Update to reflect changes in gconf peditors (setup_dialog): Use
2001-12-19 Bradford Hovinen <hovinen@ximian.com> * mouse-properties-capplet.c (*_{to|from}_gconf): Update to reflect changes in gconf peditors (setup_dialog): Use numeric_range
This commit is contained in:
parent
bf698d95b1
commit
e70b2fb620
3 changed files with 135 additions and 60 deletions
|
@ -8,6 +8,9 @@
|
||||||
(drawing_area_button_press_event): Use response of
|
(drawing_area_button_press_event): Use response of
|
||||||
gconf_change_set_check_value to determine if value is in changeset
|
gconf_change_set_check_value to determine if value is in changeset
|
||||||
(main): Remove --apply and --init-session-settings
|
(main): Remove --apply and --init-session-settings
|
||||||
|
(setup_dialog): Use g_object_set to set the conversion callbacks
|
||||||
|
(*_{to|from}_gconf): Update to reflect changes in gconf peditors
|
||||||
|
(setup_dialog): Use numeric_range
|
||||||
|
|
||||||
2001-12-18 Bradford Hovinen <hovinen@ximian.com>
|
2001-12-18 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
|
|
|
@ -65,44 +65,68 @@ gint double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
/* All of our scales but double_click are on the range 1->10 as a result, we
|
/* 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 gconf key is to our range.
|
* have a few routines to convert from whatever the gconf key is to our range.
|
||||||
*/
|
*/
|
||||||
static gfloat
|
static GConfValue *
|
||||||
double_click_from_gconf (gfloat double_click)
|
double_click_from_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
return CLAMP (floor ((double_click + 50) / 100) * 100, 0, 1000) / 1000.0;
|
GConfValue *new_value;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||||
|
gconf_value_set_float (new_value, CLAMP (floor ((gconf_value_get_int (value) + 50) / 100) * 100, 0, 1000) / 1000.0);
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
double_click_to_gconf (gfloat double_click)
|
double_click_to_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
return double_click * 1000.0;
|
GConfValue *new_value;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_INT);
|
||||||
|
gconf_value_set_int (new_value, gconf_value_get_float (value) * 1000.0);
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
motion_acceleration_from_gconf (gfloat motion_acceleration)
|
motion_acceleration_from_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
motion_acceleration = CLAMP (motion_acceleration, 0.2, 6.0);
|
GConfValue *new_value;
|
||||||
|
gfloat motion_acceleration;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||||
|
motion_acceleration = CLAMP (gconf_value_get_float (value), 0.2, 6.0);
|
||||||
|
|
||||||
if (motion_acceleration >= 1)
|
if (motion_acceleration >= 1)
|
||||||
return motion_acceleration + 4;
|
gconf_value_set_float (new_value, motion_acceleration + 4);
|
||||||
else
|
else
|
||||||
return motion_acceleration * 5;
|
gconf_value_set_float (new_value, motion_acceleration * 5);
|
||||||
|
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
motion_acceleration_to_gconf (gfloat motion_acceleration)
|
motion_acceleration_to_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
motion_acceleration = CLAMP (motion_acceleration, 1.0, 10.0);
|
GConfValue *new_value;
|
||||||
|
gfloat motion_acceleration;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||||
|
motion_acceleration = CLAMP (gconf_value_get_float (value), 1.0, 10.0);
|
||||||
|
|
||||||
if (motion_acceleration < 5)
|
if (motion_acceleration < 5)
|
||||||
return motion_acceleration / 5.0;
|
gconf_value_set_float (new_value, motion_acceleration / 5.0);
|
||||||
else
|
else
|
||||||
return motion_acceleration - 4;
|
gconf_value_set_float (new_value, motion_acceleration - 4);
|
||||||
|
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
threshold_from_gconf (gfloat drag_threshold)
|
threshold_from_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
return CLAMP (drag_threshold, 1, 10);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve legacy settings */
|
/* Retrieve legacy settings */
|
||||||
|
@ -301,18 +325,30 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
||||||
/* Double-click time */
|
/* Double-click time */
|
||||||
g_signal_connect (WID ("double_click_darea"), "expose_event", (GCallback) drawing_area_expose_event, changeset);
|
g_signal_connect (WID ("double_click_darea"), "expose_event", (GCallback) drawing_area_expose_event, changeset);
|
||||||
|
|
||||||
gconf_peditor_new_int_range
|
peditor = gconf_peditor_new_numeric_range
|
||||||
(changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"),
|
(changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"));
|
||||||
double_click_from_gconf, double_click_to_gconf);
|
g_object_set (peditor,
|
||||||
gconf_peditor_new_float_range
|
"conv-to-widget-cb", double_click_from_gconf,
|
||||||
(changeset, "/desktop/gnome/peripherals/mouse/motion_acceleration", WID ("accel_scale"),
|
"conv-from-widget-cb", double_click_to_gconf,
|
||||||
motion_acceleration_from_gconf, motion_acceleration_to_gconf);
|
NULL);
|
||||||
gconf_peditor_new_float_range
|
|
||||||
|
peditor = gconf_peditor_new_numeric_range
|
||||||
|
(changeset, "/desktop/gnome/peripherals/mouse/motion_acceleration", WID ("accel_scale"));
|
||||||
|
g_object_set (peditor,
|
||||||
|
"conv-to-widget-cb", motion_acceleration_from_gconf,
|
||||||
|
"conv-from-widget-cb", motion_acceleration_to_gconf,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gconf_peditor_new_numeric_range
|
||||||
(changeset, "/desktop/gnome/peripherals/mouse/motion_threshold",
|
(changeset, "/desktop/gnome/peripherals/mouse/motion_threshold",
|
||||||
WID ("sensitivity_scale"), NULL, NULL);
|
WID ("sensitivity_scale"));
|
||||||
gconf_peditor_new_int_range
|
|
||||||
(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"),
|
peditor = gconf_peditor_new_numeric_range
|
||||||
threshold_from_gconf, NULL);
|
(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"));
|
||||||
|
g_object_set (peditor,
|
||||||
|
"conv-to-widget-cb", threshold_from_gconf,
|
||||||
|
"conv-from-widget-cb", gconf_value_float_to_int,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Construct the dialog */
|
/* Construct the dialog */
|
||||||
|
|
|
@ -65,44 +65,68 @@ gint double_click_state = DOUBLE_CLICK_TEST_OFF;
|
||||||
/* All of our scales but double_click are on the range 1->10 as a result, we
|
/* 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 gconf key is to our range.
|
* have a few routines to convert from whatever the gconf key is to our range.
|
||||||
*/
|
*/
|
||||||
static gfloat
|
static GConfValue *
|
||||||
double_click_from_gconf (gfloat double_click)
|
double_click_from_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
return CLAMP (floor ((double_click + 50) / 100) * 100, 0, 1000) / 1000.0;
|
GConfValue *new_value;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||||
|
gconf_value_set_float (new_value, CLAMP (floor ((gconf_value_get_int (value) + 50) / 100) * 100, 0, 1000) / 1000.0);
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
double_click_to_gconf (gfloat double_click)
|
double_click_to_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
return double_click * 1000.0;
|
GConfValue *new_value;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_INT);
|
||||||
|
gconf_value_set_int (new_value, gconf_value_get_float (value) * 1000.0);
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
motion_acceleration_from_gconf (gfloat motion_acceleration)
|
motion_acceleration_from_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
motion_acceleration = CLAMP (motion_acceleration, 0.2, 6.0);
|
GConfValue *new_value;
|
||||||
|
gfloat motion_acceleration;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||||
|
motion_acceleration = CLAMP (gconf_value_get_float (value), 0.2, 6.0);
|
||||||
|
|
||||||
if (motion_acceleration >= 1)
|
if (motion_acceleration >= 1)
|
||||||
return motion_acceleration + 4;
|
gconf_value_set_float (new_value, motion_acceleration + 4);
|
||||||
else
|
else
|
||||||
return motion_acceleration * 5;
|
gconf_value_set_float (new_value, motion_acceleration * 5);
|
||||||
|
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
motion_acceleration_to_gconf (gfloat motion_acceleration)
|
motion_acceleration_to_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
motion_acceleration = CLAMP (motion_acceleration, 1.0, 10.0);
|
GConfValue *new_value;
|
||||||
|
gfloat motion_acceleration;
|
||||||
|
|
||||||
|
new_value = gconf_value_new (GCONF_VALUE_FLOAT);
|
||||||
|
motion_acceleration = CLAMP (gconf_value_get_float (value), 1.0, 10.0);
|
||||||
|
|
||||||
if (motion_acceleration < 5)
|
if (motion_acceleration < 5)
|
||||||
return motion_acceleration / 5.0;
|
gconf_value_set_float (new_value, motion_acceleration / 5.0);
|
||||||
else
|
else
|
||||||
return motion_acceleration - 4;
|
gconf_value_set_float (new_value, motion_acceleration - 4);
|
||||||
|
|
||||||
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gfloat
|
static GConfValue *
|
||||||
threshold_from_gconf (gfloat drag_threshold)
|
threshold_from_gconf (const GConfValue *value)
|
||||||
{
|
{
|
||||||
return CLAMP (drag_threshold, 1, 10);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve legacy settings */
|
/* Retrieve legacy settings */
|
||||||
|
@ -301,18 +325,30 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
||||||
/* Double-click time */
|
/* Double-click time */
|
||||||
g_signal_connect (WID ("double_click_darea"), "expose_event", (GCallback) drawing_area_expose_event, changeset);
|
g_signal_connect (WID ("double_click_darea"), "expose_event", (GCallback) drawing_area_expose_event, changeset);
|
||||||
|
|
||||||
gconf_peditor_new_int_range
|
peditor = gconf_peditor_new_numeric_range
|
||||||
(changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"),
|
(changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"));
|
||||||
double_click_from_gconf, double_click_to_gconf);
|
g_object_set (peditor,
|
||||||
gconf_peditor_new_float_range
|
"conv-to-widget-cb", double_click_from_gconf,
|
||||||
(changeset, "/desktop/gnome/peripherals/mouse/motion_acceleration", WID ("accel_scale"),
|
"conv-from-widget-cb", double_click_to_gconf,
|
||||||
motion_acceleration_from_gconf, motion_acceleration_to_gconf);
|
NULL);
|
||||||
gconf_peditor_new_float_range
|
|
||||||
|
peditor = gconf_peditor_new_numeric_range
|
||||||
|
(changeset, "/desktop/gnome/peripherals/mouse/motion_acceleration", WID ("accel_scale"));
|
||||||
|
g_object_set (peditor,
|
||||||
|
"conv-to-widget-cb", motion_acceleration_from_gconf,
|
||||||
|
"conv-from-widget-cb", motion_acceleration_to_gconf,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gconf_peditor_new_numeric_range
|
||||||
(changeset, "/desktop/gnome/peripherals/mouse/motion_threshold",
|
(changeset, "/desktop/gnome/peripherals/mouse/motion_threshold",
|
||||||
WID ("sensitivity_scale"), NULL, NULL);
|
WID ("sensitivity_scale"));
|
||||||
gconf_peditor_new_int_range
|
|
||||||
(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"),
|
peditor = gconf_peditor_new_numeric_range
|
||||||
threshold_from_gconf, NULL);
|
(changeset, "/desktop/gnome/peripherals/mouse/drag_threshold", WID ("drag_threshold_scale"));
|
||||||
|
g_object_set (peditor,
|
||||||
|
"conv-to-widget-cb", threshold_from_gconf,
|
||||||
|
"conv-from-widget-cb", gconf_value_float_to_int,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Construct the dialog */
|
/* Construct the dialog */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue