app: emit "update" when the viewable goes away via the weak notify

This commit is contained in:
Michael Natterer 2010-10-28 02:14:28 +02:00
parent d899328a1c
commit 9dee789cfd
1 changed files with 15 additions and 4 deletions

View File

@ -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",