[Goodies-commits] r7681 - in xfce4-screenshooter/trunk: . docs/manual/es docs/manual/es/images lib

Jerome Guelfucci jeromeg at xfce.org
Sun Jul 5 23:52:25 CEST 2009


Author: jeromeg
Date: 2009-07-05 21:52:25 +0000 (Sun, 05 Jul 2009)
New Revision: 7681

Modified:
   xfce4-screenshooter/trunk/ChangeLog
   xfce4-screenshooter/trunk/docs/manual/es/
   xfce4-screenshooter/trunk/docs/manual/es/images/
   xfce4-screenshooter/trunk/lib/Makefile.am
   xfce4-screenshooter/trunk/lib/exo-simple-job.c
   xfce4-screenshooter/trunk/lib/katze-throbber.c
   xfce4-screenshooter/trunk/lib/screenshooter-capture.c
   xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c
   xfce4-screenshooter/trunk/lib/screenshooter-simple-job.c
   xfce4-screenshooter/trunk/lib/screenshooter-utils.c
   xfce4-screenshooter/trunk/lib/screenshooter-zimagez.c
   xfce4-screenshooter/trunk/lib/sexy-url-label.c
Log:
Fix build with full debugging. Factorise some code.

The code now builds with the flags set by xfce4-dev-tools in trunk. Do
not escape user and password in screenshooter-zimagez.c, it fails. Move
some code to extra functions in this file.



Modified: xfce4-screenshooter/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter/trunk/ChangeLog	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/ChangeLog	2009-07-05 21:52:25 UTC (rev 7681)
@@ -1,6 +1,14 @@
+2009-07-05 jeromeg
+
+Fix build with full debugging. Factorise some code.
+
+The code now builds with the flags set by xfce4-dev-tools in trunk. Do
+not escape user and password in screenshooter-zimagez.c, it fails. Move
+some code to extra functions in this file.
+
 2009-06-16 jeromeg
 
-Post release version bump. Re-add svn tag.:wq
+Post release version bump. Re-add svn tag.
 
 2009-06-14 jeromeg
 


Property changes on: xfce4-screenshooter/trunk/docs/manual/es
___________________________________________________________________
Added: svn:ignore
   + Makefile
Makefile.in
*.xml



Property changes on: xfce4-screenshooter/trunk/docs/manual/es/images
___________________________________________________________________
Added: svn:ignore
   + Makefile
Makefile.in


Modified: xfce4-screenshooter/trunk/lib/Makefile.am
===================================================================
--- xfce4-screenshooter/trunk/lib/Makefile.am	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/Makefile.am	2009-07-05 21:52:25 UTC (rev 7681)
@@ -74,9 +74,11 @@
 	&& echo timestamp > $(@F)
 
 screenshooter-marshal.c: screenshooter-marshal.list Makefile
-	( cd $(srcdir) && glib-genmarshal \
-		--prefix=_screenshooter_marshal \
-		--body screenshooter-marshal.list ) >> xgen-emc \
+	cd $(srcdir) \
+	&& echo "#include \"screenshooter-marshal.h\"" > xgen-emc \
+	&& glib-genmarshal \
+	--prefix=_screenshooter_marshal \
+	--body screenshooter-marshal.list >> xgen-emc \
 	&& cp xgen-emc screenshooter-marshal.c \
 	&& rm -f xgen-emc
 

Modified: xfce4-screenshooter/trunk/lib/exo-simple-job.c
===================================================================
--- xfce4-screenshooter/trunk/lib/exo-simple-job.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/exo-simple-job.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -185,7 +185,7 @@
   va_list       var_args;
   GValue        value = { 0, };
   gchar        *error_message;
-  gint          n;
+  guint         n;
 
   /* allocate and initialize the simple job */
   simple_job = g_object_new (EXO_TYPE_SIMPLE_JOB, NULL);

