aboutsummaryrefslogtreecommitdiffstats
path: root/shell/main.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-08-18 12:37:15 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-08-18 12:37:15 +0800
commitf19618ac7f06b7f9e4bb2d7ce2e75de6e8554737 (patch)
treed6481a36d0a743a7b7ccbd249c94f76cd707d6ae /shell/main.c
parentfce40453c9aece0fcdd523fe80ff1cc573747844 (diff)
downloadgsoc2013-evolution-f19618ac7f06b7f9e4bb2d7ce2e75de6e8554737.tar.gz
gsoc2013-evolution-f19618ac7f06b7f9e4bb2d7ce2e75de6e8554737.tar.zst
gsoc2013-evolution-f19618ac7f06b7f9e4bb2d7ce2e75de6e8554737.zip
** Fixes bug #508732
2008-08-18 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #508732 * shell/e-shell.c: Add a "crash_recovery" flag, with accessor functions for it. * shell/e-shell-window (init_view): Check and reset the "crash_recovery" flag before creating a new shell view. The components can use this flag to take steps to recover from the previous crash. * shell/apps_evolution_shell.schemas.in: Remove the "skip_recovery_dialog" and "recovery" keys. * shell/Evolution-Component.idl (createView): Add a "select_item" boolean parameter. * shell/main.c: Kill the crash recovery dialog. Instead just set the crash recovery flag in e-shell appropriately. * mail/mail-component.c (impl_createView): Add a "select_item" argument for crash recovery, which we forward to EMFolderBrowser as a "suppress_message_selection" flag. * mail/em-folder-browser.c (emfb_set_folder): Suppress automatic message selection if we are recovering from a crash. * addressbook/gui/component/addressbook-component.c (impl_createView): * calendar/gui/calendar-component.c (impl_createView): * calendar/gui/memos-component.c (impl_createView): * calendar/gui/tasks-component.c (impl_createView): Add a "select_item" argument for crash recovery, which these components do not use. * help/C/evolution.xml: Remove the bit about crash recovery. svn path=/trunk/; revision=36009
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c98
1 files changed, 2 insertions, 96 deletions
diff --git a/shell/main.c b/shell/main.c
index 27ebb4a9a5..4d71e902d7 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -87,11 +87,6 @@
#define SKIP_WARNING_DIALOG_KEY \
"/apps/evolution/shell/skip_warning_dialog"
-#define SKIP_RECOVERY_DIALOG_KEY \
- "/apps/evolution/shell/skip_recovery_dialog"
-#define RECOVERY_KEY \
- "/apps/evolution/shell/recovery"
-
static EShell *shell = NULL;
@@ -287,70 +282,6 @@ destroy_config (GConfClient *client)
#endif /* DEVELOPMENT */
-static int
-show_recovery_warning(void)
-{
- GtkWidget *vbox;
- GtkWidget *label;
- GtkWidget *warning_dialog;
- GtkWidget *checkbox;
- GtkWidget *alignment;
- gboolean skip;
- char *text;
- int flags = 0, response;
-
- warning_dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (warning_dialog), _("Evolution Crash Detection"));
- gtk_window_set_modal (GTK_WINDOW (warning_dialog), TRUE);
- gtk_dialog_add_button (GTK_DIALOG (warning_dialog), _("Ig_nore"), GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (warning_dialog), _("_Recover"), GTK_RESPONSE_OK);
-
- gtk_dialog_set_has_separator (GTK_DIALOG (warning_dialog), FALSE);
-
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (warning_dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (warning_dialog)->action_area), 12);
-
- vbox = gtk_vbox_new (FALSE, 12);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox), vbox,
- TRUE, TRUE, 0);
-
- text = g_strdup(
- /* xgettext:no-c-format */
- _("Evolution appears to have exited unexpectedly the last time it was\n"
- "run. As a precautionary measure, all preview panes will be hidden.\n"
- "You can restore the preview panes from the View menu.\n"));
- label = gtk_label_new (text);
- g_free(text);
-
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
-
- gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
-
- checkbox = gtk_check_button_new_with_mnemonic (_("_Do not show this message again"));
-
- alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
-
- gtk_container_add (GTK_CONTAINER (alignment), checkbox);
- gtk_box_pack_start (GTK_BOX (vbox), alignment, TRUE, TRUE, 0);
-
- gtk_widget_show_all (warning_dialog);
-
- response = gtk_dialog_run (GTK_DIALOG (warning_dialog));
-
- if (response != GTK_RESPONSE_CANCEL)
- flags = flags|(1<<1);
-
- skip = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
- if (skip)
- flags = flags|(1<<2);
-
- gtk_widget_destroy (warning_dialog);
-
- return flags;
-}
-
static void
open_uris (GNOME_Evolution_Shell corba_shell, gchar **uris)
{
@@ -399,6 +330,7 @@ idle_cb (gchar **uris)
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
shell = e_shell_new (startup_line_mode, &result);
+ e_shell_set_crash_recovery (shell, e_file_lock_exists ());
switch (result) {
case E_SHELL_CONSTRUCT_RESULT_OK:
@@ -431,33 +363,7 @@ idle_cb (gchar **uris)
if (uris != NULL)
open_uris (corba_shell, uris);
else {
- GConfClient *client = gconf_client_get_default ();
-
- if (gconf_client_get_bool (client, RECOVERY_KEY, NULL) && e_file_lock_exists ()) {
- /* It should have crashed last time or a force-shutdown */
- gboolean skip = gconf_client_get_bool (client, SKIP_RECOVERY_DIALOG_KEY, NULL);
- gboolean recover = TRUE;
- if (!skip){
- int flags = show_recovery_warning ();
-
- gconf_client_set_bool (client, SKIP_RECOVERY_DIALOG_KEY, (flags & (1<<2)) ? TRUE : FALSE, NULL);
- recover = (flags & (1<<1)) ? TRUE: FALSE;
- }
-
- if (recover) {
- /* Disable the previews */
- gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL);
- gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL);
- gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL);
- gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL);
- }
- /* Let us not delete and recreate a lock, instead reuse it. We don't use timestamps anyways */
- } else {
- /* What great can we do, if lock creation fails ?*/
- e_file_lock_create ();
- }
- g_object_unref (client);
-
+ e_file_lock_create ();
e_shell_create_window (shell, default_component_id, NULL);
}
} else {