Update uses of gtkut_tree_view_get_selected_pointer().
authorAndrej Kacian <ticho@claws-mail.org>
Tue, 27 Feb 2018 19:24:06 +0000 (20:24 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 27 Feb 2018 19:24:06 +0000 (20:24 +0100)
src/account.c
src/addressadd.c
src/editldap_basedn.c
src/importldif.c
src/mimeview.c
src/plugins/pgpcore/select-keys.c
src/ssl_manager.c

index 52e88f5..be5967f 100644 (file)
@@ -1633,7 +1633,8 @@ static gint account_list_view_get_selected_account_id(GtkWidget *list_view)
        PrefsAccount *res = NULL;
 
        res = (PrefsAccount *)gtkut_tree_view_get_selected_pointer(
-                       GTK_TREE_VIEW(list_view), ACCOUNT_DATA);
+                       GTK_TREE_VIEW(list_view), ACCOUNT_DATA,
+                       NULL, NULL, NULL);
 
        return (res != NULL ? res->account_id : -1);
 }
@@ -1663,7 +1664,8 @@ static PrefsAccount *account_list_view_get_selected_account(GtkWidget *list_view
 {
        PrefsAccount *res =
                (PrefsAccount *)gtkut_tree_view_get_selected_pointer(
-                       GTK_TREE_VIEW(list_view), ACCOUNT_DATA);
+                       GTK_TREE_VIEW(list_view), ACCOUNT_DATA,
+                       NULL, NULL, NULL);
 
        return res;
 }
index a6a7f2a..dda7b7a 100644 (file)
@@ -132,7 +132,8 @@ static gboolean addressadd_key_pressed( GtkWidget *widget, GdkEventKey *event, g
 static void set_selected_ptr()
 {
        addressadd_dlg.fiSelected = gtkut_tree_view_get_selected_pointer(
-                       GTK_TREE_VIEW(addressadd_dlg.tree_folder), ADDRADD_COL_PTR);
+                       GTK_TREE_VIEW(addressadd_dlg.tree_folder), ADDRADD_COL_PTR,
+                       NULL, NULL, NULL);
 }
 
 static void addressadd_ok( GtkWidget *widget, gboolean *cancelled ) {
index 07a8fc5..6fcaeda 100644 (file)
@@ -95,19 +95,13 @@ static void set_selected()
 {
        GtkWidget *entry = ldapedit_basedn.basedn_entry;
        GtkWidget *view = ldapedit_basedn.basedn_list;
-       GtkTreeModel *model;
-       GtkTreeSelection *sel;
-       GtkTreeIter iter;
        gchar *text;
 
        if (entry == NULL || view == NULL)
                return;
 
-       sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
-       if (!gtk_tree_selection_get_selected(sel, &model, &iter))
-               return;
-
-       gtk_tree_model_get(model, &iter, 0, &text, -1);
+       text = gtkut_tree_view_get_selected_pointer(
+                       GTK_TREE_VIEW(view), 0, NULL, NULL, NULL);
 
        if (text == NULL)
                return;
index 707146c..91bf665 100644 (file)
@@ -277,18 +277,16 @@ static gboolean imp_ldif_field_move() {
 
 static void _update_selected_row()
 {
-       GtkWidget *view = impldif_dlg.view_fields;
        GtkTreeModel *model;
-       GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
        GtkTreeIter iter;
        Ldif_FieldRec *rec;
 
-       if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+       rec = gtkut_tree_view_get_selected_pointer(
+                       GTK_TREE_VIEW(impldif_dlg.view_fields), FIELD_COL_PTR,
+                       &model, NULL, &iter);
+       if (rec == NULL)
                return;
 
-       gtk_tree_model_get(model, &iter, FIELD_COL_PTR, &rec, -1);
-       cm_return_if_fail(rec != NULL);
-
        ldif_field_set_name(rec, gtk_entry_get_text(
                                GTK_ENTRY(impldif_dlg.entryAttrib)));
        ldif_field_set_selected(rec, gtk_toggle_button_get_active(
@@ -592,7 +590,8 @@ static void imp_ldif_field_list_cursor_changed(GtkTreeView *view,
 
        gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryAttrib), "" );
 
-       rec = gtkut_tree_view_get_selected_pointer(view, FIELD_COL_PTR);
+       rec = gtkut_tree_view_get_selected_pointer(view, FIELD_COL_PTR,
+                       NULL, NULL, NULL);
 
        if( rec != NULL) {
                /* Update widget contents */
index 82cfd78..a00c72f 100644 (file)
@@ -569,7 +569,8 @@ void mimeview_destroy(MimeView *mimeview)
 MimeInfo *mimeview_get_selected_part(MimeView *mimeview)
 {
        return gtkut_tree_view_get_selected_pointer(
-                       GTK_TREE_VIEW(mimeview->ctree), COL_DATA);
+                       GTK_TREE_VIEW(mimeview->ctree), COL_DATA,
+                       NULL, NULL, NULL);
 }
 
 MimeInfo *mimeview_get_node_part(MimeView *mimeview, GtkTreePath *path)
index 0598851..4bfae56 100644 (file)
@@ -614,7 +614,8 @@ select_btn_cb (GtkWidget *widget, gpointer data)
     cm_return_if_fail (sk);
 
     key = gtkut_tree_view_get_selected_pointer(
-        GTK_TREE_VIEW(sk->view), COL_PTR);
+        GTK_TREE_VIEW(sk->view), COL_PTR,
+                               NULL, NULL, NULL);
     if (key) {
         gpgme_user_id_t uid;
        for (uid = key->uids; uid; uid = uid->next) {
index 1792b35..38d8457 100644 (file)
@@ -393,17 +393,13 @@ static void ssl_manager_delete_cb(GtkWidget *widget,
 {
        SSLCertificate *cert;
        int val;
-       GtkTreeIter sel;
+       GtkTreeIter iter;
        GtkTreeModel *model;
 
-       if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection
-                               (GTK_TREE_VIEW(manager.certlist)),
-                               &model, &sel))
-               return;
-       
-       gtk_tree_model_get(model, &sel,
-                          SSL_MANAGER_CERT, &cert,
-                          -1);
+       cert = gtkut_tree_view_get_selected_pointer(
+                       GTK_TREE_VIEW(manager.certlist), SSL_MANAGER_CERT,
+                       &model, NULL, &iter);
+
        if (!cert)
                return;
 
@@ -418,7 +414,7 @@ static void ssl_manager_delete_cb(GtkWidget *widget,
        
        ssl_certificate_delete_from_disk(cert);
        ssl_certificate_destroy(cert);
-       gtk_list_store_remove(GTK_LIST_STORE(model), &sel);
+       gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 }
 
 static void ssl_manager_view_cb(GtkWidget *widget, 
@@ -427,7 +423,8 @@ static void ssl_manager_view_cb(GtkWidget *widget,
        SSLCertificate *cert;
 
        cert = gtkut_tree_view_get_selected_pointer(
-                       GTK_TREE_VIEW(manager.certlist), SSL_MANAGER_CERT);
+                       GTK_TREE_VIEW(manager.certlist), SSL_MANAGER_CERT,
+                       NULL, NULL, NULL);
 
        if (!cert)
                return;