[gimp] app: emit "update" when the viewable goes away via the weak notify
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: emit "update" when the viewable goes away via the weak notify
- Date: Thu, 28 Oct 2010 00:17:33 +0000 (UTC)
commit 9dee789cfdda1e138768b369c987c40608e9d720
Author: Michael Natterer <mitch gimp org>
Date: Thu Oct 28 02:14:28 2010 +0200
app: emit "update" when the viewable goes away via the weak notify
app/widgets/gimpviewrenderer.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c
index 9f3f94f..7cfa3dd 100644
--- a/app/widgets/gimpviewrenderer.c
+++ b/app/widgets/gimpviewrenderer.c
@@ -297,6 +297,15 @@ gimp_view_renderer_set_context (GimpViewRenderer *renderer,
}
}
+static void
+gimp_view_renderer_weak_notify (GimpViewRenderer *renderer,
+ GimpViewable *viewable)
+{
+ renderer->viewable = NULL;
+
+ gimp_view_renderer_update_idle (renderer);
+}
+
void
gimp_view_renderer_set_viewable (GimpViewRenderer *renderer,
GimpViewable *viewable)
@@ -325,8 +334,9 @@ gimp_view_renderer_set_viewable (GimpViewRenderer *renderer,
if (renderer->viewable)
{
- g_object_remove_weak_pointer (G_OBJECT (renderer->viewable),
- (gpointer) &renderer->viewable);
+ g_object_weak_unref (G_OBJECT (renderer->viewable),
+ (GWeakNotify) gimp_view_renderer_weak_notify,
+ renderer);
g_signal_handlers_disconnect_by_func (renderer->viewable,
G_CALLBACK (gimp_view_renderer_invalidate),
@@ -341,8 +351,9 @@ gimp_view_renderer_set_viewable (GimpViewRenderer *renderer,
if (renderer->viewable)
{
- g_object_add_weak_pointer (G_OBJECT (renderer->viewable),
- (gpointer) &renderer->viewable);
+ g_object_weak_ref (G_OBJECT (renderer->viewable),
+ (GWeakNotify) gimp_view_renderer_weak_notify,
+ renderer);
g_signal_connect_swapped (renderer->viewable,
"invalidate-preview",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]