[evolution/kill-bonobo] Miscellaneous bug fixes.



commit 9b73ae5c7d2c016a3b1f07b1040355063b32814b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Apr 23 16:48:05 2009 -0400

    Miscellaneous bug fixes.
---
 composer/e-msg-composer.c        |    1 +
 configure.in                     |    2 +-
 e-util/e-marshal.list            |    1 +
 mail/e-mail-reader.c             |   31 ++++++---
 mail/e-mail-shell-module.c       |    5 +-
 mail/e-mail-shell-view-actions.c |  140 ++++++++++++++++++++++++++++++++++++++
 mail/e-mail-shell-view-actions.h |    4 +
 mail/e-mail-shell-view-private.c |   53 ++++++++++++++
 mail/em-folder-browser.c         |   56 ---------------
 mail/em-utils.c                  |    6 +-
 mail/mail-send-recv.c            |   20 ++++-
 mail/mail-send-recv.h            |    8 ++-
 mail/mail-session.h              |   11 +--
 widgets/misc/Makefile.am         |    2 +
 widgets/misc/e-activity.c        |   84 +++++++++++++++--------
 widgets/misc/e-activity.h        |    4 +-
 16 files changed, 309 insertions(+), 119 deletions(-)

diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index e8375d8..dde9ff4 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -3419,6 +3419,7 @@ handle_mailto (EMsgComposer *composer, const gchar *mailto)
 				   !g_ascii_strcasecmp (header, "attachment")) {
 				EAttachment *attachment;
 
+				camel_url_decode (content);
 				if (g_ascii_strncasecmp (content, "file:", 5) == 0)
 					attachment = e_attachment_new_for_uri (content);
 				else
diff --git a/configure.in b/configure.in
index a8f1e0c..1fe9f86 100644
--- a/configure.in
+++ b/configure.in
@@ -21,7 +21,7 @@ EDS_PACKAGE=1.2
 GTKHTML_PACKAGE=3.14
 
 # Required Packages
-m4_define([glib_minimum_version], [2.18.0])
+m4_define([glib_minimum_version], [2.20.0])
 m4_define([gtk_minimum_version], [2.16.0])
 m4_define([eds_minimum_version], [evo_version])
 m4_define([gnome_icon_theme_minimum_version], [2.19.91])
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
index 3666024..b667ca4 100644
--- a/e-util/e-marshal.list
+++ b/e-util/e-marshal.list
@@ -66,3 +66,4 @@ NONE:STRING,STRING,STRING
 NONE:STRING,STRING,UINT
 OBJECT:OBJECT,DOUBLE,DOUBLE,BOOLEAN
 POINTER:NONE
+STRING:NONE
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 196f2f0..dd8e24b 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -1658,20 +1658,17 @@ mail_reader_double_click_cb (EMailReader *reader,
 	e_mail_reader_activate (reader, "mail-message-open");
 }
 
-static gint
-mail_reader_key_press_cb (EMailReader *reader,
-                          gint row,
-                          ETreePath path,
-                          gint col,
-                          GdkEvent *event)
+static gboolean
+mail_reader_key_press_event_cb (EMailReader *reader,
+                                GdkEventKey *event)
 {
 	const gchar *action_name;
 
-	if ((event->key.state & GDK_CONTROL_MASK) != 0)
+	if ((event->state & GDK_CONTROL_MASK) != 0)
 		goto ctrl;
 
 	/* <keyval> alone */
-	switch (event->key.keyval) {
+	switch (event->keyval) {
 		case GDK_Delete:
 		case GDK_KP_Delete:
 			action_name = "mail-delete";
@@ -1714,7 +1711,7 @@ mail_reader_key_press_cb (EMailReader *reader,
 ctrl:
 
 	/* Ctrl + <keyval> */
-	switch (event->key.keyval) {
+	switch (event->keyval) {
 		case GDK_period:
 			action_name = "mail-next-unread";
 			break;
@@ -1733,6 +1730,16 @@ exit:
 	return TRUE;
 }
 
+static gint
+mail_reader_key_press_cb (EMailReader *reader,
+                          gint row,
+                          ETreePath path,
+                          gint col,
+                          GdkEvent *event)
+{
+	return mail_reader_key_press_event_cb (reader, &event->key);
+}
+
 static gboolean
 mail_reader_message_read_cb (EMailReader *reader)
 {
@@ -2137,10 +2144,14 @@ e_mail_reader_init (EMailReader *reader)
 	/* Connect signals. */
 
 	g_signal_connect_swapped (
-		EM_FORMAT_HTML (html_display)->html, "button-release-event",
+		html, "button-release-event",
 		G_CALLBACK (mail_reader_html_button_release_event_cb), reader);
 
 	g_signal_connect_swapped (
+		html, "key-press-event",
+		G_CALLBACK (mail_reader_key_press_event_cb), reader);
+
+	g_signal_connect_swapped (
 		message_list, "message-selected",
 		G_CALLBACK (mail_reader_message_selected_cb), reader);
 
diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c
index 9f5eafc..35bde6f 100644
--- a/mail/e-mail-shell-module.c
+++ b/mail/e-mail-shell-module.c
@@ -110,7 +110,8 @@ static struct {
 };
 
 /* XXX So many things need the shell module that it's
- *     just easier to make it globally available. */ 
+ *     just easier for now to make it globally available.
+ *     We should fix this, though. */
 EShellModule *mail_shell_module = NULL;
 
 static GHashTable *store_hash;
@@ -846,7 +847,7 @@ mail_shell_module_start (EShellModule *shell_module)
 	if (enable_search_folders)
 		vfolder_load_storage ();
 
-	mail_autoreceive_init (session);
+	mail_autoreceive_init (shell_module, session);
 
 	if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
 		mail_sync_timeout_source_id = g_timeout_add_seconds (
diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c
index 08c5882..f9235a6 100644
--- a/mail/e-mail-shell-view-actions.c
+++ b/mail/e-mail-shell-view-actions.c
@@ -615,6 +615,132 @@ action_mail_show_hidden_cb (GtkAction *action,
 }
 
 static void
+action_mail_smart_backward_cb (GtkAction *action,
+                               EMailShellView *mail_shell_view)
+{
+	EShell *shell;
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	EShellSettings *shell_settings;
+	EMailShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	EMFormatHTMLDisplay *html_display;
+	EMailReader *reader;
+	MessageList *message_list;
+	GtkToggleAction *toggle_action;
+	GtkHTML *html;
+	gboolean caret_mode;
+	gboolean magic_spacebar;
+
+	/* This implements the so-called "Magic Backspace". */
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+	html_display = e_mail_reader_get_html_display (reader);
+	message_list = e_mail_reader_get_message_list (reader);
+
+	magic_spacebar = e_shell_settings_get_boolean (
+		shell_settings, "mail-magic-spacebar");
+
+	toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
+	caret_mode = gtk_toggle_action_get_active (toggle_action);
+
+	html = EM_FORMAT_HTML (html_display)->html;
+
+	if (gtk_html_command (html, "scroll-backward"))
+		return;
+
+	if (caret_mode || !magic_spacebar)
+		return;
+
+	/* XXX Are two separate calls really necessary? */
+
+	if (message_list_select (
+		message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+		0, CAMEL_MESSAGE_SEEN))
+		return;
+
+	if (message_list_select (
+		message_list, MESSAGE_LIST_SELECT_PREVIOUS |
+		MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN))
+		return;
+
+	em_folder_tree_select_prev_path (folder_tree, TRUE);
+
+	gtk_widget_grab_focus (GTK_WIDGET (message_list));
+}
+
+static void
+action_mail_smart_forward_cb (GtkAction *action,
+                              EMailShellView *mail_shell_view)
+{
+	EShell *shell;
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	EShellSettings *shell_settings;
+	EMailShellSidebar *mail_shell_sidebar;
+	EMFolderTree *folder_tree;
+	EMFormatHTMLDisplay *html_display;
+	EMailReader *reader;
+	MessageList *message_list;
+	GtkToggleAction *toggle_action;
+	GtkHTML *html;
+	gboolean caret_mode;
+	gboolean magic_spacebar;
+
+	/* This implements the so-called "Magic Spacebar". */
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+	folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+	reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+	html_display = e_mail_reader_get_html_display (reader);
+	message_list = e_mail_reader_get_message_list (reader);
+
+	magic_spacebar = e_shell_settings_get_boolean (
+		shell_settings, "mail-magic-spacebar");
+
+	toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
+	caret_mode = gtk_toggle_action_get_active (toggle_action);
+
+	html = EM_FORMAT_HTML (html_display)->html;
+
+	if (gtk_html_command (html, "scroll-forward"))
+		return;
+
+	if (caret_mode || !magic_spacebar)
+		return;
+
+	/* XXX Are two separate calls really necessary? */
+
+	if (message_list_select (
+		message_list, MESSAGE_LIST_SELECT_NEXT,
+		0, CAMEL_MESSAGE_SEEN))
+		return;
+
+	if (message_list_select (
+		message_list, MESSAGE_LIST_SELECT_NEXT |
+		MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN))
+		return;
+
+	em_folder_tree_select_next_path (folder_tree, TRUE);
+
+	gtk_widget_grab_focus (GTK_WIDGET (message_list));
+}
+
+static void
 action_mail_stop_cb (GtkAction *action,
                      EMailShellView *mail_shell_view)
 {
@@ -906,6 +1032,20 @@ static GtkActionEntry mail_entries[] = {
 	  N_("Show messages that have been temporarily hidden"),
 	  G_CALLBACK (action_mail_show_hidden_cb) },
 
+	{ "mail-smart-backward",
+	  NULL,
+	  NULL,  /* No menu item; key press only */
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_mail_smart_backward_cb) },
+
+	{ "mail-smart-forward",
+	  NULL,
+	  NULL,  /* No menu item; key press only */
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_mail_smart_forward_cb) },
+
 	{ "mail-stop",
 	  GTK_STOCK_STOP,
 	  N_("Cancel"),
diff --git a/mail/e-mail-shell-view-actions.h b/mail/e-mail-shell-view-actions.h
index 16490fe..c6c1fa3 100644
--- a/mail/e-mail-shell-view-actions.h
+++ b/mail/e-mail-shell-view-actions.h
@@ -177,6 +177,10 @@
 	E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden")
 #define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-show-source")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-smart-backward")
+#define E_SHELL_WINDOW_ACTION_MAIL_SMART_FORWARD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "mail-smart-forward")
 #define E_SHELL_WINDOW_ACTION_MAIL_STOP(window) \
 	E_SHELL_WINDOW_ACTION ((window), "mail-stop")
 #define E_SHELL_WINDOW_ACTION_MAIL_THREADS_COLLAPSE_ALL(window) \
diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c
index 8aecb20..5974cc7 100644
--- a/mail/e-mail-shell-view-private.c
+++ b/mail/e-mail-shell-view-private.c
@@ -64,6 +64,49 @@ mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view,
 }
 
 static gboolean
+mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view,
+                                    GdkEventKey *event)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	GtkAction *action;
+
+	shell_view = E_SHELL_VIEW (mail_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	if ((event->state & GDK_CONTROL_MASK) != 0)
+		return FALSE;
+
+	switch (event->keyval) {
+		case GDK_space:
+			action = ACTION (MAIL_SMART_FORWARD);
+			break;
+
+		case GDK_BackSpace:
+			action = ACTION (MAIL_SMART_BACKWARD);
+			break;
+
+		default:
+			return FALSE;
+	}
+
+	gtk_action_activate (action);
+
+	return TRUE;
+}
+
+static gint
+mail_shell_view_message_list_key_press_cb (EMailShellView *mail_shell_view,
+                                           gint row,
+                                           ETreePath path,
+                                           gint col,
+                                           GdkEvent *event)
+{
+	return mail_shell_view_key_press_event_cb (
+		mail_shell_view, &event->key);
+}
+
+static gboolean
 mail_shell_view_message_list_right_click_cb (EShellView *shell_view,
                                              gint row,
                                              ETreePath path,
@@ -231,6 +274,11 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
 		mail_shell_view);
 
 	g_signal_connect_swapped (
+		message_list->tree, "key-press",
+		G_CALLBACK (mail_shell_view_message_list_key_press_cb),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
 		message_list->tree, "right-click",
 		G_CALLBACK (mail_shell_view_message_list_right_click_cb),
 		mail_shell_view);
@@ -262,6 +310,11 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
 		mail_shell_view);
 
 	g_signal_connect_swapped (
+		html, "key-press-event",
+		G_CALLBACK (mail_shell_view_key_press_event_cb),
+		mail_shell_view);
+
+	g_signal_connect_swapped (
 		html, "status-message",
 		G_CALLBACK (mail_shell_view_reader_status_message_cb),
 		mail_shell_view);
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 97945ca..5d47304 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -140,7 +140,6 @@ static void emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser
 static void emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb);
 static void emfb_search_search_cleared(ESearchBar *esb);
 
-static int emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb);
 static void emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb);
 
 static void emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path);
@@ -337,7 +336,6 @@ emfb_init(GObject *o)
 
 	e_event_emit((EEvent *)eme, "emfb.created", (EEventTarget *)target);
 
-	g_signal_connect (((EMFolderView *) emfb)->list->tree, "key_press", G_CALLBACK(emfb_list_key_press), emfb);
 	g_signal_connect (((EMFolderView *) emfb)->list, "message_selected", G_CALLBACK (emfb_list_message_selected), emfb);
 
 }
