kconfig: improve xconfig and gconfig
cover kconfig: improve xconfig and gconfig
[xconfig]
- small improvement for choice
[gconfig]
- Fix memory leak
- Lots of refactoring
- Migrate GTK 2 to GTK 3
- Fix all compile warnings
- Improve usability (grey out buttons, keep the item selection, etc.)
Masahiro Yamada (66):
kconfig: set MENU_CHANGED to choice when the selected member is
changed
kconfig: qconf: do not show checkbox icon for choice
kconfig: qconf: show selected choice in the Value column
kconfig: rename menu_get_parent_menu() to
menu_get_menu_or_parent_menu()
kconfig: re-add menu_get_parent_menu() that returns parent menu
kconfig: gconf: make columns resizable
kconfig: gconf: fix potential memory leak in renderer_edited()
kconfig: gconf: always destroy dialog in on_window1_delete_event()
kconfig: gconf: remove old #ifdef GTK_CHECK_VERSION
kconfig: gconf: remove empty if-block
kconfig: gconf: remove meaningless code in init_main_window()
kconfig: gconf: remove unneeded gtk_tree_view_set_headers_visible()
calls
kconfig: gconf: remove gtk_tree_view_column_set_visible() calls
kconfig: gconf: remove gtk_widget_realize() calls
kconfig: gconf: remove gtk_tree_view_set_rules_hint() calls
kconfig: gconf: remove unnecessary gtk_set_locale() call
kconfig: gconf: remove internal-child="image" nodes from glade
kconfig: gconf: remove parents[] array and indent variable
kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2
kconfig: gconf: remove unneeded variable in on_split_clicked()
kconfig: gconf: remove unneeded variables in
on_treeview*_button_press_event()
kconfig: gconf: remove unused 'color' variable
kconfig: gconf: add static qualifiers to variables
kconfig: gconf: move init_*() functions below
kconfig: gconf: refactor view setting code
kconfig: gconf: grey out button for current view
kconfig: gconf: move the main window event handlers below
kconfig: gconf: move button1 initialization below
kconfig: gconf: add static qualifiers to event handlers
kconfig: gconf: remove glade_xml_signal_autoconnect() call
kconfig: gconf: make key_press_event work in left pane too
kconfig: gconf: avoid hardcoding model2 in
on_treeview2_cursor_changed()
kconfig: gconf: avoid hardcoding model2 in renderer_edited()
kconfig: gconf: avoid hardcoding model* in
on_treeview*_button_press_event()
kconfig: gconf: add on_save_clicked() event handler
kconfig: gconf: use GtkFileChooser in on_load1_activate()
kconfig: gconf: use GtkFileChooser in on_save_as1_activate()
kconfig: gconf: use GdkPixbuf in replace_button_icon()
kconfig: gconf: refactor replace_button_icon()
kconfig: gconf: make introduction, about, license dialogs modal
kconfig: gconf: remove global 'tree' variable
kconfig: gconf: merge 'current' and 'browsed' global variables
kconfig: gconf: preserve menu selection when switching view mode
kconfig: gconf: use GtkTreeModelFilter to control row visibility
kconfig: gconf: remove global 'model1' and 'model2' variables
kconfig: gconf: remove init_tree_model()
kconfig: gconf: inline fill_row() into set_node()
kconfig: gconf: do not reconstruct tree store when a symbol is changed
kconfig: gconf: inline display_list() into set_view_mode()
kconfig: gconf: remove dead code in display_tree_part()
kconfig: gconf: rename display_tree_part()
kconfig: gconf: remove fixup_rootmenu()
kconfig: gconf: use size_allocate event handler
kconfig: gconf: replace GDK_space with GDK_KEY_space
kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
kconfig: gconf: remove "tooltips" property from glade
kconfig: gconf: replace "tooltip" property with "tooltip-text"
kconfig: gconf: remove unnecessary default message in text view
kconfig: gconf: use gtk_check_menu_item_get_active() accessor
kconfig: gconf: use gtk_dialog_get_content_area() accessor
kconfig: gconf: remove GtkHandleBox from glade
kconfig: gconf: rename gconf.glade to gconf.ui
kconfig: gconf: migrate to GTK 3
kconfig: gconf: replace GtkVbox with GtkBox
kconfig: gconf: replace GdkColor with GdkRGBA
kconfig: gconf: show GTK version in About dialog
scripts/kconfig/conf.c | 2 +-
scripts/kconfig/gconf-cfg.sh | 11 +-
scripts/kconfig/gconf.c | 1828 ++++++++++-----------
scripts/kconfig/{gconf.glade => gconf.ui} | 360 ++--
scripts/kconfig/lkc.h | 1 +
scripts/kconfig/menu.c | 20 +
scripts/kconfig/qconf.cc | 26 +-
scripts/kconfig/symbol.c | 4 +
8 files changed, 1023 insertions(+), 1229 deletions(-)
rename scripts/kconfig/{gconf.glade => gconf.ui} (57%)Signature · 1 line
2.43.0
PATCH 1/66 kconfig: set MENU_CHANGED to choice when the selected member is changed
In gconf, choice entries display the selected symbol in the 'Value' column, but it is not updated when the selected symbol is changed.
Set the MENU_CHANGED flag, so it is updated.
---
scripts/kconfig/symbol.c | 4 ++++ 1 file changed, 4 insertions(+)
scripts/kconfig/symbol.c +4 -0
@@ -195,6 +195,10 @@ static void sym_set_changed(struct symbol *sym)list_for_each_entry (menu, &sym->menus, link) menu->flags |=MENU_CHANGED ; + + menu =sym_get_choice_menu (sym); +if (menu) + menu->flags |=MENU_CHANGED ; }static void sym_set_all_changed (void )
Signature · 1 line
2.43.0
Re: [PATCH 01/66] kconfig: set MENU_CHANGED to choice when the selected member is changed
Quoted 6 lines · Masahiro Yamada
In gconf, choice entries display the selected symbol in the 'Value' column, but it is not updated when the selected symbol is changed.
Set the
MENU_CHANGEDflag, so it is updated.Signed-off-by Masahiro Yamada <[email protected]>
Probably not related to this change (AFAICT), but I was trying to reproduce this problem and I cannot do it.
To enable an option (any options, choice or not), I have to double-click on it or (sometimes, not for choice) I can use Y / N / M on the keyboard. When I do either of those, the value (including a choice value) is changed.
I mention double-click only because the Help text (Information) says that clicking will cycle thru Y/M/N.
The Information also says that "dot indicates that it is to be compiled as a module". I see more of a Dash or Hyphen or just a horizontal bar.
Thanks for reading...
Quoted 20 lines
---
scripts/kconfig/symbol.c | 4 ++++ 1 file changed, 4 insertions(+)scripts/kconfig/symbol.c +4
-0@@ -195,6 +195,10 @@ static void sym_set_changed(struct symbol *sym)list_for_each_entry (menu, &sym->menus, link) menu->flags |=MENU_CHANGED ; + + menu =sym_get_choice_menu (sym); +if (menu) + menu->flags |=MENU_CHANGED ; }static void sym_set_all_changed (void )
Signature · 1 line
~Randy
Re: [PATCH 01/66] kconfig: set MENU_CHANGED to choice when the selected member is changed
Quoted 7 lines · Randy Dunlap
Quoted 3 lines · Masahiro Yamada
In gconf, choice entries display the selected symbol in the 'Value' column, but it is not updated when the selected symbol is changed.
Quoted 6 lines
Quoted 3 lines
Set the
MENU_CHANGEDflag, so it is updated.Signed-off-by Masahiro Yamada <[email protected]>Probably not related to this change (AFAICT), but I was trying to reproduce this problem and I cannot do it.
You can try this simple test code.
choice
prompt "choose"
config A
bool "A"
config B
bool "B"
endchoice
In Full mode, open the tree and double-clock the two radio buttons alternatively. (select A or B back-and-forth) In the main line code, the Value column of "choose" remains "B".
After this commit, it starts to react to the change, but the fix is not perfect.
In the gconfig-v3 branch, this should work perfectly.
Quoted 6 lines
To enable an option (any options, choice or not), I have to double-click on it or (sometimes, not for choice) I can use Y / N / M on the keyboard. When I do either of those, the value (including a choice value) is changed.
I mention double-click only because the Help text (Information) says that clicking will cycle thru Y/M/N.
Presumably, this should be double-click in gconfig. (So, the help message should be fixed.)
A single click in the "option" column is used for other functionality. (open/close the tree item in Split and Full views).
Quoted 3 lines
The Information also says that "dot indicates that it is to be compiled as a module". I see more of a Dash or Hyphen or just a horizontal bar.
Right. The help message should be fixed.
Quoted 22 lines
Thanks for reading...
Quoted 19 lines
---
scripts/kconfig/symbol.c | 4 ++++ 1 file changed, 4 insertions(+)scripts/kconfig/symbol.c +4
-0@@ -195,6 +195,10 @@ static void sym_set_changed(struct symbol *sym)list_for_each_entry (menu, &sym->menus, link) menu->flags |=MENU_CHANGED ; + + menu =sym_get_choice_menu (sym); +if (menu) + menu->flags |=MENU_CHANGED ; }
Quoted 5 lines
scripts/kconfig/symbol.c static void sym_set_changed(struct symbol *sym) · line 204
Quoted 1 line
scripts/kconfig/symbol.c +0
-0static void sym_set_all_changed (void )--
~Randy
--
Best Regards
Masahiro Yamada
Randy Dunlap
Tested-byRe: [PATCH 01/66] kconfig: set MENU_CHANGED to choice when the selected member is changed
Quoted 28 lines · Masahiro Yamada
Quoted 7 lines · Randy Dunlap
Quoted 3 lines · Masahiro Yamada
In gconf, choice entries display the selected symbol in the 'Value' column, but it is not updated when the selected symbol is changed.
Quoted 6 lines
Quoted 3 lines
Set the
MENU_CHANGEDflag, so it is updated.Signed-off-by Masahiro Yamada <[email protected]>Probably not related to this change (AFAICT), but I was trying to reproduce this problem and I cannot do it.
You can try this simple test code.
choice
prompt "choose"config A
bool "A"config B
bool "B"endchoice
Quoted 8 lines
In Full mode, open the tree and double-clock the two radio buttons alternatively. (select A or B back-and-forth) In the main line code, the Value column of "choose" remains "B".
After this commit, it starts to react to the change, but the fix is not perfect.
In the gconfig-v3 branch, this should work perfectly.
OK, confirmed in gconfig-v2 branch.
One other thing: if I Quit in today's linux-next (probably similar to mainline), if the .config file has changed, the Warning box choices (Yes, No, Cancel) have their first letters underlined and the Cancel block (just the rectangle itself) is bold, more distinct than the others, so it must be the default if Enter is pressed.
In the gconfig-v2 branch, the Warning block choices are neither underlined in their first letter (for us keyboard users) nor is any one of them Bold (default). It is a much better UX in the linux-next/mainline than gconfig-v2.
Is this a change from GTK2 to GTK3? Unintended? Fixable?
thanks.
Signature · 1 line
~Randy
PATCH 2/66 kconfig: qconf: do not show checkbox icon for choice
In reply to Masahiro YamadaWhen you select "Show All Options" or "Show Prompt Options", choice entries display a check box icon, but this has no point because choice is always y since commit
---
scripts/kconfig/qconf.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
scripts/kconfig/qconf.cc +6 -5
@@ -92,7 +92,6 @@ void ConfigItem::updateMenu(void) { ConfigList* list; struct symbol* sym; - struct property *prop; QString prompt; int type; tristate expr;
@@ -105,11 +104,10 @@ void ConfigItem::updateMenu(void) } sym = menu->sym; - prop = menu->prompt; prompt = menu_get_prompt(menu); - if (prop) switch (prop->type) { - case P_MENU: + switch (menu->type) { + case M_MENU: if (list->mode == singleMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child.
@@ -123,10 +121,13 @@ void ConfigItem::updateMenu(void) setIcon(promptColIdx, QIcon()); } goto set_prompt; - case P_COMMENT: + case M_COMMENT: setIcon(promptColIdx, QIcon()); prompt = "*** " + prompt + " ***"; goto set_prompt; + case M_CHOICE: + setIcon(promptColIdx, QIcon()); + goto set_prompt; default: ; }
Signature · 1 line
2.43.0
Re: [PATCH 02/66] kconfig: qconf: do not show checkbox icon for choice
Quoted 3 lines · Masahiro Yamada
When you select "Show All Options" or "Show Prompt Options", choice entries display a check box icon, but this has no point because choice is always y since commit
since commit _____________________.
Quoted 48 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/qconf.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)scripts/kconfig/qconf.cc +6
-5@@ -92,7 +92,6 @@ void ConfigItem::updateMenu(void) { ConfigList* list; struct symbol* sym; - struct property *prop; QString prompt; int type; tristate expr;@@ -105,11 +104,10 @@ void ConfigItem::updateMenu(void) } sym = menu->sym; - prop = menu->prompt; prompt = menu_get_prompt(menu); - if (prop) switch (prop->type) { - case P_MENU: + switch (menu->type) { + case M_MENU: if (list->mode == singleMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child.@@ -123,10 +121,13 @@ void ConfigItem::updateMenu(void) setIcon(promptColIdx, QIcon()); } goto set_prompt; - case P_COMMENT: + case M_COMMENT: setIcon(promptColIdx, QIcon()); prompt = "*** " + prompt + " ***"; goto set_prompt; + case M_CHOICE: + setIcon(promptColIdx, QIcon()); + goto set_prompt; default: ; }
Signature · 1 line
~Randy
Re: [PATCH 02/66] kconfig: qconf: do not show checkbox icon for choice
Quoted 9 lines · Randy Dunlap
Quoted 3 lines · Masahiro Yamada
When you select "Show All Options" or "Show Prompt Options", choice entries display a check box icon, but this has no point because choice is always y since commit
since commit _____________________.
since commit fde192511bdb ("kconfig: remove tristate choice support").
I will fix it.
Thanks.
Quoted 52 lines
Quoted 38 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/qconf.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)scripts/kconfig/qconf.cc +2
-5@@ -92,7 +92,6 @@ void ConfigItem::updateMenu(void) { ConfigList* list; struct symbol* sym; - struct property *prop; QString prompt; int type; tristate expr;@@ -105,11 +104,10 @@ void ConfigItem::updateMenu(void) } sym = menu->sym; - prop = menu->prompt; prompt = menu_get_prompt(menu); - if (prop) switch (prop->type) { - case P_MENU: + switch (menu->type) { + case M_MENU: if (list->mode == singleMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child.@@ -123,10 +121,13 @@ void ConfigItem::updateMenu(void) setIcon(promptColIdx, QIcon()); } goto set_prompt; - case P_COMMENT:scripts/kconfig/qconf.cc void ConfigItem::updateMenu(void) · line 133
Quoted 10 lines
scripts/kconfig/qconf.cc +4
-0+ case M_COMMENT: setIcon(promptColIdx, QIcon()); prompt = "*** " + prompt + " ***"; goto set_prompt; + case M_CHOICE: + setIcon(promptColIdx, QIcon()); + goto set_prompt; default: ; }--
~Randy
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 02/66] kconfig: qconf: do not show checkbox icon for choice
In reply to Masahiro YamadaHi,
Quoted 4 lines · Masahiro Yamada
When you select "Show All Options" or "Show Prompt Options", choice entries display a check box icon, but this has no point because choice is always y since commit
I don't see a check box icon beside the choice entries either before or after this change. Or do you mean a Radio Button?
(setup: make defconfig for x86_64 in 2 subdirs, one pre-patches named X64, one post-patches named xx64.)
Enable Show Prompt Options for both testing windows.
E.g., under "Processor types and features", scroll down on the right side to "TSX enable mode". Under it in each in pre-patches and post-patches, I see buttons to choose which TSX enable mode to select. They look the same both pre-patch and post-patch.
What am I missing?
Quoted 37 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/qconf.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)scripts/kconfig/qconf.cc +2
-5@@ -92,7 +92,6 @@ void ConfigItem::updateMenu(void) { ConfigList* list; struct symbol* sym; - struct property *prop; QString prompt; int type; tristate expr;@@ -105,11 +104,10 @@ void ConfigItem::updateMenu(void) } sym = menu->sym; - prop = menu->prompt; prompt = menu_get_prompt(menu); - if (prop) switch (prop->type) { - case P_MENU: + switch (menu->type) { + case M_MENU: if (list->mode == singleMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child.@@ -123,10 +121,13 @@ void ConfigItem::updateMenu(void) setIcon(promptColIdx, QIcon()); } goto set_prompt; - case P_COMMENT:
scripts/kconfig/qconf.cc void ConfigItem::updateMenu(void) · line 133
Quoted 10 lines
scripts/kconfig/qconf.cc +4
-0+ case M_COMMENT: setIcon(promptColIdx, QIcon()); prompt = "*** " + prompt + " ***"; goto set_prompt; + case M_CHOICE: + setIcon(promptColIdx, QIcon()); + goto set_prompt; default: ; }
Thanks.
Signature · 1 line
~Randy
Re: [PATCH 02/66] kconfig: qconf: do not show checkbox icon for choice
Quoted 14 lines · Randy Dunlap
Hi,
Quoted 4 lines · Masahiro Yamada
When you select "Show All Options" or "Show Prompt Options", choice entries display a check box icon, but this has no point because choice is always y since commit
I don't see a check box icon beside the choice entries either before or after this change. Or do you mean a Radio Button?
(setup: make defconfig for
x86_64in 2 subdirs, one pre-patches named X64, one post-patches named xx64.)
Quoted 9 lines
Enable Show Prompt Options for both testing windows.
E.g., under "Processor types and features", scroll down on the right side to "TSX enable mode". Under it in each in pre-patches and post-patches, I see buttons to choose which TSX enable mode to select. They look the same both pre-patch and post-patch.
What am I missing?
Yep, user error. I didn't back out the patches to build xconfig. :( My bad.
Thanks.
Quoted 50 lines
Quoted 38 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/qconf.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)scripts/kconfig/qconf.cc +2
-5@@ -92,7 +92,6 @@ void ConfigItem::updateMenu(void) { ConfigList* list; struct symbol* sym; - struct property *prop; QString prompt; int type; tristate expr;@@ -105,11 +104,10 @@ void ConfigItem::updateMenu(void) } sym = menu->sym; - prop = menu->prompt; prompt = menu_get_prompt(menu); - if (prop) switch (prop->type) { - case P_MENU: + switch (menu->type) { + case M_MENU: if (list->mode == singleMode) { /* a menuconfig entry is displayed differently * depending whether it's at the view root or a child.@@ -123,10 +121,13 @@ void ConfigItem::updateMenu(void) setIcon(promptColIdx, QIcon()); } goto set_prompt; - case P_COMMENT:scripts/kconfig/qconf.cc void ConfigItem::updateMenu(void) · line 133
Quoted 10 lines
scripts/kconfig/qconf.cc +4
-0+ case M_COMMENT: setIcon(promptColIdx, QIcon()); prompt = "*** " + prompt + " ***"; goto set_prompt; + case M_CHOICE: + setIcon(promptColIdx, QIcon()); + goto set_prompt; default: ; }Thanks.
Signature · 1 line
~Randy
PATCH 3/66 kconfig: qconf: show selected choice in the Value column
In reply to Masahiro YamadaIt is useful to display the selected choice's value in the Value column.
---
scripts/kconfig/qconf.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +8 -1
@@ -127,6 +127,9 @@ void ConfigItem::updateMenu(void) goto set_prompt; case M_CHOICE: setIcon(promptColIdx, QIcon()); + sym = sym_calc_choice(menu); + if (sym) + setText(dataColIdx, sym->name); goto set_prompt; default: ;
@@ -189,7 +192,11 @@ void ConfigItem::testUpdateMenu(void) if (!menu) return; - sym_calc_value(menu->sym); + if (menu->type == M_CHOICE) + sym_calc_choice(menu); + else + sym_calc_value(menu->sym); + if (menu->flags & MENU_CHANGED) { /* the menu entry changed, so update all list items */ menu->flags &= ~MENU_CHANGED;
Signature · 1 line
2.43.0
Re: [PATCH 03/66] kconfig: qconf: show selected choice in the Value column
Quoted 1 line · Masahiro Yamada
It is useful to display the selected choice's value in the Value column.
(instead of 'N', useless)
Nice, thanks.
Quoted 34 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/qconf.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)scripts/kconfig/qconf.cc +8
-1@@ -127,6 +127,9 @@ void ConfigItem::updateMenu(void) goto set_prompt; case M_CHOICE: setIcon(promptColIdx, QIcon()); + sym = sym_calc_choice(menu); + if (sym) + setText(dataColIdx, sym->name); goto set_prompt; default: ;@@ -189,7 +192,11 @@ void ConfigItem::testUpdateMenu(void) if (!menu) return; - sym_calc_value(menu->sym); + if (menu->type == M_CHOICE) + sym_calc_choice(menu); + else + sym_calc_value(menu->sym); + if (menu->flags & MENU_CHANGED) { /* the menu entry changed, so update all list items */ menu->flags &= ~MENU_CHANGED;
Signature · 1 line
~Randy
PATCH 4/66 kconfig: rename menu_get_parent_menu() to menu_get_menu_or_parent_menu()
In reply to Masahiro YamadaThe current menu_get_parent_menu() does not always return the parent menu; if the given argument is itself a menu, it returns that menu.
Rename this function to better reflect this behavior.
---
scripts/kconfig/conf.c | 2 +- scripts/kconfig/lkc.h | 2 +- scripts/kconfig/menu.c | 8 +++++++- scripts/kconfig/qconf.cc | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-)
scripts/kconfig/conf.c +1 -1
@@ -594,7 +594,7 @@ static void check_conf(struct menu *menu)default :if (!conf_cnt++)printf ("*\n* Restart config...\n*\n" ); - rootEntry =menu_get_parent_menu (menu); + rootEntry =menu_get_menu_or_parent_menu (menu);conf (rootEntry);break ; }
scripts/kconfig/lkc.h +1 -1
@@ -97,7 +97,7 @@ bool menu_is_empty(struct menu *menu);bool menu_is_visible (struct menu *menu);bool menu_has_prompt (const struct menu *menu);const char *menu_get_prompt (const struct menu *menu); -struct menu *menu_get_parent_menu (struct menu *menu); +struct menu *menu_get_menu_or_parent_menu (struct menu *menu);int get_jump_key_char (void );struct gstr get_relations_str (struct symbol **sym_arr,struct list_head *head);void menu_get_ext_help (struct menu *menu,struct gstr *help);
scripts/kconfig/menu.c +7 -1
@@ -575,7 +575,13 @@ const char *menu_get_prompt(const struct menu *menu)return NULL ; } -struct menu *menu_get_parent_menu (struct menu *menu) +/** +* menu_get_menu_or_parent_menu - return the parent menu or the menu itself +* @menu: pointer to the menu +* return: the parent menu. If the given argument is already a menu, return +* itself. +*/ +struct menu *menu_get_menu_or_parent_menu (struct menu *menu) {enum prop_type type;
scripts/kconfig/qconf.cc +3 -3
@@ -577,7 +577,7 @@ void ConfigList::setParentMenu(void) oldroot = rootEntry; if (rootEntry == &rootmenu) return; - setRootMenu(menu_get_parent_menu(rootEntry->parent)); + setRootMenu(menu_get_menu_or_parent_menu(rootEntry->parent)); QTreeWidgetItemIterator it(this); while (*it) {
@@ -1540,7 +1540,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) switch (configList->mode) { case singleMode: list = configList; - parent = menu_get_parent_menu(menu); + parent = menu_get_menu_or_parent_menu(menu); if (!parent) return; list->setRootMenu(parent);
@@ -1551,7 +1551,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) configList->clearSelection(); list = configList; } else { - parent = menu_get_parent_menu(menu->parent); + parent = menu_get_menu_or_parent_menu(menu->parent); if (!parent) return;
Signature · 1 line
2.43.0
Re: [PATCH 04/66] kconfig: rename menu_get_parent_menu() to menu_get_menu_or_parent_menu()
Quoted 6 lines · Masahiro Yamada
The current
menu_get_parent_menu()does not always return the parent menu; if the given argument is itself a menu, it returns that menu.Rename this function to better reflect this behavior.
Signed-off-by Masahiro Yamada <[email protected]>
Thanks.
Quoted 84 lines
---
scripts/kconfig/conf.c | 2 +- scripts/kconfig/lkc.h | 2 +- scripts/kconfig/menu.c | 8 +++++++- scripts/kconfig/qconf.cc | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-)scripts/kconfig/conf.c +1
-1@@ -594,7 +594,7 @@ static void check_conf(struct menu *menu)default :if (!conf_cnt++)printf ("*\n* Restart config...\n*\n" ); - rootEntry =menu_get_parent_menu (menu); + rootEntry =menu_get_menu_or_parent_menu (menu);conf (rootEntry);break ; }scripts/kconfig/lkc.h +1
-1@@ -97,7 +97,7 @@ bool menu_is_empty(struct menu *menu);bool menu_is_visible (struct menu *menu);bool menu_has_prompt (const struct menu *menu);const char *menu_get_prompt (const struct menu *menu); -struct menu *menu_get_parent_menu (struct menu *menu); +struct menu *menu_get_menu_or_parent_menu (struct menu *menu);int get_jump_key_char (void );struct gstr get_relations_str (struct symbol **sym_arr,struct list_head *head);void menu_get_ext_help (struct menu *menu,struct gstr *help);scripts/kconfig/menu.c +7
-1@@ -575,7 +575,13 @@ const char *menu_get_prompt(const struct menu *menu)return NULL ; } -struct menu *menu_get_parent_menu (struct menu *menu) +/** +* menu_get_menu_or_parent_menu - return the parent menu or the menu itself +* @menu: pointer to the menu +* return: the parent menu. If the given argument is already a menu, return +* itself. +*/ +struct menu *menu_get_menu_or_parent_menu (struct menu *menu) {enum prop_type type;scripts/kconfig/qconf.cc +3
-3@@ -577,7 +577,7 @@ void ConfigList::setParentMenu(void) oldroot = rootEntry; if (rootEntry == &rootmenu) return; - setRootMenu(menu_get_parent_menu(rootEntry->parent)); + setRootMenu(menu_get_menu_or_parent_menu(rootEntry->parent)); QTreeWidgetItemIterator it(this); while (*it) {@@ -1540,7 +1540,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) switch (configList->mode) { case singleMode: list = configList; - parent = menu_get_parent_menu(menu); + parent = menu_get_menu_or_parent_menu(menu); if (!parent) return; list->setRootMenu(parent);@@ -1551,7 +1551,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) configList->clearSelection(); list = configList; } else { - parent = menu_get_parent_menu(menu->parent); + parent = menu_get_menu_or_parent_menu(menu->parent); if (!parent) return;
Signature · 1 line
~Randy
PATCH 5/66 kconfig: re-add menu_get_parent_menu() that returns parent menu
In reply to Masahiro YamadaThis helper returns the parent menu, or NULL if there is no parent. The main difference from the previous version is that it always returns the parent menu even when the given argument is itself a menu.
---
scripts/kconfig/lkc.h | 1 + scripts/kconfig/menu.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+)
scripts/kconfig/lkc.h +1 -0
@@ -97,6 +97,7 @@ bool menu_is_empty(struct menu *menu);bool menu_is_visible (struct menu *menu);bool menu_has_prompt (const struct menu *menu);const char *menu_get_prompt (const struct menu *menu); +struct menu *menu_get_parent_menu (struct menu *menu);struct menu *menu_get_menu_or_parent_menu (struct menu *menu);int get_jump_key_char (void );struct gstr get_relations_str (struct symbol **sym_arr,struct list_head *head);
scripts/kconfig/menu.c +14 -0
@@ -575,6 +575,20 @@ const char *menu_get_prompt(const struct menu *menu)return NULL ; } +/** +* menu_get_parent_menu - return the parent menu or NULL +* @menu: pointer to the menu +* return: the parent menu, or NULL if there is no parent. +*/ +struct menu *menu_get_parent_menu (struct menu *menu) +{ +for (menu = menu->parent; menu; menu = menu->parent) +if (menu->type ==M_MENU ) +return menu; + +return NULL ; +} +/** * menu_get_menu_or_parent_menu - return the parent menu or the menu itself * @menu: pointer to the menu
Signature · 1 line
2.43.0
Re: [PATCH 05/66] kconfig: re-add menu_get_parent_menu() that returns parent menu
Quoted 5 lines · Masahiro Yamada
This helper returns the parent menu, or NULL if there is no parent. The main difference from the previous version is that it always returns the parent menu even when the given argument is itself a menu.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 43 lines
---
scripts/kconfig/lkc.h | 1 + scripts/kconfig/menu.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+)scripts/kconfig/lkc.h +1
-0@@ -97,6 +97,7 @@ bool menu_is_empty(struct menu *menu);bool menu_is_visible (struct menu *menu);bool menu_has_prompt (const struct menu *menu);const char *menu_get_prompt (const struct menu *menu); +struct menu *menu_get_parent_menu (struct menu *menu);struct menu *menu_get_menu_or_parent_menu (struct menu *menu);int get_jump_key_char (void );struct gstr get_relations_str (struct symbol **sym_arr,struct list_head *head);scripts/kconfig/menu.c +14
-0@@ -575,6 +575,20 @@ const char *menu_get_prompt(const struct menu *menu)return NULL ; } +/** +* menu_get_parent_menu - return the parent menu or NULL +* @menu: pointer to the menu +* return: the parent menu, or NULL if there is no parent. +*/ +struct menu *menu_get_parent_menu (struct menu *menu) +{ +for (menu = menu->parent; menu; menu = menu->parent) +if (menu->type ==M_MENU ) +return menu; + +return NULL ; +} +/** * menu_get_menu_or_parent_menu - return the parent menu or the menu itself * @menu: pointer to the menu
Signature · 1 line
~Randy
PATCH 6/66 kconfig: gconf: make columns resizable
In reply to Masahiro YamadaThe variable "resizeable" is a typo and always set to FALSE, resulting in dead code in init_right_tree(). It is unclear column resizing should be disabled. Enable it.
---
scripts/kconfig/gconf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
scripts/kconfig/gconf.c +3 -6
@@ -30,7 +30,6 @@ static gint view_mode = FULL_VIEW;static gboolean show_name = TRUE;static gboolean show_range = TRUE;static gboolean show_value = TRUE; -static gboolean resizeable = FALSE;static int opt_mode =OPT_NORMAL ;GtkWidget *main_wnd =NULL ;
@@ -312,11 +311,9 @@ static void init_right_tree(void) column =gtk_tree_view_get_column (view,COL_VALUE );gtk_tree_view_column_set_visible (column, show_value); -if (resizeable) { -for (i =0 ; i <COL_VALUE ; i++) { - column =gtk_tree_view_get_column (view, i); -gtk_tree_view_column_set_resizable (column, TRUE); - } +for (i =0 ; i <COL_VALUE ; i++) { + column =gtk_tree_view_get_column (view, i); +gtk_tree_view_column_set_resizable (column, TRUE); } sel =gtk_tree_view_get_selection (view);
Signature · 1 line
2.43.0
Re: [PATCH 06/66] kconfig: gconf: make columns resizable
Quoted 5 lines · Masahiro Yamada
The variable "resizeable" is a typo and always set to FALSE, resulting in dead code in
init_right_tree(). It is unclear column resizing should be disabled. Enable it.Signed-off-by Masahiro Yamada <[email protected]>
Looks good.
Quoted 32 lines
---
scripts/kconfig/gconf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)scripts/kconfig/gconf.c +3
-6@@ -30,7 +30,6 @@ static gint view_mode = FULL_VIEW;static gboolean show_name = TRUE;static gboolean show_range = TRUE;static gboolean show_value = TRUE; -static gboolean resizeable = FALSE;static int opt_mode =OPT_NORMAL ;GtkWidget *main_wnd =NULL ;@@ -312,11 +311,9 @@ static void init_right_tree(void) column =gtk_tree_view_get_column (view,COL_VALUE );gtk_tree_view_column_set_visible (column, show_value); -if (resizeable) { -for (i =0 ; i <COL_VALUE ; i++) { - column =gtk_tree_view_get_column (view, i); -gtk_tree_view_column_set_resizable (column, TRUE); - } +for (i =0 ; i <COL_VALUE ; i++) { + column =gtk_tree_view_get_column (view, i); +gtk_tree_view_column_set_resizable (column, TRUE); } sel =gtk_tree_view_get_selection (view);
Signature · 1 line
~Randy
PATCH 7/66 kconfig: gconf: fix potential memory leak in renderer_edited()
In reply to Masahiro YamadaIf gtk_tree_model_get_iter() fails, gtk_tree_path_free() is not called.
---
scripts/kconfig/gconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/gconf.c +2 -1
@@ -745,7 +745,7 @@ static void renderer_edited(GtkCellRendererText * cell,struct symbol *sym;if (!gtk_tree_model_get_iter (model2, &iter, path)) -return ; + goto free;gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); sym = menu->sym;
@@ -757,6 +757,7 @@ static void renderer_edited(GtkCellRendererText * cell,update_tree (&rootmenu,NULL ); +free:gtk_tree_path_free (path); }
Signature · 1 line
2.43.0
Re: [PATCH 07/66] kconfig: gconf: fix potential memory leak in renderer_edited()
Quoted 3 lines · Masahiro Yamada
If
gtk_tree_model_get_iter()fails,gtk_tree_path_free()is not called.Signed-off-by Masahiro Yamada <[email protected]>
Quoted 26 lines
---
scripts/kconfig/gconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/kconfig/gconf.c +2
-1@@ -745,7 +745,7 @@ static void renderer_edited(GtkCellRendererText * cell,struct symbol *sym;if (!gtk_tree_model_get_iter (model2, &iter, path)) -return ; + goto free;gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); sym = menu->sym;@@ -757,6 +757,7 @@ static void renderer_edited(GtkCellRendererText * cell,update_tree (&rootmenu,NULL ); +free:gtk_tree_path_free (path); }
Signature · 1 line
~Randy
PATCH 8/66 kconfig: gconf: always destroy dialog in on_window1_delete_event()
In reply to Masahiro YamadaWhen gtk_dialog_run() returns GTK_RESPONSE_YES or GTK_RESPONSE_NO, gtk_widget_destroy() is not called, resulting is a memory leak.
It is better to always destroy the dialog, even if the application is about to exit.
---
scripts/kconfig/gconf.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
scripts/kconfig/gconf.c +8 -5
@@ -378,6 +378,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, {GtkWidget *dialog, *label;gint result; +gint ret = FALSE;if (!conf_get_changed ())return FALSE;
@@ -404,17 +405,19 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,switch (result) {case GTK_RESPONSE_YES :on_save_activate (NULL ,NULL ); -return FALSE; +break ;case GTK_RESPONSE_NO : -return FALSE; +break ;case GTK_RESPONSE_CANCEL :case GTK_RESPONSE_DELETE_EVENT :default : -gtk_widget_destroy (dialog); -return TRUE; + ret = TRUE; +break ; } -return FALSE; +gtk_widget_destroy (dialog); + +return ret; }
Signature · 1 line
2.43.0
Re: [PATCH 08/66] kconfig: gconf: always destroy dialog in on_window1_delete_event()
Quoted 7 lines · Masahiro Yamada
When
gtk_dialog_run()returnsGTK_RESPONSE_YESorGTK_RESPONSE_NO,gtk_widget_destroy()is not called, resulting is a memory leak.It is better to always destroy the dialog, even if the application is about to exit.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 42 lines
---
scripts/kconfig/gconf.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)scripts/kconfig/gconf.c +8
-5@@ -378,6 +378,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, {GtkWidget *dialog, *label;gint result; +gint ret = FALSE;if (!conf_get_changed ())return FALSE;@@ -404,17 +405,19 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,switch (result) {case GTK_RESPONSE_YES :on_save_activate (NULL ,NULL ); -return FALSE; +break ;case GTK_RESPONSE_NO : -return FALSE; +break ;case GTK_RESPONSE_CANCEL :case GTK_RESPONSE_DELETE_EVENT :default : -gtk_widget_destroy (dialog); -return TRUE; + ret = TRUE; +break ; } -return FALSE; +gtk_widget_destroy (dialog); + +return ret; }
Signature · 1 line
~Randy
PATCH 9/66 kconfig: gconf: remove old #ifdef GTK_CHECK_VERSION
In reply to Masahiro YamadaRemove old code.
---
scripts/kconfig/gconf.c | 4 ---- 1 file changed, 4 deletions(-)
scripts/kconfig/gconf.c +0 -4
@@ -849,16 +849,12 @@ on_treeview2_button_press_event(GtkWidget * widget,struct menu *menu;gint col; -#if GTK_CHECK_VERSION (2 ,1 ,4 )// bug in ctree with earlier version of GTK gint tx = (gint ) event->x;gint ty = (gint ) event->y;gint cx, cy;gtk_tree_view_get_path_at_pos (view, tx, ty, &path, &column, &cx, &cy); -#else -gtk_tree_view_get_cursor (view, &path, &column); -#endif if (path ==NULL )return FALSE;
Signature · 1 line
2.43.0
PATCH 10/66 kconfig: gconf: remove empty if-block
In reply to Masahiro YamadaThis if-block is empty.
---
scripts/kconfig/gconf.c | 2 -- 1 file changed, 2 deletions(-)
scripts/kconfig/gconf.c +0 -2
@@ -913,8 +913,6 @@ on_treeview2_key_press_event(GtkWidget * widget,gtk_tree_view_expand_row (view, path, FALSE);return TRUE; } -if (event->keyval == GDK_KP_Enter) { - }if (widget == tree1_w)return FALSE;
Signature · 1 line
2.43.0
Re: [PATCH 10/66] kconfig: gconf: remove empty if-block
Quoted 3 lines · Masahiro Yamada
This if-block is empty.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 18 lines
---
scripts/kconfig/gconf.c | 2 -- 1 file changed, 2 deletions(-)scripts/kconfig/gconf.c +0
-2@@ -913,8 +913,6 @@ on_treeview2_key_press_event(GtkWidget * widget,gtk_tree_view_expand_row (view, path, FALSE);return TRUE; } -if (event->keyval == GDK_KP_Enter) { - }if (widget == tree1_w)return FALSE;
Signature · 1 line
~Randy
PATCH 11/66 kconfig: gconf: remove meaningless code in init_main_window()
In reply to Masahiro YamadaThe 'widget' variable is set, but not used in later code.
---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/gconf.c +0 -1
@@ -129,7 +129,6 @@ static void init_main_window(const gchar *glade_file)conf_set_changed_callback (conf_changed); style =gtk_widget_get_style (main_wnd); - widget =glade_xml_get_widget (xml,"toolbar1" );replace_button_icon (xml, main_wnd->window, style,"button4" , (gchar **) xpm_single_view);
Signature · 1 line
2.43.0
Re: [PATCH 11/66] kconfig: gconf: remove meaningless code in init_main_window()
Quoted 3 lines · Masahiro Yamada
The 'widget' variable is set, but not used in later code.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 17 lines
---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)scripts/kconfig/gconf.c +0
-1@@ -129,7 +129,6 @@ static void init_main_window(const gchar *glade_file)conf_set_changed_callback (conf_changed); style =gtk_widget_get_style (main_wnd); - widget =glade_xml_get_widget (xml,"toolbar1" );replace_button_icon (xml, main_wnd->window, style,"button4" , (gchar **) xpm_single_view);
Signature · 1 line
~Randy
PATCH 12/66 kconfig: gconf: remove unneeded gtk_tree_view_set_headers_visible() calls
In reply to Masahiro YamadaThe headers are visible by default.
---
scripts/kconfig/gconf.c | 2 -- 1 file changed, 2 deletions(-)
scripts/kconfig/gconf.c +0 -2
@@ -189,7 +189,6 @@ static void init_left_tree(void)GtkTreeViewColumn *column;gtk_tree_view_set_model (view, model1); -gtk_tree_view_set_headers_visible (view, TRUE);gtk_tree_view_set_rules_hint (view, TRUE); column =gtk_tree_view_column_new ();
@@ -232,7 +231,6 @@ static void init_right_tree(void)gint i;gtk_tree_view_set_model (view, model2); -gtk_tree_view_set_headers_visible (view, TRUE);gtk_tree_view_set_rules_hint (view, TRUE); column =gtk_tree_view_column_new ();
Signature · 1 line
2.43.0
PATCH 13/66 kconfig: gconf: remove gtk_tree_view_column_set_visible() calls
In reply to Masahiro YamadaThe columns are visible by default.
---
scripts/kconfig/gconf.c | 11 ----------- 1 file changed, 11 deletions(-)
scripts/kconfig/gconf.c +0 -11
@@ -297,17 +297,6 @@ static void init_right_tree(void)g_signal_connect (G_OBJECT (renderer),"edited" ,G_CALLBACK (renderer_edited),NULL ); - column =gtk_tree_view_get_column (view,COL_NAME ); -gtk_tree_view_column_set_visible (column, show_name); - column =gtk_tree_view_get_column (view,COL_NO ); -gtk_tree_view_column_set_visible (column, show_range); - column =gtk_tree_view_get_column (view,COL_MOD ); -gtk_tree_view_column_set_visible (column, show_range); - column =gtk_tree_view_get_column (view,COL_YES ); -gtk_tree_view_column_set_visible (column, show_range); - column =gtk_tree_view_get_column (view,COL_VALUE ); -gtk_tree_view_column_set_visible (column, show_value); -for (i =0 ; i <COL_VALUE ; i++) { column =gtk_tree_view_get_column (view, i);gtk_tree_view_column_set_resizable (column, TRUE);
Signature · 1 line
2.43.0
PATCH 14/66 kconfig: gconf: remove gtk_widget_realize() calls
In reply to Masahiro YamadaThis function is primarily used in widget implementations, and isn't very useful otherwise.
---
scripts/kconfig/gconf.c | 2 -- 1 file changed, 2 deletions(-)
scripts/kconfig/gconf.c +0 -2
@@ -215,7 +215,6 @@ static void init_left_tree(void) sel =gtk_tree_view_get_selection (view);gtk_tree_selection_set_mode (sel,GTK_SELECTION_SINGLE ); -gtk_widget_realize (tree1_w); } static void renderer_edited(GtkCellRendererText * cell,
@@ -967,7 +966,6 @@ on_treeview1_button_press_event(GtkWidget * widget,display_tree_part (); } -gtk_widget_realize (tree2_w);gtk_tree_view_set_cursor (view, path,NULL , FALSE);gtk_widget_grab_focus (tree2_w);
Signature · 1 line
2.43.0
PATCH 15/66 kconfig: gconf: remove gtk_tree_view_set_rules_hint() calls
In reply to Masahiro YamadaThe use of the this function is not recommended, and it has been deprecated since GTK 3.14.
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.14.0/gtk/gtktreeview.c#L11891
---
scripts/kconfig/gconf.c | 2 -- 1 file changed, 2 deletions(-)
scripts/kconfig/gconf.c +0 -2
@@ -189,7 +189,6 @@ static void init_left_tree(void)GtkTreeViewColumn *column;gtk_tree_view_set_model (view, model1); -gtk_tree_view_set_rules_hint (view, TRUE); column =gtk_tree_view_column_new ();gtk_tree_view_append_column (view, column);
@@ -230,7 +229,6 @@ static void init_right_tree(void)gint i;gtk_tree_view_set_model (view, model2); -gtk_tree_view_set_rules_hint (view, TRUE); column =gtk_tree_view_column_new ();gtk_tree_view_append_column (view, column);
Signature · 1 line
2.43.0
PATCH 16/66 kconfig: gconf: remove unnecessary gtk_set_locale() call
In reply to Masahiro Yamadagtk_set_locale() has been deprecated since version 2.24, and setlocale() should be used directly. [1]
However, gtk_init() automatically does this, so there is typically no point in calling this function.
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtkmain.c#L1152
---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/gconf.c +0 -1
@@ -1367,7 +1367,6 @@ int main(int ac, char *av[])gchar *glade_file;/* GTK stuffs */ -gtk_set_locale ();gtk_init (&ac, &av);glade_init ();
Signature · 1 line
2.43.0
PATCH 17/66 kconfig: gconf: remove internal-child="image" nodes from glade
In reply to Masahiro YamadaThese nodes do not appear to serve anything useful.
---
scripts/kconfig/gconf.glade | 84 ------------------------------------- 1 file changed, 84 deletions(-)
scripts/kconfig/gconf.glade +0 -84
@@ -48,18 +48,6 @@ <property name="use_underline">True</property> <signal name="activate" handler="on_load1_activate"/> <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image39"> - <property name="visible">True</property> - <property name="stock">gtk-open</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child>
@@ -71,18 +59,6 @@ <property name="use_underline">True</property> <signal name="activate" handler="on_save_activate"/> <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image40"> - <property name="visible">True</property> - <property name="stock">gtk-save</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child>
@@ -93,18 +69,6 @@ <property name="label" translatable="yes">Save _as</property> <property name="use_underline">True</property> <signal name="activate" handler="on_save_as1_activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image41"> - <property name="visible">True</property> - <property name="stock">gtk-save-as</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child>
@@ -121,18 +85,6 @@ <property name="use_underline">True</property> <signal name="activate" handler="on_quit1_activate"/> <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image42"> - <property name="visible">True</property> - <property name="stock">gtk-quit</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child> </widget>
@@ -244,18 +196,6 @@ <property name="use_underline">True</property> <signal name="activate" handler="on_introduction1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image43"> - <property name="visible">True</property> - <property name="stock">gtk-dialog-question</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child>
@@ -266,18 +206,6 @@ <property name="use_underline">True</property> <signal name="activate" handler="on_about1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image44"> - <property name="visible">True</property> - <property name="stock">gtk-properties</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child>
@@ -287,18 +215,6 @@ <property name="label" translatable="yes">_License</property> <property name="use_underline">True</property> <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image45"> - <property name="visible">True</property> - <property name="stock">gtk-justify-fill</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> </widget> </child> </widget>
Signature · 1 line
2.43.0
PATCH 18/66 kconfig: gconf: remove parents[] array and indent variable
In reply to Masahiro YamadaThe parents[] array is used to store the GtkTreeIter of parent nodes, but this can be simplified: we can pass a GtkTreeIter pointer down when _display_tree() recurses.
---
scripts/kconfig/gconf.c | 49 ++++++++++++----------------------------- 1 file changed, 14 insertions(+), 35 deletions(-)
scripts/kconfig/gconf.c +14 -35
@@ -47,8 +47,6 @@ GdkColor color;GtkTreeStore *tree1, *tree2, *tree;GtkTreeModel *model1, *model2; -static GtkTreeIter *parents[256 ]; -static gint indent;static struct menu *current;// current node for SINGLE view static struct menu *browsed;// browsed node for SPLIT view
@@ -153,8 +151,6 @@ static void init_main_window(const gchar *glade_file)static void init_tree_model (void ) { -gint i; - tree = tree2 = gtk_tree_store_new(COL_NUMBER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
@@ -166,9 +162,6 @@ static void init_tree_model(void) G_TYPE_BOOLEAN); model2 =GTK_TREE_MODEL (tree2); -for (parents[0 ] =NULL , i =1 ; i <256 ; i++) - parents[i] = (GtkTreeIter *)g_malloc (sizeof (GtkTreeIter)); - tree1 = gtk_tree_store_new(COL_NUMBER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
@@ -1131,18 +1124,6 @@ static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row)g_object_unref (pix); } - -/* Add a node to the tree */ -static void place_node (struct menu *menu,char **row) -{ -GtkTreeIter *parent = parents[indent -1 ]; -GtkTreeIter *node = parents[indent]; - -gtk_tree_store_append (tree, node, parent); -set_node (node, menu, row); -} - -/* Find a node in the GTK+ tree */ static GtkTreeIter found;
@@ -1193,9 +1174,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)struct symbol *sym;struct menu *menu1, *menu2; -if (src == &rootmenu) - indent =1 ; - valid =gtk_tree_model_iter_children (model2, child2, dst);for (child1 = src->list; child1; child1 = child1->next) {
@@ -1253,9 +1231,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)set_node (child2, menu1,fill_row (menu1)); } - indent++;update_tree (child1, child2); - indent--; valid =gtk_tree_model_iter_next (model2, child2); }
@@ -1263,16 +1239,15 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)/* Display the whole tree (single/split/full view) */ -static void display_tree (struct menu *menu) +static void _display_tree (struct menu *menu,GtkTreeIter *parent) {struct property *prop;struct menu *child;enum prop_type ptype; +GtkTreeIter iter; -if (menu == &rootmenu) { - indent =1 ; +if (menu == &rootmenu) current = &rootmenu; - }for (child = menu->list; child; child = child->next) { prop = child->prompt;
@@ -1290,8 +1265,10 @@ static void display_tree(struct menu *menu)if ((opt_mode ==OPT_NORMAL &&menu_is_visible (child)) || (opt_mode ==OPT_PROMPT &&menu_has_prompt (child)) || - (opt_mode ==OPT_ALL &&menu_get_prompt (child))) -place_node (child,fill_row (child)); + (opt_mode ==OPT_ALL &&menu_get_prompt (child))) { +gtk_tree_store_append (tree, &iter, parent); +set_node (&iter, child,fill_row (child)); + }if ((view_mode !=FULL_VIEW ) && (ptype ==P_MENU ) && (tree == tree2))
@@ -1308,14 +1285,16 @@ static void display_tree(struct menu *menu)if (((view_mode ==SINGLE_VIEW ) && (menu->flags &MENU_ROOT )) || (view_mode ==FULL_VIEW ) - || (view_mode ==SPLIT_VIEW )) { - indent++; -display_tree (child); - indent--; - } + || (view_mode ==SPLIT_VIEW )) +_display_tree (child, &iter); } } +static void display_tree (struct menu *menu) +{ +_display_tree (menu,NULL ); +} +/* Display a part of the tree starting at current node (single/split view) */ static void display_tree_part (void ) {
Signature · 1 line
2.43.0
PATCH 19/66 kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2
In reply to Masahiro YamadaThe tree1 and tree2 variables are initialized earlier in init_tree_model(), so the NULL checks are redundant.
---
scripts/kconfig/gconf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
scripts/kconfig/gconf.c +4 -8
@@ -678,8 +678,7 @@ void on_split_clicked(GtkButton * button, gpointer user_data)gtk_widget_show (tree1_w);gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h);gtk_paned_set_position (GTK_PANED (hpaned), w /2 ); -if (tree2) -gtk_tree_store_clear (tree2); +gtk_tree_store_clear (tree2);display_list ();/* Disable back btn, like in full mode. */
@@ -691,8 +690,7 @@ void on_full_clicked(GtkButton * button, gpointer user_data) { view_mode =FULL_VIEW ;gtk_widget_hide (tree1_w); -if (tree2) -gtk_tree_store_clear (tree2); +gtk_tree_store_clear (tree2);display_tree (&rootmenu);gtk_widget_set_sensitive (back_btn, FALSE); }
@@ -1298,8 +1296,7 @@ static void display_tree(struct menu *menu)/* Display a part of the tree starting at current node (single/split view) */ static void display_tree_part (void ) { -if (tree2) -gtk_tree_store_clear (tree2); +gtk_tree_store_clear (tree2);if (view_mode ==SINGLE_VIEW )display_tree (current);else if (view_mode ==SPLIT_VIEW )
@@ -1312,8 +1309,7 @@ static void display_tree_part(void)/* Display the list in the left frame (split view) */ static void display_list (void ) { -if (tree1) -gtk_tree_store_clear (tree1); +gtk_tree_store_clear (tree1); tree = tree1;display_tree (&rootmenu);
Signature · 1 line
2.43.0
PATCH 20/66 kconfig: gconf: remove unneeded variable in on_split_clicked()
In reply to Masahiro YamadaThe height of the window is not used here. Passing NULL to gtk_window_get_default_size() is allowed. [1]
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtkwindow.c#L3974
---
scripts/kconfig/gconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/gconf.c +2 -2
@@ -673,10 +673,10 @@ void on_single_clicked(GtkButton * button, gpointer user_data)void on_split_clicked (GtkButton * button,gpointer user_data) { -gint w, h; +gint w; view_mode =SPLIT_VIEW ;gtk_widget_show (tree1_w); -gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h); +gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w,NULL );gtk_paned_set_position (GTK_PANED (hpaned), w /2 );gtk_tree_store_clear (tree2);display_list ();
Signature · 1 line
2.43.0
PATCH 21/66 kconfig: gconf: remove unneeded variables in on_treeview*_button_press_event()
In reply to Masahiro YamadaNo all position parameters are used here. Passing NULL to gtk_tree_view_get_cursor() or gtk_tree_view_get_path_at_pos() is allowed. [1] [2]
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12638
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12795
---
scripts/kconfig/gconf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
scripts/kconfig/gconf.c +3 -11
@@ -822,13 +822,10 @@ on_treeview2_button_press_event(GtkWidget * widget,GtkTreeIter iter;struct menu *menu;gint col; -gint tx = (gint ) event->x;gint ty = (gint ) event->y; -gint cx, cy; -gtk_tree_view_get_path_at_pos (view, tx, ty, &path, &column, &cx, - &cy); +gtk_tree_view_get_path_at_pos (view, tx, ty, &path, &column,NULL ,NULL );if (path ==NULL )return FALSE;
@@ -871,12 +868,11 @@ on_treeview2_key_press_event(GtkWidget * widget, {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path; -GtkTreeViewColumn *column;GtkTreeIter iter;struct menu *menu;gint col; -gtk_tree_view_get_cursor (view, &path, &column); +gtk_tree_view_get_cursor (view, &path,NULL );if (path ==NULL )return FALSE;
@@ -930,16 +926,12 @@ on_treeview1_button_press_event(GtkWidget * widget, {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path; -GtkTreeViewColumn *column;GtkTreeIter iter;struct menu *menu; -gint tx = (gint ) event->x;gint ty = (gint ) event->y; -gint cx, cy; -gtk_tree_view_get_path_at_pos (view, tx, ty, &path, &column, &cx, - &cy); +gtk_tree_view_get_path_at_pos (view, tx, ty, &path,NULL ,NULL ,NULL );if (path ==NULL )return FALSE;
Signature · 1 line
2.43.0
Re: [PATCH 21/66] kconfig: gconf: remove unneeded variables in on_treeview*_button_press_event()
Quoted 1 line · Masahiro Yamada
No all position parameters are used here. Passing NULL to
Not all
Quoted 10 lines
gtk_tree_view_get_cursor()orgtk_tree_view_get_path_at_pos()is allowed. [1] [2][1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12638
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12795Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/gconf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
Signature · 1 line
~Randy
Re: [PATCH 21/66] kconfig: gconf: remove unneeded variables in on_treeview*_button_press_event()
Quoted 14 lines · Randy Dunlap
Quoted 1 line · Masahiro Yamada
No all position parameters are used here. Passing NULL to
Not all
Quoted 6 lines
gtk_tree_view_get_cursor()orgtk_tree_view_get_path_at_pos()is allowed. [1] [2][1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12638
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gtk/gtktreeview.c#L12795Signed-off-by Masahiro Yamada <[email protected]>
Thanks. I will locally fix it.
Quoted 6 lines
Quoted 3 lines
scripts/kconfig/gconf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)--
~Randy
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 22/66 kconfig: gconf: remove unused 'color' variable
In reply to Masahiro YamadaThis is not used at all.
---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/gconf.c +0 -1
@@ -43,7 +43,6 @@ GtkWidget *save_btn = NULL;GtkWidget *save_menu_item =NULL ;GtkTextTag *tag1, *tag2; -GdkColor color;GtkTreeStore *tree1, *tree2, *tree;GtkTreeModel *model1, *model2;
Signature · 1 line
2.43.0
PATCH 23/66 kconfig: gconf: add static qualifiers to variables
In reply to Masahiro YamadaI also removed unnecessary initializers.
---
scripts/kconfig/gconf.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
scripts/kconfig/gconf.c +12 -12
@@ -32,20 +32,20 @@ static gboolean show_range = TRUE;static gboolean show_value = TRUE;static int opt_mode =OPT_NORMAL ; -GtkWidget *main_wnd =NULL ; -GtkWidget *tree1_w =NULL ;// left frame -GtkWidget *tree2_w =NULL ;// right frame -GtkWidget *text_w =NULL ; -GtkWidget *hpaned =NULL ; -GtkWidget *vpaned =NULL ; -GtkWidget *back_btn =NULL ; -GtkWidget *save_btn =NULL ; -GtkWidget *save_menu_item =NULL ; +static GtkWidget *main_wnd; +static GtkWidget *tree1_w;// left frame +static GtkWidget *tree2_w;// right frame +static GtkWidget *text_w; +static GtkWidget *hpaned; +static GtkWidget *vpaned; +static GtkWidget *back_btn; +static GtkWidget *save_btn; +static GtkWidget *save_menu_item; -GtkTextTag *tag1, *tag2; +static GtkTextTag *tag1, *tag2; -GtkTreeStore *tree1, *tree2, *tree; -GtkTreeModel *model1, *model2; +static GtkTreeStore *tree1, *tree2, *tree; +static GtkTreeModel *model1, *model2;static struct menu *current;// current node for SINGLE view static struct menu *browsed;// browsed node for SPLIT view
Signature · 1 line
2.43.0
PATCH 24/66 kconfig: gconf: move init_*() functions below
In reply to Masahiro YamadaThis allows removal of the forward declaration of renderer_edited().
---
scripts/kconfig/gconf.c | 450 ++++++++++++++++++++-------------------- 1 file changed, 222 insertions(+), 228 deletions(-)
scripts/kconfig/gconf.c +222 -228
@@ -62,240 +62,12 @@ static void display_tree(struct menu *menu);static void display_tree_part (void );static void update_tree (struct menu *src,GtkTreeIter * dst); -static void replace_button_icon (GladeXML *xml,GdkDrawable *window, -GtkStyle *style,gchar *btn_name,gchar **xpm) -{ -GdkPixmap *pixmap; -GdkBitmap *mask; -GtkToolButton *button; -GtkWidget *image; - - pixmap =gdk_pixmap_create_from_xpm_d (window, &mask, - &style->bg[GTK_STATE_NORMAL ], - xpm); - - button =GTK_TOOL_BUTTON (glade_xml_get_widget (xml, btn_name)); - image =gtk_image_new_from_pixmap (pixmap, mask); -gtk_widget_show (image); -gtk_tool_button_set_icon_widget (button, image); -} -static void conf_changed (bool dirty) {gtk_widget_set_sensitive (save_btn, dirty);gtk_widget_set_sensitive (save_menu_item, dirty); } -/* Main Window Initialization */ -static void init_main_window (const gchar *glade_file) -{ -GladeXML *xml; -GtkWidget *widget; -GtkTextBuffer *txtbuf; -GtkStyle *style; - - xml =glade_xml_new (glade_file,"window1" ,NULL ); -if (!xml) -g_error ("GUI loading failed !\n" ); -glade_xml_signal_autoconnect (xml); - - main_wnd =glade_xml_get_widget (xml,"window1" ); - hpaned =glade_xml_get_widget (xml,"hpaned1" ); - vpaned =glade_xml_get_widget (xml,"vpaned1" ); - tree1_w =glade_xml_get_widget (xml,"treeview1" ); - tree2_w =glade_xml_get_widget (xml,"treeview2" ); - text_w =glade_xml_get_widget (xml,"textview3" ); - - back_btn =glade_xml_get_widget (xml,"button1" ); -gtk_widget_set_sensitive (back_btn, FALSE); - - widget =glade_xml_get_widget (xml,"show_name1" ); -gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, - show_name); - - widget =glade_xml_get_widget (xml,"show_range1" ); -gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, - show_range); - - widget =glade_xml_get_widget (xml,"show_data1" ); -gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, - show_value); - - save_btn =glade_xml_get_widget (xml,"button3" ); - save_menu_item =glade_xml_get_widget (xml,"save1" ); -conf_set_changed_callback (conf_changed); - - style =gtk_widget_get_style (main_wnd); - -replace_button_icon (xml, main_wnd->window, style, -"button4" , (gchar **) xpm_single_view); -replace_button_icon (xml, main_wnd->window, style, -"button5" , (gchar **) xpm_split_view); -replace_button_icon (xml, main_wnd->window, style, -"button6" , (gchar **) xpm_tree_view); - - txtbuf =gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_w)); - tag1 =gtk_text_buffer_create_tag (txtbuf,"mytag1" , -"foreground" ,"red" , -"weight" ,PANGO_WEIGHT_BOLD , -NULL ); - tag2 =gtk_text_buffer_create_tag (txtbuf,"mytag2" , -/*"style", PANGO_STYLE_OBLIQUE, */ -NULL ); - -gtk_window_set_title (GTK_WINDOW (main_wnd), rootmenu.prompt->text); - -gtk_widget_show (main_wnd); -} - -static void init_tree_model (void ) -{ - tree = tree2 =gtk_tree_store_new (COL_NUMBER , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_POINTER ,GDK_TYPE_COLOR , -G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF , -G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , -G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , -G_TYPE_BOOLEAN ); - model2 =GTK_TREE_MODEL (tree2); - - tree1 =gtk_tree_store_new (COL_NUMBER , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_POINTER ,GDK_TYPE_COLOR , -G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF , -G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , -G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , -G_TYPE_BOOLEAN ); - model1 =GTK_TREE_MODEL (tree1); -} - -static void init_left_tree (void ) -{ -GtkTreeView *view =GTK_TREE_VIEW (tree1_w); -GtkCellRenderer *renderer; -GtkTreeSelection *sel; -GtkTreeViewColumn *column; - -gtk_tree_view_set_model (view, model1); - - column =gtk_tree_view_column_new (); -gtk_tree_view_append_column (view, column); -gtk_tree_view_column_set_title (column,"Options" ); - - renderer =gtk_cell_renderer_toggle_new (); -gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), - renderer, FALSE); -gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), - renderer, -"active" ,COL_BTNACT , -"inconsistent" ,COL_BTNINC , -"visible" ,COL_BTNVIS , -"radio" ,COL_BTNRAD ,NULL ); - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), - renderer, FALSE); -gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), - renderer, -"text" ,COL_OPTION , -"foreground-gdk" , -COL_COLOR ,NULL ); - - sel =gtk_tree_view_get_selection (view); -gtk_tree_selection_set_mode (sel,GTK_SELECTION_SINGLE ); -} - -static void renderer_edited (GtkCellRendererText * cell, -const gchar * path_string, -const gchar * new_text,gpointer user_data); - -static void init_right_tree (void ) -{ -GtkTreeView *view =GTK_TREE_VIEW (tree2_w); -GtkCellRenderer *renderer; -GtkTreeSelection *sel; -GtkTreeViewColumn *column; -gint i; - -gtk_tree_view_set_model (view, model2); - - column =gtk_tree_view_column_new (); -gtk_tree_view_append_column (view, column); -gtk_tree_view_column_set_title (column,"Options" ); - - renderer =gtk_cell_renderer_pixbuf_new (); -gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), - renderer, FALSE); -gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), - renderer, -"pixbuf" ,COL_PIXBUF , -"visible" ,COL_PIXVIS ,NULL ); - renderer =gtk_cell_renderer_toggle_new (); -gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), - renderer, FALSE); -gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), - renderer, -"active" ,COL_BTNACT , -"inconsistent" ,COL_BTNINC , -"visible" ,COL_BTNVIS , -"radio" ,COL_BTNRAD ,NULL ); - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), - renderer, FALSE); -gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), - renderer, -"text" ,COL_OPTION , -"foreground-gdk" , -COL_COLOR ,NULL ); - - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_insert_column_with_attributes (view,-1 , -"Name" , renderer, -"text" ,COL_NAME , -"foreground-gdk" , -COL_COLOR ,NULL ); - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_insert_column_with_attributes (view,-1 , -"N" , renderer, -"text" ,COL_NO , -"foreground-gdk" , -COL_COLOR ,NULL ); - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_insert_column_with_attributes (view,-1 , -"M" , renderer, -"text" ,COL_MOD , -"foreground-gdk" , -COL_COLOR ,NULL ); - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_insert_column_with_attributes (view,-1 , -"Y" , renderer, -"text" ,COL_YES , -"foreground-gdk" , -COL_COLOR ,NULL ); - renderer =gtk_cell_renderer_text_new (); -gtk_tree_view_insert_column_with_attributes (view,-1 , -"Value" , renderer, -"text" ,COL_VALUE , -"editable" , -COL_EDIT , -"foreground-gdk" , -COL_COLOR ,NULL ); -g_signal_connect (G_OBJECT (renderer),"edited" , -G_CALLBACK (renderer_edited),NULL ); - -for (i =0 ; i <COL_VALUE ; i++) { - column =gtk_tree_view_get_column (view, i); -gtk_tree_view_column_set_resizable (column, TRUE); - } - - sel =gtk_tree_view_get_selection (view); -gtk_tree_selection_set_mode (sel,GTK_SELECTION_SINGLE ); -} - -/* Utility Functions */
@@ -1324,6 +1096,228 @@ static void fixup_rootmenu(struct menu *menu) } } +/* Main Window Initialization */ +static void replace_button_icon (GladeXML *xml,GdkDrawable *window, +GtkStyle *style,gchar *btn_name,gchar **xpm) +{ +GdkPixmap *pixmap; +GdkBitmap *mask; +GtkToolButton *button; +GtkWidget *image; + + pixmap =gdk_pixmap_create_from_xpm_d (window, &mask, + &style->bg[GTK_STATE_NORMAL ], + xpm); + + button =GTK_TOOL_BUTTON (glade_xml_get_widget (xml, btn_name)); + image =gtk_image_new_from_pixmap (pixmap, mask); +gtk_widget_show (image); +gtk_tool_button_set_icon_widget (button, image); +} + +static void init_main_window (const gchar *glade_file) +{ +GladeXML *xml; +GtkWidget *widget; +GtkTextBuffer *txtbuf; +GtkStyle *style; + + xml =glade_xml_new (glade_file,"window1" ,NULL ); +if (!xml) +g_error ("GUI loading failed !\n" ); +glade_xml_signal_autoconnect (xml); + + main_wnd =glade_xml_get_widget (xml,"window1" ); + hpaned =glade_xml_get_widget (xml,"hpaned1" ); + vpaned =glade_xml_get_widget (xml,"vpaned1" ); + tree1_w =glade_xml_get_widget (xml,"treeview1" ); + tree2_w =glade_xml_get_widget (xml,"treeview2" ); + text_w =glade_xml_get_widget (xml,"textview3" ); + + back_btn =glade_xml_get_widget (xml,"button1" ); +gtk_widget_set_sensitive (back_btn, FALSE); + + widget =glade_xml_get_widget (xml,"show_name1" ); +gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, + show_name); + + widget =glade_xml_get_widget (xml,"show_range1" ); +gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, + show_range); + + widget =glade_xml_get_widget (xml,"show_data1" ); +gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, + show_value); + + save_btn =glade_xml_get_widget (xml,"button3" ); + save_menu_item =glade_xml_get_widget (xml,"save1" ); +conf_set_changed_callback (conf_changed); + + style =gtk_widget_get_style (main_wnd); + +replace_button_icon (xml, main_wnd->window, style, +"button4" , (gchar **) xpm_single_view); +replace_button_icon (xml, main_wnd->window, style, +"button5" , (gchar **) xpm_split_view); +replace_button_icon (xml, main_wnd->window, style, +"button6" , (gchar **) xpm_tree_view); + + txtbuf =gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_w)); + tag1 =gtk_text_buffer_create_tag (txtbuf,"mytag1" , +"foreground" ,"red" , +"weight" ,PANGO_WEIGHT_BOLD , +NULL ); + tag2 =gtk_text_buffer_create_tag (txtbuf,"mytag2" , +/*"style", PANGO_STYLE_OBLIQUE, */ +NULL ); + +gtk_window_set_title (GTK_WINDOW (main_wnd), rootmenu.prompt->text); + +gtk_widget_show (main_wnd); +} + +static void init_tree_model (void ) +{ + tree = tree2 =gtk_tree_store_new (COL_NUMBER , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_POINTER ,GDK_TYPE_COLOR , +G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF , +G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , +G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , +G_TYPE_BOOLEAN ); + model2 =GTK_TREE_MODEL (tree2); + + tree1 =gtk_tree_store_new (COL_NUMBER , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_POINTER ,GDK_TYPE_COLOR , +G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF , +G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , +G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , +G_TYPE_BOOLEAN ); + model1 =GTK_TREE_MODEL (tree1); +} + +static void init_left_tree (void ) +{ +GtkTreeView *view =GTK_TREE_VIEW (tree1_w); +GtkCellRenderer *renderer; +GtkTreeSelection *sel; +GtkTreeViewColumn *column; + +gtk_tree_view_set_model (view, model1); + + column =gtk_tree_view_column_new (); +gtk_tree_view_append_column (view, column); +gtk_tree_view_column_set_title (column,"Options" ); + + renderer =gtk_cell_renderer_toggle_new (); +gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), + renderer, FALSE); +gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), + renderer, +"active" ,COL_BTNACT , +"inconsistent" ,COL_BTNINC , +"visible" ,COL_BTNVIS , +"radio" ,COL_BTNRAD ,NULL ); + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), + renderer, FALSE); +gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), + renderer, +"text" ,COL_OPTION , +"foreground-gdk" , +COL_COLOR ,NULL ); + + sel =gtk_tree_view_get_selection (view); +gtk_tree_selection_set_mode (sel,GTK_SELECTION_SINGLE ); +} + +static void init_right_tree (void ) +{ +GtkTreeView *view =GTK_TREE_VIEW (tree2_w); +GtkCellRenderer *renderer; +GtkTreeSelection *sel; +GtkTreeViewColumn *column; +gint i; + +gtk_tree_view_set_model (view, model2); + + column =gtk_tree_view_column_new (); +gtk_tree_view_append_column (view, column); +gtk_tree_view_column_set_title (column,"Options" ); + + renderer =gtk_cell_renderer_pixbuf_new (); +gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), + renderer, FALSE); +gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), + renderer, +"pixbuf" ,COL_PIXBUF , +"visible" ,COL_PIXVIS ,NULL ); + renderer =gtk_cell_renderer_toggle_new (); +gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), + renderer, FALSE); +gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), + renderer, +"active" ,COL_BTNACT , +"inconsistent" ,COL_BTNINC , +"visible" ,COL_BTNVIS , +"radio" ,COL_BTNRAD ,NULL ); + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), + renderer, FALSE); +gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), + renderer, +"text" ,COL_OPTION , +"foreground-gdk" , +COL_COLOR ,NULL ); + + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_insert_column_with_attributes (view,-1 , +"Name" , renderer, +"text" ,COL_NAME , +"foreground-gdk" , +COL_COLOR ,NULL ); + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_insert_column_with_attributes (view,-1 , +"N" , renderer, +"text" ,COL_NO , +"foreground-gdk" , +COL_COLOR ,NULL ); + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_insert_column_with_attributes (view,-1 , +"M" , renderer, +"text" ,COL_MOD , +"foreground-gdk" , +COL_COLOR ,NULL ); + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_insert_column_with_attributes (view,-1 , +"Y" , renderer, +"text" ,COL_YES , +"foreground-gdk" , +COL_COLOR ,NULL ); + renderer =gtk_cell_renderer_text_new (); +gtk_tree_view_insert_column_with_attributes (view,-1 , +"Value" , renderer, +"text" ,COL_VALUE , +"editable" , +COL_EDIT , +"foreground-gdk" , +COL_COLOR ,NULL ); +g_signal_connect (G_OBJECT (renderer),"edited" , +G_CALLBACK (renderer_edited),NULL ); + +for (i =0 ; i <COL_VALUE ; i++) { + column =gtk_tree_view_get_column (view, i); +gtk_tree_view_column_set_resizable (column, TRUE); + } + + sel =gtk_tree_view_get_selection (view); +gtk_tree_selection_set_mode (sel,GTK_SELECTION_SINGLE ); +}/* Main */ int main (int ac,char *av[])
Signature · 1 line
2.43.0
PATCH 25/66 kconfig: gconf: refactor view setting code
In reply to Masahiro YamadaFactor out common code for setting the view into a new function, set_view_mode().
---
scripts/kconfig/gconf.c | 74 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-)
scripts/kconfig/gconf.c +38 -36
@@ -18,7 +18,7 @@#include <unistd.h> #include <time.h> -enum { +enum view_mode {SINGLE_VIEW ,SPLIT_VIEW ,FULL_VIEW };
@@ -70,6 +70,39 @@ static void conf_changed(bool dirty)/* Utility Functions */ +static void set_view_mode (enum view_mode mode) +{ + view_mode = mode; + +if (mode ==SPLIT_VIEW ) {// two panes +gint w; + +gtk_widget_show (tree1_w); +gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w,NULL ); +gtk_paned_set_position (GTK_PANED (hpaned), w /2 ); + }else { +gtk_widget_hide (tree1_w); +gtk_paned_set_position (GTK_PANED (hpaned),0 ); + } + +switch (mode) { +case SINGLE_VIEW : + current = &rootmenu; +display_tree_part (); +break ; +case SPLIT_VIEW : +gtk_tree_store_clear (tree2); +display_list (); +break ; +case FULL_VIEW : +gtk_tree_store_clear (tree2); +display_tree (&rootmenu); +break ; + } + +if (mode !=SINGLE_VIEW ) +gtk_widget_set_sensitive (back_btn, FALSE); +}static void text_insert_help (struct menu *menu) {
@@ -435,35 +468,19 @@ void on_load_clicked(GtkButton * button, gpointer user_data)void on_single_clicked (GtkButton * button,gpointer user_data) { - view_mode =SINGLE_VIEW ; -gtk_widget_hide (tree1_w); - current = &rootmenu; -display_tree_part (); +set_view_mode (SINGLE_VIEW ); }void on_split_clicked (GtkButton * button,gpointer user_data) { -gint w; - view_mode =SPLIT_VIEW ; -gtk_widget_show (tree1_w); -gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w,NULL ); -gtk_paned_set_position (GTK_PANED (hpaned), w /2 ); -gtk_tree_store_clear (tree2); -display_list (); - -/* Disable back btn, like in full mode. */ -gtk_widget_set_sensitive (back_btn, FALSE); +set_view_mode (SPLIT_VIEW ); }void on_full_clicked (GtkButton * button,gpointer user_data) { - view_mode =FULL_VIEW ; -gtk_widget_hide (tree1_w); -gtk_tree_store_clear (tree2); -display_tree (&rootmenu); -gtk_widget_set_sensitive (back_btn, FALSE); +set_view_mode (FULL_VIEW ); }
@@ -1039,11 +1056,6 @@ static void _display_tree(struct menu *menu, GtkTreeIter *parent)|| (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW))*/ -/* Change paned position if the view is not in 'split mode' */ -if (view_mode ==SINGLE_VIEW || view_mode ==FULL_VIEW ) { -gtk_paned_set_position (GTK_PANED (hpaned),0 ); - } -if (((view_mode ==SINGLE_VIEW ) && (menu->flags &MENU_ROOT )) || (view_mode ==FULL_VIEW ) || (view_mode ==SPLIT_VIEW ))
@@ -1368,17 +1380,7 @@ int main(int ac, char *av[])conf_read (NULL ); -switch (view_mode) { -case SINGLE_VIEW : -display_tree_part (); -break ; -case SPLIT_VIEW : -display_list (); -break ; -case FULL_VIEW : -display_tree (&rootmenu); -break ; - } +set_view_mode (view_mode);gtk_main ();
Signature · 1 line
2.43.0
Re: [PATCH 25/66] kconfig: gconf: refactor view setting code
Quoted 4 lines · Masahiro Yamada
Factor out common code for setting the view into a new function,
set_view_mode().Signed-off-by Masahiro Yamada <[email protected]>
Nice cleanup.
Quoted 4 lines
---
scripts/kconfig/gconf.c | 74 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-)
Signature · 1 line
~Randy
PATCH 26/66 kconfig: gconf: grey out button for current view
In reply to Masahiro YamadaThis clarifies which view is currently selected.
---
scripts/kconfig/gconf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
scripts/kconfig/gconf.c +13 -2
@@ -38,8 +38,7 @@ static GtkWidget *tree2_w; // right framestatic GtkWidget *text_w;static GtkWidget *hpaned;static GtkWidget *vpaned; -static GtkWidget *back_btn; -static GtkWidget *save_btn; +static GtkWidget *back_btn, *save_btn, *single_btn, *split_btn, *full_btn;static GtkWidget *save_menu_item;static GtkTextTag *tag1, *tag2;
@@ -85,18 +84,25 @@ static void set_view_mode(enum view_mode mode)gtk_paned_set_position (GTK_PANED (hpaned),0 ); } +gtk_widget_set_sensitive (single_btn, TRUE); +gtk_widget_set_sensitive (split_btn, TRUE); +gtk_widget_set_sensitive (full_btn, TRUE); +switch (mode) {case SINGLE_VIEW : current = &rootmenu;display_tree_part (); +gtk_widget_set_sensitive (single_btn, FALSE);break ;case SPLIT_VIEW :gtk_tree_store_clear (tree2);display_list (); +gtk_widget_set_sensitive (split_btn, FALSE);break ;case FULL_VIEW :gtk_tree_store_clear (tree2);display_tree (&rootmenu); +gtk_widget_set_sensitive (full_btn, FALSE);break ; }
@@ -1167,10 +1173,15 @@ static void init_main_window(const gchar *glade_file) style =gtk_widget_get_style (main_wnd); + single_btn =glade_xml_get_widget (xml,"button4" );replace_button_icon (xml, main_wnd->window, style,"button4" , (gchar **) xpm_single_view); + + split_btn =glade_xml_get_widget (xml,"button5" );replace_button_icon (xml, main_wnd->window, style,"button5" , (gchar **) xpm_split_view); + + full_btn =glade_xml_get_widget (xml,"button6" );replace_button_icon (xml, main_wnd->window, style,"button6" , (gchar **) xpm_tree_view);
Signature · 1 line
2.43.0
Re: [PATCH 26/66] kconfig: gconf: grey out button for current view
Quoted 3 lines · Masahiro Yamada
This clarifies which view is currently selected.
Signed-off-by Masahiro Yamada <[email protected]>
Looks good.
Quoted 61 lines
---
scripts/kconfig/gconf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)scripts/kconfig/gconf.c +13
-2@@ -38,8 +38,7 @@ static GtkWidget *tree2_w; // right framestatic GtkWidget *text_w;static GtkWidget *hpaned;static GtkWidget *vpaned; -static GtkWidget *back_btn; -static GtkWidget *save_btn; +static GtkWidget *back_btn, *save_btn, *single_btn, *split_btn, *full_btn;static GtkWidget *save_menu_item;static GtkTextTag *tag1, *tag2;@@ -85,18 +84,25 @@ static void set_view_mode(enum view_mode mode)gtk_paned_set_position (GTK_PANED (hpaned),0 ); } +gtk_widget_set_sensitive (single_btn, TRUE); +gtk_widget_set_sensitive (split_btn, TRUE); +gtk_widget_set_sensitive (full_btn, TRUE); +switch (mode) {case SINGLE_VIEW : current = &rootmenu;display_tree_part (); +gtk_widget_set_sensitive (single_btn, FALSE);break ;case SPLIT_VIEW :gtk_tree_store_clear (tree2);display_list (); +gtk_widget_set_sensitive (split_btn, FALSE);break ;case FULL_VIEW :gtk_tree_store_clear (tree2);display_tree (&rootmenu); +gtk_widget_set_sensitive (full_btn, FALSE);break ; }@@ -1167,10 +1173,15 @@ static void init_main_window(const gchar *glade_file) style =gtk_widget_get_style (main_wnd); + single_btn =glade_xml_get_widget (xml,"button4" );replace_button_icon (xml, main_wnd->window, style,"button4" , (gchar **) xpm_single_view); + + split_btn =glade_xml_get_widget (xml,"button5" );replace_button_icon (xml, main_wnd->window, style,"button5" , (gchar **) xpm_split_view); + + full_btn =glade_xml_get_widget (xml,"button6" );replace_button_icon (xml, main_wnd->window, style,"button6" , (gchar **) xpm_tree_view);
Signature · 1 line
~Randy
PATCH 27/66 kconfig: gconf: move the main window event handlers below
In reply to Masahiro YamadaThis allows removal of the forward delcaration of on_save_activate().
---
scripts/kconfig/gconf.c | 164 +++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 86 deletions(-)
scripts/kconfig/gconf.c +78 -86
@@ -155,84 +155,6 @@ static void text_insert_msg(const char *title, const char *message) NULL); } - -/* Main Windows Callbacks */ - -void on_save_activate (GtkMenuItem * menuitem,gpointer user_data); -gboolean on_window1_delete_event (GtkWidget * widget,GdkEvent * event, -gpointer user_data) -{ -GtkWidget *dialog, *label; -gint result; -gint ret = FALSE; - -if (!conf_get_changed ()) -return FALSE; - - dialog =gtk_dialog_new_with_buttons ("Warning !" , -GTK_WINDOW (main_wnd), - (GtkDialogFlags) - (GTK_DIALOG_MODAL | -GTK_DIALOG_DESTROY_WITH_PARENT ), -GTK_STOCK_OK , -GTK_RESPONSE_YES , -GTK_STOCK_NO , -GTK_RESPONSE_NO , -GTK_STOCK_CANCEL , -GTK_RESPONSE_CANCEL ,NULL ); -gtk_dialog_set_default_response (GTK_DIALOG (dialog), -GTK_RESPONSE_CANCEL ); - - label =gtk_label_new ("\nSave configuration ?\n" ); -gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), label); -gtk_widget_show (label); - - result =gtk_dialog_run (GTK_DIALOG (dialog)); -switch (result) { -case GTK_RESPONSE_YES : -on_save_activate (NULL ,NULL ); -break ; -case GTK_RESPONSE_NO : -break ; -case GTK_RESPONSE_CANCEL : -case GTK_RESPONSE_DELETE_EVENT : -default : - ret = TRUE; -break ; - } - -gtk_widget_destroy (dialog); - -return ret; -} - - -void on_window1_destroy (GtkObject * object,gpointer user_data) -{ -gtk_main_quit (); -} - - -void -on_window1_size_request (GtkWidget * widget, -GtkRequisition * requisition,gpointer user_data) -{ -static gint old_h; -gint w, h; - -if (widget->window ==NULL ) -gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h); -else -gdk_window_get_size (widget->window, &w, &h); - -if (h == old_h) -return ; - old_h = h; - -gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); -} - -/* Menu & Toolbar Callbacks */
@@ -311,14 +233,6 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show (fs); } - -void on_quit1_activate (GtkMenuItem * menuitem,gpointer user_data) -{ -if (!on_window1_delete_event (NULL ,NULL ,NULL )) -gtk_widget_destroy (GTK_WIDGET (main_wnd)); -} - -void on_show_name1_activate (GtkMenuItem * menuitem,gpointer user_data) {GtkTreeViewColumn *col;
@@ -501,6 +415,84 @@ void on_expand_clicked(GtkButton * button, gpointer user_data)gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); } +/* Main Windows Callbacks */ + +void on_window1_destroy (GtkObject *object,gpointer user_data) +{ +gtk_main_quit (); +} + +void on_window1_size_request (GtkWidget *widget, +GtkRequisition *requisition, +gpointer user_data) +{ +static gint old_h; +gint w, h; + +if (widget->window ==NULL ) +gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h); +else +gdk_window_get_size (widget->window, &w, &h); + +if (h == old_h) +return ; + old_h = h; + +gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); +} + +gboolean on_window1_delete_event (GtkWidget *widget,GdkEvent *event, +gpointer user_data) +{ +GtkWidget *dialog, *label; +gint result; +gint ret = FALSE; + +if (!conf_get_changed ()) +return FALSE; + + dialog =gtk_dialog_new_with_buttons ("Warning !" , +GTK_WINDOW (main_wnd), + (GtkDialogFlags) + (GTK_DIALOG_MODAL | +GTK_DIALOG_DESTROY_WITH_PARENT ), +GTK_STOCK_OK , +GTK_RESPONSE_YES , +GTK_STOCK_NO , +GTK_RESPONSE_NO , +GTK_STOCK_CANCEL , +GTK_RESPONSE_CANCEL ,NULL ); +gtk_dialog_set_default_response (GTK_DIALOG (dialog), +GTK_RESPONSE_CANCEL ); + + label =gtk_label_new ("\nSave configuration ?\n" ); +gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), label); +gtk_widget_show (label); + + result =gtk_dialog_run (GTK_DIALOG (dialog)); +switch (result) { +case GTK_RESPONSE_YES : +on_save_activate (NULL ,NULL ); +break ; +case GTK_RESPONSE_NO : +break ; +case GTK_RESPONSE_CANCEL : +case GTK_RESPONSE_DELETE_EVENT : +default : + ret = TRUE; +break ; + } + +gtk_widget_destroy (dialog); + +return ret; +} + +void on_quit1_activate (GtkMenuItem *menuitem,gpointer user_data) +{ +if (!on_window1_delete_event (NULL ,NULL ,NULL )) +gtk_widget_destroy (GTK_WIDGET (main_wnd)); +}/* CTree Callbacks */
Signature · 1 line
2.43.0
PATCH 28/66 kconfig: gconf: move button1 initialization below
In reply to Masahiro YamadaCollect the toolbar-related code in one place.
---
scripts/kconfig/gconf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
scripts/kconfig/gconf.c +5 -3
@@ -1144,9 +1144,7 @@ static void init_main_window(const gchar *glade_file) tree2_w =glade_xml_get_widget (xml,"treeview2" ); text_w =glade_xml_get_widget (xml,"textview3" ); - back_btn =glade_xml_get_widget (xml,"button1" ); -gtk_widget_set_sensitive (back_btn, FALSE); - +/* menubar */ widget =glade_xml_get_widget (xml,"show_name1" );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_name);
@@ -1159,6 +1157,10 @@ static void init_main_window(const gchar *glade_file)gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_value); +/* toolbar */ + back_btn =glade_xml_get_widget (xml,"button1" ); +gtk_widget_set_sensitive (back_btn, FALSE); + save_btn =glade_xml_get_widget (xml,"button3" ); save_menu_item =glade_xml_get_widget (xml,"save1" );conf_set_changed_callback (conf_changed);
Signature · 1 line
2.43.0
PATCH 29/66 kconfig: gconf: add static qualifiers to event handlers
In reply to Masahiro YamadaThis fixes several -Wmissing-prototypes warnings.
---
scripts/kconfig/gconf.c | 173 +++++++++++++++++++++++++----------- scripts/kconfig/gconf.glade | 30 ------- 2 files changed, 120 insertions(+), 83 deletions(-)
scripts/kconfig/gconf.c +120 -53
@@ -172,7 +172,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)display_tree_part (); } -void on_load1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_load1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *fs;
@@ -191,8 +191,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show (fs); } - -void on_save_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_save_activate (GtkMenuItem *menuitem,gpointer user_data) {if (conf_write (NULL ))text_insert_msg ("Error" ,"Unable to save configuration !" );
@@ -214,7 +213,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)gtk_widget_destroy (GTK_WIDGET (user_data)); } -void on_save_as1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_save_as1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *fs;
@@ -233,7 +232,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show (fs); } -void on_show_name1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_show_name1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkTreeViewColumn *col;
@@ -243,8 +242,7 @@ void on_show_name1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_tree_view_column_set_visible (col, show_name); } - -void on_show_range1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_show_range1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkTreeViewColumn *col;
@@ -261,8 +259,7 @@ void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data) } - -void on_show_data1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_show_data1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkTreeViewColumn *col;
@@ -272,35 +269,31 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_tree_view_column_set_visible (col, show_value); } - -void -on_set_option_mode1_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_set_option_mode1_activate (GtkMenuItem *menuitem, +gpointer user_data) { opt_mode =OPT_NORMAL ;gtk_tree_store_clear (tree2);display_tree (&rootmenu);/* instead of update_tree to speed-up */ } - -void -on_set_option_mode2_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_set_option_mode2_activate (GtkMenuItem *menuitem, +gpointer user_data) { opt_mode =OPT_ALL ;gtk_tree_store_clear (tree2);display_tree (&rootmenu);/* instead of update_tree to speed-up */ } - -void -on_set_option_mode3_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_set_option_mode3_activate (GtkMenuItem *menuitem, +gpointer user_data) { opt_mode =OPT_PROMPT ;gtk_tree_store_clear (tree2);display_tree (&rootmenu);/* instead of update_tree to speed-up */ } - -void on_introduction1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_introduction1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *dialog; const gchar *intro_text =
@@ -327,8 +320,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show_all (dialog); } - -void on_about1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_about1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *dialog; const gchar *about_text =
@@ -345,8 +337,7 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show_all (dialog); } - -void on_license1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_license1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *dialog; const gchar *license_text =
@@ -364,8 +355,8 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show_all (dialog); } - -void on_back_clicked (GtkButton * button,gpointer user_data) +/* toolbar handlers */ +static void on_back_clicked (GtkButton *button,gpointer user_data) {enum prop_type ptype;
@@ -379,50 +370,44 @@ void on_back_clicked(GtkButton * button, gpointer user_data)gtk_widget_set_sensitive (back_btn, FALSE); } - -void on_load_clicked (GtkButton * button,gpointer user_data) +static void on_load_clicked (GtkButton *button,gpointer user_data) {on_load1_activate (NULL , user_data); } - -void on_single_clicked (GtkButton * button,gpointer user_data) +static void on_single_clicked (GtkButton *button,gpointer user_data) {set_view_mode (SINGLE_VIEW ); } - -void on_split_clicked (GtkButton * button,gpointer user_data) +static void on_split_clicked (GtkButton *button,gpointer user_data) {set_view_mode (SPLIT_VIEW ); } - -void on_full_clicked (GtkButton * button,gpointer user_data) +static void on_full_clicked (GtkButton *button,gpointer user_data) {set_view_mode (FULL_VIEW ); } - -void on_collapse_clicked (GtkButton * button,gpointer user_data) +static void on_collapse_clicked (GtkButton *button,gpointer user_data) {gtk_tree_view_collapse_all (GTK_TREE_VIEW (tree2_w)); } - -void on_expand_clicked (GtkButton * button,gpointer user_data) +static void on_expand_clicked (GtkButton *button,gpointer user_data) {gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); }/* Main Windows Callbacks */ -void on_window1_destroy (GtkObject *object,gpointer user_data) +static void on_window1_destroy (GtkObject *object,gpointer user_data) {gtk_main_quit (); } -void on_window1_size_request (GtkWidget *widget, +static void on_window1_size_request (GtkWidget *widget,GtkRequisition *requisition,gpointer user_data) {
@@ -441,7 +426,7 @@ void on_window1_size_request(GtkWidget *widget,gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); } -gboolean on_window1_delete_event (GtkWidget *widget,GdkEvent *event, +static gboolean on_window1_delete_event (GtkWidget *widget,GdkEvent *event,gpointer user_data) {GtkWidget *dialog, *label;
@@ -488,7 +473,7 @@ gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event,return ret; } -void on_quit1_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_quit1_activate (GtkMenuItem *menuitem,gpointer user_data) {if (!on_window1_delete_event (NULL ,NULL ,NULL ))gtk_widget_destroy (GTK_WIDGET (main_wnd));
@@ -598,9 +583,9 @@ static gint column2index(GtkTreeViewColumn * column)/* User click: update choice (full) or goes down (single) */ -gboolean -on_treeview2_button_press_event (GtkWidget * widget, -GdkEventButton * event,gpointer user_data) +static gboolean on_treeview2_button_press_event (GtkWidget *widget, +GdkEventButton *event, +gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path;
@@ -648,9 +633,9 @@ on_treeview2_button_press_event(GtkWidget * widget, }/* Key pressed: update choice */ -gboolean -on_treeview2_key_press_event (GtkWidget * widget, -GdkEventKey * event,gpointer user_data) +static gboolean on_treeview2_key_press_event (GtkWidget *widget, +GdkEventKey *event, +gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path;
@@ -690,8 +675,8 @@ on_treeview2_key_press_event(GtkWidget * widget,/* Row selection changed: update help */ -void -on_treeview2_cursor_changed (GtkTreeView * treeview,gpointer user_data) +static void on_treeview2_cursor_changed (GtkTreeView *treeview, +gpointer user_data) {GtkTreeSelection *selection;GtkTreeIter iter;
@@ -706,9 +691,9 @@ on_treeview2_cursor_changed(GtkTreeView * treeview, gpointer user_data)/* User click: display sub-tree in the right frame. */ -gboolean -on_treeview1_button_press_event (GtkWidget * widget, -GdkEventButton * event,gpointer user_data) +static gboolean on_treeview1_button_press_event (GtkWidget *widget, +GdkEventButton *event, +gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path;
@@ -1138,47 +1123,129 @@ static void init_main_window(const gchar *glade_file)glade_xml_signal_autoconnect (xml); main_wnd =glade_xml_get_widget (xml,"window1" ); +g_signal_connect (main_wnd,"destroy" , +G_CALLBACK (on_window1_destroy),NULL ); +g_signal_connect (main_wnd,"size_request" , +G_CALLBACK (on_window1_size_request),NULL ); +g_signal_connect (main_wnd,"delete_event" , +G_CALLBACK (on_window1_delete_event),NULL ); + hpaned =glade_xml_get_widget (xml,"hpaned1" ); vpaned =glade_xml_get_widget (xml,"vpaned1" ); tree1_w =glade_xml_get_widget (xml,"treeview1" ); +g_signal_connect (tree1_w,"cursor_changed" , +G_CALLBACK (on_treeview2_cursor_changed),NULL ); +g_signal_connect (tree1_w,"button_press_event" , +G_CALLBACK (on_treeview1_button_press_event),NULL ); +g_signal_connect (tree1_w,"key_press_event" , +G_CALLBACK (on_treeview2_key_press_event),NULL ); + tree2_w =glade_xml_get_widget (xml,"treeview2" ); +g_signal_connect (tree2_w,"cursor_changed" , +G_CALLBACK (on_treeview2_cursor_changed),NULL ); +g_signal_connect (tree2_w,"button_press_event" , +G_CALLBACK (on_treeview2_button_press_event),NULL ); +g_signal_connect (tree2_w,"key_press_event" , +G_CALLBACK (on_treeview2_key_press_event),NULL ); + text_w =glade_xml_get_widget (xml,"textview3" );/* menubar */ + widget =glade_xml_get_widget (xml,"load1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_load1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"save1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_save_activate),NULL ); + + widget =glade_xml_get_widget (xml,"save_as1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_save_as1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"quit1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_quit1_activate),NULL ); + widget =glade_xml_get_widget (xml,"show_name1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_show_name1_activate),NULL );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_name); widget =glade_xml_get_widget (xml,"show_range1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_show_range1_activate),NULL );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_range); widget =glade_xml_get_widget (xml,"show_data1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_show_data1_activate),NULL );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_value); + widget =glade_xml_get_widget (xml,"set_option_mode1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_set_option_mode1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"set_option_mode2" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_set_option_mode2_activate),NULL ); + + widget =glade_xml_get_widget (xml,"set_option_mode3" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_set_option_mode3_activate),NULL ); + + widget =glade_xml_get_widget (xml,"introduction1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_introduction1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"about1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_about1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"license1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_license1_activate),NULL ); +/* toolbar */ back_btn =glade_xml_get_widget (xml,"button1" ); +g_signal_connect (back_btn,"clicked" , +G_CALLBACK (on_back_clicked),NULL );gtk_widget_set_sensitive (back_btn, FALSE); + widget =glade_xml_get_widget (xml,"button2" ); +g_signal_connect (widget,"clicked" , +G_CALLBACK (on_load_clicked),NULL ); + save_btn =glade_xml_get_widget (xml,"button3" ); +g_signal_connect (save_btn,"clicked" , +G_CALLBACK (on_save_activate),NULL ); save_menu_item =glade_xml_get_widget (xml,"save1" );conf_set_changed_callback (conf_changed); style =gtk_widget_get_style (main_wnd); single_btn =glade_xml_get_widget (xml,"button4" ); +g_signal_connect (single_btn,"clicked" , +G_CALLBACK (on_single_clicked),NULL );replace_button_icon (xml, main_wnd->window, style,"button4" , (gchar **) xpm_single_view); split_btn =glade_xml_get_widget (xml,"button5" ); +g_signal_connect (split_btn,"clicked" , +G_CALLBACK (on_split_clicked),NULL );replace_button_icon (xml, main_wnd->window, style,"button5" , (gchar **) xpm_split_view); full_btn =glade_xml_get_widget (xml,"button6" ); +g_signal_connect (full_btn,"clicked" , +G_CALLBACK (on_full_clicked),NULL );replace_button_icon (xml, main_wnd->window, style,"button6" , (gchar **) xpm_tree_view); + widget =glade_xml_get_widget (xml,"button7" ); +g_signal_connect (widget,"clicked" , +G_CALLBACK (on_collapse_clicked),NULL ); + + widget =glade_xml_get_widget (xml,"button8" ); +g_signal_connect (widget,"clicked" , +G_CALLBACK (on_expand_clicked),NULL ); + txtbuf =gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_w)); tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", "foreground", "red",
scripts/kconfig/gconf.glade +0 -30
@@ -17,9 +17,6 @@ <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <signal name="destroy" handler="on_window1_destroy" object="window1"/> - <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> - <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> <child> <widget class="GtkVBox" id="vbox1">
@@ -46,7 +43,6 @@ <property name="tooltip" translatable="yes">Load a config file</property> <property name="label" translatable="yes">_Load</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_load1_activate"/> <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>
@@ -57,7 +53,6 @@ <property name="tooltip" translatable="yes">Save the config in .config</property> <property name="label" translatable="yes">_Save</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_save_activate"/> <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>
@@ -68,7 +63,6 @@ <property name="tooltip" translatable="yes">Save the config in a file</property> <property name="label" translatable="yes">Save _as</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_save_as1_activate"/> </widget> </child>
@@ -83,7 +77,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_Quit</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_quit1_activate"/> <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>
@@ -108,7 +101,6 @@ <property name="label" translatable="yes">Show _name</property> <property name="use_underline">True</property> <property name="active">False</property> - <signal name="activate" handler="on_show_name1_activate"/> </widget> </child>
@@ -119,7 +111,6 @@ <property name="label" translatable="yes">Show _range</property> <property name="use_underline">True</property> <property name="active">False</property> - <signal name="activate" handler="on_show_range1_activate"/> </widget> </child>
@@ -130,7 +121,6 @@ <property name="label" translatable="yes">Show _data</property> <property name="use_underline">True</property> <property name="active">False</property> - <signal name="activate" handler="on_show_data1_activate"/> </widget> </child>
@@ -147,7 +137,6 @@ <property name="label" translatable="yes">Show normal options</property> <property name="use_underline">True</property> <property name="active">True</property> - <signal name="activate" handler="on_set_option_mode1_activate"/> </widget> </child>
@@ -159,7 +148,6 @@ <property name="use_underline">True</property> <property name="active">False</property> <property name="group">set_option_mode1</property> - <signal name="activate" handler="on_set_option_mode2_activate"/> </widget> </child>
@@ -171,7 +159,6 @@ <property name="use_underline">True</property> <property name="active">False</property> <property name="group">set_option_mode1</property> - <signal name="activate" handler="on_set_option_mode3_activate"/> </widget> </child>
@@ -194,7 +181,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_Introduction</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_introduction1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>
@@ -204,7 +190,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_About</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_about1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>
@@ -214,7 +199,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_License</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> </widget> </child> </widget>
@@ -254,7 +238,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_back_clicked"/> </widget> <packing> <property name="expand">False</property>
@@ -291,7 +274,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_load_clicked"/> </widget> <packing> <property name="expand">False</property>
@@ -309,7 +291,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_save_activate"/> </widget> <packing> <property name="expand">False</property>
@@ -346,7 +327,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> </widget> <packing> <property name="expand">False</property>
@@ -364,7 +344,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> </widget> <packing> <property name="expand">False</property>
@@ -382,7 +361,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> </widget> <packing> <property name="expand">False</property>
@@ -419,7 +397,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_collapse_clicked"/> </widget> <packing> <property name="expand">False</property>
@@ -437,7 +414,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_expand_clicked"/> </widget> <packing> <property name="expand">False</property>
@@ -477,9 +453,6 @@ <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">False</property> - <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> - <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> - <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> </widget> </child> </widget>
@@ -512,9 +485,6 @@ <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">False</property> - <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> - <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> - <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> </widget> </child> </widget>
Signature · 1 line
2.43.0
Re: [PATCH 29/66] kconfig: gconf: add static qualifiers to event handlers
Quoted 3 lines · Masahiro Yamada
This fixes several -Wmissing-prototypes warnings.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 600 lines
---
scripts/kconfig/gconf.c | 173 +++++++++++++++++++++++++----------- scripts/kconfig/gconf.glade | 30 ------- 2 files changed, 120 insertions(+), 83 deletions(-)scripts/kconfig/gconf.c +120
-53@@ -172,7 +172,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)display_tree_part (); } -void on_load1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_load1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *fs;@@ -191,8 +191,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show (fs); } - -void on_save_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_save_activate (GtkMenuItem *menuitem,gpointer user_data) {if (conf_write (NULL ))text_insert_msg ("Error" ,"Unable to save configuration !" );@@ -214,7 +213,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)gtk_widget_destroy (GTK_WIDGET (user_data)); } -void on_save_as1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_save_as1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *fs;@@ -233,7 +232,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show (fs); } -void on_show_name1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_show_name1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkTreeViewColumn *col;@@ -243,8 +242,7 @@ void on_show_name1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_tree_view_column_set_visible (col, show_name); } - -void on_show_range1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_show_range1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkTreeViewColumn *col;@@ -261,8 +259,7 @@ void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data) } - -void on_show_data1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_show_data1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkTreeViewColumn *col;@@ -272,35 +269,31 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_tree_view_column_set_visible (col, show_value); } - -void -on_set_option_mode1_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_set_option_mode1_activate (GtkMenuItem *menuitem, +gpointer user_data) { opt_mode =OPT_NORMAL ;gtk_tree_store_clear (tree2);display_tree (&rootmenu);/* instead of update_tree to speed-up */ } - -void -on_set_option_mode2_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_set_option_mode2_activate (GtkMenuItem *menuitem, +gpointer user_data) { opt_mode =OPT_ALL ;gtk_tree_store_clear (tree2);display_tree (&rootmenu);/* instead of update_tree to speed-up */ } - -void -on_set_option_mode3_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_set_option_mode3_activate (GtkMenuItem *menuitem, +gpointer user_data) { opt_mode =OPT_PROMPT ;gtk_tree_store_clear (tree2);display_tree (&rootmenu);/* instead of update_tree to speed-up */ } - -void on_introduction1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_introduction1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *dialog; const gchar *intro_text =@@ -327,8 +320,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show_all (dialog); } - -void on_about1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_about1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *dialog; const gchar *about_text =@@ -345,8 +337,7 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show_all (dialog); } - -void on_license1_activate (GtkMenuItem * menuitem,gpointer user_data) +static void on_license1_activate (GtkMenuItem *menuitem,gpointer user_data) {GtkWidget *dialog; const gchar *license_text =@@ -364,8 +355,8 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)gtk_widget_show_all (dialog); } - -void on_back_clicked (GtkButton * button,gpointer user_data) +/* toolbar handlers */ +static void on_back_clicked (GtkButton *button,gpointer user_data) {enum prop_type ptype;@@ -379,50 +370,44 @@ void on_back_clicked(GtkButton * button, gpointer user_data)gtk_widget_set_sensitive (back_btn, FALSE); } - -void on_load_clicked (GtkButton * button,gpointer user_data) +static void on_load_clicked (GtkButton *button,gpointer user_data) {on_load1_activate (NULL , user_data); } - -void on_single_clicked (GtkButton * button,gpointer user_data) +static void on_single_clicked (GtkButton *button,gpointer user_data) {set_view_mode (SINGLE_VIEW ); } - -void on_split_clicked (GtkButton * button,gpointer user_data) +static void on_split_clicked (GtkButton *button,gpointer user_data) {set_view_mode (SPLIT_VIEW ); } - -void on_full_clicked (GtkButton * button,gpointer user_data) +static void on_full_clicked (GtkButton *button,gpointer user_data) {set_view_mode (FULL_VIEW ); } - -void on_collapse_clicked (GtkButton * button,gpointer user_data) +static void on_collapse_clicked (GtkButton *button,gpointer user_data) {gtk_tree_view_collapse_all (GTK_TREE_VIEW (tree2_w)); } - -void on_expand_clicked (GtkButton * button,gpointer user_data) +static void on_expand_clicked (GtkButton *button,gpointer user_data) {gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); }/* Main Windows Callbacks */ -void on_window1_destroy (GtkObject *object,gpointer user_data) +static void on_window1_destroy (GtkObject *object,gpointer user_data) {gtk_main_quit (); } -void on_window1_size_request (GtkWidget *widget, +static void on_window1_size_request (GtkWidget *widget,GtkRequisition *requisition,gpointer user_data) {@@ -441,7 +426,7 @@ void on_window1_size_request(GtkWidget *widget,gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); } -gboolean on_window1_delete_event (GtkWidget *widget,GdkEvent *event, +static gboolean on_window1_delete_event (GtkWidget *widget,GdkEvent *event,gpointer user_data) {GtkWidget *dialog, *label;@@ -488,7 +473,7 @@ gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event,return ret; } -void on_quit1_activate (GtkMenuItem *menuitem,gpointer user_data) +static void on_quit1_activate (GtkMenuItem *menuitem,gpointer user_data) {if (!on_window1_delete_event (NULL ,NULL ,NULL ))gtk_widget_destroy (GTK_WIDGET (main_wnd));@@ -598,9 +583,9 @@ static gint column2index(GtkTreeViewColumn * column)/* User click: update choice (full) or goes down (single) */ -gboolean -on_treeview2_button_press_event (GtkWidget * widget, -GdkEventButton * event,gpointer user_data) +static gboolean on_treeview2_button_press_event (GtkWidget *widget, +GdkEventButton *event, +gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path;@@ -648,9 +633,9 @@ on_treeview2_button_press_event(GtkWidget * widget, }/* Key pressed: update choice */ -gboolean -on_treeview2_key_press_event (GtkWidget * widget, -GdkEventKey * event,gpointer user_data) +static gboolean on_treeview2_key_press_event (GtkWidget *widget, +GdkEventKey *event, +gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path;@@ -690,8 +675,8 @@ on_treeview2_key_press_event(GtkWidget * widget,/* Row selection changed: update help */ -void -on_treeview2_cursor_changed (GtkTreeView * treeview,gpointer user_data) +static void on_treeview2_cursor_changed (GtkTreeView *treeview, +gpointer user_data) {GtkTreeSelection *selection;GtkTreeIter iter;@@ -706,9 +691,9 @@ on_treeview2_cursor_changed(GtkTreeView * treeview, gpointer user_data)/* User click: display sub-tree in the right frame. */ -gboolean -on_treeview1_button_press_event (GtkWidget * widget, -GdkEventButton * event,gpointer user_data) +static gboolean on_treeview1_button_press_event (GtkWidget *widget, +GdkEventButton *event, +gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget);GtkTreePath *path;@@ -1138,47 +1123,129 @@ static void init_main_window(const gchar *glade_file)glade_xml_signal_autoconnect (xml); main_wnd =glade_xml_get_widget (xml,"window1" ); +g_signal_connect (main_wnd,"destroy" , +G_CALLBACK (on_window1_destroy),NULL ); +g_signal_connect (main_wnd,"size_request" , +G_CALLBACK (on_window1_size_request),NULL ); +g_signal_connect (main_wnd,"delete_event" , +G_CALLBACK (on_window1_delete_event),NULL ); + hpaned =glade_xml_get_widget (xml,"hpaned1" ); vpaned =glade_xml_get_widget (xml,"vpaned1" ); tree1_w =glade_xml_get_widget (xml,"treeview1" ); +g_signal_connect (tree1_w,"cursor_changed" , +G_CALLBACK (on_treeview2_cursor_changed),NULL ); +g_signal_connect (tree1_w,"button_press_event" , +G_CALLBACK (on_treeview1_button_press_event),NULL ); +g_signal_connect (tree1_w,"key_press_event" , +G_CALLBACK (on_treeview2_key_press_event),NULL ); + tree2_w =glade_xml_get_widget (xml,"treeview2" ); +g_signal_connect (tree2_w,"cursor_changed" , +G_CALLBACK (on_treeview2_cursor_changed),NULL ); +g_signal_connect (tree2_w,"button_press_event" , +G_CALLBACK (on_treeview2_button_press_event),NULL ); +g_signal_connect (tree2_w,"key_press_event" , +G_CALLBACK (on_treeview2_key_press_event),NULL ); + text_w =glade_xml_get_widget (xml,"textview3" );/* menubar */ + widget =glade_xml_get_widget (xml,"load1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_load1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"save1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_save_activate),NULL ); + + widget =glade_xml_get_widget (xml,"save_as1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_save_as1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"quit1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_quit1_activate),NULL ); + widget =glade_xml_get_widget (xml,"show_name1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_show_name1_activate),NULL );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_name); widget =glade_xml_get_widget (xml,"show_range1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_show_range1_activate),NULL );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_range); widget =glade_xml_get_widget (xml,"show_data1" ); +g_signal_connect (widget,"activate" ,G_CALLBACK (on_show_data1_activate),NULL );gtk_check_menu_item_set_active ((GtkCheckMenuItem *) widget, show_value); + widget =glade_xml_get_widget (xml,"set_option_mode1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_set_option_mode1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"set_option_mode2" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_set_option_mode2_activate),NULL ); + + widget =glade_xml_get_widget (xml,"set_option_mode3" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_set_option_mode3_activate),NULL ); + + widget =glade_xml_get_widget (xml,"introduction1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_introduction1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"about1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_about1_activate),NULL ); + + widget =glade_xml_get_widget (xml,"license1" ); +g_signal_connect (widget,"activate" , +G_CALLBACK (on_license1_activate),NULL ); +/* toolbar */ back_btn =glade_xml_get_widget (xml,"button1" ); +g_signal_connect (back_btn,"clicked" , +G_CALLBACK (on_back_clicked),NULL );gtk_widget_set_sensitive (back_btn, FALSE); + widget =glade_xml_get_widget (xml,"button2" ); +g_signal_connect (widget,"clicked" , +G_CALLBACK (on_load_clicked),NULL ); + save_btn =glade_xml_get_widget (xml,"button3" ); +g_signal_connect (save_btn,"clicked" , +G_CALLBACK (on_save_activate),NULL ); save_menu_item =glade_xml_get_widget (xml,"save1" );conf_set_changed_callback (conf_changed); style =gtk_widget_get_style (main_wnd); single_btn =glade_xml_get_widget (xml,"button4" ); +g_signal_connect (single_btn,"clicked" , +G_CALLBACK (on_single_clicked),NULL );replace_button_icon (xml, main_wnd->window, style,"button4" , (gchar **) xpm_single_view); split_btn =glade_xml_get_widget (xml,"button5" ); +g_signal_connect (split_btn,"clicked" , +G_CALLBACK (on_split_clicked),NULL );replace_button_icon (xml, main_wnd->window, style,"button5" , (gchar **) xpm_split_view); full_btn =glade_xml_get_widget (xml,"button6" ); +g_signal_connect (full_btn,"clicked" , +G_CALLBACK (on_full_clicked),NULL );replace_button_icon (xml, main_wnd->window, style,"button6" , (gchar **) xpm_tree_view); + widget =glade_xml_get_widget (xml,"button7" ); +g_signal_connect (widget,"clicked" , +G_CALLBACK (on_collapse_clicked),NULL ); + + widget =glade_xml_get_widget (xml,"button8" ); +g_signal_connect (widget,"clicked" , +G_CALLBACK (on_expand_clicked),NULL ); + txtbuf =gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_w)); tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", "foreground", "red",scripts/kconfig/gconf.glade +0
-30@@ -17,9 +17,6 @@ <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <signal name="destroy" handler="on_window1_destroy" object="window1"/> - <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> - <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> <child> <widget class="GtkVBox" id="vbox1">@@ -46,7 +43,6 @@ <property name="tooltip" translatable="yes">Load a config file</property> <property name="label" translatable="yes">_Load</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_load1_activate"/> <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>@@ -57,7 +53,6 @@ <property name="tooltip" translatable="yes">Save the config in .config</property> <property name="label" translatable="yes">_Save</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_save_activate"/> <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>@@ -68,7 +63,6 @@ <property name="tooltip" translatable="yes">Save the config in a file</property> <property name="label" translatable="yes">Save _as</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_save_as1_activate"/> </widget> </child>@@ -83,7 +77,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_Quit</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_quit1_activate"/> <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>@@ -108,7 +101,6 @@ <property name="label" translatable="yes">Show _name</property> <property name="use_underline">True</property> <property name="active">False</property> - <signal name="activate" handler="on_show_name1_activate"/> </widget> </child>@@ -119,7 +111,6 @@ <property name="label" translatable="yes">Show _range</property> <property name="use_underline">True</property> <property name="active">False</property> - <signal name="activate" handler="on_show_range1_activate"/> </widget> </child>@@ -130,7 +121,6 @@ <property name="label" translatable="yes">Show _data</property> <property name="use_underline">True</property> <property name="active">False</property> - <signal name="activate" handler="on_show_data1_activate"/> </widget> </child>@@ -147,7 +137,6 @@ <property name="label" translatable="yes">Show normal options</property> <property name="use_underline">True</property> <property name="active">True</property> - <signal name="activate" handler="on_set_option_mode1_activate"/> </widget> </child>@@ -159,7 +148,6 @@ <property name="use_underline">True</property> <property name="active">False</property> <property name="group">set_option_mode1</property> - <signal name="activate" handler="on_set_option_mode2_activate"/> </widget> </child>@@ -171,7 +159,6 @@ <property name="use_underline">True</property> <property name="active">False</property> <property name="group">set_option_mode1</property> - <signal name="activate" handler="on_set_option_mode3_activate"/> </widget> </child>@@ -194,7 +181,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_Introduction</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_introduction1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>@@ -204,7 +190,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_About</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_about1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> </widget> </child>@@ -214,7 +199,6 @@ <property name="visible">True</property> <property name="label" translatable="yes">_License</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> </widget> </child> </widget>@@ -254,7 +238,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_back_clicked"/> </widget> <packing> <property name="expand">False</property>@@ -291,7 +274,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_load_clicked"/> </widget> <packing> <property name="expand">False</property>@@ -309,7 +291,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_save_activate"/> </widget> <packing> <property name="expand">False</property>@@ -346,7 +327,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> </widget> <packing> <property name="expand">False</property>@@ -364,7 +344,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> </widget> <packing> <property name="expand">False</property>@@ -382,7 +361,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> </widget> <packing> <property name="expand">False</property>@@ -419,7 +397,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_collapse_clicked"/> </widget> <packing> <property name="expand">False</property>@@ -437,7 +414,6 @@ <property name="visible_horizontal">True</property> <property name="visible_vertical">True</property> <property name="is_important">False</property> - <signal name="clicked" handler="on_expand_clicked"/> </widget> <packing> <property name="expand">False</property>@@ -477,9 +453,6 @@ <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">False</property> - <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> - <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> - <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> </widget> </child> </widget>@@ -512,9 +485,6 @@ <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">False</property> - <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> - <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> - <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> </widget> </child> </widget>
Signature · 1 line
~Randy
PATCH 30/66 kconfig: gconf: remove glade_xml_signal_autoconnect() call
In reply to Masahiro YamadaNow that all signals are connected manually, this is no longer unnecessary.
---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/gconf.c +0 -1
@@ -1120,7 +1120,6 @@ static void init_main_window(const gchar *glade_file) xml =glade_xml_new (glade_file,"window1" ,NULL );if (!xml)g_error ("GUI loading failed !\n" ); -glade_xml_signal_autoconnect (xml); main_wnd =glade_xml_get_widget (xml,"window1" ); g_signal_connect(main_wnd, "destroy",
Signature · 1 line
2.43.0
Re: [PATCH 30/66] kconfig: gconf: remove glade_xml_signal_autoconnect() call
Quoted 2 lines · Masahiro Yamada
Now that all signals are connected manually, this is no longer unnecessary.
Double negative. Or is that what you meant?
is no longer necessary.
is now unnecessary.
Quoted 19 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)scripts/kconfig/gconf.c +0
-1@@ -1120,7 +1120,6 @@ static void init_main_window(const gchar *glade_file) xml =glade_xml_new (glade_file,"window1" ,NULL );if (!xml)g_error ("GUI loading failed !\n" ); -glade_xml_signal_autoconnect (xml); main_wnd =glade_xml_get_widget (xml,"window1" ); g_signal_connect(main_wnd, "destroy",
Signature · 1 line
~Randy
Re: [PATCH 30/66] kconfig: gconf: remove glade_xml_signal_autoconnect() call
Quoted 11 lines · Randy Dunlap
Quoted 2 lines · Masahiro Yamada
Now that all signals are connected manually, this is no longer unnecessary.
Double negative. Or is that what you meant?
is no longer necessary.
is now unnecessary.
is no longer necessary.
I will fix it. Thanks.
Quoted 24 lines
Quoted 12 lines
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/gconf.c | 1 - 1 file changed, 1 deletion(-)scripts/kconfig/gconf.c +0
-0scripts/kconfig/gconf.c static void init_main_window(const gchar *glade_file) · line 1125
Quoted 7 lines
scripts/kconfig/gconf.c +0
-1@@ -1120,7 +1120,6 @@ static void init_main_window(const gchar *glade_file) xml =glade_xml_new (glade_file,"window1" ,NULL );if (!xml)g_error ("GUI loading failed !\n" ); -glade_xml_signal_autoconnect (xml); main_wnd =glade_xml_get_widget (xml,"window1" ); g_signal_connect(main_wnd, "destroy",--
~Randy
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 31/66 kconfig: gconf: make key_press_event work in left pane too
In reply to Masahiro YamadaCurrently, on_treeview2_key_press_event() returns early for the tree1 widget. We can make it work on the left pane as well by avoiding the hardcoded use of model2.
---
scripts/kconfig/gconf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
scripts/kconfig/gconf.c +3 -4
@@ -638,6 +638,7 @@ static gboolean on_treeview2_key_press_event(GtkWidget *widget, gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget); +GtkTreeModel *model =gtk_tree_view_get_model (view);GtkTreePath *path;GtkTreeIter iter;struct menu *menu;
@@ -654,11 +655,9 @@ static gboolean on_treeview2_key_press_event(GtkWidget *widget,gtk_tree_view_expand_row (view, path, FALSE);return TRUE; } -if (widget == tree1_w) -return FALSE; -gtk_tree_model_get_iter (model2, &iter, path); -gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); +gtk_tree_model_get_iter (model, &iter, path); +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 );if (!strcasecmp (event->string,"n" )) col =COL_NO ;
Signature · 1 line
2.43.0
PATCH 32/66 kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
In reply to Masahiro YamadaThe on_treeview2_cursor_changed() handler is connected to both the left and right tree views, but it hardcodes model2 (the GtkTreeModel of the right tree view). This is incorrect. Get the associated model from the view.
---
scripts/kconfig/gconf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/gconf.c +3 -2
@@ -677,13 +677,14 @@ static gboolean on_treeview2_key_press_event(GtkWidget *widget,static void on_treeview2_cursor_changed (GtkTreeView *treeview,gpointer user_data) { +GtkTreeModel *model =gtk_tree_view_get_model (treeview);GtkTreeSelection *selection;GtkTreeIter iter;struct menu *menu; selection =gtk_tree_view_get_selection (treeview); -if (gtk_tree_selection_get_selected (selection, &model2, &iter)) { -gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); +if (gtk_tree_selection_get_selected (selection, &model, &iter)) { +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 );text_insert_help (menu); } }
Signature · 1 line
2.43.0
PATCH 33/66 kconfig: gconf: avoid hardcoding model2 in renderer_edited()
In reply to Masahiro YamadaAlthough this is only used in the right tree view, it is better not to hardcode model2 for consistency.
---
scripts/kconfig/gconf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
scripts/kconfig/gconf.c +6 -4
@@ -486,19 +486,21 @@ static void renderer_edited(GtkCellRendererText * cell,const gchar * path_string, const gchar * new_text, gpointer user_data) { + GtkTreeView *view = GTK_TREE_VIEW(user_data); +GtkTreeModel *model =gtk_tree_view_get_model (view);GtkTreePath *path =gtk_tree_path_new_from_string (path_string);GtkTreeIter iter;const char *old_def, *new_def;struct menu *menu;struct symbol *sym; -if (!gtk_tree_model_get_iter (model2, &iter, path)) +if (!gtk_tree_model_get_iter (model, &iter, path)) goto free; -gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 ); sym = menu->sym; -gtk_tree_model_get (model2, &iter,COL_VALUE , &old_def,-1 ); +gtk_tree_model_get (model, &iter,COL_VALUE , &old_def,-1 ); new_def = new_text;sym_set_string_value (sym, new_def);
@@ -1391,7 +1393,7 @@ static void init_right_tree(void)"foreground-gdk" , COL_COLOR, NULL);g_signal_connect (G_OBJECT (renderer),"edited" , -G_CALLBACK (renderer_edited),NULL ); +G_CALLBACK (renderer_edited), tree2_w);for (i =0 ; i <COL_VALUE ; i++) { column =gtk_tree_view_get_column (view, i);
Signature · 1 line
2.43.0
PATCH 34/66 kconfig: gconf: avoid hardcoding model* in on_treeview*_button_press_event()
In reply to Masahiro YamadaIt is better not to hardcode model1 or model2 for consistency.
---
scripts/kconfig/gconf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
scripts/kconfig/gconf.c +6 -4
@@ -590,6 +590,7 @@ static gboolean on_treeview2_button_press_event(GtkWidget *widget, gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget); +GtkTreeModel *model =gtk_tree_view_get_model (view);GtkTreePath *path;GtkTreeViewColumn *column;GtkTreeIter iter;
@@ -602,9 +603,9 @@ static gboolean on_treeview2_button_press_event(GtkWidget *widget,if (path ==NULL )return FALSE; -if (!gtk_tree_model_get_iter (model2, &iter, path)) +if (!gtk_tree_model_get_iter (model, &iter, path))return FALSE; -gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 ); col =column2index (column);if (event->type ==GDK_2BUTTON_PRESS ) {
@@ -698,6 +699,7 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget, gpointer user_data) {GtkTreeView *view =GTK_TREE_VIEW (widget); +GtkTreeModel *model =gtk_tree_view_get_model (view);GtkTreePath *path;GtkTreeIter iter;struct menu *menu;
@@ -708,8 +710,8 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,if (path ==NULL )return FALSE; -gtk_tree_model_get_iter (model1, &iter, path); -gtk_tree_model_get (model1, &iter,COL_MENU , &menu,-1 ); +gtk_tree_model_get_iter (model, &iter, path); +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 );if (event->type ==GDK_2BUTTON_PRESS ) {toggle_sym_value (menu);
Signature · 1 line
2.43.0
PATCH 35/66 kconfig: gconf: add on_save_clicked() event handler
In reply to Masahiro YamadaThe "clicked" event handler for GtkToolButton takes the GtkToolButton* as the first parameter.
This is different from the existing on_save_activate() handler.
---
scripts/kconfig/gconf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/kconfig/gconf.c +6 -1
@@ -375,6 +375,11 @@ static void on_load_clicked(GtkButton *button, gpointer user_data)on_load1_activate (NULL , user_data); } +static void on_save_clicked (GtkButton *button,gpointer user_data) +{ +on_save_activate (NULL , user_data); +} +static void on_single_clicked (GtkButton *button,gpointer user_data) {set_view_mode (SINGLE_VIEW );
@@ -1217,7 +1222,7 @@ static void init_main_window(const gchar *glade_file) save_btn =glade_xml_get_widget (xml,"button3" );g_signal_connect (save_btn,"clicked" , -G_CALLBACK (on_save_activate),NULL ); +G_CALLBACK (on_save_clicked),NULL ); save_menu_item =glade_xml_get_widget (xml,"save1" );conf_set_changed_callback (conf_changed);
Signature · 1 line
2.43.0
PATCH 36/66 kconfig: gconf: use GtkFileChooser in on_load1_activate()
In reply to Masahiro Yamadagtk_file_selection_new() is deprecated, and gtk_file_chooser_dialog_new() should be used instead. [1]
---
scripts/kconfig/gconf.c | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
scripts/kconfig/gconf.c +29 -29
@@ -157,38 +157,38 @@ static void text_insert_msg(const char *title, const char *message)/* Menu & Toolbar Callbacks */ - -static void -load_filename (GtkFileSelection * file_selector,gpointer user_data) -{ -const gchar *fn; - - fn =gtk_file_selection_get_filename (GTK_FILE_SELECTION - (user_data)); - -if (conf_read (fn)) -text_insert_msg ("Error" ,"Unable to load configuration !" ); -else -display_tree_part (); -} -static void on_load1_activate (GtkMenuItem *menuitem,gpointer user_data) { -GtkWidget *fs; +GtkWidget *dialog; +GtkFileChooser *chooser; +gint res; - fs =gtk_file_selection_new ("Load file..." ); -g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" , -G_CALLBACK (load_filename), (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->cancel_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -gtk_widget_show (fs); + dialog =gtk_file_chooser_dialog_new ("Load file..." , +GTK_WINDOW (user_data), +GTK_FILE_CHOOSER_ACTION_OPEN , +"_Cancel" ,GTK_RESPONSE_CANCEL , +"_Open" ,GTK_RESPONSE_ACCEPT , +NULL ); + + chooser =GTK_FILE_CHOOSER (dialog); +gtk_file_chooser_set_filename (chooser,conf_get_configname ()); + + res =gtk_dialog_run (GTK_DIALOG (dialog)); +if (res ==GTK_RESPONSE_ACCEPT ) { +char *filename; + + filename =gtk_file_chooser_get_filename (chooser); + +if (conf_read (filename)) +text_insert_msg ("Error" , +"Unable to load configuration!" ); +else +display_tree_part (); + +g_free (filename); + } + +gtk_widget_destroy (GTK_WIDGET (dialog)); }static void on_save_activate (GtkMenuItem *menuitem,gpointer user_data)
Signature · 1 line
2.43.0
Re: [PATCH 36/66] kconfig: gconf: use GtkFileChooser in on_load1_activate()
Quoted 6 lines · Masahiro Yamada
gtk_file_selection_new()is deprecated, andgtk_file_chooser_dialog_new()should be used instead. [1]Signed-off-by Masahiro Yamada <[email protected]>
Old gconfig (pre-patches) did not even clear the error message on a good Load. I still see (on OLD)
Unable to load configuration !
after a successful Load (determined by Save and diff).
This is no longer a problem.
Quoted 77 lines
---
scripts/kconfig/gconf.c | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-)scripts/kconfig/gconf.c +29
-29@@ -157,38 +157,38 @@ static void text_insert_msg(const char *title, const char *message)/* Menu & Toolbar Callbacks */ - -static void -load_filename (GtkFileSelection * file_selector,gpointer user_data) -{ -const gchar *fn; - - fn =gtk_file_selection_get_filename (GTK_FILE_SELECTION - (user_data)); - -if (conf_read (fn)) -text_insert_msg ("Error" ,"Unable to load configuration !" ); -else -display_tree_part (); -} -static void on_load1_activate (GtkMenuItem *menuitem,gpointer user_data) { -GtkWidget *fs; +GtkWidget *dialog; +GtkFileChooser *chooser; +gint res; - fs =gtk_file_selection_new ("Load file..." ); -g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" , -G_CALLBACK (load_filename), (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->cancel_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -gtk_widget_show (fs); + dialog =gtk_file_chooser_dialog_new ("Load file..." , +GTK_WINDOW (user_data), +GTK_FILE_CHOOSER_ACTION_OPEN , +"_Cancel" ,GTK_RESPONSE_CANCEL , +"_Open" ,GTK_RESPONSE_ACCEPT , +NULL ); + + chooser =GTK_FILE_CHOOSER (dialog); +gtk_file_chooser_set_filename (chooser,conf_get_configname ()); + + res =gtk_dialog_run (GTK_DIALOG (dialog)); +if (res ==GTK_RESPONSE_ACCEPT ) { +char *filename; + + filename =gtk_file_chooser_get_filename (chooser); + +if (conf_read (filename)) +text_insert_msg ("Error" , +"Unable to load configuration!" ); +else +display_tree_part (); + +g_free (filename); + } + +gtk_widget_destroy (GTK_WIDGET (dialog)); }static void on_save_activate (GtkMenuItem *menuitem,gpointer user_data)
Signature · 1 line
~Randy
PATCH 37/66 kconfig: gconf: use GtkFileChooser in on_save_as1_activate()
In reply to Masahiro Yamadagtk_file_selection_new() is deprecated, and gtk_file_chooser_dialog_new() should be used instead. [1]
---
scripts/kconfig/gconf.c | 56 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 29 deletions(-)
scripts/kconfig/gconf.c +27 -29
@@ -198,38 +198,36 @@ static void on_save_activate(GtkMenuItem *menuitem, gpointer user_data)conf_write_autoconf (0 ); } - -static void -store_filename (GtkFileSelection * file_selector,gpointer user_data) -{ -const gchar *fn; - - fn =gtk_file_selection_get_filename (GTK_FILE_SELECTION - (user_data)); - -if (conf_write (fn)) -text_insert_msg ("Error" ,"Unable to save configuration !" ); - -gtk_widget_destroy (GTK_WIDGET (user_data)); -} -static void on_save_as1_activate (GtkMenuItem *menuitem,gpointer user_data) { -GtkWidget *fs; +GtkWidget *dialog; +GtkFileChooser *chooser; +gint res; - fs =gtk_file_selection_new ("Save file as..." ); -g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" , -G_CALLBACK (store_filename), (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->cancel_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -gtk_widget_show (fs); + dialog =gtk_file_chooser_dialog_new ("Save file as..." , +GTK_WINDOW (user_data), +GTK_FILE_CHOOSER_ACTION_SAVE , +"_Cancel" ,GTK_RESPONSE_CANCEL , +"_Save" ,GTK_RESPONSE_ACCEPT , +NULL ); + + chooser =GTK_FILE_CHOOSER (dialog); +gtk_file_chooser_set_filename (chooser,conf_get_configname ()); + + res =gtk_dialog_run (GTK_DIALOG (dialog)); +if (res ==GTK_RESPONSE_ACCEPT ) { +char *filename; + + filename =gtk_file_chooser_get_filename (chooser); + +if (conf_write (filename)) +text_insert_msg ("Error" , +"Unable to save configuration !" ); + +g_free (filename); + } + +gtk_widget_destroy (dialog); }static void on_show_name1_activate (GtkMenuItem *menuitem,gpointer user_data)
Signature · 1 line
2.43.0
Re: [PATCH 37/66] kconfig: gconf: use GtkFileChooser in on_save_as1_activate()
Quoted 6 lines · Masahiro Yamada
gtk_file_selection_new()is deprecated, andgtk_file_chooser_dialog_new()should be used instead. [1]Signed-off-by Masahiro Yamada <[email protected]>
Quoted 75 lines
---
scripts/kconfig/gconf.c | 56 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 29 deletions(-)scripts/kconfig/gconf.c +27
-29@@ -198,38 +198,36 @@ static void on_save_activate(GtkMenuItem *menuitem, gpointer user_data)conf_write_autoconf (0 ); } - -static void -store_filename (GtkFileSelection * file_selector,gpointer user_data) -{ -const gchar *fn; - - fn =gtk_file_selection_get_filename (GTK_FILE_SELECTION - (user_data)); - -if (conf_write (fn)) -text_insert_msg ("Error" ,"Unable to save configuration !" ); - -gtk_widget_destroy (GTK_WIDGET (user_data)); -} -static void on_save_as1_activate (GtkMenuItem *menuitem,gpointer user_data) { -GtkWidget *fs; +GtkWidget *dialog; +GtkFileChooser *chooser; +gint res; - fs =gtk_file_selection_new ("Save file as..." ); -g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" , -G_CALLBACK (store_filename), (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->ok_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -g_signal_connect_swapped (GTK_OBJECT - (GTK_FILE_SELECTION (fs)->cancel_button), -"clicked" ,G_CALLBACK (gtk_widget_destroy), - (gpointer ) fs); -gtk_widget_show (fs); + dialog =gtk_file_chooser_dialog_new ("Save file as..." , +GTK_WINDOW (user_data), +GTK_FILE_CHOOSER_ACTION_SAVE , +"_Cancel" ,GTK_RESPONSE_CANCEL , +"_Save" ,GTK_RESPONSE_ACCEPT , +NULL ); + + chooser =GTK_FILE_CHOOSER (dialog); +gtk_file_chooser_set_filename (chooser,conf_get_configname ()); + + res =gtk_dialog_run (GTK_DIALOG (dialog)); +if (res ==GTK_RESPONSE_ACCEPT ) { +char *filename; + + filename =gtk_file_chooser_get_filename (chooser); + +if (conf_write (filename)) +text_insert_msg ("Error" , +"Unable to save configuration !" ); + +g_free (filename); + } + +gtk_widget_destroy (dialog); }static void on_show_name1_activate (GtkMenuItem *menuitem,gpointer user_data)
Signature · 1 line
~Randy
PATCH 38/66 kconfig: gconf: use GdkPixbuf in replace_button_icon()
In reply to Masahiro Yamadagdk_pixmap_create_from_xpm_d has been deprecated since version 2.22. Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_xpm_data() to create it. [1]
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gdk/gdkpixmap.c#L742
---
scripts/kconfig/gconf.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
scripts/kconfig/gconf.c +6 -7
@@ -1102,17 +1102,16 @@ static void fixup_rootmenu(struct menu *menu)static void replace_button_icon (GladeXML *xml,GdkDrawable *window,GtkStyle *style,gchar *btn_name,gchar **xpm) { -GdkPixmap *pixmap; -GdkBitmap *mask; -GtkToolButton *button; +GdkPixbuf *pixbuf;GtkWidget *image; +GtkToolButton *button; - pixmap =gdk_pixmap_create_from_xpm_d (window, &mask, - &style->bg[GTK_STATE_NORMAL ], - xpm); + pixbuf =gdk_pixbuf_new_from_xpm_data ((const char **)xpm); + image =gtk_image_new_from_pixbuf (pixbuf); +g_object_unref (pixbuf); button =GTK_TOOL_BUTTON (glade_xml_get_widget (xml, btn_name)); - image =gtk_image_new_from_pixmap (pixmap, mask); +gtk_widget_show (image);gtk_tool_button_set_icon_widget (button, image); }
Signature · 1 line
2.43.0
PATCH 39/66 kconfig: gconf: refactor replace_button_icon()
In reply to Masahiro YamadaThe "window" and "style" arguments for replace_button_icon() are now unused. Remove them and refactor the function accordingly.
---
scripts/kconfig/gconf.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
scripts/kconfig/gconf.c +5 -15
@@ -1099,21 +1099,17 @@ static void fixup_rootmenu(struct menu *menu) }/* Main Window Initialization */ -static void replace_button_icon (GladeXML *xml,GdkDrawable *window, -GtkStyle *style,gchar *btn_name,gchar **xpm) +static void replace_button_icon (GtkWidget *widget,const char *const xpm[]) {GdkPixbuf *pixbuf;GtkWidget *image; -GtkToolButton *button; pixbuf =gdk_pixbuf_new_from_xpm_data ((const char **)xpm); image =gtk_image_new_from_pixbuf (pixbuf);g_object_unref (pixbuf); - button =GTK_TOOL_BUTTON (glade_xml_get_widget (xml, btn_name)); -gtk_widget_show (image); -gtk_tool_button_set_icon_widget (button, image); +gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (widget), image); }static void init_main_window (const gchar *glade_file)
@@ -1121,7 +1117,6 @@ static void init_main_window(const gchar *glade_file)GladeXML *xml;GtkWidget *widget;GtkTextBuffer *txtbuf; -GtkStyle *style; xml =glade_xml_new (glade_file,"window1" ,NULL );if (!xml)
@@ -1223,25 +1218,20 @@ static void init_main_window(const gchar *glade_file) save_menu_item =glade_xml_get_widget (xml,"save1" );conf_set_changed_callback (conf_changed); - style =gtk_widget_get_style (main_wnd); - single_btn =glade_xml_get_widget (xml,"button4" );g_signal_connect (single_btn,"clicked" ,G_CALLBACK (on_single_clicked),NULL ); -replace_button_icon (xml, main_wnd->window, style, -"button4" , (gchar **) xpm_single_view); +replace_button_icon (single_btn, xpm_single_view); split_btn =glade_xml_get_widget (xml,"button5" );g_signal_connect (split_btn,"clicked" ,G_CALLBACK (on_split_clicked),NULL ); -replace_button_icon (xml, main_wnd->window, style, -"button5" , (gchar **) xpm_split_view); +replace_button_icon (split_btn, xpm_split_view); full_btn =glade_xml_get_widget (xml,"button6" );g_signal_connect (full_btn,"clicked" ,G_CALLBACK (on_full_clicked),NULL ); -replace_button_icon (xml, main_wnd->window, style, -"button6" , (gchar **) xpm_tree_view); +replace_button_icon (full_btn, xpm_tree_view); widget =glade_xml_get_widget (xml,"button7" ); g_signal_connect(widget, "clicked",
Signature · 1 line
2.43.0
PATCH 40/66 kconfig: gconf: make introduction, about, license dialogs modal
In reply to Masahiro YamadaThese are modal dialogs in xconfig. Make them modal in gconfig as well.
---
scripts/kconfig/gconf.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
scripts/kconfig/gconf.c +6 -12
@@ -312,10 +312,8 @@ static void on_introduction1_activate(GtkMenuItem *menuitem, gpointer user_data)GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO , GTK_BUTTONS_CLOSE, "%s", intro_text); -g_signal_connect_swapped (GTK_OBJECT (dialog),"response" , -G_CALLBACK (gtk_widget_destroy), -GTK_OBJECT (dialog)); -gtk_widget_show_all (dialog); +gtk_dialog_run (GTK_DIALOG (dialog)); +gtk_widget_destroy (dialog); }static void on_about1_activate (GtkMenuItem *menuitem,gpointer user_data)
@@ -329,10 +327,8 @@ static void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data)GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO , GTK_BUTTONS_CLOSE, "%s", about_text); -g_signal_connect_swapped (GTK_OBJECT (dialog),"response" , -G_CALLBACK (gtk_widget_destroy), -GTK_OBJECT (dialog)); -gtk_widget_show_all (dialog); +gtk_dialog_run (GTK_DIALOG (dialog)); +gtk_widget_destroy (dialog); }static void on_license1_activate (GtkMenuItem *menuitem,gpointer user_data)
@@ -347,10 +343,8 @@ static void on_license1_activate(GtkMenuItem *menuitem, gpointer user_data)GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO , GTK_BUTTONS_CLOSE, "%s", license_text); -g_signal_connect_swapped (GTK_OBJECT (dialog),"response" , -G_CALLBACK (gtk_widget_destroy), -GTK_OBJECT (dialog)); -gtk_widget_show_all (dialog); +gtk_dialog_run (GTK_DIALOG (dialog)); +gtk_widget_destroy (dialog); }/* toolbar handlers */
Signature · 1 line
2.43.0
Re: [PATCH 40/66] kconfig: gconf: make introduction, about, license dialogs modal
Quoted 3 lines · Masahiro Yamada
These are modal dialogs in xconfig. Make them modal in gconfig as well.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 5 lines
---
scripts/kconfig/gconf.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
Signature · 1 line
~Randy
PATCH 41/66 kconfig: gconf: remove global 'tree' variable
In reply to Masahiro YamadaPass the tree store as a function parameter to make it clearer which tree is being updated.
---
scripts/kconfig/gconf.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
scripts/kconfig/gconf.c +21 -21
@@ -43,7 +43,7 @@ static GtkWidget *save_menu_item;static GtkTextTag *tag1, *tag2; -static GtkTreeStore *tree1, *tree2, *tree; +static GtkTreeStore *tree1, *tree2;static GtkTreeModel *model1, *model2;static struct menu *current;// current node for SINGLE view
@@ -57,7 +57,7 @@ enum { };static void display_list (void ); -static void display_tree (struct menu *menu); +static void display_tree (GtkTreeStore *store,struct menu *menu);static void display_tree_part (void );static void update_tree (struct menu *src,GtkTreeIter * dst);
@@ -101,7 +101,7 @@ static void set_view_mode(enum view_mode mode)break ;case FULL_VIEW :gtk_tree_store_clear (tree2); -display_tree (&rootmenu); +display_tree (tree2, &rootmenu);gtk_widget_set_sensitive (full_btn, FALSE);break ; }
@@ -272,7 +272,7 @@ static void on_set_option_mode1_activate(GtkMenuItem *menuitem, { opt_mode =OPT_NORMAL ;gtk_tree_store_clear (tree2); -display_tree (&rootmenu);/* instead of update_tree to speed-up */ +display_tree (tree2, &rootmenu);/* instead of update_tree to speed-up */ } static void on_set_option_mode2_activate(GtkMenuItem *menuitem,
@@ -280,7 +280,7 @@ static void on_set_option_mode2_activate(GtkMenuItem *menuitem, { opt_mode =OPT_ALL ;gtk_tree_store_clear (tree2); -display_tree (&rootmenu);/* instead of update_tree to speed-up */ +display_tree (tree2, &rootmenu);/* instead of update_tree to speed-up */ } static void on_set_option_mode3_activate(GtkMenuItem *menuitem,
@@ -288,7 +288,7 @@ static void on_set_option_mode3_activate(GtkMenuItem *menuitem, { opt_mode =OPT_PROMPT ;gtk_tree_store_clear (tree2); -display_tree (&rootmenu);/* instead of update_tree to speed-up */ +display_tree (tree2, &rootmenu);/* instead of update_tree to speed-up */ }static void on_introduction1_activate (GtkMenuItem *menuitem,gpointer user_data)
@@ -852,7 +852,8 @@ static gchar **fill_row(struct menu *menu)/* Set the node content with a row of strings */ -static void set_node (GtkTreeIter * node,struct menu *menu,gchar ** row) +static void set_node (GtkTreeStore *tree,GtkTreeIter *node, +struct menu *menu,gchar **row) {GdkColor color;gboolean success;
@@ -976,7 +977,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)gtk_tree_store_insert_before (tree2, child2, dst, sibling); -set_node (child2, menu1,fill_row (menu1)); +set_node (tree2, child2, menu1,fill_row (menu1));if (menu2 ==NULL ) valid = TRUE; }else {// remove node
@@ -990,7 +991,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) goto reparse;// next child } }else if (sym && (child1->flags &MENU_CHANGED )) { -set_node (child2, menu1,fill_row (menu1)); +set_node (tree2, child2, menu1,fill_row (menu1)); }update_tree (child1, child2);
@@ -1001,7 +1002,8 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)/* Display the whole tree (single/split/full view) */ -static void _display_tree (struct menu *menu,GtkTreeIter *parent) +static void _display_tree (GtkTreeStore *tree,struct menu *menu, +GtkTreeIter *parent) {struct property *prop;struct menu *child;
@@ -1029,7 +1031,7 @@ static void _display_tree(struct menu *menu, GtkTreeIter *parent) (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || (opt_mode == OPT_ALL && menu_get_prompt(child))) {gtk_tree_store_append (tree, &iter, parent); -set_node (&iter, child,fill_row (child)); +set_node (tree, &iter, child,fill_row (child)); } if ((view_mode != FULL_VIEW) && (ptype == P_MENU)
@@ -1043,13 +1045,13 @@ static void _display_tree(struct menu *menu, GtkTreeIter *parent)if (((view_mode ==SINGLE_VIEW ) && (menu->flags &MENU_ROOT )) || (view_mode ==FULL_VIEW ) || (view_mode ==SPLIT_VIEW )) -_display_tree (child, &iter); +_display_tree (tree, child, &iter); } } -static void display_tree (struct menu *menu) +static void display_tree (GtkTreeStore *store,struct menu *menu) { -_display_tree (menu,NULL ); +_display_tree (store, menu,NULL ); }/* Display a part of the tree starting at current node (single/split view) */
@@ -1057,11 +1059,11 @@ static void display_tree_part(void) {gtk_tree_store_clear (tree2);if (view_mode ==SINGLE_VIEW ) -display_tree (current); +display_tree (tree2, current);else if (view_mode ==SPLIT_VIEW ) -display_tree (browsed); +display_tree (tree2, browsed);else if (view_mode ==FULL_VIEW ) -display_tree (&rootmenu); +display_tree (tree2, &rootmenu);gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); }
@@ -1070,10 +1072,8 @@ static void display_list(void) {gtk_tree_store_clear (tree1); - tree = tree1; -display_tree (&rootmenu); +display_tree (tree1, &rootmenu);gtk_tree_view_expand_all (GTK_TREE_VIEW (tree1_w)); - tree = tree2; }static void fixup_rootmenu (struct menu *menu)
@@ -1251,7 +1251,7 @@ static void init_main_window(const gchar *glade_file)static void init_tree_model (void ) { - tree = tree2 = gtk_tree_store_new(COL_NUMBER, + tree2 = gtk_tree_store_new(COL_NUMBER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
Signature · 1 line
2.43.0
PATCH 42/66 kconfig: gconf: merge 'current' and 'browsed' global variables
In reply to Masahiro YamadaThe 'current' (SINGLE view) and 'browsed' (SPLIT_VIEW) variables serve similar purposes and are not needed at the same time. Merge them.
---
scripts/kconfig/gconf.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
scripts/kconfig/gconf.c +13 -19
@@ -46,8 +46,7 @@ static GtkTextTag *tag1, *tag2;static GtkTreeStore *tree1, *tree2;static GtkTreeModel *model1, *model2; -static struct menu *current;// current node for SINGLE view -static struct menu *browsed;// browsed node for SPLIT view +static struct menu *browsed;// browsed menu for SINGLE/SPLIT view enum {COL_OPTION ,COL_NAME ,COL_NO ,COL_MOD ,COL_YES ,COL_VALUE ,
@@ -90,7 +89,7 @@ static void set_view_mode(enum view_mode mode)switch (mode) {case SINGLE_VIEW : - current = &rootmenu; + browsed = &rootmenu;display_tree_part ();gtk_widget_set_sensitive (single_btn, FALSE);break ;
@@ -352,13 +351,13 @@ static void on_back_clicked(GtkButton *button, gpointer user_data) {enum prop_type ptype; - current = current->parent; - ptype = current->prompt ? current->prompt->type :P_UNKNOWN ; + browsed = browsed->parent; + ptype = browsed->prompt ? browsed->prompt->type :P_UNKNOWN ;if (ptype !=P_MENU ) - current = current->parent; + browsed = browsed->parent;display_tree_part (); -if (current == &rootmenu) +if (browsed == &rootmenu)gtk_widget_set_sensitive (back_btn, FALSE); }
@@ -611,7 +610,7 @@ static gboolean on_treeview2_button_press_event(GtkWidget *widget,if (ptype ==P_MENU && view_mode !=FULL_VIEW && col ==COL_OPTION ) {// goes down into menu - current = menu; + browsed = menu;display_tree_part ();gtk_widget_set_sensitive (back_btn, TRUE); }else if (col ==COL_OPTION ) {
@@ -710,14 +709,11 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,gtk_tree_model_get_iter (model, &iter, path);gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 ); -if (event->type ==GDK_2BUTTON_PRESS ) { +if (event->type ==GDK_2BUTTON_PRESS )toggle_sym_value (menu); - current = menu; -display_tree_part (); - }else { - browsed = menu; -display_tree_part (); - } + + browsed = menu; +display_tree_part ();gtk_tree_view_set_cursor (view, path,NULL , FALSE);gtk_widget_grab_focus (tree2_w);
@@ -1011,7 +1007,7 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu,GtkTreeIter iter;if (menu == &rootmenu) - current = &rootmenu; + browsed = &rootmenu;for (child = menu->list; child; child = child->next) { prop = child->prompt;
@@ -1058,9 +1054,7 @@ static void display_tree(GtkTreeStore *store, struct menu *menu)static void display_tree_part (void ) {gtk_tree_store_clear (tree2); -if (view_mode ==SINGLE_VIEW ) -display_tree (tree2, current); -else if (view_mode ==SPLIT_VIEW ) +if (view_mode ==SINGLE_VIEW || view_mode ==SPLIT_VIEW )display_tree (tree2, browsed);else if (view_mode ==FULL_VIEW )display_tree (tree2, &rootmenu);
Signature · 1 line
2.43.0
PATCH 43/66 kconfig: gconf: preserve menu selection when switching view mode
In reply to Masahiro YamadaPreserve the current menu selection when switching to a different view mode, as it improves usability.
---
scripts/kconfig/gconf.c | 86 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 8 deletions(-)
scripts/kconfig/gconf.c +78 -8
@@ -47,6 +47,7 @@ static GtkTreeStore *tree1, *tree2;static GtkTreeModel *model1, *model2;static struct menu *browsed;// browsed menu for SINGLE/SPLIT view +static struct menu *selected;// selected entry enum {COL_OPTION ,COL_NAME ,COL_NO ,COL_MOD ,COL_YES ,COL_VALUE ,
@@ -68,6 +69,47 @@ static void conf_changed(bool dirty)/* Utility Functions */ +static void _select_menu (GtkTreeView *view,GtkTreeModel *model, +GtkTreeIter *parent,struct menu *match) +{ +GtkTreeIter iter; +gboolean valid; + + valid =gtk_tree_model_iter_children (model, &iter, parent); +while (valid) { +struct menu *menu; + +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 ); + +if (menu == match) { +GtkTreeSelection *selection; +GtkTreePath *path; + +/* +* Expand parents to reflect the selection, and +* scroll down to it. +*/ + path =gtk_tree_model_get_path (model, &iter); +gtk_tree_view_expand_to_path (view, path); +gtk_tree_view_scroll_to_cell (view, path,NULL , TRUE, +0.5 ,0.0 ); +gtk_tree_path_free (path); + + selection =gtk_tree_view_get_selection (view); +gtk_tree_selection_select_iter (selection, &iter); + } + +_select_menu (view, model, &iter, match); + + valid =gtk_tree_model_iter_next (model, &iter); + } +} + +static void select_menu (GtkTreeView *view,struct menu *match) +{ +_select_menu (view,gtk_tree_view_get_model (view),NULL , match); +} +static void set_view_mode (enum view_mode mode) { view_mode = mode;
@@ -89,24 +131,40 @@ static void set_view_mode(enum view_mode mode)switch (mode) {case SINGLE_VIEW : - browsed = &rootmenu; +if (selected) + browsed =menu_get_parent_menu (selected) ?: &rootmenu; +else + browsed = &rootmenu;display_tree_part (); +select_menu (GTK_TREE_VIEW (tree2_w), selected);gtk_widget_set_sensitive (single_btn, FALSE);break ;case SPLIT_VIEW : + browsed =NULL ; +if (selected) { +if (selected->type ==M_MENU ) + browsed = selected; +else + browsed =menu_get_parent_menu (selected); + }gtk_tree_store_clear (tree2);display_list (); +if (browsed) +display_tree (tree2, browsed); +select_menu (GTK_TREE_VIEW (tree1_w), browsed); +select_menu (GTK_TREE_VIEW (tree2_w), selected);gtk_widget_set_sensitive (split_btn, FALSE);break ;case FULL_VIEW :gtk_tree_store_clear (tree2);display_tree (tree2, &rootmenu); +select_menu (GTK_TREE_VIEW (tree2_w), selected);gtk_widget_set_sensitive (full_btn, FALSE);break ; } -if (mode !=SINGLE_VIEW ) -gtk_widget_set_sensitive (back_btn, FALSE); +gtk_widget_set_sensitive (back_btn, + mode ==SINGLE_VIEW && browsed != &rootmenu); }static void text_insert_help (struct menu *menu)
@@ -603,6 +661,8 @@ static gboolean on_treeview2_button_press_event(GtkWidget *widget,return FALSE;gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 ); + selected = menu; + col =column2index (column);if (event->type ==GDK_2BUTTON_PRESS ) {enum prop_type ptype;
@@ -712,8 +772,12 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,if (event->type ==GDK_2BUTTON_PRESS )toggle_sym_value (menu); - browsed = menu; -display_tree_part (); + selected = menu; + +if (menu->type ==M_MENU ) { + browsed = menu; +display_tree_part (); + }gtk_tree_view_set_cursor (view, path,NULL , FALSE);gtk_widget_grab_focus (tree2_w);
@@ -1006,10 +1070,16 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu,enum prop_type ptype;GtkTreeIter iter; -if (menu == &rootmenu) - browsed = &rootmenu; -for (child = menu->list; child; child = child->next) { +/* +* REVISIT: +* menu_finalize() creates empty "if" entries. +* Do not confuse gtk_tree_model_get(), which would otherwise +* return "if" menu entry. +*/ +if (child->type ==M_IF ) +continue ; + prop = child->prompt; ptype = prop ? prop->type :P_UNKNOWN ;
Signature · 1 line
2.43.0
Re: [PATCH 43/66] kconfig: gconf: preserve menu selection when switching view mode
Quoted 6 lines · Masahiro Yamada
Preserve the current menu selection when switching to a different view mode, as it improves usability.
Signed-off-by Masahiro Yamada <[email protected]>---
There is a corner case where this does not work in Split view. One example is a top-level symbol, such as CONFIG_64BIT.
For x86, CONFIG_64BIT is located at the top-level, and it does not belong to any menu.
This works in Single and Full views.
[1] Choose Full view (default)
[2] Select "64-bit kernel"
[3] Choose Single view and Full view back-and-forth
[4] "64-bit kernel" is still selected
However, this does not work in Split View:
[1] Choose Full view (default)
[2] Select "64-bit kernel"
[3] Choose Split view
[4] "64-bit kernel" is not selected
The Split view never works in a consistent way.
I will consider whether I should fix such a corner case or not.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 44/66 kconfig: gconf: use GtkTreeModelFilter to control row visibility
In reply to Masahiro YamadaCurrently, update_tree() adds/removes entries to show/hide rows. This approach is extremely complicated.
Use the tree model filter to control row visibility instead.
Do not toggle the MENU_CHANGED flag, as it is hard to control this correctly.
---
scripts/kconfig/gconf.c | 217 +++++++++++++++------------------------- 1 file changed, 80 insertions(+), 137 deletions(-)
scripts/kconfig/gconf.c +80 -137
@@ -59,7 +59,9 @@ enum {static void display_list (void );static void display_tree (GtkTreeStore *store,struct menu *menu);static void display_tree_part (void ); -static void update_tree (struct menu *src,GtkTreeIter * dst); +static gchar **fill_row (struct menu *menu); +static void set_node (GtkTreeStore *tree,GtkTreeIter *node, +struct menu *menu,gchar **row);static void conf_changed (bool dirty) {
@@ -110,6 +112,47 @@ static void select_menu(GtkTreeView *view, struct menu *match)_select_menu (view,gtk_tree_view_get_model (view),NULL , match); } +static void _update_row_visibility (GtkTreeView *view) +{ +GtkTreeModelFilter *filter =GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (view)); + +gtk_tree_model_filter_refilter (filter); +} + +static void update_row_visibility (void ) +{ +if (view_mode ==SPLIT_VIEW ) +_update_row_visibility (GTK_TREE_VIEW (tree1_w)); +_update_row_visibility (GTK_TREE_VIEW (tree2_w)); +} + +static void _update_tree (GtkTreeStore *store,GtkTreeIter *parent) +{ +GtkTreeModel *model =GTK_TREE_MODEL (store); +GtkTreeIter iter; +gboolean valid; + + valid =gtk_tree_model_iter_children (model, &iter, parent); +while (valid) { +struct menu *menu; + +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 ); + +if (menu) +set_node (store, &iter, menu,fill_row (menu)); + +_update_tree (store, &iter); + + valid =gtk_tree_model_iter_next (model, &iter); + } +} + +static void update_tree (GtkTreeStore *store) +{ +_update_tree (store,NULL ); +update_row_visibility (); +} +static void set_view_mode (enum view_mode mode) { view_mode = mode;
@@ -328,24 +371,21 @@ static void on_set_option_mode1_activate(GtkMenuItem *menuitem, gpointer user_data) { opt_mode =OPT_NORMAL ; -gtk_tree_store_clear (tree2); -display_tree (tree2, &rootmenu);/* instead of update_tree to speed-up */ +update_row_visibility (); }static void on_set_option_mode2_activate (GtkMenuItem *menuitem,gpointer user_data) { opt_mode =OPT_ALL ; -gtk_tree_store_clear (tree2); -display_tree (tree2, &rootmenu);/* instead of update_tree to speed-up */ +update_row_visibility (); }static void on_set_option_mode3_activate (GtkMenuItem *menuitem,gpointer user_data) { opt_mode =OPT_PROMPT ; -gtk_tree_store_clear (tree2); -display_tree (tree2, &rootmenu);/* instead of update_tree to speed-up */ +update_row_visibility (); }static void on_introduction1_activate (GtkMenuItem *menuitem,gpointer user_data)
@@ -559,7 +599,7 @@ static void renderer_edited(GtkCellRendererText * cell,sym_set_string_value (sym, new_def); -update_tree (&rootmenu,NULL ); +update_tree (tree2); free:gtk_tree_path_free (path);
@@ -590,9 +630,9 @@ static void change_sym_value(struct menu *menu, gint col) newval = yes;sym_set_tristate_value (sym, newval);if (view_mode ==FULL_VIEW ) -update_tree (&rootmenu,NULL ); +update_tree (tree2);else if (view_mode ==SPLIT_VIEW ) { -update_tree (browsed,NULL ); +update_tree (tree2);display_list (); }else if (view_mode ==SINGLE_VIEW )
@@ -613,9 +653,9 @@ static void toggle_sym_value(struct menu *menu)sym_toggle_tristate_value (menu->sym);if (view_mode ==FULL_VIEW ) -update_tree (&rootmenu,NULL ); +update_tree (tree2);else if (view_mode ==SPLIT_VIEW ) { -update_tree (browsed,NULL ); +update_tree (tree2);display_list (); }else if (view_mode ==SINGLE_VIEW )
@@ -842,7 +882,6 @@ static gchar **fill_row(struct menu *menu) row[COL_NAME ] =g_strdup (sym->name);sym_calc_value (sym); - menu->flags &= ~MENU_CHANGED ;if (sym_is_choice (sym)) {// parse childs for getting final value struct menu *child;
@@ -947,120 +986,6 @@ static void set_node(GtkTreeStore *tree, GtkTreeIter *node,g_object_unref (pix); } -/* Find a node in the GTK+ tree */ -static GtkTreeIter found; - -/* -* Find a menu in the GtkTree starting at parent. -*/ -static GtkTreeIter *gtktree_iter_find_node (GtkTreeIter *parent, -struct menu *tofind) -{ -GtkTreeIter iter; -GtkTreeIter *child = &iter; -gboolean valid; -GtkTreeIter *ret; - - valid =gtk_tree_model_iter_children (model2, child, parent); -while (valid) { -struct menu *menu; - -gtk_tree_model_get (model2, child,6 , &menu,-1 ); - -if (menu == tofind) { -memcpy (&found, child,sizeof (GtkTreeIter)); -return &found; - } - - ret =gtktree_iter_find_node (child, tofind); -if (ret) -return ret; - - valid =gtk_tree_model_iter_next (model2, child); - } - -return NULL ; -} - - -/* -* Update the tree by adding/removing entries -* Does not change other nodes -*/ -static void update_tree (struct menu *src,GtkTreeIter * dst) -{ -struct menu *child1; -GtkTreeIter iter, tmp; -GtkTreeIter *child2 = &iter; -gboolean valid; -GtkTreeIter *sibling; -struct symbol *sym; -struct menu *menu1, *menu2; - - valid =gtk_tree_model_iter_children (model2, child2, dst); -for (child1 = src->list; child1; child1 = child1->next) { - - sym = child1->sym; - - reparse: - menu1 = child1; -if (valid) -gtk_tree_model_get (model2, child2,COL_MENU , - &menu2,-1 ); -else - menu2 =NULL ;// force adding of a first child - -if ((opt_mode ==OPT_NORMAL && !menu_is_visible (child1)) || - (opt_mode ==OPT_PROMPT && !menu_has_prompt (child1)) || - (opt_mode ==OPT_ALL && !menu_get_prompt (child1))) { - -/* remove node */ -if (gtktree_iter_find_node (dst, menu1) !=NULL ) { -memcpy (&tmp, child2,sizeof (GtkTreeIter)); - valid =gtk_tree_model_iter_next (model2, - child2); -gtk_tree_store_remove (tree2, &tmp); -if (!valid) -return ;/* next parent */ -else - goto reparse;/* next child */ - }else -continue ; - } - -if (menu1 != menu2) { -if (gtktree_iter_find_node (dst, menu1) ==NULL ) {// add node -if (!valid && !menu2) - sibling =NULL ; -else - sibling = child2; -gtk_tree_store_insert_before (tree2, - child2, - dst, sibling); -set_node (tree2, child2, menu1,fill_row (menu1)); -if (menu2 ==NULL ) - valid = TRUE; - }else {// remove node -memcpy (&tmp, child2,sizeof (GtkTreeIter)); - valid =gtk_tree_model_iter_next (model2, - child2); -gtk_tree_store_remove (tree2, &tmp); -if (!valid) -return ;// next parent -else - goto reparse;// next child - } - }else if (sym && (child1->flags &MENU_CHANGED )) { -set_node (tree2, child2, menu1,fill_row (menu1)); - } - -update_tree (child1, child2); - - valid =gtk_tree_model_iter_next (model2, child2); - } -} - -/* Display the whole tree (single/split/full view) */ static void _display_tree (GtkTreeStore *tree,struct menu *menu,GtkTreeIter *parent)
@@ -1083,8 +1008,6 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu, prop = child->prompt; ptype = prop ? prop->type :P_UNKNOWN ; - menu->flags &= ~MENU_CHANGED ; -if ((view_mode ==SPLIT_VIEW ) && !(child->flags &MENU_ROOT ) && (tree == tree1))continue ;
@@ -1093,12 +1016,8 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu, && (tree == tree2))continue ; -if ((opt_mode ==OPT_NORMAL &&menu_is_visible (child)) || - (opt_mode ==OPT_PROMPT &&menu_has_prompt (child)) || - (opt_mode ==OPT_ALL &&menu_get_prompt (child))) { -gtk_tree_store_append (tree, &iter, parent); -set_node (tree, &iter, child,fill_row (child)); - } +gtk_tree_store_append (tree, &iter, parent); +set_node (tree, &iter, child,fill_row (child));if ((view_mode !=FULL_VIEW ) && (ptype ==P_MENU ) && (tree == tree2))
@@ -1313,6 +1232,20 @@ static void init_main_window(const gchar *glade_file)gtk_widget_show (main_wnd); } +static gboolean visible_func (GtkTreeModel *model,GtkTreeIter *iter, +gpointer data) +{ +struct menu *menu; + +gtk_tree_model_get (model, iter,COL_MENU , &menu,-1 ); + +if (!menu) +return FALSE; + +return menu_is_visible (menu) || opt_mode ==OPT_ALL || + (opt_mode ==OPT_PROMPT &&menu_has_prompt (menu)); +} +static void init_tree_model (void ) { tree2 = gtk_tree_store_new(COL_NUMBER,
@@ -1344,8 +1277,13 @@ static void init_left_tree(void)GtkCellRenderer *renderer;GtkTreeSelection *sel;GtkTreeViewColumn *column; +GtkTreeModel *filter; -gtk_tree_view_set_model (view, model1); + filter =gtk_tree_model_filter_new (model1,NULL ); + +gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter), + visible_func,NULL ,NULL ); +gtk_tree_view_set_model (view, filter); column =gtk_tree_view_column_new ();gtk_tree_view_append_column (view, column);
@@ -1379,9 +1317,14 @@ static void init_right_tree(void)GtkCellRenderer *renderer;GtkTreeSelection *sel;GtkTreeViewColumn *column; +GtkTreeModel *filter;gint i; -gtk_tree_view_set_model (view, model2); + filter =gtk_tree_model_filter_new (model2,NULL ); + +gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter), + visible_func,NULL ,NULL ); +gtk_tree_view_set_model (view, filter); column =gtk_tree_view_column_new ();gtk_tree_view_append_column (view, column);
Signature · 1 line
2.43.0
PATCH 45/66 kconfig: gconf: remove global 'model1' and 'model2' variables
In reply to Masahiro YamadaThese variables are unnecessary because the current model can be retrieved using gtk_tree_view_get_model().
---
scripts/kconfig/gconf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
scripts/kconfig/gconf.c +2 -5
@@ -44,7 +44,6 @@ static GtkWidget *save_menu_item;static GtkTextTag *tag1, *tag2;static GtkTreeStore *tree1, *tree2; -static GtkTreeModel *model1, *model2;static struct menu *browsed;// browsed menu for SINGLE/SPLIT view static struct menu *selected;// selected entry
@@ -1257,7 +1256,6 @@ static void init_tree_model(void)G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , G_TYPE_BOOLEAN); - model2 =GTK_TREE_MODEL (tree2); tree1 = gtk_tree_store_new(COL_NUMBER, G_TYPE_STRING, G_TYPE_STRING,
@@ -1268,7 +1266,6 @@ static void init_tree_model(void)G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , G_TYPE_BOOLEAN); - model1 =GTK_TREE_MODEL (tree1); }static void init_left_tree (void )
@@ -1279,7 +1276,7 @@ static void init_left_tree(void)GtkTreeViewColumn *column;GtkTreeModel *filter; - filter =gtk_tree_model_filter_new (model1,NULL ); + filter =gtk_tree_model_filter_new (GTK_TREE_MODEL (tree1),NULL );gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter), visible_func,NULL ,NULL );
@@ -1320,7 +1317,7 @@ static void init_right_tree(void)GtkTreeModel *filter;gint i; - filter =gtk_tree_model_filter_new (model2,NULL ); + filter =gtk_tree_model_filter_new (GTK_TREE_MODEL (tree2),NULL );gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter), visible_func,NULL ,NULL );
Signature · 1 line
2.43.0
Re: [PATCH 45/66] kconfig: gconf: remove global 'model1' and 'model2' variables
Quoted 4 lines · Masahiro Yamada
These variables are unnecessary because the current model can be retrieved using
gtk_tree_view_get_model().Signed-off-by Masahiro Yamada <[email protected]>
Quoted 4 lines
---
scripts/kconfig/gconf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Signature · 1 line
~Randy
PATCH 46/66 kconfig: gconf: remove init_tree_model()
In reply to Masahiro YamadaMove the relevant code into init_left_tree() or init_right_tree().
---
scripts/kconfig/gconf.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-)
scripts/kconfig/gconf.c +16 -20
@@ -1245,17 +1245,13 @@ static gboolean visible_func(GtkTreeModel *model, GtkTreeIter *iter, (opt_mode ==OPT_PROMPT &&menu_has_prompt (menu)); } -static void init_tree_model (void ) +static void init_left_tree (void ) { - tree2 =gtk_tree_store_new (COL_NUMBER , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_POINTER ,GDK_TYPE_COLOR , -G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF , -G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , -G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , -G_TYPE_BOOLEAN ); +GtkTreeView *view =GTK_TREE_VIEW (tree1_w); +GtkCellRenderer *renderer; +GtkTreeSelection *sel; +GtkTreeViewColumn *column; +GtkTreeModel *filter; tree1 = gtk_tree_store_new(COL_NUMBER, G_TYPE_STRING, G_TYPE_STRING,
@@ -1266,15 +1262,6 @@ static void init_tree_model(void)G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , G_TYPE_BOOLEAN); -} - -static void init_left_tree (void ) -{ -GtkTreeView *view =GTK_TREE_VIEW (tree1_w); -GtkCellRenderer *renderer; -GtkTreeSelection *sel; -GtkTreeViewColumn *column; -GtkTreeModel *filter; filter =gtk_tree_model_filter_new (GTK_TREE_MODEL (tree1),NULL );
@@ -1317,6 +1304,16 @@ static void init_right_tree(void)GtkTreeModel *filter;gint i; + tree2 =gtk_tree_store_new (COL_NUMBER , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_STRING ,G_TYPE_STRING , +G_TYPE_POINTER ,GDK_TYPE_COLOR , +G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF , +G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , +G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , +G_TYPE_BOOLEAN ); + filter =gtk_tree_model_filter_new (GTK_TREE_MODEL (tree2),NULL ); gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter),
@@ -1439,7 +1436,6 @@ int main(int ac, char *av[])/* Load the interface and connect signals */ init_main_window (glade_file); -init_tree_model ();init_left_tree ();init_right_tree ();
Signature · 1 line
2.43.0
PATCH 47/66 kconfig: gconf: inline fill_row() into set_node()
In reply to Masahiro YamadaThe row[] array is used to prepare data passed to set_node(), but this indirection is unnecessary. Squash fill_row() into set_node() and call gtk_tree_store_set() directly.
Also, calling gdk_pixbuf_new_from_xpm_data() for every row is inefficient. Call it once and store the resulting pixbuf in a global variable.
---
scripts/kconfig/gconf.c | 272 ++++++++++++++++------------------------ 1 file changed, 106 insertions(+), 166 deletions(-)
scripts/kconfig/gconf.c +106 -166
@@ -44,6 +44,7 @@ static GtkWidget *save_menu_item;static GtkTextTag *tag1, *tag2;static GtkTreeStore *tree1, *tree2; +static GdkPixbuf *pix_menu;static struct menu *browsed;// browsed menu for SINGLE/SPLIT view static struct menu *selected;// selected entry
@@ -58,9 +59,6 @@ enum {static void display_list (void );static void display_tree (GtkTreeStore *store,struct menu *menu);static void display_tree_part (void ); -static gchar **fill_row (struct menu *menu); -static void set_node (GtkTreeStore *tree,GtkTreeIter *node, -struct menu *menu,gchar **row);static void conf_changed (bool dirty) {
@@ -125,6 +123,104 @@ static void update_row_visibility(void)_update_row_visibility (GTK_TREE_VIEW (tree2_w)); } +static void set_node (GtkTreeStore *tree,GtkTreeIter *node,struct menu *menu) +{ +struct symbol *sym = menu->sym; +tristate val; +gchar *option; +const gchar *_no ="" ; +const gchar *_mod ="" ; +const gchar *_yes ="" ; +const gchar *value ="" ; +GdkColor color; +gboolean editable = FALSE; +gboolean btnvis = FALSE; + + option =g_strdup_printf ("%s %s %s %s" , + menu->type ==M_COMMENT ?"***" :"" , +menu_get_prompt (menu), + menu->type ==M_COMMENT ?"***" :"" , + sym && !sym_has_value (sym) ?"(NEW)" :"" ); + +gdk_color_parse (menu_is_visible (menu) ?"Black" :"DarkGray" , &color); + +if (!sym) + goto set; + +sym_calc_value (sym); + +if (menu->type ==M_CHOICE ) {// parse children to get a final value +struct symbol *def_sym =sym_calc_choice (menu); +struct menu *def_menu =NULL ; + +for (struct menu *child = menu->list; child; child = child->next) { +if (menu_is_visible (child) && child->sym == def_sym) + def_menu = child; + } + +if (def_menu) + value =menu_get_prompt (def_menu); + + goto set; + } + +switch (sym_get_type (sym)) { +case S_BOOLEAN : +case S_TRISTATE : + + btnvis = TRUE; + + val =sym_get_tristate_value (sym); +switch (val) { +case no: + _no ="N" ; + value ="N" ; +break ; +case mod: + _mod ="M" ; + value ="M" ; +break ; +case yes: + _yes ="Y" ; + value ="Y" ; +break ; + } + +if (val != no &&sym_tristate_within_range (sym, no)) + _no ="_" ; +if (val != mod &&sym_tristate_within_range (sym, mod)) + _mod ="_" ; +if (val != yes &&sym_tristate_within_range (sym, yes)) + _yes ="_" ; +break ; +default : + value =sym_get_string_value (sym); + editable = TRUE; +break ; + } + +set: +gtk_tree_store_set (tree, node, +COL_OPTION , option, +COL_NAME , sym ? sym->name :"" , +COL_NO , _no, +COL_MOD , _mod, +COL_YES , _yes, +COL_VALUE , value, +COL_MENU , (gpointer ) menu, +COL_COLOR , &color, +COL_EDIT , editable, +COL_PIXBUF , pix_menu, +COL_PIXVIS , view_mode ==SINGLE_VIEW && menu->type ==M_MENU , +COL_BTNVIS , btnvis, +COL_BTNACT , _yes[0 ] =='Y' , +COL_BTNINC , _mod[0 ] =='M' , +COL_BTNRAD , sym &&sym_is_choice_value (sym), +-1 ); + +g_free (option); +} +static void _update_tree (GtkTreeStore *store,GtkTreeIter *parent) {GtkTreeModel *model =GTK_TREE_MODEL (store);
@@ -138,7 +234,7 @@ static void _update_tree(GtkTreeStore *store, GtkTreeIter *parent)gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 );if (menu) -set_node (store, &iter, menu,fill_row (menu)); +set_node (store, &iter, menu);_update_tree (store, &iter);
@@ -563,6 +659,9 @@ static gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event,gtk_widget_destroy (dialog); +if (!ret) +g_object_unref (pix_menu); +return ret; }
@@ -824,167 +923,6 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,return FALSE; } - -/* Fill a row of strings */ -static gchar **fill_row (struct menu *menu) -{ -static gchar *row[COL_NUMBER ]; -struct symbol *sym = menu->sym; -const char *def; -int stype; -tristate val; -enum prop_type ptype; -int i; - -for (i =COL_OPTION ; i <=COL_COLOR ; i++) -g_free (row[i]); -bzero (row,sizeof (row)); - - ptype = menu->prompt ? menu->prompt->type :P_UNKNOWN ; - - row[COL_OPTION ] = -g_strdup_printf ("%s %s %s %s" , - ptype ==P_COMMENT ?"***" :"" , -menu_get_prompt (menu), - ptype ==P_COMMENT ?"***" :"" , - sym && !sym_has_value (sym) ?"(NEW)" :"" ); - -if (opt_mode ==OPT_ALL && !menu_is_visible (menu)) - row[COL_COLOR ] =g_strdup ("DarkGray" ); -else if (opt_mode ==OPT_PROMPT && -menu_has_prompt (menu) && !menu_is_visible (menu)) - row[COL_COLOR ] =g_strdup ("DarkGray" ); -else - row[COL_COLOR ] =g_strdup ("Black" ); - -switch (ptype) { -case P_MENU : - row[COL_PIXBUF ] = (gchar *) xpm_menu; -if (view_mode ==SINGLE_VIEW ) - row[COL_PIXVIS ] =GINT_TO_POINTER (TRUE); - row[COL_BTNVIS ] =GINT_TO_POINTER (FALSE); -break ; -case P_COMMENT : - row[COL_PIXBUF ] = (gchar *) xpm_void; - row[COL_PIXVIS ] =GINT_TO_POINTER (FALSE); - row[COL_BTNVIS ] =GINT_TO_POINTER (FALSE); -break ; -default : - row[COL_PIXBUF ] = (gchar *) xpm_void; - row[COL_PIXVIS ] =GINT_TO_POINTER (FALSE); - row[COL_BTNVIS ] =GINT_TO_POINTER (TRUE); -break ; - } - -if (!sym) -return row; - row[COL_NAME ] =g_strdup (sym->name); - -sym_calc_value (sym); - -if (sym_is_choice (sym)) {// parse childs for getting final value -struct menu *child; -struct symbol *def_sym =sym_calc_choice (menu); -struct menu *def_menu =NULL ; - -for (child = menu->list; child; child = child->next) { -if (menu_is_visible (child) - && child->sym == def_sym) - def_menu = child; - } - -if (def_menu) - row[COL_VALUE ] = -g_strdup (menu_get_prompt (def_menu)); - - row[COL_BTNVIS ] =GINT_TO_POINTER (FALSE); -return row; - } -if (sym_is_choice_value (sym)) - row[COL_BTNRAD ] =GINT_TO_POINTER (TRUE); - - stype =sym_get_type (sym); -switch (stype) { -case S_BOOLEAN : -case S_TRISTATE : - val =sym_get_tristate_value (sym); -switch (val) { -case no: - row[COL_NO ] =g_strdup ("N" ); - row[COL_VALUE ] =g_strdup ("N" ); - row[COL_BTNACT ] =GINT_TO_POINTER (FALSE); - row[COL_BTNINC ] =GINT_TO_POINTER (FALSE); -break ; -case mod: - row[COL_MOD ] =g_strdup ("M" ); - row[COL_VALUE ] =g_strdup ("M" ); - row[COL_BTNINC ] =GINT_TO_POINTER (TRUE); -break ; -case yes: - row[COL_YES ] =g_strdup ("Y" ); - row[COL_VALUE ] =g_strdup ("Y" ); - row[COL_BTNACT ] =GINT_TO_POINTER (TRUE); - row[COL_BTNINC ] =GINT_TO_POINTER (FALSE); -break ; - } - -if (val != no &&sym_tristate_within_range (sym, no)) - row[COL_NO ] =g_strdup ("_" ); -if (val != mod &&sym_tristate_within_range (sym, mod)) - row[COL_MOD ] =g_strdup ("_" ); -if (val != yes &&sym_tristate_within_range (sym, yes)) - row[COL_YES ] =g_strdup ("_" ); -break ; -case S_INT : -case S_HEX : -case S_STRING : - def =sym_get_string_value (sym); - row[COL_VALUE ] =g_strdup (def); - row[COL_EDIT ] =GINT_TO_POINTER (TRUE); - row[COL_BTNVIS ] =GINT_TO_POINTER (FALSE); -break ; - } - -return row; -} - - -/* Set the node content with a row of strings */ -static void set_node (GtkTreeStore *tree,GtkTreeIter *node, -struct menu *menu,gchar **row) -{ -GdkColor color; -gboolean success; -GdkPixbuf *pix; - - pix =gdk_pixbuf_new_from_xpm_data ((const char **) - row[COL_PIXBUF ]); - -gdk_color_parse (row[COL_COLOR ], &color); -gdk_colormap_alloc_colors (gdk_colormap_get_system (), &color,1 , - FALSE, FALSE, &success); - -gtk_tree_store_set (tree, node, -COL_OPTION , row[COL_OPTION ], -COL_NAME , row[COL_NAME ], -COL_NO , row[COL_NO ], -COL_MOD , row[COL_MOD ], -COL_YES , row[COL_YES ], -COL_VALUE , row[COL_VALUE ], -COL_MENU , (gpointer ) menu, -COL_COLOR , &color, -COL_EDIT ,GPOINTER_TO_INT (row[COL_EDIT ]), -COL_PIXBUF , pix, -COL_PIXVIS ,GPOINTER_TO_INT (row[COL_PIXVIS ]), -COL_BTNVIS ,GPOINTER_TO_INT (row[COL_BTNVIS ]), -COL_BTNACT ,GPOINTER_TO_INT (row[COL_BTNACT ]), -COL_BTNINC ,GPOINTER_TO_INT (row[COL_BTNINC ]), -COL_BTNRAD ,GPOINTER_TO_INT (row[COL_BTNRAD ]), --1 ); - -g_object_unref (pix); -} -/* Display the whole tree (single/split/full view) */ static void _display_tree (GtkTreeStore *tree,struct menu *menu,GtkTreeIter *parent)
@@ -1016,7 +954,7 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu,continue ;gtk_tree_store_append (tree, &iter, parent); -set_node (tree, &iter, child,fill_row (child)); +set_node (tree, &iter, child);if ((view_mode !=FULL_VIEW ) && (ptype ==P_MENU ) && (tree == tree2))
@@ -1384,6 +1322,8 @@ static void init_right_tree(void)g_signal_connect (G_OBJECT (renderer),"edited" ,G_CALLBACK (renderer_edited), tree2_w); + pix_menu =gdk_pixbuf_new_from_xpm_data ((const char **)xpm_menu); +for (i =0 ; i <COL_VALUE ; i++) { column =gtk_tree_view_get_column (view, i);gtk_tree_view_column_set_resizable (column, TRUE);
Signature · 1 line
2.43.0
PATCH 48/66 kconfig: gconf: do not reconstruct tree store when a symbol is changed
In reply to Masahiro YamadaThere is no need to reconstruct the entire tree store when a symbol's value changes. Simply call gtk_tree_store_set() to update the row data.
Introduce update_trees() to factor out the common update logic.
---
scripts/kconfig/gconf.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
scripts/kconfig/gconf.c +11 -18
@@ -248,6 +248,13 @@ static void update_tree(GtkTreeStore *store)update_row_visibility (); } +static void update_trees (void ) +{ +if (view_mode ==SPLIT_VIEW ) +update_tree (tree1); +update_tree (tree2); +} +static void set_view_mode (enum view_mode mode) { view_mode = mode;
@@ -378,7 +385,7 @@ static void on_load1_activate(GtkMenuItem *menuitem, gpointer user_data)text_insert_msg ("Error" ,"Unable to load configuration!" ); else -display_tree_part (); +update_trees ();g_free (filename); }
@@ -697,7 +704,7 @@ static void renderer_edited(GtkCellRendererText * cell,sym_set_string_value (sym, new_def); -update_tree (tree2); +update_trees (); free:gtk_tree_path_free (path);
@@ -727,14 +734,7 @@ static void change_sym_value(struct menu *menu, gint col)if (!sym_tristate_within_range (sym, newval)) newval = yes;sym_set_tristate_value (sym, newval); -if (view_mode ==FULL_VIEW ) -update_tree (tree2); -else if (view_mode ==SPLIT_VIEW ) { -update_tree (tree2); -display_list (); - } -else if (view_mode ==SINGLE_VIEW ) -display_tree_part ();//fixme: keep exp/coll +update_trees ();break ;case S_INT :case S_HEX :
@@ -750,14 +750,7 @@ static void toggle_sym_value(struct menu *menu)return ;sym_toggle_tristate_value (menu->sym); -if (view_mode ==FULL_VIEW ) -update_tree (tree2); -else if (view_mode ==SPLIT_VIEW ) { -update_tree (tree2); -display_list (); - } -else if (view_mode ==SINGLE_VIEW ) -display_tree_part ();//fixme: keep exp/coll +update_trees (); }static gint column2index (GtkTreeViewColumn * column)
Signature · 1 line
2.43.0
PATCH 49/66 kconfig: gconf: inline display_list() into set_view_mode()
In reply to Masahiro YamadaThis function is now only called by set_view_mode(), so inline it for simplicity.
---
scripts/kconfig/gconf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
scripts/kconfig/gconf.c +3 -11
@@ -56,7 +56,6 @@ enum { COL_NUMBER }; -static void display_list (void );static void display_tree (GtkTreeStore *store,struct menu *menu);static void display_tree_part (void );
@@ -292,8 +291,10 @@ static void set_view_mode(enum view_mode mode)else browsed =menu_get_parent_menu (selected); } +gtk_tree_store_clear (tree1); +display_tree (tree1, &rootmenu); +gtk_tree_view_expand_all (GTK_TREE_VIEW (tree1_w));gtk_tree_store_clear (tree2); -display_list ();if (browsed)display_tree (tree2, browsed);select_menu (GTK_TREE_VIEW (tree1_w), browsed);
@@ -980,15 +981,6 @@ static void display_tree_part(void)gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); } -/* Display the list in the left frame (split view) */ -static void display_list (void ) -{ -gtk_tree_store_clear (tree1); - -display_tree (tree1, &rootmenu); -gtk_tree_view_expand_all (GTK_TREE_VIEW (tree1_w)); -} -static void fixup_rootmenu (struct menu *menu) {struct menu *child;
Signature · 1 line
2.43.0
PATCH 50/66 kconfig: gconf: remove dead code in display_tree_part()
In reply to Masahiro YamadaThis function is no longer called in the FULL_VIEW mode, so remove the dead code.
---
scripts/kconfig/gconf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
scripts/kconfig/gconf.c +1 -4
@@ -974,10 +974,7 @@ static void display_tree(GtkTreeStore *store, struct menu *menu)static void display_tree_part (void ) {gtk_tree_store_clear (tree2); -if (view_mode ==SINGLE_VIEW || view_mode ==SPLIT_VIEW ) -display_tree (tree2, browsed); -else if (view_mode ==FULL_VIEW ) -display_tree (tree2, &rootmenu); +display_tree (tree2, browsed);gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); }
Signature · 1 line
2.43.0
PATCH 51/66 kconfig: gconf: rename display_tree_part()
In reply to Masahiro YamadaThis function recreates the tree store to update the menu content. Rename it to recreate_menu_content_tree() to better reflect its purpose.
---
scripts/kconfig/gconf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
scripts/kconfig/gconf.c +6 -6
@@ -57,7 +57,7 @@ enum { };static void display_tree (GtkTreeStore *store,struct menu *menu); -static void display_tree_part (void ); +static void recreate_menu_content_tree (void );static void conf_changed (bool dirty) {
@@ -279,7 +279,7 @@ static void set_view_mode(enum view_mode mode) browsed =menu_get_parent_menu (selected) ?: &rootmenu; else browsed = &rootmenu; -display_tree_part (); +recreate_menu_content_tree ();select_menu (GTK_TREE_VIEW (tree2_w), selected);gtk_widget_set_sensitive (single_btn, FALSE);break ;
@@ -556,7 +556,7 @@ static void on_back_clicked(GtkButton *button, gpointer user_data) ptype = browsed->prompt ? browsed->prompt->type :P_UNKNOWN ;if (ptype !=P_MENU ) browsed = browsed->parent; -display_tree_part (); +recreate_menu_content_tree ();if (browsed == &rootmenu)gtk_widget_set_sensitive (back_btn, FALSE);
@@ -803,7 +803,7 @@ static gboolean on_treeview2_button_press_event(GtkWidget *widget,if (ptype ==P_MENU && view_mode !=FULL_VIEW && col ==COL_OPTION ) {// goes down into menu browsed = menu; -display_tree_part (); +recreate_menu_content_tree ();gtk_widget_set_sensitive (back_btn, TRUE); }else if (col ==COL_OPTION ) {toggle_sym_value (menu);
@@ -908,7 +908,7 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,if (menu->type ==M_MENU ) { browsed = menu; -display_tree_part (); +recreate_menu_content_tree (); }gtk_tree_view_set_cursor (view, path,NULL , FALSE);
@@ -971,7 +971,7 @@ static void display_tree(GtkTreeStore *store, struct menu *menu) }/* Display a part of the tree starting at current node (single/split view) */ -static void display_tree_part (void ) +static void recreate_menu_content_tree (void ) {gtk_tree_store_clear (tree2);display_tree (tree2, browsed);
Signature · 1 line
2.43.0
PATCH 52/66 kconfig: gconf: remove fixup_rootmenu()
In reply to Masahiro YamadaThe MENU_ROOT flag is a hack used for SPLIT_VIEW mode. Top-level symbols have no parent menu, so they are displayed directly in the left pane.
Show the rootmenu, allowing top-level symbols to have a proper parent menu and be displayed consistently in the right pane.
---
scripts/kconfig/gconf.c | 164 +++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 93 deletions(-)
scripts/kconfig/gconf.c +71 -93
@@ -56,9 +56,6 @@ enum { COL_NUMBER }; -static void display_tree (GtkTreeStore *store,struct menu *menu); -static void recreate_menu_content_tree (void ); -static void conf_changed (bool dirty) {gtk_widget_set_sensitive (save_btn, dirty);
@@ -254,6 +251,74 @@ static void update_trees(void)update_tree (tree2); } +static void _recreate_menu_tree (GtkTreeStore *store,struct menu *menu, +GtkTreeIter *parent,gboolean menu_only) +{ +GtkTreeIter iter; + +/* REVISIT: menu_finalize() creates empty "if" entries. */ +if (menu->type ==M_IF ) +return ; + +if (!menu_only || menu->type ==M_MENU ) { +gtk_tree_store_append (store, &iter, parent); +set_node (store, &iter, menu); + } + +for (struct menu *child = menu->list; child; child = child->next) +_recreate_menu_tree (store, child, &iter, menu_only); +} + +static void recreate_menu_tree (void ) +{ +GtkTreeStore *store; +GtkTreeView *view; + +if (view_mode ==SPLIT_VIEW ) { + store = tree1; + view =GTK_TREE_VIEW (tree1_w); + }else { + store = tree2; + view =GTK_TREE_VIEW (tree2_w); + } + +gtk_tree_store_clear (store); +_recreate_menu_tree (store, &rootmenu,NULL , view_mode ==SPLIT_VIEW ); +select_menu (view, browsed); +gtk_tree_view_expand_all (view); +} + +static void _recreate_menu_content_tree (GtkTreeStore *store,struct menu *menu, +GtkTreeIter *parent,gboolean no_menu) +{ +for (struct menu *child = menu->list; child; child = child->next) { +GtkTreeIter iter; + +/* REVISIT: menu_finalize() creates empty "if" entries. */ +if (child->type ==M_IF ) +continue ; + +if (!no_menu || child->type !=M_MENU ) { +gtk_tree_store_append (store, &iter, parent); +set_node (store, &iter, child); + } + +if (child->type !=M_MENU ) +_recreate_menu_content_tree (store, child, &iter, + no_menu); + } +} + +static void recreate_menu_content_tree (void ) +{ +gtk_tree_store_clear (tree2); +if (browsed) +_recreate_menu_content_tree (tree2, browsed,NULL , + view_mode ==SPLIT_VIEW ); +select_menu (GTK_TREE_VIEW (tree2_w), selected); +gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); +} +static void set_view_mode (enum view_mode mode) { view_mode = mode;
@@ -280,7 +345,6 @@ static void set_view_mode(enum view_mode mode)else browsed = &rootmenu;recreate_menu_content_tree (); -select_menu (GTK_TREE_VIEW (tree2_w), selected);gtk_widget_set_sensitive (single_btn, FALSE);break ;case SPLIT_VIEW :
@@ -291,20 +355,12 @@ static void set_view_mode(enum view_mode mode)else browsed =menu_get_parent_menu (selected); } -gtk_tree_store_clear (tree1); -display_tree (tree1, &rootmenu); -gtk_tree_view_expand_all (GTK_TREE_VIEW (tree1_w)); -gtk_tree_store_clear (tree2); -if (browsed) -display_tree (tree2, browsed); -select_menu (GTK_TREE_VIEW (tree1_w), browsed); -select_menu (GTK_TREE_VIEW (tree2_w), selected); +recreate_menu_tree (); +recreate_menu_content_tree ();gtk_widget_set_sensitive (split_btn, FALSE);break ;case FULL_VIEW : -gtk_tree_store_clear (tree2); -display_tree (tree2, &rootmenu); -select_menu (GTK_TREE_VIEW (tree2_w), selected); +recreate_menu_tree ();gtk_widget_set_sensitive (full_btn, FALSE);break ; }
@@ -917,83 +973,6 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,return FALSE; } -/* Display the whole tree (single/split/full view) */ -static void _display_tree (GtkTreeStore *tree,struct menu *menu, -GtkTreeIter *parent) -{ -struct property *prop; -struct menu *child; -enum prop_type ptype; -GtkTreeIter iter; - -for (child = menu->list; child; child = child->next) { -/* -* REVISIT: -* menu_finalize() creates empty "if" entries. -* Do not confuse gtk_tree_model_get(), which would otherwise -* return "if" menu entry. -*/ -if (child->type ==M_IF ) -continue ; - - prop = child->prompt; - ptype = prop ? prop->type :P_UNKNOWN ; - -if ((view_mode ==SPLIT_VIEW ) - && !(child->flags &MENU_ROOT ) && (tree == tree1)) -continue ; - -if ((view_mode ==SPLIT_VIEW ) && (child->flags &MENU_ROOT ) - && (tree == tree2)) -continue ; - -gtk_tree_store_append (tree, &iter, parent); -set_node (tree, &iter, child); - -if ((view_mode !=FULL_VIEW ) && (ptype ==P_MENU ) - && (tree == tree2)) -continue ; -/* -if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) -|| (view_mode == FULL_VIEW) -|| (view_mode == SPLIT_VIEW))*/ - -if (((view_mode ==SINGLE_VIEW ) && (menu->flags &MENU_ROOT )) - || (view_mode ==FULL_VIEW ) - || (view_mode ==SPLIT_VIEW )) -_display_tree (tree, child, &iter); - } -} - -static void display_tree (GtkTreeStore *store,struct menu *menu) -{ -_display_tree (store, menu,NULL ); -} - -/* Display a part of the tree starting at current node (single/split view) */ -static void recreate_menu_content_tree (void ) -{ -gtk_tree_store_clear (tree2); -display_tree (tree2, browsed); -gtk_tree_view_expand_all (GTK_TREE_VIEW (tree2_w)); -} - -static void fixup_rootmenu (struct menu *menu) -{ -struct menu *child; -static int menu_cnt =0 ; - - menu->flags |=MENU_ROOT ; -for (child = menu->list; child; child = child->next) { -if (child->prompt && child->prompt->type ==P_MENU ) { - menu_cnt++; -fixup_rootmenu (child); - menu_cnt--; - }else if (!menu_cnt) -fixup_rootmenu (child); - } -} -/* Main Window Initialization */ static void replace_button_icon (GtkWidget *widget,const char *const xpm[]) {
@@ -1354,7 +1333,6 @@ int main(int ac, char *av[]) name = av[1 ];conf_parse (name); -fixup_rootmenu (&rootmenu);/* Load the interface and connect signals */ init_main_window (glade_file);
Signature · 1 line
2.43.0
Re: [PATCH 52/66] kconfig: gconf: remove fixup_rootmenu()
Quoted 9 lines · Masahiro Yamada
The
MENU_ROOTflag is a hack used forSPLIT_VIEWmode. Top-level symbols have no parent menu, so they are displayed directly in the left pane.Show the rootmenu, allowing top-level symbols to have a proper parent menu and be displayed consistently in the right pane.
Signed-off-by Masahiro Yamada <[email protected]>---
I will drop this.
This does not work when a menu is created under a non-menu entry.
e.g.)
config A
bool "A"
if A
menu "menu"
config B
bool "B"
endmenu
endif
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 53/66 kconfig: gconf: use size_allocate event handler
In reply to Masahiro YamadaThe size_request event is not available in GTK 3. Use the size_allocate event handler instead.
---
scripts/kconfig/gconf.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
scripts/kconfig/gconf.c +6 -14
@@ -660,21 +660,13 @@ static void on_window1_destroy(GtkObject *object, gpointer user_data)gtk_main_quit (); } -static void on_window1_size_request (GtkWidget *widget, -GtkRequisition *requisition, +static void on_window_size_allocate (GtkWidget *widget, +GtkAllocation *allocation,gpointer user_data) { -static gint old_h; -gint w, h; +gint h; -if (widget->window ==NULL ) -gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h); -else -gdk_window_get_size (widget->window, &w, &h); - -if (h == old_h) -return ; - old_h = h; + h = allocation->height;gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); }
@@ -1000,8 +992,8 @@ static void init_main_window(const gchar *glade_file) main_wnd =glade_xml_get_widget (xml,"window1" );g_signal_connect (main_wnd,"destroy" ,G_CALLBACK (on_window1_destroy),NULL ); -g_signal_connect (main_wnd,"size_request" , -G_CALLBACK (on_window1_size_request),NULL ); +g_signal_connect (main_wnd,"size_allocate" , +G_CALLBACK (on_window_size_allocate),NULL );g_signal_connect (main_wnd,"delete_event" ,G_CALLBACK (on_window1_delete_event),NULL );
Signature · 1 line
2.43.0
Re: [PATCH 53/66] kconfig: gconf: use size_allocate event handler
Quoted 6 lines · Masahiro Yamada
The
size_requestevent is not available in GTK 3. Use thesize_allocateevent handler instead.Signed-off-by Masahiro Yamada <[email protected]>---
This has a regression - with this, we cannot move the horizontal separator between in the right pane.
I will use the "configure-event" event instead.
Quoted 48 lines
scripts/kconfig/gconf.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)scripts/kconfig/gconf.c +6
-15@@ -660,21 +660,13 @@ static void on_window1_destroy(GtkObject *object, gpointer user_data)gtk_main_quit (); } -static void on_window1_size_request (GtkWidget *widget, -GtkRequisition *requisition, +static void on_window_size_allocate (GtkWidget *widget, +GtkAllocation *allocation,gpointer user_data) { -static gint old_h; -gint w, h; +gint h; -if (widget->window ==NULL ) -gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h); -else -gdk_window_get_size (widget->window, &w, &h); - -if (h == old_h) -return ; - old_h = h; + h = allocation->height;gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); }@@ -1000,8 +992,8 @@ static void init_main_window(const gchar *glade_file) main_wnd =glade_xml_get_widget (xml,"window1" );g_signal_connect (main_wnd,"destroy" ,G_CALLBACK (on_window1_destroy),NULL ); -g_signal_connect (main_wnd,"size_request" , -G_CALLBACK (on_window1_size_request),NULL ); +g_signal_connect (main_wnd,"size_allocate" , +G_CALLBACK (on_window_size_allocate),NULL );g_signal_connect (main_wnd,"delete_event" ,G_CALLBACK (on_window1_delete_event),NULL ); --2.43.0
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 53/66] kconfig: gconf: use size_allocate event handler
Quoted 10 lines · Masahiro Yamada
Quoted 6 lines · Masahiro Yamada
The
size_requestevent is not available in GTK 3. Use thesize_allocateevent handler instead.Signed-off-by Masahiro Yamada <[email protected]>---
This has a regression - with this, we cannot move the horizontal separator between in the right pane.
Between the menu items and the message area?
That's what I see.
Quoted 53 lines
I will use the "configure-event" event instead.
Quoted 48 lines
scripts/kconfig/gconf.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)scripts/kconfig/gconf.c +6
-15@@ -660,21 +660,13 @@ static void on_window1_destroy(GtkObject *object, gpointer user_data)gtk_main_quit (); } -static void on_window1_size_request (GtkWidget *widget, -GtkRequisition *requisition, +static void on_window_size_allocate (GtkWidget *widget, +GtkAllocation *allocation,gpointer user_data) { -static gint old_h; -gint w, h; +gint h; -if (widget->window ==NULL ) -gtk_window_get_default_size (GTK_WINDOW (main_wnd), &w, &h); -else -gdk_window_get_size (widget->window, &w, &h); - -if (h == old_h) -return ; - old_h = h; + h = allocation->height;gtk_paned_set_position (GTK_PANED (vpaned),2 * h /3 ); }@@ -1000,8 +992,8 @@ static void init_main_window(const gchar *glade_file) main_wnd =glade_xml_get_widget (xml,"window1" );g_signal_connect (main_wnd,"destroy" ,G_CALLBACK (on_window1_destroy),NULL ); -g_signal_connect (main_wnd,"size_request" , -G_CALLBACK (on_window1_size_request),NULL ); +g_signal_connect (main_wnd,"size_allocate" , +G_CALLBACK (on_window_size_allocate),NULL );g_signal_connect (main_wnd,"delete_event" ,G_CALLBACK (on_window1_delete_event),NULL ); --2.43.0
Signature · 1 line
~Randy
Re: [PATCH 53/66] kconfig: gconf: use size_allocate event handler
Quoted 9 lines · Randy Dunlap
Quoted 5 lines · Masahiro Yamada
Quoted 4 lines · Masahiro Yamada
The
size_requestevent is not available in GTK 3. Use thesize_allocateevent handler instead.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Masahiro Yamada <[email protected]>---
This has a regression - with this, we cannot move the horizontal separator between in the right pane.
Between the menu items and the message area?
That's what I see.
Right.
The horizontal bar between the menu tree and the
help message area.
Before this patch series, you can drag it up and down using a mouse.
With v1 applied, you cannot move it.
This problem was fixed in v2.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 54/66 kconfig: gconf: replace GDK_space with GDK_KEY_space
In reply to Masahiro YamadaIn GTK3, keysyms changed to have a KEY_ prefix.
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gdk/gdkkeysyms-compat.h#L24
---
scripts/kconfig/gconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/gconf.c +1 -1
@@ -887,7 +887,7 @@ static gboolean on_treeview2_key_press_event(GtkWidget *widget,if (path ==NULL )return FALSE; -if (event->keyval == GDK_space) { +if (event->keyval == GDK_KEY_space) {if (gtk_tree_view_row_expanded (view, path))gtk_tree_view_collapse_row (view, path);else
Signature · 1 line
2.43.0
PATCH 55/66 kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
In reply to Masahiro YamadaThese are deprecated with GTK 3.10. [1]
Use "_OK", "_no", "_Cancel".
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.10.0/gtk/deprecated/gtkstock.h#L827
---
scripts/kconfig/gconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/kconfig/gconf.c +3 -3
@@ -686,11 +686,11 @@ static gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event, (GtkDialogFlags) (GTK_DIALOG_MODAL |GTK_DIALOG_DESTROY_WITH_PARENT ), -GTK_STOCK_OK , +"_OK" ,GTK_RESPONSE_YES , -GTK_STOCK_NO , +"_No" ,GTK_RESPONSE_NO , -GTK_STOCK_CANCEL , +"_Cancel" , GTK_RESPONSE_CANCEL, NULL);gtk_dialog_set_default_response (GTK_DIALOG (dialog),GTK_RESPONSE_CANCEL );
Signature · 1 line
2.43.0
Re: [PATCH 55/66] kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
Quoted 4 lines · Masahiro Yamada
These are deprecated with GTK 3.10. [1]
Use "
_OK", "_no", "_Cancel".
That's bad (on GTK) IMO. I would much rather see (and try to remember) a symbolic name than some half-random string.
Quoted 27 lines
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.10.0/gtk/deprecated/gtkstock.h#L827
Signed-off-by Masahiro Yamada <[email protected]>---
scripts/kconfig/gconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)scripts/kconfig/gconf.c +3
-3@@ -686,11 +686,11 @@ static gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event, (GtkDialogFlags) (GTK_DIALOG_MODAL |GTK_DIALOG_DESTROY_WITH_PARENT ), -GTK_STOCK_OK , +"_OK" ,GTK_RESPONSE_YES , -GTK_STOCK_NO , +"_No" ,GTK_RESPONSE_NO , -GTK_STOCK_CANCEL , +"_Cancel" , GTK_RESPONSE_CANCEL, NULL);gtk_dialog_set_default_response (GTK_DIALOG (dialog),GTK_RESPONSE_CANCEL );
Signature · 1 line
~Randy
PATCH 56/66 kconfig: gconf: remove "tooltips" property from glade
In reply to Masahiro YamadaThe tips are still displayed without this.
This property does not exist in GtkBuilder with GTK 3.
---
scripts/kconfig/gconf.glade | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/gconf.glade +0 -1
@@ -225,7 +225,6 @@ <property name="visible">True</property> <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> - <property name="tooltips">True</property> <property name="show_arrow">True</property> <child>
Signature · 1 line
2.43.0
PATCH 57/66 kconfig: gconf: replace "tooltip" property with "tooltip-text"
In reply to Masahiro YamadaThis was replaced with "tooltip-text" in GtkBuilder with GTK 3.
---
scripts/kconfig/gconf.glade | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
scripts/kconfig/gconf.glade +17 -17
@@ -40,7 +40,7 @@ <child> <widget class="GtkImageMenuItem" id="load1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Load a config file</property> + <property name="tooltip-text" translatable="yes">Load a config file</property> <property name="label" translatable="yes">_Load</property> <property name="use_underline">True</property> <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/>
@@ -50,7 +50,7 @@ <child> <widget class="GtkImageMenuItem" id="save1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Save the config in .config</property> + <property name="tooltip-text" translatable="yes">Save the config in .config</property> <property name="label" translatable="yes">_Save</property> <property name="use_underline">True</property> <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
@@ -60,7 +60,7 @@ <child> <widget class="GtkImageMenuItem" id="save_as1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Save the config in a file</property> + <property name="tooltip-text" translatable="yes">Save the config in a file</property> <property name="label" translatable="yes">Save _as</property> <property name="use_underline">True</property> </widget>
@@ -97,7 +97,7 @@ <child> <widget class="GtkCheckMenuItem" id="show_name1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Show name</property> + <property name="tooltip-text" translatable="yes">Show name</property> <property name="label" translatable="yes">Show _name</property> <property name="use_underline">True</property> <property name="active">False</property>
@@ -107,7 +107,7 @@ <child> <widget class="GtkCheckMenuItem" id="show_range1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Show range (Y/M/N)</property> + <property name="tooltip-text" translatable="yes">Show range (Y/M/N)</property> <property name="label" translatable="yes">Show _range</property> <property name="use_underline">True</property> <property name="active">False</property>
@@ -117,7 +117,7 @@ <child> <widget class="GtkCheckMenuItem" id="show_data1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Show value of the option</property> + <property name="tooltip-text" translatable="yes">Show value of the option</property> <property name="label" translatable="yes">Show _data</property> <property name="use_underline">True</property> <property name="active">False</property>
@@ -133,7 +133,7 @@ <child> <widget class="GtkRadioMenuItem" id="set_option_mode1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Show normal options</property> + <property name="tooltip-text" translatable="yes">Show normal options</property> <property name="label" translatable="yes">Show normal options</property> <property name="use_underline">True</property> <property name="active">True</property>
@@ -143,7 +143,7 @@ <child> <widget class="GtkRadioMenuItem" id="set_option_mode2"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Show all options</property> + <property name="tooltip-text" translatable="yes">Show all options</property> <property name="label" translatable="yes">Show all _options</property> <property name="use_underline">True</property> <property name="active">False</property>
@@ -154,7 +154,7 @@ <child> <widget class="GtkRadioMenuItem" id="set_option_mode3"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Show all options with prompts</property> + <property name="tooltip-text" translatable="yes">Show all options with prompts</property> <property name="label" translatable="yes">Show all prompt options</property> <property name="use_underline">True</property> <property name="active">False</property>
@@ -230,7 +230,7 @@ <child> <widget class="GtkToolButton" id="button1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> + <property name="tooltip-text" translatable="yes">Goes up of one level (single view)</property> <property name="label" translatable="yes">Back</property> <property name="use_underline">True</property> <property name="stock_id">gtk-undo</property>
@@ -266,7 +266,7 @@ <child> <widget class="GtkToolButton" id="button2"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Load a config file</property> + <property name="tooltip-text" translatable="yes">Load a config file</property> <property name="label" translatable="yes">Load</property> <property name="use_underline">True</property> <property name="stock_id">gtk-open</property>
@@ -283,7 +283,7 @@ <child> <widget class="GtkToolButton" id="button3"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Save a config file</property> + <property name="tooltip-text" translatable="yes">Save a config file</property> <property name="label" translatable="yes">Save</property> <property name="use_underline">True</property> <property name="stock_id">gtk-save</property>
@@ -319,7 +319,7 @@ <child> <widget class="GtkToolButton" id="button4"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Single view</property> + <property name="tooltip-text" translatable="yes">Single view</property> <property name="label" translatable="yes">Single</property> <property name="use_underline">True</property> <property name="stock_id">gtk-missing-image</property>
@@ -336,7 +336,7 @@ <child> <widget class="GtkToolButton" id="button5"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Split view</property> + <property name="tooltip-text" translatable="yes">Split view</property> <property name="label" translatable="yes">Split</property> <property name="use_underline">True</property> <property name="stock_id">gtk-missing-image</property>
@@ -353,7 +353,7 @@ <child> <widget class="GtkToolButton" id="button6"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Full view</property> + <property name="tooltip-text" translatable="yes">Full view</property> <property name="label" translatable="yes">Full</property> <property name="use_underline">True</property> <property name="stock_id">gtk-missing-image</property>
@@ -389,7 +389,7 @@ <child> <widget class="GtkToolButton" id="button7"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> + <property name="tooltip-text" translatable="yes">Collapse the whole tree in the right frame</property> <property name="label" translatable="yes">Collapse</property> <property name="use_underline">True</property> <property name="stock_id">gtk-remove</property>
@@ -406,7 +406,7 @@ <child> <widget class="GtkToolButton" id="button8"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> + <property name="tooltip-text" translatable="yes">Expand the whole tree in the right frame</property> <property name="label" translatable="yes">Expand</property> <property name="use_underline">True</property> <property name="stock_id">gtk-add</property>
Signature · 1 line
2.43.0
Re: [PATCH 57/66] kconfig: gconf: replace "tooltip" property with "tooltip-text"
Quoted 3 lines · Masahiro Yamada
This was replaced with "tooltip-text" in GtkBuilder with GTK 3.
Signed-off-by Masahiro Yamada <[email protected]>
One nit below:
Quoted 10 lines
---
scripts/kconfig/gconf.glade | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)scripts/kconfig/gconf.glade +0
-0
scripts/kconfig/gconf.glade line 233
Quoted 5 lines
scripts/kconfig/gconf.glade +1
-1@@ -230,7 +230,7 @@ <child> <widget class="GtkToolButton" id="button1"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> + <property name="tooltip-text" translatable="yes">Goes up of one level (single view)</property>
You didn't change the text here, but this would read better as
Goes up by one level
or
Goes up one level
I.e., drop the "of".
Signature · 1 line
~Randy
PATCH 58/66 kconfig: gconf: remove unnecessary default message in text view
In reply to Masahiro YamadaThis message looks odd because it is displayed when nothing is selected.
---
scripts/kconfig/gconf.glade | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/gconf.glade +0 -1
@@ -517,7 +517,6 @@ <property name="left_margin">0</property> <property name="right_margin">0</property> <property name="indent">0</property> - <property name="text" translatable="yes">Sorry, no help available for this option yet.</property> </widget> </child> </widget>
Signature · 1 line
2.43.0
PATCH 59/66 kconfig: gconf: use gtk_check_menu_item_get_active() accessor
In reply to Masahiro YamadaGTK 3 removes many implementation details and struct members from its public headers.
Use the gtk_check_menu_item_get_active() accessor.
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/compiling.sgml#L85
---
scripts/kconfig/gconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/kconfig/gconf.c +3 -3
@@ -493,7 +493,7 @@ static void on_show_name1_activate(GtkMenuItem *menuitem, gpointer user_data) {GtkTreeViewColumn *col; - show_name =GTK_CHECK_MENU_ITEM (menuitem)->active; + show_name =gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)); col =gtk_tree_view_get_column (GTK_TREE_VIEW (tree2_w),COL_NAME );if (col)gtk_tree_view_column_set_visible (col, show_name);
@@ -503,7 +503,7 @@ static void on_show_range1_activate(GtkMenuItem *menuitem, gpointer user_data) {GtkTreeViewColumn *col; - show_range =GTK_CHECK_MENU_ITEM (menuitem)->active; + show_range =gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)); col =gtk_tree_view_get_column (GTK_TREE_VIEW (tree2_w),COL_NO );if (col)gtk_tree_view_column_set_visible (col, show_range);
@@ -520,7 +520,7 @@ static void on_show_data1_activate(GtkMenuItem *menuitem, gpointer user_data) {GtkTreeViewColumn *col; - show_value =GTK_CHECK_MENU_ITEM (menuitem)->active; + show_value =gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)); col =gtk_tree_view_get_column (GTK_TREE_VIEW (tree2_w),COL_VALUE );if (col)gtk_tree_view_column_set_visible (col, show_value);
Signature · 1 line
2.43.0
PATCH 60/66 kconfig: gconf: use gtk_dialog_get_content_area() accessor
In reply to Masahiro YamadaGTK 3 removes many implementation details and struct members from its public headers.
Use the gtk_check_menu_item_get_active() accessor.
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/compiling.sgml#L85
---
scripts/kconfig/gconf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/gconf.c +3 -2
@@ -674,7 +674,7 @@ static void on_window_size_allocate(GtkWidget *widget,static gboolean on_window1_delete_event (GtkWidget *widget,GdkEvent *event,gpointer user_data) { -GtkWidget *dialog, *label; +GtkWidget *dialog, *label, *content_area;gint result;gint ret = FALSE;
@@ -696,7 +696,8 @@ static gboolean on_window1_delete_event(GtkWidget *widget, GdkEvent *event, GTK_RESPONSE_CANCEL); label =gtk_label_new ("\nSave configuration ?\n" ); -gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), label); + content_area =gtk_dialog_get_content_area (GTK_DIALOG (dialog)); +gtk_container_add (GTK_CONTAINER (content_area), label);gtk_widget_show (label); result =gtk_dialog_run (GTK_DIALOG (dialog));
Signature · 1 line
2.43.0
PATCH 61/66 kconfig: gconf: remove GtkHandleBox from glade
In reply to Masahiro YamadaGtkHandleBox is deprecated with GTK 3.4. [1]
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.4.0/gtk/deprecated/gtkhandlebox.c#L426
---
scripts/kconfig/gconf.glade | 9 --------- 1 file changed, 9 deletions(-)
scripts/kconfig/gconf.glade +0 -9
@@ -214,13 +214,6 @@ </child> <child> - <widget class="GtkHandleBox" id="handlebox1"> - <property name="visible">True</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - <property name="handle_position">GTK_POS_LEFT</property> - <property name="snap_edge">GTK_POS_TOP</property> - - <child> <widget class="GtkToolbar" id="toolbar1"> <property name="visible">True</property> <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
@@ -420,8 +413,6 @@ </packing> </child> </widget> - </child> - </widget> <packing> <property name="padding">0</property> <property name="expand">False</property>
Signature · 1 line
2.43.0
PATCH 62/66 kconfig: gconf: rename gconf.glade to gconf.ui
In reply to Masahiro YamadaThe next commit will convert this file to GtkBuilder format. Rename it in advance to reflect the intended format.
---
scripts/kconfig/gconf.c | 6 +++---
scripts/kconfig/{gconf.glade => gconf.ui} | 0
2 files changed, 3 insertions(+), 3 deletions(-)
rename scripts/kconfig/{gconf.glade => gconf.ui} (100%)scripts/kconfig/gconf.c +3 -3
@@ -1301,11 +1301,11 @@ int main(int ac, char *av[])/* Determine GUI path */ env =getenv (SRCTREE );if (env) - glade_file =g_strconcat (env,"/scripts/kconfig/gconf.glade" ,NULL ); + glade_file =g_strconcat (env,"/scripts/kconfig/gconf.ui" ,NULL );else if (av[0 ][0 ] =='/' ) - glade_file =g_strconcat (av[0 ],".glade" ,NULL ); + glade_file =g_strconcat (av[0 ],".ui" ,NULL );else - glade_file =g_strconcat (g_get_current_dir (),"/" , av[0 ],".glade" ,NULL ); + glade_file =g_strconcat (g_get_current_dir (),"/" , av[0 ],".ui" ,NULL );/* Conf stuffs */ if (ac >1 && av[1 ][0 ] =='-' ) {
scripts/kconfig/gconf.ui renamed from scripts/kconfig/gconf.glade +0 -0
Signature · 1 line
2.43.0
PATCH 63/66 kconfig: gconf: migrate to GTK 3
In reply to Masahiro YamadaThis commit switches from GTK 2.x to GTK 3, applying the following necessary changes:
- Do not include invidual headers
- GtkObject is gone
- Convert glade to GtkBuilder
[1]: https://docs.gtk.org/gtk3/migrating-2to3.html
---
scripts/kconfig/gconf-cfg.sh | 11 +- scripts/kconfig/gconf.c | 72 ++++++------- scripts/kconfig/gconf.ui | 200 +++++++++++++++++------------------ 3 files changed, 136 insertions(+), 147 deletions(-)
scripts/kconfig/gconf-cfg.sh +2 -9
@@ -6,7 +6,7 @@ set -eu cflags=$1 libs=$2 -PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" +PKG=gtk+-3.0 if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then echo >&2 "*"
@@ -18,18 +18,11 @@ fi if ! ${HOSTPKG_CONFIG} --exists $PKG; then echo >&2 "*" echo >&2 "* Unable to find the GTK+ installation. Please make sure that" - echo >&2 "* the GTK+ 2.0 development package is correctly installed." + echo >&2 "* the GTK 3 development package is correctly installed." echo >&2 "* You need $PKG" echo >&2 "*" exit 1 fi -if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then - echo >&2 "*" - echo >&2 "* GTK+ is present but version >= 2.0.0 is required." - echo >&2 "*" - exit 1 -fi - ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs}
scripts/kconfig/gconf.c +35 -37
193 lines not on this page · raw message
scripts/kconfig/gconf.ui +99 -101
581 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 64/66 kconfig: gconf: replace GtkVbox with GtkBox
In reply to Masahiro YamadaGtkVBox is deprecated with GTK 3.2. [1]
Use GtkBox instead.
[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.2.0/gtk/gtkvbox.c#L47
---
scripts/kconfig/gconf.ui | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/gconf.ui +2 -1
@@ -19,7 +19,8 @@ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <child> - <object class="GtkVBox" id="vbox1"> + <object class="GtkBox" id="vbox1"> + <property name="orientation">vertical</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property>
Signature · 1 line
2.43.0
PATCH 65/66 kconfig: gconf: replace GdkColor with GdkRGBA
In reply to Masahiro YamadaGdkColor is deprecated with GTK 3.14. [1]
Use GdkRGBA instead.
This fixes warnings such as:
scripts/kconfig/gconf.c: In function ‘set_node’:scripts/kconfig/gconf.c:138:9: warning: ‘gdk_color_parse’ is deprecated: Use 'gdk_rgba_parse' instead [-Wdeprecated-declarations]
138 | gdk_color_parse(menu_is_visible(menu) ? "Black" : "DarkGray", &color);
| ^~~~~~~~~~~~~~~[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.14.0/gdk/deprecated/gdkcolor.h#L52
---
scripts/kconfig/gconf.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
scripts/kconfig/gconf.c +11 -11
@@ -125,7 +125,7 @@ static void set_node(GtkTreeStore *tree, GtkTreeIter *node, struct menu *menu)const gchar *_mod ="" ;const gchar *_yes ="" ;const gchar *value ="" ; -GdkColor color; +GdkRGBA color;gboolean editable = FALSE;gboolean btnvis = FALSE;
@@ -135,7 +135,7 @@ static void set_node(GtkTreeStore *tree, GtkTreeIter *node, struct menu *menu) menu->type ==M_COMMENT ?"***" :"" , sym && !sym_has_value(sym) ? "(NEW)" : ""); -gdk_color_parse (menu_is_visible (menu) ?"Black" :"DarkGray" , &color); +gdk_rgba_parse (&color,menu_is_visible (menu) ?"Black" :"DarkGray" );if (!sym) goto set;
@@ -1148,7 +1148,7 @@ static void init_left_tree(void)G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_POINTER ,GDK_TYPE_COLOR , +G_TYPE_POINTER ,GDK_TYPE_RGBA ,G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
@@ -1179,7 +1179,7 @@ static void init_left_tree(void)gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,"text" ,COL_OPTION , -"foreground-gdk" , +"foreground-rgba" ,COL_COLOR ,NULL ); sel =gtk_tree_view_get_selection (view);
@@ -1199,7 +1199,7 @@ static void init_right_tree(void)G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING ,G_TYPE_STRING , -G_TYPE_POINTER ,GDK_TYPE_COLOR , +G_TYPE_POINTER ,GDK_TYPE_RGBA ,G_TYPE_BOOLEAN ,GDK_TYPE_PIXBUF ,G_TYPE_BOOLEAN ,G_TYPE_BOOLEAN , G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
@@ -1237,32 +1237,32 @@ static void init_right_tree(void)gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,"text" ,COL_OPTION , -"foreground-gdk" , +"foreground-rgba" ,COL_COLOR ,NULL ); renderer =gtk_cell_renderer_text_new ();gtk_tree_view_insert_column_with_attributes (view,-1 ,"Name" , renderer,"text" ,COL_NAME , -"foreground-gdk" , +"foreground-rgba" ,COL_COLOR ,NULL ); renderer =gtk_cell_renderer_text_new ();gtk_tree_view_insert_column_with_attributes (view,-1 ,"N" , renderer,"text" ,COL_NO , -"foreground-gdk" , +"foreground-rgba" ,COL_COLOR ,NULL ); renderer =gtk_cell_renderer_text_new ();gtk_tree_view_insert_column_with_attributes (view,-1 ,"M" , renderer,"text" ,COL_MOD , -"foreground-gdk" , +"foreground-rgba" ,COL_COLOR ,NULL ); renderer =gtk_cell_renderer_text_new ();gtk_tree_view_insert_column_with_attributes (view,-1 ,"Y" , renderer,"text" ,COL_YES , -"foreground-gdk" , +"foreground-rgba" ,COL_COLOR ,NULL ); renderer =gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes(view, -1,
@@ -1270,7 +1270,7 @@ static void init_right_tree(void)"text" ,COL_VALUE ,"editable" ,COL_EDIT , -"foreground-gdk" , +"foreground-rgba" , COL_COLOR, NULL);g_signal_connect (G_OBJECT (renderer),"edited" ,G_CALLBACK (renderer_edited), tree2_w);
Signature · 1 line
2.43.0
PATCH 66/66 kconfig: gconf: show GTK version in About dialog
In reply to Masahiro YamadaLikewise xconfig, it is useful to display the GTK version in the About dialog.
---
scripts/kconfig/gconf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/kconfig/gconf.c +5 -1
@@ -579,7 +579,11 @@ static void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data) dialog =gtk_message_dialog_new (GTK_WINDOW (main_wnd),GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO , -GTK_BUTTONS_CLOSE ,"%s" , about_text); +GTK_BUTTONS_CLOSE ,"%s\nGTK version: %d.%d.%d" , + about_text, +gtk_get_major_version (), +gtk_get_minor_version (), +gtk_get_micro_version ());gtk_dialog_run (GTK_DIALOG (dialog));gtk_widget_destroy (dialog); }
Signature · 1 line
2.43.0
Re: [PATCH 66/66] kconfig: gconf: show GTK version in About dialog
Quoted 4 lines · Masahiro Yamada
Likewise xconfig, it is useful to display the GTK version in the About dialog.
Signed-off-by Masahiro Yamada <[email protected]>
Quoted 22 lines
---
scripts/kconfig/gconf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)scripts/kconfig/gconf.c +5
-1@@ -579,7 +579,11 @@ static void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data) dialog =gtk_message_dialog_new (GTK_WINDOW (main_wnd),GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO , -GTK_BUTTONS_CLOSE ,"%s" , about_text); +GTK_BUTTONS_CLOSE ,"%s\nGTK version: %d.%d.%d" , + about_text, +gtk_get_major_version (), +gtk_get_minor_version (), +gtk_get_micro_version ());gtk_dialog_run (GTK_DIALOG (dialog));gtk_widget_destroy (dialog); }
Signature · 1 line
~Randy
Quoted 4 lines · Masahiro Yamada
[xconfig]
- small improvement for choice
Quoted 9 lines
[gconfig]
- Fix memory leak
- Lots of refactoring
- Migrate GTK 2 to GTK 3
- Fix all compile warnings
- Improve usability (grey out buttons, keep the item selection, etc.)
Hi,
I have tested all 65 patches here (omitting 52).
They worked well. Good job.
I will test your git tree/branch Monday/Tuesday.
I did notice one visual difference. The GTK+2 version of gconfig (before the patches) uses an alternating white/light gray background for the menu items while the GTK+3 version (after the patches) uses an all white background.
I prefer the alternating but it may be just some collateral damage in the name of progress. Or could be something else entirely!
Before you posted all of these gconfig patches, I was going to ask how many gconfig users are there? I don't see much on the mailing list about gconfig from users and suggest that maybe we should just drop it, but if you are OK with maintaining it and updating it like in this patch series, so be it.
I did seem to have found one gconfig user [1]. Maybe you are also a gconfig user.
[1] https://lore.kernel.org/linux-kbuild/[email protected]/
Quoted 86 lines
Masahiro Yamada (66):
kconfig: setMENU_CHANGEDto choice when the selected member is
changed
kconfig: qconf: do not show checkbox icon for choice
kconfig: qconf: show selected choice in the Value column
kconfig: renamemenu_get_parent_menu()to
menu_get_menu_or_parent_menu()
kconfig: re-addmenu_get_parent_menu()that returns parent menu
kconfig: gconf: make columns resizable
kconfig: gconf: fix potential memory leak inrenderer_edited()
kconfig: gconf: always destroy dialog inon_window1_delete_event()
kconfig: gconf: remove old #ifdefGTK_CHECK_VERSION
kconfig: gconf: remove empty if-block
kconfig: gconf: remove meaningless code ininit_main_window()
kconfig: gconf: remove unneededgtk_tree_view_set_headers_visible()
calls
kconfig: gconf: removegtk_tree_view_column_set_visible()calls
kconfig: gconf: removegtk_widget_realize()calls
kconfig: gconf: removegtk_tree_view_set_rules_hint()calls
kconfig: gconf: remove unnecessarygtk_set_locale()call
kconfig: gconf: remove internal-child="image" nodes from glade
kconfig: gconf: remove parents[] array and indent variable
kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2
kconfig: gconf: remove unneeded variable inon_split_clicked()
kconfig: gconf: remove unneeded variables in
on_treeview*_button_press_event()
kconfig: gconf: remove unused 'color' variable
kconfig: gconf: add static qualifiers to variables
kconfig: gconf: move init_*() functions below
kconfig: gconf: refactor view setting code
kconfig: gconf: grey out button for current view
kconfig: gconf: move the main window event handlers below
kconfig: gconf: move button1 initialization below
kconfig: gconf: add static qualifiers to event handlers
kconfig: gconf: removeglade_xml_signal_autoconnect()call
kconfig: gconf: makekey_press_eventwork in left pane too
kconfig: gconf: avoid hardcoding model2 in
on_treeview2_cursor_changed()
kconfig: gconf: avoid hardcoding model2 inrenderer_edited()
kconfig: gconf: avoid hardcoding model* in
on_treeview*_button_press_event()
kconfig: gconf: addon_save_clicked()event handler
kconfig: gconf: use GtkFileChooser inon_load1_activate()
kconfig: gconf: use GtkFileChooser inon_save_as1_activate()
kconfig: gconf: use GdkPixbuf inreplace_button_icon()
kconfig: gconf: refactorreplace_button_icon()
kconfig: gconf: make introduction, about, license dialogs modal
kconfig: gconf: remove global 'tree' variable
kconfig: gconf: merge 'current' and 'browsed' global variables
kconfig: gconf: preserve menu selection when switching view mode
kconfig: gconf: use GtkTreeModelFilter to control row visibility
kconfig: gconf: remove global 'model1' and 'model2' variables
kconfig: gconf: removeinit_tree_model()
kconfig: gconf: inlinefill_row()intoset_node()
kconfig: gconf: do not reconstruct tree store when a symbol is changed
kconfig: gconf: inlinedisplay_list()intoset_view_mode()
kconfig: gconf: remove dead code indisplay_tree_part()
kconfig: gconf: renamedisplay_tree_part()
kconfig: gconf: removefixup_rootmenu()
kconfig: gconf: usesize_allocateevent handler
kconfig: gconf: replaceGDK_spacewithGDK_KEY_space
kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
kconfig: gconf: remove "tooltips" property from glade
kconfig: gconf: replace "tooltip" property with "tooltip-text"
kconfig: gconf: remove unnecessary default message in text view
kconfig: gconf: usegtk_check_menu_item_get_active()accessor
kconfig: gconf: usegtk_dialog_get_content_area()accessor
kconfig: gconf: remove GtkHandleBox from glade
kconfig: gconf: rename gconf.glade to gconf.ui
kconfig: gconf: migrate to GTK 3
kconfig: gconf: replace GtkVbox with GtkBox
kconfig: gconf: replace GdkColor with GdkRGBA
kconfig: gconf: show GTK version in About dialogscripts/kconfig/conf.c | 2 +- scripts/kconfig/gconf-cfg.sh | 11 +- scripts/kconfig/gconf.c | 1828 ++++++++++----------- scripts/kconfig/{gconf.glade => gconf.ui} | 360 ++-- scripts/kconfig/lkc.h | 1 + scripts/kconfig/menu.c | 20 + scripts/kconfig/qconf.cc | 26 +- scripts/kconfig/symbol.c | 4 + 8 files changed, 1023 insertions(+), 1229 deletions(-) rename scripts/kconfig/{gconf.glade => gconf.ui} (57%)
Signature · 1 line
~Randy
Quoted 23 lines · Randy Dunlap
Quoted 4 lines · Masahiro Yamada
[xconfig]
- small improvement for choice
Quoted 9 lines
[gconfig]
- Fix memory leak
- Lots of refactoring
- Migrate GTK 2 to GTK 3
- Fix all compile warnings
- Improve usability (grey out buttons, keep the item selection, etc.)Hi,
I have tested all 65 patches here (omitting 52).
They worked well. Good job.
I will test your git tree/branch Monday/Tuesday.
Quoted 7 lines
I did notice one visual difference. The GTK+2 version of gconfig (before the patches) uses an alternating white/light gray background for the menu items while the GTK+3 version (after the patches) uses an all white background.
I prefer the alternating but it may be just some collateral damage in the name of progress. Or could be something else entirely!
I think
[PATCH 15/66] kconfig: gconf: remove gtk_tree_view_set_rules_hint() calls affected this.
gtk_tree_view_set_rules_hint() is deprecated.
The comment says "just do it in a theme"
https://gitlab.gnome.org/GNOME/gtk/-/blob/3.14.0/gtk/gtktreeview.c#L11875
But, I do not know which theme should be applied.
Quoted 8 lines
Before you posted all of these gconfig patches, I was going to ask how many gconfig users are there? I don't see much on the mailing list about gconfig from users and suggest that maybe we should just drop it, but if you are OK with maintaining it and updating it like in this patch series, so be it.
I did seem to have found one gconfig user [1]. Maybe you are also a gconfig user.
I keep it as far as I can maintain it.
I am not a heavy user of gconfig, but I maintain all front-ends for now.
Quoted 96 lines
[1] https://lore.kernel.org/linux-kbuild/[email protected]/
Quoted 75 lines
Masahiro Yamada (66):
kconfig: setMENU_CHANGEDto choice when the selected member is
changed
kconfig: qconf: do not show checkbox icon for choice
kconfig: qconf: show selected choice in the Value column
kconfig: renamemenu_get_parent_menu()to
menu_get_menu_or_parent_menu()
kconfig: re-addmenu_get_parent_menu()that returns parent menu
kconfig: gconf: make columns resizable
kconfig: gconf: fix potential memory leak inrenderer_edited()
kconfig: gconf: always destroy dialog inon_window1_delete_event()
kconfig: gconf: remove old #ifdefGTK_CHECK_VERSION
kconfig: gconf: remove empty if-block
kconfig: gconf: remove meaningless code ininit_main_window()
kconfig: gconf: remove unneededgtk_tree_view_set_headers_visible()
calls
kconfig: gconf: removegtk_tree_view_column_set_visible()calls
kconfig: gconf: removegtk_widget_realize()calls
kconfig: gconf: removegtk_tree_view_set_rules_hint()calls
kconfig: gconf: remove unnecessarygtk_set_locale()call
kconfig: gconf: remove internal-child="image" nodes from glade
kconfig: gconf: remove parents[] array and indent variable
kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2
kconfig: gconf: remove unneeded variable inon_split_clicked()
kconfig: gconf: remove unneeded variables in
on_treeview*_button_press_event()
kconfig: gconf: remove unused 'color' variable
kconfig: gconf: add static qualifiers to variables
kconfig: gconf: move init_*() functions below
kconfig: gconf: refactor view setting code
kconfig: gconf: grey out button for current view
kconfig: gconf: move the main window event handlers below
kconfig: gconf: move button1 initialization below
kconfig: gconf: add static qualifiers to event handlers
kconfig: gconf: removeglade_xml_signal_autoconnect()call
kconfig: gconf: makekey_press_eventwork in left pane too
kconfig: gconf: avoid hardcoding model2 in
on_treeview2_cursor_changed()
kconfig: gconf: avoid hardcoding model2 inrenderer_edited()
kconfig: gconf: avoid hardcoding model* in
on_treeview*_button_press_event()
kconfig: gconf: addon_save_clicked()event handler
kconfig: gconf: use GtkFileChooser inon_load1_activate()
kconfig: gconf: use GtkFileChooser inon_save_as1_activate()
kconfig: gconf: use GdkPixbuf inreplace_button_icon()
kconfig: gconf: refactorreplace_button_icon()
kconfig: gconf: make introduction, about, license dialogs modal
kconfig: gconf: remove global 'tree' variable
kconfig: gconf: merge 'current' and 'browsed' global variables
kconfig: gconf: preserve menu selection when switching view mode
kconfig: gconf: use GtkTreeModelFilter to control row visibility
kconfig: gconf: remove global 'model1' and 'model2' variables
kconfig: gconf: removeinit_tree_model()
kconfig: gconf: inlinefill_row()intoset_node()
kconfig: gconf: do not reconstruct tree store when a symbol is changed
kconfig: gconf: inlinedisplay_list()intoset_view_mode()
kconfig: gconf: remove dead code indisplay_tree_part()
kconfig: gconf: renamedisplay_tree_part()
kconfig: gconf: removefixup_rootmenu()
kconfig: gconf: usesize_allocateevent handler
kconfig: gconf: replaceGDK_spacewithGDK_KEY_space
kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
kconfig: gconf: remove "tooltips" property from glade
kconfig: gconf: replace "tooltip" property with "tooltip-text"
kconfig: gconf: remove unnecessary default message in text view
kconfig: gconf: usegtk_check_menu_item_get_active()accessor
kconfig: gconf: usegtk_dialog_get_content_area()accessor
kconfig: gconf: remove GtkHandleBox from glade
kconfig: gconf: rename gconf.glade to gconf.ui
kconfig: gconf: migrate to GTK 3
kconfig: gconf: replace GtkVbox with GtkBox
kconfig: gconf: replace GdkColor with GdkRGBA
kconfig: gconf: show GTK version in About dialogQuoted 11 lines
scripts/kconfig/conf.c | 2 +- scripts/kconfig/gconf-cfg.sh | 11 +- scripts/kconfig/gconf.c | 1828 ++++++++++----------- scripts/kconfig/{gconf.glade => gconf.ui} | 360 ++-- scripts/kconfig/lkc.h | 1 + scripts/kconfig/menu.c | 20 + scripts/kconfig/qconf.cc | 26 +- scripts/kconfig/symbol.c | 4 + 8 files changed, 1023 insertions(+), 1229 deletions(-) rename scripts/kconfig/{gconf.glade => gconf.ui} (57%)--
~Randy
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 29 lines · Masahiro Yamada
Quoted 28 lines · Randy Dunlap
Quoted 4 lines · Masahiro Yamada
[xconfig]
- small improvement for choice
Quoted 9 lines
[gconfig]
- Fix memory leak
- Lots of refactoring
- Migrate GTK 2 to GTK 3
- Fix all compile warnings
- Improve usability (grey out buttons, keep the item selection, etc.)Hi,
I have tested all 65 patches here (omitting 52).
They worked well. Good job.
I will test your git tree/branch Monday/Tuesday.I did notice one visual difference. The GTK+2 version of gconfig (before the patches) uses an alternating white/light gray background for the menu items while the GTK+3 version (after the patches) uses an all white background.
Quoted 8 lines
Quoted 2 lines
I prefer the alternating but it may be just some collateral damage in the name of progress. Or could be something else entirely!
I think
[PATCH 15/66] kconfig: gconf: removegtk_tree_view_set_rules_hint()calls affected this.
Yes, that likely did it.
Quoted 7 lines
gtk_tree_view_set_rules_hint()is deprecated.The comment says "just do it in a theme"
https://gitlab.gnome.org/GNOME/gtk/-/blob/3.14.0/gtk/gtktreeview.c#L11875But, I do not know which theme should be applied.
Agreed. I didn't find any help on that subject either.
Thanks.
Signature · 1 line
~Randy