Index: gnome-settings-daemon/gnome-settings-mouse.c
===================================================================
--- gnome-settings-daemon/gnome-settings-mouse.c	(Revision 8097)
+++ gnome-settings-daemon/gnome-settings-mouse.c	(Arbeitskopie)
@@ -26,10 +26,13 @@
 	GnomeSettingsModuleClass parent_class;
 } GnomeSettingsModuleMouseClass;
 
+static gboolean synaptics_enabled = FALSE;
+
 static GnomeSettingsModuleRunlevel gnome_settings_module_mouse_get_runlevel (GnomeSettingsModule *module);
 static gboolean gnome_settings_module_mouse_initialize (GnomeSettingsModule *module, GConfClient *config_client);
 static gboolean gnome_settings_module_mouse_start (GnomeSettingsModule *module);
 static gboolean gnome_settings_module_mouse_stop (GnomeSettingsModule *module);
+static void synaptics_set (gchar *key, gint value);
 
 static void
 gnome_settings_module_mouse_class_init (GnomeSettingsModuleMouseClass *klass)
@@ -99,6 +102,7 @@
 	const gint left_button = 1;
 	gint right_button;
 	gint i;
+	gchar *command;
 
 	/* if the button is higher than 2 (3rd button) then it's
 	 * probably one direction of a scroll wheel or something else
@@ -146,6 +150,13 @@
 		/* swap the buttons */
 		buttons[left_button - 1] = left_button;
 	}
+	
+	/* set touchpad tapping accordingly */
+	for (i = 0; i < MIN (n_buttons, 3); i++) {
+		command = g_strdup_printf ("TapButton%d", i+1);
+		synaptics_set (command, buttons[i]);
+	}
+	g_free (command);
 }
 
 #ifdef HAVE_XINPUT
@@ -458,6 +469,59 @@
 }
 
 static void
+synaptics_set (gchar *key, gint value)
+{
+	gchar *command;
+	
+	if (!synaptics_enabled)
+		return;
+		
+	command = g_strdup_printf ("synclient %s=%d", key, value);
+	g_spawn_command_line_async (command, NULL);
+	g_free (command);
+}
+
+static void
+set_touchpad_off (gboolean touchpad_off)
+{
+	synaptics_set ("TouchpadOff", touchpad_off ? 1 : 0);
+}
+
+static void
+set_max_tap_time (gint max_tap_time)
+{
+	if (max_tap_time < 0) {
+		max_tap_time = 0;
+	}
+	
+	synaptics_set ("MaxTapTime", max_tap_time);
+}
+
+static void
+set_vert_edge_scroll (gboolean vert_edge_scroll)
+{
+	synaptics_set ("VertEdgeScroll", vert_edge_scroll ? 1 : 0);
+}
+
+static void
+set_vert_scroll_delta (gint vert_scroll_delta)
+{
+	synaptics_set ("VertScrollDelta", vert_scroll_delta);
+}
+
+static void
+set_horiz_edge_scroll (gboolean horiz_edge_scroll)
+{
+	synaptics_set ("HorizEdgeScroll", horiz_edge_scroll ? 1 : 0);
+}
+
+static void
+set_horiz_scroll_delta (gint horiz_scroll_delta)
+{
+	synaptics_set ("HorizScrollDelta", horiz_scroll_delta);
+}
+
+static void
 mouse_callback (GConfEntry *entry)
 {
 	if (! strcmp (entry->key, "/desktop/gnome/peripherals/mouse/left_handed")) {
@@ -475,10 +539,41 @@
 	}
 }
 
