[gtk/wip/layout-manager: 11/14] Port GtkSwitch to GtkLegacyLayout
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/layout-manager: 11/14] Port GtkSwitch to GtkLegacyLayout
- Date: Tue, 26 Mar 2019 00:13:01 +0000 (UTC)
commit 8cf06befc030dfe70f63b0c9e103f25f213f9dd3
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Mar 4 13:36:52 2019 +0000
Port GtkSwitch to GtkLegacyLayout
gtk/gtkswitch.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index eefa49c708..420927f13e 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -61,6 +61,7 @@
#include "gtkgizmoprivate.h"
#include "gtkintl.h"
#include "gtkimage.h"
+#include "gtklegacylayoutprivate.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtkprogresstrackerprivate.h"
@@ -319,10 +320,10 @@ gtk_switch_measure (GtkWidget *widget,
}
static void
-gtk_switch_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline)
+gtk_switch_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
{
GtkSwitch *self = GTK_SWITCH (widget);
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
@@ -544,9 +545,6 @@ gtk_switch_class_init (GtkSwitchClass *klass)
g_object_class_install_properties (gobject_class, LAST_PROP, switch_props);
- widget_class->measure = gtk_switch_measure;
- widget_class->size_allocate = gtk_switch_size_allocate;
-
klass->activate = gtk_switch_activate;
klass->state_set = state_set;
@@ -613,6 +611,7 @@ static void
gtk_switch_init (GtkSwitch *self)
{
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
+ GtkLayoutManager *layout;
GtkGesture *gesture;
gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
@@ -642,6 +641,11 @@ gtk_switch_init (GtkSwitch *self)
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
priv->pan_gesture = gesture;
+ layout = gtk_legacy_layout_new (NULL,
+ gtk_switch_measure,
+ gtk_switch_allocate);
+ gtk_widget_set_layout_manager (GTK_WIDGET (self), layout);
+ g_object_unref (layout);
priv->on_image = gtk_image_new_from_icon_name ("switch-on-symbolic");
gtk_widget_set_parent (priv->on_image, GTK_WIDGET (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]