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>
33 #include "totem-scrsaver.h"
34 #include "eggsmclient.h"
36 #include "ev-application.h"
37 #include "ev-document-factory.h"
38 #include "ev-file-helpers.h"
39 #include "ev-metadata-manager.h"
43 #include "ev-media-player-keys.h"
44 #endif /* ENABLE_DBUS */
47 #include <dbus/dbus-glib-bindings.h>
48 #include "ev-application-service.h"
51 static void ev_application_add_icon_path_for_screen (GdkScreen *screen);
52 static void ev_application_save_print_settings (EvApplication *application);
54 struct _EvApplication {
55 GObject base_instance;
58 gchar *accel_map_file;
61 EggToolbarsModel *toolbars_model;
63 TotemScrsaver *scr_saver;
65 EggSMClient *smclient;
67 gchar *last_chooser_uri;
70 EvMediaPlayerKeys *keys;
71 #endif /* ENABLE_DBUS */
73 GtkPrintSettings *print_settings;
74 GtkPageSetup *page_setup;
75 GKeyFile *print_settings_file;
78 struct _EvApplicationClass {
79 GObjectClass base_class;
82 static EvApplication *instance;
84 G_DEFINE_TYPE (EvApplication, ev_application, G_TYPE_OBJECT);
86 #define APPLICATION_SERVICE_NAME "org.gnome.evince.ApplicationService"
88 #define EV_PRINT_SETTINGS_FILE "print-settings"
89 #define EV_PRINT_SETTINGS_GROUP "Print Settings"
90 #define EV_PAGE_SETUP_GROUP "Page Setup"
94 ev_application_register_service (EvApplication *application)
96 static DBusGConnection *connection = NULL;
97 DBusGProxy *driver_proxy;
99 guint request_name_result;
102 g_warning ("Service already registered.");
106 connection = dbus_g_bus_get (DBUS_BUS_STARTER, &err);
107 if (connection == NULL) {
108 g_warning ("Service registration failed.");
114 driver_proxy = dbus_g_proxy_new_for_name (connection,
117 DBUS_INTERFACE_DBUS);
119 if (!org_freedesktop_DBus_request_name (driver_proxy,
120 APPLICATION_SERVICE_NAME,
121 DBUS_NAME_FLAG_DO_NOT_QUEUE,
122 &request_name_result, &err)) {
123 g_warning ("Service registration failed.");
124 g_clear_error (&err);
127 g_object_unref (driver_proxy);
129 if (request_name_result == DBUS_REQUEST_NAME_REPLY_EXISTS) {
133 dbus_g_object_type_install_info (EV_TYPE_APPLICATION,
134 &dbus_glib_ev_application_object_info);
135 dbus_g_connection_register_g_object (connection,
136 "/org/gnome/evince/Evince",
137 G_OBJECT (application));
139 application->scr_saver = totem_scrsaver_new (connection);
141 ev_metadata_manager_init ();
145 #endif /* ENABLE_DBUS */
148 * ev_application_get_instance:
150 * Checks for #EvApplication instance, if it doesn't exist it does create it.
152 * Returns: an instance of the #EvApplication data.
155 ev_application_get_instance (void)
158 instance = EV_APPLICATION (g_object_new (EV_TYPE_APPLICATION, NULL));
166 ev_application_load_session (EvApplication *application)
168 GKeyFile *state_file;
171 if (!egg_sm_client_is_resumed (application->smclient))
174 state_file = egg_sm_client_get_state_file (application->smclient);
178 uri_list = g_key_file_get_string_list (state_file,
185 for (i = 0; uri_list[i]; i++) {
186 if (g_ascii_strcasecmp (uri_list[i], "empty-window") == 0)
187 ev_application_open_window (application, NULL, GDK_CURRENT_TIME, NULL);
189 ev_application_open_uri (application, uri_list[i], NULL, GDK_CURRENT_TIME, NULL);
191 g_strfreev (uri_list);
193 g_key_file_free (state_file);
199 smclient_save_state_cb (EggSMClient *client,
200 GKeyFile *state_file,
201 EvApplication *application)
205 const gchar **uri_list;
206 const gchar *empty = "empty-window";
208 windows = ev_application_get_windows (application);
212 uri_list = g_new (const gchar *, g_list_length (windows));
213 for (l = windows, i = 0; l != NULL; l = g_list_next (l), i++) {
214 EvWindow *window = EV_WINDOW (l->data);
216 if (ev_window_is_empty (window))
219 uri_list[i] = ev_window_get_uri (window);
221 g_key_file_set_string_list (state_file,
224 (const char **)uri_list,
230 smclient_quit_cb (EggSMClient *client,
231 EvApplication *application)
233 ev_application_shutdown (application);
237 ev_application_init_session (EvApplication *application)
239 application->smclient = egg_sm_client_get ();
240 g_signal_connect (application->smclient, "save_state",
241 G_CALLBACK (smclient_save_state_cb),
243 g_signal_connect (application->smclient, "quit",
244 G_CALLBACK (smclient_quit_cb),
249 * ev_display_open_if_needed:
250 * @name: the name of the display to be open if it's needed.
252 * Search among all the open displays if any of them have the same name as the
253 * passed name. If the display isn't found it tries the open it.
255 * Returns: a #GdkDisplay of the display with the passed name.
258 ev_display_open_if_needed (const gchar *name)
262 GdkDisplay *display = NULL;
264 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
266 for (l = displays; l != NULL; l = l->next) {
267 const gchar *display_name = gdk_display_get_name ((GdkDisplay *) l->data);
269 if (g_ascii_strcasecmp (display_name, name) == 0) {
275 g_slist_free (displays);
277 return display != NULL ? display : gdk_display_open (name);
281 * get_screen_from_args:
282 * @args: a #GHashTable with data passed to the application.
284 * Looks for the screen in the display available in the hash table passed to the
285 * application. If the display isn't opened, it's opened and the #GdkScreen
286 * assigned to the screen in that display returned.
288 * Returns: the #GdkScreen assigned to the screen on the display indicated by
289 * the data on the #GHashTable.
292 get_screen_from_args (GHashTable *args)
294 GValue *value = NULL;
295 GdkDisplay *display = NULL;
296 GdkScreen *screen = NULL;
298 g_assert (args != NULL);
300 value = g_hash_table_lookup (args, "display");
302 const gchar *display_name;
304 display_name = g_value_get_string (value);
305 display = ev_display_open_if_needed (display_name);
308 value = g_hash_table_lookup (args, "screen");
312 screen_number = g_value_get_int (value);
313 screen = gdk_display_get_screen (display, screen_number);
320 * get_window_run_mode_from_args:
321 * @args: a #GHashTable with data passed to the application.
323 * It does look if the mode option has been passed from command line, using it
324 * as the window run mode, otherwise the run mode will be the normal mode.
326 * Returns: The window run mode passed from command line or
327 * EV_WINDOW_MODE_NORMAL in other case.
329 static EvWindowRunMode
330 get_window_run_mode_from_args (GHashTable *args)
332 EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
333 GValue *value = NULL;
335 g_assert (args != NULL);
337 value = g_hash_table_lookup (args, "mode");
339 mode = g_value_get_uint (value);
346 * get_destination_from_args:
347 * @args: a #GHashTable with data passed to the application.
349 * It does look for the page-label argument parsed from the command line and
350 * if it does exist, it returns an #EvLinkDest.
352 * Returns: An #EvLinkDest to page-label if it has been passed from the command
353 * line, NULL in other case.
356 get_destination_from_args (GHashTable *args)
358 EvLinkDest *dest = NULL;
359 GValue *value = NULL;
361 g_assert (args != NULL);
363 value = g_hash_table_lookup (args, "page-label");
365 const gchar *page_label;
367 page_label = g_value_get_string (value);
368 dest = ev_link_dest_new_page_label (page_label);
375 get_find_string_from_args (GHashTable *args)
377 GValue *value = NULL;
379 g_assert (args != NULL);
381 value = g_hash_table_lookup (args, "find-string");
383 return value ? g_value_get_string (value) : NULL;
387 * get_unlink_temp_file_from_args:
388 * @args: a #GHashTable with data passed to the application.
390 * It does look if the unlink-temp-file option has been passed from the command
391 * line returning it's boolean representation, otherwise it does return %FALSE.
393 * Returns: the boolean representation of the unlink-temp-file value or %FALSE
397 get_unlink_temp_file_from_args (GHashTable *args)
399 gboolean unlink_temp_file = FALSE;
400 GValue *value = NULL;
402 g_assert (args != NULL);
404 value = g_hash_table_lookup (args, "unlink-temp-file");
406 unlink_temp_file = g_value_get_boolean (value);
409 return unlink_temp_file;
413 get_print_settings_from_args (GHashTable *args)
415 const gchar *print_settings = NULL;
416 GValue *value = NULL;
418 g_assert (args != NULL);
420 value = g_hash_table_lookup (args, "print-settings");
422 print_settings = g_value_get_string (value);
425 return print_settings;
429 * ev_application_open_window:
430 * @application: The instance of the application.
431 * @args: A #GHashTable with the arguments data.
432 * @timestamp: Current time value.
433 * @error: The #GError facility.
435 * Creates a new window and if the args are available, it's not NULL, it gets
436 * the screen from them and assigns the just created window to it. At last it
442 ev_application_open_window (EvApplication *application,
447 GtkWidget *new_window = ev_window_new ();
448 GdkScreen *screen = NULL;
451 screen = get_screen_from_args (args);
455 gtk_window_set_screen (GTK_WINDOW (new_window), screen);
457 ev_application_add_icon_path_for_screen (screen);
459 if (!GTK_WIDGET_REALIZED (new_window))
460 gtk_widget_realize (new_window);
462 #ifdef GDK_WINDOWING_X11
464 timestamp = gdk_x11_get_server_time (GTK_WIDGET (new_window)->window);
465 gdk_x11_window_set_user_time (GTK_WIDGET (new_window)->window, timestamp);
467 gtk_window_present (GTK_WINDOW (new_window));
469 gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
470 #endif /* GDK_WINDOWING_X11 */
476 * ev_application_get_empty_window:
477 * @application: The instance of the application.
478 * @screen: The screen where the empty window will be search.
480 * It does look if there is any empty window in the indicated screen.
482 * Returns: The first empty #EvWindow in the passed #GdkScreen or NULL in other
486 ev_application_get_empty_window (EvApplication *application,
489 EvWindow *empty_window = NULL;
490 GList *windows = ev_application_get_windows (application);
493 for (l = windows; l != NULL; l = l->next) {
494 EvWindow *window = EV_WINDOW (l->data);
496 if (ev_window_is_empty (window) &&
497 gtk_window_get_screen (GTK_WINDOW (window)) == screen) {
498 empty_window = window;
503 g_list_free (windows);
509 * ev_application_get_uri_window:
510 * @application: The instance of the application.
511 * @uri: The uri to be opened.
513 * It looks in the list of the windows for the one with the document represented
514 * by the passed uri on it. If the window is empty or the document isn't present
515 * on any window, it will return NULL.
517 * Returns: The #EvWindow where the document represented by the passed uri is
518 * shown, NULL in other case.
521 ev_application_get_uri_window (EvApplication *application, const char *uri)
523 EvWindow *uri_window = NULL;
524 GList *windows = gtk_window_list_toplevels ();
527 g_return_val_if_fail (uri != NULL, NULL);
529 for (l = windows; l != NULL; l = l->next) {
530 if (EV_IS_WINDOW (l->data)) {
531 EvWindow *window = EV_WINDOW (l->data);
532 const char *window_uri = ev_window_get_uri (window);
534 if (window_uri && strcmp (window_uri, uri) == 0 && !ev_window_is_empty (window)) {
541 g_list_free (windows);
547 ev_application_add_icon_path_for_screen (GdkScreen *screen)
549 GtkIconTheme *icon_theme;
551 icon_theme = screen ? gtk_icon_theme_get_for_screen (screen) : gtk_icon_theme_get_default ();
556 gchar *ev_icons_path;
558 /* GtkIconTheme will then look in Evince custom hicolor dir
559 * for icons as well as the standard search paths
561 ev_icons_path = g_build_filename (DATADIR, "icons", NULL);
562 gtk_icon_theme_get_search_path (icon_theme, &path, &n_paths);
563 for (i = n_paths - 1; i >= 0; i--) {
564 if (g_ascii_strcasecmp (ev_icons_path, path[i]) == 0)
569 gtk_icon_theme_append_search_path (icon_theme,
572 g_free (ev_icons_path);
578 * ev_application_open_uri_at_dest:
579 * @application: The instance of the application.
580 * @uri: The uri to be opened.
581 * @screen: Thee screen where the link will be shown.
582 * @dest: The #EvLinkDest of the document.
583 * @mode: The run mode of the window.
584 * @unlink_temp_file: The unlink_temp_file option value.
585 * @timestamp: Current time value.
588 ev_application_open_uri_at_dest (EvApplication *application,
592 EvWindowRunMode mode,
593 const gchar *search_string,
594 gboolean unlink_temp_file,
595 const gchar *print_settings,
598 EvWindow *new_window;
600 g_return_if_fail (uri != NULL);
602 ev_application_add_icon_path_for_screen (screen);
604 new_window = ev_application_get_uri_window (application, uri);
606 if (new_window == NULL) {
607 new_window = ev_application_get_empty_window (application, screen);
610 if (new_window == NULL) {
611 new_window = EV_WINDOW (ev_window_new ());
615 gtk_window_set_screen (GTK_WINDOW (new_window), screen);
617 /* We need to load uri before showing the window, so
618 we can restore window size without flickering */
619 ev_window_open_uri (new_window, uri, dest, mode, search_string,
620 unlink_temp_file, print_settings);
622 if (!GTK_WIDGET_REALIZED (GTK_WIDGET (new_window)))
623 gtk_widget_realize (GTK_WIDGET (new_window));
625 #ifdef GDK_WINDOWING_X11
627 timestamp = gdk_x11_get_server_time (GTK_WIDGET (new_window)->window);
628 gdk_x11_window_set_user_time (GTK_WIDGET (new_window)->window, timestamp);
630 ev_document_fc_mutex_lock ();
631 gtk_window_present (GTK_WINDOW (new_window));
632 ev_document_fc_mutex_unlock ();
634 ev_document_fc_mutex_lock ();
635 gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
636 ev_document_fc_mutex_unlock ();
637 #endif /* GDK_WINDOWING_X11 */
641 * ev_application_open_uri:
642 * @application: The instance of the application.
643 * @uri: The uri to be opened
644 * @args: A #GHashTable with the arguments data.
645 * @timestamp: Current time value.
646 * @error: The #GError facility.
649 ev_application_open_uri (EvApplication *application,
655 EvLinkDest *dest = NULL;
656 EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
657 const gchar *search_string = NULL;
658 gboolean unlink_temp_file = FALSE;
659 const gchar *print_settings = NULL;
660 GdkScreen *screen = NULL;
663 screen = get_screen_from_args (args);
664 dest = get_destination_from_args (args);
665 mode = get_window_run_mode_from_args (args);
666 search_string = get_find_string_from_args (args);
667 unlink_temp_file = (mode == EV_WINDOW_MODE_PREVIEW &&
668 get_unlink_temp_file_from_args (args));
669 print_settings = get_print_settings_from_args (args);
672 ev_application_open_uri_at_dest (application, uri, screen,
673 dest, mode, search_string,
675 print_settings, timestamp);
678 g_object_unref (dest);
684 ev_application_open_uri_list (EvApplication *application,
691 for (l = uri_list; l != NULL; l = l->next) {
692 ev_application_open_uri_at_dest (application, (char *)l->data,
693 screen, NULL, 0, NULL,
694 FALSE, NULL, timestamp);
699 ev_application_shutdown (EvApplication *application)
701 if (application->accel_map_file) {
702 gtk_accel_map_save (application->accel_map_file);
703 g_free (application->accel_map_file);
704 application->accel_map_file = NULL;
707 if (application->toolbars_model) {
708 g_object_unref (application->toolbars_model);
709 g_free (application->toolbars_file);
710 application->toolbars_model = NULL;
711 application->toolbars_file = NULL;
714 ev_application_save_print_settings (application);
716 if (application->print_settings_file) {
717 g_key_file_free (application->print_settings_file);
718 application->print_settings_file = NULL;
721 if (application->print_settings) {
722 g_object_unref (application->print_settings);
723 application->print_settings = NULL;
726 if (application->page_setup) {
727 g_object_unref (application->page_setup);
728 application->page_setup = NULL;
732 if (application->keys) {
733 g_object_unref (application->keys);
734 application->keys = NULL;
736 #endif /* ENABLE_DBUS */
738 ev_metadata_manager_shutdown ();
740 g_free (application->dot_dir);
741 application->dot_dir = NULL;
742 g_free (application->last_chooser_uri);
743 application->last_chooser_uri = NULL;
745 g_object_unref (application);
752 ev_application_class_init (EvApplicationClass *ev_application_class)
757 ev_application_init (EvApplication *ev_application)
760 const gchar *home_dir;
762 ev_application_init_session (ev_application);
764 ev_application->dot_dir = g_build_filename (g_get_home_dir (),
769 /* FIXME: why make this fatal? */
770 if (!ev_dir_ensure_exists (ev_application->dot_dir, 0700))
773 home_dir = g_get_home_dir ();
775 ev_application->accel_map_file = g_build_filename (home_dir,
780 gtk_accel_map_load (ev_application->accel_map_file);
783 ev_application->toolbars_model = egg_toolbars_model_new ();
785 ev_application->toolbars_file = g_build_filename
786 (ev_application->dot_dir, "evince_toolbar.xml", NULL);
788 egg_toolbars_model_load_names (ev_application->toolbars_model,
789 DATADIR "/evince-toolbar.xml");
791 if (!egg_toolbars_model_load_toolbars (ev_application->toolbars_model,
792 ev_application->toolbars_file)) {
793 egg_toolbars_model_load_toolbars (ev_application->toolbars_model,
794 DATADIR"/evince-toolbar.xml");
797 /* Open item doesn't exist anymore,
798 * convert it to OpenRecent for compatibility
800 for (i = 0; i < egg_toolbars_model_n_items (ev_application->toolbars_model, 0); i++) {
803 item = egg_toolbars_model_item_nth (ev_application->toolbars_model, 0, i);
804 if (g_ascii_strcasecmp (item, "FileOpen") == 0) {
805 egg_toolbars_model_remove_item (ev_application->toolbars_model, 0, i);
806 egg_toolbars_model_add_item (ev_application->toolbars_model, 0, i,
808 ev_application_save_toolbars_model (ev_application);
813 egg_toolbars_model_set_flags (ev_application->toolbars_model, 0,
814 EGG_TB_MODEL_NOT_REMOVABLE);
817 ev_application->keys = ev_media_player_keys_new ();
818 #endif /* ENABLE_DBUS */
822 * ev_application_get_windows:
823 * @application: The instance of the application.
825 * It creates a list of the top level windows.
827 * Returns: A #GList of the top level windows.
830 ev_application_get_windows (EvApplication *application)
832 GList *l, *toplevels;
833 GList *windows = NULL;
835 toplevels = gtk_window_list_toplevels ();
837 for (l = toplevels; l != NULL; l = l->next) {
838 if (EV_IS_WINDOW (l->data)) {
839 windows = g_list_append (windows, l->data);
843 g_list_free (toplevels);
849 * ev_application_get_media_keys:
850 * @application: The instance of the application.
852 * It gives you access to the media player keys handler object.
854 * Returns: A #EvMediaPlayerKeys.
857 ev_application_get_media_keys (EvApplication *application)
860 return G_OBJECT (application->keys);
863 #endif /* ENABLE_DBUS */
867 ev_application_get_toolbars_model (EvApplication *application)
869 return application->toolbars_model;
873 ev_application_save_toolbars_model (EvApplication *application)
875 egg_toolbars_model_save_toolbars (application->toolbars_model,
876 application->toolbars_file, "1.0");
880 ev_application_set_chooser_uri (EvApplication *application, const gchar *uri)
882 g_free (application->last_chooser_uri);
883 application->last_chooser_uri = g_strdup (uri);
887 ev_application_get_chooser_uri (EvApplication *application)
889 return application->last_chooser_uri;
893 ev_application_screensaver_enable (EvApplication *application)
895 if (application->scr_saver)
896 totem_scrsaver_enable (application->scr_saver);
900 ev_application_screensaver_disable (EvApplication *application)
902 if (application->scr_saver)
903 totem_scrsaver_disable (application->scr_saver);
907 ev_application_get_print_settings_file (EvApplication *application)
911 if (application->print_settings_file)
912 return application->print_settings_file;
914 application->print_settings_file = g_key_file_new ();
916 filename = g_build_filename (ev_application_get_dot_dir (application), EV_PRINT_SETTINGS_FILE, NULL);
917 if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
918 GError *error = NULL;
920 g_key_file_load_from_file (application->print_settings_file,
922 G_KEY_FILE_KEEP_COMMENTS |
923 G_KEY_FILE_KEEP_TRANSLATIONS,
926 g_warning ("%s", error->message);
927 g_error_free (error);
932 return application->print_settings_file;
936 ev_application_save_print_settings (EvApplication *application)
942 GError *error = NULL;
944 if (!application->print_settings && !application->page_setup)
947 key_file = ev_application_get_print_settings_file (application);
948 if (application->print_settings)
949 gtk_print_settings_to_key_file (application->print_settings,
951 EV_PRINT_SETTINGS_GROUP);
952 if (application->page_setup)
953 gtk_page_setup_to_key_file (application->page_setup,
955 EV_PAGE_SETUP_GROUP);
957 filename = g_build_filename (ev_application_get_dot_dir (application), EV_PRINT_SETTINGS_FILE, NULL);
958 data = g_key_file_to_data (key_file, (gsize *)&data_length, NULL);
959 g_file_set_contents (filename, data, data_length, &error);
961 g_warning ("%s", error->message);
962 g_error_free (error);
969 ev_application_get_print_settings (EvApplication *application)
972 GtkPrintSettings *print_settings;
974 if (application->print_settings)
975 return application->print_settings;
977 key_file = ev_application_get_print_settings_file (application);
978 print_settings = g_key_file_has_group (key_file, EV_PRINT_SETTINGS_GROUP) ?
979 gtk_print_settings_new_from_key_file (key_file, EV_PRINT_SETTINGS_GROUP, NULL) :
980 gtk_print_settings_new ();
982 application->print_settings = print_settings ? print_settings : gtk_print_settings_new ();
984 return application->print_settings;
988 ev_application_set_print_settings (EvApplication *application,
989 GtkPrintSettings *settings)
993 g_return_if_fail (GTK_IS_PRINT_SETTINGS (settings));
995 if (settings == application->print_settings)
998 key_file = ev_application_get_print_settings_file (application);
1000 if (application->print_settings)
1001 g_object_unref (application->print_settings);
1003 application->print_settings = g_object_ref (settings);
1004 gtk_print_settings_to_key_file (settings, key_file, EV_PRINT_SETTINGS_GROUP);
1008 ev_application_get_page_setup (EvApplication *application)
1011 GtkPageSetup *page_setup;
1013 if (application->page_setup)
1014 return application->page_setup;
1016 key_file = ev_application_get_print_settings_file (application);
1017 page_setup = g_key_file_has_group (key_file, EV_PAGE_SETUP_GROUP) ?
1018 gtk_page_setup_new_from_key_file (key_file, EV_PAGE_SETUP_GROUP, NULL) :
1019 gtk_page_setup_new ();
1021 application->page_setup = page_setup ? page_setup : gtk_page_setup_new ();
1023 return application->page_setup;
1027 ev_application_set_page_setup (EvApplication *application,
1028 GtkPageSetup *page_setup)
1032 g_return_if_fail (GTK_IS_PAGE_SETUP (page_setup));
1034 if (page_setup == application->page_setup)
1037 key_file = ev_application_get_print_settings_file (application);
1039 if (application->page_setup)
1040 g_object_unref (application->page_setup);
1042 application->page_setup = g_object_ref (page_setup);
1043 gtk_page_setup_to_key_file (page_setup, key_file, EV_PAGE_SETUP_GROUP);
1047 ev_application_get_dot_dir (EvApplication *application)
1049 return application->dot_dir;