X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=shell%2Fmain.c;h=3abe4cd2ea37ff7b542e5ab86824e8c575c10d56;hb=c087ebf90ee6c32656ae925d0c1682b427a21e7e;hp=56b6098a55b4caec8126c782f6f6f31534e64451;hpb=64d6ea86fc5614af0004c3e6e84d21706b04d56d;p=evince.git diff --git a/shell/main.c b/shell/main.c index 56b6098a..3abe4cd2 100644 --- a/shell/main.c +++ b/shell/main.c @@ -15,7 +15,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id$ */ #include "config.h" @@ -39,7 +38,6 @@ #endif #include "ev-stock-icons.h" -#include "ev-debug.h" #include "ev-job-queue.h" #include "ev-file-helpers.h" @@ -47,6 +45,7 @@ static gchar *ev_page_label; static gboolean preview_mode = FALSE; static gboolean fullscren_mode = FALSE; static gboolean presentation_mode = FALSE; +static gboolean unlink_temp_file = FALSE; static const char **file_arguments = NULL; static const GOptionEntry goption_options[] = @@ -55,6 +54,7 @@ static const GOptionEntry goption_options[] = { "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscren_mode, N_("Run evince in fullscreen mode"), NULL }, { "presentation", 's', 0, G_OPTION_ARG_NONE, &presentation_mode, N_("Run evince in presentation mode"), NULL }, { "preview", 'w', 0, G_OPTION_ARG_NONE, &preview_mode, N_("Run evince as a previewer"), NULL }, + { "unlink-tempfile", 'u', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &unlink_temp_file, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &file_arguments, NULL, N_("[FILE...]") }, { NULL } }; @@ -121,6 +121,16 @@ arguments_parse (void) g_hash_table_insert (args, g_strdup ("mode"), value); + if (mode == EV_WINDOW_MODE_PREVIEW && unlink_temp_file) { + value = g_new0 (GValue, 1); + g_value_init (value, G_TYPE_BOOLEAN); + g_value_set_boolean (value, unlink_temp_file); + + g_hash_table_insert (args, + g_strdup ("unlink-temp-file"), + value); + } + return args; } @@ -170,7 +180,6 @@ load_files (const char **files, } #ifdef ENABLE_DBUS - static gboolean load_files_remote (const char **files, GHashTable *args) @@ -179,9 +188,6 @@ load_files_remote (const char **files, GError *error = NULL; DBusGConnection *connection; gboolean result = FALSE; -#if DBUS_VERSION < 35 - DBusGPendingCall *call; -#endif DBusGProxy *remote_object; GdkDisplay *display; guint32 timestamp; @@ -202,31 +208,6 @@ load_files_remote (const char **files, "/org/gnome/evince/Evince", "org.gnome.evince.Application"); if (!files) { -#if DBUS_VERSION <= 33 - call = dbus_g_proxy_begin_call (remote_object, "OpenWindow", - DBUS_TYPE_UINT32, ×tamp, - 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_object_unref (remote_object); - dbus_g_connection_unref (connection); - return FALSE; - } -#elif DBUS_VERSION == 34 - call = dbus_g_proxy_begin_call (remote_object, "OpenWindow", - G_TYPE_UINT, timestamp, - 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_object_unref (remote_object); - dbus_g_connection_unref (connection); - return FALSE; - } -#else if (!dbus_g_proxy_call (remote_object, "OpenWindow", &error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), args, G_TYPE_UINT, timestamp, @@ -238,7 +219,7 @@ load_files_remote (const char **files, dbus_g_connection_unref (connection); return FALSE; } -#endif + g_object_unref (remote_object); dbus_g_connection_unref (connection); @@ -251,33 +232,7 @@ load_files_remote (const char **files, uri = gnome_vfs_make_uri_from_shell_arg (files[i]); page_label = ev_page_label ? ev_page_label : ""; -#if DBUS_VERSION <= 33 - call = dbus_g_proxy_begin_call (remote_object, "OpenURI", - DBUS_TYPE_STRING, &uri, - DBUS_TYPE_STRING, &page_label, - DBUS_TYPE_UINT32, ×tamp, - 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, - G_TYPE_UINT, timestamp, - 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); - continue; - } -#else + if (!dbus_g_proxy_call (remote_object, "OpenURI", &error, G_TYPE_STRING, uri, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), args, @@ -289,7 +244,7 @@ load_files_remote (const char **files, g_free (uri); continue; } -#endif + g_free (uri); result = TRUE; } @@ -345,7 +300,6 @@ main (int argc, char *argv[]) } #endif - gdk_threads_init (); gnome_authentication_manager_init (); if (enable_metadata) { @@ -356,7 +310,6 @@ main (int argc, char *argv[]) g_set_application_name (_("Evince Document Viewer")); ev_file_helpers_init (); - ev_debug_init (); ev_stock_icons_init (); gtk_window_set_default_icon_name ("evince");