@@ -818,60 +816,6 @@ emfb_search_search_cleared(ESearchBar *esb)
 
 /* ********************************************************************** */
 
-static int
-emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb)
-{
-	gboolean state, folder_choose = TRUE;
-	if ((ev->key.state & GDK_CONTROL_MASK) != 0)
-		return FALSE;
-
-	switch (ev->key.keyval) {
-	case GDK_space:
-		if (!emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) {
-			state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-forward");
-			if (!state) {
-				folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN);
-				if (!folder_choose)
-					folder_choose = message_list_select(((EMFolderView *) emfb)->list,
-								    MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
-			}
-
-		} else
-			em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE);
-		break;
-	case GDK_BackSpace:
-		if (!emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) {
-			state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-backward");
-			if (!state) {
-				folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, CAMEL_MESSAGE_SEEN);
-				if (!folder_choose)
-					folder_choose = message_list_select(((EMFolderView *) emfb)->list,
-								    MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
-			}
-
-		} else
-			em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), FALSE);
-		break;
-	default:
-		return FALSE;
-	}
-
-	if (!folder_choose && !emfb->view.preview->caret_mode && mail_config_get_enable_magic_spacebar ()) {
-		//check for unread messages. if yes .. rewindback to the folder
-		EMFolderTree *emft = g_object_get_data((GObject*)emfb, "foldertree");
-		switch (ev->key.keyval) {
-		    case GDK_space:
-			    em_folder_tree_select_next_path (emft, TRUE);
-			    break;
-		    case GDK_BackSpace:
-			    em_folder_tree_select_prev_path (emft, TRUE);
-			    break;
-		}
-		gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list);
-	}
-	return TRUE;
-}
-
 static void
 emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *emfb)
 {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 34562bb..a98359e 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1402,7 +1402,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const char *uri)
 	if (folder == local_templates_folder)
 		return TRUE;
 	
