mouse: Merge CcMouseProperties into CcMousePanel

This commit is contained in:
Robert Ancell 2018-11-09 12:29:02 +13:00
parent 20614e98ac
commit ef6c7c03ca
8 changed files with 1083 additions and 1235 deletions

View file

@ -21,28 +21,344 @@
*
*/
#include <gdesktop-enums.h>
#include <gtk/gtk.h>
#include "cc-mouse-caps-helper.h"
#include "cc-mouse-panel.h"
#include "cc-mouse-resources.h"
#include "cc-mouse-test.h"
#include "gnome-mouse-properties.h"
#include "gsd-device-manager.h"
#include "gsd-input-helper.h"
#include "list-box-helper.h"
struct _CcMousePanel
{
CcPanel parent_instance;
CcMouseProperties *mouse_properties;
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;
CcMouseTest *mouse_test;
GtkWidget *primary_button_left;
GtkWidget *primary_button_right;
GtkWidget *scrolled_window;
GtkStack *stack;
GtkWidget *tap_to_click_row;
GtkWidget *tap_to_click_switch;
GtkButton *test_button;
GtkWidget *touchpad_frame;
GtkWidget *touchpad_listbox;
GtkWidget *touchpad_natural_scrolling_row;
GtkWidget *touchpad_natural_scrolling_switch;
GtkWidget *touchpad_speed_row;
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;
GSettings *touchpad_settings;
GsdDeviceManager *device_manager;
guint device_added_id;
guint device_removed_id;
gboolean have_mouse;
gboolean have_touchpad;
gboolean have_touchscreen;
gboolean have_synaptics;
gboolean left_handed;
GtkGesture *left_gesture;
GtkGesture *right_gesture;
};
CC_PANEL_REGISTER (CcMousePanel, cc_mouse_panel)
static void
setup_touchpad_options (CcMousePanel *self)
{
gboolean edge_scroll_enabled;
gboolean two_finger_scroll_enabled;
gboolean have_two_finger_scrolling;
gboolean have_edge_scrolling;
gboolean have_tap_to_click;
if (self->have_synaptics || !self->have_touchpad) {
gtk_widget_hide (self->touchpad_frame);
return;
}
cc_touchpad_check_capabilities (&have_two_finger_scrolling, &have_edge_scrolling, &have_tap_to_click);
gtk_widget_show (self->touchpad_frame);
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 */
gtk_switch_set_active (GTK_SWITCH (self->edge_scrolling_switch), FALSE);
}
}
static void
two_finger_scrolling_changed_event (CcMousePanel *self,
gboolean state)
{
/* Updating the setting will cause the "state" of the switch to be updated. */
g_settings_set_boolean (self->touchpad_settings, "two-finger-scrolling-enabled", state);
/* Disable edge scrolling if two-finger scrolling is enabled */
if (state && gtk_widget_get_visible (self->edge_scrolling_row))
gtk_switch_set_active (GTK_SWITCH (self->edge_scrolling_switch), FALSE);
}
static void
edge_scrolling_changed_event (CcMousePanel *self,
gboolean state)
{
/* Updating the setting will cause the "state" of the switch to be updated. */
g_settings_set_boolean (self->touchpad_settings, "edge-scrolling-enabled", state);
/* Disable two-finger scrolling if edge scrolling is enabled */
if (state && gtk_widget_get_visible (self->two_finger_scrolling_row))
gtk_switch_set_active (GTK_SWITCH (self->two_finger_scrolling_switch), FALSE);
}
static gboolean
get_touchpad_enabled (GSettings *settings)
{
GDesktopDeviceSendEvents send_events;
send_events = g_settings_get_enum (settings, "send-events");
return send_events == G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED;
}
static gboolean
show_touchpad_enabling_switch (CcMousePanel *self)
{
if (!self->have_touchpad)
return FALSE;
g_debug ("Should we show the touchpad disable switch: have_mouse: %s have_touchscreen: %s\n",
self->have_mouse ? "true" : "false",
self->have_touchscreen ? "true" : "false");
/* Let's show the button when a mouse or touchscreen is present */
if (self->have_mouse || self->have_touchscreen)
return TRUE;
/* Let's also show when the touchpad is disabled. */
if (!get_touchpad_enabled (self->touchpad_settings))
return TRUE;
return FALSE;
}
static gboolean
touchpad_enabled_get_mapping (GValue *value,
GVariant *variant,
gpointer user_data)
{
gboolean enabled;
enabled = g_strcmp0 (g_variant_get_string (variant, NULL), "enabled") == 0;
g_value_set_boolean (value, enabled);
return TRUE;
}
static GVariant *
touchpad_enabled_set_mapping (const GValue *value,
const GVariantType *type,
gpointer user_data)
{
gboolean enabled;
enabled = g_value_get_boolean (value);
return g_variant_new_string (enabled ? "enabled" : "disabled");
}
static void
handle_secondary_button (CcMousePanel *self,
GtkWidget *button,
GtkGesture *gesture)
{
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect_swapped (gesture, "pressed", G_CALLBACK (gtk_button_clicked), button);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE);
}
/* Set up the property editors in the dialog. */
static void
setup_dialog (CcMousePanel *self)
{
GtkWidget *button;
self->left_handed = g_settings_get_boolean (self->mouse_settings, "left-handed");
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",
self->primary_button_left, "active",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
g_settings_bind (self->mouse_settings, "left-handed",
self->primary_button_right, "active",
G_SETTINGS_BIND_DEFAULT);
/* Allow changing orientation with either button */
button = self->primary_button_right;
self->right_gesture = gtk_gesture_multi_press_new (button);
handle_secondary_button (self, button, self->right_gesture);
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",
self->mouse_natural_scrolling_switch, "active",
G_SETTINGS_BIND_DEFAULT);
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 (self->mouse_frame, self->have_mouse);
g_settings_bind (self->mouse_settings, "speed",
gtk_range_get_adjustment (GTK_RANGE (self->mouse_speed_scale)), "value",
G_SETTINGS_BIND_DEFAULT);
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 (self->touchpad_toggle_switch, show_touchpad_enabling_switch (self));
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
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",
self->touchpad_natural_scrolling_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->touchpad_speed_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->tap_to_click_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->two_finger_scrolling_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->edge_scrolling_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind (self->touchpad_settings, "natural-scroll",
self->touchpad_natural_scrolling_switch, "active",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "speed",
gtk_range_get_adjustment (GTK_RANGE (self->touchpad_speed_scale)), "value",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "tap-to-click",
self->tap_to_click_switch, "active",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "two-finger-scrolling-enabled",
self->two_finger_scrolling_switch, "state",
G_SETTINGS_BIND_GET);
g_settings_bind (self->touchpad_settings, "edge-scrolling-enabled",
self->edge_scrolling_switch, "state",
G_SETTINGS_BIND_GET);
setup_touchpad_options (self);
}
/* Callback issued when a button is clicked on the dialog */
static void
device_changed (GsdDeviceManager *device_manager,
GsdDevice *device,
CcMousePanel *self)
{
self->have_touchpad = touchpad_is_present ();
setup_touchpad_options (self);
self->have_mouse = mouse_is_present ();
gtk_widget_set_visible (self->mouse_frame, self->have_mouse);
gtk_widget_set_visible (self->touchpad_toggle_switch, show_touchpad_enabling_switch (self));
}
static void
on_content_size_changed (CcMousePanel *self,
GtkAllocation *allocation)
{
if (allocation->height < 490)
{
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
}
else
{
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (self->scrolled_window), 490);
}
}
static void
cc_mouse_panel_dispose (GObject *object)
{
CcMousePanel *self = CC_MOUSE_PANEL (object);
g_clear_object (&self->mouse_settings);
g_clear_object (&self->gsd_mouse_settings);
g_clear_object (&self->touchpad_settings);
g_clear_object (&self->right_gesture);
g_clear_object (&self->left_gesture);
if (self->device_manager != NULL) {
g_signal_handler_disconnect (self->device_manager, self->device_added_id);
self->device_added_id = 0;
g_signal_handler_disconnect (self->device_manager, self->device_removed_id);
self->device_removed_id = 0;
self->device_manager = NULL;
}
G_OBJECT_CLASS (cc_mouse_panel_parent_class)->dispose (object);
}
@ -58,7 +374,7 @@ test_button_toggled_cb (CcMousePanel *self)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->test_button)))
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->mouse_test));
else
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->mouse_properties));
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->scrolled_window));
}
static void
@ -79,9 +395,27 @@ cc_mouse_panel_init (CcMousePanel *self)
{
g_resources_register (cc_mouse_get_resource ());
cc_mouse_properties_get_type ();
cc_mouse_test_get_type ();
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");
self->touchpad_settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
self->device_manager = gsd_device_manager_get ();
self->device_added_id = g_signal_connect (self->device_manager, "device-added",
G_CALLBACK (device_changed), self);
self->device_removed_id = g_signal_connect (self->device_manager, "device-removed",
G_CALLBACK (device_changed), self);
self->have_mouse = mouse_is_present ();
self->have_touchpad = touchpad_is_present ();
self->have_touchscreen = touchscreen_is_present ();
self->have_synaptics = cc_synaptics_check ();
if (self->have_synaptics)
g_warning ("Detected synaptics X driver, please migrate to libinput");
setup_dialog (self);
}
static void
@ -98,10 +432,33 @@ cc_mouse_panel_class_init (CcMousePanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/mouse/cc-mouse-panel.ui");
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_properties);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, edge_scrolling_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, edge_scrolling_switch);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, general_listbox);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_frame);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_listbox);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_natural_scrolling_switch);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_speed_scale);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, mouse_test);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, primary_button_left);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, primary_button_right);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, scrolled_window);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, stack);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, tap_to_click_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, tap_to_click_switch);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, test_button);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_frame);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_listbox);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_natural_scrolling_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_natural_scrolling_switch);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_speed_scale);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, touchpad_toggle_switch);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, two_finger_scrolling_row);
gtk_widget_class_bind_template_child (widget_class, CcMousePanel, two_finger_scrolling_switch);
gtk_widget_class_bind_template_callback (widget_class, edge_scrolling_changed_event);
gtk_widget_class_bind_template_callback (widget_class, on_content_size_changed);
gtk_widget_class_bind_template_callback (widget_class, test_button_toggled_cb);
gtk_widget_class_bind_template_callback (widget_class, two_finger_scrolling_changed_event);
}

