[Commits] [SCM] claws branch, master, updated. 3.16.0-88-ge281818

ticho at claws-mail.org ticho at claws-mail.org
Sat Mar 10 12:41:48 CET 2018


The branch, master has been updated
       via  e281818aadcda30c10da33d55237626fe2482362 (commit)
      from  8017810c4aba7ce1b785f74f4fcaa2f05196d56c (commit)

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


- Log -----------------------------------------------------------------
commit e281818aadcda30c10da33d55237626fe2482362
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 7580e21..0ede96a 100644
--- a/src/editaddress_other_attributes_ldap.c
+++ b/src/editaddress_other_attributes_ldap.c
@@ -256,9 +256,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 {
@@ -268,19 +276,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