diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2010-04-13 23:46:24 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-04-14 09:34:19 -0400 |
commit | 06f9a55cf72b6aa19b4206a05d6f9af6fa9648ea (patch) | |
tree | 77b587eacf8c5cbd85b75f9bfa66f9a19c08921c /scripts/kconfig/gconf.c | |
parent | 22c7eca61e51296643bb0a379fc726fda8f3b015 (diff) |
gconfig: add support to show hidden options that have prompts
There's a button in gconfig to "Show all options", but I think
normally we are not interested in those configs which have no
prompt and thus can't be changed, so here I add a new button to
show hidden options which have prompts.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/gconf.c')
-rw-r--r-- | scripts/kconfig/gconf.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index c6aa5a5948a1..bef10411837f 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -30,12 +30,16 @@ enum { | |||
30 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW | 30 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW |
31 | }; | 31 | }; |
32 | 32 | ||
33 | enum { | ||
34 | OPT_NORMAL, OPT_ALL, OPT_PROMPT | ||
35 | }; | ||
36 | |||
33 | static gint view_mode = FULL_VIEW; | 37 | static gint view_mode = FULL_VIEW; |
34 | static gboolean show_name = TRUE; | 38 | static gboolean show_name = TRUE; |
35 | static gboolean show_range = TRUE; | 39 | static gboolean show_range = TRUE; |
36 | static gboolean show_value = TRUE; | 40 | static gboolean show_value = TRUE; |
37 | static gboolean show_all = FALSE; | ||
38 | static gboolean resizeable = FALSE; | 41 | static gboolean resizeable = FALSE; |
42 | static int opt_mode = OPT_NORMAL; | ||
39 | 43 | ||
40 | GtkWidget *main_wnd = NULL; | 44 | GtkWidget *main_wnd = NULL; |
41 | GtkWidget *tree1_w = NULL; // left frame | 45 | GtkWidget *tree1_w = NULL; // left frame |
@@ -637,12 +641,29 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data) | |||
637 | 641 | ||
638 | 642 | ||
639 | void | 643 | void |
640 | on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data) | 644 | on_set_option_mode1_activate(GtkMenuItem *menuitem, gpointer user_data) |
645 | { | ||
646 | opt_mode = OPT_NORMAL; | ||
647 | gtk_tree_store_clear(tree2); | ||
648 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
649 | } | ||
650 | |||
651 | |||
652 | void | ||
653 | on_set_option_mode2_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
641 | { | 654 | { |
642 | show_all = GTK_CHECK_MENU_ITEM(menuitem)->active; | 655 | opt_mode = OPT_ALL; |
656 | gtk_tree_store_clear(tree2); | ||
657 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ | ||
658 | } | ||
659 | |||
643 | 660 | ||
661 | void | ||
662 | on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data) | ||
663 | { | ||
664 | opt_mode = OPT_PROMPT; | ||
644 | gtk_tree_store_clear(tree2); | 665 | gtk_tree_store_clear(tree2); |
645 | display_tree(&rootmenu); // instead of update_tree to speed-up | 666 | display_tree(&rootmenu); /* instead of update_tree to speed-up */ |
646 | } | 667 | } |
647 | 668 | ||
648 | 669 | ||
@@ -1095,7 +1116,10 @@ static gchar **fill_row(struct menu *menu) | |||
1095 | g_strdup_printf("%s %s", _(menu_get_prompt(menu)), | 1116 | g_strdup_printf("%s %s", _(menu_get_prompt(menu)), |
1096 | sym && sym_has_value(sym) ? "(NEW)" : ""); | 1117 | sym && sym_has_value(sym) ? "(NEW)" : ""); |
1097 | 1118 | ||
1098 | if (show_all && !menu_is_visible(menu)) | 1119 | if (opt_mode == OPT_ALL && !menu_is_visible(menu)) |
1120 | row[COL_COLOR] = g_strdup("DarkGray"); | ||
1121 | else if (opt_mode == OPT_PROMPT && | ||
1122 | menu_has_prompt(menu) && !menu_is_visible(menu)) | ||
1099 | row[COL_COLOR] = g_strdup("DarkGray"); | 1123 | row[COL_COLOR] = g_strdup("DarkGray"); |
1100 | else | 1124 | else |
1101 | row[COL_COLOR] = g_strdup("Black"); | 1125 | row[COL_COLOR] = g_strdup("Black"); |
@@ -1318,16 +1342,19 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) | |||
1318 | menu2 ? menu_get_prompt(menu2) : "nil"); | 1342 | menu2 ? menu_get_prompt(menu2) : "nil"); |
1319 | #endif | 1343 | #endif |
1320 | 1344 | ||
1321 | if (!menu_is_visible(child1) && !show_all) { // remove node | 1345 | if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) || |
1346 | (opt_mode == OPT_PROMPT && !menu_has_prompt(child1))) { | ||
1347 | |||
1348 | /* remove node */ | ||
1322 | if (gtktree_iter_find_node(dst, menu1) != NULL) { | 1349 | if (gtktree_iter_find_node(dst, menu1) != NULL) { |
1323 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | 1350 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); |
1324 | valid = gtk_tree_model_iter_next(model2, | 1351 | valid = gtk_tree_model_iter_next(model2, |
1325 | child2); | 1352 | child2); |
1326 | gtk_tree_store_remove(tree2, &tmp); | 1353 | gtk_tree_store_remove(tree2, &tmp); |
1327 | if (!valid) | 1354 | if (!valid) |
1328 | return; // next parent | 1355 | return; /* next parent */ |
1329 | else | 1356 | else |
1330 | goto reparse; // next child | 1357 | goto reparse; /* next child */ |
1331 | } else | 1358 | } else |
1332 | continue; | 1359 | continue; |
1333 | } | 1360 | } |
@@ -1396,7 +1423,9 @@ static void display_tree(struct menu *menu) | |||
1396 | && (tree == tree2)) | 1423 | && (tree == tree2)) |
1397 | continue; | 1424 | continue; |
1398 | 1425 | ||
1399 | if (menu_is_visible(child) || show_all) | 1426 | if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) || |
1427 | (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || | ||
1428 | (opt_mode == OPT_ALL)) | ||
1400 | place_node(child, fill_row(child)); | 1429 | place_node(child, fill_row(child)); |
1401 | #ifdef DEBUG | 1430 | #ifdef DEBUG |
1402 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); | 1431 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); |