View file

@ -7,8 +7,701 @@
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<child>
<object class="CcMouseProperties" id="mouse_properties">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property>
<property name="hscrollbar_policy">never</property>
<signal name="size-allocate" handler="on_content_size_changed" object="CcMousePanel" swapped="yes"/>
<child>
<object class="GtkBox" id="prefs_widget">
<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>
<child>
<object class="GtkFrame" id="general_frame">
<property name="visible">True</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="GtkFrame" id="general_frame_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="general_listbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="primary_button_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="primary_button_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">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_row</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>
<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>
</child>
</object>
</child>
</object>
</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>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<child>
<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="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">mouse_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="mouse_speed_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">mouse_speed_adjustment</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>
</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="GtkListBox" id="touchpad_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">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="touchpad_toggle_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>
<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>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="touchpad_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">
<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="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>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="touchpad_speed_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="touchpad_speed_grid">
<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>
<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">touchpad_speed_adjustment</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>
</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="GtkGrid" id="tap_to_click_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>
<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>
</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="activatable">false</property>
<child>
<object class="GtkGrid" id="two_finger_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>
<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>
<signal name="state-set" handler="two_finger_scrolling_changed_event" object="CcMousePanel" swapped="yes"/>
</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="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>
<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>
<signal name="state-set" handler="edge_scrolling_changed_event" object="CcMousePanel" swapped="yes"/>
</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>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
@ -29,4 +722,31 @@
<class name="text-button"/>
</style>
</object>
<object class="GtkAdjustment" id="mouse_speed_adjustment">
<property name="lower">-1</property>
<property name="upper">1</property>
</object>
<object class="GtkAdjustment" id="touchpad_speed_adjustment">
<property name="lower">-1</property>
<property name="upper">1</property>
</object>
<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"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="mouse_speed_scale"/>
<widget name="touchpad_speed_scale"/>
</widgets>
</object>
</interface>

