]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-application.c
Update for release 2.20.0
[evince.git] / shell / ev-application.c
index 1d21c2c1dfc6b5d2e4cccb1e2633c8f2f0d43df9..7633fb7a3cde6f203aed2fbe9b35a3123850f9d4 100644 (file)
@@ -45,6 +45,8 @@
 
 #include <string.h>
 
 
 #include <string.h>
 
+static void ev_application_add_icon_path_for_screen (GdkScreen *screen);
+
 struct _EvApplication {
        GObject base_instance;
 
 struct _EvApplication {
        GObject base_instance;
 
@@ -350,6 +352,22 @@ get_unlink_temp_file_from_args (GHashTable *args)
        return unlink_temp_file;
 }
 
        return unlink_temp_file;
 }
 
+static const gchar *
+get_print_settings_from_args (GHashTable *args)
+{
+       const gchar *print_settings = NULL;
+       GValue      *value = NULL;
+
+       g_assert (args != NULL);
+
+       value = g_hash_table_lookup (args, "print-settings");
+       if (value) {
+               print_settings = g_value_get_string (value);
+       }
+
+       return print_settings;
+}
+
 /**
  * ev_application_open_window:
  * @application: The instance of the application.
 /**
  * ev_application_open_window:
  * @application: The instance of the application.
@@ -379,6 +397,7 @@ ev_application_open_window (EvApplication  *application,
        if (screen) {
                gtk_window_set_screen (GTK_WINDOW (new_window), screen);
        }
        if (screen) {
                gtk_window_set_screen (GTK_WINDOW (new_window), screen);
        }
+       ev_application_add_icon_path_for_screen (screen);
        
        gtk_widget_show (new_window);
        
        
        gtk_widget_show (new_window);
        
@@ -458,30 +477,11 @@ ev_application_get_uri_window (EvApplication *application, const char *uri)
        return uri_window;
 }
 
        return uri_window;
 }
 
-/**
- * ev_application_open_uri_at_dest:
- * @application: The instance of the application.
- * @uri: The uri to be opened.
- * @screen: Thee screen where the link will be shown.
- * @dest: The #EvLinkDest of the document.
- * @mode: The run mode of the window.
- * @unlink_temp_file: The unlink_temp_file option value.
- * @timestamp: Current time value.
- */
-void
-ev_application_open_uri_at_dest (EvApplication  *application,
-                                const char     *uri,
-                                GdkScreen      *screen,
-                                EvLinkDest     *dest,
-                                EvWindowRunMode mode,
-                                gboolean        unlink_temp_file,
-                                guint           timestamp)
+static void
+ev_application_add_icon_path_for_screen (GdkScreen *screen)
 {
 {
-       EvWindow     *new_window;
        GtkIconTheme *icon_theme;
 
        GtkIconTheme *icon_theme;
 
-       g_return_if_fail (uri != NULL);
-
        icon_theme = gtk_icon_theme_get_for_screen (screen);
        if (icon_theme) {
                gchar **path = NULL;
        icon_theme = gtk_icon_theme_get_for_screen (screen);
        if (icon_theme) {
                gchar **path = NULL;
@@ -506,6 +506,33 @@ ev_application_open_uri_at_dest (EvApplication  *application,
                g_free (ev_icons_path);
                g_strfreev (path);
        }       
                g_free (ev_icons_path);
                g_strfreev (path);
        }       
+}
+
+/**
+ * ev_application_open_uri_at_dest:
+ * @application: The instance of the application.
+ * @uri: The uri to be opened.
+ * @screen: Thee screen where the link will be shown.
+ * @dest: The #EvLinkDest of the document.
+ * @mode: The run mode of the window.
+ * @unlink_temp_file: The unlink_temp_file option value.
+ * @timestamp: Current time value.
+ */
+void
+ev_application_open_uri_at_dest (EvApplication  *application,
+                                const char     *uri,
+                                GdkScreen      *screen,
+                                EvLinkDest     *dest,
+                                EvWindowRunMode mode,
+                                gboolean        unlink_temp_file,
+                                const gchar    *print_settings, 
+                                guint           timestamp)
+{
+       EvWindow *new_window;
+
+       g_return_if_fail (uri != NULL);
+       
+       ev_application_add_icon_path_for_screen (screen);
 
        new_window = ev_application_get_uri_window (application, uri);
        
 
        new_window = ev_application_get_uri_window (application, uri);
        
@@ -522,7 +549,8 @@ ev_application_open_uri_at_dest (EvApplication  *application,
 
        /* We need to load uri before showing the window, so
           we can restore window size without flickering */     
 
        /* We need to load uri before showing the window, so
           we can restore window size without flickering */     
-       ev_window_open_uri (new_window, uri, dest, mode, unlink_temp_file);
+       ev_window_open_uri (new_window, uri, dest, mode,
+                           unlink_temp_file, print_settings);
 
        ev_document_fc_mutex_lock ();
        gtk_widget_show (GTK_WIDGET (new_window));
 
        ev_document_fc_mutex_lock ();
        gtk_widget_show (GTK_WIDGET (new_window));
@@ -550,6 +578,7 @@ ev_application_open_uri (EvApplication  *application,
        EvLinkDest      *dest = NULL;
        EvWindowRunMode  mode = EV_WINDOW_MODE_NORMAL;
        gboolean         unlink_temp_file = FALSE;
        EvLinkDest      *dest = NULL;
        EvWindowRunMode  mode = EV_WINDOW_MODE_NORMAL;
        gboolean         unlink_temp_file = FALSE;
+       const gchar     *print_settings = NULL;
        GdkScreen       *screen = NULL;
 
        if (args) {
        GdkScreen       *screen = NULL;
 
        if (args) {
@@ -558,11 +587,12 @@ ev_application_open_uri (EvApplication  *application,
                mode = get_window_run_mode_from_args (args);
                unlink_temp_file = (mode == EV_WINDOW_MODE_PREVIEW &&
                                    get_unlink_temp_file_from_args (args));
                mode = get_window_run_mode_from_args (args);
                unlink_temp_file = (mode == EV_WINDOW_MODE_PREVIEW &&
                                    get_unlink_temp_file_from_args (args));
+               print_settings = get_print_settings_from_args (args);
        }
        
        ev_application_open_uri_at_dest (application, uri, screen,
        }
        
        ev_application_open_uri_at_dest (application, uri, screen,
-                                        dest, mode, unlink_temp_file, 
-                                        timestamp);
+                                        dest, mode, unlink_temp_file,
+                                        print_settings, timestamp);
 
        if (dest)
                g_object_unref (dest);
 
        if (dest)
                g_object_unref (dest);
@@ -580,8 +610,8 @@ ev_application_open_uri_list (EvApplication *application,
 
        for (l = uri_list; l != NULL; l = l->next) {
                ev_application_open_uri_at_dest (application, (char *)l->data,
 
        for (l = uri_list; l != NULL; l = l->next) {
                ev_application_open_uri_at_dest (application, (char *)l->data,
-                                                screen, NULL, 0, FALSE, 
-                                                timestamp);
+                                                screen, NULL, 0, FALSE,
+                                                NULL, timestamp);
        }
 }
 
        }
 }