[gnome-control-center] background: Replace GtkStack child names with widget references
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Replace GtkStack child names with widget references
- Date: Mon, 30 Mar 2020 02:10:45 +0000 (UTC)
commit e9ca51789c3a54a6effc246fab42f41ff180b248
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Nov 20 14:48:59 2019 +1300
background: Replace GtkStack child names with widget references
The child names are easier to break if widgets are changed - this can't be
detected by the compiler.
panels/background/cc-background-preview.c | 8 ++++++--
panels/background/cc-background-preview.ui | 10 ++--------
2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/panels/background/cc-background-preview.c b/panels/background/cc-background-preview.c
index 17b47d6e4..9fef9be40 100644
--- a/panels/background/cc-background-preview.c
+++ b/panels/background/cc-background-preview.c
@@ -28,7 +28,9 @@ struct _CcBackgroundPreview
GtkImage *animated_background_icon;
GtkLabel *desktop_clock_label;
+ GtkFrame *desktop_frame;
GtkDrawingArea *drawing_area;
+ GtkFrame *lock_frame;
GtkLabel *lock_screen_label;
GtkStack *stack;
@@ -231,8 +233,8 @@ cc_background_preview_set_property (GObject *object,
{
case PROP_IS_LOCK_SCREEN:
self->is_lock_screen = g_value_get_boolean (value);
- gtk_stack_set_visible_child_name (self->stack,
- self->is_lock_screen ? "lock" : "desktop");
+ gtk_stack_set_visible_child (self->stack,
+ self->is_lock_screen ? GTK_WIDGET (self->lock_frame) : GTK_WIDGET
(self->desktop_frame));
break;
case PROP_ITEM:
@@ -325,7 +327,9 @@ cc_background_preview_class_init (CcBackgroundPreviewClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, animated_background_icon);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, desktop_clock_label);
+ gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, desktop_frame);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, drawing_area);
+ gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, lock_frame);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, lock_screen_label);
gtk_widget_class_bind_template_child (widget_class, CcBackgroundPreview, stack);
diff --git a/panels/background/cc-background-preview.ui b/panels/background/cc-background-preview.ui
index 0906847e1..30f7902ca 100644
--- a/panels/background/cc-background-preview.ui
+++ b/panels/background/cc-background-preview.ui
@@ -34,7 +34,7 @@
<property name="expand">True</property>
<child>
- <object class="GtkFrame">
+ <object class="GtkFrame" id="desktop_frame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="shadow-type">none</property>
@@ -104,14 +104,11 @@
</child>
</object>
- <packing>
- <property name="name">desktop</property>
- </packing>
</child>
<child>
- <object class="GtkFrame">
+ <object class="GtkFrame" id="lock_frame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="shadow-type">none</property>
@@ -128,9 +125,6 @@
<class name="lock-screen-preview" />
</style>
</object>
- <packing>
- <property name="name">lock</property>
- </packing>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]