[gimp] app: make sure signal connections are disconnected later.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make sure signal connections are disconnected later.
- Date: Sun, 12 Mar 2017 17:44:21 +0000 (UTC)
commit e29e950ca8ec195e5122cf0c85a83b1ed19d3dc2
Author: Jehan <jehan girinstud io>
Date: Sun Mar 12 18:36:16 2017 +0100
app: make sure signal connections are disconnected later.
app/widgets/gimpdockbook.c | 20 ++++++++++++++++----
app/widgets/gimpeditor.c | 10 +++++++++-
app/widgets/gimptoolpalette.c | 32 ++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 5 deletions(-)
---
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index ddcc919..f39605f 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -339,6 +339,13 @@ gimp_dockbook_finalize (GObject *object)
g_object_unref (dockbook->p->ui_manager);
dockbook->p->ui_manager = NULL;
}
+ if (dockbook->p->dock)
+ {
+ g_signal_handlers_disconnect_by_func (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
+ G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
+ dockbook);
+ dockbook->p->dock = NULL;
+ }
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -901,7 +908,16 @@ gimp_dockbook_set_dock (GimpDockbook *dockbook,
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
g_return_if_fail (dock == NULL || GIMP_IS_DOCK (dock));
+ if (dockbook->p->dock && gimp_dock_get_context (dockbook->p->dock))
+ g_signal_handlers_disconnect_by_func (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
+ G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
+ dockbook);
dockbook->p->dock = dock;
+ if (dock)
+ g_signal_connect (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
+ "notify::icon-size",
+ G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
+ dockbook);
}
GimpUIManager *
@@ -935,10 +951,6 @@ gimp_dockbook_add (GimpDockbook *dockbook,
position);
gimp_dockbook_update_auto_tab_style (dockbook);
- g_signal_connect (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
- "notify::icon-size",
- G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
- dockbook);
/* Create the new tab widget, it will get the correct tab style now */
tab_widget = gimp_dockbook_create_tab_widget (dockbook, dockable);
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index 103d280..c49e1b4 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -280,6 +280,9 @@ gimp_editor_dispose (GObject *object)
if (editor->priv->ui_manager)
{
+ g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
+ G_CALLBACK (gimp_editor_icon_size_notify),
+ editor);
g_object_unref (editor->priv->ui_manager);
editor->priv->ui_manager = NULL;
}
@@ -454,7 +457,12 @@ gimp_editor_create_menu (GimpEditor *editor,
editor->priv->menu_factory = g_object_ref (menu_factory);
if (editor->priv->ui_manager)
- g_object_unref (editor->priv->ui_manager);
+ {
+ g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
+ G_CALLBACK (gimp_editor_icon_size_notify),
+ editor);
+ g_object_unref (editor->priv->ui_manager);
+ }
editor->priv->ui_manager = gimp_menu_factory_manager_new (menu_factory,
menu_identifier,
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index 73699c6..25c6456 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -64,6 +64,8 @@ struct _GimpToolPalettePrivate
GimpToolPalettePrivate)
+static void gimp_tool_palette_finalize (GObject *object);
+
static void gimp_tool_palette_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gimp_tool_palette_style_set (GtkWidget *widget,
@@ -96,8 +98,11 @@ G_DEFINE_TYPE (GimpToolPalette, gimp_tool_palette, GTK_TYPE_TOOL_PALETTE)
static void
gimp_tool_palette_class_init (GimpToolPaletteClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ object_class->finalize = gimp_tool_palette_finalize;
+
widget_class->size_allocate = gimp_tool_palette_size_allocate;
widget_class->style_set = gimp_tool_palette_style_set;
widget_class->hierarchy_changed = gimp_tool_palette_hierarchy_changed;
@@ -126,6 +131,26 @@ gimp_tool_palette_init (GimpToolPalette *palette)
}
static void
+gimp_tool_palette_finalize (GObject *object)
+{
+ GimpToolPalette *palette = GIMP_TOOL_PALETTE (object);
+ GimpToolPalettePrivate *private = GET_PRIVATE (palette);
+
+ if (private->toolbox)
+ {
+ GimpContext *context = gimp_toolbox_get_context (private->toolbox);
+
+ if (context)
+ g_signal_handlers_disconnect_by_func (context->gimp->config,
+ G_CALLBACK (gimp_tool_palette_icon_size_notify),
+ palette);
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
gimp_tool_palette_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
@@ -292,6 +317,13 @@ gimp_tool_palette_set_toolbox (GimpToolPalette *palette,
private = GET_PRIVATE (palette);
+ if (private->toolbox)
+ {
+ context = gimp_toolbox_get_context (private->toolbox);
+ g_signal_handlers_disconnect_by_func (GIMP_GUI_CONFIG (context->gimp->config),
+ G_CALLBACK (gimp_tool_palette_icon_size_notify),
+ palette);
+ }
private->toolbox = toolbox;
context = gimp_toolbox_get_context (toolbox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]