[geany/geany] 9e418d: Show overridden keybindings in bold for prefs dialog tree

Nick Treleaven git-noreply at xxxxx
Thu Jul 26 00:03:50 UTC 2012


Branch:      refs/heads/document-messages
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Wed, 04 Apr 2012 12:43:39
Commit:      9e418d7aafeb1aa482255c723a095f2f92572c69
             https://github.com/geany/geany/commit/9e418d7aafeb1aa482255c723a095f2f92572c69

Log Message:
-----------
Show overridden keybindings in bold for prefs dialog tree


Modified Paths:
--------------
    src/keybindings.c
    src/keybindings.h
    src/prefs.c

Modified: src/keybindings.c
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -167,6 +167,8 @@ GeanyKeyBinding *keybindings_set_item(GeanyKeyGroup *group, gsize key_id,
 	}
 	kb->key = key;
 	kb->mods = mod;
+	kb->default_key = key;
+	kb->default_mods = mod;
 	kb->callback = callback;
 	kb->menu_item = menu_item;
 	kb->id = key_id;


Modified: src/keybindings.h
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -42,6 +42,8 @@
 	GeanyKeyCallback callback;
 	GtkWidget *menu_item;	/**< Optional widget to set an accelerator for, or @c NULL */
 	guint id;
+	guint default_key;
+	GdkModifierType default_mods;
 }
 GeanyKeyBinding;
 


Modified: src/prefs.c
18 files changed, 13 insertions(+), 5 deletions(-)
===================================================================
@@ -140,7 +140,9 @@ enum
 	KB_TREE_ACTION,
 	KB_TREE_SHORTCUT,
 	KB_TREE_INDEX,
-	KB_TREE_EDITABLE
+	KB_TREE_EDITABLE,
+	KB_TREE_WEIGHT,
+	KB_TREE_COLUMNS
 };
 
 
@@ -279,17 +281,20 @@ static void kb_init_tree(void)
 
 	tree = GTK_TREE_VIEW(ui_lookup_widget(ui_widgets.prefs_dialog, "treeview7"));
 
-	store = gtk_tree_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
+	store = gtk_tree_store_new(KB_TREE_COLUMNS,
+		G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT);
 	gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
 	g_object_unref(store);
 
 	renderer = gtk_cell_renderer_text_new();
-	column = gtk_tree_view_column_new_with_attributes(_("Action"), renderer, "text", KB_TREE_ACTION, NULL);
+	column = gtk_tree_view_column_new_with_attributes(_("Action"), renderer,
+		"text", KB_TREE_ACTION, "weight", KB_TREE_WEIGHT, NULL);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
 
 	renderer = gtk_cell_renderer_text_new();
 	column = gtk_tree_view_column_new_with_attributes(_("Shortcut"), renderer,
-		"text", KB_TREE_SHORTCUT, "editable", KB_TREE_EDITABLE, NULL);
+		"text", KB_TREE_SHORTCUT, "editable", KB_TREE_EDITABLE,
+		"weight", KB_TREE_WEIGHT, NULL);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
 
 	/* set policy settings for the scrolled window around the treeview again, because glade
@@ -329,7 +334,10 @@ static void kb_init(void)
 			key_string = gtk_accelerator_name(kb->key, kb->mods);
 			gtk_tree_store_append(store, &iter, &parent);
 			gtk_tree_store_set(store, &iter, KB_TREE_ACTION, label,
-				KB_TREE_SHORTCUT, key_string, KB_TREE_EDITABLE, TRUE, KB_TREE_INDEX, kb->id, -1);
+				KB_TREE_SHORTCUT, key_string, KB_TREE_EDITABLE, TRUE,
+				KB_TREE_INDEX, kb->id, -1);
+			if (kb->key != kb->default_key || kb->mods != kb->default_mods)
+				gtk_tree_store_set(store, &iter, KB_TREE_WEIGHT, PANGO_WEIGHT_BOLD, -1);
 			g_free(key_string);
 			g_free(label);
 		}


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list