[evolution] Bug 745869 - Send account overrides: Recipient lost on edit
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 745869 - Send account overrides: Recipient lost on edit
- Date: Mon, 9 Mar 2015 11:47:36 +0000 (UTC)
commit 3fee09f44f46249d7f5d2ef8eed1a4e3f9c8f9ee
Author: Milan Crha <mcrha redhat com>
Date: Mon Mar 9 12:46:23 2015 +0100
Bug 745869 - Send account overrides: Recipient lost on edit
Also preselect the first account after account list change.
modules/mail/em-composer-prefs.c | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 0718011..c66f13c 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -251,7 +251,7 @@ static void
sao_account_treeview_selection_changed_cb (GtkTreeSelection *selection,
GtkBuilder *builder)
{
- GtkTreeModel *model = NULL;
+ GtkTreeModel *model;
GtkWidget *widget;
gboolean enable = FALSE;
@@ -307,6 +307,25 @@ sao_account_treeview_selection_changed_cb (GtkTreeSelection *selection,
}
static void
+sao_account_row_changed_cb (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ GtkBuilder *builder)
+{
+ GtkTreeSelection *selection;
+ GtkWidget *widget;
+
+ if (gtk_tree_model_iter_n_children (model, NULL) != 1)
+ return;
+
+ widget = e_builder_get_widget (builder, "sao-account-treeview");
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+
+ if (!gtk_tree_selection_get_selected (selection, NULL, NULL))
+ gtk_tree_selection_select_iter (selection, iter);
+}
+
+static void
sao_overrides_changed_cb (EMailSendAccountOverride *account_override,
GtkBuilder *builder)
{
@@ -603,10 +622,18 @@ sao_recipient_edited_cb (GtkCellRendererText *renderer,
e_mail_send_account_override_set_for_recipient (account_override, text, account_uid);
} else {
GtkTreeSelection *selection;
+ GtkTreePath *path1, *path2;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
- gtk_list_store_remove (GTK_LIST_STORE (model), &new_iter);
+ path1 = gtk_tree_model_get_path (model, &iter);
+ path2 = gtk_tree_model_get_path (model, &new_iter);
+
+ if (!path1 || !path2 || gtk_tree_path_compare (path1, path2) != 0)
+ gtk_list_store_remove (GTK_LIST_STORE (model), &new_iter);
+
+ gtk_tree_path_free (path1);
+ gtk_tree_path_free (path2);
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_iter (selection, &iter);
@@ -842,6 +869,8 @@ send_account_override_setup (GtkBuilder *builder,
selection, "changed",
G_CALLBACK (sao_account_treeview_selection_changed_cb), builder);
+ g_signal_connect (model, "row-changed", G_CALLBACK (sao_account_row_changed_cb), builder);
+
widget = e_builder_get_widget (builder, "sao-folders-treeview");
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]