View file

@ -1,444 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2001, 2012 Red Hat, Inc.
* Copyright (C) 2001 Ximian, Inc.
*
* Written by: Jonathon Blandford <jrb@redhat.com>,
* Bradford Hovinen <hovinen@ximian.com>,
* Ondrej Holy <oholy@redhat.com>,
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <glib/gi18n.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gnome-settings-daemon/gsd-enums.h>
#include <math.h>
#include <gdesktop-enums.h>
#include "gnome-mouse-properties.h"
#include "gsd-input-helper.h"
#include "gsd-device-manager.h"
#include "list-box-helper.h"
#include "cc-mouse-caps-helper.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
struct _CcMouseProperties
{
GtkBin parent_instance;
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_row;
GtkWidget *touchpad_natural_scrolling_switch;
GtkWidget *touchpad_speed_row;
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;
GSettings *touchpad_settings;
GsdDeviceManager *device_manager;
guint device_added_id;
guint device_removed_id;
gboolean have_mouse;
gboolean have_touchpad;
gboolean have_touchscreen;
gboolean have_synaptics;
gboolean left_handed;
GtkGesture *left_gesture;
GtkGesture *right_gesture;
};
G_DEFINE_TYPE (CcMouseProperties, cc_mouse_properties, GTK_TYPE_BIN);
static void
setup_touchpad_options (CcMouseProperties *self)
{
gboolean edge_scroll_enabled;
gboolean two_finger_scroll_enabled;
gboolean have_two_finger_scrolling;
gboolean have_edge_scrolling;
gboolean have_tap_to_click;
if (self->have_synaptics || !self->have_touchpad) {
gtk_widget_hide (self->touchpad_frame);
return;
}
cc_touchpad_check_capabilities (&have_two_finger_scrolling, &have_edge_scrolling, &have_tap_to_click);
gtk_widget_show (self->touchpad_frame);
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 */
gtk_switch_set_active (GTK_SWITCH (self->edge_scrolling_switch), FALSE);
}
}
static void
two_finger_scrolling_changed_event (CcMouseProperties *self,
gboolean state)
{
/* Updating the setting will cause the "state" of the switch to be updated. */
g_settings_set_boolean (self->touchpad_settings, "two-finger-scrolling-enabled", state);
if (state && gtk_widget_get_visible (self->edge_scrolling_row)) {
/* Disable edge scrolling if two-finger scrolling is enabled */
gtk_switch_set_active (GTK_SWITCH (self->edge_scrolling_switch), FALSE);
}
}
static void
edge_scrolling_changed_event (CcMouseProperties *self,
gboolean state)
{
/* Updating the setting will cause the "state" of the switch to be updated. */
g_settings_set_boolean (self->touchpad_settings, "edge-scrolling-enabled", state);
if (state && gtk_widget_get_visible (self->two_finger_scrolling_row)) {
/* Disable two-finger scrolling if edge scrolling is enabled */
gtk_switch_set_active (GTK_SWITCH (self->two_finger_scrolling_switch), FALSE);
}
}
static gboolean
get_touchpad_enabled (GSettings *settings)
{
GDesktopDeviceSendEvents send_events;
send_events = g_settings_get_enum (settings, "send-events");
return send_events == G_DESKTOP_DEVICE_SEND_EVENTS_ENABLED;
}
static gboolean
show_touchpad_enabling_switch (CcMouseProperties *self)
{
if (!self->have_touchpad)
return FALSE;
g_debug ("Should we show the touchpad disable switch: have_mouse: %s have_touchscreen: %s\n",
self->have_mouse ? "true" : "false",
self->have_touchscreen ? "true" : "false");
/* Let's show the button when a mouse or touchscreen is present */
if (self->have_mouse || self->have_touchscreen)
return TRUE;
/* Let's also show when the touchpad is disabled. */
if (!get_touchpad_enabled (self->touchpad_settings))
return TRUE;
return FALSE;
}
static gboolean
touchpad_enabled_get_mapping (GValue *value,
GVariant *variant,
gpointer user_data)
{
gboolean enabled;
enabled = g_strcmp0 (g_variant_get_string (variant, NULL), "enabled") == 0;
g_value_set_boolean (value, enabled);
return TRUE;
}
static GVariant *
touchpad_enabled_set_mapping (const GValue *value,
const GVariantType *type,
gpointer user_data)
{
gboolean enabled;
enabled = g_value_get_boolean (value);
return g_variant_new_string (enabled ? "enabled" : "disabled");
}
static void
handle_secondary_button (CcMouseProperties *self,
GtkWidget *button,
GtkGesture *gesture)
{
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect_swapped (gesture, "pressed", G_CALLBACK (gtk_button_clicked), button);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE);
}
/* Set up the property editors in the dialog. */
static void
setup_dialog (CcMouseProperties *self)
{
GtkWidget *button;
self->left_handed = g_settings_get_boolean (self->mouse_settings, "left-handed");
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",
self->primary_button_left, "active",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN);
g_settings_bind (self->mouse_settings, "left-handed",
self->primary_button_right, "active",
G_SETTINGS_BIND_DEFAULT);
/* Allow changing orientation with either button */
button = self->primary_button_right;
self->right_gesture = gtk_gesture_multi_press_new (button);
handle_secondary_button (self, button, self->right_gesture);
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",
self->mouse_natural_scrolling_switch, "active",
G_SETTINGS_BIND_DEFAULT);
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 (self->mouse_frame, self->have_mouse);
g_settings_bind (self->mouse_settings, "speed",
gtk_range_get_adjustment (GTK_RANGE (self->mouse_speed_scale)), "value",
G_SETTINGS_BIND_DEFAULT);
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 (self->touchpad_toggle_switch,
show_touchpad_enabling_switch (self));
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
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",
self->touchpad_natural_scrolling_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->touchpad_speed_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->tap_to_click_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->two_finger_scrolling_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind_with_mapping (self->touchpad_settings, "send-events",
self->edge_scrolling_row, "sensitive",
G_SETTINGS_BIND_GET,
touchpad_enabled_get_mapping,
touchpad_enabled_set_mapping,
NULL, NULL);
g_settings_bind (self->touchpad_settings, "natural-scroll",
self->touchpad_natural_scrolling_switch, "active",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "speed",
gtk_range_get_adjustment (GTK_RANGE (self->touchpad_speed_scale)), "value",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "tap-to-click",
self->tap_to_click_switch, "active",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (self->touchpad_settings, "two-finger-scrolling-enabled",
self->two_finger_scrolling_switch, "state",
G_SETTINGS_BIND_GET);
g_settings_bind (self->touchpad_settings, "edge-scrolling-enabled",
self->edge_scrolling_switch, "state",
G_SETTINGS_BIND_GET);
setup_touchpad_options (self);
}
/* Callback issued when a button is clicked on the dialog */
static void
device_changed (GsdDeviceManager *device_manager,
GsdDevice *device,
CcMouseProperties *self)
{
self->have_touchpad = touchpad_is_present ();
setup_touchpad_options (self);
self->have_mouse = mouse_is_present ();
gtk_widget_set_visible (self->mouse_frame, self->have_mouse);
gtk_widget_set_visible (self->touchpad_toggle_switch,
show_touchpad_enabling_switch (self));
}
static void
on_content_size_changed (CcMouseProperties *self,
GtkAllocation *allocation)
{
if (allocation->height < 490) {
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
} else {
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (self->scrolled_window), 490);
}
}
static void
cc_mouse_properties_finalize (GObject *object)
{
CcMouseProperties *self = CC_MOUSE_PROPERTIES (object);
g_clear_object (&self->mouse_settings);
g_clear_object (&self->gsd_mouse_settings);
g_clear_object (&self->touchpad_settings);
g_clear_object (&self->right_gesture);
g_clear_object (&self->left_gesture);
if (self->device_manager != NULL) {
g_signal_handler_disconnect (self->device_manager, self->device_added_id);
self->device_added_id = 0;
g_signal_handler_disconnect (self->device_manager, self->device_removed_id);
self->device_removed_id = 0;
self->device_manager = NULL;
}
G_OBJECT_CLASS (cc_mouse_properties_parent_class)->finalize (object);
}
static void
cc_mouse_properties_class_init (CcMousePropertiesClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
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_row);
gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_natural_scrolling_switch);
gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, touchpad_speed_row);
gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, tap_to_click_row);
gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, two_finger_scrolling_row);
gtk_widget_class_bind_template_child (widget_class, CcMouseProperties, edge_scrolling_row);
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);
gtk_widget_class_bind_template_callback (widget_class, edge_scrolling_changed_event);
gtk_widget_class_bind_template_callback (widget_class, two_finger_scrolling_changed_event);
gtk_widget_class_bind_template_callback (widget_class, on_content_size_changed);
}
static void
cc_mouse_properties_init (CcMouseProperties *self)
{
g_autoptr(GError) error = NULL;
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");
self->touchpad_settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
self->device_manager = gsd_device_manager_get ();
self->device_added_id = g_signal_connect (self->device_manager, "device-added",
G_CALLBACK (device_changed), self);
self->device_removed_id = g_signal_connect (self->device_manager, "device-removed",
G_CALLBACK (device_changed), self);
self->have_mouse = mouse_is_present ();
self->have_touchpad = touchpad_is_present ();
self->have_touchscreen = touchscreen_is_present ();
self->have_synaptics = cc_synaptics_check ();
if (self->have_synaptics)
g_warning ("Detected synaptics X driver, please migrate to libinput");
setup_dialog (self);
}
GtkWidget *
cc_mouse_properties_new (void)
{
return (GtkWidget *) g_object_new (CC_TYPE_MOUSE_PROPERTIES, NULL);
}

