[gpointing-device-settings] separate touchpad_off and tapping and scrolling off.
- From: Hiroyuki Ikezoe <hiikezoe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gpointing-device-settings] separate touchpad_off and tapping and scrolling off.
- Date: Thu, 14 Jan 2010 10:35:42 +0000 (UTC)
commit 49614a87c4f27619679cd83e13eac68c1be1f98d
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date: Thu Jan 14 19:34:55 2010 +0900
separate touchpad_off and tapping and scrolling off.
data/touchpad.ui | 50 ++++++++++++-------------------
modules/gpds-touchpad-ui.c | 70 +++++++++++++++++++++++++++++++++++++------
2 files changed, 79 insertions(+), 41 deletions(-)
---
diff --git a/data/touchpad.ui b/data/touchpad.ui
index a6df643..dafe9d2 100644
--- a/data/touchpad.ui
+++ b/data/touchpad.ui
@@ -103,6 +103,17 @@
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
+ <object class="GtkCheckButton" id="disable_touchpad">
+ <property name="label" translatable="yes">_Disable touchpad</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="general_frame">
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
@@ -122,38 +133,15 @@
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkListStore" id="general_use_list_store">
- <columns>
- <column type="gint"/>
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0">1</col>
- <col id="1">Touchpad on</col>
- </row>
- <row>
- <col id="0">2</col>
- <col id="1">Touchpad off</col>
- </row>
- <row>
- <col id="0">3</col>
- <col id="1">Touchpad tapping and scrolling off</col>
- </row>
- </data>
- </object>
- <object class="GtkComboBox" id="touchpad_use_type">
- <property name="model">general_use_list_store</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">True</property>
- <property name="active">0</property>
- <child>
- <object class="GtkCellRendererText" id="touchpad_use_type_text"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
+ <object class="GtkCheckButton" id="disable_tapping_and_scrolling">
+ <property name="label" translatable="yes">Disable _tapping and scrolling</property>
+ <property name="use_underline">True</property>
</object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
<object class="GtkCheckButton" id="disable_while_other_device_exists">
diff --git a/modules/gpds-touchpad-ui.c b/modules/gpds-touchpad-ui.c
index 57c1f44..7a2f130 100644
--- a/modules/gpds-touchpad-ui.c
+++ b/modules/gpds-touchpad-ui.c
@@ -446,11 +446,17 @@ set_sensitivity_depends_on_use_type (GpdsUI *ui,
switch (use_type) {
case GPDS_TOUCHPAD_USE_TYPE_OFF:
+ set_widget_sensitivity(builder, "general_box", FALSE);
+ set_widget_sensitivity(builder, "scrolling_vbox", FALSE);
+ set_widget_sensitivity(builder, "tapping_vbox", FALSE);
+ break;
case GPDS_TOUCHPAD_USE_TYPE_TAPPING_AND_SCROLLING_OFF:
+ set_widget_sensitivity(builder, "general_box", TRUE);
set_widget_sensitivity(builder, "scrolling_vbox", FALSE);
set_widget_sensitivity(builder, "tapping_vbox", FALSE);
break;
case GPDS_TOUCHPAD_USE_TYPE_NORMAL:
+ set_widget_sensitivity(builder, "general_box", TRUE);
set_widget_sensitivity(builder, "scrolling_vbox", TRUE);
set_widget_sensitivity(builder, "tapping_vbox", TRUE);
default:
@@ -459,31 +465,61 @@ set_sensitivity_depends_on_use_type (GpdsUI *ui,
}
static void
-set_touchpad_use_type_combo_state (GpdsUI *ui, GpdsTouchpadUseType use_type)
+set_touchpad_use_type (GpdsUI *ui, GpdsTouchpadUseType use_type)
{
- GtkComboBox *combo;
+ GtkToggleButton *button;
GtkBuilder *builder;
+ gboolean disable_touchpad, disable_tapping_and_scrolling;
+
+ disable_touchpad = (use_type == GPDS_TOUCHPAD_USE_TYPE_OFF);
+ disable_tapping_and_scrolling = (use_type == GPDS_TOUCHPAD_USE_TYPE_TAPPING_AND_SCROLLING_OFF);
builder = gpds_ui_get_builder(ui);
+ button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "disable_touchpad"));
+ gtk_toggle_button_set_active(button, disable_touchpad);
+
+ button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "disable_tapping_and_scrolling"));
+ gtk_toggle_button_set_active(button, disable_tapping_and_scrolling);
- combo = GTK_COMBO_BOX(gtk_builder_get_object(builder, "touchpad_use_type"));
- gtk_combo_box_set_active(combo, (gint)use_type);
set_sensitivity_depends_on_use_type(ui, use_type);
}
static void
-cb_touchpad_use_type_changed (GtkComboBox *combo, gpointer user_data)
+cb_touchpad_use_type_toggled (GtkToggleButton *button, gpointer user_data)
{
GpdsUI *ui = GPDS_UI(user_data);
+ GpdsTouchpadUseType use_type;
gint properties[1];
GError *error = NULL;
+ GtkToggleButton *disable_touchpad_button;
+ GtkToggleButton *disable_tapping_and_scrolling_button;
+ GtkBuilder *builder;
+ gboolean disable_touchpad, disable_tapping_and_scrolling;
GpdsXInput *xinput;
xinput = gpds_xinput_ui_get_xinput(GPDS_XINPUT_UI(ui));
if (!xinput)
return;
- properties[0] = gtk_combo_box_get_active(combo);
+ builder = gpds_ui_get_builder(ui);
+ disable_touchpad_button =
+ GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "disable_touchpad"));
+ disable_tapping_and_scrolling_button =
+ GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "disable_tapping_and_scrolling"));
+
+ disable_touchpad = gtk_toggle_button_get_active(disable_touchpad_button);
+ disable_tapping_and_scrolling =
+ gtk_toggle_button_get_active(disable_tapping_and_scrolling_button);
+
+ if (disable_touchpad)
+ use_type = GPDS_TOUCHPAD_USE_TYPE_OFF;
+ else {
+ use_type = disable_tapping_and_scrolling ?
+ GPDS_TOUCHPAD_USE_TYPE_TAPPING_AND_SCROLLING_OFF :
+ GPDS_TOUCHPAD_USE_TYPE_NORMAL;
+ }
+
+ properties[0] = use_type;
if (!gpds_xinput_set_int_properties(xinput,
GPDS_TOUCHPAD_OFF,
&error,
@@ -494,8 +530,21 @@ cb_touchpad_use_type_changed (GtkComboBox *combo, gpointer user_data)
g_error_free(error);
}
}
- gpds_ui_set_gconf_int(ui, GPDS_TOUCHPAD_OFF_KEY, properties[0]);
- set_sensitivity_depends_on_use_type(ui, properties[0]);
+
+ gpds_ui_set_gconf_int(ui, GPDS_TOUCHPAD_OFF_KEY, (gint)use_type);
+ set_sensitivity_depends_on_use_type(ui, use_type);
+}
+
+static void
+cb_disable_touchpad_toggled (GtkToggleButton *button, gpointer user_data)
+{
+ cb_touchpad_use_type_toggled(button, user_data);
+}
+
+static void
+cb_disable_tapping_and_scrolling_toggled (GtkToggleButton *button, gpointer user_data)
+{
+ cb_touchpad_use_type_toggled(button, user_data);
}
static void
@@ -591,7 +640,8 @@ setup_signals (GpdsUI *ui, GtkBuilder *builder)
G_CALLBACK(cb_ ## object_name ## _ ## signal_name),\
ui)
- CONNECT(touchpad_use_type, changed);
+ CONNECT(disable_touchpad, toggled);
+ CONNECT(disable_tapping_and_scrolling, toggled);
CONNECT(disable_while_other_device_exists, toggled);
CONNECT(guest_mouse_off, toggled);
CONNECT(palm_detection, toggled);
@@ -778,7 +828,7 @@ set_touchpad_use_type_property_from_preference (GpdsUI *ui)
if (!gpds_ui_get_gconf_int(ui, GPDS_TOUCHPAD_OFF_KEY, (gint*)&type))
type = values[0];
- set_touchpad_use_type_combo_state(ui, type);
+ set_touchpad_use_type(ui, type);
g_free(values);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]