[Xfce4-commits] <xfce4-screenshooter:master> Properly fix the last user issue.

Jérôme Guelfucci noreply at xfce.org
Sun Oct 11 18:54:01 CEST 2009


Updating branch refs/heads/master
         to 9f1dfbeae19b94d694298f20015c8da04c3ef04c (commit)
       from a846ab7c026cd7befe4349f9bc4f47f6cf752483 (commit)

commit 9f1dfbeae19b94d694298f20015c8da04c3ef04c
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Oct 11 18:55:25 2009 +0200

    Properly fix the last user issue.
    
    I was doing something very ugly with the last_user string, pass it
    as a pointer to modify it. I don't even get how it could work before.

 lib/screenshooter-actions.c |    2 +-
 lib/screenshooter-zimagez.c |   14 +++++++-------
 lib/screenshooter-zimagez.h |    6 +++---
 src/main.c                  |    3 +--
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/lib/screenshooter-actions.c b/lib/screenshooter-actions.c
index 847a08f..623e4bf 100644
--- a/lib/screenshooter-actions.c
+++ b/lib/screenshooter-actions.c
@@ -101,7 +101,7 @@ gboolean screenshooter_action_idle (ScreenshotData *sd)
           if (sd->action == OPEN)
             screenshooter_open_screenshot (screenshot_path, sd->app);
           else
-            screenshooter_upload_to_zimagez (screenshot_path, sd->last_user, sd->title);
+            screenshooter_upload_to_zimagez (screenshot_path, &sd->last_user, sd->title);
         }
 
       g_object_unref (temp_dir);
diff --git a/lib/screenshooter-zimagez.c b/lib/screenshooter-zimagez.c
index 581b284..cda72f1 100644
--- a/lib/screenshooter-zimagez.c
+++ b/lib/screenshooter-zimagez.c
@@ -73,7 +73,7 @@ static void              cb_ask_for_information    (ScreenshooterJob  *job,
                                                     gpointer           unused);
 static void              cb_image_uploaded         (ScreenshooterJob  *job,
                                                     gchar             *upload_name,
-                                                    gchar             *last_user);
+                                                    gchar            **last_user);
 static void              cb_error                  (ExoJob            *job,
                                                     GError            *error,
                                                     gpointer           unused);
@@ -883,7 +883,7 @@ cb_ask_for_information (ScreenshooterJob *job,
 
 
 
-static void cb_image_uploaded (ScreenshooterJob *job, gchar *upload_name, gchar *last_user)
+static void cb_image_uploaded (ScreenshooterJob *job, gchar *upload_name, gchar **last_user)
 {
   GtkWidget *dialog;
   GtkWidget *main_alignment, *vbox;
@@ -923,15 +923,15 @@ static void cb_image_uploaded (ScreenshooterJob *job, gchar *upload_name, gchar
     g_strdup_printf ("[url=%s]\n  [img]%s[/img]\n[/url]", image_url, thumbnail_url);
 
   /* Set the last user */
-  if (last_user != NULL)
-    g_free (last_user);
+  if (*last_user != NULL)
+    g_free (*last_user);
 
   last_user_temp = g_object_get_data (G_OBJECT (job), "user");
 
   if (last_user_temp == NULL)
     last_user_temp = g_strdup ("");
 
-  last_user = g_strdup (last_user_temp);
+  *last_user = g_strdup (last_user_temp);
 
   /* Dialog */
   dialog =
@@ -1154,7 +1154,7 @@ static void cb_update_info (ExoJob *job, gchar *message, GtkWidget *label)
  **/
 
 void screenshooter_upload_to_zimagez (const gchar *image_path,
-                                      gchar       *last_user,
+                                      gchar       **last_user,
                                       gchar       *title)
 {
   ScreenshooterJob *job;
@@ -1210,7 +1210,7 @@ void screenshooter_upload_to_zimagez (const gchar *image_path,
 
   gtk_widget_show_all (GTK_DIALOG(dialog)->vbox);
 
-  job = zimagez_upload_to_zimagez (image_path, last_user, title);
+  job = zimagez_upload_to_zimagez (image_path, *last_user, title);
 
   g_signal_connect (job, "ask", (GCallback) cb_ask_for_information, NULL);
   g_signal_connect (job, "image-uploaded", (GCallback) cb_image_uploaded, last_user);
diff --git a/lib/screenshooter-zimagez.h b/lib/screenshooter-zimagez.h
index cd750a5..da0558d 100644
--- a/lib/screenshooter-zimagez.h
+++ b/lib/screenshooter-zimagez.h
@@ -33,9 +33,9 @@
 #include "sexy-url-label.h"
 #include "katze-throbber.h"
 
-void screenshooter_upload_to_zimagez (const gchar *image_path,
-                                      gchar       *last_user,
-                                      gchar       *title);
+void screenshooter_upload_to_zimagez (const gchar  *image_path,
+                                      gchar       **last_user,
+                                      gchar        *title);
 
 
 #endif
diff --git a/src/main.c b/src/main.c
index 4a9daeb..536157e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -306,8 +306,7 @@ int main (int argc, char **argv)
   g_free (sd->screenshot_dir);
   g_free (sd->title);
   g_free (sd->app);
-  if (sd->last_user)
-    g_free (sd->last_user);
+  g_free (sd->last_user);
   g_free (sd);
 
   TRACE ("Ciao");



More information about the Xfce4-commits mailing list