[Goodies-commits] r7397 - in xfce4-screenshooter/trunk: . lib src

Jerome Guelfucci jeromeg at xfce.org
Sat May 23 18:25:42 CEST 2009


Author: jeromeg
Date: 2009-05-23 16:25:42 +0000 (Sat, 23 May 2009)
New Revision: 7397

Modified:
   xfce4-screenshooter/trunk/ChangeLog
   xfce4-screenshooter/trunk/TODO
   xfce4-screenshooter/trunk/configure.ac.in
   xfce4-screenshooter/trunk/lib/Makefile.am
   xfce4-screenshooter/trunk/lib/screenshooter-actions.c
   xfce4-screenshooter/trunk/lib/screenshooter-actions.h
   xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c
   xfce4-screenshooter/trunk/lib/screenshooter-global.h
   xfce4-screenshooter/trunk/lib/screenshooter-utils.c
   xfce4-screenshooter/trunk/src/main.c
Log:
	* Only build the ZimageZ stuff if the dependencies are
	  installed. Makes libcurl and xmlrpc-c optional.


Modified: xfce4-screenshooter/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter/trunk/ChangeLog	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/ChangeLog	2009-05-23 16:25:42 UTC (rev 7397)
@@ -1,5 +1,10 @@
 2009-05-23 jeromeg
 
+	* Only build the ZimageZ stuff if the dependencies are
+	  installed. Makes libcurl and xmlrpc-c optional.
+
+2009-05-23 jeromeg
+
 	* configure.ac.in: check for libcurl, it is needed by the
 	  xmlrpc-c stuff.
 

Modified: xfce4-screenshooter/trunk/TODO
===================================================================
--- xfce4-screenshooter/trunk/TODO	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/TODO	2009-05-23 16:25:42 UTC (rev 7397)
@@ -10,7 +10,6 @@
 * Fix last user.
 * Improve the results dialog with a text area and URL in tooltips.
 * Add a pulsy progress bar for the zimagez upload.
-* Make the zimagez stuff optionnal.
 * Update the documentation.
 * Check for leaks.
 

Modified: xfce4-screenshooter/trunk/configure.ac.in
===================================================================
--- xfce4-screenshooter/trunk/configure.ac.in	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/configure.ac.in	2009-05-23 16:25:42 UTC (rev 7397)
@@ -56,8 +56,13 @@
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.16.0])
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.16.0])
-XDT_CHECK_PACKAGE([CURL], [libcurl], [7])
 
+dnl ************************************
+dnl *** Check for optional packages ***
+dnl ************************************
+
+XDT_CHECK_OPTIONAL_PACKAGE([CURL], [libcurl], [7])
+
 dnl **************************
 dnl *** Check for xmlrpc-c ***
 dnl **************************
@@ -73,12 +78,10 @@
   AC_MSG_CHECKING([XMLRPC_LIBS])
   XMLRPC_LIBS="`$XMLRPC_CONFIG --libs client`"
   AC_MSG_RESULT([$XMLRPC_LIBS])
-
-  AC_SUBST([XMLRPC_CFLAGS])
-  AC_SUBST([XMLRPC_LIBS])
-else
-  AC_MSG_ERROR(Xmlrpc was not found on your system.)
 fi
+AM_CONDITIONAL([HAVE_XMLRPC], [test x"$XMLRPC_CONFIG" != x"no"])
+AC_SUBST([XMLRPC_CFLAGS])
+AC_SUBST([XMLRPC_LIBS])
 
 dnl **************************
 dnl *** Check for xsltproc ***
@@ -150,6 +153,15 @@
 echo ""
 
 echo "  * Debugging support:             $enable_debug"
+if test x"$CURL_FOUND" = x"yes"; then
+  if test x"$XMLRPC_CONFIG" != x"no"; then
+    echo "  * ZimageZ support:               yes"
+  else
+    echo "  * ZimageZ support:               no"
+  fi
+else
+  echo "  * ZimageZ support:               no"
+fi
 
 echo ""
 echo "Maintainer Configuration:"

Modified: xfce4-screenshooter/trunk/lib/Makefile.am
===================================================================
--- xfce4-screenshooter/trunk/lib/Makefile.am	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/lib/Makefile.am	2009-05-23 16:25:42 UTC (rev 7397)
@@ -1,27 +1,17 @@
-noinst_LTLIBRARIES = 							\
+noinst_LTLIBRARIES = \
 	libscreenshooter.la
 
-libscreenshooter_built_sources = \
-	screenshooter-marshal.c screenshooter-marshal.h
-
-libscreenshooter_la_SOURCES =							\
+libscreenshooter_la_SOURCES =	\
 	$(libscreenshooter_built_sources) \
 	libscreenshooter.h \
