X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fmain.c;h=4fff6dfebfae1887ffd6fed01825b0477327d2a9;hb=082a08309e217bcbe1d31622a5eb55dec8475e77;hp=7a070912b32b552fb8b1d9733f71f27167cc50c4;hpb=54bf2ac0ed59a10a51405ee9f14de5eb9d503148;p=evince.git diff --git a/shell/main.c b/shell/main.c index 7a070912..4fff6dfe 100644 --- a/shell/main.c +++ b/shell/main.c @@ -74,6 +74,7 @@ load_files_remote (const char **files) int i; GError *error = NULL; DBusGConnection *connection; + gboolean result = FALSE; #if DBUS_VERSION < 35 DBusGPendingCall *call; #endif @@ -92,7 +93,15 @@ load_files_remote (const char **files) "/org/gnome/evince/Evince", "org.gnome.evince.Application"); if (!files) { -#if DBUS_VERSION < 35 +#if DBUS_VERSION <= 33 + 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)) { + g_warning (error->message); + g_clear_error (&error); + return FALSE; + } +#elif DBUS_VERSION == 34 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)) { @@ -111,13 +120,24 @@ load_files_remote (const char **files) } 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 +#if DBUS_VERSION <= 33 + 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_warning (error->message); + g_clear_error (&error); + g_free (uri); + continue; + } +#elif DBUS_VERSION == 34 call = dbus_g_proxy_begin_call (remote_object, "OpenURI", G_TYPE_STRING, uri, G_TYPE_STRING, page_label, @@ -126,7 +146,8 @@ 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; + g_free (uri); + continue; } #else if (!dbus_g_proxy_call (remote_object, "OpenURI", &error, @@ -135,23 +156,22 @@ load_files_remote (const char **files) G_TYPE_INVALID)) { g_warning (error->message); g_clear_error (&error); - result = FALSE; + g_free (uri); + continue; } #endif g_free (uri); - return result; + result = TRUE; } - return TRUE; + return result; } #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; @@ -189,11 +209,10 @@ main (int argc, char *argv[]) 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")); @@ -211,11 +230,9 @@ main (int argc, char *argv[]) poptFreeContext (context); ev_file_helpers_shutdown (); -#if ENABLE_METADATA if (enable_metadata) { ev_metadata_manager_shutdown (); } -#endif return 0; }