+static void
+touchpad_callback (GConfEntry *entry)
+{
+	if (! strcmp (entry->key, "/desktop/gnome/peripherals/touchpad/off")) {
+		if (entry->value->type == GCONF_VALUE_BOOL) {
+			set_touchpad_off (gconf_value_get_bool (entry->value));
+		}
+	} else if (! strcmp (entry->key, "/desktop/gnome/peripherals/touchpad/max_tap_time")) {
+		if (entry->value->type == GCONF_VALUE_INT) {
+			set_max_tap_time (gconf_value_get_int (entry->value));
+		}
+	} else if (! strcmp (entry->key, "/desktop/gnome/peripherals/touchpad/vert_edge_scroll")) {
+		if (entry->value->type == GCONF_VALUE_BOOL) {
+			set_vert_edge_scroll (gconf_value_get_bool (entry->value));
+		}
+	} else if (! strcmp (entry->key, "/desktop/gnome/peripherals/touchpad/vert_scroll_delta")) {
+		if (entry->value->type == GCONF_VALUE_INT) {
+			set_vert_scroll_delta (gconf_value_get_int (entry->value));
+		}
+	} else if (! strcmp (entry->key, "/desktop/gnome/peripherals/touchpad/horiz_edge_scroll")) {
+		if (entry->value->type == GCONF_VALUE_BOOL) {
+			set_horiz_edge_scroll (gconf_value_get_bool (entry->value));
+		}
+	} else if (! strcmp (entry->key, "/desktop/gnome/peripherals/touchpad/horiz_scroll_delta")) {
+		if (entry->value->type == GCONF_VALUE_INT) {
+			set_horiz_scroll_delta (gconf_value_get_int (entry->value));
+		}
+	}
+}
+
 static gboolean
 gnome_settings_module_mouse_initialize (GnomeSettingsModule *module, GConfClient *config_client)
 {
 	gnome_settings_register_config_callback ("/desktop/gnome/peripherals/mouse", mouse_callback);
+	gnome_settings_register_config_callback ("/desktop/gnome/peripherals/touchpad", touchpad_callback);
 
 	return TRUE;
 }
@@ -487,6 +582,7 @@
 static gboolean
 gnome_settings_module_mouse_start (GnomeSettingsModule *module)
 {
+	gchar *output;
 	GConfClient *client = gnome_settings_module_get_config_client (module);
 
 	set_left_handed (gconf_client_get_bool (client, "/desktop/gnome/peripherals/mouse/left_handed", NULL));
@@ -497,6 +593,26 @@
 	set_locate_pointer (gconf_client_get_bool (client,
 						   "/desktop/gnome/peripherals/mouse/locate_pointer", NULL));
 
+	/* touchpad */
+	if (g_spawn_command_line_sync ("synclient -l", NULL, &output, NULL, NULL)
+		&& !strstr (output, "SHMConfig")) {
+			synaptics_enabled = TRUE;
+			
+			set_touchpad_off (gconf_client_get_bool (client,
+							"/desktop/gnome/peripherals/touchpad/off", NULL));
+			set_max_tap_time (gconf_client_get_int (client,
+							"/desktop/gnome/peripherals/touchpad/max_tap_time", NULL));
+			set_vert_edge_scroll (gconf_client_get_bool (client,
+							"/desktop/gnome/peripherals/touchpad/vert_edge_scroll", NULL));
+			set_vert_scroll_delta (gconf_client_get_int (client,
+							"/desktop/gnome/peripherals/touchpad/vert_scroll_delta", NULL));
+			set_horiz_edge_scroll (gconf_client_get_bool (client,
+							"/desktop/gnome/peripherals/touchpad/horiz_edge_scroll", NULL));
+			set_horiz_scroll_delta (gconf_client_get_int (client,
+							"/desktop/gnome/peripherals/touchpad/horiz_scroll_delta", NULL));
+	}
+	g_free (output);
+	
 	return TRUE;
 }
 
Index: capplets/mouse/gnome-mouse-properties.glade
===================================================================
--- capplets/mouse/gnome-mouse-properties.glade	(Revision 8127)
+++ capplets/mouse/gnome-mouse-properties.glade	(Arbeitskopie)
@@ -122,7 +122,7 @@
 		      <child>
 			<widget class="GtkLabel" id="label11">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">    </property>
+			  <property name="label">    </property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -271,7 +271,7 @@
 		      <child>
 			<widget class="GtkLabel" id="label13">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">    </property>
+			  <property name="label">    </property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -525,7 +525,7 @@
 		      <child>
 			<widget class="GtkLabel" id="label18">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">    </property>
+			  <property name="label">    </property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -841,7 +841,7 @@
 		      <child>
 			<widget class="GtkLabel" id="label19">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">    </property>
+			  <property name="label">    </property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -1025,6 +1025,467 @@
 	      <property name="type">tab</property>
 	    </packing>
 	  </child>
