[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-121-g1b5888c

ticho at claws-mail.org ticho at claws-mail.org
Sat Mar 10 15:26:45 CET 2018


The branch, gtk3 has been updated
       via  1b5888c7bd5bf06759282b18eeaeaad934ca7914 (commit)
      from  f5a1bf015058d785c668dbe3fba1cc3662329631 (commit)

Summary of changes:
 src/editaddress_other_attributes_ldap.c |   33 +++++++++++++++++--------------
 1 file changed, 18 insertions(+), 15 deletions(-)


- Log -----------------------------------------------------------------
commit 1b5888c7bd5bf06759282b18eeaeaad934ca7914
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Mar 10 12:40:13 2018 +0100

    Apply the attribute list fix from 8017810c4 also when handling LDAP contacts.

diff --git a/src/editaddress_other_attributes_ldap.c b/src/editaddress_other_attributes_ldap.c
index f360d9a..3bdb0ec 100644
--- a/src/editaddress_other_attributes_ldap.c
+++ b/src/editaddress_other_attributes_ldap.c
@@ -255,9 +255,17 @@ static void edit_person_attrib_add(gpointer data) {
 	GtkTreeSelection *sel = gtk_tree_view_get_selection(
 			GTK_TREE_VIEW(personEditDlg->view_attrib));
 	GtkTreeIter iter, iter2;
-	UserAttribute *attrib;
+	UserAttribute *attrib, *prev_attrib;
+
+	attrib = edit_person_attrib_edit(&errFlg, NULL);
+	if (attrib == NULL) /* input for new attribute is not valid */
+		return;
 
-	if (model != NULL) {
+	prev_attrib = gtkut_tree_view_get_selected_pointer(
+			GTK_TREE_VIEW(personEditDlg->view_attrib), ATTRIB_COL_PTR,
+			&model, &sel, &iter);
+
+	if (prev_attrib == NULL) {
 		/* No row selected, or list empty, add it as first row. */
 		gtk_list_store_insert(GTK_LIST_STORE(model), &iter, 0);
 	} else {
@@ -267,19 +275,14 @@ static void edit_person_attrib_add(gpointer data) {
 		iter = iter2;
 	}
 
-	/* Grab the values from text entries, and fill out the new row. */
-	attrib = edit_person_attrib_edit(&errFlg, NULL);
-	debug_print("after edit\n");
-	if (!errFlg) {
-		debug_print("!errflg\n");
-		gtk_list_store_set(GTK_LIST_STORE(model), &iter,
-				ATTRIB_COL_NAME, attrib->name,
-				ATTRIB_COL_VALUE, attrib->value,
-				ATTRIB_COL_PTR, attrib,
-				-1);
-		gtk_tree_selection_select_iter(sel, &iter);
-		edit_person_attrib_clear(NULL);
-	}
+	/* Fill out the new row. */
+	gtk_list_store_set(GTK_LIST_STORE(model), &iter,
+			ATTRIB_COL_NAME, attrib->name,
+			ATTRIB_COL_VALUE, attrib->value,
+			ATTRIB_COL_PTR, attrib,
+			-1);
+	gtk_tree_selection_select_iter(sel, &iter);
+	edit_person_attrib_clear(NULL);
 }
 
 static void edit_person_entry_att_changed (GtkWidget *entry, gpointer data)

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list