]> www.fi.muni.cz Git - evince.git/commitdiff
Marco Pesenti Gritti <mpg@redhat.com>
authorCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 5 Jul 2005 17:02:52 +0000 (17:02 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Tue, 5 Jul 2005 17:02:52 +0000 (17:02 +0000)
2005-07-05  Carlos Garcia Campos  <carlosgc@gnome.org>
            Marco Pesenti Gritti  <mpg@redhat.com>

        * shell/Makefile.am: Add --prefix for dbus-binding-tool script

        * shell/ev-application.[ch], shell/ev-window.c: change dbus RPC
        functions to the format required by dbus

        * shell/main.c: use G_TYPE instead of DBUS_TYPE to fix compilation
        errors. Use the RPC parameters in the expected way

ChangeLog
configure.ac
shell/Makefile.am
shell/ev-application.c
shell/ev-application.h
shell/ev-window.c
shell/main.c

index a3f20490ff7bdf50dd8182ca92a3f9ccea32a0fd..6ebc23a89b6492e2588860869ab1e565f502be35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-07-05  Carlos Garcia Campos  <carlosgc@gnome.org>
+           Marco Pesenti Gritti  <mpg@redhat.com>
+
+       * shell/Makefile.am: Add --prefix for dbus-binding-tool script
+       
+       * shell/ev-application.[ch], shell/ev-window.c: change dbus RPC 
+       functions to the format required by dbus
+
+       * shell/main.c: use G_TYPE instead of DBUS_TYPE to fix compilation
+       errors. Use the RPC parameters in the expected way
+
 2005-07-05  Marco Pesenti Gritti  <mpg@redhat.com>
 
        * Makefile.am:
index bd56713359b21bcf0ae044a9dd4cc8e802515b49..70084aa479fa4550f1a77ef870ad871107942698 100644 (file)
@@ -59,8 +59,12 @@ AC_MSG_RESULT([$enable_dbus])
 
 if test "x$enable_dbus" = "xyes" ; then
         AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
-        AC_DEFINE([ENABLE_METADATA],[1],[Define if metadata support is enabled])
+       AC_DEFINE([ENABLE_METADATA],[1],[Define if metadata support is enabled])
         PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
+
+       DBUS_VERSION=`$PKG_CONFIG --modversion dbus-glib-1 | sed 's/0.\([[0-9]]*\)/\1/'`
+       AC_DEFINE_UNQUOTED(DBUS_VERSION, $DBUS_VERSION, [DBUS version.])
+       AM_CONDITIONAL([DBUS_TOOL_NO_PREFIX], [test "x$DBUS_VERSION" = "x33"])
 fi
 
 AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
index 2b88796752165f9765a9cc21b88b32b7399034e2..24e3ab66e52f16407ba6de88147df3bf4f23d3e3 100644 (file)
@@ -130,7 +130,8 @@ if ENABLE_DBUS
 BUILT_SOURCES += ev-application-service.h
 endif
 
-EXTRA_DIST = ev-marshal.list
+EXTRA_DIST = ev-marshal.list \
+            ev-application-service.h
 
 ev-marshal.h: ev-marshal.list
        glib-genmarshal --prefix=ev_marshal ev-marshal.list --header > ev-marshal.h
@@ -139,5 +140,10 @@ ev-marshal.c: ev-marshal.list
        echo '#include "ev-marshal.h"' > ev-marshal.c
        glib-genmarshal --prefix=ev_marshal ev-marshal.list --body >> ev-marshal.c
 
+if DBUS_TOOL_NO_PREFIX
 ev-application-service.h: ev-application-service.xml
        dbus-binding-tool --mode=glib-server --output=ev-application-service.h $(srcdir)/ev-application-service.xml
+else
+ev-application-service.h: ev-application-service.xml
+       dbus-binding-tool --prefix=ev_application --mode=glib-server --output=ev-application-service.h $(srcdir)/ev-application-service.xml
+endif
index 6b8ef370bd05cb25e379dd390238e7574b358d96..aa5ea56e95599de7d92314a89af462f253646529 100644 (file)
@@ -61,6 +61,9 @@ ev_application_register_service (EvApplication *application)
        connection = dbus_g_bus_get (DBUS_BUS_STARTER, &err);
        if (connection == NULL) {
                g_warning ("Service registration failed.");
+               g_error_free (err);
+
+               return FALSE;
        }
 
        driver_proxy = dbus_g_proxy_new_for_name (connection,
@@ -70,24 +73,30 @@ ev_application_register_service (EvApplication *application)
 
        if (!org_freedesktop_DBus_request_name (driver_proxy,
                                                APPLICATION_SERVICE_NAME,
-                                               0, &request_name_result, &err))
-       {
+                                               0, &request_name_result, &err)) {
                g_warning ("Service registration failed.");
+               g_clear_error (&err);
        }
 
        if (request_name_result == DBUS_REQUEST_NAME_REPLY_EXISTS) {
                return FALSE;
        }
 
+#if DBUS_VERSION == 33
        dbus_g_object_class_install_info (G_OBJECT_GET_CLASS (application),
-                                          &dbus_glib_ev_application_object_info);
+                                         &dbus_glib_ev_application_object_info);
+#else
+       dbus_g_object_type_install_info (EV_TYPE_APPLICATION,
+                                        &dbus_glib_ev_application_object_info);
+#endif
+
        dbus_g_connection_register_g_object (connection,
                                             "/org/gnome/evince/Evince",
                                              G_OBJECT (application));
 
        return TRUE;
 }