+	  
+            <child>
+              <widget class="GtkVBox" id="touchpad_vbox">
+                <property name="border_width">12</property>
+                <property name="spacing">18</property>
+                <child>
+                  <widget class="GtkVBox" id="vbox10">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkLabel" id="touchpad_category_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0</property>
+                        <property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox2">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="touchpad_enabled_toggle">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Enable _touchpad</property>
+                            <property name="use_underline">True</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox4">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="touchpad_clicking_toggle">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Enable mouse _clicks with touchpad</property>
+                            <property name="use_underline">True</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkVBox" id="vbox11">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkLabel" id="scrolling_category_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Scrolling&lt;/b&gt;</property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox9">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label8">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="touchpad_vertical_scrolling_toggle">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Enable _vertical scrolling</property>
+                            <property name="use_underline">True</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox10">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label9">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkHBox" id="hbox13">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkLabel" id="label15">
+                                <property name="width_request">22</property>
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="label">     </property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="sensitivity_label1">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="label" translatable="yes">_Sensitivity:</property>
+                                <property name="use_underline">True</property>
+                                <property name="justify">GTK_JUSTIFY_CENTER</property>
+                                <property name="mnemonic_widget">sensitivity_scale</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label6">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="label">    </property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="low_label1">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">&lt;i&gt;Low&lt;/i&gt;</property>
+                                <property name="use_markup">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHScale" id="touchpad_vertical_scrolling_scale">
+                                <property name="visible">True</property>
+                                <property name="update_policy">GTK_UPDATE_DELAYED</property>
+                                <property name="adjustment">5 5 255 5 10 10</property>
+                                <property name="restrict_to_fill_level">False</property>
+                                <property name="fill_level">0</property>
+                                <property name="draw_value">False</property>
+                              </widget>
+                              <packing>
+                                <property name="padding">6</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="high_label1">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">&lt;i&gt;High&lt;/i&gt;</property>
+                                <property name="use_markup">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">5</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox14">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label14">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="touchpad_horizontal_scrolling_toggle">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Enable _horizontal scrolling</property>
+                            <property name="use_underline">True</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox17">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label7">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkHBox" id="hbox15">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkLabel" id="label16">
+                                <property name="width_request">22</property>
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="label">     </property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="sensitivity_label2">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="label" translatable="yes">S_ensitivity:</property>
+                                <property name="use_underline">True</property>
+                                <property name="justify">GTK_JUSTIFY_CENTER</property>
+                                <property name="mnemonic_widget">sensitivity_scale</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label17">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="label">    </property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="low_label2">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">&lt;i&gt;Low&lt;/i&gt;</property>
+                                <property name="use_markup">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHScale" id="touchpad_horizontal_scrolling_scale">
+                                <property name="visible">True</property>
+                                <property name="update_policy">GTK_UPDATE_DELAYED</property>
+                                <property name="adjustment">5 5 255 5 10 10</property>
+                                <property name="restrict_to_fill_level">False</property>
+                                <property name="fill_level">0</property>
+                                <property name="draw_value">False</property>
+                              </widget>
+                              <packing>
+                                <property name="padding">6</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="high_label2">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">&lt;i&gt;High&lt;/i&gt;</property>
+                                <property name="use_markup">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">5</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkAspectFrame" id="touchpad_error_aspectframe">
+                    <property name="shadow_type">GTK_SHADOW_NONE</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox8">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkImage" id="image1">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-dialog-error</property>
+                            <property name="icon_size">6</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label20">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label">    </property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="touchpad_error_label">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Could not access touchpad configuration. Please make sure that SHMConfig is enabled in xorg.conf.</property>
+                            <property name="wrap">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="touchpad_label7">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Touchpad</property>
+              </widget>
+              <packing>
+                <property name="type">tab</property>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>	  
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
Index: capplets/mouse/gnome-mouse-properties.c
===================================================================
--- capplets/mouse/gnome-mouse-properties.c	(Revision 8097)
+++ capplets/mouse/gnome-mouse-properties.c	(Arbeitskopie)
@@ -223,13 +223,74 @@
 }
 
 static GConfValue *
