diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-12-16 13:05:11 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-12-16 13:05:11 +0800 |
commit | f252ffb547b5542bcf03557d39f8e5c32f325c0a (patch) | |
tree | ba73dbbfa94143b7077d32cc3b2c14b736ed1e5a | |
parent | 22638789fafe044f3c25a5ddbbc371e5da727293 (diff) | |
download | gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.tar gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.tar.gz gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.tar.bz2 gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.tar.lz gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.tar.xz gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.tar.zst gsoc2013-evolution-f252ffb547b5542bcf03557d39f8e5c32f325c0a.zip |
- Mail: Update the sidebar on folder selection.
svn path=/branches/kill-bonobo/; revision=36901
-rw-r--r-- | doc/reference/shell/Makefile.am | 1 | ||||
-rw-r--r-- | doc/reference/shell/tmpl/e-shell.sgml | 45 | ||||
-rw-r--r-- | doc/reference/shell/tmpl/eshell-unused.sgml | 26 | ||||
-rw-r--r-- | mail/e-mail-shell-content.c | 7 | ||||
-rw-r--r-- | mail/e-mail-shell-module.c | 51 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.c | 197 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.h | 7 | ||||
-rw-r--r-- | mail/mail-component.c | 316 |
8 files changed, 463 insertions, 187 deletions
diff --git a/doc/reference/shell/Makefile.am b/doc/reference/shell/Makefile.am index fb2533f0a0..971b1316f6 100644 --- a/doc/reference/shell/Makefile.am +++ b/doc/reference/shell/Makefile.am @@ -106,7 +106,6 @@ GTKDOC_LIBS= \ $(top_builddir)/filter/.libs/filter-file.o \ $(top_builddir)/filter/.libs/filter-input.o \ $(top_builddir)/filter/.libs/filter-int.o \ - $(top_builddir)/filter/.libs/filter-label.o \ $(top_builddir)/filter/.libs/filter-option.o \ $(top_builddir)/filter/.libs/filter-part.o \ $(top_builddir)/filter/.libs/filter-rule.o \ diff --git a/doc/reference/shell/tmpl/e-shell.sgml b/doc/reference/shell/tmpl/e-shell.sgml index f5e844dce5..290ac7fcb8 100644 --- a/doc/reference/shell/tmpl/e-shell.sgml +++ b/doc/reference/shell/tmpl/e-shell.sgml @@ -40,6 +40,22 @@ EShell @arg1: @Returns: +<!-- ##### SIGNAL EShell::prepare-for-offline ##### --> +<para> + +</para> + +@eshell: the object which received the signal. +@arg1: + +<!-- ##### SIGNAL EShell::prepare-for-online ##### --> +<para> + +</para> + +@eshell: the object which received the signal. +@arg1: + <!-- ##### SIGNAL EShell::send-receive ##### --> <para> @@ -64,26 +80,21 @@ EShell @eshell: the object which received the signal. @arg1: -<!-- ##### ARG EShell:online-mode ##### --> +<!-- ##### ARG EShell:network-available ##### --> <para> </para> -<!-- ##### ARG EShell:settings ##### --> +<!-- ##### ARG EShell:online-mode ##### --> <para> </para> -<!-- ##### ENUM EShellLineStatus ##### --> +<!-- ##### ARG EShell:settings ##### --> <para> </para> -@E_SHELL_LINE_STATUS_ONLINE: -@E_SHELL_LINE_STATUS_GOING_OFFLINE: -@E_SHELL_LINE_STATUS_OFFLINE: -@E_SHELL_LINE_STATUS_FORCED_OFFLINE: - <!-- ##### FUNCTION e_shell_get_default ##### --> <para> @@ -195,24 +206,6 @@ EShell @online_mode: -<!-- ##### FUNCTION e_shell_get_line_status ##### --> -<para> - -</para> - -@shell: -@Returns: - - -<!-- ##### FUNCTION e_shell_set_line_status ##### --> -<para> - -</para> - -@shell: -@status: - - <!-- ##### FUNCTION e_shell_get_preferences_window ##### --> <para> diff --git a/doc/reference/shell/tmpl/eshell-unused.sgml b/doc/reference/shell/tmpl/eshell-unused.sgml index 3ed67b59d1..cee15019d4 100644 --- a/doc/reference/shell/tmpl/eshell-unused.sgml +++ b/doc/reference/shell/tmpl/eshell-unused.sgml @@ -433,6 +433,16 @@ intelligent @minor: @revision: +<!-- ##### ENUM EShellLineStatus ##### --> +<para> + +</para> + +@E_SHELL_LINE_STATUS_ONLINE: +@E_SHELL_LINE_STATUS_GOING_OFFLINE: +@E_SHELL_LINE_STATUS_OFFLINE: +@E_SHELL_LINE_STATUS_FORCED_OFFLINE: + <!-- ##### STRUCT EShellWindowPrivate ##### --> <para> @@ -1721,6 +1731,14 @@ intelligent @revision: @Returns: +<!-- ##### FUNCTION e_shell_get_line_status ##### --> +<para> + +</para> + +@shell: +@Returns: + <!-- ##### FUNCTION e_shell_marshal_BOOLEAN__STRING ##### --> <para> @@ -1766,6 +1784,14 @@ intelligent @online: @Returns: +<!-- ##### FUNCTION e_shell_set_line_status ##### --> +<para> + +</para> + +@shell: +@status: + <!-- ##### FUNCTION e_shell_upgrade_attempt ##### --> <para> diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index 6d1ffc0a08..cdd49aa718 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -450,7 +450,12 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content view_collection = shell_view_class->view_collection; folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); - g_return_if_fail (folder_view->folder != NULL); + + /* If no folder is selected, return silently. */ + if (folder_view->folder == NULL) + return; + + /* If we have a folder, we should also have a URI. */ g_return_if_fail (folder_view->folder_uri != NULL); if (mail_shell_content->priv->view_instance != NULL) { diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c index 5662067b54..464349a3a7 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-module.c @@ -110,6 +110,11 @@ static MailAsyncEvent *async_event; static EMFolderTreeModel *folder_tree_model; static CamelStore *local_store; +static gint mail_sync_in_progress; +static guint mail_sync_timeout_source_id; + +extern gint camel_application_is_exiting; + G_LOCK_DEFINE_STATIC (local_store); static StoreInfo * @@ -465,6 +470,44 @@ mail_shell_module_init_preferences (EShell *shell) } static void +mail_shell_module_sync_store_done_cb (CamelStore *store, + gpointer user_data) +{ + mail_sync_in_progress--; +} + +static void +mail_shell_module_sync_store_cb (CamelStore *store) +{ + if (!camel_application_is_exiting) { + mail_sync_in_progress++; + mail_sync_store ( + store, FALSE, + mail_shell_module_sync_store_done_cb, NULL); + } +} + +static gboolean +mail_shell_module_mail_sync (EShellModule *shell_module) +{ + if (camel_application_is_exiting) + return FALSE; + + if (mail_sync_in_progress) + goto exit; + + if (session == NULL || !camel_session_is_online (session)) + goto exit; + + e_mail_shell_module_stores_foreach ( + shell_module, (GHFunc) + mail_shell_module_sync_store_cb, NULL); + +exit: + return !camel_application_is_exiting; +} + +static void mail_shell_module_notify_online_mode_cb (EShell *shell, GParamSpec *pspec, EShellModule *shell_module) @@ -693,6 +736,14 @@ e_shell_module_init (GTypeModule *type_module) &enable_search_folders, NULL); if (enable_search_folders) vfolder_load_storage (); + + mail_autoreceive_init (session); + + if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL) + mail_sync_timeout_source_id = g_timeout_add_seconds ( + mail_config_get_sync_timeout (), + (GSourceFunc) mail_shell_module_mail_sync, + shell_module); } /******************************** Public API *********************************/ diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index 21521fd0f9..1dfe6c430d 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -60,6 +60,17 @@ mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view, } static void +mail_shell_view_folder_view_changed_cb (EMailShellView *mail_shell_view, + EMFolderView *folder_view) +{ + EMailShellContent *mail_shell_content; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + e_mail_shell_content_update_view_instance (mail_shell_content); + e_mail_shell_view_update_sidebar (mail_shell_view); +} + +static void mail_shell_view_load_view_collection (EShellViewClass *shell_view_class) { GalViewCollection *collection; @@ -129,11 +140,15 @@ void e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) { EMailShellViewPrivate *priv = mail_shell_view->priv; + EMailShellContent *mail_shell_content; EMailShellSidebar *mail_shell_sidebar; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EMFolderTreeModel *folder_tree_model; EMFolderTree *folder_tree; + EMFolderView *folder_view; + gchar *uri; shell_view = E_SHELL_VIEW (mail_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); @@ -143,6 +158,9 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) priv->mail_shell_content = g_object_ref (shell_content); priv->mail_shell_sidebar = g_object_ref (shell_content); + mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); @@ -156,7 +174,36 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) G_CALLBACK (mail_shell_view_folder_tree_popup_event_cb), mail_shell_view); + g_signal_connect_swapped ( + folder_view, "changed", + G_CALLBACK (mail_shell_view_folder_view_changed_cb), + mail_shell_view); + + /* Use the same callback as "changed". */ + g_signal_connect_swapped ( + folder_view, "loaded", + G_CALLBACK (mail_shell_view_folder_view_changed_cb), + mail_shell_view); + e_mail_shell_view_actions_init (mail_shell_view); + + /* Restore the previously selected folder. */ + folder_tree_model = em_folder_tree_get_model (folder_tree); + uri = em_folder_tree_model_get_selected (folder_tree_model); + if (uri != NULL) { + gboolean expanded; + + expanded = em_folder_tree_model_get_expanded_uri ( + folder_tree_model, uri); + em_folder_tree_set_selected (folder_tree, uri, FALSE); + em_folder_view_set_folder_uri (folder_view, uri); + + if (!expanded) + em_folder_tree_model_set_expanded_uri ( + folder_tree_model, uri, expanded); + + g_free (uri); + } } void @@ -175,3 +222,153 @@ void e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view) { } + +void +e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) +{ + EMailShellContent *mail_shell_content; + EShellSidebar *shell_sidebar; + EShellModule *shell_module; + EShellView *shell_view; + EMFolderView *folder_view; + CamelStore *local_store; + CamelFolder *folder; + GPtrArray *selected; + GString *buffer; + const gchar *display_name; + const gchar *folder_uri; + gchar *folder_name; + gchar *title; + guint32 num_deleted; + guint32 num_junked; + guint32 num_junked_not_deleted; + guint32 num_unread; + guint32 num_visible; + + g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_module = e_shell_view_get_shell_module (shell_view); + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + local_store = e_mail_shell_module_get_local_store (shell_module); + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + folder_uri = folder_view->folder_uri; + folder = folder_view->folder; + + /* If no folder is selected, reset the sidebar banners + * to their default values and stop. */ + if (folder == NULL) { + GtkAction *action; + gchar *label; + + action = e_shell_view_get_action (shell_view); + g_object_get (action, "label", &label, NULL); + e_shell_sidebar_set_primary_text (shell_sidebar, label); + e_shell_sidebar_set_secondary_text (shell_sidebar, NULL); + e_shell_view_set_title (shell_view, label); + g_free (label); + return; + } + + camel_object_get ( + folder, NULL, + CAMEL_FOLDER_NAME, &folder_name, + CAMEL_FOLDER_DELETED, &num_deleted, + CAMEL_FOLDER_JUNKED, &num_junked, + CAMEL_FOLDER_JUNKED_NOT_DELETED, &num_junked_not_deleted, + CAMEL_FOLDER_UNREAD, &num_unread, + CAMEL_FOLDER_VISIBLE, &num_visible, + NULL); + + buffer = g_string_sized_new (256); + selected = message_list_get_selected (folder_view->list); + + if (selected->len > 1) + g_string_append_printf ( + buffer, ngettext ("%d selected, ", "%d selected, ", + selected->len), selected->len); + + if (CAMEL_IS_VTRASH_FOLDER (folder)) { + CamelVTrashFolder *trash_folder; + + trash_folder = (CamelVTrashFolder *) folder; + + /* "Trash" folder */ + if (trash_folder->type == CAMEL_VTRASH_FOLDER_TRASH) + g_string_append_printf ( + buffer, ngettext ("%d deleted", + "%d deleted", num_deleted), num_deleted); + + /* "Junk" folder (hide deleted messages) */ + else if (folder_view->hide_deleted) + g_string_append_printf ( + buffer, ngettext ("%d junk", + "%d junk", num_junked_not_deleted), + num_junked_not_deleted); + + /* "Junk" folder (show deleted messages) */ + else + g_string_append_printf ( + buffer, ngettext ("%d junk", "%d junk", + num_junked), num_junked); + + /* "Drafts" folder */ + } else if (em_utils_folder_is_drafts (folder, folder_uri)) { + g_string_append_printf ( + buffer, ngettext ("%d draft", "%d drafts", + num_visible), num_visible); + + /* "Outbox" folder */ + } else if (em_utils_folder_is_outbox (folder, folder_uri)) { + g_string_append_printf ( + buffer, ngettext ("%d unsent", "%d unsent", + num_visible), num_visible); + + /* "Sent" folder */ + } else if (em_utils_folder_is_sent (folder, folder_uri)) { + g_string_append_printf ( + buffer, ngettext ("%d sent", "%d sent", + num_visible), num_visible); + + /* Normal folder */ + } else { + if (!folder_view->hide_deleted) + num_visible += + num_deleted - num_junked + + num_junked_not_deleted; + + if (num_unread > 0 && selected->len <= 1) + g_string_append_printf ( + buffer, ngettext ("%d unread, ", + "%d unread, ", num_unread), num_unread); + g_string_append_printf ( + buffer, ngettext ("%d total", "%d total", + num_visible), num_visible); + } + + message_list_free_uids (folder_view->list, selected); + + /* Choose a suitable folder name for displaying. */ + if (folder->parent_store == local_store && ( + strcmp (folder_name, "Drafts") == 0 || + strcmp (folder_name, "Inbox") == 0 || + strcmp (folder_name, "Outbox") == 0 || + strcmp (folder_name, "Sent") == 0 || + strcmp (folder_name, "Templates") == 0)) + display_name = _(folder_name); + else if (strcmp (folder_name, "INBOX") == 0) + display_name = _("Inbox"); + else + display_name = folder_name; + + title = g_strdup_printf ("%s (%s)", display_name, buffer->str); + e_shell_sidebar_set_primary_text (shell_sidebar, display_name); + e_shell_sidebar_set_secondary_text (shell_sidebar, buffer->str); + e_shell_view_set_title (shell_view, title); + g_free (title); + + camel_object_free (folder, CAMEL_FOLDER_NAME, folder_name); + g_string_free (buffer, TRUE); +} diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h index cc5f721d67..921c3027b9 100644 --- a/mail/e-mail-shell-view-private.h +++ b/mail/e-mail-shell-view-private.h @@ -25,12 +25,15 @@ #include "e-mail-shell-view.h" #include <glib/gi18n.h> +#include <camel/camel-vtrash-folder.h> #include "e-util/gconf-bridge.h" - #include "widgets/menus/gal-view-instance.h" +#include "em-utils.h" + #include "e-mail-shell-content.h" +#include "e-mail-shell-module.h" #include "e-mail-shell-sidebar.h" #include "e-mail-shell-view-actions.h" @@ -120,6 +123,8 @@ void e_mail_shell_view_private_finalize void e_mail_shell_view_actions_init (EMailShellView *mail_shell_view); +void e_mail_shell_view_update_sidebar + (EMailShellView *mail_shell_view); G_END_DECLS diff --git a/mail/mail-component.c b/mail/mail-component.c index 33468cb459..77d125ce71 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -518,86 +518,86 @@ view_on_url (GObject *emitter, const char *url, const char *nice_url, MailCompon e_activity_handler_set_message (priv->activity_handler, nice_url); } -static void -view_changed(EMFolderView *emfv, EComponentView *component_view) -{ - EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label"); - CORBA_Environment ev; - - CORBA_exception_init(&ev); - - if (emfv->folder) { - char *name, *title; - const char *use_name; /* will contain localized name, if necessary */ - guint32 visible, unread, deleted, junked, junked_not_deleted; - GPtrArray *selected; - GString *tmp = g_string_new(""); - - camel_object_get(emfv->folder, NULL, - CAMEL_FOLDER_NAME, &name, - CAMEL_FOLDER_DELETED, &deleted, - CAMEL_FOLDER_VISIBLE, &visible, - CAMEL_FOLDER_JUNKED, &junked, - CAMEL_FOLDER_JUNKED_NOT_DELETED, &junked_not_deleted, - CAMEL_FOLDER_UNREAD, &unread, NULL); - - selected = message_list_get_selected(emfv->list); - - /* This is so that if any of these are - * shared/reused, we fallback to the standard - * display behaviour */ - if (selected->len > 1) - g_string_append_printf(tmp, ngettext ("%d selected, ", "%d selected, ", selected->len), selected->len); - - if (CAMEL_IS_VTRASH_FOLDER(emfv->folder)) { - if (((CamelVTrashFolder *)emfv->folder)->type == CAMEL_VTRASH_FOLDER_TRASH) { - g_string_append_printf(tmp, ngettext ("%d deleted", "%d deleted", deleted), deleted); - } else { - guint32 num = junked_not_deleted; - - if (!emfv->hide_deleted) - num = junked; - - g_string_append_printf (tmp, ngettext ("%d junk", "%d junk", num), num); - } - } else if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)) { - g_string_append_printf(tmp, ngettext ("%d draft", "%d drafts", visible), visible); - } else if (em_utils_folder_is_sent(emfv->folder, emfv->folder_uri)) { - g_string_append_printf(tmp, ngettext ("%d sent", "%d sent", visible), visible); - } else if (em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) { - g_string_append_printf(tmp, ngettext ("%d unsent", "%d unsent", visible), visible); - /* HACK: hardcoded inbox or maildir '.' folder */ - } else { - if (!emfv->hide_deleted) - visible += deleted - junked + junked_not_deleted; - if (unread && selected->len <= 1) - g_string_append_printf(tmp, ngettext ("%d unread, ", "%d unread, ", unread), unread); - g_string_append_printf(tmp, ngettext ("%d total", "%d total", visible), visible); - } - - message_list_free_uids(emfv->list, selected); - - if (emfv->folder->parent_store == mail_component_peek_local_store(NULL) - && (!strcmp (name, "Drafts") || !strcmp (name, "Inbox") - || !strcmp (name, "Outbox") || !strcmp (name, "Sent") || !strcmp (name, "Templates"))) - use_name = _(name); - else if (!strcmp (name, "INBOX")) - use_name = _("Inbox"); - else - use_name = name; - - e_info_label_set_info (el, use_name, tmp->str); - title = g_strdup_printf ("%s (%s)", use_name, tmp->str); - e_component_view_set_title(component_view, title); - g_free(title); - - g_string_free(tmp, TRUE); - camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name); - } else { - e_info_label_set_info(el, _("Mail"), ""); - e_component_view_set_title(component_view, _("Mail")); - } -} +//static void +//view_changed(EMFolderView *emfv, EComponentView *component_view) +//{ +// EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label"); +// CORBA_Environment ev; +// +// CORBA_exception_init(&ev); +// +// if (emfv->folder) { +// char *name, *title; +// const char *use_name; /* will contain localized name, if necessary */ +// guint32 visible, unread, deleted, junked, junked_not_deleted; +// GPtrArray *selected; +// GString *tmp = g_string_new(""); +// +// camel_object_get(emfv->folder, NULL, +// CAMEL_FOLDER_NAME, &name, +// CAMEL_FOLDER_DELETED, &deleted, +// CAMEL_FOLDER_VISIBLE, &visible, +// CAMEL_FOLDER_JUNKED, &junked, +// CAMEL_FOLDER_JUNKED_NOT_DELETED, &junked_not_deleted, +// CAMEL_FOLDER_UNREAD, &unread, NULL); +// +// selected = message_list_get_selected(emfv->list); +// +// /* This is so that if any of these are +// * shared/reused, we fallback to the standard +// * display behaviour */ +// if (selected->len > 1) +// g_string_append_printf(tmp, ngettext ("%d selected, ", "%d selected, ", selected->len), selected->len); +// +// if (CAMEL_IS_VTRASH_FOLDER(emfv->folder)) { +// if (((CamelVTrashFolder *)emfv->folder)->type == CAMEL_VTRASH_FOLDER_TRASH) { +// g_string_append_printf(tmp, ngettext ("%d deleted", "%d deleted", deleted), deleted); +// } else { +// guint32 num = junked_not_deleted; +// +// if (!emfv->hide_deleted) +// num = junked; +// +// g_string_append_printf (tmp, ngettext ("%d junk", "%d junk", num), num); +// } +// } else if (em_utils_folder_is_drafts(emfv->folder, emfv->folder_uri)) { +// g_string_append_printf(tmp, ngettext ("%d draft", "%d drafts", visible), visible); +// } else if (em_utils_folder_is_sent(emfv->folder, emfv->folder_uri)) { +// g_string_append_printf(tmp, ngettext ("%d sent", "%d sent", visible), visible); +// } else if (em_utils_folder_is_outbox(emfv->folder, emfv->folder_uri)) { +// g_string_append_printf(tmp, ngettext ("%d unsent", "%d unsent", visible), visible); +// /* HACK: hardcoded inbox or maildir '.' folder */ +// } else { +// if (!emfv->hide_deleted) +// visible += deleted - junked + junked_not_deleted; +// if (unread && selected->len <= 1) +// g_string_append_printf(tmp, ngettext ("%d unread, ", "%d unread, ", unread), unread); +// g_string_append_printf(tmp, ngettext ("%d total", "%d total", visible), visible); +// } +// +// message_list_free_uids(emfv->list, selected); +// +// if (emfv->folder->parent_store == mail_component_peek_local_store(NULL) +// && (!strcmp (name, "Drafts") || !strcmp (name, "Inbox") +// || !strcmp (name, "Outbox") || !strcmp (name, "Sent") || !strcmp (name, "Templates"))) +// use_name = _(name); +// else if (!strcmp (name, "INBOX")) +// use_name = _("Inbox"); +// else +// use_name = name; +// +// e_info_label_set_info (el, use_name, tmp->str); +// title = g_strdup_printf ("%s (%s)", use_name, tmp->str); +// e_component_view_set_title(component_view, title); +// g_free(title); +// +// g_string_free(tmp, TRUE); +// camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name); +// } else { +// e_info_label_set_info(el, _("Mail"), ""); +// e_component_view_set_title(component_view, _("Mail")); +// } +//} static void view_changed_timeout_remove (EComponentView *component_view) @@ -733,22 +733,22 @@ impl_createView (PortableServer_Servant servant, 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); - - if ((uri = em_folder_tree_model_get_selected (priv->model))) { - gboolean expanded; - - expanded = em_folder_tree_model_get_expanded_uri (priv->model, uri); - em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri, FALSE); - em_folder_view_set_folder_uri ((EMFolderView *) view_widget, uri); - - if (!expanded) - em_folder_tree_model_set_expanded_uri (priv->model, uri, expanded); +// 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); - g_free (uri); - } +// if ((uri = em_folder_tree_model_get_selected (priv->model))) { +// gboolean expanded; +// +// expanded = em_folder_tree_model_get_expanded_uri (priv->model, uri); +// em_folder_tree_set_selected ((EMFolderTree *) tree_widget, uri, FALSE); +// em_folder_view_set_folder_uri ((EMFolderView *) view_widget, uri); +// +// if (!expanded) +// em_folder_tree_model_set_expanded_uri (priv->model, uri, expanded); +// +// g_free (uri); +// } em_format_set_session ((EMFormat *) ((EMFolderView *) view_widget)->preview, session); @@ -781,12 +781,12 @@ impl_createView (PortableServer_Servant servant, g_signal_connect (component_view->view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget); - g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget); +// g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget); g_signal_connect((EMFolderBrowser *)view_widget, "account_search_cleared", G_CALLBACK (enable_folder_tree), tree_widget); g_signal_connect(((EMFolderBrowser *)view_widget), "account_search_activated", G_CALLBACK (disable_folder_tree), tree_widget); - g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view); - g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view); +// g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view); +// g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view); g_object_set_data((GObject*)info, "folderview", view_widget); g_object_set_data((GObject*)view_widget, "foldertree", tree_widget); @@ -1089,42 +1089,42 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme // camel_exception_clear (&ex); //} -static void -mc_sync_store_done (CamelStore *store, void *data) -{ - MailComponent *mc = (MailComponent *) data; - - mc->priv->mail_sync_in_progress--; -} - -static void -mc_sync_store (gpointer key, gpointer value, gpointer user_data) -{ - extern int camel_application_is_exiting; - MailComponent *mc = (MailComponent *) user_data; - - mc->priv->mail_sync_in_progress++; - - if (!camel_application_is_exiting) - mail_sync_store (CAMEL_STORE (key), FALSE, mc_sync_store_done, mc); - else - mc_sync_store_done (CAMEL_STORE (key), mc); -} - -static gboolean -call_mail_sync (gpointer user_data) -{ - extern int camel_application_is_exiting; - MailComponent *mc = (MailComponent *)user_data; - - if (camel_application_is_exiting) - return FALSE; +//static void +//mc_sync_store_done (CamelStore *store, void *data) +//{ +// MailComponent *mc = (MailComponent *) data; +// +// mc->priv->mail_sync_in_progress--; +//} - if (!mc->priv->mail_sync_in_progress && session && camel_session_is_online (session)) - mail_component_stores_foreach (mc, mc_sync_store, mc); +//static void +//mc_sync_store (gpointer key, gpointer value, gpointer user_data) +//{ +// extern int camel_application_is_exiting; +// MailComponent *mc = (MailComponent *) user_data; +// +// mc->priv->mail_sync_in_progress++; +// +// if (!camel_application_is_exiting) +// mail_sync_store (CAMEL_STORE (key), FALSE, mc_sync_store_done, mc); +// else +// mc_sync_store_done (CAMEL_STORE (key), mc); +//} - return !camel_application_is_exiting; -} +//static gboolean +c//all_mail_sync (gpointer user_data) +//{ +// extern int camel_application_is_exiting; +// MailComponent *mc = (MailComponent *)user_data; +// +// if (camel_application_is_exiting) +// return FALSE; +// +// if (!mc->priv->mail_sync_in_progress && session && camel_session_is_online (session)) +// mail_component_stores_foreach (mc, mc_sync_store, mc); +// +// return !camel_application_is_exiting; +//} //struct _setline_data { // GNOME_Evolution_Listener listener; @@ -1276,42 +1276,42 @@ mail_component_init (MailComponent *component) priv->lock = g_mutex_new(); priv->quit_state = -1; - /* FIXME This is used as both a filename and URI path throughout - * the mail code. Need to clean this up; maybe provide a - * mail_component_get_base_uri() function. */ - priv->base_directory = g_build_filename (e_get_user_data_dir (), "mail", NULL); -#ifdef G_OS_WIN32 - { - char *p = priv->base_directory; - while ((p = strchr(p, '\\'))) - *p++ = '/'; - } -#endif +// /* FIXME This is used as both a filename and URI path throughout +// * the mail code. Need to clean this up; maybe provide a +// * mail_component_get_base_uri() function. */ +// priv->base_directory = g_build_filename (e_get_user_data_dir (), "mail", NULL); +//#ifdef G_OS_WIN32 +// { +// char *p = priv->base_directory; +// while ((p = strchr(p, '\\'))) +// *p++ = '/'; +// } +//#endif - if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST) - abort (); +// if (g_mkdir_with_parents (e_get_user_data_dir (), 0777) == -1 && errno != EEXIST) +// abort (); - priv->model = em_folder_tree_model_new (e_get_user_data_dir ()); +// priv->model = em_folder_tree_model_new (e_get_user_data_dir ()); priv->logger = e_logger_create ("mail"); priv->activity_handler = e_activity_handler_new (); e_activity_handler_set_logger (priv->activity_handler, priv->logger); e_activity_handler_set_error_flush_time (priv->activity_handler, mail_config_get_error_timeout ()*1000); - mail_session_init (e_get_user_data_dir ()); +// mail_session_init (e_get_user_data_dir ()); - priv->async_event = mail_async_event_new(); - priv->store_hash = g_hash_table_new_full ( - NULL, NULL, - (GDestroyNotify) NULL, - (GDestroyNotify) store_hash_free); +// priv->async_event = mail_async_event_new(); +// priv->store_hash = g_hash_table_new_full ( +// NULL, NULL, +// (GDestroyNotify) NULL, +// (GDestroyNotify) store_hash_free); - mail_autoreceive_init (session); +// mail_autoreceive_init (session); - priv->mail_sync_in_progress = 0; - if (g_getenv("CAMEL_FLUSH_CHANGES")) - priv->mail_sync_id = g_timeout_add_seconds (mail_config_get_sync_timeout (), call_mail_sync, component); - else - priv->mail_sync_id = 0; +// priv->mail_sync_in_progress = 0; +// if (g_getenv("CAMEL_FLUSH_CHANGES")) +// priv->mail_sync_id = g_timeout_add_seconds (mail_config_get_sync_timeout (), call_mail_sync, component); +// else +// priv->mail_sync_id = 0; } /* Public API. */ |