[gtk+/wip/baedert/drawing: 268/306] spinbutton: Fix property notification
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 268/306] spinbutton: Fix property notification
- Date: Fri, 23 Jun 2017 20:19:27 +0000 (UTC)
commit 7100ad117a8a94584a7e149f80f6cf2a9c1de93b
Author: Timm Bäder <mail baedert org>
Date: Fri Jun 16 14:33:58 2017 +0200
spinbutton: Fix property notification
gtk/gtkspinbutton.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index c88b158..6039b37 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -620,13 +620,13 @@ gtk_spin_button_set_property (GObject *object,
gtk_spin_button_set_orientation (spin_button, g_value_get_enum (value));
break;
case PROP_WIDTH_CHARS:
- gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), g_value_get_int (value));
+ gtk_spin_button_set_width_chars (spin_button, g_value_get_int (value));
break;
case PROP_MAX_WIDTH_CHARS:
- gtk_entry_set_max_width_chars (GTK_ENTRY (priv->entry), g_value_get_int (value));
+ gtk_spin_button_set_max_width_chars (spin_button, g_value_get_int (value));
break;
case PROP_TEXT:
- gtk_entry_set_text (GTK_ENTRY (priv->entry), g_value_get_string (value));
+ gtk_spin_button_set_text (spin_button, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -673,13 +673,14 @@ gtk_spin_button_get_property (GObject *object,
g_value_set_enum (value, priv->orientation);
break;
case PROP_WIDTH_CHARS:
- g_value_set_int (value, gtk_entry_get_width_chars (GTK_ENTRY (priv->entry)));
+ g_value_set_int (value, gtk_spin_button_get_width_chars (spin_button));
break;
case PROP_MAX_WIDTH_CHARS:
- g_value_set_int (value, gtk_entry_get_max_width_chars (GTK_ENTRY (priv->entry)));
+ g_value_set_int (value, gtk_spin_button_get_max_width_chars (spin_button));
break;
case PROP_TEXT:
- g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (priv->entry)));
+ g_value_set_string (value, gtk_spin_button_get_text (spin_button));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2334,7 +2335,7 @@ gtk_spin_button_get_max_width_chars (GtkSpinButton *spin_button)
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), -1);
- return gtk_entry_get_width_chars (GTK_ENTRY (priv->entry));
+ return gtk_entry_get_max_width_chars (GTK_ENTRY (priv->entry));
}
/**
@@ -2356,8 +2357,11 @@ gtk_spin_button_set_max_width_chars (GtkSpinButton *spin_button,
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- gtk_entry_set_max_width_chars (GTK_ENTRY (priv->entry), max_width_chars);
- g_object_notify (G_OBJECT (spin_button), "max-width-chars");
+ if (max_width_chars != gtk_entry_get_max_width_chars (GTK_ENTRY (priv->entry)))
+ {
+ gtk_entry_set_max_width_chars (GTK_ENTRY (priv->entry), max_width_chars);
+ g_object_notify (G_OBJECT (spin_button), "max-width-chars");
+ }
}
/**
@@ -2400,6 +2404,9 @@ gtk_spin_button_set_width_chars (GtkSpinButton *spin_button,
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), width_chars);
- g_object_notify (G_OBJECT (spin_button), "width-chars");
+ if (width_chars != gtk_entry_get_width_chars (GTK_ENTRY (priv->entry)))
+ {
+ gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), width_chars);
+ g_object_notify (G_OBJECT (spin_button), "width-chars");
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]