evolution r37009 - in branches/kill-bonobo: composer doc/reference/shell doc/reference/shell/tmpl mail shell shell/test



Author: mbarnes
Date: Wed Jan  7 18:23:46 2009
New Revision: 37009
URL: http://svn.gnome.org/viewvc/evolution?rev=37009&view=rev

Log:
Tweak the EShell API.
Disable File -> Close Window when there's only one window.
Replace EMMessageBrowser with EMailBrowser.


Removed:
   branches/kill-bonobo/mail/em-message-browser.c
   branches/kill-bonobo/mail/em-message-browser.h
Modified:
   branches/kill-bonobo/composer/e-msg-composer.c
   branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
   branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml
   branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml
   branches/kill-bonobo/mail/Makefile.am
   branches/kill-bonobo/mail/e-mail-browser.c
   branches/kill-bonobo/mail/e-mail-browser.h
   branches/kill-bonobo/mail/e-mail-reader.c
   branches/kill-bonobo/mail/e-mail-reader.h
   branches/kill-bonobo/mail/e-mail-shell-module-settings.c
   branches/kill-bonobo/mail/e-mail-shell-module.c
   branches/kill-bonobo/mail/em-account-editor.c
   branches/kill-bonobo/mail/em-composer-prefs.c
   branches/kill-bonobo/mail/em-folder-view.c
   branches/kill-bonobo/mail/em-format-html.c
   branches/kill-bonobo/mail/em-mailer-prefs.c
   branches/kill-bonobo/shell/e-shell-content.c
   branches/kill-bonobo/shell/e-shell-migrate.c
   branches/kill-bonobo/shell/e-shell-window-actions.c
   branches/kill-bonobo/shell/e-shell-window-private.c
   branches/kill-bonobo/shell/e-shell-window-private.h
   branches/kill-bonobo/shell/e-shell-window.c
   branches/kill-bonobo/shell/e-shell.c
   branches/kill-bonobo/shell/e-shell.h
   branches/kill-bonobo/shell/main.c
   branches/kill-bonobo/shell/test/e-test-shell-module.c

Modified: branches/kill-bonobo/composer/e-msg-composer.c
==============================================================================
--- branches/kill-bonobo/composer/e-msg-composer.c	(original)
+++ branches/kill-bonobo/composer/e-msg-composer.c	Wed Jan  7 18:23:46 2009
@@ -1361,7 +1361,7 @@
 	g_return_if_fail (text != NULL);
 
 	shell = e_shell_get_default ();
-	shell_settings = e_shell_get_settings (shell);
+	shell_settings = e_shell_get_shell_settings (shell);
 
 	/*
 
@@ -2061,7 +2061,7 @@
 	array = composer->priv->gconf_bridge_binding_ids;
 
 	shell = e_shell_get_default ();
-	shell_settings = e_shell_get_settings (shell);
+	shell_settings = e_shell_get_shell_settings (shell);
 
 	/* Restore Persistent State */
 

Modified: branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/eshell-sections.txt	(original)
+++ branches/kill-bonobo/doc/reference/shell/eshell-sections.txt	Wed Jan  7 18:23:46 2009
@@ -3,13 +3,13 @@
 <TITLE>EShell</TITLE>
 EShell
 e_shell_get_default
-e_shell_list_modules
+e_shell_get_shell_modules
+e_shell_get_shell_windows
 e_shell_get_canonical_name
 e_shell_get_module_by_name
 e_shell_get_module_by_scheme
-e_shell_get_settings
-e_shell_create_window
-e_shell_get_focused_window
+e_shell_get_shell_settings
+e_shell_create_shell_window
 e_shell_handle_uri
 e_shell_send_receive
 e_shell_get_network_available

