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

Jerome Guelfucci jeromeg at xfce.org
Mon Dec 1 11:22:09 CET 2008


Author: jeromeg
Date: 2008-12-01 10:22:09 +0000 (Mon, 01 Dec 2008)
New Revision: 6243

Modified:
   xfce4-screenshooter-plugin/trunk/ChangeLog
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c
   xfce4-screenshooter-plugin/trunk/src/main.c
Log:
  * src/main.c: check for GTK_RESPONSE_OK instead of something !=
    GTK_RESPONSE_CANCEL.
  * lib/screenshooter-dialogs.c:
    - (set_default_item) set first item as active if no item was found,
    change the prototype.
    - (screenshooter_dialog_new) use the new set_default_item, don't set
    the first item as active without updating sd->app. Fixes the opening
    of screenshots with the first item of the combobox.


Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog	2008-12-01 10:05:19 UTC (rev 6242)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog	2008-12-01 10:22:09 UTC (rev 6243)
@@ -1,5 +1,16 @@
 2008-12-01 jeromeg
 
+  * src/main.c: check for GTK_RESPONSE_OK instead of something !=
+    GTK_RESPONSE_CANCEL.
+  * lib/screenshooter-dialogs.c:
+    - (set_default_item) set first item as active if no item was found,
+    change the prototype.
+    - (screenshooter_dialog_new) use the new set_default_item, don't set
+    the first item as active without updating sd->app. Fixes the opening
+    of screenshots with the first item of the combobox.
+
+2008-12-01 jeromeg
+
   * src/main.c: Show the dialog again after taking a screenshot, the
     application is exited when the user presses the Cancel Button.
 

Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c	2008-12-01 10:05:19 UTC (rev 6242)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c	2008-12-01 10:22:09 UTC (rev 6243)
@@ -66,7 +66,7 @@
 populate_liststore                 (GtkListStore       *liststore);
 static void 
 set_default_item                   (GtkWidget          *combobox, 
-                                    gchar              *default_app);                                               
+                                    ScreenshotData     *sd);                                               
                                                                                                
 #endif                                                                                                                                                                         
                                       
@@ -363,31 +363,47 @@
 
 
 /* Select the sd->app item in the combobox */
-static void set_default_item (GtkWidget     *combobox, 
-                              gchar         *default_app)
+static void set_default_item (GtkWidget       *combobox, 
+                              ScreenshotData  *sd)
 {
   GtkTreeModel *model = 
     gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
   GtkTreeIter iter; 
   gchar *command = NULL;
+  gboolean found = FALSE;
   
   /* Get the first iter */
-  gtk_tree_model_get_iter_first (model , &iter);    
-  
+  gtk_tree_model_get_iter_first (model , &iter);
+       
   /* Loop until finding the appropirate item, if any */
   do
     {
       gtk_tree_model_get (model, &iter, 2, &command, -1);
       
-      if (g_str_equal (command, default_app))
+      if (g_str_equal (command, sd->app))
         {
           gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-          break;
+          
+          found = TRUE;
         }
       
       g_free (command);      
     }
-  while (gtk_tree_model_iter_next (model, &iter)); 
+  while (gtk_tree_model_iter_next (model, &iter));
+  
+  /* If no suitable item was found, set the first item as active and
+   * set sd->app accordingly. */
+  if (!found)
+    {
+      gtk_tree_model_get_iter_first (model , &iter);
+      gtk_tree_model_get (model, &iter, 2, &command, -1);
+      
+      gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+      
+      g_free (sd->app);
+      
+      sd->app = command;
+    }
 }                              
 #endif
 
@@ -833,11 +849,9 @@
                                   "pixbuf", 0, NULL);                                  
   
   populate_liststore (liststore);
+    
+  set_default_item (combobox, sd);
   
-  gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
-  
-  set_default_item (combobox, sd->app);
-  
   gtk_box_pack_start (GTK_BOX (open_with_box), 
                       combobox, FALSE, 
                       FALSE, 0);

Modified: xfce4-screenshooter-plugin/trunk/src/main.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/src/main.c	2008-12-01 10:05:19 UTC (rev 6242)
+++ xfce4-screenshooter-plugin/trunk/src/main.c	2008-12-01 10:22:09 UTC (rev 6243)
@@ -192,7 +192,7 @@
       /* Show the dialog and take the screenshot until the application
        * is exited */
       
-      while (response != GTK_RESPONSE_CANCEL)
+      while (response == GTK_RESPONSE_OK)
         {
           /* Set the dialog up */
           dialog = screenshooter_dialog_new (sd, FALSE);




More information about the Goodies-commits mailing list