diff --git a/capplets/accessibility/keyboard/ChangeLog b/capplets/accessibility/keyboard/ChangeLog index f91da19a4..a46bff9f2 100644 --- a/capplets/accessibility/keyboard/ChangeLog +++ b/capplets/accessibility/keyboard/ChangeLog @@ -1,3 +1,9 @@ +2002-06-10 Jody Goldberg + + * accessibility-keyboard.c : tweak the layout as requested and adjust + the max slowkey delay to 500 to avoid losing the keyboard due to some + sort of an X problem. + 2002-06-17 Jody Goldberg * Release 2.0.0 diff --git a/capplets/accessibility/keyboard/Makefile.am b/capplets/accessibility/keyboard/Makefile.am index aa01d58c4..20d957618 100644 --- a/capplets/accessibility/keyboard/Makefile.am +++ b/capplets/accessibility/keyboard/Makefile.am @@ -4,6 +4,9 @@ libaccessibility_keyboard_a_SOURCES = \ accessibility-keyboard.c \ accessibility-keyboard.h +# in case we need to forward port the sun accessX extension +# AccessXcomm.c + bin_PROGRAMS = gnome-accessibility-keyboard-properties gnome_accessibility_keyboard_properties_SOURCES = gnome-accessibility-keyboard-properties.c @@ -21,7 +24,7 @@ pixmap_DATA = \ accessibility-keyboard-bouncekey.png Gladedir = $(GNOMECC_GLADE_DIR) -Glade_DATA = gnome-accessibility-keyboard-properties.glade2 +Glade_DATA = gnome-accessibility-keyboard-properties.glade iconsdir = $(GNOMECC_ICONS_DIR) icons_DATA = accessibility-keyboard-capplet.png diff --git a/capplets/accessibility/keyboard/accessibility-keyboard.c b/capplets/accessibility/keyboard/accessibility-keyboard.c index 9a4b51188..0ca46a21e 100644 --- a/capplets/accessibility/keyboard/accessibility-keyboard.c +++ b/capplets/accessibility/keyboard/accessibility-keyboard.c @@ -44,27 +44,26 @@ static struct { char const * const image; char const * const image_file; char const * const gconf_key; - gboolean only_for_dialog; - char const * const content [5]; + char const * const content [3]; } const features [] = { { "bouncekeys_enable", "bouncekeys_image", IDIR "accessibility-keyboard-bouncekey.png", - CONFIG_ROOT "/bouncekeys_enable", FALSE, - { "bouncekeys_delay_slide", "bouncekeys_delay_spin", "bouncekeys_label1", "bouncekeys_label2", "bouncekeys_box" } }, + CONFIG_ROOT "/bouncekeys_enable", + { "bouncekey_table", NULL, NULL } }, { "slowkeys_enable", "slowkeys_image", IDIR "accessibility-keyboard-slowkey.png", - CONFIG_ROOT "/slowkeys_enable", FALSE, - { "slowkeys_delay_slide", "slowkeys_delay_spin", "slowkeys_table", "slowkeys_label", NULL } }, + CONFIG_ROOT "/slowkeys_enable", + { "slowkeys_table", NULL, NULL } }, { "mousekeys_enable", "mousekeys_image", IDIR "accessibility-keyboard-mousekey.png", - CONFIG_ROOT "/mousekeys_enable", FALSE, - { "mousekeys_table", NULL, NULL, NULL, NULL } }, + CONFIG_ROOT "/mousekeys_enable", + { "mousekeys_table", NULL, NULL } }, { "stickykeys_enable", "stickykeys_image", IDIR "accessibility-keyboard-stickykey.png", - CONFIG_ROOT "/stickykeys_enable", FALSE, - { "stickykeys_two_key_off", "stickykeys_modifier_beep", NULL, NULL, NULL } }, + CONFIG_ROOT "/stickykeys_enable", + { "stickeykeys_table", NULL, NULL } }, { "togglekeys_enable", "togglekeys_image", IDIR "accessibility-keyboard-togglekey.png", - CONFIG_ROOT "/togglekeys_enable", FALSE, - { NULL, NULL, NULL, NULL, NULL } }, + CONFIG_ROOT "/togglekeys_enable", + { NULL, NULL, NULL } }, { "timeout_enable", NULL, NULL, - CONFIG_ROOT "/timeout_enable", TRUE, - { "timeout_slide", "timeout_spin", NULL, NULL, NULL } } + CONFIG_ROOT "/timeout_enable", + { "timeout_slide", "timeout_spin", "timeout_label" } } }; static struct { @@ -75,28 +74,22 @@ static struct { int max_val; int step_size; char const * const gconf_key; - gboolean only_for_dialog; } const ranges [] = { { "bouncekeys_delay_slide", "bouncekeys_delay_spin", 300, 10, 900, 10, - CONFIG_ROOT "/bouncekeys_delay", FALSE }, + CONFIG_ROOT "/bouncekeys_delay" }, { "slowkeys_delay_slide", "slowkeys_delay_spin", 300, 10, 900, 10, - CONFIG_ROOT "/slowkeys_delay", FALSE }, - { "mousekeys_max_speed_slide", "mousekeys_max_speed_spin", 300, 10, 1000, 20, - CONFIG_ROOT "/mousekeys_max_speed", FALSE }, + CONFIG_ROOT "/slowkeys_delay" }, + /* WARNING anything larger than approx 512 seems to loose all keyboard input */ + { "mousekeys_max_speed_slide", "mousekeys_max_speed_spin", 300, 10, 500, 20, + CONFIG_ROOT "/mousekeys_max_speed" }, { "mousekeys_accel_time_slide", "mousekeys_accel_time_spin", 300, 10, 3000, 100, - CONFIG_ROOT "/mousekeys_accel_time", FALSE }, + CONFIG_ROOT "/mousekeys_accel_time" }, { "mousekeys_init_delay_slide", "mousekeys_init_delay_spin", 300, 10, 5000, 100, - CONFIG_ROOT "/mousekeys_init_delay", FALSE }, + CONFIG_ROOT "/mousekeys_init_delay" }, { "timeout_slide", "timeout_spin", 200, 10, 500, 10, - CONFIG_ROOT "/timeout", TRUE }, + CONFIG_ROOT "/timeout" }, }; -static void -cb_accessibility_toggled (GtkToggleButton *btn, GtkWidget *table) -{ - gtk_widget_set_sensitive (table, gtk_toggle_button_get_active (btn)); -} - static void set_sensitive (GladeXML *dialog, char const *name, gboolean state) { @@ -128,56 +121,53 @@ cb_feature_toggled (GtkToggleButton *btn, gpointer feature_index) } static void -setup_toggles (GladeXML *dialog, GConfChangeSet *changeset, gboolean as_dialog) +setup_toggles (GladeXML *dialog, GConfChangeSet *changeset) { GObject *peditor; GtkWidget *checkbox; int i = G_N_ELEMENTS (features); - while (i-- > 0) - if (as_dialog || !features [i].only_for_dialog) { - checkbox = WID (features [i].checkbox); + while (i-- > 0) { + checkbox = WID (features [i].checkbox); - g_return_if_fail (checkbox != NULL); + g_return_if_fail (checkbox != NULL); - g_object_set_data (G_OBJECT (checkbox), "dialog", dialog); - g_signal_connect (G_OBJECT (checkbox), - "toggled", - G_CALLBACK (cb_feature_toggled), GINT_TO_POINTER (i)); - peditor = gconf_peditor_new_boolean (changeset, - (gchar *)features [i].gconf_key, checkbox, NULL); - } + g_object_set_data (G_OBJECT (checkbox), "dialog", dialog); + g_signal_connect (G_OBJECT (checkbox), + "toggled", + G_CALLBACK (cb_feature_toggled), GINT_TO_POINTER (i)); + peditor = gconf_peditor_new_boolean (changeset, + (gchar *)features [i].gconf_key, checkbox, NULL); + } } static void -setup_simple_toggles (GladeXML *dialog, GConfChangeSet *changeset, gboolean as_dialog) +setup_simple_toggles (GladeXML *dialog, GConfChangeSet *changeset) { static struct { char const *gconf_key; char const *checkbox; - gboolean only_for_dialog; } const simple_toggles [] = { - { CONFIG_ROOT "/feature_state_change_beep","feature_state_change_beep", TRUE }, - { CONFIG_ROOT "/bouncekeys_beep_reject", "bouncekeys_beep_reject", FALSE }, + { CONFIG_ROOT "/feature_state_change_beep","feature_state_change_beep" }, + { CONFIG_ROOT "/bouncekeys_beep_reject", "bouncekeys_beep_reject" }, - { CONFIG_ROOT "/slowkeys_beep_press", "slowkeys_beep_press", FALSE }, - { CONFIG_ROOT "/slowkeys_beep_accept", "slowkeys_beep_accept", FALSE }, - { CONFIG_ROOT "/slowkeys_beep_reject", "slowkeys_beep_reject", FALSE}, + { CONFIG_ROOT "/slowkeys_beep_press", "slowkeys_beep_press" }, + { CONFIG_ROOT "/slowkeys_beep_accept", "slowkeys_beep_accept" }, + { CONFIG_ROOT "/slowkeys_beep_reject", "slowkeys_beep_reject" }, - { CONFIG_ROOT "/stickykeys_two_key_off", "stickykeys_two_key_off", FALSE }, - { CONFIG_ROOT "/stickykeys_modifier_beep", "stickykeys_modifier_beep", FALSE}, + { CONFIG_ROOT "/stickykeys_two_key_off", "stickykeys_two_key_off" }, + { CONFIG_ROOT "/stickykeys_modifier_beep", "stickykeys_modifier_beep" }, }; int i = G_N_ELEMENTS (simple_toggles); - while (i-- > 0) - if (as_dialog || !simple_toggles [i].only_for_dialog) { - GtkWidget *w = WID (simple_toggles [i].checkbox); + while (i-- > 0) { + GtkWidget *w = WID (simple_toggles [i].checkbox); - g_return_if_fail (w != NULL); + g_return_if_fail (w != NULL); - gconf_peditor_new_boolean (changeset, - (gchar *) simple_toggles [i].gconf_key, - w, NULL); - } + gconf_peditor_new_boolean (changeset, + (gchar *) simple_toggles [i].gconf_key, + w, NULL); + } } static GConfValue* @@ -192,7 +182,7 @@ cb_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) } static void -setup_ranges (GladeXML *dialog, GConfChangeSet *changeset, gboolean as_dialog) +setup_ranges (GladeXML *dialog, GConfChangeSet *changeset) { GObject *peditor; GtkWidget *slide, *spin; @@ -200,9 +190,6 @@ setup_ranges (GladeXML *dialog, GConfChangeSet *changeset, gboolean as_dialog) int i = G_N_ELEMENTS (ranges); while (i-- > 0) { - if (!as_dialog && ranges [i].only_for_dialog) - continue; - slide = WID (ranges [i].slide); spin = WID (ranges [i].spin); g_return_if_fail (slide != NULL); @@ -231,46 +218,32 @@ setup_ranges (GladeXML *dialog, GConfChangeSet *changeset, gboolean as_dialog) } static void -setup_images (GladeXML *dialog, gboolean as_dialog) +setup_images (GladeXML *dialog) { int i = G_N_ELEMENTS (features); while (i-- > 0) - if (features [i].image != NULL && - (as_dialog || !features [i].only_for_dialog)) { + if (features [i].image != NULL) gtk_image_set_from_file (GTK_IMAGE (WID (features [i].image)), features [i].image_file); - } } static void -setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, gboolean as_dialog) +cb_launch_keyboard_capplet (GtkButton *button, GtkWidget *dialog) { - GtkWidget *content = WID ("keyboard_table"); - GtkWidget *page = WID ("accessX_page"); - GObject *label; + GError *err = NULL; + if (!g_spawn_command_line_async ("gnome-keyboard-properties", &err)) + capplet_error_dialog (GTK_WINDOW (gtk_widget_get_toplevel (dialog)), + _("There was an error launching the keyboard capplet : %s"), + err); +} - - g_return_if_fail (content != NULL); - g_return_if_fail (page != NULL); - - setup_images (dialog, as_dialog); - setup_ranges (dialog, changeset, as_dialog); - setup_toggles (dialog, changeset, as_dialog); - setup_simple_toggles (dialog, changeset, as_dialog); - - label = g_object_new (GTK_TYPE_CHECK_BUTTON, - "label", _("_Enable keyboard accessibility"), - "use_underline", TRUE, - /* init true so that if gconf is false toggle will fire */ - "active", TRUE, - NULL); - gtk_frame_set_label_widget (GTK_FRAME (page), GTK_WIDGET (label)); - g_signal_connect (label, - "toggled", - G_CALLBACK (cb_accessibility_toggled), content); - gconf_peditor_new_boolean (changeset, - CONFIG_ROOT "/enable", - GTK_WIDGET (label), NULL); +static void +setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) +{ + setup_images (dialog); + setup_ranges (dialog, changeset); + setup_toggles (dialog, changeset); + setup_simple_toggles (dialog, changeset); } /*******************************************************************************/ @@ -465,31 +438,26 @@ cb_load_CDE_file (GtkButton *button, GtkWidget *dialog) /*******************************************************************************/ GtkWidget * -setup_accessX_dialog (GConfChangeSet *changeset, gboolean as_dialog) +setup_accessX_dialog (GConfChangeSet *changeset) { GConfClient *client; -#if 1 - char const *toplevel_name = as_dialog ? "accessX_dialog" : "accessX_page"; + char const *toplevel_name = "accessX_dialog"; GladeXML *dialog = glade_xml_new (GNOMECC_DATA_DIR - "/interfaces/gnome-accessibility-keyboard-properties.glade2", + "/interfaces/gnome-accessibility-keyboard-properties.glade", toplevel_name, NULL); - GtkWidget *toplevel = WID (toplevel_name); -#else - char const *toplevel_name = "key_access_dialog"; - GladeXML *dialog = glade_xml_new ("access-foo.glade", - toplevel_name, NULL); - GtkWidget *toplevel = WID (toplevel_name); -#endif + GtkWidget *toplevel = WID (toplevel_name); + client = gconf_client_get_default (); gconf_client_add_dir (client, CONFIG_ROOT, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - setup_dialog (dialog, changeset, as_dialog); + setup_dialog (dialog, changeset); + + g_signal_connect (G_OBJECT (WID ("load_CDE_file")), + "clicked", + G_CALLBACK (cb_load_CDE_file), toplevel); + g_signal_connect (G_OBJECT (WID ("launch_repeat_button")), + "clicked", + G_CALLBACK (cb_launch_keyboard_capplet), toplevel); - if (as_dialog) { - GtkWidget *load_cde = WID ("load_CDE_file"); - g_signal_connect (G_OBJECT (load_cde), - "clicked", - G_CALLBACK (cb_load_CDE_file), toplevel); - } return toplevel; } diff --git a/capplets/accessibility/keyboard/accessibility-keyboard.h b/capplets/accessibility/keyboard/accessibility-keyboard.h index f1fae31f4..f08343c93 100644 --- a/capplets/accessibility/keyboard/accessibility-keyboard.h +++ b/capplets/accessibility/keyboard/accessibility-keyboard.h @@ -27,6 +27,6 @@ #include #include -GtkWidget *setup_accessX_dialog (GConfChangeSet *changeset, gboolean as_dialog); +GtkWidget *setup_accessX_dialog (GConfChangeSet *changeset); #endif /* GNOME_ACCESSIBILITY_KEYBOARD_H */ diff --git a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c index 6ff720d80..7efa02868 100644 --- a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c +++ b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c @@ -37,19 +37,11 @@ dialog_response (GtkWidget *widget, gint response_id, GConfChangeSet *changeset) { - if (response_id == GTK_RESPONSE_HELP) { - GError *error = NULL; - - /* TODO : get this written */ - gnome_help_display_desktop (NULL, - "control-center-manual", + if (response_id == GTK_RESPONSE_HELP) + capplet_help (GTK_WINDOW (widget), "accessibility-keyboard.xml", - "CONFIGURATION", &error); - if (error) { - g_warning ("help error: %s\n", error->message); - g_error_free (error); - } - } else + "CONFIGURATION"); + else gtk_main_quit (); } @@ -69,7 +61,7 @@ main (int argc, char **argv) activate_settings_daemon (); changeset = NULL; - dialog = setup_accessX_dialog (changeset, TRUE); + dialog = setup_accessX_dialog (changeset); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (dialog_response), changeset); diff --git a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade2 b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade similarity index 54% rename from capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade2 rename to capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade index b61820d54..f80b7c03b 100644 --- a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade2 +++ b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade @@ -38,6 +38,72 @@ + + + True + True + True + GTK_RELIEF_NORMAL + 1 + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-revert-to-saved + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Import CDE AccessX file + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + True @@ -59,108 +125,103 @@ - + + 5 True - True - True - True - GTK_POS_TOP - False - 2 - 2 - False + 4 + 2 + False + 5 + 5 - + True 0 + 0.5 GTK_SHADOW_ETCHED_IN - + + 4 True - 14 - 10 + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_CHAR + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + True + Testing Area + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 1 + 2 + 3 + 4 + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 3 + True + 2 + 2 False - 0 - 0 + 3 + 3 - - True - False - 0 - - - - True - Only accept keys after they have been pressed and held for a user adjustable amount of time. - True - Enable Slo_w Keys - True - GTK_RELIEF_NORMAL - True - False - True - - - 0 - False - False - - - - - - True - - - 0 - True - True - - - - - 7 - 10 - 0 - 1 - fill - - - - - - True - msecs - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 2 - 0 - - - 3 - 4 - 2 - 3 - fill - fill - - - - - + True 0.5 0 5 - 0 + 5 0 @@ -172,18 +233,320 @@ + + + True + Beep when an LED is turned on and two beeps when one is turned off. + True + Enable _Toggle Keys + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + True + Repeat Key Preferences + True + GTK_RELIEF_NORMAL + + + 1 + 2 + 1 + 2 + fill + + + + + + + + + True + Toggle and Repeat Keys + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + 1 + 3 + 4 + fill + fill + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 2 + 2 + False + 0 + 0 + + + + True + True + B_eep when modifier is pressed + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + True + _Turn off Sticky Keys when +two keys pressed simultaneously + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + 0.5 + 0 + 5 + 5 + + + 0 + 1 + 0 + 2 + fill + + + + + + + + True + Perform multiple simultaneous key press operations by pressing modifier keys in sequence. + True + Enable _Sticky Keys + True + GTK_RELIEF_NORMAL + True + False + True + + + label_item + + + + + 1 + 2 + 2 + 3 + fill + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 3 + 2 + False + 0 + 0 + True 0.5 0 5 - 0 + 5 - 6 - 7 + 0 + 1 0 + 3 + fill + + + + + + True + _Only accept keypress after : + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 9 + 0 + + + + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + False + 0 + + + + True + True + False + GTK_POS_TOP + 1 + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 + + + + + + 0 + True + True + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + True + False + 1 0 100 1 10 10 + + + + + + + + 0 + False + True + + + + + + True + msecs + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 2 + 0 + + + + + + 0 + False + False + + + + + 1 + 2 + 1 2 fill fill @@ -191,7 +554,7 @@ - + True 3 2 @@ -287,16 +650,78 @@ - 7 - 10 - 3 - 6 + 1 + 2 + 2 + 3 + fill fill + + + + + + True + Only accept keys after they have been pressed and held for a user adjustable amount of time. + True + Enable Slo_w Keys + True + GTK_RELIEF_NORMAL + True + False + True + + + label_item + + + + + 1 + 2 + 1 + 2 + fill + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 3 + 2 + False + 0 + 0 + + + + True + 0.5 + 0 + 5 + 5 + + + 0 + 1 + 0 + 3 + fill + + - + True _Ignore keypresses within : True @@ -308,21 +733,175 @@ 0.5 10 0 + + + 1 - 4 - 1 - 2 + 2 + 0 + 1 fill - + True - _Only accept keypress after : + False + 0 + + + + True + True + False + GTK_POS_TOP + 1 + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 + + + + + + 0 + True + True + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 0 100 1 10 10 + + + + + + + + 0 + True + True + + + + + + True + msecs + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 2 + 0 + + + + + + 0 + False + False + + + + + 1 + 2 + 1 + 2 + fill + fill + + + + + + True + True + Beep when key is re_jected + True + GTK_RELIEF_NORMAL + False + False + True + + + 1 + 2 + 2 + 3 + fill + + + + + + + + + True + Ignore all subsequent presses of the SAME key if they happen within a user selectable period of time. + True + Enable _Bounce Keys + True + GTK_RELIEF_NORMAL + True + False + True + + + label_item + + + + + 0 + 1 + 2 + 3 + fill + fill + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 6 + 4 + False + 0 + 0 + + + + True + Ma_ximum pointer speed : True False GTK_JUSTIFY_LEFT @@ -330,641 +909,96 @@ False 0 0.5 - 10 + 0 0 - - - 7 - 10 - 1 - 2 - fill - - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 0 100 1 10 10 - - - 2 - 3 - 2 - 3 - fill - - - - - - - True - True - False - GTK_POS_TOP - 1 - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - 1 - 2 - 2 - 3 - fill - - - - - - True - False - 0 - - - - True - True - False - GTK_POS_TOP - 1 - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - 0 - True - True - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - True - False - 1 0 100 1 10 10 - - - 0 - False - True - - - - - - True - msecs - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 2 - 0 - - - 0 - False - False - - - - - 7 - 10 - 2 - 3 - fill - - - - - - True - True - _Turn off Sticky Keys when -two keys pressed simultaneously - True - GTK_RELIEF_NORMAL - True - False - True - - - 7 - 10 - 9 - 11 - fill - - - - - - - True - True - B_eep when modifier is pressed - True - GTK_RELIEF_NORMAL - True - False - True - - - 7 - 10 - 8 - 9 - fill - - - - - - - True - False - 0 - - - - True - Perform multiple simultaneous key press operations by pressing modifier keys in sequence. - True - Enable _Sticky Keys - True - GTK_RELIEF_NORMAL - True - False - True - - - 0 - False - False - - - - - - True - - - 0 - True - True - - - - - 7 - 10 - 7 - 8 - fill - - - - - - True - 0.5 - 0 - 5 - 0 - - - 6 - 7 - 7 - 9 - fill - fill - - - - - - True - False - 0 - - - - True - Beep when an LED is turned on and two beeps when one is turned off. - True - Enable _Toggle Keys - True - GTK_RELIEF_NORMAL - True - False - True - - - 0 - False - False - - - - - - True - - - 0 - True - True - - - - - 7 - 10 - 12 - 13 - fill - fill - - - - - - True - 6 - 3 - False - 0 - 0 - - - - True - Ma_ximum pointer speed : - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 3 - 0 - 1 - fill - - - - - - - True - Start mo_ving this long after keypress : - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 3 - 4 - 5 - fill - - - - - - - True - pixels/sec - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 2 - 0 - - - 2 - 3 - 1 - 2 - fill - fill - - - - - - True - msecs - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 2 - 0 - - - 2 - 3 - 3 - 4 - fill - fill - - - - - - True - msecs - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 2 - 0 - - - 2 - 3 - 5 - 6 - fill - fill - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - True - False - 1 0 100 1 10 10 - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - True - False - 1 0 100 1 10 10 - - - 1 - 2 - 3 - 4 - fill - fill - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - True - False - 1 0 100 1 10 10 - - - 1 - 2 - 5 - 6 - fill - fill - - - - - - True - True - False - GTK_POS_TOP - 1 - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - True - True - False - GTK_POS_TOP - 1 - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - True - True - False - GTK_POS_TOP - 1 - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - 0 - 1 - 5 - 6 - fill - - - - - - True - Time to _accelerate to max speed : - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 3 - 2 - 3 - fill - - - + + + 1 4 - 5 - 11 + 0 + 1 fill - fill + - + True - 0.5 - 0 - 5 + Start mo_ving this long after keypress : + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 0 - - - 0 - 1 - 4 - 6 - fill - fill - - - - - - True - False - 0 - - - - True - Beep when: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - True - key is re_jected - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - + + + 1 4 + 4 + 5 + fill + + + + + + + True + pixels/sec + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 2 + 0 + + + + + + 3 + 4 + 1 + 2 + fill + fill + + + + + + True + msecs + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 2 + 0 + + + + + + 3 + 4 3 4 fill @@ -973,24 +1007,313 @@ two keys pressed simultaneously - + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + True + False + 1 0 100 1 10 10 + + + + + + + + 2 + 3 + 1 + 2 + fill + fill + + + + + + True + True + False + GTK_POS_TOP + 1 + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + True + Time to _accelerate to max speed : + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + 1 + 4 + 2 + 3 + fill + + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + True + False + 1 0 100 1 10 10 + + + + + + + + 2 + 3 + 5 + 6 + + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + True + False + 1 0 100 1 10 10 + + + + + + + + 2 + 3 + 3 + 4 + + + + + + + True + True + False + GTK_POS_TOP + 1 + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 + + + + + + 1 + 2 + 3 + 4 + fill + fill + + + + + + True + True + False + GTK_POS_TOP + 1 + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 + + + + + + 1 + 2 + 5 + 6 + fill + fill + + + + + + True + msecs + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 2 + 0 + + + + + + 3 + 4 + 5 + 6 + fill + + + + + + + True + 0.5 + 0 + 5 + 5 + + + 0 + 1 + 0 + 6 + fill + + + + + + + + True + Turn the numeric keypad into a mouse control pad. + True + Enable _Mouse Keys + True + GTK_RELIEF_NORMAL + True + False + True + + + label_item + + + + + 0 + 1 + 1 + 2 + fill + fill + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 15 + True + False + 10 + + + + True + 0 + 0 + 0 + 0 + + + + True + True + _Beep when enabling/disabling keyboard accessibility features + True + GTK_RELIEF_NORMAL + False + False + True + + + + + 0 + False + False + + + + + True False 0 - + True - <b>Test</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 + True + _Disable if unused for + True + GTK_RELIEF_NORMAL + True + False + True 0 @@ -1000,32 +1323,15 @@ two keys pressed simultaneously - - 4 + True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_CHAR - True - 0 - 0 - 0 - 0 - 0 - 0 - - - + False + GTK_POS_TOP + 1 + GTK_UPDATE_CONTINUOUS + False + 0 0 0 0 0 0 0 @@ -1033,47 +1339,18 @@ two keys pressed simultaneously True - - - 0 - 4 - 12 - 14 - 30 - 5 - - - - - - True - - - 5 - 6 - 0 - 14 - - - - - - - True - False - 0 - + True - Ignore all subsequent presses of the SAME key if they happen within a user selectable period of time. True - Enable _Bounce Keys - True - GTK_RELIEF_NORMAL - True - False - True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 0 100 1 10 10 0 @@ -1083,371 +1360,60 @@ two keys pressed simultaneously - - True - - - 0 - True - True - - - - - 1 - 5 - 0 - 1 - fill - fill - - - - - - True - False - 0 - - - - True - Turn the numeric keypad into a mouse control pad. - True - Enable _Mouse Keys - True - GTK_RELIEF_NORMAL - True - False - True - - - 0 - False - True - - - - - - True - - - 0 - True - True - - - - - 1 - 5 - 4 - 5 - fill - - - - - - True - - - 0 - 4 - 11 - 12 - fill - fill - - - - - - 8 - True - - - 4 - 5 - 11 - 12 - fill - fill - - - - - - True - 0.5 - 0 - 5 - 0 - - - 6 - 7 - 12 - 14 - 3 - fill - fill - - - - - - - False - True - - - - - - True - _Keyboard - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 15 - True - False - 10 - - - - True - 0 - 0 - 0 - 0 - - - - True - True - _Beep when enabling/disabling keyboard accessibility features - True - GTK_RELIEF_NORMAL - False - False - True - - - - - 0 - False - False - - - - - - True - False - 0 - - - - True - True - _Disable if unused for - True - GTK_RELIEF_NORMAL - True - False - True - - - 0 - False - False - - - - - - True - True - False - GTK_POS_TOP - 1 - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - 0 - True - True - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 0 100 1 10 10 - - - 0 - False - True - - - - - - True - seconds - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 5 - 0 - - - 0 - False - False - - - - - 0 - False - True - - - - - - True - 0 - 0.5 - 0 - 1 - - - - True - True - GTK_RELIEF_NORMAL - - - + True + seconds + False + False + GTK_JUSTIFY_LEFT + False + False 0.5 0.5 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-revert-to-saved - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Import CDE AccessX file - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - + 5 + 0 + + 0 + False + False + + + 0 + False + True + + + + + + True + General + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + - 0 - False - False + label_item - False - True - - - - - - True - _Misc - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab + 0 + 2 + 0 + 1 + fill diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog index e87681a34..ed696f659 100644 --- a/capplets/common/ChangeLog +++ b/capplets/common/ChangeLog @@ -1,3 +1,8 @@ +2002-06-13 Jody Goldberg + + * capplet-util.c (capplet_help) : Use the new utility. + (capplet_error_dialog) : split out into a new utility. + 2002-06-17 Jody Goldberg * Release 2.0.0 diff --git a/capplets/common/capplet-util.c b/capplets/common/capplet-util.c index 84e392c44..24d03f18d 100644 --- a/capplets/common/capplet-util.c +++ b/capplets/common/capplet-util.c @@ -285,6 +285,35 @@ capplet_init (int argc, #endif + +/** + * capplet_error_dialog : + * + * @parent : + * @msg : already translated. + * @err : + * + */ +void +capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err) +{ + if (err != NULL) { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + msg, err->message); + + g_signal_connect (G_OBJECT (dialog), + "response", + G_CALLBACK (gtk_widget_destroy), NULL); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); + gtk_widget_show (dialog); + g_error_free (err); + } +} /** * capplet_help : * @parent : @@ -305,21 +334,8 @@ capplet_help (GtkWindow *parent, char const *helpfile, char const *section) gnome_help_display_desktop (NULL, "user-guide", helpfile, section, &error); - if (error) { - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (GTK_WINDOW (parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, + if (error != NULL) + capplet_error_dialog (parent, _("There was an error displaying help: %s"), - error->message); - - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (gtk_widget_destroy), NULL); - gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); - gtk_widget_show (dialog); - g_error_free (error); - } + error); } diff --git a/capplets/common/capplet-util.h b/capplets/common/capplet-util.h index 39b501c28..197a02f1a 100644 --- a/capplets/common/capplet-util.h +++ b/capplets/common/capplet-util.h @@ -90,6 +90,7 @@ void capplet_init (int argc, SetupPropertyEditorsFn setup_property_editors_fn, GetLegacySettingsFn get_legacy_settings_fn); +void capplet_error_dialog (GtkWindow *parent, char const *msg, GError *err); void capplet_help (GtkWindow *parent, char const *helpfile, char const *section); #endif /* __CAPPLET_UTIL_H */ diff --git a/capplets/file-types/ChangeLog b/capplets/file-types/ChangeLog index cb8a57565..467b26ab1 100644 --- a/capplets/file-types/ChangeLog +++ b/capplets/file-types/ChangeLog @@ -1,12 +1,56 @@ -2002-06-17 Jody Goldberg - - * Release 2.0.0 - 2002-06-15 Jody Goldberg + http://bugzilla.gnome.org/show_bug.cgi?id=85397 + http://bugzilla.gnome.org/show_bug.cgi?id=84545 * mime-types-model.c (mime_types_model_get_value) : gtk_tree_view_search_equal_func does not like NULL. (IS_CATEGORY) : check for NULL. + * file-types-capplet.c (create_dialog) : search the description not + the mime type. + +2002-06-08 Jody Goldberg + + * mime-types-model.c (IS_CATEGORY) : test for null in case we are + stupid. + +2002-06-07 Jody Goldberg + + * file-types-capplet.c (dialog_done_cb) : no need to save things + again. The only caller had already done that. + + * mime-type-info.c (mime_type_info_save) : Don't mess with the + application here, it should already be setup. However, be really + really anal about verifying it because I do not trust the + surrounding code or know it well enough to trust it. Make sure that + the assigned app is on the short list of associated apps. + + * mime-category-edit-dialog.c (store_data) : Use + mime_edit_dialog_get_app. + * mime-edit-dialog.c (store_data) : Use it here too. + (mime_edit_dialog_get_app) : new. split some duplicated code out of + the type and category dialogs and move it here. Then make it + readable and less stupid about creating copies of existing + applications. While we're at it have it handle the creation of new + applications, merging commands with existing applications and other + useful stuff. + +2002-06-07 Jody Goldberg + + * mime-category-edit-dialog.c (store_data) : clarify and remove the + custom flag. + + * mime-type-info.c (mime_category_info_using_custom_app) : delete. + (mime_type_info_using_custom_app) : delete. + + * mime-edit-dialog.c (validate_data) : correct the warning about + invalid type, we would _not_ create one for the user :-( + Allow a user to optionally overwrite an existing mime type. + This is useful when editing. + * mime-edit-dialog.c (store_data) : clarify and remove the custom flag. + +2002-06-17 Jody Goldberg + + * Release 2.0.0 2002-06-05 Jody Goldberg diff --git a/capplets/file-types/file-types-capplet.c b/capplets/file-types/file-types-capplet.c index f066b6969..4b4f903c5 100644 --- a/capplets/file-types/file-types-capplet.c +++ b/capplets/file-types/file-types-capplet.c @@ -219,6 +219,9 @@ create_dialog (void) gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_set_attributes (column, renderer, "text", MODEL_COLUMN_DESCRIPTION, NULL); + g_object_set (G_OBJECT (treeview), + "search_column", MODEL_COLUMN_DESCRIPTION, + NULL); gtk_tree_view_column_set_title (column, _("Description")); gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); @@ -255,9 +258,6 @@ create_dialog (void) static void dialog_done_cb (MimeEditDialog *dialog, gboolean done, MimeTypeInfo *info) { - if (done) - mime_type_info_save (info); - gtk_main_quit (); } diff --git a/capplets/file-types/mime-category-edit-dialog.c b/capplets/file-types/mime-category-edit-dialog.c index 3cab10947..3604f45f3 100644 --- a/capplets/file-types/mime-category-edit-dialog.c +++ b/capplets/file-types/mime-category-edit-dialog.c @@ -33,6 +33,7 @@ #include "mime-types-model.h" #include "mime-type-info.h" #include "mime-category-edit-dialog.h" +#include "mime-edit-dialog.h" #define WID(x) (glade_xml_get_widget (dialog->p->dialog_xml, x)) @@ -399,40 +400,11 @@ update_subcategories (ModelEntry *entry, MimeCategoryInfo *category) static void store_data (MimeCategoryEditDialog *dialog) { - GtkOptionMenu *option_menu; - GtkMenuShell *menu_shell; - GObject *menu_item; - gint idx; - - GnomeVFSMimeApplication *app; - - option_menu = GTK_OPTION_MENU (WID ("default_action_select")); - menu_shell = GTK_MENU_SHELL (gtk_option_menu_get_menu (option_menu)); - idx = gtk_option_menu_get_history (option_menu); - menu_item = (g_list_nth (menu_shell->children, idx))->data; - - app = g_object_get_data (menu_item, "app"); - if (app != NULL) { - gnome_vfs_mime_application_free (dialog->p->info->default_action); - dialog->p->info->default_action = gnome_vfs_mime_application_copy (app); - } else { - if (!mime_category_info_using_custom_app (dialog->p->info)) { - gnome_vfs_mime_application_free (dialog->p->info->default_action); - dialog->p->info->default_action = g_new0 (GnomeVFSMimeApplication, 1); - } - - g_free (dialog->p->info->default_action->command); - dialog->p->info->default_action->command - = g_strdup (gtk_entry_get_text (GTK_ENTRY - (gnome_file_entry_gtk_entry - (GNOME_FILE_ENTRY (WID ("program_entry")))))); - dialog->p->info->default_action->requires_terminal - = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("needs_terminal_toggle"))); - } - - dialog->p->info->use_parent_category = - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("use_category_toggle"))); - + mime_edit_dialog_get_app (dialog->p->dialog_xml, + dialog->p->info->description, + &(dialog->p->info->default_action)); + dialog->p->info->use_parent_category = gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON (WID ("use_category_toggle"))); model_entry_save (MODEL_ENTRY (dialog->p->info)); update_subcategories (MODEL_ENTRY (dialog->p->info), dialog->p->info); } diff --git a/capplets/file-types/mime-edit-dialog.c b/capplets/file-types/mime-edit-dialog.c index c2a8a1e5b..a84b1c128 100644 --- a/capplets/file-types/mime-edit-dialog.c +++ b/capplets/file-types/mime-edit-dialog.c @@ -602,6 +602,102 @@ collect_filename_extensions (MimeEditDialog *dialog) return ret; } +/** + * mime_edit_dialog_get_app : + * @glade : + * @mime_type : a fall back in case we can't generate a meaningful application name. + * @current : + * + * A utility routine for looking up applications. it should handle life cycle + * and hopefully merge in existing copies of custom applications. + **/ +void +mime_edit_dialog_get_app (GladeXML *glade, char const *mime_type, + GnomeVFSMimeApplication **current) +{ + GtkWidget *menu = glade_xml_get_widget (glade, "default_action_select"); + gint idx = gtk_option_menu_get_history (GTK_OPTION_MENU (menu)); + GtkWidget *shell = gtk_option_menu_get_menu (GTK_OPTION_MENU (menu)); + GObject *item = (g_list_nth (GTK_MENU_SHELL (shell)->children, idx))->data; + + GnomeVFSMimeApplication *res, *app = g_object_get_data (item, "app"); + + if (app == NULL) { + char *cmd = gnome_file_entry_get_full_path ( + GNOME_FILE_ENTRY (glade_xml_get_widget (glade, "program_entry")), FALSE); + gboolean requires_terminal = gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON (glade_xml_get_widget (glade, "needs_terminal_toggle"))); + char *base_cmd; + + GList *ptr, *app_list = NULL; + + /* I have no idea what semantics people want, but I'll be anal + * and avoid NULL + */ + if (cmd != NULL) + cmd = g_strdup (""); + base_cmd = g_path_get_basename (cmd); + if (base_cmd == NULL); + base_cmd = g_strdup (""); + + app_list = gnome_vfs_application_registry_get_applications (NULL); + for (ptr = app_list; ptr != NULL ; ptr = ptr->next) { + char const *app_cmd = gnome_vfs_application_registry_peek_value (ptr->data, + GNOME_VFS_APPLICATION_REGISTRY_COMMAND); + + /* Look for a matching application (with or without path) */ + if (app_cmd != NULL && + (!strcmp (cmd, app_cmd) || !strcmp (base_cmd, app_cmd))) { + gboolean ok, app_req = gnome_vfs_application_registry_get_bool_value (ptr->data, + GNOME_VFS_APPLICATION_REGISTRY_REQUIRES_TERMINAL, &ok); + if (ok && app_req == requires_terminal) + break; + } + } + + /* No existing application, lets create one */ + if (ptr == NULL) { + res = g_new0 (GnomeVFSMimeApplication, 1); + res->command = cmd; + res->requires_terminal = requires_terminal; + + res->name = base_cmd; + if (res->name != NULL && *res->name) { + /* Can we use the app name as the id ? + * We know that there are no apps with the same + * command, so if the id is taken we are screwed + */ + if (gnome_vfs_application_registry_get_mime_application (res->name) == NULL) + res->id = g_strdup (res->name); + } else { /* fail safe to ensure a name */ + g_free (res->name); + res->name = g_strdup_printf ("Custom %s", mime_type); + } + + /* If there is no id yet, make up a unique string */ + if (res->id == NULL) { + uuid_t app_uuid; + gchar app_uuid_str[100]; + uuid_generate (app_uuid); + uuid_unparse (app_uuid, app_uuid_str); + res->id = g_strdup (app_uuid_str); + } + + gnome_vfs_application_registry_save_mime_application (res); + } else { + g_free (cmd); + g_free (base_cmd); + res = gnome_vfs_application_registry_get_mime_application (ptr->data); + } + + g_list_free (app_list); + } else + res = gnome_vfs_mime_application_copy (app); + + gnome_vfs_mime_application_free (*current); + *current = res; +} + static void store_data (MimeEditDialog *dialog) { @@ -618,8 +714,6 @@ store_data (MimeEditDialog *dialog) uuid_t mime_uuid; gchar mime_uuid_str[100]; - GnomeVFSMimeApplication *app; - GtkTreeIter iter; GtkTreePath *path; @@ -665,31 +759,9 @@ store_data (MimeEditDialog *dialog) CORBA_free (dialog->p->info->default_component); dialog->p->info->default_component = g_object_get_data (menu_item, "component"); - option_menu = GTK_OPTION_MENU (WID ("default_action_select")); - menu_shell = GTK_MENU_SHELL (gtk_option_menu_get_menu (option_menu)); - idx = gtk_option_menu_get_history (option_menu); - menu_item = (g_list_nth (menu_shell->children, idx))->data; - - app = g_object_get_data (menu_item, "app"); - if (app != NULL) { - gnome_vfs_mime_application_free (dialog->p->info->default_action); - dialog->p->info->default_action = gnome_vfs_mime_application_copy (app); - } else { - if (!mime_type_info_using_custom_app (dialog->p->info)) { - gnome_vfs_mime_application_free (dialog->p->info->default_action); - dialog->p->info->default_action = g_new0 (GnomeVFSMimeApplication, 1); - } else if (!dialog->p->info->default_action) { - dialog->p->info->default_action = g_new0 (GnomeVFSMimeApplication, 1); - } - - g_free (dialog->p->info->default_action->command); - dialog->p->info->default_action->command - = g_strdup (gtk_entry_get_text (GTK_ENTRY - (gnome_file_entry_gtk_entry - (GNOME_FILE_ENTRY (WID ("program_entry")))))); - dialog->p->info->default_action->requires_terminal - = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("needs_terminal_toggle"))); - } + mime_edit_dialog_get_app (dialog->p->dialog_xml, + dialog->p->info->mime_type, + &(dialog->p->info->default_action)); ext_list = collect_filename_extensions (dialog); mime_type_info_set_file_extensions (dialog->p->info, ext_list); @@ -716,30 +788,33 @@ store_data (MimeEditDialog *dialog) static gboolean validate_data (MimeEditDialog *dialog) { - const gchar *tmp; - const gchar *mesg = NULL; + const gchar *mime_type; + GtkWidget *err_dialog = NULL; - tmp = gtk_entry_get_text (GTK_ENTRY (WID ("mime_type_entry"))); + mime_type = gtk_entry_get_text (GTK_ENTRY (WID ("mime_type_entry"))); - if (tmp != NULL && *tmp != '\0') { - if (strchr (tmp, ' ') || !strchr (tmp, '/')) { - mesg = _("Invalid MIME type. Please enter a valid MIME type, or " - "leave the field blank to have one generated for you."); - } else if (dialog->p->is_add && (gnome_vfs_mime_type_is_known (tmp) || - get_mime_type_info (tmp) != NULL)) { - mesg = _("There already exists a MIME type of that name."); + if (mime_type != NULL && *mime_type != '\0') { + if (strchr (mime_type, ' ') || !strchr (mime_type, '/')) { + err_dialog = gtk_message_dialog_new ( + GTK_WINDOW (dialog->p->dialog_win), + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, + GTK_BUTTONS_CANCEL, + _("Please enter a valid MIME type. It should be of the form " + "class/type and may not contain any spaces.")); + } else if (dialog->p->is_add && (gnome_vfs_mime_type_is_known (mime_type) || + get_mime_type_info (mime_type) != NULL)) { + err_dialog = gtk_message_dialog_new ( + GTK_WINDOW (dialog->p->dialog_win), + GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, + GTK_BUTTONS_OK_CANCEL, + _("A MIME type with that name already exists, overwrite ?.")); } } - if (mesg != NULL) { - GtkWidget *err_dialog = gtk_message_dialog_new ( - GTK_WINDOW (dialog->p->dialog_win), - GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - mesg); - gtk_dialog_run (GTK_DIALOG (err_dialog)); + if (err_dialog) { + int res = gtk_dialog_run (GTK_DIALOG (err_dialog)); gtk_object_destroy (GTK_OBJECT (err_dialog)); - return FALSE; + return res != GTK_RESPONSE_CANCEL; } return TRUE; } diff --git a/capplets/file-types/mime-edit-dialog.h b/capplets/file-types/mime-edit-dialog.h index 8d54f449a..7623c7310 100644 --- a/capplets/file-types/mime-edit-dialog.h +++ b/capplets/file-types/mime-edit-dialog.h @@ -58,6 +58,9 @@ GObject *mime_edit_dialog_new (GtkTreeModel *model, MimeTypeInfo *info); GObject *mime_add_dialog_new (GtkTreeModel *model, GtkWindow *parent); +void mime_edit_dialog_get_app (GladeXML *glade, char const *mime_type, + GnomeVFSMimeApplication **current); + G_END_DECLS #endif /* __MIME_EDIT_DIALOG_H */ diff --git a/capplets/file-types/mime-type-info.c b/capplets/file-types/mime-type-info.c index 88e017a71..8417f4b7c 100644 --- a/capplets/file-types/mime-type-info.c +++ b/capplets/file-types/mime-type-info.c @@ -194,22 +194,6 @@ mime_type_info_get_category_name (const MimeTypeInfo *info) return mime_category_info_get_full_description (MIME_CATEGORY_INFO (info->entry.parent)); } -gboolean -mime_type_info_using_custom_app (const MimeTypeInfo *info) -{ - gchar *tmp; - gboolean ret; - - if (!info->default_action || !info->default_action->name) - return TRUE; - - tmp = g_strdup_printf ("Custom %s", info->mime_type); - ret = !strcmp (tmp, info->default_action->name); - g_free (tmp); - - return ret; -} - void mime_type_info_set_category_name (const MimeTypeInfo *info, const gchar *category_name, const gchar *category_desc, GtkTreeModel *model) { @@ -234,43 +218,34 @@ mime_type_info_set_file_extensions (MimeTypeInfo *info, GList *list) } void -mime_type_info_save (const MimeTypeInfo *info) +mime_type_info_save (MimeTypeInfo *info) { gchar *tmp; - uuid_t app_uuid; - gchar app_uuid_str[100]; gnome_vfs_mime_freeze (); gnome_vfs_mime_set_description (info->mime_type, info->description); gnome_vfs_mime_set_icon (info->mime_type, info->icon_name); - if (info->default_action != NULL && - info->default_action->command != NULL && - info->default_action->command [0] != '\0') { - tmp = g_strdup_printf ("Custom %s", info->mime_type); - - if (info->default_action->name == NULL) - info->default_action->name = tmp; - - if (info->default_action->id == NULL) { - uuid_generate (app_uuid); - uuid_unparse (app_uuid, app_uuid_str); - - info->default_action->id = g_strdup (app_uuid_str); - } else if (!strcmp (tmp, info->default_action->name)) { - gnome_vfs_application_registry_set_value (info->default_action->id, "command", - info->default_action->command); - gnome_vfs_application_registry_set_bool_value (info->default_action->id, "requires_terminal", - info->default_action->requires_terminal); + /* Be really anal about validating this action */ + if (info->default_action != NULL) { + if ( info->default_action->command == NULL || + *info->default_action->command == '\0' || + info->default_action->id == NULL || + *info->default_action->id == '\0') { + g_warning ("Invalid application"); + gnome_vfs_mime_application_free (info->default_action); + info->default_action = NULL; } - - gnome_vfs_mime_set_default_application (info->mime_type, info->default_action->id); - - gnome_vfs_application_registry_save_mime_application (info->default_action); - } else { - gnome_vfs_mime_set_default_application (info->mime_type, NULL); } + if (info->default_action != NULL) { + gnome_vfs_mime_set_default_application (info->mime_type, + info->default_action->id); + gnome_vfs_mime_add_application_to_short_list (info->mime_type, + info->default_action->id); + } else + gnome_vfs_mime_set_default_application (info->mime_type, NULL); + tmp = form_extensions_string (info, " ", NULL); gnome_vfs_mime_set_extensions_list (info->mime_type, tmp); g_free (tmp); @@ -383,24 +358,6 @@ mime_category_info_load_all (MimeCategoryInfo *category) g_free (tmp1); } -gboolean -mime_category_info_using_custom_app (const MimeCategoryInfo *category) -{ - gchar *tmp; - gboolean ret; - - if (category == NULL || - category->default_action == NULL || - category->default_action->name == NULL) - return TRUE; - - tmp = g_strdup_printf ("Custom %s", category->name); - ret = !strcmp (tmp, category->default_action->name); - g_free (tmp); - - return ret; -} - static void set_subcategory_ids (ModelEntry *entry, MimeCategoryInfo *category, gchar *app_id) { @@ -427,54 +384,36 @@ set_subcategory_ids (ModelEntry *entry, MimeCategoryInfo *category, gchar *app_i void mime_category_info_save (MimeCategoryInfo *category) { - gchar *tmp, *tmp1, *tmp2; - uuid_t app_uuid; - gchar app_uuid_str[100]; + gchar *key, *basename; gboolean set_ids; - tmp1 = get_gconf_base_name (category); - - tmp = g_strconcat (tmp1, "/default-action-id", NULL); - - if (category->default_action != NULL && - category->default_action->command != NULL && - *category->default_action->command != '\0') - { - tmp2 = g_strdup_printf ("Custom %s", category->name); - - if (category->default_action->name == NULL) - category->default_action->name = tmp2; - - if (category->default_action->id == NULL) { - uuid_generate (app_uuid); - uuid_unparse (app_uuid, app_uuid_str); - - category->default_action->id = g_strdup (app_uuid_str); - - gnome_vfs_application_registry_save_mime_application (category->default_action); - gnome_vfs_application_registry_sync (); + /* Be really anal about validating this action */ + if (category->default_action != NULL) { + if ( category->default_action->command == NULL || + *category->default_action->command == '\0' || + category->default_action->id == NULL || + *category->default_action->id == '\0') { + g_warning ("Invalid application"); + gnome_vfs_mime_application_free (category->default_action); + category->default_action = NULL; } - else if (!strcmp (tmp, category->default_action->name)) { - gnome_vfs_application_registry_set_value (category->default_action->id, "command", - category->default_action->command); - gnome_vfs_application_registry_set_bool_value (category->default_action->id, "requires_terminal", - category->default_action->requires_terminal); - } - - gconf_client_set_string (gconf_client_get_default (), - tmp, category->default_action->id, NULL); - set_ids = TRUE; - } else { - gconf_client_unset (gconf_client_get_default (), tmp, NULL); - set_ids = FALSE; } - g_free (tmp); + basename = get_gconf_base_name (category); + key = g_strconcat (basename, "/default-action-id", NULL); + if (category->default_action != NULL) { + gconf_client_set_string (gconf_client_get_default (), + key, category->default_action->id, NULL); + set_ids = TRUE; + } else + gconf_client_unset (gconf_client_get_default (), key, NULL); + g_free (key); - tmp = g_strconcat (tmp1, "/use-parent-category", NULL); - gconf_client_set_bool (gconf_client_get_default (), tmp, category->use_parent_category, NULL); - g_free (tmp); - g_free (tmp1); + key = g_strconcat (basename, "/use-parent-category", NULL); + gconf_client_set_bool (gconf_client_get_default (), key, + category->use_parent_category, NULL); + g_free (key); + g_free (basename); if (set_ids) set_subcategory_ids (MODEL_ENTRY (category), category, category->default_action->id); @@ -570,10 +509,8 @@ reduce_supported_app_list (ModelEntry *entry, GList *list, gboolean top) GList * mime_category_info_find_apps (MimeCategoryInfo *info) { - GList *ret; - - ret = find_possible_supported_apps (MODEL_ENTRY (info), TRUE); - return reduce_supported_app_list (MODEL_ENTRY (info), ret, TRUE); + return reduce_supported_app_list (MODEL_ENTRY (info), + find_possible_supported_apps (MODEL_ENTRY (info), TRUE), TRUE); } gchar * diff --git a/capplets/file-types/mime-type-info.h b/capplets/file-types/mime-type-info.h index 264e810b9..f211ff81f 100644 --- a/capplets/file-types/mime-type-info.h +++ b/capplets/file-types/mime-type-info.h @@ -84,15 +84,13 @@ const GList *mime_type_info_get_file_extensions (MimeTypeInfo *info); const gchar *mime_type_info_get_icon_path (MimeTypeInfo *info); gboolean mime_type_info_get_use_category (MimeTypeInfo *info); -void mime_type_info_save (const MimeTypeInfo *info); +void mime_type_info_save (MimeTypeInfo *info); void mime_type_info_free (MimeTypeInfo *info); gchar *mime_type_info_get_file_extensions_pretty_string (MimeTypeInfo *info); gchar *mime_type_info_get_category_name (const MimeTypeInfo *info); -gboolean mime_type_info_using_custom_app (const MimeTypeInfo *info); - void mime_type_info_set_category_name (const MimeTypeInfo *info, const gchar *category_name, const gchar *category_desc, @@ -105,7 +103,6 @@ MimeCategoryInfo *mime_category_info_new (MimeCategoryInfo *parent, const gchar *description, GtkTreeModel *model); void mime_category_info_load_all (MimeCategoryInfo *category); -gboolean mime_category_info_using_custom_app (const MimeCategoryInfo *category); void mime_category_info_save (MimeCategoryInfo *category); GList *mime_category_info_find_apps (MimeCategoryInfo *info); diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index 5d8b3deb7..e58436316 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,9 @@ +2002-06-13 Jody Goldberg + + * gnome-keyboard-properties.c (accessibility_button_clicked) : produce + a better warning for failure to launch the keyboard accessibility + capplet. + 2002-06-17 Jody Goldberg * Release 2.0.0 diff --git a/capplets/keyboard/gnome-keyboard-properties.c b/capplets/keyboard/gnome-keyboard-properties.c index 08acff41a..64b77654d 100644 --- a/capplets/keyboard/gnome-keyboard-properties.c +++ b/capplets/keyboard/gnome-keyboard-properties.c @@ -235,7 +235,11 @@ static void accessibility_button_clicked (GtkWidget *widget, gpointer data) { - g_spawn_command_line_async ("gnome-accessibility-keyboard-properties", NULL); + 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 diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am index 6436393aa..4e048ad4d 100644 --- a/gnome-settings-daemon/Makefile.am +++ b/gnome-settings-daemon/Makefile.am @@ -34,6 +34,7 @@ gnome_settings_daemon_SOURCES = \ xsettings-manager.h \ gnome-settings-keybindings.c \ gnome-settings-keybindings.h \ + $(AccessX_files) \ $(CORBA_GENERATED) gnome_settings_daemon_LDADD = \ @@ -42,6 +43,12 @@ gnome_settings_daemon_LDADD = \ $(top_builddir)/libsounds/libsounds.a \ $(XF86MISC_LIBS) +#AccessX_files = \ +# AccessXcomm.c \ +# extutil.h \ +# AccessXproto.h \ +# AccessXlibint.h + CORBA_GENERATED_HEADER_FILES = GNOME_SettingsDaemon.h CORBA_GENERATED = \