]> www.fi.muni.cz Git - evince.git/commitdiff
[shell] Add DBUS DocumentLoaded signal to EvWindow
authorJosé Aliste <jaliste@src.gnome.org>
Wed, 1 Sep 2010 21:12:03 +0000 (17:12 -0400)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 8 Sep 2010 10:34:08 +0000 (12:34 +0200)
See bug #626561.

shell/ev-window.c

index 5b6cb7856b0ad0f79f516da4679fb0940e5d25ed..19a404e4e32e626b3254094aaadd90e984704e7b 100644 (file)
@@ -349,6 +349,7 @@ static void     ev_window_media_player_key_pressed      (EvWindow         *windo
 static void     ev_window_update_max_min_scale          (EvWindow         *window);
 #ifdef ENABLE_DBUS
 static void    ev_window_emit_closed                   (EvWindow         *window);
+static void    ev_window_emit_doc_loaded               (EvWindow         *window);
 #endif
 
 static guint ev_window_n_copies = 0;
@@ -1544,6 +1545,7 @@ ev_window_load_job_cb (EvJob *job,
        if (!ev_job_is_failed (job)) {
                ev_document_model_set_document (ev_window->priv->model, document);
 
+               ev_window_emit_doc_loaded (ev_window);
                setup_chrome_from_metadata (ev_window);
                update_chrome_actions (ev_window);
                setup_document_from_metadata (ev_window);
@@ -6614,6 +6616,35 @@ ev_window_emit_closed (EvWindow *window)
                g_dbus_connection_flush_sync (connection, NULL, NULL);
 }
 
+static void
+ev_window_emit_doc_loaded (EvWindow *window)
+{
+       GDBusConnection *connection;
+       GError          *error = NULL;
+
+       if (window->priv->dbus_object_id <= 0)
+               return;
+
+       connection = ev_application_get_dbus_connection (EV_APP);
+       if (!connection)
+               return;
+
+       g_dbus_connection_emit_signal (connection,
+                                      NULL,
+                                      window->priv->dbus_object_path,
+                                      EV_WINDOW_DBUS_INTERFACE,
+                                      "DocumentLoaded",
+                                      g_variant_new("(s)", window->priv->uri),
+                                      &error);
+       if (error) {
+               g_printerr ("Failed to emit DBus signal DocumentLoaded: %s\n",
+                           error->message);
+               g_error_free (error);
+
+               return;
+       }
+}
+
 static void
 method_call_cb (GDBusConnection       *connection,
                 const gchar           *sender,
@@ -6652,6 +6683,9 @@ static const char introspection_xml[] =
              "<arg type='(ii)' name='source_point' direction='out'/>"
            "</signal>"
             "<signal name='Closed'/>"
+           "<signal name='DocumentLoaded'>"
+             "<arg type='s' name='uri' direction='out'/>"
+           "</signal>"
           "</interface>"
         "</node>";