evolution r36009 - in trunk: addressbook addressbook/gui/component calendar calendar/gui help help/C mail shell



Author: mbarnes
Date: Mon Aug 18 04:37:15 2008
New Revision: 36009
URL: http://svn.gnome.org/viewvc/evolution?rev=36009&view=rev

Log:
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.



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/component/addressbook-component.c
   trunk/calendar/ChangeLog
   trunk/calendar/gui/calendar-component.c
   trunk/calendar/gui/memos-component.c
   trunk/calendar/gui/tasks-component.c
   trunk/help/C/evolution.xml
   trunk/help/ChangeLog
   trunk/mail/ChangeLog
   trunk/mail/em-folder-browser.c
   trunk/mail/em-folder-browser.h
   trunk/mail/mail-component.c
   trunk/shell/ChangeLog
   trunk/shell/Evolution-Component.idl
   trunk/shell/apps_evolution_shell.schemas.in
   trunk/shell/e-shell-window.c
   trunk/shell/e-shell.c
   trunk/shell/e-shell.h
   trunk/shell/main.c

Modified: trunk/addressbook/gui/component/addressbook-component.c
==============================================================================
--- trunk/addressbook/gui/component/addressbook-component.c	(original)
+++ trunk/addressbook/gui/component/addressbook-component.c	Mon Aug 18 04:37:15 2008
@@ -193,6 +193,7 @@
 static GNOME_Evolution_ComponentView
 impl_createView (PortableServer_Servant servant,
 		 GNOME_Evolution_ShellView parent,
+		 CORBA_boolean select_item,
 		 CORBA_Environment *ev)
 {
 	AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));

Modified: trunk/calendar/gui/calendar-component.c
==============================================================================
--- trunk/calendar/gui/calendar-component.c	(original)
+++ trunk/calendar/gui/calendar-component.c	Mon Aug 18 04:37:15 2008
@@ -1550,6 +1550,7 @@
 static GNOME_Evolution_ComponentView
 impl_createView (PortableServer_Servant servant,
 		 GNOME_Evolution_ShellView parent,
+		 CORBA_boolean select_item,
 		 CORBA_Environment *ev)
 {
 	CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));

Modified: trunk/calendar/gui/memos-component.c
==============================================================================
--- trunk/calendar/gui/memos-component.c	(original)
+++ trunk/calendar/gui/memos-component.c	Mon Aug 18 04:37:15 2008
@@ -1215,6 +1215,7 @@
 static GNOME_Evolution_ComponentView
 impl_createView (PortableServer_Servant servant,
 		 GNOME_Evolution_ShellView parent,
+		 CORBA_boolean select_item,
 		 CORBA_Environment *ev)
 {
 	MemosComponent *component = MEMOS_COMPONENT (bonobo_object_from_servant (servant));

Modified: trunk/calendar/gui/tasks-component.c
==============================================================================
--- trunk/calendar/gui/tasks-component.c	(original)
+++ trunk/calendar/gui/tasks-component.c	Mon Aug 18 04:37:15 2008
@@ -1207,6 +1207,7 @@
 static GNOME_Evolution_ComponentView
 impl_createView (PortableServer_Servant servant,
 		 GNOME_Evolution_ShellView parent,
+		 CORBA_boolean select_item,
 		 CORBA_Environment *ev)
 {
 	TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant));

Modified: trunk/help/C/evolution.xml
==============================================================================
--- trunk/help/C/evolution.xml	(original)
+++ trunk/help/C/evolution.xml	Mon Aug 18 04:37:15 2008
@@ -1013,12 +1013,6 @@
    </section>
   </section>
 
-  <section id="b1a5acwx">
-   <title>Crash Recovery</title>
-   <para>Evolution displays a crash detection message when you restart it after a crash.</para>
-   <mediaobject id="b1a5aezg"><imageobject><imagedata format="PNG" fileref="figures/evo_crash_recovery.png"/></imageobject></mediaobject>
-   <para>Click Ignore to restore the preview pane displayed when Evolution crashed. If you click Recover, Evolution opens with all preview panes hidden.</para>
-  </section>
   <section id="bsekq8r">
    <title>Command Line Options</title>
    <para>Evolution has a number of command line options that you can use. For more information about command line options, open a terminal window and type <command>evolution --help</command>.</para>

Modified: trunk/mail/em-folder-browser.c
==============================================================================
--- trunk/mail/em-folder-browser.c	(original)
+++ trunk/mail/em-folder-browser.c	Mon Aug 18 04:37:15 2008
@@ -122,6 +122,7 @@
 	guint folder_changed_id;
 
 	guint show_wide:1;
+	guint suppress_message_selection:1;
 	gboolean scope_restricted;
 
 	EMMenu *menu;		/* toplevel menu manager */
@@ -2007,6 +2008,7 @@
 {
 	EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
 	struct _EMFolderBrowserPrivate *p = emfb->priv;
+	gboolean different_folder;
 
 	message_list_freeze(emfv->list);
 
@@ -2025,6 +2027,10 @@
 		emfb->priv->folder_changed_id = 0;
 	}
 
