From 909bf45d2c2d567decaf57b7869e0fbdcb7c0ed4 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Mon, 22 Oct 2012 16:44:21 +0200 Subject: port mouse applet to gsettings --- capplets/mouse/Makefile.am | 4 +- capplets/mouse/mate-mouse-accessibility.c | 232 ----------- capplets/mouse/mate-mouse-accessibility.h | 33 -- capplets/mouse/mate-mouse-properties.c | 286 +++++-------- capplets/mouse/mate-mouse-properties.ui | 666 ------------------------------ 5 files changed, 104 insertions(+), 1117 deletions(-) delete mode 100644 capplets/mouse/mate-mouse-accessibility.c delete mode 100644 capplets/mouse/mate-mouse-accessibility.h (limited to 'capplets') diff --git a/capplets/mouse/Makefile.am b/capplets/mouse/Makefile.am index c60082a5..c3aa4fc6 100644 --- a/capplets/mouse/Makefile.am +++ b/capplets/mouse/Makefile.am @@ -5,9 +5,7 @@ bin_PROGRAMS = mate-mouse-properties mate_mouse_properties_LDADD = $(MATECC_CAPPLETS_LIBS) mate_mouse_properties_SOURCES = \ - mate-mouse-properties.c \ - mate-mouse-accessibility.c \ - mate-mouse-accessibility.h + mate-mouse-properties.c @INTLTOOL_DESKTOP_RULE@ diff --git a/capplets/mouse/mate-mouse-accessibility.c b/capplets/mouse/mate-mouse-accessibility.c deleted file mode 100644 index a1c4277b..00000000 --- a/capplets/mouse/mate-mouse-accessibility.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2007 Gerd Kohlberger - * - * 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 of the License, 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 . - */ - -#include -#include - -#include "capplet-util.h" -#include "mateconf-property-editor.h" - -#define MT_MATECONF_HOME "/desktop/mate/accessibility/mouse" - -/* 5th entry in combo box */ -#define DIRECTION_DISABLE 4 - -enum { - CLICK_TYPE_SINGLE, - CLICK_TYPE_DOUBLE, - CLICK_TYPE_DRAG, - CLICK_TYPE_SECONDARY, - N_CLICK_TYPES -}; - -static void -update_mode_sensitivity (GtkBuilder *dialog, gint mode) -{ - gtk_widget_set_sensitive (WID ("box_ctw"), !mode); - gtk_widget_set_sensitive (WID ("box_gesture"), mode); -} - -/* check if a direction (gesture mode) is already in use */ -static gboolean -verify_setting (MateConfClient *client, gint value, gint type) -{ - gint i, ct[N_CLICK_TYPES]; - - ct[CLICK_TYPE_SINGLE] = - mateconf_client_get_int (client, - MT_MATECONF_HOME "/dwell_gesture_single", - NULL); - ct[CLICK_TYPE_DOUBLE] = - mateconf_client_get_int (client, - MT_MATECONF_HOME "/dwell_gesture_double", - NULL); - ct[CLICK_TYPE_DRAG] = - mateconf_client_get_int (client, - MT_MATECONF_HOME "/dwell_gesture_drag", - NULL); - ct[CLICK_TYPE_SECONDARY] = - mateconf_client_get_int (client, - MT_MATECONF_HOME "/dwell_gesture_secondary", - NULL); - - for (i = 0; i < N_CLICK_TYPES; ++i) { - if (i == type) - continue; - if (ct[i] == value) - return FALSE; - } - - return TRUE; -} - -static void -populate_gesture_combo (GtkWidget *combo) -{ - GtkListStore *model; - GtkTreeIter iter; - GtkCellRenderer *cr; - - model = gtk_list_store_new (1, G_TYPE_STRING); - - gtk_list_store_append (model, &iter); - /* Translators: this is the gesture to trigger/choose the click type. - Don't include the prefix "gesture|" in the translation. */ - gtk_list_store_set (model, &iter, 0, Q_("gesture|Move left"), -1); - - gtk_list_store_append (model, &iter); - /* Translators: this is the gesture to trigger/choose the click type. - Don't include the prefix "gesture|" in the translation. */ - gtk_list_store_set (model, &iter, 0, Q_("gesture|Move right"), -1); - - gtk_list_store_append (model, &iter); - /* Translators: this is the gesture to trigger/choose the click type. - Don't include the prefix "gesture|" in the translation. */ - gtk_list_store_set (model, &iter, 0, Q_("gesture|Move up"), -1); - - gtk_list_store_append (model, &iter); - /* Translators: this is the gesture to trigger/choose the click type. - Don't include the prefix "gesture|" in the translation. */ - gtk_list_store_set (model, &iter, 0, Q_("gesture|Move down"), -1); - - gtk_list_store_append (model, &iter); - /* Translators: this is the gesture to trigger/choose the click type. - Don't include the prefix "gesture|" in the translation. */ - gtk_list_store_set (model, &iter, 0, Q_("gesture|Disabled"), -1); - - gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (model)); - - cr = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cr, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cr, - "text", 0, - NULL); -} - -static void -delay_enable_toggled_cb (GtkWidget *checkbox, GtkBuilder *dialog) -{ - gtk_widget_set_sensitive (WID ("delay_box"), - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))); -} - -static void -dwell_enable_toggled_cb (GtkWidget *checkbox, GtkBuilder *dialog) -{ - gtk_widget_set_sensitive (WID ("dwell_box"), - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))); -} - -static void -gesture_single (GtkComboBox *combo, gpointer data) -{ - if (!verify_setting (data, gtk_combo_box_get_active (combo), CLICK_TYPE_SINGLE)) - gtk_combo_box_set_active (combo, DIRECTION_DISABLE); -} - -static void -gesture_double (GtkComboBox *combo, gpointer data) -{ - if (!verify_setting (data, gtk_combo_box_get_active (combo), CLICK_TYPE_DOUBLE)) - gtk_combo_box_set_active (combo, DIRECTION_DISABLE); -} - -static void -gesture_drag (GtkComboBox *combo, gpointer data) -{ - if (!verify_setting (data, gtk_combo_box_get_active (combo), CLICK_TYPE_DRAG)) - gtk_combo_box_set_active (combo, DIRECTION_DISABLE); -} - -static void -gesture_secondary (GtkComboBox *combo, gpointer data) -{ - if (!verify_setting (data, gtk_combo_box_get_active (combo), CLICK_TYPE_SECONDARY)) - gtk_combo_box_set_active (combo, DIRECTION_DISABLE); -} - -static void -mateconf_value_changed (MateConfClient *client, - const gchar *key, - MateConfValue *value, - gpointer dialog) -{ - if (g_str_equal (key, MT_MATECONF_HOME "/dwell_mode")) - update_mode_sensitivity (dialog, mateconf_value_get_int (value)); -} - -void -setup_accessibility (GtkBuilder *dialog, MateConfClient *client) -{ - mateconf_client_add_dir (client, MT_MATECONF_HOME, - MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); - g_signal_connect (client, "value_changed", - G_CALLBACK (mateconf_value_changed), dialog); - - mateconf_peditor_new_boolean (NULL, MT_MATECONF_HOME "/dwell_enable", - WID ("dwell_enable"), NULL); - mateconf_peditor_new_boolean (NULL, MT_MATECONF_HOME "/delay_enable", - WID ("delay_enable"), NULL); - mateconf_peditor_new_boolean (NULL, MT_MATECONF_HOME "/dwell_show_ctw", - WID ("dwell_show_ctw"), NULL); - - mateconf_peditor_new_numeric_range (NULL, MT_MATECONF_HOME "/delay_time", - WID ("delay_time"), NULL); - mateconf_peditor_new_numeric_range (NULL, MT_MATECONF_HOME "/dwell_time", - WID ("dwell_time"), NULL); - mateconf_peditor_new_numeric_range (NULL, MT_MATECONF_HOME "/threshold", - WID ("threshold"), NULL); - - mateconf_peditor_new_select_radio (NULL, MT_MATECONF_HOME "/dwell_mode", - gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("dwell_mode_ctw"))), - NULL); - update_mode_sensitivity (dialog, - mateconf_client_get_int (client, - MT_MATECONF_HOME "/dwell_mode", - NULL)); - - populate_gesture_combo (WID ("dwell_gest_single")); - mateconf_peditor_new_combo_box (NULL, MT_MATECONF_HOME "/dwell_gesture_single", - WID ("dwell_gest_single"), NULL); - g_signal_connect (WID ("dwell_gest_single"), "changed", - G_CALLBACK (gesture_single), client); - - populate_gesture_combo (WID ("dwell_gest_double")); - mateconf_peditor_new_combo_box (NULL, MT_MATECONF_HOME "/dwell_gesture_double", - WID ("dwell_gest_double"), NULL); - g_signal_connect (WID ("dwell_gest_double"), "changed", - G_CALLBACK (gesture_double), client); - - populate_gesture_combo (WID ("dwell_gest_drag")); - mateconf_peditor_new_combo_box (NULL, MT_MATECONF_HOME "/dwell_gesture_drag", - WID ("dwell_gest_drag"), NULL); - g_signal_connect (WID ("dwell_gest_drag"), "changed", - G_CALLBACK (gesture_drag), client); - - populate_gesture_combo (WID ("dwell_gest_secondary")); - mateconf_peditor_new_combo_box (NULL, MT_MATECONF_HOME "/dwell_gesture_secondary", - WID ("dwell_gest_secondary"), NULL); - g_signal_connect (WID ("dwell_gest_secondary"), "changed", - G_CALLBACK (gesture_secondary), client); - - g_signal_connect (WID ("delay_enable"), "toggled", - G_CALLBACK (delay_enable_toggled_cb), dialog); - delay_enable_toggled_cb (WID ("delay_enable"), dialog); - g_signal_connect (WID ("dwell_enable"), "toggled", - G_CALLBACK (dwell_enable_toggled_cb), dialog); - dwell_enable_toggled_cb (WID ("dwell_enable"), dialog); -} diff --git a/capplets/mouse/mate-mouse-accessibility.h b/capplets/mouse/mate-mouse-accessibility.h deleted file mode 100644 index 0fd4ad33..00000000 --- a/capplets/mouse/mate-mouse-accessibility.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007 Gerd Kohlberger - * - * 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 of the License, 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 . - */ - -#ifndef __MATE_MOUSE_A11Y_H -#define __MATE_MOUSE_A11Y_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void setup_accessibility (GtkBuilder *dialog, MateConfClient *client); - -#ifdef __cplusplus -} -#endif - -#endif /* __MATE_MOUSE_A11Y_H */ diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c index a1311f5b..6b0f3bf2 100644 --- a/capplets/mouse/mate-mouse-properties.c +++ b/capplets/mouse/mate-mouse-properties.c @@ -27,15 +27,14 @@ #include #include -#include +#include #include #include #include "capplet-util.h" -#include "mateconf-property-editor.h" #include "activate-settings-daemon.h" #include "capplet-stock-icons.h" -#include "mate-mouse-accessibility.h" +//#include "mate-mouse-accessibility.h" #include #include @@ -56,29 +55,18 @@ enum DOUBLE_CLICK_TEST_ON }; -/* We use this in at least half a dozen places, so it makes sense just to - * define the macro */ +#define MOUSE_SCHEMA "org.mate.peripherals-mouse" +#define DOUBLE_CLICK_KEY "double-click" -#define DOUBLE_CLICK_KEY "/desktop/mate/peripherals/mouse/double_click" +#define TOUCHPAD_SCHEMA "org.mate.peripherals-touchpad" /* State in testing the double-click speed. Global for a great deal of * convenience */ static gint double_click_state = DOUBLE_CLICK_TEST_OFF; -/* normalization routines */ -/* All of our scales but double_click are on the range 1->10 as a result, we - * have a few routines to convert from whatever the mateconf key is to our range. - */ -static MateConfValue * -double_click_from_mateconf (MateConfPropertyEditor *peditor, const MateConfValue *value) -{ - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_INT); - mateconf_value_set_int (new_value, CLAMP ((int) floor ((mateconf_value_get_int (value) + 50) / 100.0) * 100, 100, 1000)); - return new_value; -} +static GSettings *mouse_settings = NULL; +static GSettings *touchpad_settings = NULL; static void get_default_mouse_info (int *default_numerator, int *default_denominator, int *default_threshold) @@ -105,86 +93,6 @@ get_default_mouse_info (int *default_numerator, int *default_denominator, int *d } -static MateConfValue * -motion_acceleration_from_mateconf (MateConfPropertyEditor *peditor, - const MateConfValue *value) -{ - MateConfValue *new_value; - gfloat motion_acceleration; - - new_value = mateconf_value_new (MATECONF_VALUE_FLOAT); - - if (mateconf_value_get_float (value) == -1.0) { - int numerator, denominator; - - get_default_mouse_info (&numerator, &denominator, NULL); - - motion_acceleration = CLAMP ((gfloat)(numerator / denominator), 0.2, 6.0); - } - else { - motion_acceleration = CLAMP (mateconf_value_get_float (value), 0.2, 6.0); - } - - if (motion_acceleration >= 1) - mateconf_value_set_float (new_value, motion_acceleration + 4); - else - mateconf_value_set_float (new_value, motion_acceleration * 5); - - return new_value; -} - -static MateConfValue * -motion_acceleration_to_mateconf (MateConfPropertyEditor *peditor, - const MateConfValue *value) -{ - MateConfValue *new_value; - gfloat motion_acceleration; - - new_value = mateconf_value_new (MATECONF_VALUE_FLOAT); - motion_acceleration = CLAMP (mateconf_value_get_float (value), 1.0, 10.0); - - if (motion_acceleration < 5) - mateconf_value_set_float (new_value, motion_acceleration / 5.0); - else - mateconf_value_set_float (new_value, motion_acceleration - 4); - - return new_value; -} - -static MateConfValue * -threshold_from_mateconf (MateConfPropertyEditor *peditor, - const MateConfValue *value) -{ - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_FLOAT); - - if (mateconf_value_get_int (value) == -1) { - int threshold; - - get_default_mouse_info (NULL, NULL, &threshold); - mateconf_value_set_float (new_value, CLAMP (threshold, 1, 10)); - } - else { - mateconf_value_set_float (new_value, CLAMP (mateconf_value_get_int (value), 1, 10)); - } - - return new_value; -} - -static MateConfValue * -drag_threshold_from_mateconf (MateConfPropertyEditor *peditor, - const MateConfValue *value) -{ - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_FLOAT); - - mateconf_value_set_float (new_value, CLAMP (mateconf_value_get_int (value), 1, 10)); - - return new_value; -} - /* Double Click handling */ struct test_data_t @@ -213,29 +121,21 @@ test_maybe_timeout (struct test_data_t *data) static gboolean event_box_button_press_event (GtkWidget *widget, GdkEventButton *event, - MateConfChangeSet *changeset) + gpointer user_data) { gint double_click_time; - MateConfValue *value; static struct test_data_t data; static gint test_on_timeout_id = 0; static gint test_maybe_timeout_id = 0; static guint32 double_click_timestamp = 0; GtkWidget *image; - MateConfClient *client; if (event->type != GDK_BUTTON_PRESS) return FALSE; image = g_object_get_data (G_OBJECT (widget), "image"); - if (!(changeset && mateconf_change_set_check_value (changeset, DOUBLE_CLICK_KEY, &value))) { - client = mateconf_client_get_default(); - double_click_time = mateconf_client_get_int (client, DOUBLE_CLICK_KEY, NULL); - g_object_unref (client); - - } else - double_click_time = mateconf_value_get_int (value); + double_click_time = g_settings_get_int (mouse_settings, DOUBLE_CLICK_KEY); if (test_maybe_timeout_id != 0) g_source_remove (test_maybe_timeout_id); @@ -289,42 +189,53 @@ orientation_radio_button_release_event (GtkWidget *widget, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); } -static MateConfValue * -left_handed_from_mateconf (MateConfPropertyEditor *peditor, - const MateConfValue *value) +static void +orientation_radio_button_toggled (GtkToggleButton *togglebutton, + GtkBuilder *dialog) { - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_INT); - - mateconf_value_set_int (new_value, mateconf_value_get_bool (value)); - - return new_value; + gboolean left_handed; + left_handed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("left_handed_radio"))); + g_settings_set_boolean (mouse_settings, "left-handed", left_handed); } -static MateConfValue * -left_handed_to_mateconf (MateConfPropertyEditor *peditor, - const MateConfValue *value) +static void +scrollmethod_gsettings_changed_event (GSettings *settings, + gchar *key, + GtkBuilder *dialog) { - MateConfValue *new_value; - - new_value = mateconf_value_new (MATECONF_VALUE_BOOL); - - mateconf_value_set_bool (new_value, mateconf_value_get_int (value) == 1); - - return new_value; + int scroll_method = g_settings_get_int (touchpad_settings, "scroll-method"); + gtk_widget_set_sensitive (WID ("scroll_disabled_radio"), + scroll_method == 0); + gtk_widget_set_sensitive (WID ("scroll_edge_radio"), + scroll_method == 1); + gtk_widget_set_sensitive (WID ("scroll_twofinger_radio"), + scroll_method == 2); } static void -scrollmethod_changed_event (MateConfPropertyEditor *peditor, - const gchar *key, - const MateConfValue *value, - GtkBuilder *dialog) +scrollmethod_clicked_event (GtkWidget *widget, + GtkBuilder *dialog) { GtkToggleButton *disabled = GTK_TOGGLE_BUTTON (WID ("scroll_disabled_radio")); gtk_widget_set_sensitive (WID ("horiz_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"); + + if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget))) + return; + + radio_group = g_slist_copy (gtk_radio_button_get_group + (GTK_RADIO_BUTTON (WID ("scroll_disabled_radio")))); + radio_group = g_slist_reverse (radio_group); + new_scroll_method = g_slist_index (radio_group, widget); + g_slist_free (radio_group); + + if (new_scroll_method != old_scroll_method) + g_settings_set_int (touchpad_settings, "scroll-method", new_scroll_method); } static void @@ -436,75 +347,85 @@ find_synaptics (void) /* Set up the property editors in the dialog. */ static void -setup_dialog (GtkBuilder *dialog, MateConfChangeSet *changeset) +setup_dialog (GtkBuilder *dialog) { GtkRadioButton *radio; - GObject *peditor; /* Orientation radio buttons */ radio = GTK_RADIO_BUTTON (WID ("left_handed_radio")); - peditor = mateconf_peditor_new_select_radio - (changeset, "/desktop/mate/peripherals/mouse/left_handed", gtk_radio_button_get_group (radio), - "conv-to-widget-cb", left_handed_from_mateconf, - "conv-from-widget-cb", left_handed_to_mateconf, - NULL); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radio), + g_settings_get_boolean(mouse_settings, "left-handed")); /* explicitly connect to button-release so that you can change orientation with either button */ g_signal_connect (WID ("right_handed_radio"), "button_release_event", G_CALLBACK (orientation_radio_button_release_event), NULL); g_signal_connect (WID ("left_handed_radio"), "button_release_event", G_CALLBACK (orientation_radio_button_release_event), NULL); + g_signal_connect (WID ("left_handed_radio"), "toggled", + G_CALLBACK (orientation_radio_button_toggled), dialog); /* Locate pointer toggle */ - peditor = mateconf_peditor_new_boolean - (changeset, "/desktop/mate/peripherals/mouse/locate_pointer", WID ("locate_pointer_toggle"), NULL); + g_settings_bind (mouse_settings, "locate-pointer", WID ("locate_pointer_toggle"), + "active", G_SETTINGS_BIND_DEFAULT); /* Double-click time */ - peditor = mateconf_peditor_new_numeric_range - (changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"), - "conv-to-widget-cb", double_click_from_mateconf, - NULL); + g_settings_bind (mouse_settings, DOUBLE_CLICK_KEY, + gtk_range_get_adjustment (GTK_RANGE (WID ("delay_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); + gtk_image_set_from_stock (GTK_IMAGE (WID ("double_click_image")), MOUSE_DBLCLCK_OFF, mouse_capplet_dblclck_icon_get_size ()); g_object_set_data (G_OBJECT (WID ("double_click_eventbox")), "image", WID ("double_click_image")); g_signal_connect (WID ("double_click_eventbox"), "button_press_event", - G_CALLBACK (event_box_button_press_event), changeset); + G_CALLBACK (event_box_button_press_event), NULL); /* speed */ - mateconf_peditor_new_numeric_range - (changeset, "/desktop/mate/peripherals/mouse/motion_acceleration", WID ("accel_scale"), - "conv-to-widget-cb", motion_acceleration_from_mateconf, - "conv-from-widget-cb", motion_acceleration_to_mateconf, - NULL); - - mateconf_peditor_new_numeric_range - (changeset, "/desktop/mate/peripherals/mouse/motion_threshold", WID ("sensitivity_scale"), - "conv-to-widget-cb", threshold_from_mateconf, - NULL); + g_settings_bind (mouse_settings, "motion-acceleration", + gtk_range_get_adjustment (GTK_RANGE (WID ("accel_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (mouse_settings, "motion-threshold", + gtk_range_get_adjustment (GTK_RANGE (WID ("sensitivity_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); /* DnD threshold */ - mateconf_peditor_new_numeric_range - (changeset, "/desktop/mate/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"), - "conv-to-widget-cb", drag_threshold_from_mateconf, - NULL); + g_settings_bind (mouse_settings, "drag-threshold", + gtk_range_get_adjustment (GTK_RANGE (WID ("drag_threshold_scale"))), "value", + G_SETTINGS_BIND_DEFAULT); /* Trackpad page */ if (find_synaptics () == FALSE) gtk_notebook_remove_page (GTK_NOTEBOOK (WID ("prefs_widget")), -1); else { - mateconf_peditor_new_boolean - (changeset, "/desktop/mate/peripherals/touchpad/disable_while_typing", WID ("disable_w_typing_toggle"), NULL); - mateconf_peditor_new_boolean - (changeset, "/desktop/mate/peripherals/touchpad/tap_to_click", WID ("tap_to_click_toggle"), NULL); - mateconf_peditor_new_boolean - (changeset, "/desktop/mate/peripherals/touchpad/horiz_scroll_enabled", WID ("horiz_scroll_toggle"), NULL); - radio = GTK_RADIO_BUTTON (WID ("scroll_disabled_radio")); - peditor = mateconf_peditor_new_select_radio - (changeset, "/desktop/mate/peripherals/touchpad/scroll_method", gtk_radio_button_get_group (radio), - NULL); + g_settings_bind (touchpad_settings, "disable-while-typing", + WID ("disable_w_typing_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "tap-to-click", + WID ("tap_to_click_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + g_settings_bind (touchpad_settings, "horiz-scroll-enabled", + WID ("horiz_scroll_toggle"), "active", + G_SETTINGS_BIND_DEFAULT); + radio = GTK_RADIO_BUTTON (WID ("scroll_disabled_radio")); + GSList *radio_group = gtk_radio_button_get_group (radio); + GSList *item; + gint i; + gint scroll_method = g_settings_get_int(touchpad_settings, "scroll-method"); + for (item = radio_group; item != NULL; item = item->next) { + if (i == scroll_method) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(item->data), TRUE); + break; + } + i++; + } synaptics_check_capabilities (dialog); - scrollmethod_changed_event (MATECONF_PROPERTY_EDITOR (peditor), NULL, NULL, dialog); - g_signal_connect (peditor, "value-changed", - G_CALLBACK (scrollmethod_changed_event), dialog); + for (item = radio_group; item != NULL; item = item->next) { + g_signal_connect (G_OBJECT (item->data), "clicked", + G_CALLBACK(scrollmethod_clicked_event), + dialog); + } + g_signal_connect (touchpad_settings, + "changed::scroll-method", + G_CALLBACK(scrollmethod_gsettings_changed_event), + dialog); } } @@ -564,7 +485,7 @@ create_dialog (void) /* Callback issued when a button is clicked on the dialog */ static void -dialog_response_cb (GtkDialog *dialog, gint response_id, MateConfChangeSet *changeset) +dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data) { if (response_id == GTK_RESPONSE_HELP) capplet_help (GTK_WINDOW (dialog), @@ -576,7 +497,6 @@ dialog_response_cb (GtkDialog *dialog, gint response_id, MateConfChangeSet *chan int main (int argc, char **argv) { - MateConfClient *client; GtkBuilder *dialog; GtkWidget *dialog_win, *w; gchar *start_page = NULL; @@ -587,7 +507,7 @@ main (int argc, char **argv) G_OPTION_ARG_STRING, &start_page, /* TRANSLATORS: don't translate the terms in brackets */ - N_("Specify the name of the page to show (general|accessibility)"), + N_("Specify the name of the page to show (general)"), N_("page") }, {NULL} }; @@ -600,15 +520,14 @@ main (int argc, char **argv) activate_settings_daemon (); - client = mateconf_client_get_default (); - mateconf_client_add_dir (client, "/desktop/mate/peripherals/mouse", MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); - mateconf_client_add_dir (client, "/desktop/mate/peripherals/touchpad", MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL); + mouse_settings = g_settings_new (MOUSE_SCHEMA); + touchpad_settings = g_settings_new (TOUCHPAD_SCHEMA); dialog = create_dialog (); if (dialog) { - setup_dialog (dialog, NULL); - setup_accessibility (dialog, client); + setup_dialog (dialog); + //setup_accessibility (dialog); dialog_win = WID ("mouse_properties_dialog"); g_signal_connect (dialog_win, "response", @@ -641,7 +560,8 @@ main (int argc, char **argv) g_object_unref (dialog); } - g_object_unref (client); + g_object_unref (mouse_settings); + g_object_unref (touchpad_settings); return 0; } diff --git a/capplets/mouse/mate-mouse-properties.ui b/capplets/mouse/mate-mouse-properties.ui index b855ff11..edc91a8c 100644 --- a/capplets/mouse/mate-mouse-properties.ui +++ b/capplets/mouse/mate-mouse-properties.ui @@ -706,672 +706,6 @@ False - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - vertical - 18 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Simulated Secondary Click - - - - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - _Trigger secondary click by holding down the primary button - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - - - True - 12 - - - True - 0 - _Delay: - True - center - delay_time - - - False - False - 0 - - - - - True - 6 - - - True - 1 - 0.4699999988079071 - Short - - - - - - - False - False - 0 - - - - - True - True - discontinuous - adjustment5 - False - - - - - - Cursor blinks speed - - - - - 1 - - - - - True - 0 - Long - - - - - - - False - False - 2 - - - - - 1 - - - - - - - 1 - - - - - - - 1 - - - - - False - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Dwell Click - - - - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - _Initiate click when stopping pointer movement - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - True - 2 - 3 - 12 - 6 - - - True - 0 - _Motion threshold: - True - center - threshold - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - 0 - D_elay: - True - center - dwell_time - - - GTK_FILL - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 - - - True - 1 - Short - center - - - - - - - False - 0 - - - - - True - True - discontinuous - adjustment6 - False - right - - - 1 - - - - - True - 0 - Long - center - - - - - - - False - 2 - - - - - 1 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 - - - True - 1 - Small - center - - - - - - - False - 0 - - - - - True - True - discontinuous - adjustment7 - 0 - False - - - 1 - - - - - True - 0 - Large - center - - - - - - - False - 2 - - - - - 1 - 3 - 1 - 2 - - - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - Choose type of click _beforehand - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - True - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - Show click type _window - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-dialog-info - - - False - 0 - - - - - 320 - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - You can also use the Dwell Click panel applet to choose the click type. - True - - - - - - 1 - - - - - 1 - - - - - - - 1 - - - - - False - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - vertical - 6 - - - Choose type of click with mo_use gestures - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - True - True - dwell_mode_ctw - - - 0 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 2 - 12 - 6 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 3 - 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Seco_ndary click: - True - dwell_gest_secondary - - - 3 - 4 - GTK_FILL - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - D_rag click: - True - dwell_gest_drag - - - 2 - 3 - GTK_FILL - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - D_ouble click: - True - dwell_gest_double - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - _Single click: - True - dwell_gest_single - - - GTK_FILL - GTK_FILL - - - - - - - 1 - - - - - False - 1 - - - - - 1 - - - - - - - 1 - - - - - - - 1 - - - - - False - 1 - - - - - - - True - Accessibility - center - - - 1 - False - - True -- cgit v1.2.1