diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 23 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-settings.c | 15 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 109 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 17 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 26 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 3 |
6 files changed, 87 insertions, 106 deletions
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 */ |