Modified: branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml	(original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml	Wed Jan  7 18:23:46 2009
@@ -78,7 +78,6 @@
 </para>
 
 @eshell: the object which received the signal.
- arg1: 
 
 <!-- ##### ARG EShell:network-available ##### -->
 <para>
@@ -90,7 +89,7 @@
 
 </para>
 
-<!-- ##### ARG EShell:settings ##### -->
+<!-- ##### ARG EShell:shell-settings ##### -->
 <para>
 
 </para>
@@ -103,7 +102,7 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_list_modules ##### -->
+<!-- ##### FUNCTION e_shell_get_shell_modules ##### -->
 <para>
 
 </para>
@@ -112,17 +111,16 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_get_canonical_name ##### -->
+<!-- ##### FUNCTION e_shell_get_shell_windows ##### -->
 <para>
 
 </para>
 
 @shell: 
- name: 
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_get_module_by_name ##### -->
+<!-- ##### FUNCTION e_shell_get_canonical_name ##### -->
 <para>
 
 </para>
@@ -132,26 +130,27 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_get_module_by_scheme ##### -->
+<!-- ##### FUNCTION e_shell_get_module_by_name ##### -->
 <para>
 
 </para>
 
 @shell: 
- scheme: 
+ name: 
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_get_settings ##### -->
+<!-- ##### FUNCTION e_shell_get_module_by_scheme ##### -->
 <para>
 
 </para>
 
 @shell: 
+ scheme: 
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_create_window ##### -->
+<!-- ##### FUNCTION e_shell_get_shell_settings ##### -->
 <para>
 
 </para>
@@ -160,7 +159,7 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_get_focused_window ##### -->
+<!-- ##### FUNCTION e_shell_create_shell_window ##### -->
 <para>
 
 </para>

Modified: branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml	(original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml	Wed Jan  7 18:23:46 2009
@@ -433,6 +433,12 @@
 @minor: 
 @revision: 
 
+<!-- ##### ARG EShell:settings ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### ENUM EShellLineStatus ##### -->
 <para>
 
@@ -1731,6 +1737,22 @@
 @revision: 
 @Returns: 
 
+<!-- ##### FUNCTION e_shell_create_window ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
+<!-- ##### FUNCTION e_shell_get_focused_window ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
 <!-- ##### FUNCTION e_shell_get_line_status ##### -->
 <para>
 
@@ -1739,6 +1761,38 @@
 @shell: 
 @Returns: 
 
+<!-- ##### FUNCTION e_shell_get_settings ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
+<!-- ##### FUNCTION e_shell_list_modules ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
+<!-- ##### FUNCTION e_shell_list_shell_modules ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
+<!-- ##### FUNCTION e_shell_list_shell_windows ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
 <!-- ##### FUNCTION e_shell_marshal_BOOLEAN__STRING ##### -->
 <para>
 

Modified: branches/kill-bonobo/mail/Makefile.am
==============================================================================
--- branches/kill-bonobo/mail/Makefile.am	(original)
+++ branches/kill-bonobo/mail/Makefile.am	Wed Jan  7 18:23:46 2009
@@ -121,8 +121,6 @@
 	em-mailer-prefs.h				\
 	em-menu.c					\
 	em-menu.h					\
-	em-message-browser.c				\
-	em-message-browser.h				\
 	em-network-prefs.c				\
 	em-network-prefs.h				\
 	em-popup.c					\
@@ -205,7 +203,6 @@
 #	em-inline-filter.h			\
 #	em-junk-hook.h				\
 #	em-menu.h				\
-#	em-message-browser.h			\
 #	em-popup.h				\
 #	em-stripsig-filter.h			\
 #	em-sync-stream.h			\
@@ -269,7 +266,6 @@
 #	em-inline-filter.c			\
 #	em-junk-hook.c				\
 #	em-menu.c				\
-#	em-message-browser.c			\
 #	em-migrate.c				\
 #	em-migrate.h				\
 #	em-popup.c				\

Modified: branches/kill-bonobo/mail/e-mail-browser.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-browser.c	(original)
+++ branches/kill-bonobo/mail/e-mail-browser.c	Wed Jan  7 18:23:46 2009
@@ -29,6 +29,7 @@
 #include "e-util/gconf-bridge.h"
 
 #include "mail/e-mail-reader.h"
+#include "mail/e-mail-reader-utils.h"
 #include "mail/e-mail-shell-module.h"
 #include "mail/em-folder-tree-model.h"
 #include "mail/em-format-html-display.h"
@@ -78,7 +79,7 @@
 action_close_cb (GtkAction *action,
                  EMailBrowser *browser)
 {
-	gtk_widget_destroy (GTK_WIDGET (browser));
+	e_mail_browser_close (browser);
 }
 
 static GtkActionEntry mail_browser_entries[] = {
@@ -187,6 +188,35 @@
 }
 
 static void
+mail_browser_message_selected_cb (EMailBrowser *browser,
+                                  const gchar *uid)
+{
+	EMFormatHTMLDisplay *html_display;
+	MessageList *message_list;
+	CamelMessageInfo *info;
+	EMailReader *reader;
+
+	if (uid == NULL)
+		return;
+
+	reader = E_MAIL_READER (browser);
+	html_display = e_mail_reader_get_html_display (reader);
+	message_list = e_mail_reader_get_message_list (reader);
+	info = camel_folder_get_message_info (message_list->folder, uid);
+
+	if (info == NULL)
+		return;
+
+	gtk_window_set_title (
+		GTK_WINDOW (browser),
+		camel_message_info_subject (info));
+	gtk_widget_grab_focus (
+		GTK_WIDGET (((EMFormatHTML *) html_display)->html));
+
+	camel_folder_free_message_info (message_list->folder, info);
+}
+
+static void
 mail_browser_set_shell_module (EMailBrowser *browser,
                                EShellModule *shell_module)
 {
@@ -367,6 +397,20 @@
 	gtk_widget_show (widget);
 }
 
+static gboolean
+mail_browser_key_press_event (GtkWidget *widget,
+                              GdkEventKey *event)
+{
+	if (event->keyval == GDK_Escape) {
+		e_mail_browser_close (E_MAIL_BROWSER (widget));
+		return TRUE;
+	}
+
+	/* Chain up to parent's key_press_event() method. */
+	return GTK_WIDGET_CLASS (parent_class)->
+		key_press_event (widget, event);
+}
+
 static GtkActionGroup *
 mail_browser_get_action_group (EMailReader *reader)
 {
@@ -419,9 +463,45 @@
 }
 
 static void
+mail_browser_set_message (EMailReader *reader,
+                          const gchar *uid,
+                          gboolean mark_read)
+{
+	EMailReaderIface *iface;
+	MessageList *message_list;
+	CamelMessageInfo *info;
+	CamelFolder *folder;
+
+	/* Chain up to parent's set_message() method. */
+	iface = g_type_default_interface_peek (E_TYPE_MAIL_READER);
+	iface->set_message (reader, uid, mark_read);
+
+	if (uid == NULL) {
+		e_mail_browser_close (E_MAIL_BROWSER (reader));
+		return;
+	}
+
+	message_list = e_mail_reader_get_message_list (reader);
+
+	folder = message_list->folder;
+	info = camel_folder_get_message_info (folder, uid);
+
+	if (info != NULL) {
+		gtk_window_set_title (
+			GTK_WINDOW (reader),
+			camel_message_info_subject (info));
+		camel_folder_free_message_info (folder, info);
+	}
+
+	if (mark_read)
+		e_mail_reader_mark_as_read (reader, uid);
+}
+
+static void
 mail_browser_class_init (EMailBrowserClass *class)
 {
 	GObjectClass *object_class;
+	GtkWidgetClass *widget_class;
 
 	parent_class = g_type_class_peek_parent (class);
 	g_type_class_add_private (class, sizeof (EMailBrowserPrivate));
@@ -432,6 +512,9 @@
 	object_class->dispose = mail_browser_dispose;
 	object_class->constructed = mail_browser_constructed;
 
+	widget_class = GTK_WIDGET_CLASS (class);
+	widget_class->key_press_event = mail_browser_key_press_event;
+
 	g_object_class_install_property (
 		object_class,
 		PROP_SHELL_MODULE,
@@ -453,6 +536,7 @@
 	iface->get_message_list = mail_browser_get_message_list;
 	iface->get_shell_module = mail_browser_get_shell_module;
 	iface->get_window = mail_browser_get_window;
+	iface->set_message = mail_browser_set_message;
 }
 
 static void
@@ -473,9 +557,15 @@
 	browser->priv->message_list = message_list_new ();
 	g_object_ref_sink (browser->priv->message_list);
 
+	g_signal_connect_swapped (
+		browser->priv->message_list, "message-selected",
+		G_CALLBACK (mail_browser_message_selected_cb), browser);
+
 	bridge = gconf_bridge_get ();
 	prefix = "/apps/evolution/mail/mail_browser";
 	gconf_bridge_bind_window_size (bridge, prefix, GTK_WINDOW (browser));
+
+	gtk_window_set_title (GTK_WINDOW (browser), _("Evolution"));
 }
 
 GType
@@ -523,6 +613,14 @@
 		"shell-module", shell_module, NULL);
 }
 