-  exo-job.c exo-job.h \
-	exo-simple-job.c exo-simple-job.h \
 	screenshooter-actions.c screenshooter-actions.h \
 	screenshooter-capture.c screenshooter-capture.h \
   screenshooter-dialogs.c screenshooter-dialogs.h \
 	screenshooter-global.h \
-	screenshooter-job.c screenshooter-job.h \
-	screenshooter-simple-job.c screenshooter-simple-job.h \
-	screenshooter-utils.c screenshooter-utils.h \
-	screenshooter-zimagez.c screenshooter-zimagez.h \
-  sexy-url-label.c sexy-url-label.h
+	screenshooter-utils.c screenshooter-utils.h 
 
 libscreenshooter_la_CFLAGS = \
 	-I$(top_srcdir)	\
-	$(XMLRPC_CFLAGS) \
   @GTK_CFLAGS@ \
 	@GLIB_CFLAGS@ \
 	@LIBXFCE4UTIL_CFLAGS@ \
@@ -29,12 +19,32 @@
   -DPACKAGE_LOCALE_DIR=\"$(localedir)\"
 	
 libscreenshooter_la_LIBADD = \
-	$(XMLRPC_LIBS) -lxmlrpc_client\
   @GTK_LIBS@ \
 	@LIBXFCE4UTIL_LIBS@ \
 	@LIBXFCEGUI4_LIBS@ \
   @GLIB_LIBS@
 
+if HAVE_XMLRPC
+if HAVE_CURL
+
+libscreenshooter_built_sources = \
+	screenshooter-marshal.c screenshooter-marshal.h
+
+libscreenshooter_la_SOURCES +=	\
+	$(libscreenshooter_built_sources) \
+  exo-job.c exo-job.h \
+	exo-simple-job.c exo-simple-job.h \
+	screenshooter-job.c screenshooter-job.h \
+	screenshooter-simple-job.c screenshooter-simple-job.h \
+	screenshooter-zimagez.c screenshooter-zimagez.h \
+  sexy-url-label.c sexy-url-label.h
+
+libscreenshooter_la_CFLAGS += \
+	$(XMLRPC_CFLAGS)
+
+libscreenshooter_la_LIBADD += \
+	$(XMLRPC_LIBS) -lxmlrpc_client
+
 ##
 ## Rules to auto-generate built sources
 ##
@@ -71,3 +81,6 @@
 
 EXTRA_DIST = \
 	screenshooter-marshal.list
+
+endif
+endif

Modified: xfce4-screenshooter/trunk/lib/screenshooter-actions.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-actions.c	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/lib/screenshooter-actions.c	2009-05-23 16:25:42 UTC (rev 7397)
@@ -115,10 +115,14 @@
             {
               screenshooter_open_screenshot (screenshot_path, sd->app);
             }
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
           else
             {
               screenshooter_upload_to_zimagez (screenshot_path, sd->last_user);
             }
+#endif
+#endif
         }
 
       g_object_unref (temp_dir);

Modified: xfce4-screenshooter/trunk/lib/screenshooter-actions.h
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-actions.h	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/lib/screenshooter-actions.h	2009-05-23 16:25:42 UTC (rev 7397)
@@ -24,7 +24,12 @@
 #include "screenshooter-capture.h"
 #include "screenshooter-global.h"
 #include "screenshooter-dialogs.h"
+
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
 #include "screenshooter-zimagez.h"
+#endif
+#endif
 
 gboolean screenshooter_take_and_output_screenshot (ScreenshotData *sd);
 

Modified: xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c	2009-05-23 16:25:42 UTC (rev 7397)
@@ -50,9 +50,13 @@
 static void
 cb_clipboard_toggled               (GtkToggleButton    *tb,
                                     ScreenshotData     *sd);
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
 static void
 cb_zimagez_toggled                 (GtkToggleButton    *tb,
                                     ScreenshotData     *sd);
+#endif
+#endif
 static void
 cb_show_save_dialog_toggled        (GtkToggleButton    *tb,
                                     ScreenshotData     *sd);
@@ -203,6 +207,8 @@
 
 
 
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
 static void cb_zimagez_toggled (GtkToggleButton *tb, ScreenshotData *sd)
 {
   if (gtk_toggle_button_get_active (tb))
@@ -210,6 +216,8 @@
       sd->action = UPLOAD;
     }
 }
+#endif
+#endif
 
 
 /* Set sd->show_save_dialog when the button is toggled */
@@ -697,8 +705,14 @@
 
   GtkWidget *save_radio_button, *dir_chooser;
 
-  GtkWidget *clipboard_radio_button, *zimagez_radio_button, *open_with_radio_button;
+  GtkWidget *clipboard_radio_button, *open_with_radio_button;
 
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
+  GtkWidget *zimagez_radio_button;
+#endif
+#endif
+
   GtkListStore *liststore;
   GtkWidget *combobox;
   GtkCellRenderer *renderer, *renderer_pixbuf;
