]> www.fi.muni.cz Git - evince.git/blobdiff - shell/main.c
Copy-paste g_file_set_contents to keep compatibility with gtk 2.6
[evince.git] / shell / main.c
index f6600f0f19edafc347dddff103e28797f0ee8066..4fff6dfebfae1887ffd6fed01825b0477327d2a9 100644 (file)
@@ -74,6 +74,7 @@ load_files_remote (const char **files)
        int i;
        GError *error = NULL;
        DBusGConnection *connection;
        int i;
        GError *error = NULL;
        DBusGConnection *connection;
+       gboolean result = FALSE;
 #if DBUS_VERSION < 35
        DBusGPendingCall *call;
 #endif
 #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) {
                                                    "/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)) {
                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++) {
        }
 
        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 : ""; 
                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,
                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);
                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,
                }
 #else
                if (!dbus_g_proxy_call (remote_object, "OpenURI", &error,
@@ -135,14 +156,15 @@ load_files_remote (const char **files)
                                        G_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
                                        G_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
-                       result = FALSE;
+                       g_free (uri);
+                       continue;
                }
 #endif
                g_free (uri);
                }
 #endif
                g_free (uri);
-               return result;
+               result = TRUE;
         }
 
         }
 
-       return TRUE;
+       return result;
 }
 #endif /* ENABLE_DBUS */
 
 }
 #endif /* ENABLE_DBUS */