[gimp] app: Connect to GtkNotebook::page-removed in GimpImageWindow
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Connect to GtkNotebook::page-removed in GimpImageWindow
- Date: Sun, 25 Oct 2009 18:59:47 +0000 (UTC)
commit 870d7f9376b2e0861e0458f95fa637ae41eab52e
Author: Martin Nordholts <martinn src gnome org>
Date: Sun Oct 25 16:27:24 2009 +0100
app: Connect to GtkNotebook::page-removed in GimpImageWindow
We must disconnect from the last display shell when it is removed
when rearranging the UI, so connect to GtkNotebook::page-removed
in GimpImageWindow and do that.
app/display/gimpimagewindow.c | 71 +++++++++++++++++++++++++++++-----------
1 files changed, 51 insertions(+), 20 deletions(-)
---
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 4b31652..b6223f9 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -134,6 +134,12 @@ static void gimp_image_window_switch_page (GtkNotebook *not
GtkNotebookPage *page,
gint page_num,
GimpImageWindow *window);
+static void gimp_image_window_page_removed (GtkNotebook *notebook,
+ GtkNotebookPage *page,
+ gint page_num,
+ GimpImageWindow *window);
+static void gimp_image_window_disconnect_from_active_shell
+ (GimpImageWindow *window);
static void gimp_image_window_image_notify (GimpDisplay *display,
const GParamSpec *pspec,
@@ -308,6 +314,9 @@ gimp_image_window_constructor (GType type,
g_signal_connect (private->notebook, "switch-page",
G_CALLBACK (gimp_image_window_switch_page),
window);
+ g_signal_connect (private->notebook, "page-removed",
+ G_CALLBACK (gimp_image_window_page_removed),
+ window);
gtk_widget_show (private->notebook);
/* Create the right dock columns widget */
@@ -1017,26 +1026,7 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
if (shell == private->active_shell)
return;
- if (private->active_shell)
- {
- active_display = private->active_shell->display;
-
- g_signal_handlers_disconnect_by_func (active_display,
- gimp_image_window_image_notify,
- window);
-
- g_signal_handlers_disconnect_by_func (private->active_shell,
- gimp_image_window_shell_scaled,
- window);
- g_signal_handlers_disconnect_by_func (private->active_shell,
- gimp_image_window_shell_title_notify,
- window);
- g_signal_handlers_disconnect_by_func (private->active_shell,
- gimp_image_window_shell_icon_notify,
- window);
-
- gimp_image_window_hide_tooltip (private->menubar_manager, window);
- }
+ gimp_image_window_disconnect_from_active_shell (window);
private->active_shell = shell;
@@ -1072,6 +1062,47 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
}
static void
+gimp_image_window_page_removed (GtkNotebook *notebook,
+ GtkNotebookPage *page,
+ gint page_num,
+ GimpImageWindow *window)
+{
+ GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+
+ gimp_image_window_disconnect_from_active_shell (window);
+
+ private->active_shell = NULL;
+}
+
+static void
+gimp_image_window_disconnect_from_active_shell (GimpImageWindow *window)
+{
+ GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+ GimpDisplay *active_display = NULL;
+
+ if (! private->active_shell)
+ return;
+
+ active_display = private->active_shell->display;
+
+ g_signal_handlers_disconnect_by_func (active_display,
+ gimp_image_window_image_notify,
+ window);
+
+ g_signal_handlers_disconnect_by_func (private->active_shell,
+ gimp_image_window_shell_scaled,
+ window);
+ g_signal_handlers_disconnect_by_func (private->active_shell,
+ gimp_image_window_shell_title_notify,
+ window);
+ g_signal_handlers_disconnect_by_func (private->active_shell,
+ gimp_image_window_shell_icon_notify,
+ window);
+
+ gimp_image_window_hide_tooltip (private->menubar_manager, window);
+}
+
+static void
gimp_image_window_image_notify (GimpDisplay *display,
const GParamSpec *pspec,
GimpImageWindow *window)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]