+void
+e_mail_browser_close (EMailBrowser *browser)
+{
+	g_return_if_fail (E_IS_MAIL_BROWSER (browser));
+
+	gtk_widget_destroy (GTK_WIDGET (browser));
+}
+
 GtkUIManager *
 e_mail_browser_get_ui_manager (EMailBrowser *browser)
 {

Modified: branches/kill-bonobo/mail/e-mail-browser.h
==============================================================================
--- branches/kill-bonobo/mail/e-mail-browser.h	(original)
+++ branches/kill-bonobo/mail/e-mail-browser.h	Wed Jan  7 18:23:46 2009
@@ -61,6 +61,7 @@
 
 GType		e_mail_browser_get_type		(void);
 GtkWidget *	e_mail_browser_new		(EShellModule *shell_module);
+void		e_mail_browser_close		(EMailBrowser *browser);
 GtkUIManager *	e_mail_browser_get_ui_manager	(EMailBrowser *browser);
 
 G_END_DECLS

Modified: branches/kill-bonobo/mail/e-mail-reader.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-reader.c	(original)
+++ branches/kill-bonobo/mail/e-mail-reader.c	Wed Jan  7 18:23:46 2009
@@ -24,6 +24,7 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/gtkhtml-stream.h>
 
 #ifdef HAVE_XFREE
 #include <X11/XF86keysym.h>
@@ -31,11 +32,13 @@
 
 #include "e-util/e-util.h"
 #include "e-util/gconf-bridge.h"
+#include "shell/e-shell.h"
 #include "widgets/misc/e-charset-picker.h"
 
 #include "mail/e-mail-reader-utils.h"
 #include "mail/e-mail-shell-module.h"
 #include "mail/em-composer-utils.h"
+#include "mail/em-event.h"
 #include "mail/em-folder-selector.h"
 #include "mail/em-folder-tree.h"
 #include "mail/em-utils.h"
@@ -1485,6 +1488,164 @@
 	return TRUE;
 }
 
