Code cleanup around glib version check (2.28 minimum).
[claws.git] / src / gtk / gtkutils.c
index 47b76df27fdfb375b2222e4b10e48f895e28a5eb..89d092c943af608c434803a0e5db853ac021e697 100644 (file)
@@ -1807,7 +1807,7 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, int box_width,
        return pixbuf;
 }
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
 static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl, AutoConfigureData *data)
 {
        gboolean smtp = strcmp(data->tls_service, "submission") == 0 ? TRUE : FALSE;
@@ -2003,15 +2003,23 @@ gpointer gtkut_tree_view_get_selected_pointer(GtkTreeView *view,
        cm_return_val_if_fail(view != NULL, NULL);
        cm_return_val_if_fail(column >= 0, NULL);
 
-       sel = gtk_tree_view_get_selection(view);
+       model = gtk_tree_view_get_model(view);
+       if (_model != NULL)
+               *_model = model;
 
-       cm_return_val_if_fail(
-                       gtk_tree_selection_count_selected_rows(sel) == 1,
-                       NULL);
+       sel = gtk_tree_view_get_selection(view);
+       if (_selection != NULL)
+               *_selection = sel;
 
-       if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+       if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
                return NULL; /* No row selected */
 
+       if (_iter != NULL)
+               *_iter = iter;
+
+       if (gtk_tree_selection_count_selected_rows(sel) > 1)
+               return NULL; /* Can't work with multiselect */
+
        cm_return_val_if_fail(
                        gtk_tree_model_get_n_columns(model) > column,
                        NULL);
@@ -2023,12 +2031,5 @@ gpointer gtkut_tree_view_get_selected_pointer(GtkTreeView *view,
 
        gtk_tree_model_get(model, &iter, column, &ptr, -1);
 
-       if (_model != NULL)
-               *_model = model;
-       if (_selection != NULL)
-               *_selection = sel;
-       if (_iter != NULL)
-               *_iter = iter;
-
        return ptr;
 }