]> www.fi.muni.cz Git - evince.git/commitdiff
[shell] Flush DBus connection after emitting closed signal for the last window
authorCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 12 Jul 2010 18:18:41 +0000 (20:18 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 12 Jul 2010 18:18:41 +0000 (20:18 +0200)
shell/ev-window.c

index 168ed67d4aeb24e79c0dd52df8e89e2bf9f2530b..c7e9c6d8adbb37fb02fee569cefd5310d49df161 100644 (file)
@@ -6261,10 +6261,6 @@ ev_window_emit_closed (EvWindow *window)
        if (!connection)
                return;
 
-       /* TODO: figure out if this is the last window and use
-        * g_dbus_connection_flush_sync() to make sure the signal
-        * is emitted.
-        */
        g_dbus_connection_emit_signal (connection,
                                       NULL,
                                       window->priv->dbus_object_path,
@@ -6276,7 +6272,15 @@ ev_window_emit_closed (EvWindow *window)
                g_printerr ("Failed to emit DBus signal Closed: %s\n",
                            error->message);
                g_error_free (error);
+
+               return;
        }
+
+       /* If this is the last window call g_dbus_connection_flush_sync()
+        * to make sure the signal is emitted.
+        */
+       if (ev_application_get_n_windows (EV_APP) == 1)
+               g_dbus_connection_flush_sync (connection, NULL, NULL);
 }
 
 static void