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:
parent
659d22ba34
commit
c835bcdc9a
|
@ -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
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</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>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="visible">True</property>
|
||||
|
@ -124,10 +125,10 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<object class="GtkListBoxRow" id="restrict_applications_row">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="activatable">False</property>
|
||||
<property name="activatable">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
|
|
Loading…
Reference in New Issue