gimp r24934 - in trunk: . app/actions



Author: mitch
Date: Thu Feb 21 16:39:49 2008
New Revision: 24934
URL: http://svn.gnome.org/viewvc/gimp?rev=24934&view=rev

Log:
2008-02-21  Michael Natterer  <mitch gimp org>

	* app/actions/plug-in-actions.c (plug_in_actions_history_changed):
	don't call plug_in_actions_update() because that updated the
	sensitivity of *all* plug-in actions according to the properties
	of the *current* image. Instead, look up the original GtkAction of
	the history items of *this* action group and copy the sensitivity
	from that action. Fixes bug #517683.



Modified:
   trunk/ChangeLog
   trunk/app/actions/plug-in-actions.c

Modified: trunk/app/actions/plug-in-actions.c
==============================================================================
--- trunk/app/actions/plug-in-actions.c	(original)
+++ trunk/app/actions/plug-in-actions.c	Thu Feb 21 16:39:49 2008
@@ -481,9 +481,21 @@
 
   if (proc)
     {
+      GtkAction   *actual_action;
       const gchar *label;
       gchar       *repeat;
       gchar       *reshow;
+      gboolean     sensitive = FALSE;
+
+      /*  copy the sensitivity of the plug-in procedure's actual action
+       *  instead of calling plug_in_actions_update() because doing the
+       *  latter would set the sensitivity of this image's action on
+       *  all images' actions. See bug #517683.
+       */
+      actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
+                                                   GIMP_OBJECT (proc)->name);
+      if (actual_action)
+        sensitive = gtk_action_get_sensitive (actual_action);
 
       label = gimp_plug_in_procedure_get_label (proc);
 
@@ -493,6 +505,9 @@
       gimp_action_group_set_action_label (group, "plug-in-repeat", repeat);
       gimp_action_group_set_action_label (group, "plug-in-reshow", reshow);
 
+      gimp_action_group_set_action_sensitive (group, "plug-in-repeat", sensitive);
+      gimp_action_group_set_action_sensitive (group, "plug-in-reshow", sensitive);
+
       g_free (repeat);
       g_free (reshow);
     }
@@ -502,20 +517,32 @@
                                           _("Repeat Last"));
       gimp_action_group_set_action_label (group, "plug-in-reshow",
                                           _("Re-Show Last"));
+
+      gimp_action_group_set_action_sensitive (group, "plug-in-repeat", FALSE);
+      gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE);
     }
 
   for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++)
     {
       GtkAction *action;
-      gchar     *name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
+      GtkAction *actual_action;
+      gchar     *name      = g_strdup_printf ("plug-in-recent-%02d", i + 1);
+      gboolean   sensitive = FALSE;
 
       action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name);
       g_free (name);
 
       proc = gimp_plug_in_manager_history_nth (manager, i);
 
+      /*  see comment above  */
+      actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
+                                                   GIMP_OBJECT (proc)->name);
+      if (actual_action)
+        sensitive = gtk_action_get_sensitive (actual_action);
+
       g_object_set (action,
                     "visible",   TRUE,
+                    "sensitive", sensitive,
                     "procedure", proc,
                     "label",     gimp_plug_in_procedure_get_label (proc),
                     "stock-id",  gimp_plug_in_procedure_get_stock_id (proc),
@@ -536,9 +563,6 @@
                     "procedure", NULL,
                     NULL);
     }
-
-  /* update sensitivity of the actions */
-  plug_in_actions_update (group, manager->gimp);
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]