]> www.fi.muni.cz Git - evince.git/blobdiff - shell/main.c
Add 'timestamp' argument to ev_application_open_window and
[evince.git] / shell / main.c
index fdde6e2d2ecf64eb04e25c1be46f2f10e68b1ebb..9b38ee6bbf9851de9555456567f8aa19f6b0388a 100644 (file)
@@ -24,6 +24,7 @@
 #include "ev-metadata-manager.h"
 
 #include <glib/gi18n.h>
+#include <gdk/gdkx.h>
 #include <gtk/gtkmain.h>
 #include <libgnome/gnome-program.h>
 #include <libgnomeui/gnome-ui-init.h>
@@ -54,7 +55,7 @@ load_files (const char **files)
        int i;
 
        if (!files) {
-               ev_application_open_window (EV_APP, NULL);
+               ev_application_open_window (EV_APP, GDK_CURRENT_TIME, NULL);
                return;
        }
 
@@ -62,7 +63,8 @@ load_files (const char **files)
                char *uri;
 
                uri = gnome_vfs_make_uri_from_shell_arg (files[i]);
-               ev_application_open_uri (EV_APP, uri, ev_page_label, NULL);             
+               ev_application_open_uri (EV_APP, uri, ev_page_label,
+                                        GDK_CURRENT_TIME, NULL);
                g_free (uri);
         }
 }
@@ -79,6 +81,11 @@ load_files_remote (const char **files)
        DBusGPendingCall *call;
 #endif
        DBusGProxy *remote_object;
+       GdkDisplay *display;
+       guint32 timestamp;
+
+       display = gdk_display_get_default();
+       timestamp = gdk_x11_display_get_user_time (display);
 
        connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        if (connection == NULL) {
@@ -94,7 +101,9 @@ load_files_remote (const char **files)
                                                    "org.gnome.evince.Application");
        if (!files) {
 #if DBUS_VERSION <= 33
-               call = dbus_g_proxy_begin_call (remote_object, "OpenWindow", DBUS_TYPE_INVALID);
+               call = dbus_g_proxy_begin_call (remote_object, "OpenWindow",
+                                               DBUS_TYPE_UINT32, timestamp,
+                                               DBUS_TYPE_INVALID);
 
                if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
                        g_warning (error->message);
@@ -102,7 +111,9 @@ load_files_remote (const char **files)
                        return FALSE;
                }
 #elif DBUS_VERSION == 34
-               call = dbus_g_proxy_begin_call (remote_object, "OpenWindow", G_TYPE_INVALID);
+               call = dbus_g_proxy_begin_call (remote_object, "OpenWindow",
+                                               G_TYPE_UINT, timestamp,
+                                               G_TYPE_INVALID);
 
                if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
                        g_warning (error->message);
@@ -110,7 +121,10 @@ load_files_remote (const char **files)
                        return FALSE;
                }
 #else
-               if (!dbus_g_proxy_call (remote_object, "OpenWindow", &error, G_TYPE_INVALID)) {
+               if (!dbus_g_proxy_call (remote_object, "OpenWindow", &error,
+                                       G_TYPE_UINT, timestamp,
+                                       G_TYPE_INVALID,
+                                       G_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
                        return FALSE;
@@ -129,6 +143,7 @@ load_files_remote (const char **files)
                call = dbus_g_proxy_begin_call (remote_object, "OpenURI",
                                                DBUS_TYPE_STRING, &uri,
                                                DBUS_TYPE_STRING, &page_label,
+                                               DBUS_TYPE_UINT32, timestamp,
                                                DBUS_TYPE_INVALID);
 
                if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
@@ -141,6 +156,7 @@ load_files_remote (const char **files)
                call = dbus_g_proxy_begin_call (remote_object, "OpenURI",
                                                G_TYPE_STRING, uri,
                                                G_TYPE_STRING, page_label,
+                                               G_TYPE_UINT, timestamp,
                                                G_TYPE_INVALID);
 
                if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
@@ -153,6 +169,8 @@ load_files_remote (const char **files)
                if (!dbus_g_proxy_call (remote_object, "OpenURI", &error,
                                        G_TYPE_STRING, uri,
                                        G_TYPE_STRING, page_label,
+                                       G_TYPE_UINT, timestamp,
+                                       G_TYPE_INVALID,
                                        G_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
@@ -164,6 +182,8 @@ load_files_remote (const char **files)
                result = TRUE;
         }
 
+       gdk_notify_startup_complete ();
+
        return result;
 }
 #endif /* ENABLE_DBUS */