-	if (uri == NULL)
+	if (folder == NULL || uri == NULL)
 		return FALSE;
 		
 	accounts = e_get_account_list ();
@@ -1453,7 +1453,7 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri)
 	if (folder == local_drafts_folder)
 		return TRUE;
 
-	if (uri == NULL)
+	if (folder == NULL || uri == NULL)
 		return FALSE;
 
 	accounts = e_get_account_list ();
@@ -1504,7 +1504,7 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri)
 	if (folder == local_sent_folder)
 		return TRUE;
 
-	if (uri == NULL)
+	if (folder == NULL || uri == NULL)
 		return FALSE;
 
 	accounts = e_get_account_list ();
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 6e2ace0..9fe40a5 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -46,6 +46,7 @@
 #include "mail-folder-cache.h"
 #include "em-event.h"
 
+#include "shell/e-shell.h"
 #include "e-util/e-account-utils.h"
 #include "e-util/gconf-bridge.h"
 
@@ -1069,13 +1070,13 @@ auto_account_changed(EAccountList *eal, EAccount *ea, void *dummy)
 }
 
 static void
-auto_online(CamelObject *o, void *ed, void *d)
+auto_online (EShell *shell)
 {
 	EIterator *iter;
 	EAccountList *accounts;
 	struct _auto_data *info;
 
-	if (!GPOINTER_TO_INT(ed))
+	if (!e_shell_get_online (shell))
 		return;
 
 	accounts = e_get_account_list ();
@@ -1089,10 +1090,15 @@ auto_online(CamelObject *o, void *ed, void *d)
 /* call to setup initial, and after changes are made to the config */
 /* FIXME: Need a cleanup funciton for when object is deactivated */
 void
-mail_autoreceive_init (CamelSession *session)
+mail_autoreceive_init (EShellModule *shell_module,
+                       CamelSession *session)
 {
 	EAccountList *accounts;
 	EIterator *iter;
+	EShell *shell;
+
+	g_return_if_fail (E_IS_SHELL_MODULE (shell_module));
+	g_return_if_fail (CAMEL_IS_SESSION (session));
 
 	if (auto_active)
 		return;
@@ -1107,7 +1113,13 @@ mail_autoreceive_init (CamelSession *session)
 	for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter))
 		auto_account_added(accounts, (EAccount *)e_iterator_get(iter), NULL);
 