@@ -1183,6 +1197,8 @@
   cb_toggle_set_sensi (GTK_TOGGLE_BUTTON (open_with_radio_button), combobox);
 
   /* Upload to zimagez radio button */
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   zimagez_radio_button = 
     gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (save_radio_button),
 	                                               _("Host on ZimageZ"));
@@ -1201,6 +1217,8 @@
                              0, 1, 3, 4);
 
   gtk_widget_show (zimagez_radio_button);
+#endif
+#endif
 
   return dlg;
 }

Modified: xfce4-screenshooter/trunk/lib/screenshooter-global.h
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-global.h	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/lib/screenshooter-global.h	2009-05-23 16:25:42 UTC (rev 7397)
@@ -32,7 +32,11 @@
   SAVE,
   CLIPBOARD,
   OPEN,
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   UPLOAD,
+#endif
+#endif
 };
 
 
@@ -48,7 +52,11 @@
   gint close;
   gchar *screenshot_dir;
   gchar *app;
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   gchar *last_user;
+#endif
+#endif
   gboolean cli;
 }
 ScreenshotData;

Modified: xfce4-screenshooter/trunk/lib/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-utils.c	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/lib/screenshooter-utils.c	2009-05-23 16:25:42 UTC (rev 7397)
@@ -65,7 +65,11 @@
   gint close_app = 1;
   gchar *screenshot_dir = g_strdup (home_uri);
   gchar *app = g_strdup ("none");
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   gchar *last_user = g_strdup ("");
+#endif
+#endif
 
   if (G_LIKELY (file != NULL))
     {
@@ -87,8 +91,12 @@
           g_free (app);
           app = g_strdup (xfce_rc_read_entry (rc, "app", "none"));
 
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
           g_free (last_user);
           last_user = g_strdup (xfce_rc_read_entry (rc, "last_user", ""));
+#endif
+#endif
 
           g_free (screenshot_dir);
           screenshot_dir =
@@ -111,7 +119,11 @@
   sd->close = close_app;
   sd->screenshot_dir = screenshot_dir;
   sd->app = app;
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   sd->last_user = last_user;
+#endif
+#endif
 }
 
 
@@ -143,12 +155,15 @@
   xfce_rc_write_int_entry (rc, "close", sd->close);
   xfce_rc_write_entry (rc, "screenshot_dir", sd->screenshot_dir);
   xfce_rc_write_entry (rc, "app", sd->app);
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   xfce_rc_write_entry (rc, "last_user", sd->last_user);
+#endif
+#endif
 
   TRACE ("Flush and close the rc file");
 
   xfce_rc_flush (rc);
-
   xfce_rc_close (rc);
 }
 

Modified: xfce4-screenshooter/trunk/src/main.c
===================================================================
--- xfce4-screenshooter/trunk/src/main.c	2009-05-23 14:34:14 UTC (rev 7396)
+++ xfce4-screenshooter/trunk/src/main.c	2009-05-23 16:25:42 UTC (rev 7397)
@@ -34,7 +34,11 @@
 gboolean fullscreen = FALSE;
 gboolean no_save_dialog = FALSE;
 gboolean hide_mouse = FALSE;
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
 gboolean upload = FALSE;
+#endif
+#endif
 gchar *screenshot_dir;
 gchar *application;
 gint delay = 0;
@@ -81,11 +85,15 @@
     N_("Directory where the screenshot will be saved"),
     NULL
   },
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL  
   {
     "upload", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &upload,
     N_("Upload the screenshot to ZimageZ©, a free Web hosting solution"),
     NULL
   },
+#endif
+#endif
   {
     "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
     N_("Version information"),
@@ -113,11 +121,10 @@
 {
   GError *cli_error = NULL;
   GFile *default_save_dir;
+  const gchar *rc_file;
 
   ScreenshotData *sd = g_new0 (ScreenshotData, 1);
 
-  const gchar *rc_file;
-
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
 
   /* Print a message to advise to use help when a non existing cli option is
@@ -196,11 +203,15 @@
           sd->app = application;
           sd->action = OPEN;
         }
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
       else if (upload)
         {
           sd->app = g_strdup ("none");
           sd->action = UPLOAD;
         }
+#endif
+#endif
       else
         {
           sd->app = g_strdup ("none");
@@ -250,6 +261,8 @@
       if (preferences_file != NULL)
         screenshooter_write_rc_file (preferences_file, sd);
     }
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   else if (sd->action == UPLOAD)
     {
       const gchar *preferences_file =
@@ -273,10 +286,16 @@
             }
         }
     }
+#endif
+#endif
 
   g_free (sd->screenshot_dir);
   g_free (sd->app);
+#ifdef HAVE_XMLRPC
+#ifdef HAVE_CURL
   g_free (sd->last_user);
+#endif
+#endif
   g_free (sd);
 
   TRACE ("Ciao");




More information about the Goodies-commits mailing list