diff --git a/NEWS b/NEWS index 7aba1b34d9..9f6ed93944 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ Overview of Changes in GTK 3.99.2 * GtkSearchEntry: - Don't handle forwarded events twice +* GtkPasswordEntry: + - Add an ::activate signal + * GtkTextView: - Fix dnd - Improve undo state tracking @@ -33,6 +36,9 @@ Overview of Changes in GTK 3.99.2 - Determine sample text based on font coverage - Allow filtering by language +* GtkStack: + - Add gtk_stack_add_child + * GtkVideo: - Make autoplay work @@ -44,6 +50,9 @@ Overview of Changes in GTK 3.99.2 - Tweak DND highlight color - Add spacing to .navigation-sidebar +* GDK: + - Add gdk_frame_clock_get_fps + * GSK: - Add radial gradient nodes @@ -66,8 +75,7 @@ Overview of Changes in GTK 3.99.2 - Make filter and sorter constructors return exact types - Rename GdkSurfaceState to GdkToplevelState - Remove GdkWaylandSurface::committed - - Add gdk_frame_clock_get_fps - - Add gtk_stack_add_child + - Make Wayland backend api take GdkToplevel * Demos: - Bug and crash fixes diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c index 6e5fa6281e..44302bba08 100644 --- a/gtk/gtkcolorchooserwidget.c +++ b/gtk/gtkcolorchooserwidget.c @@ -63,7 +63,6 @@ * GtkColorChooserWidget has a single CSS node with name colorchooser. */ -typedef struct _GtkColorChooserWidgetPrivate GtkColorChooserWidgetPrivate; typedef struct _GtkColorChooserWidgetClass GtkColorChooserWidgetClass; struct _GtkColorChooserWidget diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c index 90da05b8ec..6900900618 100644 --- a/gtk/gtkcolorscale.c +++ b/gtk/gtkcolorscale.c @@ -35,12 +35,19 @@ #include -typedef struct +struct _GtkColorScale { + GtkScale parent_instance; + GdkRGBA color; GtkColorScaleType type; GdkTexture *hue_texture; -} GtkColorScalePrivate; +}; + +typedef struct +{ + GtkScaleClass parent_class; +} GtkColorScaleClass; enum { @@ -59,7 +66,7 @@ static void click_action (GtkGestureClick *gesture, double y, GtkWidget *scale); -G_DEFINE_TYPE_WITH_PRIVATE (GtkColorScale, gtk_color_scale, GTK_TYPE_SCALE) +G_DEFINE_TYPE (GtkColorScale, gtk_color_scale, GTK_TYPE_SCALE) void gtk_color_scale_snapshot_trough (GtkColorScale *scale, @@ -67,20 +74,19 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale, int width, int height) { - GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (scale); GtkWidget *widget = GTK_WIDGET (scale); if (width <= 1 || height <= 1) return; - if (priv->hue_texture && - (width != gdk_texture_get_width (priv->hue_texture) || - height != gdk_texture_get_height (priv->hue_texture))) - g_clear_object (&priv->hue_texture); + if (scale->hue_texture && + (width != gdk_texture_get_width (scale->hue_texture) || + height != gdk_texture_get_height (scale->hue_texture))) + g_clear_object (&scale->hue_texture); - if (priv->type == GTK_COLOR_SCALE_HUE) + if (scale->type == GTK_COLOR_SCALE_HUE) { - if (!priv->hue_texture) + if (!scale->hue_texture) { GdkTexture *texture; int stride; @@ -114,14 +120,14 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale, bytes, stride); g_bytes_unref (bytes); - priv->hue_texture = texture; + scale->hue_texture = texture; } gtk_snapshot_append_texture (snapshot, - priv->hue_texture, + scale->hue_texture, &GRAPHENE_RECT_INIT(0, 0, width, height)); } - else if (priv->type == GTK_COLOR_SCALE_ALPHA) + else if (scale->type == GTK_COLOR_SCALE_ALPHA) { graphene_point_t start, end; const GdkRGBA *color; @@ -140,7 +146,7 @@ gtk_color_scale_snapshot_trough (GtkColorScale *scale, _gtk_color_chooser_snapshot_checkered_pattern (snapshot, width, height); - color = &priv->color; + color = &scale->color; gtk_snapshot_append_linear_gradient (snapshot, &GRAPHENE_RECT_INIT(0, 0, width, height), @@ -179,7 +185,6 @@ static void scale_constructed (GObject *object) { GtkColorScale *scale = GTK_COLOR_SCALE (object); - GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (scale); GtkEventController *controller; GtkShortcutTrigger *trigger; GtkShortcutAction *action; @@ -192,7 +197,7 @@ scale_constructed (GObject *object) shortcut = gtk_shortcut_new_with_arguments (trigger, action, "s", - priv->type == GTK_COLOR_SCALE_ALPHA + scale->type == GTK_COLOR_SCALE_ALPHA ? "a" : "h"); gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut); gtk_widget_add_controller (GTK_WIDGET (scale), controller); @@ -205,28 +210,19 @@ scale_get_property (GObject *object, GParamSpec *pspec) { GtkColorScale *scale = GTK_COLOR_SCALE (object); - GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (scale); switch (prop_id) { case PROP_SCALE_TYPE: - g_value_set_int (value, priv->type); + g_value_set_int (value, scale->type); break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } -static void -scale_set_type (GtkColorScale *scale, - GtkColorScaleType type) -{ - GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (scale); - - priv->type = type; -} - static void scale_set_property (GObject *object, guint prop_id, @@ -238,8 +234,9 @@ scale_set_property (GObject *object, switch (prop_id) { case PROP_SCALE_TYPE: - scale_set_type (scale, (GtkColorScaleType)g_value_get_int (value)); + scale->type = (GtkColorScaleType) g_value_get_int (value); break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -272,9 +269,9 @@ click_action (GtkGestureClick *gesture, static void scale_finalize (GObject *object) { - GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (GTK_COLOR_SCALE (object)); + GtkColorScale *scale = GTK_COLOR_SCALE (object); - g_clear_object (&priv->hue_texture); + g_clear_object (&scale->hue_texture); G_OBJECT_CLASS (gtk_color_scale_parent_class)->finalize (object); } @@ -293,16 +290,13 @@ gtk_color_scale_class_init (GtkColorScaleClass *class) g_param_spec_int ("scale-type", P_("Scale type"), P_("Scale type"), 0, 1, 0, GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); - } void gtk_color_scale_set_rgba (GtkColorScale *scale, const GdkRGBA *color) { - GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (scale); - - priv->color = *color; + scale->color = *color; gtk_widget_queue_draw (gtk_range_get_trough_widget (GTK_RANGE (scale))); } diff --git a/gtk/gtkcolorscaleprivate.h b/gtk/gtkcolorscaleprivate.h index d8ced03da6..47bf018702 100644 --- a/gtk/gtkcolorscaleprivate.h +++ b/gtk/gtkcolorscaleprivate.h @@ -24,30 +24,10 @@ G_BEGIN_DECLS #define GTK_TYPE_COLOR_SCALE (gtk_color_scale_get_type ()) #define GTK_COLOR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COLOR_SCALE, GtkColorScale)) -#define GTK_COLOR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_SCALE, GtkColorScaleClass)) #define GTK_IS_COLOR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COLOR_SCALE)) -#define GTK_IS_COLOR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_SCALE)) -#define GTK_COLOR_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COLOR_SCALE, GtkColorScaleClass)) -typedef struct _GtkColorScale GtkColorScale; -typedef struct _GtkColorScaleClass GtkColorScaleClass; - -struct _GtkColorScale -{ - GtkScale parent_instance; -}; - -struct _GtkColorScaleClass -{ - GtkScaleClass parent_class; - - /* Padding for future expansion */ - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); - void (*_gtk_reserved4) (void); -}; +typedef struct _GtkColorScale GtkColorScale; typedef enum { @@ -55,16 +35,16 @@ typedef enum GTK_COLOR_SCALE_ALPHA } GtkColorScaleType; -GType gtk_color_scale_get_type (void) G_GNUC_CONST; -GtkWidget * gtk_color_scale_new (GtkAdjustment *adjustment, - GtkColorScaleType type); -void gtk_color_scale_set_rgba (GtkColorScale *scale, - const GdkRGBA *color); +GType gtk_color_scale_get_type (void) G_GNUC_CONST; +GtkWidget * gtk_color_scale_new (GtkAdjustment *adjustment, + GtkColorScaleType type); +void gtk_color_scale_set_rgba (GtkColorScale *scale, + const GdkRGBA *color); -void gtk_color_scale_snapshot_trough (GtkColorScale *scale, - GtkSnapshot *snapshot, - int width, - int height); +void gtk_color_scale_snapshot_trough (GtkColorScale *scale, + GtkSnapshot *snapshot, + int width, + int height); G_END_DECLS diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c index d38a82ff57..af06d213d3 100644 --- a/gtk/gtkmagnifier.c +++ b/gtk/gtkmagnifier.c @@ -28,10 +28,10 @@ enum { PROP_MAGNIFICATION }; -typedef struct _GtkMagnifierPrivate GtkMagnifierPrivate; - -struct _GtkMagnifierPrivate +struct _GtkMagnifier { + GtkWidget parent_instance; + GdkPaintable *paintable; double magnification; int x; @@ -39,8 +39,12 @@ struct _GtkMagnifierPrivate gboolean resize; }; -G_DEFINE_TYPE_WITH_PRIVATE (GtkMagnifier, gtk_magnifier, - GTK_TYPE_WIDGET) +typedef struct +{ + GtkWidgetClass parent_class; +} GtkMagnifierClass; + +G_DEFINE_TYPE (GtkMagnifier, gtk_magnifier, GTK_TYPE_WIDGET) static void _gtk_magnifier_set_property (GObject *object, @@ -48,20 +52,22 @@ _gtk_magnifier_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { + GtkMagnifier *magnifier = GTK_MAGNIFIER (object); + switch (param_id) { case PROP_INSPECTED: - _gtk_magnifier_set_inspected (GTK_MAGNIFIER (object), - g_value_get_object (value)); + _gtk_magnifier_set_inspected (magnifier, g_value_get_object (value)); break; + case PROP_MAGNIFICATION: - _gtk_magnifier_set_magnification (GTK_MAGNIFIER (object), - g_value_get_double (value)); + _gtk_magnifier_set_magnification (magnifier, g_value_get_double (value)); break; + case PROP_RESIZE: - _gtk_magnifier_set_resize (GTK_MAGNIFIER (object), - g_value_get_boolean (value)); + _gtk_magnifier_set_resize (magnifier, g_value_get_boolean (value)); break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); } @@ -73,23 +79,22 @@ _gtk_magnifier_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GtkMagnifier *magnifier; - GtkMagnifierPrivate *priv; - - magnifier = GTK_MAGNIFIER (object); - priv = gtk_magnifier_get_instance_private (magnifier); + GtkMagnifier *magnifier = GTK_MAGNIFIER (object); switch (param_id) { case PROP_INSPECTED: - g_value_set_object (value, gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (priv->paintable))); + g_value_set_object (value, gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (magnifier->paintable))); break; + case PROP_MAGNIFICATION: - g_value_set_double (value, priv->magnification); + g_value_set_double (value, magnifier->magnification); break; + case PROP_RESIZE: - g_value_set_boolean (value, priv->resize); + g_value_set_boolean (value, magnifier->resize); break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); } @@ -100,28 +105,27 @@ gtk_magnifier_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) { GtkMagnifier *magnifier = GTK_MAGNIFIER (widget); - GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier); double width, height, paintable_width, paintable_height; - if (gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (priv->paintable)) == NULL) + if (gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (magnifier->paintable)) == NULL) return; width = gtk_widget_get_width (widget); height = gtk_widget_get_height (widget); - paintable_width = gdk_paintable_get_intrinsic_width (priv->paintable); - paintable_height = gdk_paintable_get_intrinsic_height (priv->paintable); + paintable_width = gdk_paintable_get_intrinsic_width (magnifier->paintable); + paintable_height = gdk_paintable_get_intrinsic_height (magnifier->paintable); if (paintable_width <= 0.0 || paintable_height <= 0.0) return; gtk_snapshot_save (snapshot); - if (!priv->resize) + if (!magnifier->resize) gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2)); - gtk_snapshot_scale (snapshot, priv->magnification, priv->magnification); + gtk_snapshot_scale (snapshot, magnifier->magnification, magnifier->magnification); gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT ( - - CLAMP (priv->x, 0, paintable_width), - - CLAMP (priv->y, 0, paintable_height))); + - CLAMP (magnifier->x, 0, paintable_width), + - CLAMP (magnifier->y, 0, paintable_height))); - gdk_paintable_snapshot (priv->paintable, snapshot, paintable_width, paintable_height); + gdk_paintable_snapshot (magnifier->paintable, snapshot, paintable_width, paintable_height); gtk_snapshot_restore (snapshot); } @@ -135,15 +139,14 @@ gtk_magnifier_measure (GtkWidget *widget, int *natural_baseline) { GtkMagnifier *magnifier = GTK_MAGNIFIER (widget); - GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier); int size; - if (priv->resize) + if (magnifier->resize) { if (orientation == GTK_ORIENTATION_HORIZONTAL) - size = priv->magnification * gdk_paintable_get_intrinsic_width (priv->paintable); + size = magnifier->magnification * gdk_paintable_get_intrinsic_width (magnifier->paintable); else - size = priv->magnification * gdk_paintable_get_intrinsic_height (priv->paintable); + size = magnifier->magnification * gdk_paintable_get_intrinsic_height (magnifier->paintable); } else size = 0; @@ -155,13 +158,12 @@ gtk_magnifier_measure (GtkWidget *widget, static void gtk_magnifier_dispose (GObject *object) { - GtkMagnifier *self = GTK_MAGNIFIER (object); - GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (self); + GtkMagnifier *magnifier = GTK_MAGNIFIER (object); - if (priv->paintable) - _gtk_magnifier_set_inspected (self, NULL); + if (magnifier->paintable) + _gtk_magnifier_set_inspected (magnifier, NULL); - g_clear_object (&priv->paintable); + g_clear_object (&magnifier->paintable); G_OBJECT_CLASS (gtk_magnifier_parent_class)->dispose (object); } @@ -203,18 +205,17 @@ gtk_magnifier_class_init (GtkMagnifierClass *klass) } static void -gtk_magnifier_init (GtkMagnifier *self) +gtk_magnifier_init (GtkMagnifier *magnifier) { - GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (self); - GtkWidget *widget = GTK_WIDGET (self); + GtkWidget *widget = GTK_WIDGET (magnifier); gtk_widget_set_overflow (widget, GTK_OVERFLOW_HIDDEN); - priv->magnification = 1; - priv->resize = FALSE; - priv->paintable = gtk_widget_paintable_new (NULL); - g_signal_connect_swapped (priv->paintable, "invalidate-contents", G_CALLBACK (gtk_widget_queue_draw), self); - g_signal_connect_swapped (priv->paintable, "invalidate-size", G_CALLBACK (gtk_widget_queue_resize), self); + magnifier->magnification = 1; + magnifier->resize = FALSE; + magnifier->paintable = gtk_widget_paintable_new (NULL); + g_signal_connect_swapped (magnifier->paintable, "invalidate-contents", G_CALLBACK (gtk_widget_queue_draw), magnifier); + g_signal_connect_swapped (magnifier->paintable, "invalidate-size", G_CALLBACK (gtk_widget_queue_resize), magnifier); } GtkWidget * @@ -230,23 +231,19 @@ _gtk_magnifier_new (GtkWidget *inspected) GtkWidget * _gtk_magnifier_get_inspected (GtkMagnifier *magnifier) { - GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier); - g_return_val_if_fail (GTK_IS_MAGNIFIER (magnifier), NULL); - return gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (priv->paintable)); + return gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (magnifier->paintable)); } void _gtk_magnifier_set_inspected (GtkMagnifier *magnifier, GtkWidget *inspected) { - GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier); - g_return_if_fail (GTK_IS_MAGNIFIER (magnifier)); g_return_if_fail (inspected == NULL || GTK_IS_WIDGET (inspected)); - gtk_widget_paintable_set_widget (GTK_WIDGET_PAINTABLE (priv->paintable), inspected); + gtk_widget_paintable_set_widget (GTK_WIDGET_PAINTABLE (magnifier->paintable), inspected); g_object_notify (G_OBJECT (magnifier), "inspected"); } @@ -256,17 +253,13 @@ _gtk_magnifier_set_coords (GtkMagnifier *magnifier, double x, double y) { - GtkMagnifierPrivate *priv; - g_return_if_fail (GTK_IS_MAGNIFIER (magnifier)); - priv = gtk_magnifier_get_instance_private (magnifier); - - if (priv->x == x && priv->y == y) + if (magnifier->x == x && magnifier->y == y) return; - priv->x = x; - priv->y = y; + magnifier->x = x; + magnifier->y = y; if (gtk_widget_is_visible (GTK_WIDGET (magnifier))) gtk_widget_queue_draw (GTK_WIDGET (magnifier)); @@ -277,36 +270,28 @@ _gtk_magnifier_get_coords (GtkMagnifier *magnifier, double *x, double *y) { - GtkMagnifierPrivate *priv; - g_return_if_fail (GTK_IS_MAGNIFIER (magnifier)); - priv = gtk_magnifier_get_instance_private (magnifier); - if (x) - *x = priv->x; + *x = magnifier->x; if (y) - *y = priv->y; + *y = magnifier->y; } void _gtk_magnifier_set_magnification (GtkMagnifier *magnifier, double magnification) { - GtkMagnifierPrivate *priv; - g_return_if_fail (GTK_IS_MAGNIFIER (magnifier)); - priv = gtk_magnifier_get_instance_private (magnifier); - - if (priv->magnification == magnification) + if (magnifier->magnification == magnification) return; - priv->magnification = magnification; + magnifier->magnification = magnification; g_object_notify (G_OBJECT (magnifier), "magnification"); - if (priv->resize) + if (magnifier->resize) gtk_widget_queue_resize (GTK_WIDGET (magnifier)); if (gtk_widget_is_visible (GTK_WIDGET (magnifier))) @@ -316,29 +301,21 @@ _gtk_magnifier_set_magnification (GtkMagnifier *magnifier, double _gtk_magnifier_get_magnification (GtkMagnifier *magnifier) { - GtkMagnifierPrivate *priv; - g_return_val_if_fail (GTK_IS_MAGNIFIER (magnifier), 1); - priv = gtk_magnifier_get_instance_private (magnifier); - - return priv->magnification; + return magnifier->magnification; } void _gtk_magnifier_set_resize (GtkMagnifier *magnifier, gboolean resize) { - GtkMagnifierPrivate *priv; - g_return_if_fail (GTK_IS_MAGNIFIER (magnifier)); - priv = gtk_magnifier_get_instance_private (magnifier); - - if (priv->resize == resize) + if (magnifier->resize == resize) return; - priv->resize = resize; + magnifier->resize = resize; gtk_widget_queue_resize (GTK_WIDGET (magnifier)); } @@ -346,11 +323,7 @@ _gtk_magnifier_set_resize (GtkMagnifier *magnifier, gboolean _gtk_magnifier_get_resize (GtkMagnifier *magnifier) { - GtkMagnifierPrivate *priv; - g_return_val_if_fail (GTK_IS_MAGNIFIER (magnifier), FALSE); - priv = gtk_magnifier_get_instance_private (magnifier); - - return priv->resize; + return magnifier->resize; } diff --git a/gtk/gtkmagnifierprivate.h b/gtk/gtkmagnifierprivate.h index 8d46cdcdd8..77fee2cc98 100644 --- a/gtk/gtkmagnifierprivate.h +++ b/gtk/gtkmagnifierprivate.h @@ -22,23 +22,9 @@ G_BEGIN_DECLS #define GTK_TYPE_MAGNIFIER (gtk_magnifier_get_type ()) #define GTK_MAGNIFIER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_MAGNIFIER, GtkMagnifier)) -#define GTK_MAGNIFIER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_MAGNIFIER, GtkMagnifierClass)) #define GTK_IS_MAGNIFIER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_MAGNIFIER)) -#define GTK_IS_MAGNIFIER_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE ((o), GTK_TYPE_MAGNIFIER)) -#define GTK_MAGNIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_MAGNIFIER, GtkMagnifierClass)) typedef struct _GtkMagnifier GtkMagnifier; -typedef struct _GtkMagnifierClass GtkMagnifierClass; - -struct _GtkMagnifier -{ - GtkWidget parent_instance; -}; - -struct _GtkMagnifierClass -{ - GtkWidgetClass parent_class; -}; GType gtk_magnifier_get_type (void) G_GNUC_CONST; diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index b43e508015..716228954c 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -72,27 +72,10 @@ * when the child of a #GtkRevealer widget is shown or hidden. */ -enum { - PROP_0, - PROP_TRANSITION_TYPE, - PROP_TRANSITION_DURATION, - PROP_REVEAL_CHILD, - PROP_CHILD_REVEALED, - PROP_CHILD, - LAST_PROP -}; - -typedef struct _GtkRevealerClass GtkRevealerClass; - -struct _GtkRevealer { +struct _GtkRevealer +{ GtkWidget parent_instance; -}; -struct _GtkRevealerClass { - GtkWidgetClass parent_class; -}; - -typedef struct { GtkWidget *child; GtkRevealerTransitionType transition_type; @@ -104,7 +87,22 @@ typedef struct { guint tick_id; GtkProgressTracker tracker; -} GtkRevealerPrivate; +}; + +typedef struct +{ + GtkWidgetClass parent_class; +} GtkRevealerClass; + +enum { + PROP_0, + PROP_TRANSITION_TYPE, + PROP_TRANSITION_DURATION, + PROP_REVEAL_CHILD, + PROP_CHILD_REVEALED, + PROP_CHILD, + LAST_PROP +}; static GParamSpec *props[LAST_PROP] = { NULL, }; @@ -126,7 +124,6 @@ static void gtk_revealer_set_position (GtkRevealer *revealer, static void gtk_revealer_buildable_iface_init (GtkBuildableIface *iface); G_DEFINE_TYPE_WITH_CODE (GtkRevealer, gtk_revealer, GTK_TYPE_WIDGET, - G_ADD_PRIVATE (GtkRevealer) G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_revealer_buildable_iface_init)) @@ -155,12 +152,10 @@ gtk_revealer_buildable_iface_init (GtkBuildableIface *iface) static void gtk_revealer_init (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - - priv->transition_type = GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN; - priv->transition_duration = 250; - priv->current_pos = 0.0; - priv->target_pos = 0.0; + revealer->transition_type = GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN; + revealer->transition_duration = 250; + revealer->current_pos = 0.0; + revealer->target_pos = 0.0; gtk_widget_set_overflow (GTK_WIDGET (revealer), GTK_OVERFLOW_HIDDEN); } @@ -169,9 +164,8 @@ static void gtk_revealer_dispose (GObject *obj) { GtkRevealer *revealer = GTK_REVEALER (obj); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_clear_pointer (&priv->child, gtk_widget_unparent); + g_clear_pointer (&revealer->child, gtk_widget_unparent); G_OBJECT_CLASS (gtk_revealer_parent_class)->dispose (obj); } @@ -180,11 +174,10 @@ static void gtk_revealer_finalize (GObject *obj) { GtkRevealer *revealer = GTK_REVEALER (obj); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - if (priv->tick_id != 0) - gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id); - priv->tick_id = 0; + if (revealer->tick_id != 0) + gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), revealer->tick_id); + revealer->tick_id = 0; G_OBJECT_CLASS (gtk_revealer_parent_class)->finalize (obj); } @@ -252,18 +245,17 @@ static void gtk_revealer_unmap (GtkWidget *widget) { GtkRevealer *revealer = GTK_REVEALER (widget); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); GTK_WIDGET_CLASS (gtk_revealer_parent_class)->unmap (widget); /* Finish & stop the animation */ - if (priv->current_pos != priv->target_pos) - gtk_revealer_set_position (revealer, priv->target_pos); + if (revealer->current_pos != revealer->target_pos) + gtk_revealer_set_position (revealer, revealer->target_pos); - if (priv->tick_id != 0) + if (revealer->tick_id != 0) { - gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id); - priv->tick_id = 0; + gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), revealer->tick_id); + revealer->tick_id = 0; } } @@ -273,12 +265,11 @@ gtk_revealer_compute_expand (GtkWidget *widget, gboolean *vexpand) { GtkRevealer *revealer = GTK_REVEALER (widget); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - if (priv->child) + if (revealer->child) { - *hexpand = gtk_widget_compute_expand (priv->child, GTK_ORIENTATION_HORIZONTAL); - *vexpand = gtk_widget_compute_expand (priv->child, GTK_ORIENTATION_VERTICAL); + *hexpand = gtk_widget_compute_expand (revealer->child, GTK_ORIENTATION_HORIZONTAL); + *vexpand = gtk_widget_compute_expand (revealer->child, GTK_ORIENTATION_VERTICAL); } else { @@ -291,10 +282,9 @@ static GtkSizeRequestMode gtk_revealer_get_request_mode (GtkWidget *widget) { GtkRevealer *revealer = GTK_REVEALER (widget); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - if (priv->child) - return gtk_widget_get_request_mode (priv->child); + if (revealer->child) + return gtk_widget_get_request_mode (revealer->child); else return GTK_SIZE_REQUEST_CONSTANT_SIZE; } @@ -374,56 +364,52 @@ gtk_revealer_new (void) static GtkRevealerTransitionType effective_transition (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - if (gtk_widget_get_direction (GTK_WIDGET (revealer)) == GTK_TEXT_DIR_RTL) { - if (priv->transition_type == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT) + if (revealer->transition_type == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT) return GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT; - else if (priv->transition_type == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT) + else if (revealer->transition_type == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT) return GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT; - if (priv->transition_type == GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT) + if (revealer->transition_type == GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT) return GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT; - else if (priv->transition_type == GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT) + else if (revealer->transition_type == GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT) return GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT; } - return priv->transition_type; + return revealer->transition_type; } static double get_child_size_scale (GtkRevealer *revealer, GtkOrientation orientation) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - switch (effective_transition (revealer)) { case GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT: case GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT: if (orientation == GTK_ORIENTATION_HORIZONTAL) - return priv->current_pos; + return revealer->current_pos; else return 1.0; case GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN: case GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP: if (orientation == GTK_ORIENTATION_VERTICAL) - return priv->current_pos; + return revealer->current_pos; else return 1.0; case GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT: case GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT: if (orientation == GTK_ORIENTATION_HORIZONTAL) - return sin (G_PI * priv->current_pos / 2); + return sin (G_PI * revealer->current_pos / 2); else return 1.0; case GTK_REVEALER_TRANSITION_TYPE_SWING_DOWN: case GTK_REVEALER_TRANSITION_TYPE_SWING_UP: if (orientation == GTK_ORIENTATION_VERTICAL) - return sin (G_PI * priv->current_pos / 2); + return sin (G_PI * revealer->current_pos / 2); else return 1.0; @@ -441,17 +427,16 @@ gtk_revealer_size_allocate (GtkWidget *widget, int baseline) { GtkRevealer *revealer = GTK_REVEALER (widget); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); GskTransform *transform; double hscale, vscale; int child_width, child_height; - if (priv->child == NULL || !gtk_widget_get_visible (priv->child)) + if (revealer->child == NULL || !gtk_widget_get_visible (revealer->child)) return; - if (priv->current_pos >= 1.0) + if (revealer->current_pos >= 1.0) { - gtk_widget_allocate (priv->child, width, height, baseline, NULL); + gtk_widget_allocate (revealer->child, width, height, baseline, NULL); return; } @@ -493,7 +478,7 @@ gtk_revealer_size_allocate (GtkWidget *widget, { int min, nat; g_assert (vscale == 1.0); - gtk_widget_measure (priv->child, GTK_ORIENTATION_HORIZONTAL, height, &min, &nat, NULL, NULL); + gtk_widget_measure (revealer->child, GTK_ORIENTATION_HORIZONTAL, height, &min, &nat, NULL, NULL); if (ceil (nat * hscale) == width) child_width = nat; else if (ceil (min * hscale) == width) @@ -506,7 +491,7 @@ gtk_revealer_size_allocate (GtkWidget *widget, { int min, nat; child_width = width; - gtk_widget_measure (priv->child, GTK_ORIENTATION_VERTICAL, width, &min, &nat, NULL, NULL); + gtk_widget_measure (revealer->child, GTK_ORIENTATION_VERTICAL, width, &min, &nat, NULL, NULL); if (ceil (nat * vscale) == height) child_height = nat; else if (ceil (min * vscale) == height) @@ -534,28 +519,28 @@ gtk_revealer_size_allocate (GtkWidget *widget, case GTK_REVEALER_TRANSITION_TYPE_SWING_LEFT: transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (width, height / 2)); transform = gsk_transform_perspective (transform, 2 * MAX (width, height)); - transform = gsk_transform_rotate_3d (transform, -90 * (1.0 - priv->current_pos), graphene_vec3_y_axis ()); + transform = gsk_transform_rotate_3d (transform, -90 * (1.0 - revealer->current_pos), graphene_vec3_y_axis ()); transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (- child_width, - child_height / 2)); break; case GTK_REVEALER_TRANSITION_TYPE_SWING_RIGHT: transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (0, height / 2)); transform = gsk_transform_perspective (transform, 2 * MAX (width, height)); - transform = gsk_transform_rotate_3d (transform, 90 * (1.0 - priv->current_pos), graphene_vec3_y_axis ()); + transform = gsk_transform_rotate_3d (transform, 90 * (1.0 - revealer->current_pos), graphene_vec3_y_axis ()); transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (0, - child_height / 2)); break; case GTK_REVEALER_TRANSITION_TYPE_SWING_DOWN: transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (width / 2, 0)); transform = gsk_transform_perspective (transform, 2 * MAX (width, height)); - transform = gsk_transform_rotate_3d (transform, -90 * (1.0 - priv->current_pos), graphene_vec3_x_axis ()); + transform = gsk_transform_rotate_3d (transform, -90 * (1.0 - revealer->current_pos), graphene_vec3_x_axis ()); transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (- child_width / 2, 0)); break; case GTK_REVEALER_TRANSITION_TYPE_SWING_UP: transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (width / 2, height)); transform = gsk_transform_perspective (transform, 2 * MAX (width, height)); - transform = gsk_transform_rotate_3d (transform, 90 * (1.0 - priv->current_pos), graphene_vec3_x_axis ()); + transform = gsk_transform_rotate_3d (transform, 90 * (1.0 - revealer->current_pos), graphene_vec3_x_axis ()); transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (- child_width / 2, - child_height)); break; @@ -567,25 +552,24 @@ gtk_revealer_size_allocate (GtkWidget *widget, break; } - gtk_widget_allocate (priv->child, child_width, child_height, -1, transform); + gtk_widget_allocate (revealer->child, child_width, child_height, -1, transform); } static void gtk_revealer_set_position (GtkRevealer *revealer, double pos) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); gboolean new_visible; GtkRevealerTransitionType transition; - priv->current_pos = pos; + revealer->current_pos = pos; - new_visible = priv->current_pos != 0.0; + new_visible = revealer->current_pos != 0.0; - if (priv->child != NULL && - new_visible != gtk_widget_get_child_visible (priv->child)) + if (revealer->child != NULL && + new_visible != gtk_widget_get_child_visible (revealer->child)) { - gtk_widget_set_child_visible (priv->child, new_visible); + gtk_widget_set_child_visible (revealer->child, new_visible); gtk_widget_queue_resize (GTK_WIDGET (revealer)); } @@ -596,7 +580,7 @@ gtk_revealer_set_position (GtkRevealer *revealer, } else if (transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE) { - gtk_widget_set_opacity (GTK_WIDGET (revealer), priv->current_pos); + gtk_widget_set_opacity (GTK_WIDGET (revealer), revealer->current_pos); gtk_widget_queue_draw (GTK_WIDGET (revealer)); } else @@ -604,7 +588,7 @@ gtk_revealer_set_position (GtkRevealer *revealer, gtk_widget_queue_resize (GTK_WIDGET (revealer)); } - if (priv->current_pos == priv->target_pos) + if (revealer->current_pos == revealer->target_pos) g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_CHILD_REVEALED]); } @@ -614,18 +598,17 @@ gtk_revealer_animate_cb (GtkWidget *widget, gpointer user_data) { GtkRevealer *revealer = GTK_REVEALER (widget); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); double ease; - gtk_progress_tracker_advance_frame (&priv->tracker, + gtk_progress_tracker_advance_frame (&revealer->tracker, gdk_frame_clock_get_frame_time (frame_clock)); - ease = gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE); + ease = gtk_progress_tracker_get_ease_out_cubic (&revealer->tracker, FALSE); gtk_revealer_set_position (revealer, - priv->source_pos + (ease * (priv->target_pos - priv->source_pos))); + revealer->source_pos + (ease * (revealer->target_pos - revealer->source_pos))); - if (gtk_progress_tracker_get_state (&priv->tracker) == GTK_PROGRESS_STATE_AFTER) + if (gtk_progress_tracker_get_state (&revealer->tracker) == GTK_PROGRESS_STATE_AFTER) { - priv->tick_id = 0; + revealer->tick_id = 0; return FALSE; } @@ -636,28 +619,27 @@ static void gtk_revealer_start_animation (GtkRevealer *revealer, double target) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); GtkWidget *widget = GTK_WIDGET (revealer); GtkRevealerTransitionType transition; - if (priv->target_pos == target) + if (revealer->target_pos == target) return; - priv->target_pos = target; + revealer->target_pos = target; g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_REVEAL_CHILD]); transition = effective_transition (revealer); if (gtk_widget_get_mapped (widget) && - priv->transition_duration != 0 && + revealer->transition_duration != 0 && transition != GTK_REVEALER_TRANSITION_TYPE_NONE && gtk_settings_get_enable_animations (gtk_widget_get_settings (widget))) { - priv->source_pos = priv->current_pos; - if (priv->tick_id == 0) - priv->tick_id = + revealer->source_pos = revealer->current_pos; + if (revealer->tick_id == 0) + revealer->tick_id = gtk_widget_add_tick_callback (widget, gtk_revealer_animate_cb, revealer, NULL); - gtk_progress_tracker_start (&priv->tracker, - priv->transition_duration * 1000, + gtk_progress_tracker_start (&revealer->tracker, + revealer->transition_duration * 1000, 0, 1.0); } @@ -706,11 +688,9 @@ gtk_revealer_set_reveal_child (GtkRevealer *revealer, gboolean gtk_revealer_get_reveal_child (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_val_if_fail (GTK_IS_REVEALER (revealer), FALSE); - return priv->target_pos != 0.0; + return revealer->target_pos != 0.0; } /** @@ -725,8 +705,7 @@ gtk_revealer_get_reveal_child (GtkRevealer *revealer) gboolean gtk_revealer_get_child_revealed (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - gboolean animation_finished = (priv->target_pos == priv->current_pos); + gboolean animation_finished = (revealer->target_pos == revealer->current_pos); gboolean reveal_child = gtk_revealer_get_reveal_child (revealer); if (animation_finished) @@ -744,11 +723,10 @@ gtk_revealer_measure (GtkWidget *widget, int *minimum_baseline, int *natural_baseline) { - GtkRevealer *self = GTK_REVEALER (widget); - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (self); + GtkRevealer *revealer = GTK_REVEALER (widget); double scale; - scale = get_child_size_scale (self, OPPOSITE_ORIENTATION (orientation)); + scale = get_child_size_scale (revealer, OPPOSITE_ORIENTATION (orientation)); if (for_size >= 0) { @@ -758,9 +736,9 @@ gtk_revealer_measure (GtkWidget *widget, for_size = MIN (G_MAXINT, ceil (for_size / scale)); } - if (priv->child != NULL && _gtk_widget_get_visible (priv->child)) + if (revealer->child != NULL && _gtk_widget_get_visible (revealer->child)) { - gtk_widget_measure (priv->child, + gtk_widget_measure (revealer->child, orientation, for_size, minimum, natural, @@ -772,7 +750,7 @@ gtk_revealer_measure (GtkWidget *widget, *natural = 0; } - scale = get_child_size_scale (self, orientation); + scale = get_child_size_scale (revealer, orientation); *minimum = ceil (*minimum * scale); *natural = ceil (*natural * scale); } @@ -789,11 +767,9 @@ gtk_revealer_measure (GtkWidget *widget, guint gtk_revealer_get_transition_duration (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_val_if_fail (GTK_IS_REVEALER (revealer), 0); - return priv->transition_duration; + return revealer->transition_duration; } /** @@ -807,14 +783,12 @@ void gtk_revealer_set_transition_duration (GtkRevealer *revealer, guint value) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_if_fail (GTK_IS_REVEALER (revealer)); - if (priv->transition_duration == value) + if (revealer->transition_duration == value) return; - priv->transition_duration = value; + revealer->transition_duration = value; g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_TRANSITION_DURATION]); } @@ -830,11 +804,9 @@ gtk_revealer_set_transition_duration (GtkRevealer *revealer, GtkRevealerTransitionType gtk_revealer_get_transition_type (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_val_if_fail (GTK_IS_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE); - return priv->transition_type; + return revealer->transition_type; } /** @@ -850,14 +822,12 @@ void gtk_revealer_set_transition_type (GtkRevealer *revealer, GtkRevealerTransitionType transition) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_if_fail (GTK_IS_REVEALER (revealer)); - if (priv->transition_type == transition) + if (revealer->transition_type == transition) return; - priv->transition_type = transition; + revealer->transition_type = transition; gtk_widget_queue_resize (GTK_WIDGET (revealer)); g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_TRANSITION_TYPE]); } @@ -873,18 +843,16 @@ void gtk_revealer_set_child (GtkRevealer *revealer, GtkWidget *child) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_if_fail (GTK_IS_REVEALER (revealer)); g_return_if_fail (child == NULL || GTK_IS_WIDGET (child)); - g_clear_pointer (&priv->child, gtk_widget_unparent); + g_clear_pointer (&revealer->child, gtk_widget_unparent); if (child) { gtk_widget_set_parent (child, GTK_WIDGET (revealer)); - gtk_widget_set_child_visible (child, priv->current_pos != 0.0); - priv->child = child; + gtk_widget_set_child_visible (child, revealer->current_pos != 0.0); + revealer->child = child; } g_object_notify_by_pspec (G_OBJECT (revealer), props[PROP_CHILD]); @@ -901,9 +869,7 @@ gtk_revealer_set_child (GtkRevealer *revealer, GtkWidget * gtk_revealer_get_child (GtkRevealer *revealer) { - GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer); - g_return_val_if_fail (GTK_IS_REVEALER (revealer), NULL); - return priv->child; + return revealer->child; } diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c index e373c5d1ad..2734fb721a 100644 --- a/gtk/gtkshortcutswindow.c +++ b/gtk/gtkshortcutswindow.c @@ -91,16 +91,10 @@ * The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/master/demos/gtk-demo/shortcuts-builder.ui). */ -struct _GtkShortcutsWindowClass +struct _GtkShortcutsWindow { - GtkWindowClass parent_class; + GtkWindow parent_instance; - void (*close) (GtkShortcutsWindow *self); - void (*search) (GtkShortcutsWindow *self); -}; - -typedef struct -{ GHashTable *keywords; char *initial_section; char *last_section_name; @@ -123,7 +117,15 @@ typedef struct GtkWindow *window; gulong keys_changed_id; -} GtkShortcutsWindowPrivate; +}; + +typedef struct +{ + GtkWindowClass parent_class; + + void (*close) (GtkShortcutsWindow *self); + void (*search) (GtkShortcutsWindow *self); +} GtkShortcutsWindowClass; typedef struct { @@ -138,7 +140,6 @@ static void gtk_shortcuts_window_buildable_iface_init (GtkBuildableIface *iface) G_DEFINE_TYPE_WITH_CODE (GtkShortcutsWindow, gtk_shortcuts_window, GTK_TYPE_WINDOW, - G_ADD_PRIVATE (GtkShortcutsWindow) G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_shortcuts_window_buildable_iface_init)) @@ -180,30 +181,29 @@ more_than_three_children (GtkWidget *widget) static void update_title_stack (GtkShortcutsWindow *self) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkWidget *visible_child; - visible_child = gtk_stack_get_visible_child (priv->stack); + visible_child = gtk_stack_get_visible_child (self->stack); if (GTK_IS_SHORTCUTS_SECTION (visible_child)) { - if (more_than_three_children (GTK_WIDGET (priv->stack))) + if (more_than_three_children (GTK_WIDGET (self->stack))) { char *title; - gtk_stack_set_visible_child_name (priv->title_stack, "sections"); + gtk_stack_set_visible_child_name (self->title_stack, "sections"); g_object_get (visible_child, "title", &title, NULL); - gtk_menu_button_set_label (priv->menu_button, title); + gtk_menu_button_set_label (self->menu_button, title); g_free (title); } else { - gtk_stack_set_visible_child_name (priv->title_stack, "title"); + gtk_stack_set_visible_child_name (self->title_stack, "title"); } } else if (visible_child != NULL) { - gtk_stack_set_visible_child_name (priv->title_stack, "search"); + gtk_stack_set_visible_child_name (self->title_stack, "search"); } } @@ -211,7 +211,6 @@ static void gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data) { GtkShortcutsWindow *self = data; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkWidget *item; char *accelerator = NULL; char *title = NULL; @@ -248,7 +247,7 @@ gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data) g_type_class_unref (class); - if (g_hash_table_contains (priv->search_items_hash, hash_key)) + if (g_hash_table_contains (self->search_items_hash, hash_key)) { g_free (hash_key); g_free (title); @@ -256,15 +255,15 @@ gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data) return; } - g_hash_table_insert (priv->search_items_hash, hash_key, GINT_TO_POINTER (1)); + g_hash_table_insert (self->search_items_hash, hash_key, GINT_TO_POINTER (1)); item = g_object_new (GTK_TYPE_SHORTCUTS_SHORTCUT, "accelerator", accelerator, "title", title, "direction", direction, "shortcut-type", shortcut_type, - "accel-size-group", priv->search_image_group, - "title-size-group", priv->search_text_group, + "accel-size-group", self->search_image_group, + "title-size-group", self->search_text_group, "action-name", action_name, NULL); if (icon_set) @@ -282,11 +281,11 @@ gtk_shortcuts_window_add_search_item (GtkWidget *child, gpointer data) str = g_strdup_printf ("%s %s", accelerator, title); keywords = g_utf8_strdown (str, -1); - g_hash_table_insert (priv->keywords, item, keywords); + g_hash_table_insert (self->keywords, item, keywords); if (shortcut_type == GTK_SHORTCUT_ACCELERATOR) - gtk_box_append (GTK_BOX (priv->search_shortcuts), item); + gtk_box_append (GTK_BOX (self->search_shortcuts), item); else - gtk_box_append (GTK_BOX (priv->search_gestures), item); + gtk_box_append (GTK_BOX (self->search_gestures), item); g_free (title); g_free (accelerator); @@ -310,14 +309,13 @@ section_notify_cb (GObject *section, gpointer data) { GtkShortcutsWindow *self = data; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); if (strcmp (pspec->name, "section-name") == 0) { char *name; g_object_get (section, "section-name", &name, NULL); - g_object_set (gtk_stack_get_page (priv->stack, GTK_WIDGET (section)), "name", name, NULL); + g_object_set (gtk_stack_get_page (self->stack, GTK_WIDGET (section)), "name", name, NULL); g_free (name); } else if (strcmp (pspec->name, "title") == 0) @@ -336,7 +334,6 @@ static void gtk_shortcuts_window_add_section (GtkShortcutsWindow *self, GtkShortcutsSection *section) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkListBoxRow *row; char *title; char *name; @@ -359,12 +356,12 @@ gtk_shortcuts_window_add_section (GtkShortcutsWindow *self, if (name == NULL) name = g_strdup ("shortcuts"); - gtk_stack_add_titled (priv->stack, GTK_WIDGET (section), name, title); + gtk_stack_add_titled (self->stack, GTK_WIDGET (section), name, title); - visible_section = gtk_stack_get_visible_child_name (priv->stack); + visible_section = gtk_stack_get_visible_child_name (self->stack); if (strcmp (visible_section, "internal-search") == 0 || - (priv->initial_section && strcmp (priv->initial_section, visible_section) == 0)) - gtk_stack_set_visible_child (priv->stack, GTK_WIDGET (section)); + (self->initial_section && strcmp (self->initial_section, visible_section) == 0)) + gtk_stack_set_visible_child (self->stack, GTK_WIDGET (section)); row = g_object_new (GTK_TYPE_LIST_BOX_ROW, NULL); @@ -379,7 +376,7 @@ gtk_shortcuts_window_add_section (GtkShortcutsWindow *self, NULL); g_object_set_data (G_OBJECT (section), "gtk-shortcuts-title", label); gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), GTK_WIDGET (label)); - gtk_list_box_insert (GTK_LIST_BOX (priv->list_box), GTK_WIDGET (row), -1); + gtk_list_box_insert (GTK_LIST_BOX (self->list_box), GTK_WIDGET (row), -1); update_title_stack (self); @@ -414,18 +411,17 @@ static void gtk_shortcuts_window_set_view_name (GtkShortcutsWindow *self, const char *view_name) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkWidget *section; - g_free (priv->view_name); - priv->view_name = g_strdup (view_name); + g_free (self->view_name); + self->view_name = g_strdup (view_name); - for (section = gtk_widget_get_first_child (GTK_WIDGET (priv->stack)); + for (section = gtk_widget_get_first_child (GTK_WIDGET (self->stack)); section != NULL; section = gtk_widget_get_next_sibling (section)) { if (GTK_IS_SHORTCUTS_SECTION (section)) - g_object_set (section, "view-name", priv->view_name, NULL); + g_object_set (section, "view-name", self->view_name, NULL); } } @@ -433,16 +429,15 @@ static void gtk_shortcuts_window_set_section_name (GtkShortcutsWindow *self, const char *section_name) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkWidget *section = NULL; - g_free (priv->initial_section); - priv->initial_section = g_strdup (section_name); + g_free (self->initial_section); + self->initial_section = g_strdup (section_name); if (section_name) - section = gtk_stack_get_child_by_name (priv->stack, section_name); + section = gtk_stack_get_child_by_name (self->stack, section_name); if (section) - gtk_stack_set_visible_child (priv->stack, section); + gtk_stack_set_visible_child (self->stack, section); } static void @@ -450,10 +445,9 @@ update_accels_cb (GtkWidget *widget, gpointer data) { GtkShortcutsWindow *self = data; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); if (GTK_IS_SHORTCUTS_SHORTCUT (widget)) - gtk_shortcuts_shortcut_update_accel (GTK_SHORTCUTS_SHORTCUT (widget), priv->window); + gtk_shortcuts_shortcut_update_accel (GTK_SHORTCUTS_SHORTCUT (widget), self->window); else { GtkWidget *child; @@ -468,9 +462,7 @@ update_accels_cb (GtkWidget *widget, static void update_accels_for_actions (GtkShortcutsWindow *self) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - - if (priv->window) + if (self->window) { GtkWidget *child; @@ -492,18 +484,16 @@ void gtk_shortcuts_window_set_window (GtkShortcutsWindow *self, GtkWindow *window) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - - if (priv->keys_changed_id) + if (self->keys_changed_id) { - g_signal_handler_disconnect (priv->window, priv->keys_changed_id); - priv->keys_changed_id = 0; + g_signal_handler_disconnect (self->window, self->keys_changed_id); + self->keys_changed_id = 0; } - priv->window = window; + self->window = window; - if (priv->window) - priv->keys_changed_id = g_signal_connect (window, "keys-changed", + if (self->window) + self->keys_changed_id = g_signal_connect (window, "keys-changed", G_CALLBACK (keys_changed_handler), self); @@ -515,12 +505,11 @@ gtk_shortcuts_window__list_box__row_activated (GtkShortcutsWindow *self, GtkListBoxRow *row, GtkListBox *list_box) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkWidget *section; section = g_object_get_data (G_OBJECT (row), "gtk-shortcuts-section"); - gtk_stack_set_visible_child (priv->stack, section); - gtk_popover_popdown (priv->popover); + gtk_stack_set_visible_child (self->stack, section); + gtk_popover_popdown (self->popover); } static gboolean @@ -543,7 +532,6 @@ static void gtk_shortcuts_window__entry__changed (GtkShortcutsWindow *self, GtkSearchEntry *search_entry) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); char *downcase = NULL; GHashTableIter iter; const char *text; @@ -556,26 +544,26 @@ gtk_shortcuts_window__entry__changed (GtkShortcutsWindow *self, if (!text || !*text) { - if (priv->last_section_name != NULL) + if (self->last_section_name != NULL) { - gtk_stack_set_visible_child_name (priv->stack, priv->last_section_name); + gtk_stack_set_visible_child_name (self->stack, self->last_section_name); return; } } - last_section_name = gtk_stack_get_visible_child_name (priv->stack); + last_section_name = gtk_stack_get_visible_child_name (self->stack); if (g_strcmp0 (last_section_name, "internal-search") != 0 && g_strcmp0 (last_section_name, "no-search-results") != 0) { - g_free (priv->last_section_name); - priv->last_section_name = g_strdup (last_section_name); + g_free (self->last_section_name); + self->last_section_name = g_strdup (last_section_name); } downcase = g_utf8_strdown (text, -1); - g_hash_table_iter_init (&iter, priv->keywords); + g_hash_table_iter_init (&iter, self->keywords); has_result = FALSE; while (g_hash_table_iter_next (&iter, &key, &value)) @@ -596,20 +584,18 @@ gtk_shortcuts_window__entry__changed (GtkShortcutsWindow *self, g_free (downcase); if (has_result) - gtk_stack_set_visible_child_name (priv->stack, "internal-search"); + gtk_stack_set_visible_child_name (self->stack, "internal-search"); else - gtk_stack_set_visible_child_name (priv->stack, "no-search-results"); + gtk_stack_set_visible_child_name (self->stack, "no-search-results"); } static void gtk_shortcuts_window__search_mode__changed (GtkShortcutsWindow *self) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - - if (!gtk_search_bar_get_search_mode (priv->search_bar)) + if (!gtk_search_bar_get_search_mode (self->search_bar)) { - if (priv->last_section_name != NULL) - gtk_stack_set_visible_child_name (priv->stack, priv->last_section_name); + if (self->last_section_name != NULL) + gtk_stack_set_visible_child_name (self->stack, self->last_section_name); } } @@ -622,37 +608,33 @@ gtk_shortcuts_window_close (GtkShortcutsWindow *self) static void gtk_shortcuts_window_search (GtkShortcutsWindow *self) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - - gtk_search_bar_set_search_mode (priv->search_bar, TRUE); + gtk_search_bar_set_search_mode (self->search_bar, TRUE); } static void gtk_shortcuts_window_constructed (GObject *object) { GtkShortcutsWindow *self = (GtkShortcutsWindow *)object; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); G_OBJECT_CLASS (gtk_shortcuts_window_parent_class)->constructed (object); - if (priv->initial_section != NULL) - gtk_stack_set_visible_child_name (priv->stack, priv->initial_section); + if (self->initial_section != NULL) + gtk_stack_set_visible_child_name (self->stack, self->initial_section); } static void gtk_shortcuts_window_finalize (GObject *object) { GtkShortcutsWindow *self = (GtkShortcutsWindow *)object; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - g_clear_pointer (&priv->keywords, g_hash_table_unref); - g_clear_pointer (&priv->initial_section, g_free); - g_clear_pointer (&priv->view_name, g_free); - g_clear_pointer (&priv->last_section_name, g_free); - g_clear_pointer (&priv->search_items_hash, g_hash_table_unref); + g_clear_pointer (&self->keywords, g_hash_table_unref); + g_clear_pointer (&self->initial_section, g_free); + g_clear_pointer (&self->view_name, g_free); + g_clear_pointer (&self->last_section_name, g_free); + g_clear_pointer (&self->search_items_hash, g_hash_table_unref); - g_clear_object (&priv->search_image_group); - g_clear_object (&priv->search_text_group); + g_clear_object (&self->search_image_group); + g_clear_object (&self->search_text_group); G_OBJECT_CLASS (gtk_shortcuts_window_parent_class)->finalize (object); } @@ -661,16 +643,15 @@ static void gtk_shortcuts_window_dispose (GObject *object) { GtkShortcutsWindow *self = (GtkShortcutsWindow *)object; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - if (priv->stack) - g_signal_handlers_disconnect_by_func (priv->stack, G_CALLBACK (update_title_stack), self); + if (self->stack) + g_signal_handlers_disconnect_by_func (self->stack, G_CALLBACK (update_title_stack), self); gtk_shortcuts_window_set_window (self, NULL); - priv->stack = NULL; - priv->search_bar = NULL; - priv->main_box = NULL; + self->stack = NULL; + self->search_bar = NULL; + self->main_box = NULL; G_OBJECT_CLASS (gtk_shortcuts_window_parent_class)->dispose (object); } @@ -682,19 +663,18 @@ gtk_shortcuts_window_get_property (GObject *object, GParamSpec *pspec) { GtkShortcutsWindow *self = (GtkShortcutsWindow *)object; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); switch (prop_id) { case PROP_SECTION_NAME: { - GtkWidget *child = gtk_stack_get_visible_child (priv->stack); + GtkWidget *child = gtk_stack_get_visible_child (self->stack); if (child != NULL) { char *name = NULL; - g_object_get (gtk_stack_get_page (priv->stack, child), + g_object_get (gtk_stack_get_page (self->stack, child), "name", &name, NULL); g_value_take_string (value, name); @@ -703,7 +683,7 @@ gtk_shortcuts_window_get_property (GObject *object, break; case PROP_VIEW_NAME: - g_value_set_string (value, priv->view_name); + g_value_set_string (value, self->view_name); break; default: @@ -738,10 +718,9 @@ static void gtk_shortcuts_window_unmap (GtkWidget *widget) { GtkShortcutsWindow *self = (GtkShortcutsWindow *)widget; - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); - gtk_search_bar_set_search_mode (priv->search_bar, FALSE); - gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), ""); + gtk_search_bar_set_search_mode (self->search_bar, FALSE); + gtk_editable_set_text (GTK_EDITABLE (self->search_entry), ""); GTK_WIDGET_CLASS (gtk_shortcuts_window_parent_class)->unmap (widget); } @@ -844,7 +823,6 @@ gtk_shortcuts_window_class_init (GtkShortcutsWindowClass *klass) static void gtk_shortcuts_window_init (GtkShortcutsWindow *self) { - GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self); GtkWidget *search_button; GtkBox *box; GtkWidget *scroller; @@ -854,91 +832,91 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) gtk_window_set_resizable (GTK_WINDOW (self), FALSE); - priv->keywords = g_hash_table_new_full (NULL, NULL, NULL, g_free); - priv->search_items_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + self->keywords = g_hash_table_new_full (NULL, NULL, NULL, g_free); + self->search_items_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - priv->search_text_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - priv->search_image_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + self->search_text_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + self->search_image_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - priv->header_bar = GTK_HEADER_BAR (gtk_header_bar_new ()); - gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (priv->header_bar)); + self->header_bar = GTK_HEADER_BAR (gtk_header_bar_new ()); + gtk_window_set_titlebar (GTK_WINDOW (self), GTK_WIDGET (self->header_bar)); search_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON, "icon-name", "edit-find-symbolic", NULL); - gtk_header_bar_pack_start (GTK_HEADER_BAR (priv->header_bar), search_button); + gtk_header_bar_pack_start (GTK_HEADER_BAR (self->header_bar), search_button); - priv->main_box = g_object_new (GTK_TYPE_BOX, + self->main_box = g_object_new (GTK_TYPE_BOX, "orientation", GTK_ORIENTATION_VERTICAL, NULL); - gtk_window_set_child (GTK_WINDOW (self), priv->main_box); + gtk_window_set_child (GTK_WINDOW (self), self->main_box); - priv->search_bar = g_object_new (GTK_TYPE_SEARCH_BAR, NULL); - g_object_bind_property (priv->search_bar, "search-mode-enabled", + self->search_bar = g_object_new (GTK_TYPE_SEARCH_BAR, NULL); + g_object_bind_property (self->search_bar, "search-mode-enabled", search_button, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); - gtk_box_append (GTK_BOX (priv->main_box), GTK_WIDGET (priv->search_bar)); - gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (priv->search_bar), + gtk_box_append (GTK_BOX (self->main_box), GTK_WIDGET (self->search_bar)); + gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (self->search_bar), GTK_WIDGET (self)); - priv->stack = g_object_new (GTK_TYPE_STACK, + self->stack = g_object_new (GTK_TYPE_STACK, "hexpand", TRUE, "vexpand", TRUE, "hhomogeneous", TRUE, "vhomogeneous", TRUE, "transition-type", GTK_STACK_TRANSITION_TYPE_CROSSFADE, NULL); - gtk_box_append (GTK_BOX (priv->main_box), GTK_WIDGET (priv->stack)); + gtk_box_append (GTK_BOX (self->main_box), GTK_WIDGET (self->stack)); - priv->title_stack = g_object_new (GTK_TYPE_STACK, + self->title_stack = g_object_new (GTK_TYPE_STACK, NULL); - gtk_header_bar_set_title_widget (priv->header_bar, GTK_WIDGET (priv->title_stack)); + gtk_header_bar_set_title_widget (self->header_bar, GTK_WIDGET (self->title_stack)); /* Translators: This is the window title for the shortcuts window in normal mode */ label = gtk_label_new (_("Shortcuts")); gtk_widget_add_css_class (label, "title"); - gtk_stack_add_named (priv->title_stack, label, "title"); + gtk_stack_add_named (self->title_stack, label, "title"); /* Translators: This is the window title for the shortcuts window in search mode */ label = gtk_label_new (_("Search Results")); gtk_widget_add_css_class (label, "title"); - gtk_stack_add_named (priv->title_stack, label, "search"); + gtk_stack_add_named (self->title_stack, label, "search"); - priv->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON, + self->menu_button = g_object_new (GTK_TYPE_MENU_BUTTON, "focus-on-click", FALSE, NULL); - gtk_widget_add_css_class (GTK_WIDGET (priv->menu_button), "flat"); - gtk_stack_add_named (priv->title_stack, GTK_WIDGET (priv->menu_button), "sections"); + gtk_widget_add_css_class (GTK_WIDGET (self->menu_button), "flat"); + gtk_stack_add_named (self->title_stack, GTK_WIDGET (self->menu_button), "sections"); - priv->popover = g_object_new (GTK_TYPE_POPOVER, + self->popover = g_object_new (GTK_TYPE_POPOVER, "position", GTK_POS_BOTTOM, NULL); - gtk_menu_button_set_popover (priv->menu_button, GTK_WIDGET (priv->popover)); + gtk_menu_button_set_popover (self->menu_button, GTK_WIDGET (self->popover)); - priv->list_box = g_object_new (GTK_TYPE_LIST_BOX, + self->list_box = g_object_new (GTK_TYPE_LIST_BOX, "selection-mode", GTK_SELECTION_NONE, NULL); - g_signal_connect_object (priv->list_box, + g_signal_connect_object (self->list_box, "row-activated", G_CALLBACK (gtk_shortcuts_window__list_box__row_activated), self, G_CONNECT_SWAPPED); - gtk_popover_set_child (GTK_POPOVER (priv->popover), GTK_WIDGET (priv->list_box)); + gtk_popover_set_child (GTK_POPOVER (self->popover), GTK_WIDGET (self->list_box)); - priv->search_entry = GTK_SEARCH_ENTRY (gtk_search_entry_new ()); - gtk_search_bar_set_child (GTK_SEARCH_BAR (priv->search_bar), GTK_WIDGET (priv->search_entry)); + self->search_entry = GTK_SEARCH_ENTRY (gtk_search_entry_new ()); + gtk_search_bar_set_child (GTK_SEARCH_BAR (self->search_bar), GTK_WIDGET (self->search_entry)); - g_object_set (priv->search_entry, + g_object_set (self->search_entry, /* Translators: This is placeholder text for the search entry in the shortcuts window */ "placeholder-text", _("Search Shortcuts"), "width-chars", 40, NULL); - g_signal_connect_object (priv->search_entry, + g_signal_connect_object (self->search_entry, "search-changed", G_CALLBACK (gtk_shortcuts_window__entry__changed), self, G_CONNECT_SWAPPED); - g_signal_connect_object (priv->search_bar, + g_signal_connect_object (self->search_bar, "notify::search-mode-enabled", G_CALLBACK (gtk_shortcuts_window__search_mode__changed), self, @@ -951,21 +929,21 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) NULL); gtk_widget_add_css_class (GTK_WIDGET (box), "shortcuts-search-results"); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroller), GTK_WIDGET (box)); - gtk_stack_add_named (priv->stack, scroller, "internal-search"); + gtk_stack_add_named (self->stack, scroller, "internal-search"); - priv->search_shortcuts = g_object_new (GTK_TYPE_BOX, + self->search_shortcuts = g_object_new (GTK_TYPE_BOX, "halign", GTK_ALIGN_CENTER, "spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, NULL); - gtk_box_append (GTK_BOX (box), GTK_WIDGET (priv->search_shortcuts)); + gtk_box_append (GTK_BOX (box), GTK_WIDGET (self->search_shortcuts)); - priv->search_gestures = g_object_new (GTK_TYPE_BOX, + self->search_gestures = g_object_new (GTK_TYPE_BOX, "halign", GTK_ALIGN_CENTER, "spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, NULL); - gtk_box_append (GTK_BOX (box), GTK_WIDGET (priv->search_gestures)); + gtk_box_append (GTK_BOX (box), GTK_WIDGET (self->search_gestures)); empty = g_object_new (GTK_TYPE_GRID, "row-spacing", 12, @@ -999,9 +977,9 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self) NULL); gtk_grid_attach (GTK_GRID (empty), label, 0, 2, 1, 1); - gtk_stack_add_named (priv->stack, empty, "no-search-results"); + gtk_stack_add_named (self->stack, empty, "no-search-results"); - g_signal_connect_object (priv->stack, "notify::visible-child", + g_signal_connect_object (self->stack, "notify::visible-child", G_CALLBACK (update_title_stack), self, G_CONNECT_SWAPPED); } diff --git a/gtk/gtkshortcutswindow.h b/gtk/gtkshortcutswindow.h index 09249d122d..a178653d47 100644 --- a/gtk/gtkshortcutswindow.h +++ b/gtk/gtkshortcutswindow.h @@ -32,14 +32,7 @@ G_BEGIN_DECLS #define GTK_IS_SHORTCUTS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SHORTCUTS_WINDOW)) -typedef struct _GtkShortcutsWindow GtkShortcutsWindow; -typedef struct _GtkShortcutsWindowClass GtkShortcutsWindowClass; - - -struct _GtkShortcutsWindow -{ - GtkWindow window; -}; +typedef struct _GtkShortcutsWindow GtkShortcutsWindow; GDK_AVAILABLE_IN_ALL GType gtk_shortcuts_window_get_type (void) G_GNUC_CONST;