app: Add and use windows_actions_dock_to_action_name()

This commit is contained in:
Martin Nordholts 2009-09-14 23:36:03 +02:00
parent 531c3d6253
commit 8ffda9d20f
3 changed files with 19 additions and 11 deletions

View File

@ -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 */ /* private functions */
@ -271,8 +280,7 @@ windows_actions_dock_added (GimpDialogFactory *factory,
{ {
GtkAction *action; GtkAction *action;
GimpActionEntry entry; GimpActionEntry entry;
gchar *action_name = g_strdup_printf ("windows-dock-%04d", gchar *action_name = windows_actions_dock_to_action_name (dock);
gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
entry.name = action_name; entry.name = action_name;
entry.stock_id = NULL; entry.stock_id = NULL;
@ -309,8 +317,7 @@ windows_actions_dock_removed (GimpDialogFactory *factory,
GimpActionGroup *group) GimpActionGroup *group)
{ {
GtkAction *action; GtkAction *action;
gchar *action_name = g_strdup_printf ("windows-dock-%04d", gchar *action_name = windows_actions_dock_to_action_name (dock);
gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
@ -328,8 +335,7 @@ windows_actions_dock_notify (GimpDock *dock,
GtkAction *action; GtkAction *action;
gchar *action_name; gchar *action_name;
action_name = g_strdup_printf ("windows-dock-%04d", action_name = windows_actions_dock_to_action_name (dock);
gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
g_free (action_name); g_free (action_name);

View File

@ -19,9 +19,10 @@
#define __WINDOWS_ACTIONS_H__ #define __WINDOWS_ACTIONS_H__
void windows_actions_setup (GimpActionGroup *group); void windows_actions_setup (GimpActionGroup *group);
void windows_actions_update (GimpActionGroup *group, void windows_actions_update (GimpActionGroup *group,
gpointer data); gpointer data);
gchar * windows_actions_dock_to_action_name (GimpDock *dock);
#endif /* __WINDOWS_ACTIONS_H__ */ #endif /* __WINDOWS_ACTIONS_H__ */

View File

@ -41,6 +41,8 @@
#include "dialogs/dialogs.h" #include "dialogs/dialogs.h"
#include "actions/windows-actions.h"
#include "windows-menu.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"); ui_path = g_object_get_data (G_OBJECT (manager), "image-menu-ui-path");
action_name = g_strdup_printf ("windows-dock-%04d", action_name = windows_actions_dock_to_action_name (dock);
gimp_dock_window_get_id (GIMP_DOCK_WINDOW (dock)));
action_path = g_strdup_printf ("%s/Windows/Docks", action_path = g_strdup_printf ("%s/Windows/Docks",
ui_path); ui_path);