+static gboolean
+mail_reader_message_read_cb (EMailReader *reader)
+{
+	MessageList *message_list;
+	const gchar *uid;
+
+	message_list = e_mail_reader_get_message_list (reader);
+
+	uid = g_object_get_data (G_OBJECT (reader), "mark-read-uid");
+	g_return_if_fail (uid != NULL);
+
+	if (g_strcmp0 (message_list->cursor_uid, uid) == 0)
+		e_mail_reader_mark_as_read (reader, uid);
+}
+
+static void
+mail_reader_message_loaded_cb (CamelFolder *folder,
+                               const gchar *message_uid,
+                               CamelMimeMessage *message,
+                               gpointer user_data,
+                               CamelException *ex)
+{
+	EMailReader *reader = user_data;
+	EMFormatHTMLDisplay *html_display;
+	MessageList *message_list;
+	EShellModule *shell_module;
+	EShellSettings *shell_settings;
+	EShell *shell;
+	EMEvent *event;
+	EMEventTargetMessage *target;
+	gboolean mark_read;
+	gint timeout_interval;
+	gpointer data;
+
+	html_display = e_mail_reader_get_html_display (reader);
+	message_list = e_mail_reader_get_message_list (reader);
+
+	shell_module = e_mail_reader_get_shell_module (reader);
+	shell = e_shell_module_get_shell (shell_module);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	/* If the user picked a different message in the time it took
+	 * to fetch this message, then don't bother rendering it. */
+	if (g_strcmp0 (message_list->cursor_uid, message_uid) != 0)
+		return;
+
+	/** @Event: message.reading
+	 * @Title: Viewing a message
+	 * @Target: EMEventTargetMessage
+	 *
+	 * message.reading is emitted whenever a user views a message.
+	 */
+	event = em_event_peek ();
+	target = em_event_target_new_message (
+		event, folder, message, message_uid, 0);
+	e_event_emit (
+		(EEvent *) event, "message.reading",
+		(EEventTarget *) target);
+
+	em_format_format (
+		(EMFormat *) html_display, folder, message_uid, message);
+
+	/* Reset the shell view icon. */
+	e_shell_event (shell, "mail-icon", "evolution-mail");
+
+	/* Determine whether to mark the message as read. */
+	g_object_get (
+		shell_settings,
+		"mail-mark-seen", &mark_read,
+		"mail-mark-seen-timeout", &timeout_interval, NULL);
+
+	g_object_set_data_full (
+		G_OBJECT (reader), "mark-read-uid",
+		g_strdup (message_uid), (GDestroyNotify) g_free);
+
+	if (message_list->seen_id > 0)
+		g_source_remove (message_list->seen_id);
+
+	if (mark_read) {
+		message_list->seen_id = g_timeout_add (
+			timeout_interval, (GSourceFunc)
+			mail_reader_message_read_cb, reader);
+
+	} else if (camel_exception_is_set (ex)) {
+		GtkHTMLStream *stream;
+
+		/* Display the error inline and clear the exception. */
+		stream = gtk_html_begin (
+			((EMFormatHTML *) html_display)->html);
+		gtk_html_stream_printf (
+			stream, "<h2>%s</h2><p>%s</p>",
+			_("Unable to retrieve message"),
+			ex->desc);
+		gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
+		camel_exception_clear (ex);
+	}
+
+	/* We referenced this in the call to mail_get_messagex(). */
+	g_object_unref (reader);
+}
+
+static gboolean
+mail_reader_message_selected_timeout_cb (EMailReader *reader)
+{
+	EMFormatHTMLDisplay *html_display;
+	MessageList *message_list;
+	const gchar *cursor_uid;
+	const gchar *format_uid;
+	const gchar *key;
+
+	html_display = e_mail_reader_get_html_display (reader);
+	message_list = e_mail_reader_get_message_list (reader);
+
+	cursor_uid = message_list->cursor_uid;
+	format_uid = ((EMFormat *) html_display)->uid;
+
+	if (cursor_uid != NULL) {
+		if (g_strcmp0 (cursor_uid, format_uid) != 0)
+			mail_get_messagex (
+				message_list->folder, cursor_uid,
+				mail_reader_message_loaded_cb,
+				g_object_ref (reader),
+				mail_msg_fast_ordered_push);
+	} else
+		em_format_format ((EMFormat *) html_display, NULL, NULL, NULL);
+
+	key = "message-selected-timeout";
+	g_object_set_data (G_OBJECT (reader), key, NULL);
+
+	return FALSE;
+}
+
+static void
+mail_reader_message_selected_cb (EMailReader *reader,
+                                 const gchar *uid)
+{
+	const gchar *key;
+	guint source_id;
+	gpointer data;
+
+	/* XXX This is kludgy, but we have no other place to store
+	 *     timeout state information. */
+
+	key = "message-selected-timeout";
+	data = g_object_get_data (G_OBJECT (reader), key);
+	source_id = GPOINTER_TO_UINT (data);
+
+	if (source_id > 0)
+		g_source_remove (source_id);
+
+	source_id = g_timeout_add (
+		100, (GSourceFunc)
+		mail_reader_message_selected_timeout_cb, reader);
+
+	data = GUINT_TO_POINTER (source_id);
+	g_object_set_data (G_OBJECT (reader), key, data);
+}
+
 static void
 mail_reader_set_folder (EMailReader *reader,
                         CamelFolder *folder,
@@ -1509,6 +1670,18 @@
 }
 
 static void
+mail_reader_set_message (EMailReader *reader,
+                         const gchar *uid,
+                         gboolean mark_read)
+{
+	MessageList *message_list;
+	gpointer data;
+
+	message_list = e_mail_reader_get_message_list (reader);
+	message_list_select_uid (message_list, uid);
+}
+
+static void
 mail_reader_init_charset_actions (EMailReader *reader)
 {
 	GtkActionGroup *action_group;
@@ -1541,6 +1714,7 @@
 mail_reader_class_init (EMailReaderIface *iface)
 {
 	iface->set_folder = mail_reader_set_folder;
+	iface->set_message = mail_reader_set_message;
 }
 
 GType
@@ -1626,6 +1800,10 @@
 	/* Connect signals. */
 
 	g_signal_connect_swapped (
+		message_list, "message-selected",
+		G_CALLBACK (mail_reader_message_selected_cb), reader);
+
+	g_signal_connect_swapped (
 		message_list->tree, "double-click",
 		G_CALLBACK (mail_reader_double_click_cb), reader);
 
@@ -1730,6 +1908,21 @@
 }
 
 void
+e_mail_reader_set_message (EMailReader *reader,
+                           const gchar *uid,
+                           gboolean mark_read)
+{
+	EMailReaderIface *iface;
+
+	g_return_if_fail (E_IS_MAIL_READER (reader));
+
+	iface = E_MAIL_READER_GET_IFACE (reader);
+	g_return_if_fail (iface->set_message != NULL);
+
+	iface->set_message (reader, uid, mark_read);
+}
+
+void
 e_mail_reader_create_charset_menu (EMailReader *reader,
                                    GtkUIManager *ui_manager,
                                    guint merge_id)

Modified: branches/kill-bonobo/mail/e-mail-reader.h
==============================================================================
--- branches/kill-bonobo/mail/e-mail-reader.h	(original)
+++ branches/kill-bonobo/mail/e-mail-reader.h	Wed Jan  7 18:23:46 2009
@@ -64,14 +64,15 @@
 	void		(*set_folder)		(EMailReader *reader,
 						 CamelFolder *folder,
 						 const gchar *folder_uri);
+	void		(*set_message)		(EMailReader *reader,
+						 const gchar *uid,
+						 gboolean mark_read);
 };
 
 GType		e_mail_reader_get_type		(void);
 void		e_mail_reader_init		(EMailReader *reader);
 GtkActionGroup *
 		e_mail_reader_get_action_group	(EMailReader *reader);