+touchpad_off_gconf_cb (GConfPropertyEditor *peditor, const GConfValue *value)
+{
+	GConfValue *new_value;
+
+	new_value = gconf_value_new (GCONF_VALUE_BOOL);
+	gconf_value_set_bool (new_value, !(gconf_value_get_bool (value)));
+
+	return new_value;
+}
+
+static GConfValue *
+touchpad_clicking_from_gconf (GConfPropertyEditor *peditor, const GConfValue *value)
+{
+	GConfValue *new_value;
+
+	new_value = gconf_value_new (GCONF_VALUE_BOOL);
+	gconf_value_set_bool (new_value, gconf_value_get_int (value) > 0 ? TRUE : FALSE);
+
+	return new_value;
+}
+
+static GConfValue *
+touchpad_clicking_to_gconf (GConfPropertyEditor *peditor, const GConfValue *value)
+{
+	GConfClient *client;
+	GConfValue *new_value;
+	gint max_tap_time;
+
+	client = gconf_client_get_default();
+	max_tap_time = gconf_client_get_int (client,
+		"/desktop/gnome/peripherals/touchpad/max_tap_time", NULL);
+	g_object_unref (client);
+		
+	if (gconf_value_get_bool (value)) {
+		if (max_tap_time == 0)
+			max_tap_time = 180;
+		else
+			max_tap_time = abs (max_tap_time);
+	} else
+		max_tap_time *= -1;
+		
+	new_value = gconf_value_new (GCONF_VALUE_INT);
+	gconf_value_set_int (new_value, max_tap_time);
+
+	return new_value;
+}
+
+static GConfValue *
+touchpad_scrolling_gconf_cb (GConfPropertyEditor *peditor, const GConfValue *value)
+{
+	GConfValue *new_value;
+	gint vert_scroll_delta;
+
+	vert_scroll_delta = CLAMP (255 - gconf_value_get_int (value), 5, 255);
+
+	new_value = gconf_value_new (GCONF_VALUE_INT);
+	gconf_value_set_int (new_value, vert_scroll_delta);
+
+	return new_value;
+}
+
+static GConfValue *
 drag_threshold_from_gconf (GConfPropertyEditor *peditor, 
 			   const GConfValue *value)
 {
 	GConfValue *new_value;
 
 	new_value = gconf_value_new (GCONF_VALUE_FLOAT);
-
 	gconf_value_set_float (new_value, CLAMP (gconf_value_get_int (value), 1, 10));
 
 	return new_value;
@@ -347,6 +408,107 @@
 	}
 }
 
+/*
+static gdouble
+synaptics_get_value (const gchar *key)
+{
+	gchar *output;
+	GRegex *regex;
+	GMatchInfo *match_info;
+	gchar *pattern, *word;
+	gdouble value = -1;
+		
+	g_spawn_command_line_sync ("synclient -l", &output,
+		NULL, NULL, NULL);
+		
+	if (output) {
+		pattern = g_strdup_printf ("%s.*= (.*)\n", key);
+		regex = g_regex_new (pattern, 0, 0, NULL);
+		
+		g_regex_match (regex, output, 0, &match_info);
+		g_match_info_matches (match_info);
+		word = g_match_info_fetch (match_info, 1);
+		
+		if (word) {
+			value = g_ascii_strtod (word, NULL);
+		}
+		
+		g_free (word);	
+		g_free (pattern);
+		g_match_info_free (match_info);
+		g_regex_unref (regex);
+		g_free (output);
+	}
+	
+	return value;
+}
+*/
+		
+static void
+touchpad_enabled_toggle_cb (GtkToggleButton *button, GladeXML *dialog)
+{
+	gboolean check, check_vscroll, check_hscroll;
+
+	check = gtk_toggle_button_get_active (button);
+	check_vscroll = gtk_toggle_button_get_active ((GtkToggleButton *) WID ("touchpad_vertical_scrolling_toggle"));
+	check_hscroll = gtk_toggle_button_get_active ((GtkToggleButton *) WID ("touchpad_horizontal_scrolling_toggle"));
+	
+	gtk_widget_set_sensitive (WID ("touchpad_clicking_toggle"), check);
+	gtk_widget_set_sensitive (WID ("scrolling_category_label"), check);
+	gtk_widget_set_sensitive (WID ("touchpad_vertical_scrolling_toggle"), check);
+	gtk_widget_set_sensitive (WID ("sensitivity_label1"), check && check_vscroll);
+	gtk_widget_set_sensitive (WID ("low_label1"), check && check_vscroll);
+	gtk_widget_set_sensitive (WID ("touchpad_vertical_scrolling_scale"), check && check_vscroll);
+	gtk_widget_set_sensitive (WID ("high_label1"), check && check_vscroll);
+	gtk_widget_set_sensitive (WID ("touchpad_horizontal_scrolling_toggle"), check);
+	gtk_widget_set_sensitive (WID ("sensitivity_label2"), check && check_hscroll);
+	gtk_widget_set_sensitive (WID ("low_label2"), check && check_hscroll);
+	gtk_widget_set_sensitive (WID ("touchpad_horizontal_scrolling_scale"), check && check_hscroll);
+	gtk_widget_set_sensitive (WID ("high_label2"), check && check_hscroll);
+}
+
+static void
+touchpad_clicking_toggle_cb (GtkToggleButton *button, GladeXML *dialog)
+{
+	GConfClient *client;
+	gboolean check;
+	
+	check = gtk_toggle_button_get_active (button);
+	
+	client = gconf_client_get_default ();
+	gconf_client_set_int (client, "/desktop/gnome/peripherals/touchpad/max_tap_time",
+		check ? 180 : 0,
+		NULL
+	);
+	g_object_unref (client);
+}
+
+static void
+touchpad_vertical_scrolling_toggle_cb (GtkToggleButton *button, GladeXML *dialog)
+{
+	gboolean check;
+
+	check = gtk_toggle_button_get_active (button);
+
+	gtk_widget_set_sensitive (WID ("sensitivity_label1"), check);
+	gtk_widget_set_sensitive (WID ("low_label1"), check);
+	gtk_widget_set_sensitive (WID ("touchpad_vertical_scrolling_scale"), check);
+	gtk_widget_set_sensitive (WID ("high_label1"), check);	
+}
+
+static void
+touchpad_horizontal_scrolling_toggle_cb (GtkToggleButton *button, GladeXML *dialog)
+{
+	gboolean check;
+
+	check = gtk_toggle_button_get_active (button);
+
+	gtk_widget_set_sensitive (WID ("sensitivity_label2"), check);
+	gtk_widget_set_sensitive (WID ("low_label2"), check);
+	gtk_widget_set_sensitive (WID ("touchpad_horizontal_scrolling_scale"), check);
+	gtk_widget_set_sensitive (WID ("high_label2"), check);
+}
+
 /* Set up the property editors in the dialog. */
 static void
 setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
