aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-notebook-view.c35
-rw-r--r--mail/e-mail-paned-view.c17
-rw-r--r--mail/e-mail-reader.c24
-rw-r--r--mail/e-mail-reader.h2
-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
8 files changed, 69 insertions, 69 deletions
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c
index 0a73508cbf..d6e4b4a9aa 100644
--- a/mail/e-mail-notebook-view.c
+++ b/mail/e-mail-notebook-view.c
@@ -32,6 +32,7 @@
#include "mail/em-folder-tree.h"
#include "e-mail-notebook-view.h"
#include "e-mail-folder-pane.h"
+#include "e-mail-folder-utils.h"
#include "e-mail-message-pane.h"
#include <shell/e-shell-window-actions.h>
@@ -122,7 +123,7 @@ mnv_page_changed (GtkNotebook *book,
EShellSidebar *shell_sidebar;
EMFolderTree *folder_tree;
EMailView *mview;
- const gchar *uri;
+ CamelFolder *folder;
priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
@@ -130,13 +131,18 @@ mnv_page_changed (GtkNotebook *book,
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
page = gtk_notebook_get_nth_page (book, page_num);
- uri = e_mail_reader_get_folder_uri (E_MAIL_READER (page));
+ folder = e_mail_reader_get_folder (E_MAIL_READER (page));
mview = E_MAIL_VIEW (page);
g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
- if (uri && E_IS_MAIL_FOLDER_PANE (mview))
- em_folder_tree_set_selected (folder_tree, uri, FALSE);
+ if (folder != NULL && E_IS_MAIL_FOLDER_PANE (mview)) {
+ gchar *folder_uri;
+
+ folder_uri = e_mail_folder_uri_from_folder (folder);
+ em_folder_tree_set_selected (folder_tree, folder_uri, FALSE);
+ g_free (folder_uri);
+ }
if (mview != priv->current_view) {
e_mail_view_set_previous_view (mview, priv->current_view);
@@ -261,12 +267,19 @@ mnv_tab_closed_cb (ClutterTimeline *timeline,
struct _tab_data *data)
{
EMailView *page = g_object_get_data ((GObject *)data->tab, "page");
- const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER (page));
EMailView *prev;
gint num;
- if (E_IS_MAIL_FOLDER_PANE (page))
+ if (E_IS_MAIL_FOLDER_PANE (page)) {
+ CamelFolder *folder;
+ gchar *folder_uri;
+
+ folder = e_mail_reader_get_folder (E_MAIL_READER (page));
+ folder_uri = e_mail_folder_uri_from_folder (folder);
g_hash_table_remove (data->view->priv->views, folder_uri);
+ g_free (folder_uri);
+ }
+
prev = e_mail_view_get_previous_view (page);
if (prev) {
num = emnv_get_page_num (data->view, (GtkWidget *)prev);
@@ -332,15 +345,21 @@ tab_remove_gtk_cb (GtkWidget *button,
EMailNotebookView *view)
{
EMailView *page = g_object_get_data ((GObject *)button, "page");
- const gchar *folder_uri = e_mail_reader_get_folder_uri (E_MAIL_READER (page));
EMailView *prev;
gint num;
if (gtk_notebook_get_n_pages (view->priv->book) == 1)
return;
- if (E_IS_MAIL_FOLDER_PANE (page))
+ if (E_IS_MAIL_FOLDER_PANE (page)) {
+ CamelFolder *folder;
+ gchar *folder_uri;
+
+ folder = e_mail_reader_get_folder (E_MAIL_READER (page));
+ folder_uri = e_mail_folder_uri_from_folder (folder);
g_hash_table_remove (view->priv->views, folder_uri);
+ g_free (folder_uri);
+ }
prev = e_mail_view_get_previous_view (page);
if (prev) {
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index e91050b499..33c8a6e98a 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -44,6 +44,7 @@
#include "mail-config.h"
#include "mail-ops.h"
#include "message-list.h"
+#include "e-mail-folder-utils.h"
#include "e-mail-reader-utils.h"
#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \
@@ -95,22 +96,25 @@ mail_paned_view_save_boolean (EMailView *view,
{
EShellView *shell_view;
EMailReader *reader;
+ CamelFolder *folder;
GKeyFile *key_file;
- const gchar *folder_uri;
+ gchar *folder_uri;
gchar *group_name;
shell_view = e_mail_view_get_shell_view (view);
key_file = e_shell_view_get_state_key_file (shell_view);
reader = E_MAIL_READER (view);
- folder_uri = e_mail_reader_get_folder_uri (reader);
+ folder = e_mail_reader_get_folder (reader);
- if (folder_uri == NULL)
+ if (folder == NULL)
return;
+ folder_uri = e_mail_folder_uri_from_folder (folder);
group_name = g_strdup_printf ("Folder %s", folder_uri);
g_key_file_set_boolean (key_file, group_name, key, value);
g_free (group_name);
+ g_free (folder_uri);
e_shell_view_set_state_dirty (shell_view);
}
@@ -749,7 +753,6 @@ mail_paned_view_update_view_instance (EMailView *view)
GtkOrientation orientation;
gboolean outgoing_folder;
gboolean show_vertical_view;
- const gchar *folder_uri;
gchar *view_id;
priv = E_MAIL_PANED_VIEW (view)->priv;
@@ -764,21 +767,17 @@ mail_paned_view_update_view_instance (EMailView *view)
reader = E_MAIL_READER (view);
folder = e_mail_reader_get_folder (reader);
- folder_uri = e_mail_reader_get_folder_uri (reader);
/* If no folder is selected, return silently. */
if (folder == NULL)
return;
- /* If we have a folder, we should also have a URI. */
- g_return_if_fail (folder_uri != NULL);
-
if (priv->view_instance != NULL) {
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
}
- view_id = g_strdup (folder_uri);
+ view_id = e_mail_folder_uri_from_folder (folder);
e_filename_make_safe (view_id);
outgoing_folder =
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 21d5341de2..808deda0fd 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2869,16 +2869,6 @@ mail_reader_get_folder (EMailReader *reader)
return MESSAGE_LIST (message_list)->folder;
}
-static const gchar *
-mail_reader_get_folder_uri (EMailReader *reader)
-{
- GtkWidget *message_list;
-
- message_list = e_mail_reader_get_message_list (reader);
-
- return MESSAGE_LIST (message_list)->folder_uri;
-}
-
static gboolean
mail_reader_get_enable_show_folder (EMailReader *reader)
{
@@ -3386,7 +3376,6 @@ e_mail_reader_default_init (EMailReaderInterface *interface)
interface->get_selected_uids = mail_reader_get_selected_uids;
interface->get_folder = mail_reader_get_folder;
- interface->get_folder_uri = mail_reader_get_folder_uri;
interface->enable_show_folder = mail_reader_get_enable_show_folder;
interface->set_folder = mail_reader_set_folder;
interface->set_message = mail_reader_set_message;
@@ -4081,19 +4070,6 @@ e_mail_reader_get_folder (EMailReader *reader)
return interface->get_folder (reader);
}
-const gchar *
-e_mail_reader_get_folder_uri (EMailReader *reader)
-{
- EMailReaderInterface *interface;
-
- g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
-
- interface = E_MAIL_READER_GET_INTERFACE (reader);
- g_return_val_if_fail (interface->get_folder_uri != NULL, NULL);
-
- return interface->get_folder_uri (reader);
-}
-
void
e_mail_reader_set_folder (EMailReader *reader,
CamelFolder *folder)
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index d6a7597a54..9c5da8fcd8 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -96,7 +96,6 @@ struct _EMailReaderInterface {
GtkWindow * (*get_window) (EMailReader *reader);
CamelFolder * (*get_folder) (EMailReader *reader);
- const gchar * (*get_folder_uri) (EMailReader *reader);
void (*set_folder) (EMailReader *reader,
CamelFolder *folder);
void (*set_message) (EMailReader *reader,
@@ -133,7 +132,6 @@ GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader);
GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader);
GtkWindow * e_mail_reader_get_window (EMailReader *reader);
CamelFolder * e_mail_reader_get_folder (EMailReader *reader);
-const gchar * e_mail_reader_get_folder_uri (EMailReader *reader);
void e_mail_reader_set_folder (EMailReader *reader,
CamelFolder *folder);
void e_mail_reader_set_message (EMailReader *reader,
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 =