+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:
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"])
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
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
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,
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)
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 *
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);
if (page_label != NULL) {
ev_window_open_page_label (new_window, page_label);
}
+
+ return TRUE;
}
void
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);
}
}
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);
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)
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);
}
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),
priv->recent_view = NULL;
}
-
if (priv->ui_manager) {
g_object_unref (priv->ui_manager);
priv->ui_manager = NULL;
int i;
if (!files) {
- ev_application_open_window (EV_APP);
+ ev_application_open_window (EV_APP, NULL);
return;
}
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);
}
}
load_files_remote (const char **files)
{
int i;
- GError *error;
+ GError *error = NULL;
DBusGConnection *connection;
DBusGPendingCall *call;
DBusGProxy *remote_object;
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL) {
g_warning (error->message);
+ g_error_free (error);
+
return;
}
"/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;
}
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[])