Modified: xfce4-screenshooter/trunk/lib/katze-throbber.c
===================================================================
--- xfce4-screenshooter/trunk/lib/katze-throbber.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/katze-throbber.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -143,15 +143,20 @@
 static void
 katze_throbber_class_init (KatzeThrobberClass* class)
 {
-    GObjectClass* gobject_class = G_OBJECT_CLASS (class);
+    GObjectClass* gobject_class;
+    GtkObjectClass* object_class;
+    GtkWidgetClass* widget_class;
+    GParamFlags flags;
+    
+    gobject_class = G_OBJECT_CLASS (class);
     gobject_class->dispose = katze_throbber_dispose;
     gobject_class->set_property = katze_throbber_set_property;
     gobject_class->get_property = katze_throbber_get_property;
 
-    GtkObjectClass* object_class = GTK_OBJECT_CLASS (class);
+    object_class = GTK_OBJECT_CLASS (class);
     object_class->destroy = katze_throbber_destroy;
-
-    GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (class);
+    
+    widget_class = GTK_WIDGET_CLASS (class);
     widget_class->realize = katze_throbber_realize;
     widget_class->unrealize = katze_throbber_unrealize;
     widget_class->map = katze_throbber_map;
@@ -160,9 +165,8 @@
     widget_class->screen_changed = katze_throbber_screen_changed;
     widget_class->size_request = katze_throbber_size_request;
     widget_class->expose_event = katze_throbber_expose_event;
-
-    GParamFlags flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
-
+    
+    flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT;
     g_object_class_install_property (gobject_class,
                                      PROP_ICON_SIZE,
                                      g_param_spec_int (
@@ -890,6 +894,8 @@
     }
     else
     {
+        gint cols, rows;
+      
         if (G_UNLIKELY (throbber->icon_name && !throbber->pixbuf))
         {
             icon_theme_changed (KATZE_THROBBER (widget));
@@ -903,8 +909,8 @@
             }
         }
 
-        gint cols = gdk_pixbuf_get_width (throbber->pixbuf) / throbber->width;
-        gint rows = gdk_pixbuf_get_height (throbber->pixbuf) / throbber->height;
+        cols = gdk_pixbuf_get_width (throbber->pixbuf) / throbber->width;
+        rows = gdk_pixbuf_get_height (throbber->pixbuf) / throbber->height;
 
         if (G_UNLIKELY (cols == 1 && cols == rows))
         {

Modified: xfce4-screenshooter/trunk/lib/screenshooter-capture.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-capture.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/screenshooter-capture.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -206,12 +206,8 @@
 *get_rectangle_screenshot (void)
 {
   GdkPixbuf *screenshot = NULL;
+  GdkWindow *root_window;
 
-  /* Get root window */
-  TRACE ("Get the root window");
-
-  GdkWindow *root_window =  gdk_get_default_root_window ();
-
   GdkGCValues gc_values;
   GdkGC *gc;
   GdkGrabStatus grabstatus_mouse, grabstatus_keyboard;
@@ -235,6 +231,10 @@
   gboolean cancelled = FALSE;
   gint x, y, w, h;
 
+  /* Get root window */
+  TRACE ("Get the root window");
+  root_window = gdk_get_default_root_window ();
+
   /*Set up graphics context for a XOR rectangle that will be drawn as
    * the user drags the mouse */
   TRACE ("Initialize the graphics context");

Modified: xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/screenshooter-dialogs.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -266,7 +266,7 @@
   gboolean exists = TRUE;
   GFile *directory;
   GFile *file;
-  gchar *basename;
+  gchar *base_name;
   gint i;
 
   if (G_UNLIKELY (uri == NULL))
@@ -277,42 +277,40 @@
     }
 
   TRACE ("Get the folder corresponding to the URI");
-
   directory = g_file_new_for_uri (uri);
+  base_name = g_strdup (_("Screenshot.png"));
 
-  basename = g_strdup (_("Screenshot.png"));
+  file = g_file_get_child (directory, base_name);
 
-  file = g_file_get_child (directory, basename);
-
   if (!g_file_query_exists (file, NULL))
     {
       g_object_unref (file);
       g_object_unref (directory);
 
-      return basename;
+      return base_name;
     }
 
   g_object_unref (file);
-  g_free (basename);
+  g_free (base_name);
 
   for (i = 1; exists; ++i)
     {
-      basename = g_strdup_printf (_("Screenshot-%d.png"), i);
+      base_name = g_strdup_printf (_("Screenshot-%d.png"), i);
 
-      file = g_file_get_child (directory, basename);
+      file = g_file_get_child (directory, base_name);
 
       if (!g_file_query_exists (file, NULL))
         exists = FALSE;
 
       if (exists)
-        g_free (basename);
+        g_free (base_name);
 
       g_object_unref (file);
     }
 
   g_object_unref (directory);
 
-  return basename;
+  return base_name;
 }
 
 

Modified: xfce4-screenshooter/trunk/lib/screenshooter-simple-job.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-simple-job.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/screenshooter-simple-job.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -158,7 +158,7 @@
   va_list var_args;
   GValue value = { 0, };
   gchar *error_message;
-  gint n;
+  guint n;
 
   /* allocate and initialize the simple job */
   simple_job = g_object_new (SCREENSHOOTER_TYPE_SIMPLE_JOB, NULL);

Modified: xfce4-screenshooter/trunk/lib/screenshooter-utils.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-utils.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/screenshooter-utils.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -206,7 +206,7 @@
 
 
 
-gchar *screenshooter_get_home_uri ()
+gchar *screenshooter_get_home_uri (void)
 {
   gchar *result = NULL;
   const gchar *home_path = g_getenv ("HOME");

Modified: xfce4-screenshooter/trunk/lib/screenshooter-zimagez.c
===================================================================
--- xfce4-screenshooter/trunk/lib/screenshooter-zimagez.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/screenshooter-zimagez.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -48,6 +48,7 @@
 static void              open_url_hook             (SexyUrlLabel      *url_label,
                                                     gchar             *url,
                                                     gpointer           user_data);
+static gboolean          has_empty_field           (GtkListStore      *liststore);
 static ScreenshooterJob *zimagez_upload_to_zimagez (const gchar       *file_name,
                                                     gchar             *last_user);
 static gboolean          zimagez_upload_job        (ScreenshooterJob  *job,
@@ -93,6 +94,30 @@
 
 
 static gboolean
+has_empty_field (GtkListStore *liststore)
+{
+  GtkTreeIter iter;
+  gboolean result = FALSE;
+  
+  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (liststore), &iter);
+
+  do
+    {
+      gchar *field = NULL;
+
+      gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter, 1, &field, -1);
+      result = result || g_str_equal (field, "");
+
+      g_free (field);
+    }
+  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
+
+  return result;
+}
+
+
+
+static gboolean
 zimagez_upload_job (ScreenshooterJob *job, GValueArray *param_values, GError **error)
 {
   const gchar *encoded_data;
@@ -155,7 +180,6 @@
   image_path = g_value_get_string (g_value_array_get_nth (param_values, 0));
 
   /* Start the user XML RPC session */
-
   exo_job_info_message (EXO_JOB (job), _("Initialize the connection..."));
 
   TRACE ("Initialize the RPC environment");
@@ -182,11 +206,9 @@
     }
 
   TRACE ("Get the information liststore ready.");
-
   liststore = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
 
   TRACE ("Append the user");
-
   gtk_list_store_append (liststore, &iter);
   gtk_list_store_set (liststore, &iter,
                       0, g_strdup ("user"),
@@ -194,7 +216,6 @@
                       -1);
 
   TRACE ("Append the password");
-
   gtk_list_store_append (liststore, &iter);
   gtk_list_store_set (liststore, &iter,
                       0, g_strdup ("password"),
@@ -202,7 +223,6 @@
                       -1);
 
   TRACE ("Append the title");
-
   gtk_list_store_append (liststore, &iter);
   gtk_list_store_set (liststore, &iter,
                       0, g_strdup ("title"),
@@ -210,15 +230,12 @@
                       -1);
 
   TRACE ("Append the comment");
-
   gtk_list_store_append (liststore, &iter);
   gtk_list_store_set (liststore, &iter,
                       0, g_strdup ("comment"),
                       1, comment,
                       -1);
 
-  TRACE ("Ask for the user information");
-
   screenshooter_job_ask_info (job, liststore,
                               _("Please file the following fields with your "
                                 "<a href=\"http://www.zimagez.com\">ZimageZ</a> \n"
@@ -260,9 +277,6 @@
 
   while (!response)
     {
-      gboolean empty_field = FALSE;
-      gchar *escaped_user, *escaped_password;
-
       if (exo_job_set_error_if_cancelled (EXO_JOB (job), error))
         {
           xmlrpc_env_clean (&env);
@@ -283,24 +297,9 @@
       exo_job_info_message (EXO_JOB (job), _("Check the user information..."));
 
       /* Test if one of the information fields is empty */
-      TRACE ("Check for empty fields");
-      gtk_tree_model_get_iter_first (GTK_TREE_MODEL (liststore), &iter);
-
-      do
+      if (has_empty_field (liststore))
         {
-          gchar *field = NULL;
-
-          gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter, 1, &field, -1);
-          empty_field = empty_field || g_str_equal (field, "");
-
-          g_free (field);
-        }
-      while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
-
-      if (empty_field)
-        {
           TRACE ("One of the fields was empty, let the user file it.");
-
           screenshooter_job_ask_info (job, liststore,
                                       _("<span weight=\"bold\" foreground=\"darkred\" "
                                         "stretch=\"semiexpanded\">You must fill all the "
@@ -309,8 +308,6 @@
         }
 
       encoded_password = g_strdup (g_strreverse (rot13 (password)));
-      escaped_password = g_markup_escape_text (encoded_password, -1);
-      escaped_user = g_markup_escape_text (user, -1);
 
       TRACE ("User: %s", user);
 
@@ -320,11 +317,8 @@
       exo_job_info_message (EXO_JOB (job), _("Login on ZimageZ..."));
 
       resultP = xmlrpc_client_call (&env, serverurl, method_login,
-                                    "(ss)", escaped_user, escaped_password);
+                                    "(ss)", user, encoded_password);
 
-      g_free (escaped_password);
-      g_free (escaped_user);
-
       if (env.fault_occurred)
         {
           GError *tmp_error =

Modified: xfce4-screenshooter/trunk/lib/sexy-url-label.c
===================================================================
--- xfce4-screenshooter/trunk/lib/sexy-url-label.c	2009-07-05 06:37:32 UTC (rev 7680)
+++ xfce4-screenshooter/trunk/lib/sexy-url-label.c	2009-07-05 21:52:25 UTC (rev 7681)
@@ -218,7 +218,7 @@
 	GdkModifierType state;
 	gboolean found = FALSE;
 	GList *l;
-	int index, trailing;
+	int ind, trailing;
 	int x, y;
 	SexyUrlLabelLink *link = NULL;
 
@@ -234,13 +234,13 @@
 	if (pango_layout_xy_to_index(layout,
 								 (x - priv->layout_x) * PANGO_SCALE,
 								 (y - priv->layout_y) * PANGO_SCALE,
-								 &index, &trailing))
+								 &ind, &trailing))
 	{
 		for (l = priv->links; l != NULL; l = l->next)
 		{
 			link = (SexyUrlLabelLink *)l->data;
 
-			if (index >= link->start && index <= link->end)
+			if (ind >= link->start && ind <= link->end)
 			{
 				found = TRUE;
 				break;




More information about the Goodies-commits mailing list