added the typing break to CVS from drwright.

Thu Jun 26 07:38:45 2003  Jonathan Blandford  <jrb@gnome.org>

	* typing-break/drwright.c: added the typing break to CVS from
	drwright.
This commit is contained in:
Jonathan Blandford 2003-06-26 11:40:10 +00:00 committed by Jonathan Blandford
parent 3ed3f34c81
commit 56057239d5
34 changed files with 3709 additions and 439 deletions

View file

@ -38,7 +38,6 @@
#include "capplet-stock-icons.h"
#include <../accessibility/keyboard/accessibility-keyboard.h>
enum
{
RESPONSE_APPLY = 1,
@ -71,46 +70,6 @@ create_dialog (void)
return dialog;
}
static GConfEnumStringPair bell_enums[] = {
{ 0, "off" },
{ 1, "on" },
{ 2, "custom" },
{ -1, NULL }
};
static GConfValue *
bell_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
GConfValue *new_value;
new_value = gconf_value_new (GCONF_VALUE_STRING);
gconf_value_set_string (new_value,
gconf_enum_to_string (bell_enums, gconf_value_get_int (value)));
return new_value;
}
static GConfValue *
bell_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
GConfValue *new_value;
const gchar *str;
gint val = 2;
str = (value && (value->type == GCONF_VALUE_STRING)) ? gconf_value_get_string (value) : NULL;
new_value = gconf_value_new (GCONF_VALUE_INT);
if (value->type == GCONF_VALUE_STRING) {
gconf_string_to_enum (bell_enums,
str,
&val);
}
gconf_value_set_int (new_value, val);
return new_value;
}
static GConfValue *
blink_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
{
@ -135,23 +94,6 @@ blink_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
return new_value;
}
static void
bell_guard (GtkWidget *toggle,
GladeXML *dialog)
{
gtk_widget_set_sensitive (WID ("bell_custom_fileentry"), GTK_TOGGLE_BUTTON (toggle)->active);
}
static gboolean
mnemonic_activate (GtkWidget *toggle,
gboolean group_cycling,
GtkWidget *entry)
{
if (! group_cycling)
gtk_widget_grab_focus (entry);
return FALSE;
}
static void
accessibility_button_clicked (GtkWidget *widget,
gpointer data)
@ -184,7 +126,6 @@ setup_dialog (GladeXML *dialog,
{
GObject *peditor;
GnomeProgram *program;
gchar *filename;
/* load all the images */
program = gnome_program_get ();
@ -192,8 +133,6 @@ setup_dialog (GladeXML *dialog,
capplet_init_stock_icons ();
gtk_image_set_from_stock (GTK_IMAGE (WID ("repeat_image")), KEYBOARD_REPEAT, keyboard_capplet_icon_get_size());
gtk_image_set_from_stock (GTK_IMAGE (WID ("cursor_image")), KEYBOARD_CURSOR, keyboard_capplet_icon_get_size());
gtk_image_set_from_stock (GTK_IMAGE (WID ("volume_image")), KEYBOARD_VOLUME, keyboard_capplet_icon_get_size());
gtk_image_set_from_stock (GTK_IMAGE (WID ("bell_image")), KEYBOARD_BELL, keyboard_capplet_icon_get_size());
peditor = gconf_peditor_new_boolean
(changeset, "/desktop/gnome/peripherals/keyboard/repeat", WID ("repeat_toggle"), NULL);
@ -220,23 +159,18 @@ setup_dialog (GladeXML *dialog,
"conv-from-widget-cb", blink_from_widget,
NULL);
/* Ergonomics */
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"));
(changeset, "/desktop/gnome/keyboard_break/enabled", WID ("break_enabled_toggle"), NULL);
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("break_details_table"));
gconf_peditor_new_numeric_range
(changeset, "/desktop/gnome/peripherals/keyboard/click_volume", WID ("volume_scale"),
"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);
peditor = gconf_peditor_new_select_radio
(changeset, "/desktop/gnome/peripherals/keyboard/bell_mode",
gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("bell_disabled_radio"))),
"conv-to-widget-cb", bell_to_widget,
"conv-from-widget-cb", bell_from_widget,
NULL);
g_signal_connect (G_OBJECT (WID ("bell_custom_radio")), "mnemonic_activate", (GCallback) mnemonic_activate, WID ("bell_custom_entry"));
(changeset, "/desktop/gnome/keyboard_break/type_time", WID ("break_enabled_spin"), NULL);
gconf_peditor_new_numeric_range
(changeset, "/desktop/gnome/keyboard_break/warn_time", WID ("break_warning_spin"), NULL);
gconf_peditor_new_numeric_range
(changeset, "/desktop/gnome/keyboard_break/break_time", WID ("break_interval_spin"), NULL);
gconf_peditor_new_boolean
(changeset, "/desktop/gnome/keyboard_break/allow_unlock", WID ("break_postponement_toggle"), NULL);
g_signal_connect (G_OBJECT (WID ("keyboard_dialog")), "response", (GCallback) dialog_response, changeset);
}
@ -288,6 +222,7 @@ main (int argc, char **argv)
N_("Just apply settings and quit (compatibility only; now handled by daemon)"), NULL },
{ "get-legacy", '\0', POPT_ARG_NONE, &get_legacy, 0,
N_("Retrieve and store legacy settings"), NULL },
// { "set_page",
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
};