1 /* this file is part of evince, a gnome document viewer
3 * Copyright (C) 2004 Martin Kretzschmar
6 * Martin Kretzschmar <martink@gnome.org>
8 * Evince is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Evince is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
29 #include <glib/gi18n.h>
31 #ifdef GDK_WINDOWING_X11
35 #include "totem-scrsaver.h"
36 #include "eggsmclient.h"
38 #include "ev-application.h"
39 #include "ev-document-factory.h"
40 #include "ev-file-helpers.h"
41 #include "ev-metadata-manager.h"
45 #include "ev-media-player-keys.h"
46 #endif /* ENABLE_DBUS */
49 #include <dbus/dbus-glib-bindings.h>
50 #include "ev-application-service.h"
53 static void ev_application_add_icon_path_for_screen (GdkScreen *screen);
54 static void ev_application_save_print_settings (EvApplication *application);
56 struct _EvApplication {
57 GObject base_instance;
60 gchar *accel_map_file;
63 EggToolbarsModel *toolbars_model;
65 TotemScrsaver *scr_saver;
67 EggSMClient *smclient;
69 gchar *last_chooser_uri;
72 EvMediaPlayerKeys *keys;
73 #endif /* ENABLE_DBUS */
75 GtkPrintSettings *print_settings;
76 GtkPageSetup *page_setup;
77 GKeyFile *print_settings_file;
80 struct _EvApplicationClass {
81 GObjectClass base_class;
84 static EvApplication *instance;
86 G_DEFINE_TYPE (EvApplication, ev_application, G_TYPE_OBJECT);
88 #define APPLICATION_SERVICE_NAME "org.gnome.evince.ApplicationService"
90 #define EV_PRINT_SETTINGS_FILE "print-settings"
91 #define EV_PRINT_SETTINGS_GROUP "Print Settings"
92 #define EV_PAGE_SETUP_GROUP "Page Setup"
96 ev_application_register_service (EvApplication *application)
98 static DBusGConnection *connection = NULL;
99 DBusGProxy *driver_proxy;
101 guint request_name_result;
104 g_warning ("Service already registered.");
108 connection = dbus_g_bus_get (DBUS_BUS_STARTER, &err);
109 if (connection == NULL) {
110 g_warning ("Service registration failed.");
116 driver_proxy = dbus_g_proxy_new_for_name (connection,
119 DBUS_INTERFACE_DBUS);
121 if (!org_freedesktop_DBus_request_name (driver_proxy,
122 APPLICATION_SERVICE_NAME,
123 DBUS_NAME_FLAG_DO_NOT_QUEUE,
124 &request_name_result, &err)) {
125 g_warning ("Service registration failed.");
126 g_clear_error (&err);
129 g_object_unref (driver_proxy);
131 if (request_name_result == DBUS_REQUEST_NAME_REPLY_EXISTS) {
135 dbus_g_object_type_install_info (EV_TYPE_APPLICATION,
136 &dbus_glib_ev_application_object_info);
137 dbus_g_connection_register_g_object (connection,
138 "/org/gnome/evince/Evince",
139 G_OBJECT (application));
141 application->scr_saver = totem_scrsaver_new (connection);
143 ev_metadata_manager_init ();
147 #endif /* ENABLE_DBUS */
150 * ev_application_get_instance:
152 * Checks for #EvApplication instance, if it doesn't exist it does create it.
154 * Returns: an instance of the #EvApplication data.
157 ev_application_get_instance (void)
160 instance = EV_APPLICATION (g_object_new (EV_TYPE_APPLICATION, NULL));
168 ev_application_load_session (EvApplication *application)
170 GKeyFile *state_file;
173 if (!egg_sm_client_is_resumed (application->smclient))
176 state_file = egg_sm_client_get_state_file (application->smclient);
180 uri_list = g_key_file_get_string_list (state_file,
187 for (i = 0; uri_list[i]; i++) {
188 if (g_ascii_strcasecmp (uri_list[i], "empty-window") == 0)
189 ev_application_open_window (application, NULL, GDK_CURRENT_TIME, NULL);
191 ev_application_open_uri (application, uri_list[i], NULL, GDK_CURRENT_TIME, NULL);
193 g_strfreev (uri_list);
195 g_key_file_free (state_file);
201 smclient_save_state_cb (EggSMClient *client,
202 GKeyFile *state_file,
203 EvApplication *application)
207 const gchar **uri_list;
208 const gchar *empty = "empty-window";
210 windows = ev_application_get_windows (application);
214 uri_list = g_new (const gchar *, g_list_length (windows));
215 for (l = windows, i = 0; l != NULL; l = g_list_next (l), i++) {
216 EvWindow *window = EV_WINDOW (l->data);
218 if (ev_window_is_empty (window))
221 uri_list[i] = ev_window_get_uri (window);
223 g_key_file_set_string_list (state_file,
226 (const char **)uri_list,
232 smclient_quit_cb (EggSMClient *client,
233 EvApplication *application)
235 ev_application_shutdown (application);
239 ev_application_init_session (EvApplication *application)
241 application->smclient = egg_sm_client_get ();
242 g_signal_connect (application->smclient, "save_state",
243 G_CALLBACK (smclient_save_state_cb),
245 g_signal_connect (application->smclient, "quit",
246 G_CALLBACK (smclient_quit_cb),
251 * ev_display_open_if_needed:
252 * @name: the name of the display to be open if it's needed.
254 * Search among all the open displays if any of them have the same name as the
255 * passed name. If the display isn't found it tries the open it.
257 * Returns: a #GdkDisplay of the display with the passed name.
260 ev_display_open_if_needed (const gchar *name)
264 GdkDisplay *display = NULL;
266 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
268 for (l = displays; l != NULL; l = l->next) {
269 const gchar *display_name = gdk_display_get_name ((GdkDisplay *) l->data);
271 if (g_ascii_strcasecmp (display_name, name) == 0) {
277 g_slist_free (displays);
279 return display != NULL ? display : gdk_display_open (name);
283 * get_screen_from_args:
284 * @args: a #GHashTable with data passed to the application.
286 * Looks for the screen in the display available in the hash table passed to the
287 * application. If the display isn't opened, it's opened and the #GdkScreen
288 * assigned to the screen in that display returned.
290 * Returns: the #GdkScreen assigned to the screen on the display indicated by
291 * the data on the #GHashTable.
294 get_screen_from_args (GHashTable *args)
296 GValue *value = NULL;
297 GdkDisplay *display = NULL;
298 GdkScreen *screen = NULL;
300 g_assert (args != NULL);
302 value = g_hash_table_lookup (args, "display");
304 const gchar *display_name;
306 display_name = g_value_get_string (value);
307 display = ev_display_open_if_needed (display_name);
310 value = g_hash_table_lookup (args, "screen");
314 screen_number = g_value_get_int (value);
315 screen = gdk_display_get_screen (display, screen_number);
322 * get_window_run_mode_from_args:
323 * @args: a #GHashTable with data passed to the application.
325 * It does look if the mode option has been passed from command line, using it
326 * as the window run mode, otherwise the run mode will be the normal mode.
328 * Returns: The window run mode passed from command line or
329 * EV_WINDOW_MODE_NORMAL in other case.
331 static EvWindowRunMode
332 get_window_run_mode_from_args (GHashTable *args)
334 EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
335 GValue *value = NULL;
337 g_assert (args != NULL);
339 value = g_hash_table_lookup (args, "mode");
341 mode = g_value_get_uint (value);
348 * get_destination_from_args:
349 * @args: a #GHashTable with data passed to the application.
351 * It does look for the page-label argument parsed from the command line and
352 * if it does exist, it returns an #EvLinkDest.
354 * Returns: An #EvLinkDest to page-label if it has been passed from the command
355 * line, NULL in other case.
358 get_destination_from_args (GHashTable *args)
360 EvLinkDest *dest = NULL;
361 GValue *value = NULL;
363 g_assert (args != NULL);
365 value = g_hash_table_lookup (args, "page-label");
367 const gchar *page_label;
369 page_label = g_value_get_string (value);
370 dest = ev_link_dest_new_page_label (page_label);
377 get_find_string_from_args (GHashTable *args)
379 GValue *value = NULL;
381 g_assert (args != NULL);
383 value = g_hash_table_lookup (args, "find-string");
385 return value ? g_value_get_string (value) : NULL;
389 * get_unlink_temp_file_from_args:
390 * @args: a #GHashTable with data passed to the application.
392 * It does look if the unlink-temp-file option has been passed from the command
393 * line returning it's boolean representation, otherwise it does return %FALSE.
395 * Returns: the boolean representation of the unlink-temp-file value or %FALSE
399 get_unlink_temp_file_from_args (GHashTable *args)
401 gboolean unlink_temp_file = FALSE;
402 GValue *value = NULL;
404 g_assert (args != NULL);
406 value = g_hash_table_lookup (args, "unlink-temp-file");
408 unlink_temp_file = g_value_get_boolean (value);
411 return unlink_temp_file;
415 get_print_settings_from_args (GHashTable *args)
417 const gchar *print_settings = NULL;
418 GValue *value = NULL;
420 g_assert (args != NULL);
422 value = g_hash_table_lookup (args, "print-settings");
424 print_settings = g_value_get_string (value);
427 return print_settings;
431 * ev_application_open_window:
432 * @application: The instance of the application.
433 * @args: A #GHashTable with the arguments data.
434 * @timestamp: Current time value.
435 * @error: The #GError facility.
437 * Creates a new window and if the args are available, it's not NULL, it gets
438 * the screen from them and assigns the just created window to it. At last it
444 ev_application_open_window (EvApplication *application,
449 GtkWidget *new_window = ev_window_new ();
450 GdkScreen *screen = NULL;
453 screen = get_screen_from_args (args);
457 gtk_window_set_screen (GTK_WINDOW (new_window), screen);
459 ev_application_add_icon_path_for_screen (screen);
461 if (!GTK_WIDGET_REALIZED (new_window))
462 gtk_widget_realize (new_window);
464 #ifdef GDK_WINDOWING_X11
466 timestamp = gdk_x11_get_server_time (GTK_WIDGET (new_window)->window);
467 gdk_x11_window_set_user_time (GTK_WIDGET (new_window)->window, timestamp);
469 gtk_window_present (GTK_WINDOW (new_window));
471 gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
472 #endif /* GDK_WINDOWING_X11 */
478 * ev_application_get_empty_window:
479 * @application: The instance of the application.
480 * @screen: The screen where the empty window will be search.
482 * It does look if there is any empty window in the indicated screen.
484 * Returns: The first empty #EvWindow in the passed #GdkScreen or NULL in other
488 ev_application_get_empty_window (EvApplication *application,
491 EvWindow *empty_window = NULL;
492 GList *windows = ev_application_get_windows (application);
495 for (l = windows; l != NULL; l = l->next) {
496 EvWindow *window = EV_WINDOW (l->data);
498 if (ev_window_is_empty (window) &&
499 gtk_window_get_screen (GTK_WINDOW (window)) == screen) {
500 empty_window = window;
505 g_list_free (windows);
511 * ev_application_get_uri_window:
512 * @application: The instance of the application.
513 * @uri: The uri to be opened.
515 * It looks in the list of the windows for the one with the document represented
516 * by the passed uri on it. If the window is empty or the document isn't present
517 * on any window, it will return NULL.
519 * Returns: The #EvWindow where the document represented by the passed uri is
520 * shown, NULL in other case.
523 ev_application_get_uri_window (EvApplication *application, const char *uri)
525 EvWindow *uri_window = NULL;
526 GList *windows = gtk_window_list_toplevels ();
529 g_return_val_if_fail (uri != NULL, NULL);
531 for (l = windows; l != NULL; l = l->next) {
532 if (EV_IS_WINDOW (l->data)) {
533 EvWindow *window = EV_WINDOW (l->data);
534 const char *window_uri = ev_window_get_uri (window);
536 if (window_uri && strcmp (window_uri, uri) == 0 && !ev_window_is_empty (window)) {
543 g_list_free (windows);
549 ev_application_add_icon_path_for_screen (GdkScreen *screen)
551 GtkIconTheme *icon_theme;
553 icon_theme = screen ? gtk_icon_theme_get_for_screen (screen) : gtk_icon_theme_get_default ();
558 gchar *ev_icons_path;
560 /* GtkIconTheme will then look in Evince custom hicolor dir
561 * for icons as well as the standard search paths
563 ev_icons_path = g_build_filename (DATADIR, "icons", NULL);
564 gtk_icon_theme_get_search_path (icon_theme, &path, &n_paths);
565 for (i = n_paths - 1; i >= 0; i--) {
566 if (g_ascii_strcasecmp (ev_icons_path, path[i]) == 0)
571 gtk_icon_theme_append_search_path (icon_theme,
574 g_free (ev_icons_path);
580 * ev_application_open_uri_at_dest:
581 * @application: The instance of the application.
582 * @uri: The uri to be opened.
583 * @screen: Thee screen where the link will be shown.
584 * @dest: The #EvLinkDest of the document.
585 * @mode: The run mode of the window.
586 * @unlink_temp_file: The unlink_temp_file option value.
587 * @timestamp: Current time value.
590 ev_application_open_uri_at_dest (EvApplication *application,
594 EvWindowRunMode mode,
595 const gchar *search_string,
596 gboolean unlink_temp_file,
597 const gchar *print_settings,
600 EvWindow *new_window;
602 g_return_if_fail (uri != NULL);
604 ev_application_add_icon_path_for_screen (screen);
606 new_window = ev_application_get_uri_window (application, uri);
608 if (new_window == NULL) {
609 new_window = ev_application_get_empty_window (application, screen);
612 if (new_window == NULL) {
613 new_window = EV_WINDOW (ev_window_new ());
617 gtk_window_set_screen (GTK_WINDOW (new_window), screen);
619 /* We need to load uri before showing the window, so
620 we can restore window size without flickering */
621 ev_window_open_uri (new_window, uri, dest, mode, search_string,
622 unlink_temp_file, print_settings);
624 if (!GTK_WIDGET_REALIZED (GTK_WIDGET (new_window)))
625 gtk_widget_realize (GTK_WIDGET (new_window));
627 #ifdef GDK_WINDOWING_X11
629 timestamp = gdk_x11_get_server_time (GTK_WIDGET (new_window)->window);
630 gdk_x11_window_set_user_time (GTK_WIDGET (new_window)->window, timestamp);
632 ev_document_fc_mutex_lock ();
633 gtk_window_present (GTK_WINDOW (new_window));
634 ev_document_fc_mutex_unlock ();
636 ev_document_fc_mutex_lock ();
637 gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
638 ev_document_fc_mutex_unlock ();
639 #endif /* GDK_WINDOWING_X11 */
643 * ev_application_open_uri:
644 * @application: The instance of the application.
645 * @uri: The uri to be opened
646 * @args: A #GHashTable with the arguments data.
647 * @timestamp: Current time value.
648 * @error: The #GError facility.
651 ev_application_open_uri (EvApplication *application,
657 EvLinkDest *dest = NULL;
658 EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
659 const gchar *search_string = NULL;
660 gboolean unlink_temp_file = FALSE;
661 const gchar *print_settings = NULL;
662 GdkScreen *screen = NULL;
665 screen = get_screen_from_args (args);
666 dest = get_destination_from_args (args);
667 mode = get_window_run_mode_from_args (args);
668 search_string = get_find_string_from_args (args);
669 unlink_temp_file = (mode == EV_WINDOW_MODE_PREVIEW &&
670 get_unlink_temp_file_from_args (args));
671 print_settings = get_print_settings_from_args (args);
674 ev_application_open_uri_at_dest (application, uri, screen,
675 dest, mode, search_string,
677 print_settings, timestamp);
680 g_object_unref (dest);
686 ev_application_open_uri_list (EvApplication *application,
693 for (l = uri_list; l != NULL; l = l->next) {
694 ev_application_open_uri_at_dest (application, (char *)l->data,
695 screen, NULL, 0, NULL,
696 FALSE, NULL, timestamp);
701 ev_application_shutdown (EvApplication *application)
703 if (application->accel_map_file) {
704 gtk_accel_map_save (application->accel_map_file);
705 g_free (application->accel_map_file);
706 application->accel_map_file = NULL;
709 if (application->toolbars_model) {
710 g_object_unref (application->toolbars_model);
711 g_free (application->toolbars_file);
712 application->toolbars_model = NULL;
713 application->toolbars_file = NULL;
716 ev_application_save_print_settings (application);
718 if (application->print_settings_file) {
719 g_key_file_free (application->print_settings_file);
720 application->print_settings_file = NULL;
723 if (application->print_settings) {
724 g_object_unref (application->print_settings);
725 application->print_settings = NULL;
728 if (application->page_setup) {
729 g_object_unref (application->page_setup);
730 application->page_setup = NULL;
734 if (application->keys) {
735 g_object_unref (application->keys);
736 application->keys = NULL;
738 #endif /* ENABLE_DBUS */
740 ev_metadata_manager_shutdown ();
742 g_free (application->dot_dir);
743 application->dot_dir = NULL;
744 g_free (application->last_chooser_uri);
745 application->last_chooser_uri = NULL;
747 g_object_unref (application);
754 ev_application_class_init (EvApplicationClass *ev_application_class)
759 ev_application_init (EvApplication *ev_application)
762 const gchar *home_dir;
764 ev_application_init_session (ev_application);
766 ev_application->dot_dir = g_build_filename (g_get_home_dir (),
771 /* FIXME: why make this fatal? */
772 if (!ev_dir_ensure_exists (ev_application->dot_dir, 0700))
775 home_dir = g_get_home_dir ();
777 ev_application->accel_map_file = g_build_filename (home_dir,
782 gtk_accel_map_load (ev_application->accel_map_file);
785 ev_application->toolbars_model = egg_toolbars_model_new ();
787 ev_application->toolbars_file = g_build_filename
788 (ev_application->dot_dir, "evince_toolbar.xml", NULL);
790 egg_toolbars_model_load_names (ev_application->toolbars_model,
791 DATADIR "/evince-toolbar.xml");
793 if (!egg_toolbars_model_load_toolbars (ev_application->toolbars_model,
794 ev_application->toolbars_file)) {
795 egg_toolbars_model_load_toolbars (ev_application->toolbars_model,
796 DATADIR"/evince-toolbar.xml");
799 /* Open item doesn't exist anymore,
800 * convert it to OpenRecent for compatibility
802 for (i = 0; i < egg_toolbars_model_n_items (ev_application->toolbars_model, 0); i++) {
805 item = egg_toolbars_model_item_nth (ev_application->toolbars_model, 0, i);
806 if (g_ascii_strcasecmp (item, "FileOpen") == 0) {
807 egg_toolbars_model_remove_item (ev_application->toolbars_model, 0, i);
808 egg_toolbars_model_add_item (ev_application->toolbars_model, 0, i,
810 ev_application_save_toolbars_model (ev_application);
815 egg_toolbars_model_set_flags (ev_application->toolbars_model, 0,
816 EGG_TB_MODEL_NOT_REMOVABLE);
819 ev_application->keys = ev_media_player_keys_new ();
820 #endif /* ENABLE_DBUS */
824 * ev_application_get_windows:
825 * @application: The instance of the application.
827 * It creates a list of the top level windows.
829 * Returns: A #GList of the top level windows.
832 ev_application_get_windows (EvApplication *application)
834 GList *l, *toplevels;
835 GList *windows = NULL;
837 toplevels = gtk_window_list_toplevels ();
839 for (l = toplevels; l != NULL; l = l->next) {
840 if (EV_IS_WINDOW (l->data)) {
841 windows = g_list_append (windows, l->data);
845 g_list_free (toplevels);
851 * ev_application_get_media_keys:
852 * @application: The instance of the application.
854 * It gives you access to the media player keys handler object.
856 * Returns: A #EvMediaPlayerKeys.
859 ev_application_get_media_keys (EvApplication *application)
862 return G_OBJECT (application->keys);
865 #endif /* ENABLE_DBUS */
869 ev_application_get_toolbars_model (EvApplication *application)
871 return application->toolbars_model;
875 ev_application_save_toolbars_model (EvApplication *application)
877 egg_toolbars_model_save_toolbars (application->toolbars_model,
878 application->toolbars_file, "1.0");
882 ev_application_set_chooser_uri (EvApplication *application, const gchar *uri)
884 g_free (application->last_chooser_uri);
885 application->last_chooser_uri = g_strdup (uri);
889 ev_application_get_chooser_uri (EvApplication *application)
891 return application->last_chooser_uri;
895 ev_application_screensaver_enable (EvApplication *application)
897 if (application->scr_saver)
898 totem_scrsaver_enable (application->scr_saver);
902 ev_application_screensaver_disable (EvApplication *application)
904 if (application->scr_saver)
905 totem_scrsaver_disable (application->scr_saver);
909 ev_application_get_print_settings_file (EvApplication *application)
913 if (application->print_settings_file)
914 return application->print_settings_file;
916 application->print_settings_file = g_key_file_new ();
918 filename = g_build_filename (ev_application_get_dot_dir (application), EV_PRINT_SETTINGS_FILE, NULL);
919 if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
920 GError *error = NULL;
922 g_key_file_load_from_file (application->print_settings_file,
924 G_KEY_FILE_KEEP_COMMENTS |
925 G_KEY_FILE_KEEP_TRANSLATIONS,
928 g_warning ("%s", error->message);
929 g_error_free (error);
934 return application->print_settings_file;
938 ev_application_save_print_settings (EvApplication *application)
944 GError *error = NULL;
946 if (!application->print_settings && !application->page_setup)
949 key_file = ev_application_get_print_settings_file (application);
950 if (application->print_settings)
951 gtk_print_settings_to_key_file (application->print_settings,
953 EV_PRINT_SETTINGS_GROUP);
954 if (application->page_setup)
955 gtk_page_setup_to_key_file (application->page_setup,
957 EV_PAGE_SETUP_GROUP);
959 filename = g_build_filename (ev_application_get_dot_dir (application), EV_PRINT_SETTINGS_FILE, NULL);
960 data = g_key_file_to_data (key_file, (gsize *)&data_length, NULL);
961 g_file_set_contents (filename, data, data_length, &error);
963 g_warning ("%s", error->message);
964 g_error_free (error);
971 ev_application_get_print_settings (EvApplication *application)
974 GtkPrintSettings *print_settings;
976 if (application->print_settings)
977 return application->print_settings;
979 key_file = ev_application_get_print_settings_file (application);
980 print_settings = g_key_file_has_group (key_file, EV_PRINT_SETTINGS_GROUP) ?
981 gtk_print_settings_new_from_key_file (key_file, EV_PRINT_SETTINGS_GROUP, NULL) :
982 gtk_print_settings_new ();
984 application->print_settings = print_settings ? print_settings : gtk_print_settings_new ();
986 return application->print_settings;
990 ev_application_set_print_settings (EvApplication *application,
991 GtkPrintSettings *settings)
995 g_return_if_fail (GTK_IS_PRINT_SETTINGS (settings));
997 if (settings == application->print_settings)
1000 key_file = ev_application_get_print_settings_file (application);
1002 if (application->print_settings)
1003 g_object_unref (application->print_settings);
1005 application->print_settings = g_object_ref (settings);
1006 gtk_print_settings_to_key_file (settings, key_file, EV_PRINT_SETTINGS_GROUP);
1010 ev_application_get_page_setup (EvApplication *application)
1013 GtkPageSetup *page_setup;
1015 if (application->page_setup)
1016 return application->page_setup;
1018 key_file = ev_application_get_print_settings_file (application);
1019 page_setup = g_key_file_has_group (key_file, EV_PAGE_SETUP_GROUP) ?
1020 gtk_page_setup_new_from_key_file (key_file, EV_PAGE_SETUP_GROUP, NULL) :
1021 gtk_page_setup_new ();
1023 application->page_setup = page_setup ? page_setup : gtk_page_setup_new ();
1025 return application->page_setup;
1029 ev_application_set_page_setup (EvApplication *application,
1030 GtkPageSetup *page_setup)
1034 g_return_if_fail (GTK_IS_PAGE_SETUP (page_setup));
1036 if (page_setup == application->page_setup)
1039 key_file = ev_application_get_print_settings_file (application);
1041 if (application->page_setup)
1042 g_object_unref (application->page_setup);
1044 application->page_setup = g_object_ref (page_setup);
1045 gtk_page_setup_to_key_file (page_setup, key_file, EV_PAGE_SETUP_GROUP);
1049 ev_application_get_dot_dir (EvApplication *application)
1051 return application->dot_dir;