From 008b75edd1c51ad3c5579ee84e1896b8bf03e130 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 14 Feb 2020 15:23:10 +0000 Subject: [PATCH] user-controls: Add a drop-down arrow next to the OARS age selector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To make it more obvious that it triggers a drop-down menu. Potentially, this should be a `GtkComboBox` rather than reinventing the wheel using a `GtkMenuButton` — but that’s a change for another day. Signed-off-by: Philip Withnall Helps: #11 --- libmalcontent-ui/user-controls.c | 8 +++++--- libmalcontent-ui/user-controls.ui | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index c89b5cd..a4ff30d 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -82,6 +82,7 @@ struct _MctUserControls GtkSwitch *restrict_web_browsers_switch; GtkLabel *restrict_web_browsers_description; GtkButton *oars_button; + GtkLabel *oars_button_label; GtkPopover *oars_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; GtkLabel *restrict_applications_description; @@ -399,7 +400,7 @@ update_oars_level (MctUserControls *self) if (rating_age_category == NULL || all_categories_unset) rating_age_category = _("All Ages"); - gtk_button_set_label (self->oars_button, rating_age_category); + gtk_label_set_label (self->oars_button_label, rating_age_category); } static void @@ -670,13 +671,13 @@ on_set_age_action_activated (GSimpleAction *action, /* Update the button */ if (age == oars_disabled_age) - gtk_button_set_label (self->oars_button, _("All Ages")); + gtk_label_set_label (self->oars_button_label, _("All Ages")); for (i = 0; age != oars_disabled_age && entries[i] != NULL; i++) { if (ages[i] == age) { - gtk_button_set_label (self->oars_button, entries[i]); + gtk_label_set_label (self->oars_button_label, entries[i]); break; } } @@ -966,6 +967,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_switch); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_web_browsers_description); gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_button); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_button_label); gtk_widget_class_bind_template_child (widget_class, MctUserControls, oars_popover); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_dialog); gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_description); diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 6b89fa3..78d8214 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -487,6 +487,27 @@ end center oars_popover + + + True + horizontal + + + True + + True + center + + + + + True + pan-down-symbolic + 4 + + + + 1