A Pile of pending changes

This commit is contained in:
Jody Goldberg 2002-07-16 22:07:42 +00:00
parent 52d3daae86
commit b6e858deb7
13 changed files with 799 additions and 983 deletions

View file

@ -53,79 +53,6 @@ create_dialog (void)
return dialog;
}
static GConfValue *
rate_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
GConfValue *new_value;
int rate;
rate = gconf_value_get_int (value);
new_value = gconf_value_new (GCONF_VALUE_INT);
if (rate >= (255 + 192) / 2)
gconf_value_set_int (new_value, 0);
else if (rate >= (192 + 64) / 2)
gconf_value_set_int (new_value, 1);
else if (rate >= (64 + 1) / 2)
gconf_value_set_int (new_value, 2);
else
gconf_value_set_int (new_value, 3);
return new_value;
}
static GConfValue *
rate_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
static int rates[] = {
255, 192, 64, 1
};
GConfValue *new_value;
new_value = gconf_value_new (GCONF_VALUE_INT);
gconf_value_set_int (new_value, rates[gconf_value_get_int (value)]);
return new_value;
}
static GConfValue *
delay_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
GConfValue *new_value;
int delay;
delay = gconf_value_get_int (value);
new_value = gconf_value_new (GCONF_VALUE_INT);
if (delay >= (1000 + 700) / 2)
gconf_value_set_int (new_value, 3);
else if (delay >= (700 + 300) / 2)
gconf_value_set_int (new_value, 2);
else if (delay >= (300 + 150) / 2)
gconf_value_set_int (new_value, 1);
else
gconf_value_set_int (new_value, 0);
return new_value;
}
static GConfValue *
delay_from_widget (GConfPropertyEditor *peditor, GConfValue *value)
{
static int delays[] = {
150, 300, 700, 1000
};
GConfValue *new_value;
new_value = gconf_value_new (GCONF_VALUE_INT);
gconf_value_set_int (new_value, delays[gconf_value_get_int (value)]);
return new_value;
}
static GConfEnumStringPair bell_enums[] = {
{ 0, "off" },
{ 1, "on" },
@ -189,17 +116,6 @@ blink_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
return new_value;
}
static GConfValue *
volume_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
return gconf_value_int_to_float (value);
}
static GConfValue *
volume_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
return gconf_value_float_to_int (value);
}
static void
bell_guard (GtkWidget *toggle,
GladeXML *dialog)
@ -217,6 +133,16 @@ mnemonic_activate (GtkWidget *toggle,
return FALSE;
}
static void
accessibility_button_clicked (GtkWidget *widget,
gpointer data)
{
GError *err = NULL;
if (!g_spawn_command_line_async ("gnome-accessibility-keyboard-properties", NULL))
capplet_error_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
_("There was an error launching the keyboard capplet : %s"),
err);
}
static void
dialog_response (GtkWidget *widget,
@ -227,21 +153,12 @@ dialog_response (GtkWidget *widget,
capplet_help (GTK_WINDOW (widget),
"wgoscustdesk.xml",
"goscustperiph-2");
else if (response_id == 0)
accessibility_button_clicked (NULL, NULL);
else
gtk_main_quit ();
}
static void
accessibility_button_clicked (GtkWidget *widget,
gpointer data)
{
GError *err = NULL;
if (!g_spawn_command_line_async ("gnome-accessibility-keyboard-properties", NULL))
capplet_error_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
_("There was an error launching the keyboard capplet : %s"),
err);
}
static void
setup_dialog (GladeXML *dialog,
GConfChangeSet *changeset)
@ -269,16 +186,16 @@ setup_dialog (GladeXML *dialog,
(changeset, "/desktop/gnome/peripherals/keyboard/repeat", WID ("repeat_toggle"), NULL);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("repeat_table"));
gconf_peditor_new_select_menu
(changeset, "/desktop/gnome/peripherals/keyboard/delay", WID ("repeat_delay_omenu"),
"conv-to-widget-cb", delay_to_widget,
"conv-from-widget-cb", delay_from_widget,
gconf_peditor_new_numeric_range
(changeset, "/desktop/gnome/peripherals/keyboard/delay", WID ("repeat_delay_scale"),
"conv-to-widget-cb", gconf_value_int_to_float,
"conv-from-widget-cb", gconf_value_float_to_int,
NULL);
gconf_peditor_new_select_menu
(changeset, "/desktop/gnome/peripherals/keyboard/rate", WID ("repeat_speed_omenu"),
"conv-to-widget-cb", rate_to_widget,
"conv-from-widget-cb", rate_from_widget,
gconf_peditor_new_numeric_range
(changeset, "/desktop/gnome/peripherals/keyboard/rate", WID ("repeat_speed_scale"),
"conv-to-widget-cb", gconf_value_int_to_float,
"conv-from-widget-cb", gconf_value_float_to_int,
NULL);
peditor = gconf_peditor_new_boolean
@ -290,14 +207,13 @@ setup_dialog (GladeXML *dialog,
"conv-from-widget-cb", blink_from_widget,
NULL);
peditor = gconf_peditor_new_boolean
(changeset, "/desktop/gnome/peripherals/keyboard/click", WID ("volume_toggle"), NULL);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("volume_hbox"));
gconf_peditor_new_numeric_range
(changeset, "/desktop/gnome/peripherals/keyboard/click_volume", WID ("volume_scale"),
"conv-to-widget-cb", volume_to_widget,
"conv-from-widget-cb", volume_from_widget,
"conv-to-widget-cb", gconf_value_int_to_float,
"conv-from-widget-cb", gconf_value_float_to_int,
NULL);
g_signal_connect (G_OBJECT (WID ("bell_custom_radio")), "toggled", (GCallback) bell_guard, dialog);
@ -309,8 +225,6 @@ setup_dialog (GladeXML *dialog,
NULL);
g_signal_connect (G_OBJECT (WID ("bell_custom_radio")), "mnemonic_activate", (GCallback) mnemonic_activate, WID ("bell_custom_entry"));
g_signal_connect (G_OBJECT (WID ("keyboard_dialog")), "response", (GCallback) dialog_response, changeset);
g_signal_connect (G_OBJECT (WID ("accessibility_button")), "clicked", (GCallback) accessibility_button_clicked, NULL);
}
static void
@ -385,9 +299,8 @@ main (int argc, char **argv)
changeset = NULL;
dialog = create_dialog ();
setup_dialog (dialog, changeset);
#if 0
setup_accessibility (dialog, changeset);
#endif
capplet_set_icon (WID ("keyboard_dialog"),
"keyboard-capplet.png");
gtk_widget_show (WID ("keyboard_dialog"));
gtk_main ();
}