[gdm/multi-stack: 3/35] Make lookup_item not warn when passing NULL for args



commit ca75999e3ce75549554efb758c9210e2997cc9f6
Author: Ray Strode <rstrode redhat com>
Date:   Mon Mar 2 10:07:03 2009 -0500

    Make lookup_item not warn when passing NULL for args
    
    gtk_tree_model_get doesn't like NULL, and we allow
    NULL for optional return values.
    
    We now check each argument for NULL and call
    gtk_tree_model_get individually N times (one for
    each argument) instead of just once.

 gui/simple-greeter/gdm-chooser-widget.c |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-chooser-widget.c b/gui/simple-greeter/gdm-chooser-widget.c
index b3f2a0d..4e76439 100644
--- a/gui/simple-greeter/gdm-chooser-widget.c
+++ b/gui/simple-greeter/gdm-chooser-widget.c
@@ -2157,13 +2157,30 @@ gdm_chooser_widget_lookup_item (GdmChooserWidget *widget,
         }
         g_free (active_item_id);
 
-        gtk_tree_model_get (GTK_TREE_MODEL (widget->priv->list_store), &iter,
-                            CHOOSER_IMAGE_COLUMN, image,
-                            CHOOSER_NAME_COLUMN, name,
-                            CHOOSER_PRIORITY_COLUMN, priority,
-                            CHOOSER_ITEM_IS_IN_USE_COLUMN, is_in_use,
-                            CHOOSER_ITEM_IS_SEPARATED_COLUMN, is_separate,
-                            -1);
+        if (image != NULL) {
+                gtk_tree_model_get (GTK_TREE_MODEL (widget->priv->list_store), &iter,
+                                    CHOOSER_IMAGE_COLUMN, image, -1);
+        }
+
+        if (name != NULL) {
+                gtk_tree_model_get (GTK_TREE_MODEL (widget->priv->list_store), &iter,
+                                    CHOOSER_NAME_COLUMN, name, -1);
+        }
+
+        if (priority != NULL) {
+                gtk_tree_model_get (GTK_TREE_MODEL (widget->priv->list_store), &iter,
+                                    CHOOSER_PRIORITY_COLUMN, priority, -1);
+        }
+
+        if (is_in_use != NULL) {
+                gtk_tree_model_get (GTK_TREE_MODEL (widget->priv->list_store), &iter,
+                                    CHOOSER_ITEM_IS_IN_USE_COLUMN, is_in_use, -1);
+        }
+
+        if (is_separate != NULL) {
+                gtk_tree_model_get (GTK_TREE_MODEL (widget->priv->list_store), &iter,
+                                    CHOOSER_ITEM_IS_SEPARATED_COLUMN, is_separate, -1);
+        }
 
         return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]