aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-session.c34
-rw-r--r--mail/e-mail-session.h3
-rw-r--r--mail/message-list.c24
-rw-r--r--modules/mail/e-mail-shell-backend.c23
-rw-r--r--modules/mail/e-mail-shell-settings.c15
-rw-r--r--modules/mail/e-mail-shell-view-actions.c109
-rw-r--r--modules/mail/e-mail-shell-view-private.c17
-rw-r--r--modules/mail/e-mail-shell-view.c26
-rw-r--r--modules/mail/em-mailer-prefs.c3
9 files changed, 129 insertions, 125 deletions
diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c
index 042a71abf7..70631bd0bb 100644
--- a/mail/e-mail-session.c
+++ b/mail/e-mail-session.c
@@ -81,6 +81,7 @@ typedef struct _SourceContext SourceContext;
struct _EMailSessionPrivate {
EMailAccountStore *account_store;
MailFolderCache *folder_cache;
+ EMailLabelListStore *label_store;
EAccountList *account_list;
gulong account_added_handler_id;
@@ -118,6 +119,7 @@ enum {
PROP_ACCOUNT_STORE,
PROP_FOLDER_CACHE,
PROP_JUNK_FILTER_NAME,
+ PROP_LABEL_STORE,
PROP_LOCAL_STORE,
PROP_VFOLDER_STORE
};
@@ -959,6 +961,13 @@ mail_session_get_property (GObject *object,
E_MAIL_SESSION (object)));
return;
+ case PROP_LABEL_STORE:
+ g_value_set_object (
+ value,
+ e_mail_session_get_label_store (
+ E_MAIL_SESSION (object)));
+ return;
+
case PROP_LOCAL_STORE:
g_value_set_object (
value,
@@ -995,6 +1004,11 @@ mail_session_dispose (GObject *object)
priv->folder_cache = NULL;
}
+ if (priv->label_store != NULL) {
+ g_object_unref (priv->label_store);
+ priv->label_store = NULL;
+ }
+
if (priv->account_list != NULL) {
g_signal_handler_disconnect (
priv->account_list,
@@ -1813,6 +1827,17 @@ e_mail_session_class_init (EMailSessionClass *class)
g_object_class_install_property (
object_class,
+ PROP_LABEL_STORE,
+ g_param_spec_object (
+ "label-store",
+ "Label Store",
+ "Mail label store",
+ E_TYPE_MAIL_LABEL_LIST_STORE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_LOCAL_STORE,
g_param_spec_object (
"local-store",
@@ -1855,6 +1880,7 @@ e_mail_session_init (EMailSession *session)
(GEqualFunc) g_str_equal);
session->priv = E_MAIL_SESSION_GET_PRIVATE (session);
+ session->priv->label_store = e_mail_label_list_store_new ();
session->priv->junk_filters = junk_filters;
session->priv->proxy = e_proxy_new ();
@@ -1926,6 +1952,14 @@ e_mail_session_get_folder_cache (EMailSession *session)
return session->priv->folder_cache;
}
+EMailLabelListStore *
+e_mail_session_get_label_store (EMailSession *session)
+{
+ g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
+
+ return session->priv->label_store;
+}
+
CamelStore *
e_mail_session_get_local_store (EMailSession *session)
{
diff --git a/mail/e-mail-session.h b/mail/e-mail-session.h
index ccba8263f4..7f5f22de27 100644
--- a/mail/e-mail-session.h
+++ b/mail/e-mail-session.h
@@ -29,6 +29,7 @@
#include <e-util/e-activity.h>
#include <mail/e-mail-enums.h>
#include <mail/e-mail-account-store.h>
+#include <mail/e-mail-label-list-store.h>
#include <mail/mail-folder-cache.h>
/* Standard GObject macros */
@@ -81,6 +82,8 @@ EMailAccountStore *
(EMailSession *session);
MailFolderCache *
e_mail_session_get_folder_cache (EMailSession *session);
+EMailLabelListStore *
+ e_mail_session_get_label_store (EMailSession *session);
CamelStore * e_mail_session_get_local_store (EMailSession *session);
CamelStore * e_mail_session_get_vfolder_store
(EMailSession *session);
diff --git a/mail/message-list.c b/mail/message-list.c
index b2fb46e9e1..fd153e3e01 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1509,21 +1509,6 @@ add_all_labels_foreach (ETreeModel *etm,
return FALSE;
}
-static EMailLabelListStore *
-ml_get_label_list_store (MessageList *message_list)
-{
- EShell *shell;
- EShellSettings *shell_settings;
-
- /* FIXME This should be a GObject property on MessageList. */
-
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- return e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
-}
-
static const gchar *
get_trimmed_subject (CamelMessageInfo *info)
{
@@ -1594,9 +1579,12 @@ ml_tree_value_at_ex (ETreeModel *etm,
CamelMessageInfo *msg_info,
MessageList *message_list)
{
+ EMailSession *session;
const gchar *str;
guint32 flags;
+ session = message_list_get_session (message_list);
+
g_return_val_if_fail (msg_info != NULL, NULL);
switch (col) {
@@ -1721,7 +1709,7 @@ ml_tree_value_at_ex (ETreeModel *etm,
/* Get all applicable labels. */
struct LabelsData ld;
- ld.store = ml_get_label_list_store (message_list);
+ ld.store = e_mail_session_get_label_store (session);
ld.labels_tag2iter = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) gtk_tree_iter_free);
for_node_and_subtree_if_collapsed (message_list, path, msg_info, add_all_labels_foreach, &ld);
@@ -1752,7 +1740,6 @@ ml_tree_value_at_ex (ETreeModel *etm,
}
g_hash_table_destroy (ld.labels_tag2iter);
- g_object_unref (ld.store);
}
return (gpointer) colour;
@@ -1804,7 +1791,7 @@ ml_tree_value_at_ex (ETreeModel *etm,
struct LabelsData ld;
GString *result = g_string_new ("");
- ld.store = ml_get_label_list_store (message_list);
+ ld.store = e_mail_session_get_label_store (session);
ld.labels_tag2iter = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) gtk_tree_iter_free);
for_node_and_subtree_if_collapsed (message_list, path, msg_info, add_all_labels_foreach, &ld);
@@ -1830,7 +1817,6 @@ ml_tree_value_at_ex (ETreeModel *etm,
}
g_hash_table_destroy (ld.labels_tag2iter);
- g_object_unref (ld.store);
return (gpointer) g_string_free (result, FALSE);
}
default:
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 891fc64ae9..d15ca1ebe8 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -627,33 +627,36 @@ e_mail_shell_backend_type_register (GTypeModule *type_module)
#include "filter/e-filter-option.h"
#include "shell/e-shell-settings.h"
-#include "mail/e-mail-label-list-store.h"
GSList *
e_mail_labels_get_filter_options (void)
{
EShell *shell;
- EShellSettings *shell_settings;
- EMailLabelListStore *list_store;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
+ EMailLabelListStore *label_store;
GtkTreeModel *model;
GtkTreeIter iter;
GSList *list = NULL;
gboolean valid;
shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
- list_store = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
- model = GTK_TREE_MODEL (list_store);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ label_store = e_mail_session_get_label_store (session);
+
+ model = GTK_TREE_MODEL (label_store);
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid) {
struct _filter_option *option;
gchar *name, *tag;
- name = e_mail_label_list_store_get_name (list_store, &iter);
- tag = e_mail_label_list_store_get_tag (list_store, &iter);
+ name = e_mail_label_list_store_get_name (label_store, &iter);
+ tag = e_mail_label_list_store_get_tag (label_store, &iter);
if (g_str_has_prefix (tag, "$Label")) {
gchar *tmp = tag;
@@ -673,8 +676,6 @@ e_mail_labels_get_filter_options (void)
valid = gtk_tree_model_iter_next (model, &iter);
}
- g_object_unref (list_store);
-
return g_slist_reverse (list);
}
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 49a406e0d0..0ad50d31db 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -28,7 +28,6 @@
#include <gconf/gconf-client.h>
#include <mail/e-mail-backend.h>
-#include <mail/e-mail-label-list-store.h>
#include <shell/e-shell.h>
@@ -59,7 +58,6 @@ e_mail_shell_settings_init (EShellBackend *shell_backend)
EShellSettings *shell_settings;
EMailBackend *backend;
EMailSession *session;
- gpointer object;
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
@@ -70,19 +68,6 @@ e_mail_shell_settings_init (EShellBackend *shell_backend)
/*** Global Objects ***/
e_shell_settings_install_property (
- g_param_spec_object (
- "mail-label-list-store",
- NULL,
- NULL,
- E_TYPE_MAIL_LABEL_LIST_STORE,
- G_PARAM_READWRITE));
-
- object = e_mail_label_list_store_new ();
- e_shell_settings_set_object (
- shell_settings, "mail-label-list-store", object);
- g_object_unref (object);
-
- e_shell_settings_install_property (
g_param_spec_pointer (
"mail-session",
NULL,
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 45ea021f28..26bcfc4bb8 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -675,13 +675,14 @@ static void
action_mail_label_new_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
EMailShellContent *mail_shell_content;
EMailLabelDialog *label_dialog;
- EMailLabelListStore *store;
+ EMailLabelListStore *label_store;
+ EMailBackend *backend;
+ EMailSession *session;
EMailReader *reader;
EMailView *mail_view;
CamelFolder *folder;
@@ -690,7 +691,6 @@ action_mail_label_new_cb (GtkAction *action,
GtkWidget *dialog;
GPtrArray *uids;
GdkColor label_color;
- const gchar *property_name;
const gchar *label_name;
gchar *label_tag;
gint n_children;
@@ -698,6 +698,7 @@ action_mail_label_new_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
dialog = e_mail_label_dialog_new (GTK_WINDOW (shell_window));
@@ -706,27 +707,26 @@ action_mail_label_new_cb (GtkAction *action,
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
goto exit;
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ label_store = e_mail_session_get_label_store (session);
label_dialog = E_MAIL_LABEL_DIALOG (dialog);
label_name = e_mail_label_dialog_get_label_name (label_dialog);
e_mail_label_dialog_get_label_color (label_dialog, &label_color);
- property_name = "mail-label-list-store";
- store = e_shell_settings_get_object (shell_settings, property_name);
- e_mail_label_list_store_set (store, NULL, label_name, &label_color);
- g_object_unref (store);
+ e_mail_label_list_store_set (
+ label_store, NULL, label_name, &label_color);
/* XXX This is awkward. We've added a new label to the list store
* but we don't have the new label's tag nor an iterator to use
* to fetch it. We know the label was appended to the store,
* so we have to dig it out manually. EMailLabelListStore API
* probably needs some rethinking. */
- model = GTK_TREE_MODEL (store);
+ model = GTK_TREE_MODEL (label_store);
n_children = gtk_tree_model_iter_n_children (model, NULL);
gtk_tree_model_iter_nth_child (model, &iter, NULL, n_children - 1);
- label_tag = e_mail_label_list_store_get_tag (store, &iter);
+ label_tag = e_mail_label_list_store_get_tag (label_store, &iter);
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
@@ -751,14 +751,14 @@ static void
action_mail_label_none_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EShell *shell;
EShellView *shell_view;
- EShellWindow *shell_window;
- EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
+ EMailBackend *backend;
+ EMailSession *session;
EMailShellContent *mail_shell_content;
+ EMailLabelListStore *label_store;
EMailReader *reader;
EMailView *mail_view;
- GtkTreeModel *tree_model;
CamelFolder *folder;
GtkTreeIter iter;
GPtrArray *uids;
@@ -766,12 +766,11 @@ action_mail_label_none_cb (GtkAction *action,
guint ii;
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);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
- tree_model = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ label_store = e_mail_session_get_label_store (session);
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
@@ -780,13 +779,13 @@ action_mail_label_none_cb (GtkAction *action,
folder = e_mail_reader_get_folder (reader);
uids = e_mail_reader_get_selected_uids (reader);
- valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+ valid = gtk_tree_model_get_iter_first (
+ GTK_TREE_MODEL (label_store), &iter);
while (valid) {
gchar *tag;
- tag = e_mail_label_list_store_get_tag (
- E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ tag = e_mail_label_list_store_get_tag (label_store, &iter);
for (ii = 0; ii < uids->len; ii++) {
camel_folder_set_message_user_flag (
@@ -797,7 +796,8 @@ action_mail_label_none_cb (GtkAction *action,
g_free (tag);
- valid = gtk_tree_model_iter_next (tree_model, &iter);
+ valid = gtk_tree_model_iter_next (
+ GTK_TREE_MODEL (label_store), &iter);
}
em_utils_uids_free (uids);
@@ -1892,16 +1892,17 @@ mail_shell_view_update_label_action (GtkToggleAction *action,
void
e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
{
- EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
EMailShellContent *mail_shell_content;
+ EMailLabelListStore *label_store;
+ EMailBackend *backend;
+ EMailSession *session;
EMailReader *reader;
EMailView *mail_view;
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
- GtkTreeModel *tree_model;
GtkTreeIter iter;
GPtrArray *uids;
const gchar *path;
@@ -1913,13 +1914,12 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
ui_manager = e_shell_window_get_ui_manager (shell_window);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- tree_model = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ label_store = e_mail_session_get_label_store (session);
action_group = ACTION_GROUP (MAIL_LABEL);
merge_id = mail_shell_view->priv->label_merge_id;
@@ -1936,7 +1936,8 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
reader = E_MAIL_READER (mail_view);
uids = e_mail_reader_get_selected_uids (reader);
- valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+ valid = gtk_tree_model_get_iter_first (
+ GTK_TREE_MODEL (label_store), &iter);
while (valid) {
EMailLabelAction *label_action;
@@ -1947,11 +1948,11 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
gchar *tag;
label = e_mail_label_list_store_get_name (
- E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ label_store, &iter);
stock_id = e_mail_label_list_store_get_stock_id (
- E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ label_store, &iter);
tag = e_mail_label_list_store_get_tag (
- E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ label_store, &iter);
action_name = g_strdup_printf ("mail-label-%d", ii);
/* XXX Add a tooltip! */
@@ -1984,28 +1985,28 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
g_free (stock_id);
g_free (action_name);
- valid = gtk_tree_model_iter_next (tree_model, &iter);
+ valid = gtk_tree_model_iter_next (
+ GTK_TREE_MODEL (label_store), &iter);
ii++;
}
em_utils_uids_free (uids);
-
- g_object_unref (tree_model);
}
void
e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
{
EMailShellContent *mail_shell_content;
- EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
EShellSearchbar *searchbar;
+ EMailLabelListStore *label_store;
+ EMailBackend *backend;
+ EMailSession *session;
EActionComboBox *combo_box;
GtkActionGroup *action_group;
GtkRadioAction *radio_action;
- GtkTreeModel *tree_model;
GtkTreeIter iter;
GList *list;
GSList *group;
@@ -2016,12 +2017,11 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- tree_model = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ label_store = e_mail_session_get_label_store (session);
action_group = ACTION_GROUP (MAIL_FILTER);
e_action_group_remove_all_actions (action_group);
@@ -2040,7 +2040,8 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
group = gtk_radio_action_get_group (radio_action);
g_list_free (list);
- valid = gtk_tree_model_get_iter_first (tree_model, &iter);
+ valid = gtk_tree_model_get_iter_first (
+ GTK_TREE_MODEL (label_store), &iter);
while (valid) {
GtkAction *action;
@@ -2049,9 +2050,9 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
gchar *label;
label = e_mail_label_list_store_get_name (
- E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ label_store, &iter);
stock_id = e_mail_label_list_store_get_stock_id (
- E_MAIL_LABEL_LIST_STORE (tree_model), &iter);
+ label_store, &iter);
action_name = g_strdup_printf ("mail-filter-label-%d", ii);
radio_action = gtk_radio_action_new (
@@ -2069,7 +2070,8 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
g_free (label);
g_free (stock_id);
- valid = gtk_tree_model_iter_next (tree_model, &iter);
+ valid = gtk_tree_model_iter_next (
+ GTK_TREE_MODEL (label_store), &iter);
ii++;
}
@@ -2089,6 +2091,5 @@ e_mail_shell_view_update_search_filter (EMailShellView *mail_shell_view)
e_action_combo_box_add_separator_after (combo_box, ii);
e_shell_view_unblock_execute_search (shell_view);
-
- g_object_unref (tree_model);
}
+
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index aaa4e5e4f3..269a122efe 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -612,7 +612,6 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
EShellView *shell_view;
EShellBackend *shell_backend;
EShellContent *shell_content;
- EShellSettings *shell_settings;
EShellSidebar *shell_sidebar;
EShellTaskbar *shell_taskbar;
EShellWindow *shell_window;
@@ -623,9 +622,11 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
ERuleContext *context;
EFilterRule *rule = NULL;
GtkTreeSelection *selection;
- GtkTreeModel *tree_model;
GtkUIManager *ui_manager;
GtkWidget *message_list;
+ EMailLabelListStore *label_store;
+ EMailBackend *backend;
+ EMailSession *session;
EMailReader *reader;
EMailView *mail_view;
EWebView *web_view;
@@ -643,10 +644,10 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
ui_manager = e_shell_window_get_ui_manager (shell_window);
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
- tree_model = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
+ backend = E_MAIL_BACKEND (shell_backend);
+ session = e_mail_backend_get_session (backend);
+ label_store = e_mail_session_get_label_store (session);
e_shell_window_add_action_group (shell_window, "mail");
e_shell_window_add_action_group (shell_window, "mail-filter");
@@ -743,17 +744,17 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- tree_model, "row-changed",
+ label_store, "row-changed",
G_CALLBACK (e_mail_shell_view_update_search_filter),
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- tree_model, "row-deleted",
+ label_store, "row-deleted",
G_CALLBACK (e_mail_shell_view_update_search_filter),
mail_shell_view, G_CONNECT_SWAPPED);
g_signal_connect_object (
- tree_model, "row-inserted",
+ label_store, "row-inserted",
G_CALLBACK (e_mail_shell_view_update_search_filter),
mail_shell_view, G_CONNECT_SWAPPED);
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 45246e60e9..07fec7e45f 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -214,12 +214,10 @@ mail_shell_view_execute_search (EShellView *shell_view)
EMailShellViewPrivate *priv;
EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
- EShell *shell;
EShellWindow *shell_window;
EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
- EShellSettings *shell_settings;
EShellSearchbar *searchbar;
EActionComboBox *combo_box;
EMailBackend *backend;
@@ -235,7 +233,7 @@ mail_shell_view_execute_search (EShellView *shell_view)
CamelService *service;
CamelStore *store;
GtkAction *action;
- GtkTreeModel *model;
+ EMailLabelListStore *label_store;
GtkTreePath *path;
GtkTreeIter tree_iter;
GString *string;
@@ -257,9 +255,6 @@ mail_shell_view_execute_search (EShellView *shell_view)
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
@@ -274,9 +269,7 @@ mail_shell_view_execute_search (EShellView *shell_view)
folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
- /* This returns a new object reference. */
- model = e_shell_settings_get_object (
- shell_settings, "mail-label-list-store");
+ label_store = e_mail_session_get_label_store (session);
action = ACTION (MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN);
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
@@ -362,11 +355,10 @@ filter:
g_string_append_printf (
string, "(and %s (and ", query);
valid = gtk_tree_model_get_iter_first (
- model, &tree_iter);
+ GTK_TREE_MODEL (label_store), &tree_iter);
while (valid) {
tag = e_mail_label_list_store_get_tag (
- E_MAIL_LABEL_LIST_STORE (model),
- &tree_iter);
+ label_store, &tree_iter);
use_tag = tag;
if (g_str_has_prefix (use_tag, "$Label"))
use_tag += 6;
@@ -379,7 +371,8 @@ filter:
g_free (tag);
valid = gtk_tree_model_iter_next (
- model, &tree_iter);
+ GTK_TREE_MODEL (label_store),
+ &tree_iter);
}
g_string_append_len (string, "))", 2);
g_free (query);
@@ -457,11 +450,13 @@ filter:
* the label list store. That's why we number
* the label actions from zero. */
path = gtk_tree_path_new_from_indices (value, -1);
- gtk_tree_model_get_iter (model, &tree_iter, path);
+ gtk_tree_model_get_iter (
+ GTK_TREE_MODEL (label_store),
+ &tree_iter, path);
gtk_tree_path_free (path);
tag = e_mail_label_list_store_get_tag (
- E_MAIL_LABEL_LIST_STORE (model), &tree_iter);
+ label_store, &tree_iter);
use_tag = tag;
if (g_str_has_prefix (use_tag, "$Label"))
use_tag += 6;
@@ -751,7 +746,6 @@ execute:
g_slist_foreach (search_strings, (GFunc) g_free, NULL);
g_slist_free (search_strings);
- g_object_unref (model);
g_free (query);
}
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index af570e5c88..1e7e672f1f 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -910,9 +910,8 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
gtk_widget_show (widget);
g_object_bind_property (
- shell_settings, "mail-label-list-store",
+ session, "label-store",
widget, "list-store",
- G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
/* headers */