-	camel_object_hook_event (session, "online", auto_online, NULL);
+	shell = e_shell_module_get_shell (shell_module);
+
+	auto_online (shell);
+
+	g_signal_connect (
+		shell, "notify::online",
+		G_CALLBACK (auto_online), NULL);
 }
 
 /* we setup the download info's in a hashtable, if we later need to build the gui, we insert
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index 92daaa5..d602e63 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -25,20 +25,22 @@
 
 #include <gtk/gtk.h>
 #include <camel/camel-session.h>
+#include <shell/e-shell-module.h>
 
 G_BEGIN_DECLS
 
 /* send/receive all uri's */
-GtkWidget *     mail_send_receive               (GtkWindow *parent);
+GtkWidget *	mail_send_receive		(GtkWindow *parent);
 
 /* receive a single uri */
-void            mail_receive_uri                (const gchar *uri,
+void		mail_receive_uri		(const gchar *uri,
 						 gboolean keep_on_server);
 
 void            mail_send                       (void);
 
 /* setup auto receive stuff */
-void            mail_autoreceive_init           (CamelSession *session);
+void		mail_autoreceive_init		(EShellModule *shell_module,
+						 CamelSession *session);
 
 G_END_DECLS
 
diff --git a/mail/mail-session.h b/mail/mail-session.h
index 5998c9b..e98a4bd 100644
--- a/mail/mail-session.h
+++ b/mail/mail-session.h
@@ -27,10 +27,7 @@
 #include <camel/camel-session.h>
 #include <shell/e-shell-module.h>
 
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
 void mail_session_init (EShellModule *shell_module);
 void mail_session_shutdown (void);
@@ -55,8 +52,6 @@ void mail_session_set_junk_headers (const char **name, const char **value, int l
 
 extern CamelSession *session;
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
-#endif /* ! MAIL_SESSION_H */
+#endif /* MAIL_SESSION_H */
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index ffc5195..2fa7327 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -51,6 +51,7 @@ widgetsinclude_HEADERS =			\
 	e-attachment-view.h			\
 	e-calendar.h				\
 	e-calendar-item.h			\
+	e-camel-activity.h			\
 	e-canvas.h				\
 	e-canvas-background.h			\
 	e-canvas-utils.h			\
@@ -115,6 +116,7 @@ libemiscwidgets_la_SOURCES =			\
 	e-attachment-view.c			\
 	e-calendar.c				\
 	e-calendar-item.c			\
+	e-camel-activity.c			\
 	e-canvas.c				\
 	e-canvas-background.c			\
 	e-canvas-utils.c			\
diff --git a/widgets/misc/e-activity.c b/widgets/misc/e-activity.c
index d40d5aa..7cd89a7 100644
--- a/widgets/misc/e-activity.c
+++ b/widgets/misc/e-activity.c
@@ -24,6 +24,8 @@
 #include <stdarg.h>
 #include <glib/gi18n.h>
 
+#include "e-util/e-util.h"
+
 #define E_ACTIVITY_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_ACTIVITY, EActivityPrivate))
@@ -58,6 +60,7 @@ enum {
 	CANCELLED,
 	CLICKED,
 	COMPLETED,
+	DESCRIBE,
 	LAST_SIGNAL
 };
 
@@ -84,6 +87,20 @@ activity_idle_complete_cb (EActivity *activity)
 	return FALSE;
 }
 
+static gboolean
+activity_describe_accumulator (GSignalInvocationHint *ihint,
+                               GValue *return_accu,
+                               const GValue *handler_return,
+                               gpointer accu_data)
+{
+	const gchar *string;
+
+	string = g_value_get_string (handler_return);
+	g_value_set_string (return_accu, string);
+
+	return (string == NULL);
+}
+
 static void
 activity_set_property (GObject *object,
                        guint property_id,
@@ -211,6 +228,34 @@ activity_finalize (GObject *object)
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+static void
+activity_cancelled (EActivity *activity)
+{
+	activity->priv->cancelled = TRUE;
+
+	if (activity->priv->idle_id > 0) {
+		g_source_remove (activity->priv->idle_id);
+		activity->priv->idle_id = 0;
+	}
+}
+
+static void
+activity_completed (EActivity *activity)
+{
+	activity->priv->completed = TRUE;
+
+	if (activity->priv->idle_id > 0) {
+		g_source_remove (activity->priv->idle_id);
+		activity->priv->idle_id = 0;
+	}
+}
+
+static void
+activity_clicked (EActivity *activity)
+{
+	/* Allow subclasses to safely chain up. */
+}
+
 static gchar *
 activity_describe (EActivity *activity)
 {
@@ -248,34 +293,6 @@ activity_describe (EActivity *activity)
 }
 
 static void
-activity_cancelled (EActivity *activity)
-{
-	activity->priv->cancelled = TRUE;
-
-	if (activity->priv->idle_id > 0) {
-		g_source_remove (activity->priv->idle_id);
-		activity->priv->idle_id = 0;
-	}
-}
-
-static void
-activity_completed (EActivity *activity)
-{
-	activity->priv->completed = TRUE;
-
-	if (activity->priv->idle_id > 0) {
-		g_source_remove (activity->priv->idle_id);
-		activity->priv->idle_id = 0;
-	}
-}
-
-static void
-activity_clicked (EActivity *activity)
-{
-	/* Allow subclasses to safely chain up. */
-}
-
-static void
 activity_class_init (EActivityClass *class)
 {
 	GObjectClass *object_class;
@@ -288,10 +305,10 @@ activity_class_init (EActivityClass *class)
 	object_class->get_property = activity_get_property;
 	object_class->finalize = activity_finalize;
 
-	class->describe = activity_describe;
 	class->cancelled = activity_cancelled;
 	class->completed = activity_completed;
 	class->clicked = activity_clicked;
+	class->describe = activity_describe;
 
 	g_object_class_install_property (
 		object_class,
@@ -398,6 +415,15 @@ activity_class_init (EActivityClass *class)
 		NULL, NULL,
 		g_cclosure_marshal_VOID__VOID,
 		G_TYPE_NONE, 0);
+
+	signals[DESCRIBE] = g_signal_new (
+		"describe",
+		G_OBJECT_CLASS_TYPE (object_class),
+		G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		G_STRUCT_OFFSET (EActivityClass, describe),
+		activity_describe_accumulator, NULL,
+		e_marshal_STRING__VOID,
+		G_TYPE_STRING, 0);
 }
 
 static void
diff --git a/widgets/misc/e-activity.h b/widgets/misc/e-activity.h
index 68f0bf2..34974dd 100644
--- a/widgets/misc/e-activity.h
+++ b/widgets/misc/e-activity.h
@@ -57,13 +57,11 @@ struct _EActivity {
 struct _EActivityClass {
 	GObjectClass parent_class;
 
-	/* Methods */
-	gchar *		(*describe)		(EActivity *activity);
-
 	/* Signals */
 	void		(*cancelled)		(EActivity *activity);
 	void		(*completed)		(EActivity *activity);
 	void		(*clicked)		(EActivity *activity);
+	gchar *		(*describe)		(EActivity *activity);
 };
 
 GType		e_activity_get_type		(void);



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