aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-04 02:42:29 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-04 02:42:29 +0800
commita9c9f0be5fd5aa5667412a7f1fb516d9133874df (patch)
tree4bbad728c879104495663703512688f423d04b57 /modules
parent76280e456d8d9789e9a9d2186926fc5607bd8967 (diff)
downloadgsoc2013-evolution-a9c9f0be5fd5aa5667412a7f1fb516d9133874df.tar.gz
gsoc2013-evolution-a9c9f0be5fd5aa5667412a7f1fb516d9133874df.tar.zst
gsoc2013-evolution-a9c9f0be5fd5aa5667412a7f1fb516d9133874df.zip
Remove e_mail_reader_get_folder_uri().
Instead call e_mail_reader_get_folder() and, if you really need to, generate the folder URI with e_mail_folder_uri_from_folder().
Diffstat (limited to 'modules')
-rw-r--r--modules/mail/e-mail-shell-view-actions.c9
-rw-r--r--modules/mail/e-mail-shell-view-private.c30
-rw-r--r--modules/mail/e-mail-shell-view-private.h1
-rw-r--r--modules/mail/e-mail-shell-view.c20
4 files changed, 34 insertions, 26 deletions
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index a5e6e9d40e..d20b22455c 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -128,8 +128,9 @@ action_mail_create_search_folder_cb (GtkAction *action,
EMailBackend *backend;
EMailSession *session;
EMailView *mail_view;
- const gchar *folder_uri;
+ CamelFolder *folder;
const gchar *search_text;
+ gchar *folder_uri;
gchar *rule_name;
shell_view = E_SHELL_VIEW (mail_shell_view);
@@ -150,7 +151,7 @@ action_mail_create_search_folder_cb (GtkAction *action,
search_text = "''";
reader = E_MAIL_READER (mail_view);
- folder_uri = e_mail_reader_get_folder_uri (reader);
+ folder = e_mail_reader_get_folder (reader);
search_rule = vfolder_clone_rule (session, search_rule);
g_return_if_fail (search_rule != NULL);
@@ -160,9 +161,13 @@ action_mail_create_search_folder_cb (GtkAction *action,
e_filter_rule_set_name (search_rule, rule_name);
g_free (rule_name);
+ folder_uri = e_mail_folder_uri_from_folder (folder);
+
vfolder_rule = EM_VFOLDER_RULE (search_rule);
em_vfolder_rule_add_source (vfolder_rule, folder_uri);
vfolder_gui_add_rule (vfolder_rule);
+
+ g_free (folder_uri);
}
static void
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 2faecab695..361f10bbca 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -205,7 +205,8 @@ mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view,
GtkWidget *message_list;
EMailReader *reader;
EMailView *mail_view;
- const gchar *list_uri;
+ CamelFolder *folder;
+ gchar *list_uri;
gchar *tree_uri;
mail_shell_content = mail_shell_view->priv->mail_shell_content;
@@ -217,11 +218,12 @@ mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view,
reader = E_MAIL_READER (mail_view);
message_list = e_mail_reader_get_message_list (reader);
- /* Don't use e_mail_reader_get_folder_uri() here. The fact that
- * the method gets the folder URI from the message list is supposed
- * to be a hidden implementation detail, and we want to explicitly
- * get the folder URI from the message list here. */
- list_uri = MESSAGE_LIST (message_list)->folder_uri;
+ /* Don't use e_mail_reader_get_folder() here. The fact that the
+ * method gets the folder from the message list is supposed to be
+ * a hidden implementation detail, and we want to explicitly get
+ * the folder URI from the message list here. */
+ folder = MESSAGE_LIST (message_list)->folder;
+ list_uri = e_mail_folder_uri_from_folder (folder);
tree_uri = em_folder_tree_get_selected_uri (folder_tree);
/* If the folder tree and message list disagree on the current
@@ -229,6 +231,7 @@ mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view,
if (g_strcmp0 (tree_uri, list_uri) != 0)
em_folder_tree_set_selected (folder_tree, list_uri, FALSE);
+ g_free (list_uri);
g_free (tree_uri);
/* Disconnect from the "selection-done" signal. */
@@ -875,7 +878,7 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view)
CamelFolder *folder;
CamelVeeFolder *vee_folder;
const gchar *old_state_group;
- const gchar *folder_uri;
+ gchar *folder_uri;
gchar *new_state_group;
/* XXX Move this to EMailShellContent. */
@@ -888,9 +891,8 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view)
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
- if (folder_uri == NULL)
+ if (folder == NULL)
return;
/* Do not restore state if we're running a "Current Account"
@@ -905,8 +907,10 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view)
if (vee_folder != NULL && folder == CAMEL_FOLDER (vee_folder))
return;
+ folder_uri = e_mail_folder_uri_from_folder (folder);
new_state_group = g_strdup_printf ("Folder %s", folder_uri);
old_state_group = e_shell_searchbar_get_state_group (searchbar);
+ g_free (folder_uri);
/* Avoid loading search state unnecessarily. */
if (g_strcmp0 (new_state_group, old_state_group) != 0) {
@@ -1006,17 +1010,15 @@ mail_shell_view_create_vfolder_cb (CamelFolder *folder,
{
struct {
EMailSession *session;
- gchar *uri;
gint type;
} *vfolder_data = user_data;
if (message != NULL)
vfolder_gui_add_from_message (
vfolder_data->session, message,
- vfolder_data->type, vfolder_data->uri);
+ vfolder_data->type, folder);
g_object_unref (vfolder_data->session);
- g_free (vfolder_data->uri);
g_free (vfolder_data);
}
@@ -1032,12 +1034,10 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
EMailReader *reader;
EMailView *mail_view;
CamelFolder *folder;
- const gchar *folder_uri;
GPtrArray *uids;
struct {
EMailSession *session;
- gchar *uri;
gint type;
} *vfolder_data;
@@ -1054,13 +1054,11 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view,
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
uids = e_mail_reader_get_selected_uids (reader);
if (uids->len == 1) {
vfolder_data = g_malloc (sizeof (*vfolder_data));
vfolder_data->session = g_object_ref (session);
- vfolder_data->uri = g_strdup (folder_uri);
vfolder_data->type = vfolder_type;
mail_get_message (
diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h
index 01097056b0..e6b5285504 100644
--- a/modules/mail/e-mail-shell-view-private.h
+++ b/modules/mail/e-mail-shell-view-private.h
@@ -37,6 +37,7 @@
#include "widgets/misc/e-popup-action.h"
#include "widgets/menus/gal-view-instance.h"
+#include "e-mail-folder-utils.h"
#include "e-mail-label-action.h"
#include "e-mail-label-dialog.h"
#include "e-mail-label-list-store.h"
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index ea707d0086..f0a89e3a37 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -232,7 +232,6 @@ mail_shell_view_execute_search (EShellView *shell_view)
GString *string;
GList *list, *iter;
GSList *search_strings = NULL;
- const gchar *folder_uri;
const gchar *text;
gboolean valid;
gchar *query;
@@ -263,7 +262,6 @@ mail_shell_view_execute_search (EShellView *shell_view)
reader = E_MAIL_READER (mail_view);
folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
message_list = e_mail_reader_get_message_list (reader);
/* This returns a new object reference. */
@@ -561,7 +559,7 @@ all_accounts:
/* Add local folders. */
iter = mail_vfolder_get_sources_local ();
while (iter != NULL) {
- folder_uri = iter->data;
+ const gchar *folder_uri = iter->data;
/* FIXME Not passing a GCancellable or GError here. */
folder = e_mail_session_uri_to_folder_sync (
E_MAIL_SESSION (session), folder_uri, 0, NULL, NULL);
@@ -577,7 +575,7 @@ all_accounts:
/* Add remote folders. */
iter = mail_vfolder_get_sources_remote ();
while (iter != NULL) {
- folder_uri = iter->data;
+ const gchar *folder_uri = iter->data;
/* FIXME Not passing a GCancellable or GError here. */
folder = e_mail_session_uri_to_folder_sync (
E_MAIL_SESSION (session), folder_uri, 0, NULL, NULL);
@@ -894,9 +892,9 @@ mail_shell_view_update_actions (EShellView *shell_view)
if (uri != NULL) {
GtkTreeRowReference *reference;
EMFolderTreeModel *model;
- const gchar *folder_uri;
+ CamelFolder *folder;
- folder_uri = e_mail_reader_get_folder_uri (reader);
+ folder = e_mail_reader_get_folder (reader);
/* XXX If the user right-clicks on a folder other than what
* the message list is showing, disable folder rename.
@@ -905,8 +903,14 @@ mail_shell_view_update_actions (EShellView *shell_view)
* back to where it was to avoid cancelling the inline
* folder tree editing, it's just too hairy to try to
* get right. So we're punting. */
- folder_tree_and_message_list_agree =
- (g_strcmp0 (uri, folder_uri) == 0);
+ if (CAMEL_IS_FOLDER (folder)) {
+ gchar *folder_uri;
+
+ folder_uri = e_mail_folder_uri_from_folder (folder);
+ folder_tree_and_message_list_agree =
+ (g_strcmp0 (uri, folder_uri) == 0);
+ g_free (folder_uri);
+ }
/* FIXME This belongs in a GroupWise plugin. */
account_is_groupwise =