[gnome-control-center] mouse: Use GtkTemplate
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] mouse: Use GtkTemplate
- Date: Tue, 29 May 2018 00:41:21 +0000 (UTC)
commit a7e84dcf2edbeaa225cefc536f067fcd5ad9ba35
Author: Robert Ancell <robert ancell canonical com>
Date: Mon May 28 12:40:11 2018 +1200
mouse: Use GtkTemplate
panels/mouse/gnome-mouse-properties.c | 134 +++--
panels/mouse/gnome-mouse-properties.ui | 990 +++++++++++++++++----------------
panels/mouse/gnome-mouse-test.c | 50 +-
panels/mouse/gnome-mouse-test.ui | 4 +
4 files changed, 613 insertions(+), 565 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 37bf556b6..d641c142c 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -42,13 +42,30 @@
#include <sys/stat.h>
#include <dirent.h>
-#define WID(x) (GtkWidget *) gtk_builder_get_object (self->builder, x)
-
struct _CcMouseProperties
{
GtkBin parent_instance;
- GtkBuilder *builder;
+ GtkWidget *edge_scrolling_row;
+ GtkWidget *edge_scrolling_switch;
+ GtkWidget *general_listbox;
+ GtkWidget *mouse_frame;
+ GtkWidget *mouse_listbox;
+ GtkWidget *mouse_natural_scrolling_switch;
+ GtkWidget *mouse_speed_scale;
+ GtkWidget *primary_button_left;
+ GtkWidget *primary_button_right;
+ GtkWidget *scrolled_window;
+ GtkWidget *tap_to_click_row;
+ GtkWidget *tap_to_click_switch;
+ GtkWidget *touchpad_frame;
+ GtkWidget *touchpad_listbox;
+ GtkWidget *touchpad_natural_scrolling_switch;
+ GtkWidget *touchpad_options_listbox;
+ GtkWidget *touchpad_speed_scale;
+ GtkWidget *touchpad_toggle_switch;
+ GtkWidget *two_finger_scrolling_row;
+ GtkWidget *two_finger_scrolling_switch;
GSettings *mouse_settings;
GSettings *gsd_mouse_settings;
@@ -81,34 +98,34 @@ setup_touchpad_options (CcMouseProperties *self)
gboolean have_edge_scrolling;
gboolean have_tap_to_click;
- gtk_widget_set_visible (WID ("touchpad-frame"), !self->have_synaptics);
+ gtk_widget_set_visible (self->touchpad_frame, !self->have_synaptics);
if (self->have_synaptics)
return;
- gtk_widget_set_visible (WID ("touchpad-frame"), self->have_touchpad);
+ gtk_widget_set_visible (self->touchpad_frame, self->have_touchpad);
if (!self->have_touchpad)
return;
cc_touchpad_check_capabilities (&have_two_finger_scrolling, &have_edge_scrolling, &have_tap_to_click);
- gtk_widget_show_all (WID ("touchpad-frame"));
+ gtk_widget_show_all (self->touchpad_frame);
- gtk_widget_set_visible (WID ("two-finger-scrolling-row"), have_two_finger_scrolling);
- gtk_widget_set_visible (WID ("edge-scrolling-row"), have_edge_scrolling);
- gtk_widget_set_visible (WID ("tap-to-click-row"), have_tap_to_click);
+ gtk_widget_set_visible (self->two_finger_scrolling_row, have_two_finger_scrolling);
+ gtk_widget_set_visible (self->edge_scrolling_row, have_edge_scrolling);
+ gtk_widget_set_visible (self->tap_to_click_row, have_tap_to_click);
edge_scroll_enabled = g_settings_get_boolean (self->touchpad_settings, "edge-scrolling-enabled");
two_finger_scroll_enabled = g_settings_get_boolean (self->touchpad_settings,
"two-finger-scrolling-enabled");
if (edge_scroll_enabled && two_finger_scroll_enabled) {
/* You cunning user set both, but you can only have one set in that UI */
self->changing_scroll = TRUE;
- gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")),
two_finger_scroll_enabled);
+ gtk_switch_set_active (GTK_SWITCH (self->two_finger_scrolling_switch),
two_finger_scroll_enabled);
self->changing_scroll = FALSE;
- gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), FALSE);
+ gtk_switch_set_active (GTK_SWITCH (self->edge_scrolling_switch), FALSE);
} else {
self->changing_scroll = TRUE;
- gtk_switch_set_active (GTK_SWITCH (WID ("edge-scrolling-switch")), edge_scroll_enabled);
- gtk_switch_set_active (GTK_SWITCH (WID ("two-finger-scrolling-switch")),
two_finger_scroll_enabled);
+ gtk_switch_set_active (GTK_SWITCH (self->edge_scrolling_switch), edge_scroll_enabled);
+ gtk_switch_set_active (GTK_SWITCH (self->two_finger_scrolling_switch),
two_finger_scroll_enabled);
self->changing_scroll = FALSE;
}
}
@@ -126,9 +143,9 @@ two_finger_scrolling_changed_event (GtkSwitch *button,
g_settings_set_boolean (self->touchpad_settings, "two-finger-scrolling-enabled", state);
gtk_switch_set_state (button, state);
- if (state && gtk_widget_get_visible (WID ("edge-scrolling-row"))) {
+ if (state && gtk_widget_get_visible (self->edge_scrolling_row)) {
/* Disable edge scrolling if two-finger scrolling is enabled */
- gtk_switch_set_state (GTK_SWITCH (WID ("edge-scrolling-switch")), FALSE);
+ gtk_switch_set_state (GTK_SWITCH (self->edge_scrolling_switch), FALSE);
}
}
@@ -145,9 +162,9 @@ edge_scrolling_changed_event (GtkSwitch *button,
g_settings_set_boolean (self->touchpad_settings, "edge-scrolling-enabled", state);
gtk_switch_set_state (button, state);
- if (state && gtk_widget_get_visible (WID ("two-finger-scrolling-row"))) {
+ if (state && gtk_widget_get_visible (self->two_finger_scrolling_row)) {
/* Disable two-finger scrolling if edge scrolling is enabled */
- gtk_switch_set_state (GTK_SWITCH (WID ("two-finger-scrolling-switch")), FALSE);
+ gtk_switch_set_state (GTK_SWITCH (self->two_finger_scrolling_switch), FALSE);
}
}
@@ -227,77 +244,77 @@ setup_dialog (CcMouseProperties *self)
GtkWidget *button;
self->left_handed = g_settings_get_boolean (self->mouse_settings, "left-handed");
- button = WID (self->left_handed ? "primary-button-right" : "primary-button-left");
+ button = self->left_handed ? self->primary_button_right : self->primary_button_left;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_settings_bind (self->mouse_settings, "left-handed",
- WID ("primary-button-left"), "active",
+ self->primary_button_left, "active",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
g_settings_bind (self->mouse_settings, "left-handed",
- WID ("primary-button-right"), "active",
+ self->primary_button_right, "active",
G_SETTINGS_BIND_DEFAULT);
/* Allow changing orientation with either button */
- button = WID ("primary-button-right");
+ button = self->primary_button_right;
self->right_gesture = gtk_gesture_multi_press_new (button);
handle_secondary_button (self, button, self->right_gesture);
- button = WID ("primary-button-left");
+ button = self->primary_button_left;
self->left_gesture = gtk_gesture_multi_press_new (button);
handle_secondary_button (self, button, self->left_gesture);
g_settings_bind (self->mouse_settings, "natural-scroll",
- WID ("mouse-natural-scrolling-switch"), "active",
+ self->mouse_natural_scrolling_switch, "active",
G_SETTINGS_BIND_DEFAULT);
- gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("general-listbox")), cc_list_box_update_header_func,
NULL, NULL);
- gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-listbox")),
cc_list_box_update_header_func, NULL, NULL);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->general_listbox), cc_list_box_update_header_func,
NULL, NULL);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->touchpad_listbox), cc_list_box_update_header_func,
NULL, NULL);
/* Mouse section */
- gtk_widget_set_visible (WID ("mouse-frame"), self->have_mouse);
+ gtk_widget_set_visible (self->mouse_frame, self->have_mouse);
g_settings_bind (self->mouse_settings, "speed",
- gtk_range_get_adjustment (GTK_RANGE (WID ("mouse-speed-scale"))), "value",
+ gtk_range_get_adjustment (GTK_RANGE (self->mouse_speed_scale)), "value",
G_SETTINGS_BIND_DEFAULT);
- gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("mouse-listbox")), cc_list_box_update_header_func,
NULL, NULL);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->mouse_listbox), cc_list_box_update_header_func,
NULL, NULL);
/* Touchpad section */
- gtk_widget_set_visible (WID ("touchpad-toggle-switch"),
+ gtk_widget_set_visible (self->touchpad_toggle_switch,
show_touchpad_enabling_switch (self));
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
- WID ("touchpad-toggle-switch"), "active",
+ self->touchpad_toggle_switch, "active",
G_SETTINGS_BIND_DEFAULT,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
- WID ("touchpad-options-listbox"), "sensitive",
+ self->touchpad_options_listbox, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind (self->touchpad_settings, "natural-scroll",
- WID ("touchpad-natural-scrolling-switch"), "active",
+ self->touchpad_natural_scrolling_switch, "active",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "speed",
- gtk_range_get_adjustment (GTK_RANGE (WID ("touchpad-speed-scale"))), "value",
+ gtk_range_get_adjustment (GTK_RANGE (self->touchpad_speed_scale)), "value",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "tap-to-click",
- WID ("tap-to-click-switch"), "active",
+ self->tap_to_click_switch, "active",
G_SETTINGS_BIND_DEFAULT);
setup_touchpad_options (self);
- g_signal_connect (WID ("edge-scrolling-switch"), "state-set",
+ g_signal_connect (self->edge_scrolling_switch, "state-set",
G_CALLBACK (edge_scrolling_changed_event), self);
- g_signal_connect (WID ("two-finger-scrolling-switch"), "state-set",
+ g_signal_connect (self->two_finger_scrolling_switch, "state-set",
G_CALLBACK (two_finger_scrolling_changed_event), self);
- gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-options-listbox")),
cc_list_box_update_header_func, NULL, NULL);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (self->touchpad_options_listbox),
cc_list_box_update_header_func, NULL, NULL);
}
/* Callback issued when a button is clicked on the dialog */
@@ -311,8 +328,8 @@ device_changed (GsdDeviceManager *device_manager,
setup_touchpad_options (self);
self->have_mouse = mouse_is_present ();
- gtk_widget_set_visible (WID ("mouse-frame"), self->have_mouse);
- gtk_widget_set_visible (WID ("touchpad-toggle-switch"),
+ gtk_widget_set_visible (self->mouse_frame, self->have_mouse);
+ gtk_widget_set_visible (self->touchpad_toggle_switch,
show_touchpad_enabling_switch (self));
}
@@ -339,7 +356,6 @@ cc_mouse_properties_finalize (GObject *object)
g_clear_object (&self->mouse_settings);
g_clear_object (&self->gsd_mouse_settings);
g_clear_object (&self->touchpad_settings);
- g_clear_object (&self->builder);
g_clear_object (&self->right_gesture);
g_clear_object (&self->left_gesture);
@@ -355,12 +371,35 @@ cc_mouse_properties_finalize (GObject *object)
}
static void
-cc_mouse_properties_class_init (CcMousePropertiesClass *class)
+cc_mouse_properties_class_init (CcMousePropertiesClass *klass)
{
- GObjectClass *object_class;
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class = G_OBJECT_CLASS (class);
object_class->finalize = cc_mouse_properties_finalize;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/mouse/gnome-mouse-properties.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, edge_scrolling_row);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, edge_scrolling_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, general_listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, mouse_frame);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, mouse_listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties,
mouse_natural_scrolling_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, mouse_speed_scale);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, primary_button_left);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, primary_button_right);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, scrolled_window);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, tap_to_click_row);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, tap_to_click_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_frame);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties,
touchpad_natural_scrolling_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_options_listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_speed_scale);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_toggle_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, two_finger_scrolling_row);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, two_finger_scrolling_switch);
}
static void
@@ -368,10 +407,7 @@ cc_mouse_properties_init (CcMouseProperties *self)
{
g_autoptr(GError) error = NULL;
- self->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (self->builder,
- "/org/gnome/control-center/mouse/gnome-mouse-properties.ui",
- &error);
+ gtk_widget_init_template (GTK_WIDGET (self));
self->mouse_settings = g_settings_new ("org.gnome.desktop.peripherals.mouse");
self->gsd_mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
@@ -392,11 +428,9 @@ cc_mouse_properties_init (CcMouseProperties *self)
self->changing_scroll = FALSE;
- gtk_container_add (GTK_CONTAINER (self), WID ("scrolled-window"));
-
setup_dialog (self);
- g_signal_connect (WID ("scrolled-window"), "size-allocate", G_CALLBACK (on_content_size_changed),
NULL);
+ g_signal_connect (self->scrolled_window, "size-allocate", G_CALLBACK (on_content_size_changed), NULL);
}
GtkWidget *
diff --git a/panels/mouse/gnome-mouse-properties.ui b/panels/mouse/gnome-mouse-properties.ui
index 018b374a2..f3453b970 100644
--- a/panels/mouse/gnome-mouse-properties.ui
+++ b/panels/mouse/gnome-mouse-properties.ui
@@ -16,141 +16,147 @@
<property name="step_increment">100</property>
<property name="page_increment">100</property>
</object>
- <object class="GtkScrolledWindow" id="scrolled-window">
+ <template class="CcMouseProperties" parent="GtkBin">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">none</property>
- <property name="hscrollbar_policy">never</property>
<child>
- <object class="GtkBox" id="prefs_widget">
+ <object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="margin_top">32</property>
- <property name="margin_bottom">32</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">none</property>
+ <property name="hscrollbar_policy">never</property>
<child>
- <object class="GtkFrame" id="general-frame">
+ <object class="GtkBox" id="prefs_widget">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="shadow_type">in</property>
+ <property name="halign">center</property>
+ <property name="margin_top">32</property>
<property name="margin_bottom">32</property>
- <property name="label_yalign">0.45</property>
- <property name="shadow_type">none</property>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">General</property>
- <property name="margin_bottom">12</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkFrame" id="general-frame-listbox">
+ <object class="GtkFrame" id="general_frame">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">False</property>
<property name="shadow_type">in</property>
+ <property name="margin_bottom">32</property>
+ <property name="label_yalign">0.45</property>
+ <property name="shadow_type">none</property>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">General</property>
+ <property name="margin_bottom">12</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
<child>
- <object class="GtkListBox" id="general-listbox">
+ <object class="GtkFrame" id="general_frame_listbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="selection_mode">none</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkListBoxRow" id="primary-button-row">
+ <object class="GtkListBox" id="general_listbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="activatable">false</property>
+ <property name="selection_mode">none</property>
<child>
- <object class="GtkGrid" id="primary-button-grid">
+ <object class="GtkListBoxRow" id="primary_button_row">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">16</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
- <child>
- <object class="GtkLabel" id="primary-button-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Primary Button</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">primary-button-chooser-grid</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="primary-button-description">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="max-width-chars">20</property>
- <property name="wrap">True</property>
- <property name="wrap-mode">word</property>
- <property name="label" translatable="yes">Sets the order of physical buttons
on mice and touchpads.</property>
- <style>
- <class name="dim-label"/>
- </style>
- <attributes>
- <attribute name="scale" value="0.9"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkGrid" id="primary-button-chooser-grid">
+ <object class="GtkGrid" id="primary_button_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="valign">center</property>
- <property name="column_homogeneous">True</property>
- <style>
- <class name="linked"/>
- </style>
+ <property name="row_spacing">2</property>
+ <property name="column_spacing">16</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
<child>
- <object class="GtkRadioButton" id="primary-button-left">
+ <object class="GtkLabel" id="primary_button_label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="label" translatable="yes">Left</property>
- <property name="draw-indicator">False</property>
- <property name="height_request">35</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Primary Button</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">primary_button_chooser_grid</property>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
</child>
<child>
- <object class="GtkRadioButton" id="primary-button-right">
+ <object class="GtkLabel" id="primary_button_description">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Right</property>
- <property name="draw-indicator">False</property>
- <property name="group">primary-button-left</property>
- <property name="height_request">35</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="max-width-chars">20</property>
+ <property name="wrap">True</property>
+ <property name="wrap-mode">word</property>
+ <property name="label" translatable="yes">Sets the order of physical
buttons on mice and touchpads.</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <attributes>
+ <attribute name="scale" value="0.9"/>
+ </attributes>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="primary_button_chooser_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <property name="column_homogeneous">True</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkRadioButton" id="primary_button_left">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Left</property>
+ <property name="draw-indicator">False</property>
+ <property name="height_request">35</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="primary_button_right">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Right</property>
+ <property name="draw-indicator">False</property>
+ <property name="group">primary_button_left</property>
+ <property name="height_request">35</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
</child>
</object>
</child>
@@ -160,232 +166,60 @@
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkFrame" id="mouse-frame">
- <property name="visible">False</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">none</property>
- <property name="label_yalign">0.45</property>
- <property name="margin_bottom">32</property>
- <child type="label">
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Mouse</property>
- <property name="margin_bottom">12</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
<child>
- <object class="GtkFrame" id="mouse-frame-listbox">
- <property name="visible">True</property>
+ <object class="GtkFrame" id="mouse_frame">
+ <property name="visible">False</property>
<property name="can_focus">False</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkListBox" id="mouse-listbox">
+ <property name="shadow_type">none</property>
+ <property name="label_yalign">0.45</property>
+ <property name="margin_bottom">32</property>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="selection_mode">none</property>
- <child>
- <object class="GtkListBoxRow" id="mouse-row">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activatable">false</property>
- <child>
- <object class="GtkGrid" id="mouse-grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">32</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">8</property>
- <property name="margin_bottom">8</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel" id="mouse-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="valign">end</property>
- <property name="label" translatable="yes">Mouse Speed</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">primary-button-chooser-grid</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScale" id="mouse-speed-scale">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
- <property name="draw_value">False</property>
- <property name="width-request">300</property>
- <property name="halign">end</property>
- <property name="expand">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="mouse_speed_scale-atkobject">
- <property name="AtkObject::accessible-description"
translatable="yes">Double-click timeout</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow" id="mouse-natural-scrolling-row">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activatable">false</property>
- <child>
- <object class="GtkGrid" id="mouse-natural-scrolling-grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">16</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">6</property>
- <property name="margin_bottom">6</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel" id="mouse-natural-scrolling-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments="Translators: This switch
reverses the scrolling direction for mices. The term used comes from OS X so use the same translation if
possible.">Natural Scrolling</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">mouse-natural-scrolling-switch</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="mouse-natural-scrolling-description">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Scrolling moves the content, not
the view.</property>
- <style>
- <class name="dim-label"/>
- </style>
- <attributes>
- <attribute name="scale" value="0.9"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="mouse-natural-scrolling-switch">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">end</property>
- <property name="valign">center</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Mouse</property>
+ <property name="margin_bottom">12</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkFrame" id="touchpad-frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">none</property>
- <property name="label_yalign">0.45</property>
- <child type="label">
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Touchpad</property>
- <property name="margin_bottom">12</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkFrame" id="touchpad-frame-listbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">in</property>
<child>
- <object class="GtkBox" id="touchpad-box">
+ <object class="GtkFrame" id="mouse_frame_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkListBox" id="touchpad-listbox">
+ <object class="GtkListBox" id="mouse_listbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
- <object class="GtkListBoxRow" id="touchpad-toggle-row">
+ <object class="GtkListBoxRow" id="mouse_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
- <object class="GtkGrid" id="touchpad-toggle-grid">
+ <object class="GtkGrid" id="mouse_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">32</property>
<property name="margin_start">20</property>
<property name="margin_end">20</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
<property name="valign">center</property>
<child>
- <object class="GtkLabel" id="touchpad-toggle-label">
+ <object class="GtkLabel" id="mouse_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="valign">end</property>
- <property name="label" translatable="yes">Touchpad</property>
+ <property name="label" translatable="yes">Mouse Speed</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">touchpad-toggle-switch</property>
+ <property name="mnemonic_widget">primary_button_chooser_grid</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -395,12 +229,19 @@
</packing>
</child>
<child>
- <object class="GtkSwitch" id="touchpad-toggle-switch">
+ <object class="GtkScale" id="mouse_speed_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="draw_value">False</property>
+ <property name="width-request">300</property>
<property name="halign">end</property>
- <property name="valign">center</property>
- <property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="expand">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="mouse_speed_scale_atkobject">
+ <property name="AtkObject::accessible-description"
translatable="yes">Double-click timeout</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -413,26 +254,13 @@
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkSeparator">
- <property name="visible">true</property>
- <property name="orientation">horizontal</property>
- </object>
- </child>
- <child>
- <object class="GtkListBox" id="touchpad-options-listbox">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="selection_mode">none</property>
<child>
- <object class="GtkListBoxRow" id="touchpad-natural-scrolling-row">
+ <object class="GtkListBoxRow" id="mouse_natural_scrolling_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
- <object class="GtkGrid" id="touchpad-natural-scrolling-grid">
+ <object class="GtkGrid" id="mouse_natural_scrolling_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">2</property>
@@ -443,14 +271,14 @@
<property name="margin_bottom">6</property>
<property name="valign">center</property>
<child>
- <object class="GtkLabel" id="touchpad-natural-scrolling-label">
+ <object class="GtkLabel" id="mouse_natural_scrolling_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes" comments="Translators: This
switch reverses the scrolling direction for touchpads. The term used comes from OS X so use the same
translation if possible. ">Natural Scrolling</property>
+ <property name="label" translatable="yes" comments="Translators: This
switch reverses the scrolling direction for mices. The term used comes from OS X so use the same translation
if possible.">Natural Scrolling</property>
<property name="use_underline">True</property>
- <property
name="mnemonic_widget">touchpad-natural-scrolling-switch</property>
+ <property
name="mnemonic_widget">mouse_natural_scrolling_switch</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -460,7 +288,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="touchpad-natural-scrolling-description">
+ <object class="GtkLabel" id="mouse_natural_scrolling_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -480,7 +308,7 @@
</packing>
</child>
<child>
- <object class="GtkSwitch" id="touchpad-natural-scrolling-switch">
+ <object class="GtkSwitch" id="mouse_natural_scrolling_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
@@ -497,217 +325,395 @@
</child>
</object>
</child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkFrame" id="touchpad_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">none</property>
+ <property name="label_yalign">0.45</property>
+ <child type="label">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Touchpad</property>
+ <property name="margin_bottom">12</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkFrame" id="touchpad_frame_listbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkBox" id="touchpad_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkListBoxRow" id="touchpad-speed-row">
+ <object class="GtkListBox" id="touchpad_listbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="activatable">false</property>
+ <property name="selection_mode">none</property>
<child>
- <object class="GtkGrid" id="touchpad-speed-grid">
+ <object class="GtkListBoxRow" id="touchpad_toggle_row">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">16</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">8</property>
- <property name="margin_bottom">8</property>
- <property name="valign">center</property>
+ <property name="can_focus">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkLabel" id="touchpad-speed-label">
+ <object class="GtkGrid" id="touchpad_toggle_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="valign">end</property>
- <property name="label" translatable="yes">Touchpad Speed</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">touchpad-speed-scale</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScale" id="touchpad-speed-scale">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">adjustment11</property>
- <property name="draw_value">False</property>
- <property name="expand">True</property>
- <property name="halign">end</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="touchpad_speed_scale-atkobject">
- <property name="AtkObject::accessible-description"
translatable="yes">Double-click timeout</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">32</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="touchpad_toggle_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="valign">end</property>
+ <property name="label" translatable="yes">Touchpad</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">touchpad_toggle_switch</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="touchpad_toggle_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
</child>
</object>
</child>
</object>
</child>
<child>
- <object class="GtkListBoxRow" id="tap-to-click-row">
- <property name="visible">False</property>
+ <object class="GtkSeparator">
+ <property name="visible">true</property>
+ <property name="orientation">horizontal</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBox" id="touchpad_options_listbox">
+ <property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="activatable">false</property>
+ <property name="selection_mode">none</property>
<child>
- <object class="GtkGrid" id="tap-to-click-grid">
+ <object class="GtkListBoxRow" id="touchpad_natural_scrolling_row">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">32</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
- <property name="valign">center</property>
+ <property name="can_focus">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkLabel" id="tap-to-click-label">
+ <object class="GtkGrid" id="touchpad_natural_scrolling_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="valign">end</property>
- <property name="label" translatable="yes">Tap to Click</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">tap-to-click-switch</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="tap-to-click-switch">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">end</property>
+ <property name="row_spacing">2</property>
+ <property name="column_spacing">16</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
<property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="touchpad_natural_scrolling_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes" comments="Translators:
This switch reverses the scrolling direction for touchpads. The term used comes from OS X so use the same
translation if possible. ">Natural Scrolling</property>
+ <property name="use_underline">True</property>
+ <property
name="mnemonic_widget">touchpad_natural_scrolling_switch</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="touchpad_natural_scrolling_description">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Scrolling moves the
content, not the view.</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <attributes>
+ <attribute name="scale" value="0.9"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="touchpad_natural_scrolling_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow" id="two-finger-scrolling-row">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="no_show_all">True</property>
- <property name="activatable">false</property>
<child>
- <object class="GtkGrid" id="two-finger-scrolling-grid">
+ <object class="GtkListBoxRow" id="touchpad_speed_row">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">32</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
- <property name="valign">center</property>
+ <property name="can_focus">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkLabel" id="two-finger-scrolling-label">
+ <object class="GtkGrid" id="touchpad_speed_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="valign">end</property>
- <property name="label" translatable="yes">Two-finger Scrolling</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">two-finger-scrolling-switch</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">16</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="touchpad_speed_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="valign">end</property>
+ <property name="label" translatable="yes">Touchpad Speed</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">touchpad_speed_scale</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="touchpad_speed_scale">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment11</property>
+ <property name="draw_value">False</property>
+ <property name="expand">True</property>
+ <property name="halign">end</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="touchpad_speed_scale_atkobject">
+ <property name="AtkObject::accessible-description"
translatable="yes">Double-click timeout</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="tap_to_click_row">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkSwitch" id="two-finger-scrolling-switch">
+ <object class="GtkGrid" id="tap_to_click_grid">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">end</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">32</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
<property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="tap_to_click_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="valign">end</property>
+ <property name="label" translatable="yes">Tap to Click</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">tap_to_click_switch</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="tap_to_click_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow" id="edge-scrolling-row">
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="no_show_all">True</property>
- <property name="activatable">false</property>
<child>
- <object class="GtkGrid" id="edge-scrolling-grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">32</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">12</property>
- <property name="valign">center</property>
+ <object class="GtkListBoxRow" id="two_finger_scrolling_row">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkLabel" id="edge-scrolling-label">
+ <object class="GtkGrid" id="two_finger_scrolling_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="valign">end</property>
- <property name="label" translatable="yes">Edge Scrolling</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">edge-scrolling-switch</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">32</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="two_finger_scrolling_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="valign">end</property>
+ <property name="label" translatable="yes">Two-finger
Scrolling</property>
+ <property name="use_underline">True</property>
+ <property
name="mnemonic_widget">two_finger_scrolling_switch</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="two_finger_scrolling_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow" id="edge_scrolling_row">
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="activatable">false</property>
<child>
- <object class="GtkSwitch" id="edge-scrolling-switch">
+ <object class="GtkGrid" id="edge_scrolling_grid">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">end</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">32</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">12</property>
<property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="edge_scrolling_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="valign">end</property>
+ <property name="label" translatable="yes">Edge Scrolling</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">edge_scrolling_switch</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="edge_scrolling_switch">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
</child>
</object>
</child>
@@ -723,26 +729,26 @@
</child>
</object>
</child>
- </object>
+ </template>
<object class="GtkSizeGroup">
<property name="mode">vertical</property>
<widgets>
- <widget name="mouse-row"/>
- <widget name="mouse-natural-scrolling-row"/>
- <widget name="touchpad-toggle-row"/>
- <widget name="touchpad-natural-scrolling-row"/>
- <widget name="touchpad-speed-row"/>
- <widget name="tap-to-click-row"/>
- <widget name="edge-scrolling-row"/>
+ <widget name="mouse_row"/>
+ <widget name="mouse_natural_scrolling_row"/>
+ <widget name="touchpad_toggle_row"/>
+ <widget name="touchpad_natural_scrolling_row"/>
+ <widget name="touchpad_speed_row"/>
+ <widget name="tap_to_click_row"/>
+ <widget name="edge_scrolling_row"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
- <widget name="mouse-speed-scale"/>
- <widget name="touchpad-speed-scale"/>
+ <widget name="mouse_speed_scale"/>
+ <widget name="touchpad_speed_scale"/>
</widgets>
</object>
</interface>
diff --git a/panels/mouse/gnome-mouse-test.c b/panels/mouse/gnome-mouse-test.c
index dfaafd733..d631b74e9 100644
--- a/panels/mouse/gnome-mouse-test.c
+++ b/panels/mouse/gnome-mouse-test.c
@@ -32,8 +32,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#define WID(x) (GtkWidget *) gtk_builder_get_object (self->builder, x)
-
/* Click test button sizes. */
#define SHADOW_SIZE (10.0 / 180 * size)
#define SHADOW_SHIFT_Y (-1.0 / 180 * size)
@@ -59,7 +57,11 @@ struct _CcMouseTest
{
GtkBin parent_instance;
- GtkBuilder *builder;
+ GtkWidget *button_drawing_area;
+ GtkWidget *information_label;
+ GtkWidget *image;
+ GtkWidget *scrolled_window_adjustment;
+ GtkWidget *viewport;
guint32 double_click_timestamp;
gint double_click_state;
@@ -81,7 +83,7 @@ test_maybe_timeout (CcMouseTest *self)
{
self->double_click_state = DOUBLE_CLICK_TEST_OFF;
- gtk_widget_queue_draw (WID ("button_drawing_area"));
+ gtk_widget_queue_draw (self->button_drawing_area);
self->button_drawing_area_timeout_id = 0;
@@ -127,7 +129,7 @@ setup_information_label (CcMouseTest *self)
}
if (self->double_click_state == DOUBLE_CLICK_TEST_OFF) {
- gtk_label_set_label (GTK_LABEL (WID ("information_label")), _("Try clicking, double clicking,
scrolling"));
+ gtk_label_set_label (GTK_LABEL (self->information_label), _("Try clicking, double clicking,
scrolling"));
return;
}
@@ -149,7 +151,7 @@ setup_information_label (CcMouseTest *self)
}
label_text = g_strconcat ("<b>", message, "</b>", NULL);
- gtk_label_set_markup (GTK_LABEL (WID ("information_label")), label_text);
+ gtk_label_set_markup (GTK_LABEL (self->information_label), label_text);
self->information_label_timeout_id = g_timeout_add (2500, (GSourceFunc) information_label_timeout,
self);
}
@@ -170,7 +172,7 @@ setup_scroll_image (CcMouseTest *self)
resource = "/org/gnome/control-center/mouse/scroll-test-gegl.svg";
else
resource = "/org/gnome/control-center/mouse/scroll-test.svg";
- gtk_image_set_from_resource (GTK_IMAGE (WID ("image")), resource);
+ gtk_image_set_from_resource (GTK_IMAGE (self->image), resource);
if (self->double_click_state != DOUBLE_CLICK_TEST_GEGL)
return;
@@ -224,7 +226,7 @@ button_drawing_area_button_press_event (GtkWidget *widget,
self->double_click_timestamp = event->time;
- gtk_widget_queue_draw (WID ("button_drawing_area"));
+ gtk_widget_queue_draw (self->button_drawing_area);
self->button_state = event->button;
setup_information_label (self);
@@ -297,23 +299,23 @@ setup_dialog (CcMouseTest *self)
GtkAdjustment *adjustment;
GtkStyleProvider *provider;
- g_signal_connect (WID ("button_drawing_area"), "button_press_event",
+ g_signal_connect (self->button_drawing_area, "button_press_event",
G_CALLBACK (button_drawing_area_button_press_event),
self);
- g_signal_connect (WID ("button_drawing_area"), "draw",
+ g_signal_connect (self->button_drawing_area, "draw",
G_CALLBACK (button_drawing_area_draw_event),
self);
- adjustment = GTK_ADJUSTMENT (WID ("scrolled_window_adjustment"));
+ adjustment = GTK_ADJUSTMENT (self->scrolled_window_adjustment);
gtk_adjustment_set_value (adjustment,
gtk_adjustment_get_upper (adjustment));
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), "* {background: #565854}", -1, NULL);
- gtk_style_context_add_provider (gtk_widget_get_style_context (WID ("viewport")),
+ gtk_style_context_add_provider (gtk_widget_get_style_context (self->viewport),
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- gtk_style_context_add_provider (gtk_widget_get_style_context (WID ("button_drawing_area")),
+ gtk_style_context_add_provider (gtk_widget_get_style_context (self->button_drawing_area),
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
@@ -325,7 +327,6 @@ cc_mouse_test_finalize (GObject *object)
CcMouseTest *self = CC_MOUSE_TEST (object);
g_clear_object (&self->mouse_settings);
- g_clear_object (&self->builder);
if (self->information_label_timeout_id != 0) {
g_source_remove (self->information_label_timeout_id);
@@ -346,12 +347,20 @@ cc_mouse_test_finalize (GObject *object)
}
static void
-cc_mouse_test_class_init (CcMouseTestClass *class)
+cc_mouse_test_class_init (CcMouseTestClass *klass)
{
- GObjectClass *object_class;
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class = G_OBJECT_CLASS (class);
object_class->finalize = cc_mouse_test_finalize;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/mouse/gnome-mouse-test.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, CcMouseTest, button_drawing_area);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseTest, information_label);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseTest, image);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseTest, scrolled_window_adjustment);
+ gtk_widget_class_bind_template_child (widget_class, CcMouseTest, viewport);
}
static void
@@ -359,10 +368,7 @@ cc_mouse_test_init (CcMouseTest *self)
{
g_autoptr(GError) error = NULL;
- self->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (self->builder,
- "/org/gnome/control-center/mouse/gnome-mouse-test.ui",
- &error);
+ gtk_widget_init_template (GTK_WIDGET (self));
self->double_click_timestamp = 0;
self->double_click_state = DOUBLE_CLICK_TEST_OFF;
@@ -374,8 +380,6 @@ cc_mouse_test_init (CcMouseTest *self)
self->button_drawing_area_timeout_id = 0;
self->scroll_image_timeout_id = 0;
- gtk_container_add (GTK_CONTAINER (self), WID ("test_widget"));
-
setup_dialog (self);
}
diff --git a/panels/mouse/gnome-mouse-test.ui b/panels/mouse/gnome-mouse-test.ui
index 1c20ea808..4db9153a8 100644
--- a/panels/mouse/gnome-mouse-test.ui
+++ b/panels/mouse/gnome-mouse-test.ui
@@ -7,6 +7,8 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <template class="CcMouseTest" parent="GtkBin">
+ <child>
<object class="GtkGrid" id="test_widget">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -95,4 +97,6 @@
</packing>
</child>
</object>
+ </child>
+ </template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]