-CamelFolder *	e_mail_reader_get_folder	(EMailReader *reader);
-const gchar *	e_mail_reader_get_folder_uri	(EMailReader *reader);
 gboolean	e_mail_reader_get_hide_deleted	(EMailReader *reader);
 EMFormatHTMLDisplay *
 		e_mail_reader_get_html_display	(EMailReader *reader);
@@ -81,6 +82,9 @@
 void		e_mail_reader_set_folder	(EMailReader *reader,
 						 CamelFolder *folder,
 						 const gchar *folder_uri);
+void		e_mail_reader_set_message	(EMailReader *reader,
+						 const gchar *uid,
+						 gboolean mark_read);
 void		e_mail_reader_create_charset_menu
 						(EMailReader *reader,
 						 GtkUIManager *ui_manager,

Modified: branches/kill-bonobo/mail/e-mail-shell-module-settings.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module-settings.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module-settings.c	Wed Jan  7 18:23:46 2009
@@ -26,7 +26,7 @@
 {
 	EShellSettings *shell_settings;
 
-	shell_settings = e_shell_get_settings (shell);
+	shell_settings = e_shell_get_shell_settings (shell);
 
 	/* XXX Default values should match the GConf schema.
 	 *     Yes it's redundant, but we're stuck with GConf. */

Modified: branches/kill-bonobo/mail/e-mail-shell-module.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.c	Wed Jan  7 18:23:46 2009
@@ -687,10 +687,13 @@
                                           EActivity *activity,
                                           EShellModule *shell_module)
 {
-	GtkWidget *parent;
+	GList *shell_windows;
+	GtkWidget *parent = NULL;
 	gboolean synchronize = FALSE;
 
-	parent = e_shell_get_focused_window (shell);
+	shell_windows = e_shell_get_shell_windows (shell);
+	if (shell_windows != NULL)
+		parent = GTK_WIDGET (shell_windows->data);
 
 	if (e_shell_get_network_available (shell))
 		synchronize = em_utils_prompt_user (
@@ -871,7 +874,7 @@
 	mail_shell_module_init_preferences (shell);
 
 	g_object_get (
-		e_shell_get_settings (shell),
+		e_shell_get_shell_settings (shell),
 		"mail-enable-search-folders",
 		&enable_search_folders, NULL);
 	if (enable_search_folders)

Modified: branches/kill-bonobo/mail/em-account-editor.c
==============================================================================
--- branches/kill-bonobo/mail/em-account-editor.c	(original)
+++ branches/kill-bonobo/mail/em-account-editor.c	Wed Jan  7 18:23:46 2009
@@ -667,7 +667,7 @@
 	gboolean html_mode;
 
 	shell = e_shell_get_default ();
-	shell_settings = e_shell_get_settings (shell);
+	shell_settings = e_shell_get_shell_settings (shell);
 	parent = gtk_widget_get_toplevel (w);
 
 	g_object_get (

Modified: branches/kill-bonobo/mail/em-composer-prefs.c
==============================================================================
--- branches/kill-bonobo/mail/em-composer-prefs.c	(original)
+++ branches/kill-bonobo/mail/em-composer-prefs.c	Wed Jan  7 18:23:46 2009
@@ -857,7 +857,7 @@
 
 	bridge = gconf_bridge_get ();
 	client = mail_config_get_gconf_client ();
-	shell_settings = e_shell_get_settings (shell);
+	shell_settings = e_shell_get_shell_settings (shell);
 
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",

Modified: branches/kill-bonobo/mail/em-folder-view.c
==============================================================================
--- branches/kill-bonobo/mail/em-folder-view.c	(original)
+++ branches/kill-bonobo/mail/em-folder-view.c	Wed Jan  7 18:23:46 2009
@@ -90,7 +90,6 @@
 #include "em-folder-browser.h"
 #include "em-mailer-prefs.h"
 #include "em-folder-browser.h"
-#include "em-message-browser.h"
 #include "message-list.h"
 #include "em-utils.h"
 #include "em-composer-utils.h"
@@ -528,6 +527,7 @@
 		}
 	}
 
+#if 0  /* KILL-BONOBO */
 	/* TODO: have an em_utils_open_messages call? */
 	for (i=0; i<views->len; i++) {
 		EMMessageBrowser *emmb;
@@ -547,6 +547,7 @@
 		em_utils_handle_receipt (emfv->folder, uids->pdata[i], NULL);
 		g_free(views->pdata[i]);
 	}
+#endif
 	g_ptr_array_free(views, TRUE);
 
 	message_list_free_uids(emfv->list, uids);
@@ -664,6 +665,7 @@
 static void
 emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data)
 {
+#if 0  /* KILL-BONOBO */
 	EMFolderView *emfv = data;
 	EMMessageBrowser *emmb;
 	GPtrArray *uids;
@@ -678,6 +680,7 @@
 	gtk_widget_show(emmb->window);
 
 	message_list_free_uids(emfv->list, uids);
+#endif
 }
 
 //#define DelInVFolderCheckName  "DelInVFolderCheck"

Modified: branches/kill-bonobo/mail/em-format-html.c
==============================================================================
--- branches/kill-bonobo/mail/em-format-html.c	(original)
+++ branches/kill-bonobo/mail/em-format-html.c	Wed Jan  7 18:23:46 2009
@@ -159,7 +159,6 @@
 	gtk_html_set_default_content_type(efh->html, "text/html; charset=utf-8");
 	gtk_html_set_editable(efh->html, FALSE);
 
-	g_signal_connect(efh->html, "destroy", G_CALLBACK(efh_gtkhtml_destroy), efh);
 	g_signal_connect(efh->html, "url_requested", G_CALLBACK(efh_url_requested), efh);
 	g_signal_connect(efh->html, "object_requested", G_CALLBACK(efh_object_requested), efh);
 

Modified: branches/kill-bonobo/mail/em-mailer-prefs.c
==============================================================================
--- branches/kill-bonobo/mail/em-mailer-prefs.c	(original)
+++ branches/kill-bonobo/mail/em-mailer-prefs.c	Wed Jan  7 18:23:46 2009
@@ -1108,7 +1108,7 @@
 	char *gladefile;
 
 	prefs->shell = g_object_ref (shell);
-	shell_settings = e_shell_get_settings (shell);
+	shell_settings = e_shell_get_shell_settings (shell);
 
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",

Modified: branches/kill-bonobo/shell/e-shell-content.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-content.c	(original)
+++ branches/kill-bonobo/shell/e-shell-content.c	Wed Jan  7 18:23:46 2009
@@ -459,35 +459,35 @@
 		priv->filter_label = NULL;
 	}
 
