From c835bcdc9a5f13321a40167b8ec70af6b36ecb3e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 1 May 2020 15:20:09 +0100 Subject: [PATCH 1/2] =?UTF-8?q?user-controls:=20Make=20whole=20=E2=80=98Re?= =?UTF-8?q?strict=20Applications=E2=80=99=20row=20activatable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, just the button at the end was activatable, but making the whole row activatable makes it an easier hit target. From a suggestion by Nick Richards (https://www.nedrichards.com/2020/04/endless-3.8.0-beta-1-trip-report/). Signed-off-by: Philip Withnall --- libmalcontent-ui/user-controls.c | 18 ++++++++++++++++++ libmalcontent-ui/user-controls.ui | 7 ++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/libmalcontent-ui/user-controls.c b/libmalcontent-ui/user-controls.c index c727a46..5b58ca5 100644 --- a/libmalcontent-ui/user-controls.c +++ b/libmalcontent-ui/user-controls.c @@ -87,6 +87,7 @@ struct _MctUserControls GtkPopover *oars_popover; MctRestrictApplicationsDialog *restrict_applications_dialog; GtkLabel *restrict_applications_description; + GtkListBoxRow *restrict_applications_row; GtkListBox *application_usage_permissions_listbox; GtkListBox *software_installation_permissions_listbox; @@ -134,6 +135,10 @@ static void on_restrict_applications_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data); +static void on_application_usage_permissions_listbox_activated_cb (GtkListBox *list_box, + GtkListBoxRow *row, + gpointer user_data); + static void on_set_age_action_activated (GSimpleAction *action, GVariant *param, gpointer user_data); @@ -654,6 +659,17 @@ on_restrict_applications_dialog_response_cb (GtkDialog *dialog, on_restrict_applications_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL, self); } +static void +on_application_usage_permissions_listbox_activated_cb (GtkListBox *list_box, + GtkListBoxRow *row, + gpointer user_data) +{ + MctUserControls *self = MCT_USER_CONTROLS (user_data); + + if (row == self->restrict_applications_row) + on_restrict_applications_button_clicked_cb (NULL, self); +} + static void on_set_age_action_activated (GSimpleAction *action, GVariant *param, @@ -1031,6 +1047,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) 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); + gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_row); gtk_widget_class_bind_template_child (widget_class, MctUserControls, application_usage_permissions_listbox); gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_permissions_listbox); @@ -1039,6 +1056,7 @@ mct_user_controls_class_init (MctUserControlsClass *klass) gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_button_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_delete_event_cb); gtk_widget_class_bind_template_callback (widget_class, on_restrict_applications_dialog_response_cb); + gtk_widget_class_bind_template_callback (widget_class, on_application_usage_permissions_listbox_activated_cb); } static void diff --git a/libmalcontent-ui/user-controls.ui b/libmalcontent-ui/user-controls.ui index 6c52573..69b1974 100644 --- a/libmalcontent-ui/user-controls.ui +++ b/libmalcontent-ui/user-controls.ui @@ -38,7 +38,8 @@ False True none - False + True + True @@ -124,10 +125,10 @@ - + True True - False + True False From 9b3dedd9edc2724fb68a0860bf48a67d1ddbd15a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 1 May 2020 16:09:16 +0100 Subject: [PATCH 2/2] malcontent-control: Centre the user controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This causes the controls on the main window to be centred at their full width (when there’s enough window width to do so), rather than expanding to fill the entire window. It’s not currently possible with GTK+3 to easily set a maximum width (of, say, 600px) to the column, without writing a custom widget (like `HdyColumn` does). From a suggestion by Nick Richards (https://www.nedrichards.com/2020/04/endless-3.8.0-beta-1-trip-report/). Signed-off-by: Philip Withnall --- malcontent-control/main.ui | 1 + 1 file changed, 1 insertion(+) diff --git a/malcontent-control/main.ui b/malcontent-control/main.ui index 69f9d93..12fab8b 100644 --- a/malcontent-control/main.ui +++ b/malcontent-control/main.ui @@ -58,6 +58,7 @@ 350 + center True 12 dbus_connection