File gsynaptics-support-partial-config.patch of Package gsynaptics

Do not set to 0 when some keys are not defined.
Debian bug #480744.

Forwarded to https://sourceforge.jp/tracker/index.php?func=detail&aid=12545&group_id=1720&atid=6435

diff -urNad gsynaptics-0.9.14~/src/init.c gsynaptics-0.9.14/src/init.c
--- gsynaptics-0.9.14~/src/init.c	2008-02-28 23:27:41.000000000 +0100
+++ gsynaptics-0.9.14/src/init.c	2008-05-17 09:14:12.000000000 +0200
@@ -36,63 +36,148 @@
 {
 	gboolean b_value;
 	gint i_value;
+    GConfValue *gval = NULL;
 
 	if (!gconf_client_dir_exists (gconf, DIRNAME, NULL))
 		return;
 
 	/* touchpad on/off */	
-	b_value = gconf_client_get_bool (gconf, OFF_KEY, NULL);
-	g_synaptics_set_enabled (synaptics, b_value ? 1 : 0);
+	gval = gconf_client_get (gconf, OFF_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_BOOL) {
+			b_value = gconf_value_get_bool(gval);
+			g_synaptics_set_enabled (synaptics, b_value ? 1 : 0);
+		}
+		gconf_value_free(gval);
+	}
 	
 	/* vertical scroll delta */
-	i_value = gconf_client_get_int (gconf, VERTSCROLLDELTA_KEY, NULL);
-	g_synaptics_set_vertical_scroll_delta (synaptics, i_value);
+	gval = gconf_client_get (gconf, VERTSCROLLDELTA_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_vertical_scroll_delta (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 	
 	/* horizontal scroll delta */
-	i_value = gconf_client_get_int (gconf, HORIZSCROLLDELTA_KEY, NULL);
-	g_synaptics_set_horizontal_scroll_delta (synaptics, i_value);
+	gval = gconf_client_get (gconf, HORIZSCROLLDELTA_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_horizontal_scroll_delta (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 	
 	/* circular scroll */
-	i_value = gconf_client_get_int (gconf, CIRCSCROLLDELTA_KEY, NULL);
-	b_value = gconf_client_get_bool (gconf, CIRCULARSCROLLING_KEY, NULL);
-	g_synaptics_set_circular_scroll_delta (synaptics, i_value);
-	g_synaptics_set_circular_scroll_enabled (synaptics, b_value);
+	gval = gconf_client_get (gconf, CIRCSCROLLDELTA_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_circular_scroll_delta (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
+	gval = gconf_client_get (gconf, CIRCULARSCROLLING_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_BOOL) {
+			b_value = gconf_value_get_bool(gval);
+			g_synaptics_set_circular_scroll_enabled (synaptics, b_value);
+		}
+		gconf_value_free(gval);
+	}
 	/* the trigger of circular scrolling */
-	i_value = gconf_client_get_int (gconf, CIRCSCROLLTRIGGER_KEY, NULL);
-	g_synaptics_set_circular_scroll_trigger (synaptics, i_value);
+	gval = gconf_client_get (gconf, CIRCSCROLLTRIGGER_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_circular_scroll_trigger (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 	
 	
 	/* tapping time */
-	i_value = gconf_client_get_int (gconf, MAXTAPTIME_KEY, NULL);
-	g_synaptics_set_tap_time (synaptics, i_value);
+	gval = gconf_client_get (gconf, MAXTAPTIME_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_tap_time (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 	
 	/* fast taps */
-	b_value = gconf_client_get_bool (gconf, FASTTAPS_KEY, NULL);
-	g_synaptics_set_fast_taps (synaptics, b_value);
+	gval = gconf_client_get (gconf, FASTTAPS_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_BOOL) {
+			b_value = gconf_value_get_bool(gval);
+			g_synaptics_set_fast_taps (synaptics, b_value);
+		}
+		gconf_value_free(gval);
+	}
 	
 	/* sensitivity */
-	i_value = gconf_client_get_int (gconf, SENSITIVITY_KEY, NULL);
-	g_synaptics_set_sensitivity (synaptics, i_value);
+	gval = gconf_client_get (gconf, SENSITIVITY_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_sensitivity (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 
 	/* coasting */
-	b_value = gconf_client_get_bool (gconf, COASTENABLE_KEY, NULL);
-	g_synaptics_set_coasting_enabled (synaptics, b_value);
+	gval = gconf_client_get (gconf, COASTENABLE_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_BOOL) {
+			b_value = gconf_value_get_bool(gval);
+			g_synaptics_set_coasting_enabled (synaptics, b_value);
+		}
+		gconf_value_free(gval);
+	}
 	
 	/* edge motion */
-	b_value = gconf_client_get_bool (gconf, EDGEMOTIONUSEALWAYS_KEY, NULL);
-	g_synaptics_set_edge_motion_enabled (synaptics, b_value);
+	gval = gconf_client_get (gconf, EDGEMOTIONUSEALWAYS_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_BOOL) {
+			b_value = gconf_value_get_bool(gval);
+			g_synaptics_set_edge_motion_enabled (synaptics, b_value);
+		}
+		gconf_value_free(gval);
+	}
 
 	/* min speed */
-	i_value = gconf_client_get_int (gconf, MINSPEED_KEY, NULL);
-	g_synaptics_set_min_speed (synaptics, i_value);
+	gval = gconf_client_get (gconf, MINSPEED_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_min_speed (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 
 	/* max speed */
-	i_value = gconf_client_get_int (gconf, MAXSPEED_KEY, NULL);
-	g_synaptics_set_max_speed (synaptics, i_value);
+	gval = gconf_client_get (gconf, MAXSPEED_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_max_speed (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 
 	/* accel factor */
-	i_value = gconf_client_get_int (gconf, ACCELFACTOR_KEY, NULL);
-	g_synaptics_set_accel_factor (synaptics, i_value);
+	gval = gconf_client_get (gconf, ACCELFACTOR_KEY, NULL);
+	if (gval != NULL) {
+		if (gval->type == GCONF_VALUE_INT) {
+			i_value = gconf_value_get_int(gval);
+			g_synaptics_set_accel_factor (synaptics, i_value);
+		}
+		gconf_value_free(gval);
+	}
 
 }
openSUSE Build Service is sponsored by