-        if (priv->filter_combo_box != NULL) {
-                g_object_unref (priv->filter_combo_box);
-                priv->filter_combo_box = NULL;
-        }
+	if (priv->filter_combo_box != NULL) {
+		g_object_unref (priv->filter_combo_box);
+		priv->filter_combo_box = NULL;
+	}
 
 	if (priv->search_context != NULL) {
 		g_object_unref (priv->search_context);
 		priv->search_context = NULL;
 	}
 
-        if (priv->search_label != NULL) {
-                g_object_unref (priv->search_label);
-                priv->search_label = NULL;
-        }
-
-        if (priv->search_entry != NULL) {
-                g_object_unref (priv->search_entry);
-                priv->search_entry = NULL;
-        }
-
-        if (priv->scope_label != NULL) {
-                g_object_unref (priv->scope_label);
-                priv->scope_label = NULL;
-        }
-
-        if (priv->scope_combo_box != NULL) {
-                g_object_unref (priv->scope_combo_box);
-                priv->scope_combo_box = NULL;
-        }
+	if (priv->search_label != NULL) {
+		g_object_unref (priv->search_label);
+		priv->search_label = NULL;
+	}
+
+	if (priv->search_entry != NULL) {
+		g_object_unref (priv->search_entry);
+		priv->search_entry = NULL;
+	}
+
+	if (priv->scope_label != NULL) {
+		g_object_unref (priv->scope_label);
+		priv->scope_label = NULL;
+	}
+
+	if (priv->scope_combo_box != NULL) {
+		g_object_unref (priv->scope_combo_box);
+		priv->scope_combo_box = NULL;
+	}
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (parent_class)->dispose (object);

Modified: branches/kill-bonobo/shell/e-shell-migrate.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-migrate.c	(original)
+++ branches/kill-bonobo/shell/e-shell-migrate.c	Wed Jan  7 18:23:46 2009
@@ -56,7 +56,7 @@
 	GList *modules;
 	gboolean success = TRUE;
 
-	modules = e_shell_list_modules (shell);
+	modules = e_shell_get_shell_modules (shell);
 
 	while (success && modules != NULL) {
 		EShellModule *shell_module = modules->data;

Modified: branches/kill-bonobo/shell/e-shell-window-actions.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.c	Wed Jan  7 18:23:46 2009
@@ -863,7 +863,7 @@
 	EShell *shell;
 
 	shell = e_shell_window_get_shell (shell_window);
-	e_shell_create_window (shell);
+	e_shell_create_shell_window (shell);
 }
 
 /**
@@ -1970,7 +1970,7 @@
 	ui_manager = e_shell_window_get_ui_manager (shell_window);
 	merge_id = gtk_ui_manager_new_merge_id (ui_manager);
 	shell = e_shell_window_get_shell (shell_window);
-	list = e_shell_list_modules (shell);
+	list = e_shell_get_shell_modules (shell);
 
 	/* Construct a group of radio actions from the various EShellView
 	 * subclasses and register them with the EShellSwitcher.  These

Modified: branches/kill-bonobo/shell/e-shell-window-private.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-private.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-private.c	Wed Jan  7 18:23:46 2009
@@ -173,6 +173,7 @@
 {
 	EShellWindowPrivate *priv = shell_window->priv;
 	GHashTable *loaded_views;
+	GArray *signal_handler_ids;
 	GtkAccelGroup *accel_group;
 	GtkToolItem *item;
 	GtkWidget *container;
@@ -185,6 +186,8 @@
 		(GDestroyNotify) g_free,
 		(GDestroyNotify) g_object_unref);
 
+	signal_handler_ids = g_array_new (FALSE, FALSE, sizeof (gulong));
+
 	priv->ui_manager = gtk_ui_manager_new ();
 	priv->shell_actions = gtk_action_group_new ("shell");
 	priv->gal_view_actions = gtk_action_group_new ("gal-view");
@@ -194,6 +197,7 @@
 	priv->switcher_actions = gtk_action_group_new ("switcher");
 	priv->loaded_views = loaded_views;
 	priv->active_view = "unknown";
+	priv->signal_handler_ids = signal_handler_ids;
 
 	merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
 	priv->custom_rule_merge_id = merge_id;
@@ -369,6 +373,21 @@
 {
 	EShellWindowPrivate *priv = shell_window->priv;
 
+	/* Need to disconnect handlers before we unref the shell. */
+	if (priv->signal_handler_ids != NULL) {
+		GArray *array = priv->signal_handler_ids;
+		gulong handler_id;
+		guint ii;
+
+		for (ii = 0; ii < array->len; ii++) {
+			handler_id = g_array_index (array, gulong, ii);
+			g_signal_handler_disconnect (priv->shell, handler_id);
+		}
+
+		g_array_free (array, TRUE);
+		priv->signal_handler_ids = NULL;
+	}
+
 	DISPOSE (priv->shell);
 
 	DISPOSE (priv->ui_manager);

