From 8560ca0677a720f9c6aafb52777e00fed11edff3 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 8 Jul 2022 15:43:57 -0300 Subject: [PATCH] project: Simplify buttons GtkButton has an 'icon-name' property that greatly simplifies setting up buttons. GtkMenuButton has a new 'always-show-arrow' property that also allows us to simplify some code. --- libmalcontent-ui/user-controls.c | 10 ++++------ libmalcontent-ui/user-controls.ui | 20 +------------------- malcontent-control/carousel.ui | 26 ++++++++------------------ 3 files changed, 13 insertions(+), 43 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index 25f294d..8dcac2e 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -81,8 +81,7 @@ struct _MctUserControls AdwActionRow *restrict_software_installation_row; GtkSwitch *restrict_web_browsers_switch; AdwActionRow *restrict_web_browsers_row; - GtkButton *oars_button; - GtkLabel *oars_button_label; + GtkMenuButton *oars_button; GtkPopover *oars_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; GtkLabel *restrict_applications_description; @@ -395,7 +394,7 @@ update_oars_level (MctUserControls *self) selected_age = maximum_age; } - gtk_label_set_label (self->oars_button_label, rating_age_category); + gtk_menu_button_set_label (self->oars_button, rating_age_category); self->selected_age = selected_age; } @@ -641,13 +640,13 @@ on_set_age_action_activated (GSimpleAction *action, /* Update the button */ if (age == oars_disabled_age) - gtk_label_set_label (self->oars_button_label, _("All Ages")); + gtk_menu_button_set_label (self->oars_button, _("All Ages")); for (i = 0; age != oars_disabled_age && entries[i] != NULL; i++) { if (ages[i] == age) { - gtk_label_set_label (self->oars_button_label, entries[i]); + gtk_menu_button_set_label (self->oars_button, entries[i]); break; } } @@ -998,7 +997,6 @@ 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_row); 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_row); diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index f0cfff9..b31eefb 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -103,25 +103,7 @@ center right oars_popover - - - horizontal - - - - True - start - 0.0 - - - - - pan-down-symbolic - 4 - - - - + True diff --git a/malcontent-control/carousel.ui b/malcontent-control/carousel.ui index fa5ab31..96d6a31 100644 --- a/malcontent-control/carousel.ui +++ b/malcontent-control/carousel.ui @@ -35,18 +35,13 @@ False center + go-previous-symbolic + + Previous Page + - - - 4 - go-previous-symbolic - - Previous Page - - - @@ -55,18 +50,13 @@ center end True + go-next-symbolic + + Next Page + - - - 4 - go-next-symbolic - - Next Page - - -