+void
+ev_application_save_toolbars_model (EvApplication *application)
+{
+ egg_toolbars_model_save_toolbars (application->toolbars_model,
+ application->toolbars_file, "1.0");
+}
+
+void
+ev_application_set_filechooser_uri (EvApplication *application,
+ GtkFileChooserAction action,
+ const gchar *uri)
+{
+ if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
+ g_free (application->filechooser_open_uri);
+ application->filechooser_open_uri = g_strdup (uri);
+ } else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
+ g_free (application->filechooser_save_uri);
+ application->filechooser_save_uri = g_strdup (uri);
+ }
+}
+
+const gchar *
+ev_application_get_filechooser_uri (EvApplication *application,
+ GtkFileChooserAction action)
+{
+ if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
+ if (application->filechooser_open_uri)
+ return application->filechooser_open_uri;
+ } else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
+ if (application->filechooser_save_uri)
+ return application->filechooser_save_uri;
+ }
+
+ return NULL;
+}
+
+void
+ev_application_screensaver_enable (EvApplication *application)
+{
+ if (application->scr_saver)
+ totem_scrsaver_enable (application->scr_saver);
+}
+
+void
+ev_application_screensaver_disable (EvApplication *application)
+{
+ if (application->scr_saver)
+ totem_scrsaver_disable (application->scr_saver);
+}
+
+static GKeyFile *
+ev_application_get_print_settings_file (EvApplication *application)
+{
+ gchar *filename;
+
+ if (application->print_settings_file)
+ return application->print_settings_file;
+
+ application->print_settings_file = g_key_file_new ();
+
+ filename = g_build_filename (ev_application_get_dot_dir (application), EV_PRINT_SETTINGS_FILE, NULL);
+ if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
+ GError *error = NULL;
+
+ g_key_file_load_from_file (application->print_settings_file,
+ filename,
+ G_KEY_FILE_KEEP_COMMENTS |
+ G_KEY_FILE_KEEP_TRANSLATIONS,
+ &error);
+ if (error) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+ }
+ g_free (filename);
+
+ return application->print_settings_file;
+}
+
+static void
+ev_application_save_print_settings (EvApplication *application)
+{
+ GKeyFile *key_file;
+ gchar *filename;
+ gchar *data;
+ gssize data_length;
+ GError *error = NULL;
+
+ if (!application->print_settings && !application->page_setup)
+ return;
+
+ key_file = ev_application_get_print_settings_file (application);
+ if (application->print_settings)
+ gtk_print_settings_to_key_file (application->print_settings,
+ key_file,
+ EV_PRINT_SETTINGS_GROUP);
+ if (application->page_setup)
+ gtk_page_setup_to_key_file (application->page_setup,
+ key_file,
+ EV_PAGE_SETUP_GROUP);
+
+ filename = g_build_filename (ev_application_get_dot_dir (application), EV_PRINT_SETTINGS_FILE, NULL);
+ data = g_key_file_to_data (key_file, (gsize *)&data_length, NULL);
+ g_file_set_contents (filename, data, data_length, &error);
+ if (error) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+ g_free (data);
+ g_free (filename);
+}
+
+GtkPrintSettings *
+ev_application_get_print_settings (EvApplication *application)
+{
+ GKeyFile *key_file;
+ GtkPrintSettings *print_settings;
+
+ if (application->print_settings)
+ return application->print_settings;
+
+ key_file = ev_application_get_print_settings_file (application);
+ print_settings = g_key_file_has_group (key_file, EV_PRINT_SETTINGS_GROUP) ?
+ gtk_print_settings_new_from_key_file (key_file, EV_PRINT_SETTINGS_GROUP, NULL) :
+ gtk_print_settings_new ();
+
+ application->print_settings = print_settings ? print_settings : gtk_print_settings_new ();
+
+ return application->print_settings;
+}
+
+void
+ev_application_set_print_settings (EvApplication *application,
+ GtkPrintSettings *settings)
+{
+ GKeyFile *key_file;
+
+ g_return_if_fail (GTK_IS_PRINT_SETTINGS (settings));
+
+ if (settings == application->print_settings)
+ return;
+
+ key_file = ev_application_get_print_settings_file (application);
+
+ if (application->print_settings)
+ g_object_unref (application->print_settings);
+
+ application->print_settings = g_object_ref (settings);
+ gtk_print_settings_to_key_file (settings, key_file, EV_PRINT_SETTINGS_GROUP);
+}
+
+GtkPageSetup *
+ev_application_get_page_setup (EvApplication *application)