Modified: branches/kill-bonobo/shell/e-shell-window-private.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-private.h	(original)
+++ branches/kill-bonobo/shell/e-shell-window-private.h	Wed Jan  7 18:23:46 2009
@@ -99,6 +99,9 @@
 
 	/* Miscellaneous */
 
+	/* Shell signal handlers. */
+	GArray *signal_handler_ids;
+
 	guint destroyed : 1;  /* XXX Do we still need this? */
 	guint safe_mode : 1;
 };

Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window.c	Wed Jan  7 18:23:46 2009
@@ -129,17 +129,57 @@
 }
 
 static void
+shell_window_update_close_action_cb (EShellWindow *shell_window)
+{
+	EShell *shell;
+	GList *shell_windows;
+	gboolean sensitive;
+
+	shell = e_shell_window_get_shell (shell_window);
+	shell_windows = e_shell_get_shell_windows (shell);
+	g_return_if_fail (shell_windows != NULL);
+
+	/* Disable Close Window if there's only one window.
+	 * Helps prevent users from accidentally quitting. */
+	sensitive = (g_list_length (shell_windows) > 1);
+	gtk_action_set_sensitive (ACTION (CLOSE), sensitive);
+}
+
+static void
 shell_window_set_shell (EShellWindow *shell_window,
                         EShell *shell)
 {
+	GArray *array;
+	gulong handler_id;
+
 	g_return_if_fail (shell_window->priv->shell == NULL);
 	shell_window->priv->shell = g_object_ref (shell);
 
-	g_signal_connect (
+	/* Need to disconnect these when the window is closing. */
+
+	array = shell_window->priv->signal_handler_ids;
+
+	handler_id = g_signal_connect (
 		shell, "notify::online-mode",
 		G_CALLBACK (shell_window_online_mode_notify_cb),
 		shell_window);
 
+	g_array_append_val (array, handler_id);
+
+	handler_id = g_signal_connect_swapped (
+		shell, "window-created",
+		G_CALLBACK (shell_window_update_close_action_cb),
+		shell_window);
+
+	g_array_append_val (array, handler_id);
+
+	handler_id = g_signal_connect_swapped (
+		shell, "window-destroyed",
+		G_CALLBACK (shell_window_update_close_action_cb),
+		shell_window);
+
+	g_array_append_val (array, handler_id);
+
 	g_object_notify (G_OBJECT (shell), "online-mode");
 }
 

Modified: branches/kill-bonobo/shell/e-shell.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell.c	(original)
+++ branches/kill-bonobo/shell/e-shell.c	Wed Jan  7 18:23:46 2009
@@ -58,7 +58,7 @@
 	PROP_0,
 	PROP_NETWORK_AVAILABLE,
 	PROP_ONLINE_MODE,
-	PROP_SETTINGS
+	PROP_SHELL_SETTINGS
 };
 
 enum {
@@ -131,14 +131,12 @@
                              GObject *where_the_object_was)
 {
 	GList *active_windows;
-	gboolean last_window;
 
 	active_windows = shell->priv->active_windows;
 	active_windows = g_list_remove (active_windows, where_the_object_was);
 	shell->priv->active_windows = active_windows;
 
-	last_window = (shell->priv->active_windows == NULL);
-	g_signal_emit (shell, signals[WINDOW_DESTROYED], 0, last_window);
+	g_signal_emit (shell, signals[WINDOW_DESTROYED], 0);
 }
 
 static void
@@ -306,7 +304,7 @@
 	static guint message_timer = 1;
 
 	/* Module list is read-only; do not free. */
-	list = e_shell_list_modules (shell);
+	list = e_shell_get_shell_modules (shell);
 
 	/* Any module can defer shutdown if it's still busy. */
 	for (iter = list; proceed && iter != NULL; iter = iter->next) {
@@ -387,9 +385,9 @@
 				E_SHELL (object)));
 			return;
 
-		case PROP_SETTINGS:
+		case PROP_SHELL_SETTINGS:
 			g_value_set_object (
-				value, e_shell_get_settings (
+				value, e_shell_get_shell_settings (
 				E_SHELL (object)));
 			return;
 	}
@@ -522,11 +520,11 @@
 	 **/
 	g_object_class_install_property (
 		object_class,
-		PROP_SETTINGS,
+		PROP_SHELL_SETTINGS,
 		g_param_spec_object (
-			"settings",
-			_("Settings"),
-			_("Application settings"),
+			"shell-settings",
+			_("Shell Settings"),
+			_("Application-wide settings"),
 			E_TYPE_SHELL_SETTINGS,
 			G_PARAM_READABLE));
 
@@ -655,7 +653,6 @@
 	/**
 	 * EShell::window-destroyed
 	 * @shell: the #EShell which emitted the signal
-	 * @last_window: whether that was the last #EShellWindow
 	 *
 	 * Emitted when an #EShellWindow is destroyed.
 	 **/
@@ -664,9 +661,8 @@
 		G_OBJECT_CLASS_TYPE (object_class),
 		G_SIGNAL_RUN_LAST,
 		0, NULL, NULL,
-		g_cclosure_marshal_VOID__BOOLEAN,
-		G_TYPE_NONE, 1,
-		G_TYPE_BOOLEAN);
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
 }
 
 static void
@@ -739,7 +735,7 @@
 }
 
 /**
- * e_shell_list_modules:
+ * e_shell_get_shell_modules:
  * @shell: an #EShell
  *
  * Returns a list of loaded #EShellModule instances.  The list is
@@ -748,7 +744,7 @@
  * Returns: a list of loaded #EShellModule instances
  **/
 GList *