+	different_folder =
+		emfb->view.folder != NULL &&
+		folder != emfb->view.folder;
+
 	emfb_parent->set_folder(emfv, folder, uri);
 
 	/* This is required since we get activated the first time
@@ -2108,15 +2114,20 @@
 			e_search_bar_paint ((ESearchBar *)emfb->search);
 		}
 
-		/* set the query manually, so we dont pop up advanced or saved search stuff */
+		/* This function gets triggered several times at startup,
+		 * so we don't want to reset the message suppression state
+		 * unless we're actually switching to a different folder. */
+		if (different_folder)
+			p->suppress_message_selection = FALSE;
+
+		if (!p->suppress_message_selection)
+			sstate = camel_object_meta_get (
+				folder, "evolution:selected_uid");
+		else
+			sstate = NULL;
 
-		if ((sstate = camel_object_meta_get (folder, "evolution:selected_uid"))) {
-			g_free (emfb->priv->select_uid);
-			emfb->priv->select_uid = sstate;
-		} else {
-			g_free(p->select_uid);
-			p->select_uid = NULL;
-		}
+		g_free (p->select_uid);
+		p->select_uid = sstate;
 
 		if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0)
 			p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
@@ -2228,3 +2239,9 @@
 		emfb_parent->activate(emfv, uic, act);
 	}
 }
+
+void
+em_folder_browser_suppress_message_selection (EMFolderBrowser *emfb)
+{
+	emfb->priv->suppress_message_selection = TRUE;
+}

Modified: trunk/mail/em-folder-browser.h
==============================================================================
--- trunk/mail/em-folder-browser.h	(original)
+++ trunk/mail/em-folder-browser.h	Mon Aug 18 04:37:15 2008
@@ -57,6 +57,8 @@
 void em_folder_browser_show_preview(EMFolderBrowser *emfv, gboolean state);
 void em_folder_browser_show_wide(EMFolderBrowser *emfv, gboolean state);
 gboolean em_folder_browser_get_wide(EMFolderBrowser *emfv);
+void em_folder_browser_suppress_message_selection(EMFolderBrowser *emfb);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: trunk/mail/mail-component.c
==============================================================================
--- trunk/mail/mail-component.c	(original)
+++ trunk/mail/mail-component.c	Mon Aug 18 04:37:15 2008
@@ -711,6 +711,7 @@
 static GNOME_Evolution_ComponentView
 impl_createView (PortableServer_Servant servant,
 		 GNOME_Evolution_ShellView parent,
+		 CORBA_boolean select_item,
 		 CORBA_Environment *ev)
 {
 	MailComponent *mail_component = MAIL_COMPONENT (bonobo_object_from_servant (servant));
@@ -726,6 +727,10 @@
 
 	view_widget = em_folder_browser_new ();
 
+	if (!select_item)
+		em_folder_browser_suppress_message_selection (
+			(EMFolderBrowser *) view_widget);
+
 	tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model);
 	em_folder_tree_set_excluded ((EMFolderTree *) tree_widget, 0);
 	em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget);

Modified: trunk/shell/Evolution-Component.idl
==============================================================================
--- trunk/shell/Evolution-Component.idl	(original)
+++ trunk/shell/Evolution-Component.idl	Mon Aug 18 04:37:15 2008
@@ -75,7 +75,8 @@
 			raises (UnsupportedVersion, UpgradeFailed);
 
 		/*** Basic functionality.  ***/
-		ComponentView createView(in ShellView parent)
+		ComponentView createView(in ShellView parent,
+		                         in boolean select_item)
 			raises (Failed);
 
 

Modified: trunk/shell/apps_evolution_shell.schemas.in
==============================================================================
--- trunk/shell/apps_evolution_shell.schemas.in	(original)
+++ trunk/shell/apps_evolution_shell.schemas.in	Mon Aug 18 04:37:15 2008
@@ -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>

Modified: trunk/shell/e-shell-window.c
==============================================================================
--- trunk/shell/e-shell-window.c	(original)
+++ trunk/shell/e-shell-window.c	Mon Aug 18 04:37:15 2008
@@ -210,6 +210,7 @@
 	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 @@
 	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 @@
 	   (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);

Modified: trunk/shell/e-shell.c
==============================================================================
--- trunk/shell/e-shell.c	(original)
+++ trunk/shell/e-shell.c	Mon Aug 18 04:37:15 2008
@@ -117,6 +117,9 @@
 	/* 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 @@
 	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)
 {

Modified: trunk/shell/e-shell.h
==============================================================================
--- trunk/shell/e-shell.h	(original)
+++ trunk/shell/e-shell.h	Mon Aug 18 04:37:15 2008
@@ -124,6 +124,10 @@
 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,

Modified: trunk/shell/main.c
==============================================================================
--- trunk/shell/main.c	(original)
+++ trunk/shell/main.c	Mon Aug 18 04:37:15 2008
@@ -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 @@
 
 #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 @@
 		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 @@
 		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 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]