-#endif
+#endif /* ENABLE_DBUS */
 
 EvApplication *
 ev_application_get_instance (void)
@@ -101,10 +110,13 @@ ev_application_get_instance (void)
        return instance;
 }
 
-void
-ev_application_open_window (EvApplication *application)
+gboolean
+ev_application_open_window (EvApplication  *application,
+                           GError        **error)
 {
        gtk_widget_show (ev_window_new ());
+
+       return TRUE;
 }
 
 static EvWindow *
@@ -156,19 +168,21 @@ ev_application_get_uri_window (EvApplication *application, const char *uri)
        return uri_window;
 }
 
-void
-ev_application_open_uri (EvApplication *application,
-                        const char    *uri,
-                        const char    *page_label)
+gboolean
+ev_application_open_uri (EvApplication  *application,
+                        const char     *uri,
+                        const char     *page_label,
+                        GError        **error)
 {
        EvWindow *new_window;
 
-       g_return_if_fail (uri != NULL);
+       g_return_val_if_fail (uri != NULL, FALSE);
 
        new_window = ev_application_get_uri_window (application, uri);
        if (new_window != NULL) {
                gtk_window_present (GTK_WINDOW (new_window));
-               return;
+               
+               return TRUE;
        }
 
        new_window = ev_application_get_empty_window (application);
@@ -184,6 +198,8 @@ ev_application_open_uri (EvApplication *application,
        if (page_label != NULL) {
                ev_window_open_page_label (new_window, page_label);
        }
+
+       return TRUE;
 }
 
 void
@@ -192,7 +208,7 @@ ev_application_open_uri_list (EvApplication *application, GSList *uri_list)
        GSList *l;
 
        for (l = uri_list; l != NULL; l = l->next) {
-               ev_application_open_uri (application, (char *)l->data, NULL);
+               ev_application_open_uri (application, (char *)l->data, NULL, NULL);
        }
 }
 
