Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--configure.ac6
-rw-r--r--shell/Makefile.am8
-rw-r--r--shell/ev-application.c42
-rw-r--r--shell/ev-application.h8
-rw-r--r--shell/ev-window.c7
-rw-r--r--shell/main.c26
7 files changed, 76 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index a3f2049..6ebc23a 100644
--- 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:
diff --git a/configure.ac b/configure.ac
index bd56713..70084aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"])
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 2b88796..24e3ab6 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -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
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 6b8ef37..aa5ea56 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -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);
}
}
diff --git a/shell/ev-application.h b/shell/ev-application.h
index ddf5ede..8c317c7 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -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);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index c61515b..8f55f13 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -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;
diff --git a/shell/main.c b/shell/main.c
index 1b80b4a..eb55ecd 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -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[])