View file

@ -1,38 +0,0 @@
/* -*- mode: c; style: linux -*- */
/* mouse-properties-capplet.c
* Copyright (C) 2001 Red Hat, Inc.
* Copyright (C) 2001 Ximian, Inc.
*
* Written by: Jonathon Blandford <jrb@redhat.com>,
* Bradford Hovinen <hovinen@ximian.com>,
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <gtk/gtk.h>
#ifndef _CC_MOUSE_PROPERTIES_H
#define _CC_MOUSE_PROPERTIES_H
G_BEGIN_DECLS
#define CC_TYPE_MOUSE_PROPERTIES (cc_mouse_properties_get_type ())
G_DECLARE_FINAL_TYPE (CcMouseProperties, cc_mouse_properties, CC, MOUSE_PROPERTIES, GtkBin)
GtkWidget *cc_mouse_properties_new (void);
G_END_DECLS
#endif /* _CC_MOUSE_PROPERTIES_H */

View file

@ -1,742 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">-1</property>
<property name="upper">1</property>
</object>
<object class="GtkAdjustment" id="adjustment11">
<property name="lower">-1</property>
<property name="upper">1</property>
</object>
<object class="GtkAdjustment" id="adjustment4">
<property name="lower">100</property>
<property name="upper">1000</property>
<property name="value">400</property>
<property name="step_increment">100</property>
<property name="page_increment">100</property>
</object>
<template class="CcMouseProperties" parent="GtkBin">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property>
<property name="hscrollbar_policy">never</property>
<signal name="size-allocate" handler="on_content_size_changed" object="CcMouseProperties" swapped="yes"/>
<child>
<object class="GtkBox" id="prefs_widget">
<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>
<child>
<object class="GtkFrame" id="general_frame">
<property name="visible">True</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="GtkFrame" id="general_frame_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="general_listbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="primary_button_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="primary_button_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">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_row</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>
<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>
</child>
</object>
</child>
</object>
</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>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<child>
<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="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">mouse_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="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>
</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="GtkListBox" id="touchpad_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">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="touchpad_toggle_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>
<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>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="touchpad_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">
<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="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>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="touchpad_speed_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">false</property>
<child>
<object class="GtkGrid" id="touchpad_speed_grid">
<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>
<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>
</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="GtkGrid" id="tap_to_click_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>
<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>
</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="activatable">false</property>
<child>
<object class="GtkGrid" id="two_finger_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>
<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>
<signal name="state-set" handler="two_finger_scrolling_changed_event" object="CcMouseProperties" swapped="yes"/>
</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="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>
<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>
<signal name="state-set" handler="edge_scrolling_changed_event" object="CcMouseProperties" swapped="yes"/>
</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>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</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"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="mouse_speed_scale"/>
<widget name="touchpad_speed_scale"/>
</widgets>
</object>
</interface>

