user-controls: Make whole ‘Restrict Applications’ row activatable

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 <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-05-01 15:20:09 +01:00
parent 659d22ba34
commit c835bcdc9a
2 changed files with 22 additions and 3 deletions

View File

@ -87,6 +87,7 @@ struct _MctUserControls
GtkPopover *oars_popover; GtkPopover *oars_popover;
MctRestrictApplicationsDialog *restrict_applications_dialog; MctRestrictApplicationsDialog *restrict_applications_dialog;
GtkLabel *restrict_applications_description; GtkLabel *restrict_applications_description;
GtkListBoxRow *restrict_applications_row;
GtkListBox *application_usage_permissions_listbox; GtkListBox *application_usage_permissions_listbox;
GtkListBox *software_installation_permissions_listbox; GtkListBox *software_installation_permissions_listbox;
@ -134,6 +135,10 @@ static void on_restrict_applications_dialog_response_cb (GtkDialog *dialog,
gint response_id, gint response_id,
gpointer user_data); 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, static void on_set_age_action_activated (GSimpleAction *action,
GVariant *param, GVariant *param,
gpointer user_data); 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); 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 static void
on_set_age_action_activated (GSimpleAction *action, on_set_age_action_activated (GSimpleAction *action,
GVariant *param, 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, 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_dialog);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, restrict_applications_description); 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, application_usage_permissions_listbox);
gtk_widget_class_bind_template_child (widget_class, MctUserControls, software_installation_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_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_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_restrict_applications_dialog_response_cb);
gtk_widget_class_bind_template_callback (widget_class, on_application_usage_permissions_listbox_activated_cb);
} }
static void static void

View File

@ -38,7 +38,8 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="selection_mode">none</property> <property name="selection_mode">none</property>
<property name="activate_on_single_click">False</property> <property name="activate-on-single-click">True</property>
<signal name="row-activated" handler="on_application_usage_permissions_listbox_activated_cb" object="MctUserControls" swapped="no" />
<child> <child>
<object class="GtkListBoxRow"> <object class="GtkListBoxRow">
<property name="visible">True</property> <property name="visible">True</property>
@ -124,10 +125,10 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkListBoxRow"> <object class="GtkListBoxRow" id="restrict_applications_row">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="activatable">False</property> <property name="activatable">True</property>
<property name="selectable">False</property> <property name="selectable">False</property>
<child> <child>
<object class="GtkGrid"> <object class="GtkGrid">