aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-04-13 23:46:24 -0400
committerMichal Marek <mmarek@suse.cz>2010-04-14 09:34:19 -0400
commit06f9a55cf72b6aa19b4206a05d6f9af6fa9648ea (patch)
tree77b587eacf8c5cbd85b75f9bfa66f9a19c08921c /scripts
parent22c7eca61e51296643bb0a379fc726fda8f3b015 (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')
-rw-r--r--scripts/kconfig/gconf.c47
-rw-r--r--scripts/kconfig/gconf.glade28
2 files changed, 64 insertions, 11 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
33enum {
34 OPT_NORMAL, OPT_ALL, OPT_PROMPT
35};
36
33static gint view_mode = FULL_VIEW; 37static gint view_mode = FULL_VIEW;
34static gboolean show_name = TRUE; 38static gboolean show_name = TRUE;
35static gboolean show_range = TRUE; 39static gboolean show_range = TRUE;
36static gboolean show_value = TRUE; 40static gboolean show_value = TRUE;
37static gboolean show_all = FALSE;
38static gboolean resizeable = FALSE; 41static gboolean resizeable = FALSE;
42static int opt_mode = OPT_NORMAL;
39 43
40GtkWidget *main_wnd = NULL; 44GtkWidget *main_wnd = NULL;
41GtkWidget *tree1_w = NULL; // left frame 45GtkWidget *tree1_w = NULL; // left frame
@@ -637,12 +641,29 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data)
637 641
638 642
639void 643void
640on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data) 644on_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
652void
653on_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
661void
662on_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));
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade
index 909f5a457ac0..d52b0a75d824 100644
--- a/scripts/kconfig/gconf.glade
+++ b/scripts/kconfig/gconf.glade
@@ -190,13 +190,37 @@
190 </child> 190 </child>
191 191
192 <child> 192 <child>
193 <widget class="GtkCheckMenuItem" id="show_all_options1"> 193 <widget class="GtkRadioMenuItem" id="set_option_mode1">
194 <property name="visible">True</property>
195 <property name="tooltip" translatable="yes">Show normal options</property>
196 <property name="label" translatable="yes">Show normal options</property>
197 <property name="use_underline">True</property>
198 <property name="active">True</property>
199 <signal name="activate" handler="on_set_option_mode1_activate"/>
200 </widget>
201 </child>
202
203 <child>
204 <widget class="GtkRadioMenuItem" id="set_option_mode2">
194 <property name="visible">True</property> 205 <property name="visible">True</property>
195 <property name="tooltip" translatable="yes">Show all options</property> 206 <property name="tooltip" translatable="yes">Show all options</property>
196 <property name="label" translatable="yes">Show all _options</property> 207 <property name="label" translatable="yes">Show all _options</property>
197 <property name="use_underline">True</property> 208 <property name="use_underline">True</property>
198 <property name="active">False</property> 209 <property name="active">False</property>
199 <signal name="activate" handler="on_show_all_options1_activate"/> 210 <property name="group">set_option_mode1</property>
211 <signal name="activate" handler="on_set_option_mode2_activate"/>
212 </widget>
213 </child>
214
215 <child>
216 <widget class="GtkRadioMenuItem" id="set_option_mode3">
217 <property name="visible">True</property>
218 <property name="tooltip" translatable="yes">Show all options with prompts</property>
219 <property name="label" translatable="yes">Show all prompt options</property>
220 <property name="use_underline">True</property>
221 <property name="active">False</property>
222 <property name="group">set_option_mode1</property>
223 <signal name="activate" handler="on_set_option_mode3_activate"/>
200 </widget> 224 </widget>
201 </child> 225 </child>
202 226