[gimp] app: Change GimpDialogFactory signals to "dock-window-added/removed"
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Change GimpDialogFactory signals to "dock-window-added/removed"
- Date: Sat, 26 Sep 2009 11:24:52 +0000 (UTC)
commit 62dde84e43a780ae51745cac227685256198173c
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Sep 26 13:11:42 2009 +0200
app: Change GimpDialogFactory signals to "dock-window-added/removed"
Change the GimpDialogFactory signals "dock-added" and "dock-removed"
to "dock-window-added" and "dock-window-removed". Doing this makes
sense for a couple of reasons. First of all, the dialog factory is
built around top-levels. Second of all, the listeners to the signals
(such as the "recently closed docks" construct) work on a
gtk-window-level, not a dock level.
This change is a preparation for when GimpDock will stop being a
GimpDockWindow.
app/actions/windows-actions.c | 106 +++++++++++++++++++--------------------
app/actions/windows-actions.h | 8 ++--
app/actions/windows-commands.c | 4 +-
app/menus/windows-menu.c | 92 ++++++++++++++++-----------------
app/widgets/gimpdialogfactory.c | 25 +++++----
app/widgets/gimpdialogfactory.h | 8 ++--
6 files changed, 119 insertions(+), 124 deletions(-)
---
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index de9f872..0f8aa61 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -47,32 +47,30 @@
#include "gimp-intl.h"
-static void windows_actions_display_add (GimpContainer *container,
- GimpDisplay *display,
- GimpActionGroup *group);
-static void windows_actions_display_remove (GimpContainer *container,
- GimpDisplay *display,
- GimpActionGroup *group);
-static void windows_actions_image_notify (GimpDisplay *display,
- const GParamSpec *unused,
- GimpActionGroup *group);
-
-static void windows_actions_dock_added (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpActionGroup *group);
-static void windows_actions_dock_removed (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpActionGroup *group);
-static void windows_actions_dock_notify (GimpDock *dock,
- const GParamSpec *pspec,
- GimpActionGroup *group);
-
-static void windows_actions_recent_add (GimpContainer *container,
- GimpSessionInfo *info,
- GimpActionGroup *group);
-static void windows_actions_recent_remove (GimpContainer *container,
- GimpSessionInfo *info,
- GimpActionGroup *group);
+static void windows_actions_display_add (GimpContainer *container,
+ GimpDisplay *display,
+ GimpActionGroup *group);
+static void windows_actions_display_remove (GimpContainer *container,
+ GimpDisplay *display,
+ GimpActionGroup *group);
+static void windows_actions_image_notify (GimpDisplay *display,
+ const GParamSpec *unused,
+ GimpActionGroup *group);
+static void windows_actions_dock_window_added (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpActionGroup *group);
+static void windows_actions_dock_window_removed (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpActionGroup *group);
+static void windows_actions_dock_window_notify (GimpDockWindow *dock,
+ const GParamSpec *pspec,
+ GimpActionGroup *group);
+static void windows_actions_recent_add (GimpContainer *container,
+ GimpSessionInfo *info,
+ GimpActionGroup *group);
+static void windows_actions_recent_remove (GimpContainer *container,
+ GimpSessionInfo *info,
+ GimpActionGroup *group);
static const GimpActionEntry windows_actions[] =
@@ -119,21 +117,21 @@ windows_actions_setup (GimpActionGroup *group)
windows_actions_display_add (group->gimp->displays, display, group);
}
- g_signal_connect_object (global_dock_factory, "dock-added",
- G_CALLBACK (windows_actions_dock_added),
+ g_signal_connect_object (global_dock_factory, "dock-window-added",
+ G_CALLBACK (windows_actions_dock_window_added),
group, 0);
- g_signal_connect_object (global_dock_factory, "dock-removed",
- G_CALLBACK (windows_actions_dock_removed),
+ g_signal_connect_object (global_dock_factory, "dock-window-removed",
+ G_CALLBACK (windows_actions_dock_window_removed),
group, 0);
for (list = global_dock_factory->open_dialogs;
list;
list = g_list_next (list))
{
- GimpDock *dock = list->data;
+ GimpDockWindow *dock_window = list->data;
- if (GIMP_IS_DOCK (dock))
- windows_actions_dock_added (global_dock_factory, dock, group);
+ if (GIMP_IS_DOCK_WINDOW (dock_window))
+ windows_actions_dock_window_added (global_dock_factory, dock_window, group);
}
g_signal_connect_object (global_recent_docks, "add",
@@ -160,10 +158,8 @@ windows_actions_update (GimpActionGroup *group,
}
gchar *
-windows_actions_dock_to_action_name (GimpDock *dock)
+windows_actions_dock_window_to_action_name (GimpDockWindow *dock_window)
{
- GimpDockWindow *dock_window = gimp_dock_window_from_dock (dock);
-
return g_strdup_printf ("windows-dock-%04d",
gimp_dock_window_get_id (dock_window));
}
@@ -275,13 +271,13 @@ windows_actions_image_notify (GimpDisplay *display,
}
static void
-windows_actions_dock_added (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpActionGroup *group)
+windows_actions_dock_window_added (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpActionGroup *group)
{
GtkAction *action;
GimpActionEntry entry;
- gchar *action_name = windows_actions_dock_to_action_name (dock);
+ gchar *action_name = windows_actions_dock_window_to_action_name (dock_window);
entry.name = action_name;
entry.stock_id = NULL;
@@ -300,25 +296,25 @@ windows_actions_dock_added (GimpDialogFactory *factory,
"ellipsize", PANGO_ELLIPSIZE_END,
NULL);
- g_object_set_data (G_OBJECT (action), "dock", dock);
+ g_object_set_data (G_OBJECT (action), "dock-window", dock_window);
g_free (action_name);
- g_signal_connect_object (dock, "notify::title",
- G_CALLBACK (windows_actions_dock_notify),
+ g_signal_connect_object (dock_window, "notify::title",
+ G_CALLBACK (windows_actions_dock_window_notify),
group, 0);
- if (gtk_window_get_title (GTK_WINDOW (dock)))
- windows_actions_dock_notify (dock, NULL, group);
+ if (gtk_window_get_title (GTK_WINDOW (dock_window)))
+ windows_actions_dock_window_notify (dock_window, NULL, group);
}
static void
-windows_actions_dock_removed (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpActionGroup *group)
+windows_actions_dock_window_removed (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpActionGroup *group)
{
GtkAction *action;
- gchar *action_name = windows_actions_dock_to_action_name (dock);
+ gchar *action_name = windows_actions_dock_window_to_action_name (dock_window);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
@@ -329,21 +325,21 @@ windows_actions_dock_removed (GimpDialogFactory *factory,
}
static void
-windows_actions_dock_notify (GimpDock *dock,
- const GParamSpec *pspec,
- GimpActionGroup *group)
+windows_actions_dock_window_notify (GimpDockWindow *dock_window,
+ const GParamSpec *pspec,
+ GimpActionGroup *group)
{
GtkAction *action;
gchar *action_name;
- action_name = windows_actions_dock_to_action_name (dock);
+ action_name = windows_actions_dock_window_to_action_name (dock_window);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
g_free (action_name);
if (action)
g_object_set (action,
- "label", gtk_window_get_title (GTK_WINDOW (dock)),
- "tooltip", gtk_window_get_title (GTK_WINDOW (dock)),
+ "label", gtk_window_get_title (GTK_WINDOW (dock_window)),
+ "tooltip", gtk_window_get_title (GTK_WINDOW (dock_window)),
NULL);
}
diff --git a/app/actions/windows-actions.h b/app/actions/windows-actions.h
index 8aeaa23..21ec0b6 100644
--- a/app/actions/windows-actions.h
+++ b/app/actions/windows-actions.h
@@ -19,10 +19,10 @@
#define __WINDOWS_ACTIONS_H__
-void windows_actions_setup (GimpActionGroup *group);
-void windows_actions_update (GimpActionGroup *group,
- gpointer data);
-gchar * windows_actions_dock_to_action_name (GimpDock *dock);
+void windows_actions_setup (GimpActionGroup *group);
+void windows_actions_update (GimpActionGroup *group,
+ gpointer data);
+gchar * windows_actions_dock_window_to_action_name (GimpDockWindow *dock_window);
#endif /* __WINDOWS_ACTIONS_H__ */
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index b32ee5d..dadb921 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -57,9 +57,9 @@ void
windows_show_dock_cmd_callback (GtkAction *action,
gpointer data)
{
- GtkWindow *dock = g_object_get_data (G_OBJECT (action), "dock");
+ GtkWindow *dock_window = g_object_get_data (G_OBJECT (action), "dock-window");
- gtk_window_present (dock);
+ gtk_window_present (dock_window);
}
void
diff --git a/app/menus/windows-menu.c b/app/menus/windows-menu.c
index b4ae215..f702ae3 100644
--- a/app/menus/windows-menu.c
+++ b/app/menus/windows-menu.c
@@ -46,34 +46,34 @@
#include "windows-menu.h"
-static void windows_menu_display_add (GimpContainer *container,
- GimpDisplay *display,
- GimpUIManager *manager);
-static void windows_menu_display_remove (GimpContainer *container,
- GimpDisplay *display,
- GimpUIManager *manager);
-static void windows_menu_image_notify (GimpDisplay *display,
- const GParamSpec *unused,
- GimpUIManager *manager);
-static void windows_menu_dock_added (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpUIManager *manager);
-static void windows_menu_dock_removed (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpUIManager *manager);
-static gchar * windows_menu_dock_to_merge_id (GimpDock *dock);
-static void windows_menu_recent_add (GimpContainer *container,
- GimpSessionInfo *info,
- GimpUIManager *manager);
-static void windows_menu_recent_remove (GimpContainer *container,
- GimpSessionInfo *info,
- GimpUIManager *manager);
-static gboolean windows_menu_display_query_tooltip (GtkWidget *widget,
- gint x,
- gint y,
- gboolean keyboard_mode,
- GtkTooltip *tooltip,
- GimpAction *action);
+static void windows_menu_display_add (GimpContainer *container,
+ GimpDisplay *display,
+ GimpUIManager *manager);
+static void windows_menu_display_remove (GimpContainer *container,
+ GimpDisplay *display,
+ GimpUIManager *manager);
+static void windows_menu_image_notify (GimpDisplay *display,
+ const GParamSpec *unused,
+ GimpUIManager *manager);
+static void windows_menu_dock_window_added (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpUIManager *manager);
+static void windows_menu_dock_window_removed (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpUIManager *manager);
+static gchar * windows_menu_dock_window_to_merge_id (GimpDockWindow *dock_window);
+static void windows_menu_recent_add (GimpContainer *container,
+ GimpSessionInfo *info,
+ GimpUIManager *manager);
+static void windows_menu_recent_remove (GimpContainer *container,
+ GimpSessionInfo *info,
+ GimpUIManager *manager);
+static gboolean windows_menu_display_query_tooltip (GtkWidget *widget,
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip,
+ GimpAction *action);
void
@@ -104,21 +104,21 @@ windows_menu_setup (GimpUIManager *manager,
windows_menu_display_add (manager->gimp->displays, display, manager);
}
- g_signal_connect_object (global_dock_factory, "dock-added",
- G_CALLBACK (windows_menu_dock_added),
+ g_signal_connect_object (global_dock_factory, "dock-window-added",
+ G_CALLBACK (windows_menu_dock_window_added),
manager, 0);
- g_signal_connect_object (global_dock_factory, "dock-removed",
- G_CALLBACK (windows_menu_dock_removed),
+ g_signal_connect_object (global_dock_factory, "dock-window-removed",
+ G_CALLBACK (windows_menu_dock_window_removed),
manager, 0);
for (list = global_dock_factory->open_dialogs;
list;
list = g_list_next (list))
{
- GimpDock *dock = list->data;
+ GimpDockWindow *dock_window = list->data;
- if (GIMP_IS_DOCK (dock))
- windows_menu_dock_added (global_dock_factory, dock, manager);
+ if (GIMP_IS_DOCK_WINDOW (dock_window))
+ windows_menu_dock_window_added (global_dock_factory, dock_window, manager);
}
g_signal_connect_object (global_recent_docks, "add",
@@ -244,9 +244,9 @@ windows_menu_image_notify (GimpDisplay *display,
}
static void
-windows_menu_dock_added (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpUIManager *manager)
+windows_menu_dock_window_added (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpUIManager *manager)
{
const gchar *ui_path;
gchar *action_name;
@@ -256,11 +256,11 @@ windows_menu_dock_added (GimpDialogFactory *factory,
ui_path = g_object_get_data (G_OBJECT (manager), "image-menu-ui-path");
- action_name = windows_actions_dock_to_action_name (dock);
+ action_name = windows_actions_dock_window_to_action_name (dock_window);
action_path = g_strdup_printf ("%s/Windows/Docks",
ui_path);
- merge_key = windows_menu_dock_to_merge_id (dock);
+ merge_key = windows_menu_dock_window_to_merge_id (dock_window);
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
g_object_set_data (G_OBJECT (manager), merge_key,
@@ -277,11 +277,11 @@ windows_menu_dock_added (GimpDialogFactory *factory,
}
static void
-windows_menu_dock_removed (GimpDialogFactory *factory,
- GimpDock *dock,
- GimpUIManager *manager)
+windows_menu_dock_window_removed (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window,
+ GimpUIManager *manager)
{
- gchar *merge_key = windows_menu_dock_to_merge_id (dock);
+ gchar *merge_key = windows_menu_dock_window_to_merge_id (dock_window);
guint merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
merge_key));
if (merge_id)
@@ -293,10 +293,8 @@ windows_menu_dock_removed (GimpDialogFactory *factory,
}
static gchar *
-windows_menu_dock_to_merge_id (GimpDock *dock)
+windows_menu_dock_window_to_merge_id (GimpDockWindow *dock_window)
{
- GimpDockWindow *dock_window = gimp_dock_window_from_dock (dock);
-
return g_strdup_printf ("windows-dock-%04d-merge-id",
gimp_dock_window_get_id (dock_window));
}
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index 31e5f89..ace078b 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -38,6 +38,7 @@
#include "gimpdock.h"
#include "gimpdockbook.h"
#include "gimpdockable.h"
+#include "gimpdockwindow.h"
#include "gimpmenufactory.h"
#include "gimpsessioninfo.h"
@@ -53,8 +54,8 @@ typedef enum
enum
{
- DOCK_ADDED,
- DOCK_REMOVED,
+ DOCK_WINDOW_ADDED,
+ DOCK_WINDOW_REMOVED,
LAST_SIGNAL
};
@@ -122,25 +123,25 @@ gimp_dialog_factory_class_init (GimpDialogFactoryClass *klass)
klass->factories = g_hash_table_new (g_str_hash, g_str_equal);
- factory_signals[DOCK_ADDED] =
- g_signal_new ("dock-added",
+ factory_signals[DOCK_WINDOW_ADDED] =
+ g_signal_new ("dock-window-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GimpDialogFactoryClass, dock_added),
+ G_STRUCT_OFFSET (GimpDialogFactoryClass, dock_window_added),
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
- GIMP_TYPE_DOCK);
+ GIMP_TYPE_DOCK_WINDOW);
- factory_signals[DOCK_REMOVED] =
- g_signal_new ("dock-removed",
+ factory_signals[DOCK_WINDOW_REMOVED] =
+ g_signal_new ("dock-window-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GimpDialogFactoryClass, dock_removed),
+ G_STRUCT_OFFSET (GimpDialogFactoryClass, dock_window_removed),
NULL, NULL,
gimp_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
- GIMP_TYPE_DOCK);
+ GIMP_TYPE_DOCK_WINDOW);
}
static void
@@ -940,7 +941,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
factory->session_infos = g_list_append (factory->session_infos, info);
}
- g_signal_emit (factory, factory_signals[DOCK_ADDED], 0, dialog);
+ g_signal_emit (factory, factory_signals[DOCK_WINDOW_ADDED], 0, dialog);
}
factory->open_dialogs = g_list_prepend (factory->open_dialogs, dialog);
@@ -1064,7 +1065,7 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
session_info);
g_object_unref (session_info);
- g_signal_emit (factory, factory_signals[DOCK_REMOVED], 0,
+ g_signal_emit (factory, factory_signals[DOCK_WINDOW_REMOVED], 0,
dialog);
}
diff --git a/app/widgets/gimpdialogfactory.h b/app/widgets/gimpdialogfactory.h
index d0cc335..58fe4f5 100644
--- a/app/widgets/gimpdialogfactory.h
+++ b/app/widgets/gimpdialogfactory.h
@@ -100,10 +100,10 @@ struct _GimpDialogFactoryClass
GHashTable *factories;
- void (* dock_added) (GimpDialogFactory *factory,
- GimpDock *dock);
- void (* dock_removed) (GimpDialogFactory *factory,
- GimpDock *dock);
+ void (* dock_window_added) (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window);
+ void (* dock_window_removed) (GimpDialogFactory *factory,
+ GimpDockWindow *dock_window);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]