index ddf5ede10f4c4b7751d8f74daf666160e3106ce0..8c317c7e47f6f61af026b032e293b84bf622700a 100644 (file)
@@ -54,10 +54,12 @@ struct _EvApplicationClass {
 GType         ev_application_get_type         (void);
 gboolean       ev_application_register_service (EvApplication   *application);
 EvApplication *ev_application_get_instance     (void);
-void          ev_application_open_window      (EvApplication   *application);
-void          ev_application_open_uri         (EvApplication   *application,
+gboolean       ev_application_open_window      (EvApplication   *application,
+                                               GError         **error);
+gboolean       ev_application_open_uri         (EvApplication   *application,
                                                const char      *uri,
-                                               const char      *page_label);
+                                               const char      *page_label,
+                                               GError         **error);
 void          ev_application_open_uri_list    (EvApplication   *application,
                                                GSList          *uri_list);
 void          ev_application_shutdown         (EvApplication   *application);
index c61515be7e381a0a592744786fbaa6978d7c1e43..8f55f13dd12a08fcbd4a80102fb032d8754f127f 100644 (file)
@@ -190,7 +190,7 @@ static void     ev_window_stop_presentation             (EvWindow         *windo
 static void     ev_window_cmd_view_presentation         (GtkAction        *action,
                                                         EvWindow         *window);
 static void     show_fullscreen_popup                   (EvWindow         *window);
-                                                       
+
 
 G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
 
@@ -1015,7 +1015,7 @@ ev_window_cmd_recent_file_activate (GtkAction *action,
 
        uri = egg_recent_item_get_uri (item);
 
-       ev_application_open_uri (EV_APP, uri, NULL);    
+       ev_application_open_uri (EV_APP, uri, NULL, NULL);      
        
        g_free (uri);
 }
@@ -1651,7 +1651,7 @@ ev_window_run_fullscreen (EvWindow *window)
        g_object_set (G_OBJECT (window->priv->scrolled_window),
                      "shadow-type", GTK_SHADOW_NONE,
                      NULL);
-
+       
        g_signal_connect (window->priv->view,
                          "motion-notify-event",
                          G_CALLBACK (fullscreen_motion_notify_cb),
@@ -2501,7 +2501,6 @@ ev_window_dispose (GObject *object)
                priv->recent_view = NULL;
        }
 
-
        if (priv->ui_manager) {
                g_object_unref (priv->ui_manager);
                priv->ui_manager = NULL;
index 1b80b4a78b831da7a40fa88e2ce84e258679ae9e..eb55ecd2c16ead4aef74da64d34a95d36efa6734 100644 (file)
@@ -54,7 +54,7 @@ load_files (const char **files)
        int i;
 
        if (!files) {
-               ev_application_open_window (EV_APP);
+               ev_application_open_window (EV_APP, NULL);
                return;
        }
 
@@ -62,7 +62,7 @@ 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);           
+               ev_application_open_uri (EV_APP, uri, ev_page_label, NULL);             
                g_free (uri);
         }
 }
@@ -72,7 +72,7 @@ static void
 load_files_remote (const char **files)
 {
        int i;
-       GError *error;
+       GError *error = NULL;
        DBusGConnection *connection;
        DBusGPendingCall *call;
        DBusGProxy *remote_object;
@@ -80,6 +80,8 @@ load_files_remote (const char **files)
        connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        if (connection == NULL) {
                g_warning (error->message);
+               g_error_free (error);
+               
                return;
        }
 
@@ -88,9 +90,11 @@ load_files_remote (const char **files)
                                                    "/org/gnome/evince/Evince",
                                                    "org.gnome.evince.Application");
        if (!files) {
-               call = dbus_g_proxy_begin_call (remote_object, "OpenWindow", DBUS_TYPE_INVALID);
-               if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
+               call = dbus_g_proxy_begin_call (remote_object, "OpenWindow", G_TYPE_INVALID);
+
+               if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
                        g_warning (error->message);
+                       g_clear_error (&error);
                }
                return;
        }
@@ -103,17 +107,19 @@ load_files_remote (const char **files)
                page_label = ev_page_label ? ev_page_label : ""; 
 
                call = dbus_g_proxy_begin_call (remote_object, "OpenURI",
-                                               DBUS_TYPE_STRING, &uri,
-                                               DBUS_TYPE_STRING, &page_label,
-                                               DBUS_TYPE_INVALID);
-               if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
+                                               G_TYPE_STRING, uri,
+                                               G_TYPE_STRING, page_label,
+                                               G_TYPE_INVALID);
+
+               if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
                        g_warning (error->message);
+                       g_clear_error (&error);
                }
                
                g_free (uri);
         }
 }
-#endif
+#endif /* ENABLE_DBUS */
 
 int
 main (int argc, char *argv[])