[gtk/text: 31/34] spin button: Adapt to the new delegate setup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/text: 31/34] spin button: Adapt to the new delegate setup
- Date: Mon, 18 Feb 2019 02:54:55 +0000 (UTC)
commit db1aeea64ee36e203e5075d4d5fdde349226e0af
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Feb 17 21:50:44 2019 -0500
spin button: Adapt to the new delegate setup
gtk/gtkspinbutton.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 3143fa01c1..f63a4ab4cd 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -35,7 +35,6 @@
#include "gtkbutton.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkeditable.h"
-#include "gtkeditableprivate.h"
#include "gtkimage.h"
#include "gtktext.h"
#include "gtkeventcontrollerkey.h"
@@ -224,7 +223,7 @@ enum {
PROP_UPDATE_POLICY,
PROP_VALUE,
NUM_SPINBUTTON_PROPS,
- PROP_ORIENTATION,
+ PROP_ORIENTATION = NUM_SPINBUTTON_PROPS
};
/* Signals */
@@ -385,8 +384,8 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (gobject_class, NUM_SPINBUTTON_PROPS, spinbutton_props);
- gtk_editable_install_properties (gobject_class);
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
+ gtk_editable_install_properties (gobject_class, PROP_ORIENTATION + 1);
/**
* GtkSpinButton::input:
@@ -524,10 +523,19 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
gtk_widget_class_set_css_name (widget_class, I_("spinbutton"));
}
+static GtkEditable *
+gtk_spin_button_get_delegate (GtkEditable *editable)
+{
+ GtkSpinButton *spin_button = GTK_SPIN_BUTTON (editable);
+ GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
+
+ return GTK_EDITABLE (priv->entry);
+}
+
static void
gtk_spin_button_editable_init (GtkEditableInterface *iface)
{
- gtk_editable_delegate_iface_init (iface);
+ iface->get_delegate = gtk_spin_button_get_delegate;
iface->insert_text = gtk_spin_button_insert_text;
}
@@ -831,7 +839,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_widget_set_parent (priv->box, GTK_WIDGET (spin_button));
priv->entry = gtk_text_new ();
- gtk_editable_set_delegate (GTK_EDITABLE (spin_button), GTK_EDITABLE (priv->entry));
+ gtk_editable_init_delegate (GTK_EDITABLE (spin_button));
gtk_editable_set_width_chars (GTK_EDITABLE (priv->entry), 0);
gtk_editable_set_max_width_chars (GTK_EDITABLE (priv->entry), 0);
gtk_widget_set_hexpand (priv->entry, TRUE);
@@ -905,6 +913,8 @@ gtk_spin_button_finalize (GObject *object)
gtk_spin_button_unset_adjustment (spin_button);
+ gtk_editable_finish_delegate (GTK_EDITABLE (spin_button));
+
gtk_widget_unparent (priv->box);
G_OBJECT_CLASS (gtk_spin_button_parent_class)->finalize (object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]