]> www.fi.muni.cz Git - evince.git/commitdiff
Add 'timestamp' argument to ev_application_open_window and
authorRyan Lortie <desrt@desrt.ca>
Fri, 26 Aug 2005 02:34:30 +0000 (02:34 +0000)
committerRyan Lortie <ryanl@src.gnome.org>
Fri, 26 Aug 2005 02:34:30 +0000 (02:34 +0000)
2005-08-25  Ryan Lortie  <desrt@desrt.ca>

        * shell/ev-application-service.xml: Add 'timestamp' argument to
          ev_application_open_window and ev_application_open_uri methods.

        * shell/ev-application.h: Add 'timestamp' argument to
          ev_application_open_window, ev_application_open_uri,
          and ev_application_open_uri_list functions.

        * shell/ev-application.c (ev_application_open_window,
          ev_application_open_uri, ev_application_open_uri_list): Change
          functions that show/present windows to use a timestamp if one
          is passed in.

        * shell/ev-window.c (ev_window_cmd_file_open,
          ev_window_cmd_recent_file_activate, drag_data_received_cb):
        * shell/main.c (load_files): Modify calls to ev_application to
          include GDK_CURRENT_TIME as timestamp.

        * shell/main.c (load_files_remote): Obtain timestamp for client
          instance from GDK and pass to server instance so new windows are
          focused properly.  Fix dbus_g_proxy_call() calls by including second
          G_TYPE_INVALID.

        Closes bug #314475.

ChangeLog
shell/ev-application-service.xml
shell/ev-application.c
shell/ev-application.h
shell/ev-window.c
shell/main.c

index bbd799fa8641a7333b913955a6a940414a8a7634..187b1772b3f791a8032463b1bcaca2bb69e799d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2005-08-25  Ryan Lortie  <desrt@desrt.ca>
+
+       * shell/ev-application-service.xml: Add 'timestamp' argument to
+         ev_application_open_window and ev_application_open_uri methods.
+
+       * shell/ev-application.h: Add 'timestamp' argument to
+         ev_application_open_window, ev_application_open_uri,
+         and ev_application_open_uri_list functions.
+
+       * shell/ev-application.c (ev_application_open_window,
+         ev_application_open_uri, ev_application_open_uri_list): Change
+         functions that show/present windows to use a timestamp if one
+         is passed in.
+
+       * shell/ev-window.c (ev_window_cmd_file_open,
+         ev_window_cmd_recent_file_activate, drag_data_received_cb):
+       * shell/main.c (load_files): Modify calls to ev_application to
+         include GDK_CURRENT_TIME as timestamp.
+
+       * shell/main.c (load_files_remote): Obtain timestamp for client
+         instance from GDK and pass to server instance so new windows are
+         focused properly.  Fix dbus_g_proxy_call() calls by including second
+         G_TYPE_INVALID.
+         
+       Closes bug #314475.
+
 Thu Aug 25 22:13:08 2005  Jonathan Blandford  <jrb@redhat.com>
 
        * shell/ev-window.c (ev_window_finalize): Check for
index 68a63e20fed795730326c05836fcdc63d15b9b3f..65bd1ec26512a76a525ee013cb23c6aa02cdf77b 100644 (file)
@@ -7,12 +7,14 @@
 
     <method name="OpenWindow">
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ev_application_open_window"/>
+      <arg type="u" name="timestamp" direction="in"/>
     </method>
 
     <method name="OpenURI">
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ev_application_open_uri"/>
       <arg type="s" name="uri" direction="in"/>
       <arg type="s" name="page_label" direction="in"/>
+      <arg type="u" name="timestamp" direction="in"/>
     </method>
 
   </interface>
index 6cbb149363b86e548b803025a48311bc84b7843d..ea66f659ed8e3d553e46edc0199ec6a256812be5 100644 (file)
@@ -113,9 +113,14 @@ ev_application_get_instance (void)
 
 gboolean
 ev_application_open_window (EvApplication  *application,
+                           guint32         timestamp,
                            GError        **error)
 {
-       gtk_widget_show (ev_window_new ());
+       GtkWidget *new_window = ev_window_new ();
+
+       gtk_widget_show (new_window);
+       gtk_window_present_with_time (GTK_WINDOW (new_window),
+                                     timestamp);
 
        return TRUE;
 }