View file

@ -20,7 +20,6 @@ i18n.merge_file(
resource_data = files(
'cc-mouse-panel.ui',
'cc-mouse-test.ui',
'gnome-mouse-properties.ui',
'scroll-test-gegl.svg',
'scroll-test.svg'
)
@ -37,7 +36,6 @@ sources = common_sources + files(
'cc-mouse-panel.c',
'cc-mouse-caps-helper.c',
'cc-mouse-test.c',
'gnome-mouse-properties.c',
)
deps = common_deps + [

View file

@ -3,7 +3,6 @@
<gresource prefix="/org/gnome/control-center/mouse">
<file preprocess="xml-stripblanks">cc-mouse-panel.ui</file>
<file preprocess="xml-stripblanks">cc-mouse-test.ui</file>
<file preprocess="xml-stripblanks">gnome-mouse-properties.ui</file>
<file>scroll-test.svg</file>
<file>scroll-test-gegl.svg</file>
</gresource>

View file

@ -65,8 +65,6 @@ panels/mouse/cc-mouse-panel.ui
panels/mouse/cc-mouse-test.c
panels/mouse/cc-mouse-test.ui
panels/mouse/gnome-mouse-panel.desktop.in.in
panels/mouse/gnome-mouse-properties.c
panels/mouse/gnome-mouse-properties.ui
panels/network/cc-network-panel.c
panels/network/cc-network-panel.ui
panels/network/cc-wifi-connection-row.c