Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2005-07-07 14:57:39 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-07-07 14:57:39 (GMT)
commit54bf2ac0ed59a10a51405ee9f14de5eb9d503148 (patch)
tree02905c5ea64926521ec5a385a8081ad8b0aa8bde /shell/main.c
parent79a78d0249676255e902c9207a0eec4aba179de6 (diff)
Add an _init functions that enabled metadata management at runtime.
2005-07-07 Marco Pesenti Gritti <mpg@redhat.com> * shell/ev-metadata-manager.c: (ev_metadata_manager_init), (ev_metadata_manager_get), (ev_metadata_manager_set): * shell/ev-metadata-manager.h: Add an _init functions that enabled metadata management at runtime. * shell/ev-window.c: (page_changed_cb), (setup_document_from_metadata), (ev_window_setup_document), (setup_view_from_metadata), (ev_window_open_uri), (ev_window_run_fullscreen), (ev_window_stop_fullscreen), (ev_window_run_presentation), (ev_window_stop_presentation), (save_sizing_mode), (ev_window_zoom_changed_cb), (ev_window_continuous_changed_cb), (ev_window_dual_mode_changed_cb), (window_state_event_cb), (window_configure_event_cb): Remove all ugly metadata define since we deal with it at runtime now. * shell/main.c: (load_files_remote), (main): Add support for dbus cvs head. Hopefully didnt break one of the other versions now! If we dont get a response from the dbus server just give up with it and not enable metadata.
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c61
1 files changed, 50 insertions, 11 deletions
diff --git a/shell/main.c b/shell/main.c
index eb55ecd..7a07091 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -68,21 +68,23 @@ load_files (const char **files)
}
#ifdef ENABLE_DBUS
-static void
+static gboolean
load_files_remote (const char **files)
{
int i;
GError *error = NULL;
DBusGConnection *connection;
+#if DBUS_VERSION < 35
DBusGPendingCall *call;
+#endif
DBusGProxy *remote_object;
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL) {
g_warning (error->message);
- g_error_free (error);
-
- return;
+ g_error_free (error);
+
+ return FALSE;
}
remote_object = dbus_g_proxy_new_for_name (connection,
@@ -90,22 +92,32 @@ load_files_remote (const char **files)
"/org/gnome/evince/Evince",
"org.gnome.evince.Application");
if (!files) {
+#if DBUS_VERSION < 35
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 FALSE;
}
- return;
+#else
+ if (!dbus_g_proxy_call (remote_object, "OpenWindow", &error, G_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ return FALSE;
+ }
+#endif
+ return TRUE;
}
for (i = 0; files[i]; i++) {
+ gboolean result = TRUE;
const char *page_label;
char *uri;
uri = gnome_vfs_make_uri_from_shell_arg (files[i]);
page_label = ev_page_label ? ev_page_label : "";
-
+#if DBUS_VERSION < 35
call = dbus_g_proxy_begin_call (remote_object, "OpenURI",
G_TYPE_STRING, uri,
G_TYPE_STRING, page_label,
@@ -114,16 +126,32 @@ load_files_remote (const char **files)
if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
g_warning (error->message);
g_clear_error (&error);
+ result = FALSE;
}
-
+#else
+ if (!dbus_g_proxy_call (remote_object, "OpenURI", &error,
+ G_TYPE_STRING, uri,
+ G_TYPE_STRING, page_label,
+ G_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ result = FALSE;
+ }
+#endif
g_free (uri);
+ return result;
}
+
+ return TRUE;
}
#endif /* ENABLE_DBUS */
int
main (int argc, char *argv[])
{
+#ifdef ENABLE_METADATA
+ gboolean enable_metadata = FALSE;
+#endif
poptContext context;
GValue context_as_value = { 0 };
GnomeProgram *program;
@@ -149,16 +177,24 @@ main (int argc, char *argv[])
#ifdef ENABLE_DBUS
if (!ev_application_register_service (EV_APP)) {
- load_files_remote (poptGetArgs (context));
- g_warning ("Another process was running.");
- return 0;
+ if (load_files_remote (poptGetArgs (context))) {
+ g_warning ("Another process was running.");
+ return 0;
+ }
} else {
g_warning ("Starting evince process.");
+ enable_metadata = TRUE;
}
#endif
gnome_authentication_manager_init ();
+#if ENABLE_METADATA
+ if (enable_metadata) {
+ ev_metadata_manager_init ();
+ }
+#endif
+
ev_job_queue_init ();
g_set_application_name (_("Evince Document Viewer"));
@@ -174,8 +210,11 @@ main (int argc, char *argv[])
gnome_accelerators_sync ();
poptFreeContext (context);
ev_file_helpers_shutdown ();
+
#if ENABLE_METADATA
- ev_metadata_manager_shutdown ();
+ if (enable_metadata) {
+ ev_metadata_manager_shutdown ();
+ }
#endif
return 0;