@@ -354,6 +516,7 @@
 	GObject           *peditor;
 	GConfValue        *value;
 	gchar             *message;
+	gboolean          *check;
 
 	GConfClient       *client = gconf_client_get_default ();
 
@@ -403,6 +566,61 @@
 		(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"),
 		 "conv-to-widget-cb", drag_threshold_from_gconf,
 		 NULL);
+		 
+		 
+	/* Touchpad page */
+	
+	/* enable touchpad */
+	g_signal_connect (G_OBJECT (WID ("touchpad_enabled_toggle")), "toggled", (GCallback) touchpad_enabled_toggle_cb, dialog);
+	gconf_peditor_new_boolean
+		(changeset, "/desktop/gnome/peripherals/touchpad/off", WID ("touchpad_enabled_toggle"),
+		 "conv-to-widget-cb", touchpad_off_gconf_cb,
+ 		 "conv-from-widget-cb", touchpad_off_gconf_cb,
+		 NULL);	
+		 	
+	/* touchpad clicking */
+	gconf_peditor_new_boolean
+		(changeset, "/desktop/gnome/peripherals/touchpad/max_tap_time", WID ("touchpad_clicking_toggle"),
+		 "conv-to-widget-cb", touchpad_clicking_from_gconf,
+ 		 "conv-from-widget-cb", touchpad_clicking_to_gconf,
+		 NULL);	
+	
+	/* vertical scrolling */
+	gconf_peditor_new_boolean
+		(changeset, "/desktop/gnome/peripherals/touchpad/vert_edge_scroll", WID ("touchpad_vertical_scrolling_toggle"),
+		 NULL);	
+	g_signal_connect (G_OBJECT (WID ("touchpad_vertical_scrolling_toggle")), "toggled", (GCallback) touchpad_vertical_scrolling_toggle_cb, dialog);
+
+	gconf_peditor_new_numeric_range
+		(changeset, "/desktop/gnome/peripherals/touchpad/vert_scroll_delta", WID ("touchpad_vertical_scrolling_scale"),
+		 "conv-to-widget-cb", touchpad_scrolling_gconf_cb,
+ 		 "conv-from-widget-cb", touchpad_scrolling_gconf_cb,
+		 NULL);	
+
+	check = gtk_toggle_button_get_active ((GtkToggleButton *) WID ("touchpad_vertical_scrolling_toggle"));
+	gtk_widget_set_sensitive (WID ("sensitivity_label1"), check);
+	gtk_widget_set_sensitive (WID ("low_label1"), check);
+	gtk_widget_set_sensitive (WID ("touchpad_vertical_scrolling_scale"), check);
+	gtk_widget_set_sensitive (WID ("high_label1"), check);
+	
+	/* horizontal scrolling */
+	gconf_peditor_new_boolean
+		(changeset, "/desktop/gnome/peripherals/touchpad/horiz_edge_scroll", WID ("touchpad_horizontal_scrolling_toggle"),
+		 NULL);	
+	g_signal_connect (G_OBJECT (WID ("touchpad_horizontal_scrolling_toggle")), "toggled", (GCallback) touchpad_horizontal_scrolling_toggle_cb, dialog);
+
+	gconf_peditor_new_numeric_range
+		(changeset, "/desktop/gnome/peripherals/touchpad/horiz_scroll_delta", WID ("touchpad_horizontal_scrolling_scale"),
+		 "conv-to-widget-cb", touchpad_scrolling_gconf_cb,
+ 		 "conv-from-widget-cb", touchpad_scrolling_gconf_cb,
+		 NULL);
+		 
+	check = gtk_toggle_button_get_active ((GtkToggleButton *) WID ("touchpad_horizontal_scrolling_toggle"));
+	gtk_widget_set_sensitive (WID ("sensitivity_label2"), check);
+	gtk_widget_set_sensitive (WID ("low_label2"), check);
+	gtk_widget_set_sensitive (WID ("touchpad_horizontal_scrolling_scale"), check);
+	gtk_widget_set_sensitive (WID ("high_label2"), check);
+		 
 }
 
 /* Construct the dialog */
