+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Recover previous documents?"));
+ gtk_message_dialog_format_secondary_text (
+ GTK_MESSAGE_DIALOG (dialog),
+ _("Evince appears to have exited unexpectedly the last time "
+ "it was run. You can recover the opened documents."));
+
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Don't Recover"),
+ GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Recover"),
+ GTK_RESPONSE_ACCEPT);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Crash Recovery"));
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "evince");
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), FALSE);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ return response == GTK_RESPONSE_ACCEPT;
+}
+#endif /* ENABLE_DBUS */
+
+gboolean
+ev_application_load_session (EvApplication *application,
+ const gchar **files)
+{
+ GKeyFile *state_file;
+ gchar **uri_list;
+
+#ifdef WITH_SMCLIENT
+ if (egg_sm_client_is_resumed (application->smclient)) {
+ state_file = egg_sm_client_get_state_file (application->smclient);
+ if (!state_file)
+ return FALSE;
+ } else
+#endif /* WITH_SMCLIENT */
+#ifdef ENABLE_DBUS
+ if (g_file_test (application->crashed_file, G_FILE_TEST_IS_REGULAR)) {
+ if (ev_application_run_crash_recovery_dialog (application, files)) {
+ state_file = g_key_file_new ();
+ g_key_file_load_from_file (state_file,
+ application->crashed_file,
+ G_KEY_FILE_NONE,
+ NULL);
+ } else {
+ return FALSE;
+ }
+ } else
+#endif /* ENABLE_DBUS */
+ return FALSE;
+
+ uri_list = g_key_file_get_string_list (state_file,
+ "Evince",
+ "documents",
+ NULL, NULL);
+ if (uri_list) {
+ gint i;
+
+ for (i = 0; uri_list[i]; i++) {
+ if (g_ascii_strcasecmp (uri_list[i], "empty-window") == 0)
+ ev_application_open_window (application, NULL, GDK_CURRENT_TIME, NULL);
+ else
+ ev_application_open_uri (application, uri_list[i], NULL, GDK_CURRENT_TIME, NULL);
+ }
+ g_strfreev (uri_list);
+ }
+ g_key_file_free (state_file);
+