From 69a2971101376b6bb512626598763679aee284b3 Mon Sep 17 00:00:00 2001 From: "Sergey V. Udaltsov" Date: Sun, 2 Apr 2006 01:11:42 +0000 Subject: fixed the buggon sensitivity, b.g.o#336396 --- capplets/keyboard/ChangeLog | 7 +++++++ capplets/keyboard/gnome-keyboard-properties-xkblt.c | 21 ++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index 10e6ebabb..390496334 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,10 @@ +2006-03-02 Sergey Udaltsov + + Fixes #336396 + + * gnome-keyboard-properties-xkblt.c: fixed the buttons sensitivity + change. + 2006-01-26 Rodrigo Moya Fixes #328748 diff --git a/capplets/keyboard/gnome-keyboard-properties-xkblt.c b/capplets/keyboard/gnome-keyboard-properties-xkblt.c index 0ee37a3d9..e79dde8e2 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkblt.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkblt.c @@ -53,6 +53,8 @@ static int defaultGroup = -1; static GtkCellRenderer *textRenderer; static GtkCellRenderer *toggleRenderer; +static gboolean disableButtonsSensibilityUpdate = FALSE; + void clear_xkb_elements_list (GSList * list) { @@ -214,6 +216,9 @@ xkb_layouts_enable_disable_buttons (GladeXML * dialog) gtk_tree_model_iter_n_children (selectedLayoutsModel, NULL); + if (disableButtonsSensibilityUpdate) + return; + gtk_widget_set_sensitive (addLayoutBtn, (nSelectedLayouts < maxSelectedLayouts || maxSelectedLayouts == 0)); @@ -232,6 +237,7 @@ xkb_layouts_enable_disable_buttons (GladeXML * dialog) gtk_tree_path_free (path); } } + gtk_widget_set_sensitive (upLayoutBtn, canMoveUp); gtk_widget_set_sensitive (dnLayoutBtn, canMoveDn); } @@ -322,6 +328,10 @@ xkb_layouts_fill_selected_tree (GladeXML * dialog) GtkListStore *listStore = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (WID ("xkb_layouts_selected")))); + + /* temporarily disable the buttons' status update */ + disableButtonsSensibilityUpdate = TRUE; + gtk_list_store_clear (listStore); for (curLayout = layouts; curLayout != NULL; curLayout = curLayout->next) @@ -344,7 +354,10 @@ xkb_layouts_fill_selected_tree (GladeXML * dialog) } clear_xkb_elements_list (layouts); - xkb_layouts_enable_disable_buttons (dialog); + + /* enable the buttons' status update */ + disableButtonsSensibilityUpdate = FALSE; + if (idx2Select != -1) { GtkTreeSelection *selection = @@ -355,6 +368,12 @@ xkb_layouts_fill_selected_tree (GladeXML * dialog) gtk_tree_path_free (path); idx2Select = -1; } + else + { + /* if there is nothing to select - just enable/disable the buttons, + otherwise it would be done by the selection change */ + xkb_layouts_enable_disable_buttons (dialog); + } gce = gconf_client_get_entry (xkbGConfClient, GSWITCHIT_CONFIG_KEY_DEFAULT_GROUP, -- cgit v1.2.1