aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog22
-rw-r--r--shell/Evolution-Component.idl3
-rw-r--r--shell/apps_evolution_shell.schemas.in25
-rw-r--r--shell/e-shell-window.c6
-rw-r--r--shell/e-shell.c20
-rw-r--r--shell/e-shell.h4
-rw-r--r--shell/main.c98
7 files changed, 55 insertions, 123 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 74feafdaf9..60181ad24e 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,25 @@
+2008-08-18 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #508732
+
+ * e-shell.c:
+ Add a "crash_recovery" flag, with accessor functions for it.
+
+ * 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.
+
+ * apps_evolution_shell.schemas.in:
+ Remove the "skip_recovery_dialog" and "recovery" keys.
+
+ * Evolution-Component.idl (createView):
+ Add a "select_item" boolean parameter.
+
+ * main.c:
+ Kill the crash recovery dialog. Instead just set the crash
+ recovery flag in e-shell appropriately.
+
2008-08-18 Milan Crha <mcrha@redhat.com>
** Fix for bug #416258
diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl
index 8f52fa95ba..ccf806ff91 100644
--- a/shell/Evolution-Component.idl
+++ b/shell/Evolution-Component.idl
@@ -75,7 +75,8 @@ module Evolution {
raises (UnsupportedVersion, UpgradeFailed);
/*** Basic functionality. ***/
- ComponentView createView(in ShellView parent)
+ ComponentView createView(in ShellView parent,
+ in boolean select_item)
raises (Failed);
diff --git a/shell/apps_evolution_shell.schemas.in b/shell/apps_evolution_shell.schemas.in
index 036417ea16..24172f25ba 100644
--- a/shell/apps_evolution_shell.schemas.in
+++ b/shell/apps_evolution_shell.schemas.in
@@ -41,31 +41,6 @@
</locale>
</schema>
- <!-- Recovery -->
- <schema>
- <key>/schemas/apps/evolution/shell/skip_recovery_dialog</key>
- <applyto>/apps/evolution/shell/skip_recovery_dialog</applyto>
- <owner>evolution</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Skip recovery warning dialog</short>
- <long>Whether the warning dialog in recovery of Evolution is skipped.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/evolution/shell/recovery</key>
- <applyto>/apps/evolution/shell/recovery</applyto>
- <owner>evolution</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether crash detection should be done or not</short>
- <long>Decides whether the crash detection should be run or not.</long>
- </locale>
- </schema>
-
<!-- Offline Mode -->
<schema>
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index cf188e27e7..0bef6caaee 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -210,6 +210,7 @@ init_view (EShellWindow *window,
Bonobo_Control sidebar_control;
Bonobo_Control view_control;
Bonobo_Control statusbar_control;
+ CORBA_boolean select_item;
CORBA_Environment ev;
int sidebar_notebook_page_num;
int view_notebook_page_num;
@@ -218,6 +219,9 @@ init_view (EShellWindow *window,
g_return_if_fail (view->sidebar_widget == NULL);
g_return_if_fail (view->notebook_page_num == -1);
+ select_item = !e_shell_get_crash_recovery (priv->shell.eshell);
+ e_shell_set_crash_recovery (priv->shell.eshell, FALSE);
+
CORBA_exception_init (&ev);
/* 1. Activate component. (FIXME: Shouldn't do this here.) */
@@ -238,7 +242,7 @@ init_view (EShellWindow *window,
(e.g. methods not implemented)... So handle it as if there was no
component at all. */
- component_view = GNOME_Evolution_Component_createView(component_iface, BONOBO_OBJREF(priv->shell_view), &ev);
+ component_view = GNOME_Evolution_Component_createView(component_iface, BONOBO_OBJREF(priv->shell_view), select_item, &ev);
if (component_view == NULL || BONOBO_EX (&ev)) {
g_warning ("Cannot create view for %s", view->component_id);
bonobo_object_release_unref (component_iface, NULL);
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 6173f47498..948f7c41e3 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -117,6 +117,9 @@ struct _EShellPrivate {
/* Whether quit has been requested, and the shell is now waiting for
permissions from all the components to quit. */
unsigned int preparing_to_quit : 1;
+
+ /* Whether we are recovering from a crash in the previous session. */
+ unsigned int crash_recovery : 1;
};
@@ -1214,6 +1217,23 @@ e_shell_go_online (EShell *shell,
set_line_status(shell, shell_state);
}
+gboolean
+e_shell_get_crash_recovery (EShell *shell)
+{
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ return shell->priv->crash_recovery;
+}
+
+void
+e_shell_set_crash_recovery (EShell *shell,
+ gboolean crash_recovery)
+{
+ g_return_if_fail (E_IS_SHELL (shell));
+
+ shell->priv->crash_recovery = crash_recovery;
+}
+
void
e_shell_send_receive (EShell *shell)
{
diff --git a/shell/e-shell.h b/shell/e-shell.h
index b06e480c69..5dfaafac93 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -124,6 +124,10 @@ void e_shell_go_offline (EShell *shell,
void e_shell_go_online (EShell *shell,
EShellWindow *action_window, GNOME_Evolution_ShellState shell_state);
+gboolean e_shell_get_crash_recovery (EShell *shell);
+void e_shell_set_crash_recovery (EShell *shell,
+ gboolean crash_recovery);
+
void e_shell_send_receive (EShell *shell);
void e_shell_show_settings (EShell *shell,
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 {