[gnome-control-center] keyboard: Make the '+' button work all the time
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Make the '+' button work all the time
- Date: Thu, 20 Oct 2011 09:39:11 +0000 (UTC)
commit 62cb5236b265986695783506b09c4f98412eceb1
Author: Bastien Nocera <hadess hadess net>
Date: Thu Oct 20 10:27:25 2011 +0100
keyboard: Make the '+' button work all the time
We shouldn't need to select the "Custom Shortcuts" section
of the keyboard shortcuts before the add button is made sensitive.
Make it sensitive all the time, and switch to the section as needed.
https://bugzilla.gnome.org/show_bug.cgi?id=662253
panels/keyboard/keyboard-shortcuts.c | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index 91c6275..c63dd48 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -865,8 +865,6 @@ section_selection_changed (GtkTreeSelection *selection, gpointer data)
return;
}
- gtk_widget_set_sensitive (WID (builder, "add-toolbutton"),
- group == BINDING_GROUP_USER);
gtk_widget_set_sensitive (WID (builder, "remove-toolbutton"), FALSE);
/* Fill the shortcut treeview with the keys for the selected section */
@@ -1593,11 +1591,43 @@ add_button_clicked (GtkWidget *button,
{
GtkTreeView *treeview;
GtkTreeModel *model;
+ GtkTreeModel *section_model;
+ GtkTreeIter iter;
+ gboolean found, cont;
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"shortcut_treeview"));
model = gtk_tree_view_get_model (treeview);
+ /* Select the Custom Shortcuts section
+ * before adding the shortcut itself */
+ section_model = gtk_tree_view_get_model (GTK_TREE_VIEW (WID (builder, "section_treeview")));
+ cont = gtk_tree_model_get_iter_first (section_model, &iter);
+ found = FALSE;
+ while (cont)
+ {
+ BindingGroupType group;
+
+ gtk_tree_model_get (section_model, &iter,
+ SECTION_GROUP_COLUMN, &group,
+ -1);
+
+ if (group == BINDING_GROUP_USER)
+ {
+ found = TRUE;
+ break;
+ }
+ cont = gtk_tree_model_iter_next (section_model, &iter);
+ }
+ if (found)
+ {
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (WID (builder, "section_treeview")));
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+
+ /* And add the shortcut */
add_custom_shortcut (treeview, model);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]