summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/gtkfiledialog.c4
-rw-r--r--gtk/gtknoselection.c2
-rw-r--r--gtk/gtkrange.c2
-rw-r--r--gtk/gtkscalebutton.c2
-rw-r--r--gtk/gtkscrollbar.c5
-rw-r--r--gtk/gtkscrolledwindow.c4
-rw-r--r--gtk/gtksingleselection.c2
-rw-r--r--gtk/gtkspinbutton.c4
-rw-r--r--testsuite/gtk/notify.c103
9 files changed, 104 insertions, 24 deletions
diff --git a/gtk/gtkfiledialog.c b/gtk/gtkfiledialog.c
index 8b9fc21a6a..898650bf9d 100644
--- a/gtk/gtkfiledialog.c
+++ b/gtk/gtkfiledialog.c
@@ -479,7 +479,7 @@ gtk_file_dialog_get_filters (GtkFileDialog *self)
/**
* gtk_file_dialog_set_filters:
* @self: a `GtkFileDialog`
- * @filters: a `GListModel` of `GtkFileFilters`
+ * @filters: (nullable): a `GListModel` of `GtkFileFilters`
*
* Sets the filters that will be offered to the user
* in the file chooser dialog.
@@ -491,7 +491,7 @@ gtk_file_dialog_set_filters (GtkFileDialog *self,
GListModel *filters)
{
g_return_if_fail (GTK_IS_FILE_DIALOG (self));
- g_return_if_fail (G_IS_LIST_MODEL (filters));
+ g_return_if_fail (filters == NULL || G_IS_LIST_MODEL (filters));
if (!g_set_object (&self->filters, filters))
return;
diff --git a/gtk/gtknoselection.c b/gtk/gtknoselection.c
index 3dded4f814..c0848f7c0e 100644
--- a/gtk/gtknoselection.c
+++ b/gtk/gtknoselection.c
@@ -233,7 +233,7 @@ gtk_no_selection_class_init (GtkNoSelectionClass *klass)
properties[PROP_MODEL] =
g_param_spec_object ("model", NULL, NULL,
G_TYPE_LIST_MODEL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkNoSelection:n-items:
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index bae4a2b796..a51c7d447d 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -376,7 +376,7 @@ gtk_range_class_init (GtkRangeClass *class)
properties[PROP_ADJUSTMENT] =
g_param_spec_object ("adjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT,
- GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT);
+ GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkRange:inverted: (attributes org.gtk.Property.get=gtk_range_get_inverted org.gtk.Property.set=gtk_range_set_inverted)
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 7b2c2a11a0..e1a78b1bfe 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -229,7 +229,7 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass)
PROP_ADJUSTMENT,
g_param_spec_object ("adjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT,
- GTK_PARAM_READWRITE));
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkScaleButton:icons: (attributes org.gtk.Property.set=gtk_scale_button_set_icons)
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 20b49a78a2..ec9702ae9c 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -218,7 +218,7 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class)
props[PROP_ADJUSTMENT] =
g_param_spec_object ("adjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT,
- GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT);
+ GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, LAST_PROP, props);
@@ -310,6 +310,9 @@ gtk_scrollbar_set_adjustment (GtkScrollbar *self,
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
adj = gtk_range_get_adjustment (GTK_RANGE (priv->range));
+ if (adj == adjustment)
+ return;
+
if (adj)
{
g_signal_handlers_disconnect_by_func (adj, gtk_scrollbar_adjustment_changed, self);
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 40e4379f69..b81777784b 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -587,7 +587,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
properties[PROP_HADJUSTMENT] =
g_param_spec_object ("hadjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT,
- GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT);
+ GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkScrolleWindow:vadjustment: (attributes org.gtk.Property.get=gtk_scrolled_window_get_vadjustment org.gtk.Property.set=gtk_scrolled_window_set_vadjustment)
@@ -597,7 +597,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
properties[PROP_VADJUSTMENT] =
g_param_spec_object ("vadjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT,
- GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT);
+ GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkScrolledWindow:hscrollbar-policy:
diff --git a/gtk/gtksingleselection.c b/gtk/gtksingleselection.c
index 7e06575872..e4e148ec83 100644
--- a/gtk/gtksingleselection.c
+++ b/gtk/gtksingleselection.c
@@ -431,7 +431,7 @@ gtk_single_selection_class_init (GtkSingleSelectionClass *klass)
properties[PROP_MODEL] =
g_param_spec_object ("model", NULL, NULL,
G_TYPE_LIST_MODEL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkSingleSelection:n-items:
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index e56265a15b..d5a2e6c798 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -374,7 +374,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
spinbutton_props[PROP_ADJUSTMENT] =
g_param_spec_object ("adjustment", NULL, NULL,
GTK_TYPE_ADJUSTMENT,
- GTK_PARAM_READWRITE);
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkSpinButton:climb-rate: (attributes org.gtk.Property.get=gtk_spin_button_get_climb_rate org.gtk.Property.set=gtk_spin_button_set_climb_rate)
@@ -1860,6 +1860,8 @@ gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
if (!adjustment)
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ else if (spin_button->adjustment == adjustment)
+ return;
gtk_spin_button_configure (spin_button,
adjustment,
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 8ee7df88f1..d9bdc2eb07 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -266,6 +266,26 @@ check_property (GObject *instance, GParamSpec *pspec)
g_signal_handler_disconnect (instance, id);
}
+ else if (pspec->value_type == G_TYPE_STRV)
+ {
+ NotifyData data;
+ gulong id;
+ const char *value[] = { "bla", "bla", NULL };
+
+ data.name = pspec->name;
+ data.count = 0;
+ id = g_signal_connect (instance, "notify", G_CALLBACK (count_notify), &data);
+
+ g_object_set (instance, pspec->name, value, NULL);
+ assert_notifies (instance, pspec->name, data.count, 1);
+
+ value[1] = "foo";
+
+ g_object_set (instance, pspec->name, value, NULL);
+ assert_notifies (instance, pspec->name, data.count, 2);
+
+ g_signal_handler_disconnect (instance, id);
+ }
else if (pspec->value_type == G_TYPE_DOUBLE)
{
GParamSpecDouble *p = G_PARAM_SPEC_DOUBLE (pspec);
@@ -342,6 +362,57 @@ check_property (GObject *instance, GParamSpec *pspec)
g_signal_handler_disconnect (instance, id);
}
+ else if (pspec->value_type == G_TYPE_LIST_MODEL)
+ {
+ NotifyData data;
+ gulong id;
+ GListStore *value;
+
+ data.name = pspec->name;
+ data.count = 0;
+ id = g_signal_connect (instance, "notify", G_CALLBACK (count_notify), &data);
+
+ value = g_list_store_new (GTK_TYPE_WIDGET);
+
+ g_object_set (instance, pspec->name, value, NULL);
+ assert_notifies (instance, pspec->name, data.count, 1);
+
+ g_object_set (instance, pspec->name, value, NULL);
+ assert_notifies (instance, pspec->name, data.count, 1);
+
+ g_object_set (instance, pspec->name, NULL, NULL);
+ assert_notifies (instance, pspec->name, data.count, 2);
+
+ g_object_unref (value);
+
+ g_signal_handler_disconnect (instance, id);
+ }
+ else if (pspec->value_type == GTK_TYPE_ADJUSTMENT)
+ {
+ NotifyData data;
+ gulong id;
+ GtkAdjustment *value;
+
+ data.name = pspec->name;
+ data.count = 0;
+ id = g_signal_connect (instance, "notify", G_CALLBACK (count_notify), &data);
+
+ value = gtk_adjustment_new (100, 0, 200, 1, 1, 10);
+ g_object_ref_sink (value);
+
+ g_object_set (instance, pspec->name, value, NULL);
+ assert_notifies (instance, pspec->name, data.count, 1);
+
+ g_object_set (instance, pspec->name, value, NULL);
+ assert_notifies (instance, pspec->name, data.count, 1);
+
+ g_object_set (instance, pspec->name, NULL, NULL);
+ assert_notifies (instance, pspec->name, data.count, 2);
+
+ g_object_unref (value);
+
+ g_signal_handler_disconnect (instance, id);
+ }
else if (pspec->value_type == GTK_TYPE_WIDGET)
{
NotifyData data;
@@ -353,6 +424,7 @@ check_property (GObject *instance, GParamSpec *pspec)
id = g_signal_connect (instance, "notify", G_CALLBACK (count_notify), &data);
value = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ g_object_ref_sink (value);
g_object_set (instance, pspec->name, value, NULL);
assert_notifies (instance, pspec->name, data.count, 1);
@@ -363,6 +435,8 @@ check_property (GObject *instance, GParamSpec *pspec)
g_object_set (instance, pspec->name, NULL, NULL);
assert_notifies (instance, pspec->name, data.count, 2);
+ g_object_unref (value);
+
g_signal_handler_disconnect (instance, id);
}
else
@@ -536,6 +610,7 @@ test_type (gconstpointer data)
if (g_type_is_a (pspec->owner_type, GTK_TYPE_WIDGET) &&
(g_str_equal (pspec->name, "has-focus") ||
g_str_equal (pspec->name, "has-default") ||
+ g_str_equal (pspec->name, "focus-widget") ||
g_str_equal (pspec->name, "is-focus") ||
g_str_equal (pspec->name, "hexpand") ||
g_str_equal (pspec->name, "vexpand") ||
@@ -566,12 +641,12 @@ test_type (gconstpointer data)
continue;
/* Too many special cases involving -set properties */
- if (g_str_equal (g_type_name (pspec->owner_type), "GtkCellRendererText") ||
- g_str_equal (g_type_name (pspec->owner_type), "GtkTextTag"))
+ if (pspec->owner_type == GTK_TYPE_CELL_RENDERER_TEXT ||
+ pspec->owner_type == GTK_TYPE_TEXT_TAG)
continue;
/* Most things assume a model is set */
- if (g_str_equal (g_type_name (pspec->owner_type), "GtkComboBox"))
+ if (pspec->owner_type == GTK_TYPE_COMBO_BOX)
continue;
/* Can only be set on unmapped windows */
@@ -579,13 +654,6 @@ test_type (gconstpointer data)
g_str_equal (pspec->name, "type-hint"))
continue;
- /* Special restrictions on allowed values */
- if (pspec->owner_type == GTK_TYPE_COMBO_BOX &&
- (g_str_equal (pspec->name, "id-column") ||
- g_str_equal (pspec->name, "active-id") ||
- g_str_equal (pspec->name, "entry-text-column")))
- continue;
-
if (pspec->owner_type == GTK_TYPE_ENTRY_COMPLETION &&
g_str_equal (pspec->name, "text-column"))
continue;
@@ -681,14 +749,21 @@ test_type (gconstpointer data)
g_str_equal (pspec->name, "position"))
continue;
- /* This one is special */
- if (g_str_equal (pspec->name, "focus-widget"))
- continue;
-
if (pspec->owner_type == GTK_TYPE_TREE_VIEW_COLUMN &&
g_str_equal (pspec->name, "widget"))
continue;
+ /* Interface does not do explicit notify, so we can't fix it */
+ if (pspec->owner_type == GTK_TYPE_SCROLLABLE &&
+ (g_str_equal (pspec->name, "hadjustment") ||
+ g_str_equal (pspec->name, "vadjustment")))
+ continue;
+
+ /* deprecated, not getting fixed */
+ if (pspec->owner_type == GTK_TYPE_CELL_RENDERER_SPIN &&
+ g_str_equal (pspec->name, "adjustment"))
+ continue;
+
if (g_test_verbose ())
g_print ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);