diff options
author | Clement Lefebvre <[email protected]> | 2015-09-03 17:43:46 +0100 |
---|---|---|
committer | Clement Lefebvre <[email protected]> | 2015-09-03 17:43:46 +0100 |
commit | e4c68641268956ff99cef21dc5e5cb3e3b55ccdf (patch) | |
tree | 4bcc1c6a24ff115514529e893238962362fa143e /capplets/mouse/mate-mouse-properties.c | |
parent | 87e013d5c235a034a01391892eac7c888bb27871 (diff) | |
download | mate-control-center-e4c68641268956ff99cef21dc5e5cb3e3b55ccdf.tar.bz2 mate-control-center-e4c68641268956ff99cef21dc5e5cb3e3b55ccdf.tar.xz |
Touchpad settings: Added support for natural scrolling, 2 finger and 3 finger clicks
Diffstat (limited to 'capplets/mouse/mate-mouse-properties.c')
-rw-r--r-- | capplets/mouse/mate-mouse-properties.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c index 94f2a0fb..96c14185 100644 --- a/capplets/mouse/mate-mouse-properties.c +++ b/capplets/mouse/mate-mouse-properties.c @@ -212,6 +212,8 @@ scrollmethod_gsettings_changed_event (GSettings *settings, scroll_method == 2); gtk_widget_set_sensitive (WID ("horiz_scroll_toggle"), scroll_method != 0); + gtk_widget_set_sensitive (WID ("natural_scroll_toggle"), + scroll_method != 0); } static void @@ -223,6 +225,9 @@ scrollmethod_clicked_event (GtkWidget *widget, gtk_widget_set_sensitive (WID ("horiz_scroll_toggle"), !gtk_toggle_button_get_active (disabled)); + gtk_widget_set_sensitive (WID ("natural_scroll_toggle"), + !gtk_toggle_button_get_active (disabled)); + GSList *radio_group; int new_scroll_method; int old_scroll_method = g_settings_get_int (touchpad_settings, "scroll-method"); @@ -347,6 +352,14 @@ find_synaptics (void) return ret; } +static void +comboxbox_changed_callback (GtkWidget *combobox, void *data) +{ + gint value = gtk_combo_box_get_active (GTK_COMBO_BOX (combobox)); + gchar *key = (char *) data; + g_settings_set_int (touchpad_settings, key, value); +} + /* Set up the property editors in the dialog. */ static void setup_dialog (GtkBuilder *dialog) @@ -405,9 +418,31 @@ setup_dialog (GtkBuilder *dialog) g_settings_bind (touchpad_settings, "horiz-scroll-enabled", WID ("horiz_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "natural-scroll", + WID ("natural_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); scrollmethod_gsettings_changed_event (touchpad_settings, "scroll-method", dialog); + char * emulation_values[] = { _("Disabled"), _("Left button"), _("Middle button"), _("Right button") }; + + GtkWidget *two_click_comboxbox = gtk_combo_box_text_new (); + GtkWidget *three_click_comboxbox = gtk_combo_box_text_new (); + gtk_box_pack_start (GTK_BOX (WID ("hbox_two_finger_click")), two_click_comboxbox, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (WID ("hbox_three_finger_click")), three_click_comboxbox, FALSE, FALSE, 6); + int i; + for (i=0; i<4; i++) { + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (two_click_comboxbox), emulation_values[i]); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (three_click_comboxbox), emulation_values[i]); + } + + gtk_combo_box_set_active (GTK_COMBO_BOX (two_click_comboxbox), g_settings_get_int (touchpad_settings, "two-finger-click")); + gtk_combo_box_set_active (GTK_COMBO_BOX (three_click_comboxbox), g_settings_get_int (touchpad_settings, "three-finger-click")); + gtk_widget_show (two_click_comboxbox); + gtk_widget_show (three_click_comboxbox); + g_signal_connect (two_click_comboxbox, "changed", G_CALLBACK (comboxbox_changed_callback), "two-finger-click"); + g_signal_connect (three_click_comboxbox, "changed", G_CALLBACK (comboxbox_changed_callback), "three-finger-click"); + radio = GTK_RADIO_BUTTON (WID ("scroll_disabled_radio")); GSList *radio_group = gtk_radio_button_get_group (radio); GSList *item = NULL; |