@@ -458,6 +676,7 @@
 	GConfClient    *client;
 	GladeXML       *dialog;
 	GtkWidget      *dialog_win;
+	gchar          *output;
 
 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -474,6 +693,7 @@
 
 	client = gconf_client_get_default ();
 	gconf_client_add_dir (client, "/desktop/gnome/peripherals/mouse", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+	gconf_client_add_dir (client, "/desktop/gnome/peripherals/touchpad", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 	g_object_unref (client);
 
 	dialog = create_dialog ();
@@ -488,6 +708,32 @@
 		capplet_set_icon (dialog_win, "gnome-dev-mouse-optical");
 		gtk_widget_show (dialog_win);
 
+		/* check for synclient and SHMConfig for touchpad configuration */
+		if (g_spawn_command_line_sync ("synclient -l", NULL, &output, NULL, NULL)) {
+			gtk_widget_show (WID ("touchpad_vbox"));
+			
+			if (strstr (output, "SHMConfig") != NULL) {
+				/* SHMConfig disabled; deactivate options and show warning */
+				gtk_widget_show_all (WID ("touchpad_error_aspectframe"));
+				
+				gtk_widget_set_sensitive (WID ("touchpad_category_label"), FALSE);
+				gtk_widget_set_sensitive (WID ("touchpad_enabled_toggle"), FALSE);
+				gtk_widget_set_sensitive (WID ("touchpad_clicking_toggle"), FALSE);
+				gtk_widget_set_sensitive (WID ("scrolling_category_label"), FALSE);
+				gtk_widget_set_sensitive (WID ("touchpad_vertical_scrolling_toggle"), FALSE);
+				gtk_widget_set_sensitive (WID ("sensitivity_label1"), FALSE);
+				gtk_widget_set_sensitive (WID ("low_label1"), FALSE);
+				gtk_widget_set_sensitive (WID ("touchpad_vertical_scrolling_scale"), FALSE);
+				gtk_widget_set_sensitive (WID ("high_label1"), FALSE);
+				gtk_widget_set_sensitive (WID ("touchpad_horizontal_scrolling_toggle"), FALSE);
+				gtk_widget_set_sensitive (WID ("sensitivity_label2"), FALSE);
+				gtk_widget_set_sensitive (WID ("low_label2"), FALSE);
+				gtk_widget_set_sensitive (WID ("touchpad_horizontal_scrolling_scale"), FALSE);
+				gtk_widget_set_sensitive (WID ("high_label2"), FALSE);
+			}
+		}
+		g_free (output);
+		
 		gtk_main ();
 
 		g_object_unref (dialog);
