diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-11-08 06:58:22 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-11-08 06:58:22 +0800 |
commit | bbbcab837cdbfc156132a94f6531bafa1ee0bad0 (patch) | |
tree | 8aa45dba399cb983d7abf1eadf354e482206d34f /src | |
parent | 7245f1231d628f400eeafaf89d57fcdb9649634f (diff) | |
download | gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.tar gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.tar.gz gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.tar.bz2 gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.tar.lz gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.tar.xz gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.tar.zst gsoc2013-epiphany-bbbcab837cdbfc156132a94f6531bafa1ee0bad0.zip |
Fix button sensitivity setting in language editor not to first disable the
2004-11-07 Christian Persch <chpe@cvs.gnome.org>
* src/prefs-dialog.c: (language_editor_update_buttons):
Fix button sensitivity setting in language editor not to first
disable the buttons. Fixes moving an item more than once at a time.
Diffstat (limited to 'src')
-rw-r--r-- | src/prefs-dialog.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 9fdf34a73..89b5e2b0a 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -694,27 +694,28 @@ language_editor_update_buttons (PrefsDialog *dialog) GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; + gboolean can_remove = FALSE, can_move_up = FALSE, can_move_down = FALSE; int selected; selection = gtk_tree_view_get_selection (dialog->priv->lang_treeview); - gtk_widget_set_sensitive (dialog->priv->lang_remove_button, FALSE); - gtk_widget_set_sensitive (dialog->priv->lang_up_button, FALSE); - gtk_widget_set_sensitive (dialog->priv->lang_down_button, FALSE); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) { path = gtk_tree_model_get_path (model, &iter); selected = gtk_tree_path_get_indices (path)[0]; - - gtk_widget_set_sensitive (dialog->priv->lang_remove_button, TRUE); - gtk_widget_set_sensitive (dialog->priv->lang_up_button, selected > 0); - gtk_widget_set_sensitive (dialog->priv->lang_down_button, - selected < gtk_tree_model_iter_n_children (model, NULL) - 1); + + can_remove = TRUE; + can_move_up = selected > 0; + can_move_down = + selected < gtk_tree_model_iter_n_children (model, NULL) - 1; gtk_tree_path_free (path); } + + gtk_widget_set_sensitive (dialog->priv->lang_remove_button, can_remove); + gtk_widget_set_sensitive (dialog->priv->lang_up_button, can_move_up); + gtk_widget_set_sensitive (dialog->priv->lang_down_button, can_move_down); } static void |