[gtk/wip/otte/listview] Don't warn when setting properties to their default value



commit 596b9202cedb37c44e069576040df81445825fc7
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 6 08:04:43 2019 -0500

    Don't warn when setting properties to their default value
    
    That makes our tests choke, and is not really necessary.

 gtk/gtkmultiselection.c  | 9 ++++-----
 gtk/gtknoselection.c     | 7 ++++---
 gtk/gtksingleselection.c | 9 ++++-----
 3 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkmultiselection.c b/gtk/gtkmultiselection.c
index 586d8753f8..8ce5df2e56 100644
--- a/gtk/gtkmultiselection.c
+++ b/gtk/gtkmultiselection.c
@@ -233,12 +233,11 @@ gtk_multi_selection_set_property (GObject      *object,
   switch (prop_id)
     {
     case PROP_MODEL:
+      gtk_multi_selection_clear_model (self);
       self->model = g_value_dup_object (value);
-      g_warn_if_fail (self->model != NULL);
-      g_signal_connect (self->model,
-                        "items-changed",
-                        G_CALLBACK (gtk_multi_selection_items_changed_cb),
-                        self);
+      if (self->model)
+        g_signal_connect (self->model, "items-changed",
+                          G_CALLBACK (gtk_multi_selection_items_changed_cb), self);
       break;
 
     default:
diff --git a/gtk/gtknoselection.c b/gtk/gtknoselection.c
index 7eaee46301..662bfe3d9d 100644
--- a/gtk/gtknoselection.c
+++ b/gtk/gtknoselection.c
@@ -130,10 +130,11 @@ gtk_no_selection_set_property (GObject      *object,
   switch (prop_id)
     {
     case PROP_MODEL:
+      gtk_no_selection_clear_model (self);
       self->model = g_value_dup_object (value);
-      g_warn_if_fail (self->model != NULL);
-      g_signal_connect (self->model, "items-changed",
-                        G_CALLBACK (gtk_no_selection_items_changed_cb), self);
+      if (self->model)
+        g_signal_connect (self->model, "items-changed",
+                          G_CALLBACK (gtk_no_selection_items_changed_cb), self);
       break;
 
     default:
diff --git a/gtk/gtksingleselection.c b/gtk/gtksingleselection.c
index 877ccba678..756d59a5a3 100644
--- a/gtk/gtksingleselection.c
+++ b/gtk/gtksingleselection.c
@@ -265,12 +265,11 @@ gtk_single_selection_set_property (GObject      *object,
       break;
 
     case PROP_MODEL:
+      gtk_single_selection_clear_model (self);
       self->model = g_value_dup_object (value);
-      g_warn_if_fail (self->model != NULL);
-      g_signal_connect (self->model,
-                        "items-changed",
-                        G_CALLBACK (gtk_single_selection_items_changed_cb),
-                        self);
+      if (self->model)
+        g_signal_connect (self->model, "items-changed",
+                          G_CALLBACK (gtk_single_selection_items_changed_cb), self);
       if (self->autoselect)
         gtk_single_selection_set_selected (self, 0);
       break;


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