[gimp] Bug 624824 - use gtk-image-menu-item-set-always-show-image on some menu items



commit 61025c6023653bc2b42746b73e6468f0a47ede60
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 2 15:38:55 2011 +0200

    Bug 624824 - use gtk-image-menu-item-set-always-show-image on some menu items
    
    Always show icons for:
    
    - Fill FG/BG/Pattern
    - Rotate
    - Recently opened
    - Open images

 app/actions/drawable-actions.c |    9 +++++++++
 app/actions/edit-actions.c     |    9 +++++++++
 app/actions/file-actions.c     |    2 ++
 app/actions/image-actions.c    |    9 +++++++++
 app/actions/windows-actions.c  |    3 +++
 app/widgets/gimpactiongroup.c  |   23 +++++++++++++++++++++++
 app/widgets/gimpactiongroup.h  |    3 +++
 7 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index fc6bd52..0b835a9 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -149,6 +149,15 @@ drawable_actions_setup (GimpActionGroup *group)
                                       drawable_rotate_actions,
                                       G_N_ELEMENTS (drawable_rotate_actions),
                                       G_CALLBACK (drawable_rotate_cmd_callback));
+
+#define SET_ALWAYS_SHOW_IMAGE(action,show) \
+        gimp_action_group_set_action_always_show_image (group, action, show)
+
+  SET_ALWAYS_SHOW_IMAGE ("drawable-rotate-90",  TRUE);
+  SET_ALWAYS_SHOW_IMAGE ("drawable-rotate-180", TRUE);
+  SET_ALWAYS_SHOW_IMAGE ("drawable-rotate-270", TRUE);
+
+#undef SET_ALWAYS_SHOW_IMAGE
 }
 
 void
diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c
index ac89422..f57d05a 100644
--- a/app/actions/edit-actions.c
+++ b/app/actions/edit-actions.c
@@ -252,6 +252,15 @@ edit_actions_setup (GimpActionGroup *group)
 
   pattern = gimp_context_get_pattern (context);
   edit_actions_pattern_changed (context, pattern, group);
+
+#define SET_ALWAYS_SHOW_IMAGE(action,show) \
+        gimp_action_group_set_action_always_show_image (group, action, show)
+
+  SET_ALWAYS_SHOW_IMAGE ("edit-fill-fg",      TRUE);
+  SET_ALWAYS_SHOW_IMAGE ("edit-fill-bg",      TRUE);
+  SET_ALWAYS_SHOW_IMAGE ("edit-fill-pattern", TRUE);
+
+#undef SET_ALWAYS_SHOW_IMAGE
 }
 
 void
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index c3fa676..2a3bbe9 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -207,6 +207,8 @@ file_actions_setup (GimpActionGroup *group)
       GtkAction *action;
 
       gimp_action_group_set_action_visible (group, entries[i].name, FALSE);
+      gimp_action_group_set_action_always_show_image (group, entries[i].name,
+                                                      TRUE);
 
       action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                             entries[i].name);
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 42a18e1..37ad96e 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -213,6 +213,15 @@ image_actions_setup (GimpActionGroup *group)
                                       image_rotate_actions,
                                       G_N_ELEMENTS (image_rotate_actions),
                                       G_CALLBACK (image_rotate_cmd_callback));
+
+#define SET_ALWAYS_SHOW_IMAGE(action,show) \
+        gimp_action_group_set_action_always_show_image (group, action, show)
+
+  SET_ALWAYS_SHOW_IMAGE ("image-rotate-90",  TRUE);
+  SET_ALWAYS_SHOW_IMAGE ("image-rotate-180", TRUE);
+  SET_ALWAYS_SHOW_IMAGE ("image-rotate-270", TRUE);
+
+#undef SET_ALWAYS_SHOW_IMAGE
 }
 
 void
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index 63d6507..e581cc1 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -270,6 +270,9 @@ windows_actions_image_notify (GimpDisplay      *display,
 
           gimp_action_group_add_actions (group, NULL, &entry, 1);
 
+          gimp_action_group_set_action_always_show_image (group, action_name,
+                                                          TRUE);
+
           action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                                 action_name);
 
diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c
index de28bc8..a399c4b 100644
--- a/app/widgets/gimpactiongroup.c
+++ b/app/widgets/gimpactiongroup.c
@@ -925,3 +925,26 @@ gimp_action_group_set_action_hide_empty (GimpActionGroup *group,
 
   g_object_set (action, "hide-if-empty", hide_empty ? TRUE : FALSE, NULL);
 }
+
+void
+gimp_action_group_set_action_always_show_image (GimpActionGroup *group,
+                                                const gchar     *action_name,
+                                                gboolean         always_show_image)
+{
+  GtkAction *action;
+
+  g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
+  g_return_if_fail (action_name != NULL);
+
+  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
+
+  if (! action)
+    {
+      g_warning ("%s: Unable to set \"always-show-image\" of action "
+                 "which doesn't exist: %s",
+                 G_STRFUNC, action_name);
+      return;
+    }
+
+  gtk_action_set_always_show_image (action, always_show_image);
+}
diff --git a/app/widgets/gimpactiongroup.h b/app/widgets/gimpactiongroup.h
index b9ddd74..490918d 100644
--- a/app/widgets/gimpactiongroup.h
+++ b/app/widgets/gimpactiongroup.h
@@ -200,6 +200,9 @@ void          gimp_action_group_set_action_viewable   (GimpActionGroup *group,
 void          gimp_action_group_set_action_hide_empty (GimpActionGroup *group,
                                                        const gchar     *action_name,
                                                        gboolean         hide_empty);
+void   gimp_action_group_set_action_always_show_image (GimpActionGroup *group,
+                                                       const gchar     *action_name,
+                                                       gboolean         always_show_image);
 
 
 



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