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

Jerome Guelfucci jeromeg at xfce.org
Wed Nov 12 20:55:37 CET 2008


Author: jeromeg
Date: 2008-11-12 19:55:36 +0000 (Wed, 12 Nov 2008)
New Revision: 6075

Modified:
   xfce4-screenshooter-plugin/trunk/ChangeLog
   xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c
Log:
Make the show save dialog checkbox unclickable when an application is selected.

Modified: xfce4-screenshooter-plugin/trunk/ChangeLog
===================================================================
--- xfce4-screenshooter-plugin/trunk/ChangeLog	2008-11-12 18:57:54 UTC (rev 6074)
+++ xfce4-screenshooter-plugin/trunk/ChangeLog	2008-11-12 19:55:36 UTC (rev 6075)
@@ -1,5 +1,13 @@
 2008-11-12 jeromeg
 
+  * lib/screenshooter-dialogs.c
+    - (cb_combo_active_item_set_sensitive) add to make save_button insensitive
+      when an application is selected.
+    - (screenshooter_dialog_new) add a callback to the function above, set the
+      sensitiveness when creating the checkbox.
+
+2008-11-12 jeromeg
+
   * lib/screenshooter-utils.c: 
     - (screenshooter_take_screenshot) rework the window grabbing to try to fix
       bug 4601.

Modified: xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c
===================================================================
--- xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c	2008-11-12 18:57:54 UTC (rev 6074)
+++ xfce4-screenshooter-plugin/trunk/lib/screenshooter-dialogs.c	2008-11-12 19:55:36 UTC (rev 6075)
@@ -36,6 +36,8 @@
 #ifdef HAVE_GIO                                                
 static void cb_combo_active_item_changed       (GtkWidget          *box, 
                                                 ScreenshotData     *sd);
+static void cb_combo_active_item_set_sensitive (GtkWidget          *box,
+                                                GtkWidget          *button);                                                
 static void add_item                           (GAppInfo           *app_info, 
                                                 GtkWidget          *liststore);
 static void populate_liststore                 (GtkListStore       *liststore);
@@ -128,6 +130,31 @@
 
 
 
+static void cb_combo_active_item_set_sensitive (GtkWidget          *box,
+                                                GtkWidget          *button)
+{
+  GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (box));
+  GtkTreeIter iter;
+  gchar *active_command = NULL;
+   
+  gtk_combo_box_get_active_iter (GTK_COMBO_BOX (box), &iter);
+  
+  gtk_tree_model_get (model, &iter, 2, &active_command, -1);
+  
+  if (g_str_equal (active_command, "none"))
+    {
+      gtk_widget_set_sensitive (button, TRUE);
+    }
+  else
+    {
+      gtk_widget_set_sensitive (button, FALSE);
+    }
+    
+  g_free (active_command);
+}                                                
+
+
+
 /* Extract the informations from app_info and add them to the liststore. */
 static void add_item (GAppInfo *app_info, GtkWidget *liststore)
 {
@@ -365,6 +392,14 @@
     {
 		  /* Save option */
 		  save_button = gtk_check_button_new_with_mnemonic (_("Show save dialog"));
+		  
+		  #ifdef HAVE_GIO
+		  if (!g_str_equal (sd->app, "none"))
+		    {
+		      gtk_widget_set_sensitive (save_button, FALSE);
+		    }
+		  #endif
+		  
 		  gtk_widget_show (save_button);
 		  gtk_box_pack_start (GTK_BOX (options_box), save_button, FALSE, FALSE, 0);
 		  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (save_button),
@@ -457,6 +492,13 @@
   
   g_signal_connect (G_OBJECT (combobox), "changed", 
                     G_CALLBACK (cb_combo_active_item_changed), sd);
+
+  if (plugin)
+    {
+      g_signal_connect (G_OBJECT (combobox), "changed", 
+                        G_CALLBACK (cb_combo_active_item_set_sensitive), 
+                        save_button);
+    }                  
   
   gtk_widget_show_all (combobox);                    
 #endif




More information about the Goodies-commits mailing list