[gimp] app: Add and use windows_actions_dock_to_action_name()



commit 8ffda9d20f4d9c669835b2801e693c28658556d3
Author: Martin Nordholts <martinn src gnome org>
Date:   Mon Sep 14 23:36:03 2009 +0200

    app: Add and use windows_actions_dock_to_action_name()

 app/actions/windows-actions.c |   18 ++++++++++++------
 app/actions/windows-actions.h |    7 ++++---
 app/menus/windows-menu.c      |    5 +++--
 3 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index c1a090b..36299a6 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -158,6 +158,15 @@ windows_actions_update (GimpActionGroup *group,
 {
 }
 
+gchar *
+windows_actions_dock_to_action_name (GimpDock *dock)
+{
+  g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
+
+  return g_strdup_printf ("windows-dock-%04d",
+                          gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
+}
+
 
 /*  private functions  */
 
@@ -271,8 +280,7 @@ windows_actions_dock_added (GimpDialogFactory *factory,
 {
   GtkAction       *action;
   GimpActionEntry  entry;
-  gchar           *action_name = g_strdup_printf ("windows-dock-%04d",
-                                                  gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
+  gchar           *action_name = windows_actions_dock_to_action_name (dock);
 
   entry.name        = action_name;
   entry.stock_id    = NULL;
@@ -309,8 +317,7 @@ windows_actions_dock_removed (GimpDialogFactory *factory,
                               GimpActionGroup   *group)
 {
   GtkAction *action;
-  gchar     *action_name = g_strdup_printf ("windows-dock-%04d",
-                                            gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
+  gchar     *action_name = windows_actions_dock_to_action_name (dock);
 
   action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
 
@@ -328,8 +335,7 @@ windows_actions_dock_notify (GimpDock         *dock,
   GtkAction *action;
   gchar     *action_name;
 
-  action_name = g_strdup_printf ("windows-dock-%04d",
-                                 gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
+  action_name = windows_actions_dock_to_action_name (dock);
   action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
   g_free (action_name);
 
diff --git a/app/actions/windows-actions.h b/app/actions/windows-actions.h
index 3fec14f..8aeaa23 100644
--- a/app/actions/windows-actions.h
+++ b/app/actions/windows-actions.h
@@ -19,9 +19,10 @@
 #define __WINDOWS_ACTIONS_H__
 
 
-void   windows_actions_setup  (GimpActionGroup *group);
-void   windows_actions_update (GimpActionGroup *group,
-                               gpointer         data);
+void    windows_actions_setup               (GimpActionGroup *group);
+void    windows_actions_update              (GimpActionGroup *group,
+                                             gpointer         data);
+gchar * windows_actions_dock_to_action_name (GimpDock        *dock);
 
 
 #endif /* __WINDOWS_ACTIONS_H__ */
diff --git a/app/menus/windows-menu.c b/app/menus/windows-menu.c
index 623b441..81e53fb 100644
--- a/app/menus/windows-menu.c
+++ b/app/menus/windows-menu.c
@@ -41,6 +41,8 @@
 
 #include "dialogs/dialogs.h"
 
+#include "actions/windows-actions.h"
+
 #include "windows-menu.h"
 
 
@@ -256,8 +258,7 @@ windows_menu_dock_added (GimpDialogFactory *factory,
 
   ui_path = g_object_get_data (G_OBJECT (manager), "image-menu-ui-path");
 
-  action_name = g_strdup_printf ("windows-dock-%04d",
-                                 gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
+  action_name = windows_actions_dock_to_action_name (dock);
   action_path = g_strdup_printf ("%s/Windows/Docks",
                                  ui_path);
 



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