diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2019-11-20 14:48:59 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@gmail.com> | 2020-03-30 02:05:38 +0000 |
commit | e9ca51789c3a54a6effc246fab42f41ff180b248 (patch) | |
tree | 2a5eacb27402b7c38b75053838ee144c521085c4 | |
parent | 7e0a66226b165edee07d7edb55d5bc82a0a65728 (diff) | |
download | gnome-control-center-e9ca51789c3a54a6effc246fab42f41ff180b248.tar.gz |
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.
-rw-r--r-- | panels/background/cc-background-preview.c | 8 | ||||
-rw-r--r-- | 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> |