-e_shell_list_modules (EShell *shell)
+e_shell_get_shell_modules (EShell *shell)
 {
 	g_return_val_if_fail (E_IS_SHELL (shell), NULL);
 
@@ -756,6 +752,26 @@
 }
 
 /**
+ * e_shell_get_shell_windows:
+ * @shell: an #EShell
+ *
+ * Returns a list of active #EShellWindow instances that were created by
+ * e_shell_create_shell_window().  The list is sorted by the most recently
+ * focused window, such that the first instance is the currently focused
+ * window.  (Useful for choosing a parent for a transient window.)  The
+ * list is owned by @shell and should not be modified or freed.
+ *
+ * Returns: a list of active #EShellWindow instances
+ **/
+GList *
+e_shell_get_shell_windows (EShell *shell)
+{
+	g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+	return shell->priv->active_windows;
+}
+
+/**
  * e_shell_get_canonical_name:
  * @shell: an #EShell
  * @name: the name or alias of an #EShellModule
@@ -834,9 +850,8 @@
 
 	return g_hash_table_lookup (hash_table, scheme);
 }
-
 /**
- * e_shell_get_settings:
+ * e_shell_get_shell_settings:
  * @shell: an #EShell
  *
  * Returns the #EShellSettings instance for @shell.
@@ -844,7 +859,7 @@
  * Returns: the #EShellSettings instance for @shell
  **/
 EShellSettings *
-e_shell_get_settings (EShell *shell)
+e_shell_get_shell_settings (EShell *shell)
 {
 	g_return_val_if_fail (E_IS_SHELL (shell), NULL);
 
@@ -852,7 +867,7 @@
 }
 
 /**
- * e_shell_create_window:
+ * e_shell_create_shell_window:
  * @shell: an #EShell
  *
  * Creates a new #EShellWindow and emits the #EShell::window-created
@@ -862,7 +877,7 @@
  * Returns: a new #EShellWindow
  **/
 GtkWidget *
-e_shell_create_window (EShell *shell)
+e_shell_create_shell_window (EShell *shell)
 {
 	GList *active_windows;
 	GtkWidget *shell_window;
@@ -895,27 +910,6 @@
 }
 
 /**
- * e_shell_get_focused_window:
- * @shell: an #EShell
- *
- * Returns the most recently focused #EShellWindow.  Useful for choosing
- * a parent for a transient window.  This only works for windows created
- * with e_shell_create_window().
- *
- * Returns: the most recently focused #EShellWindow
- **/
-GtkWidget *
-e_shell_get_focused_window (EShell *shell)
-{
-	g_return_val_if_fail (E_IS_SHELL (shell), NULL);
-
-	if (shell->priv->active_windows == NULL)
-		return NULL;
-
-	return GTK_WIDGET (shell->priv->active_windows->data);
-}
-
-/**
  * e_shell_handle_uri:
  * @shell: an #EShell
  * @uri: the URI to be handled

Modified: branches/kill-bonobo/shell/e-shell.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell.h	(original)
+++ branches/kill-bonobo/shell/e-shell.h	Wed Jan  7 18:23:46 2009
@@ -76,16 +76,16 @@
 
 GType		e_shell_get_type		(void);
 EShell *	e_shell_get_default		(void);
-GList *		e_shell_list_modules		(EShell *shell);
+GList *		e_shell_get_shell_modules	(EShell *shell);
+GList *		e_shell_get_shell_windows	(EShell *shell);
 const gchar *	e_shell_get_canonical_name	(EShell *shell,
 						 const gchar *name);
 EShellModule *	e_shell_get_module_by_name	(EShell *shell,
 						 const gchar *name);
 EShellModule *	e_shell_get_module_by_scheme	(EShell *shell,
 						 const gchar *scheme);
-EShellSettings *e_shell_get_settings		(EShell *shell);
-GtkWidget *	e_shell_create_window		(EShell *shell);
-GtkWidget *	e_shell_get_focused_window	(EShell *shell);
+EShellSettings *e_shell_get_shell_settings	(EShell *shell);
+GtkWidget *	e_shell_create_shell_window	(EShell *shell);
 gboolean	e_shell_handle_uri		(EShell *shell,
                                                  const gchar *uri);
 void		e_shell_send_receive		(EShell *shell,

Modified: branches/kill-bonobo/shell/main.c
==============================================================================
--- branches/kill-bonobo/shell/main.c	(original)
+++ branches/kill-bonobo/shell/main.c	Wed Jan  7 18:23:46 2009
@@ -317,7 +317,7 @@
 		g_object_unref (client);
 	}
 
-	shell_window = e_shell_create_window (shell);
+	shell_window = e_shell_create_shell_window (shell);
 
 #if 0  /* MBARNES */
 	if (shell == NULL) {
@@ -462,10 +462,9 @@
 #endif
 
 static void
-shell_window_destroyed_cb (EShell *shell,
-                           gboolean last_window)
+shell_window_destroyed_cb (EShell *shell)
 {
-	if (last_window)
+	if (e_shell_get_shell_windows (shell) == NULL)
 		gtk_main_quit ();
 }
 

Modified: branches/kill-bonobo/shell/test/e-test-shell-module.c
==============================================================================
--- branches/kill-bonobo/shell/test/e-test-shell-module.c	(original)
+++ branches/kill-bonobo/shell/test/e-test-shell-module.c	Wed Jan  7 18:23:46 2009
@@ -133,10 +133,9 @@
 }
 
 static void
-test_module_window_destroyed_cb (EShellModule *shell_module,
-                                 gboolean last_window)
+test_module_window_destroyed_cb (EShellModule *shell_module)
 {
-	g_debug ("%s (last=%d)", G_STRFUNC, last_window);
+	g_debug ("%s", G_STRFUNC);
 }
 
 static EShellModuleInfo module_info = {



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