@@ -173,6 +178,7 @@ gboolean
 ev_application_open_uri (EvApplication  *application,
                         const char     *uri,
                         const char     *page_label,
+                        guint           timestamp,
                         GError        **error)
 {
        EvWindow *new_window;
@@ -181,7 +187,8 @@ ev_application_open_uri (EvApplication  *application,
 
        new_window = ev_application_get_uri_window (application, uri);
        if (new_window != NULL) {
-               gtk_window_present (GTK_WINDOW (new_window));
+               gtk_window_present_with_time (GTK_WINDOW (new_window),
+                                             timestamp);
                
                return TRUE;
        }
@@ -190,11 +197,12 @@ ev_application_open_uri (EvApplication  *application,
 
        if (new_window == NULL) {
                new_window = EV_WINDOW (ev_window_new ());
+               gtk_widget_show (GTK_WIDGET (new_window));
        }
        
        ev_window_open_uri (new_window, uri);
 
-       gtk_window_present (GTK_WINDOW (new_window));
+       gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
 
        if (page_label != NULL) {
                ev_window_open_page_label (new_window, page_label);
@@ -204,12 +212,17 @@ ev_application_open_uri (EvApplication  *application,
 }
 
 void
-ev_application_open_uri_list (EvApplication *application, GSList *uri_list)
+ev_application_open_uri_list (EvApplication *application,
+                             GSList        *uri_list,
+                             guint          timestamp)
 {
        GSList *l;
 
        for (l = uri_list; l != NULL; l = l->next) {
-               ev_application_open_uri (application, (char *)l->data, NULL, NULL);
+               ev_application_open_uri (application, (char *)l->data,
+                                        NULL,
+                                        timestamp,
+                                        NULL);
        }
 }
 
index 1ed5b77b6c9d3a2a84b7eaad542cda66c713a96d..87e2bf10a747521a0ef1c0621ed1da32054f55f8 100644 (file)
@@ -66,13 +66,16 @@ void                  ev_application_shutdown            (EvApplication   *application);
 
 
 gboolean          ev_application_open_window         (EvApplication   *application,
+                                                     guint32         timestamp,
                                                      GError         **error);
 gboolean          ev_application_open_uri            (EvApplication   *application,
                                                      const char      *uri,
                                                      const char      *page_label,
+                                                     guint32         timestamp,
                                                      GError         **error);
 void             ev_application_open_uri_list       (EvApplication   *application,
-                                                     GSList          *uri_list);
+                                                     GSList          *uri_list,
+                                                     guint32          timestamp);
 
 
 EggToolbarsModel *ev_application_get_toolbars_model  (EvApplication   *application);
index c634a07b7149e9afdd0ea8e6932ddeb7c743ad76..8ab8da57a284d909ac41ef0965c840bbaed96e88 100644 (file)
@@ -1102,7 +1102,7 @@ ev_window_cmd_file_open (GtkAction *action, EvWindow *window)
                                
                folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (chooser));
 
-               ev_application_open_uri_list (EV_APP, uris);
+               ev_application_open_uri_list (EV_APP, uris, GDK_CURRENT_TIME);
        
                g_slist_foreach (uris, (GFunc)g_free, NULL);    
                g_slist_free (uris);
@@ -1126,7 +1126,7 @@ ev_window_cmd_recent_file_activate (GtkAction *action,
 
        uri = egg_recent_item_get_uri (item);
 
-       ev_application_open_uri (EV_APP, uri, NULL, NULL);      
+       ev_application_open_uri (EV_APP, uri, NULL, GDK_CURRENT_TIME, NULL);
        
        g_free (uri);
 }
@@ -3051,7 +3051,7 @@ drag_data_received_cb (GtkWidget *widget, GdkDragContext *context,
 
                gnome_vfs_uri_list_free (uri_list);
                
-               ev_application_open_uri_list (EV_APP, uris);
+               ev_application_open_uri_list (EV_APP, uris, 0);
                
                g_slist_free (uris);
 
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 */