summaryrefslogtreecommitdiff
path: root/scripts/kconfig/gconf.c
AgeCommit message (Collapse)Author
2025-07-26kconfig: gconf: refactor text_insert_help()Masahiro Yamada
text_insert_help() and text_insert_msg() share similar code. Refactor text_insert_help() to eliminate the code duplication. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26kconfig: gconf: remove unneeded variable in text_insert_msgMasahiro Yamada
The 'msg' and 'message' refer to the same pointer. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26kconfig: gconf: use hyphens in signalsMasahiro Yamada
Using hyphens in signal names is the official convention, even though underscores also work. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26kconfig: gconf: Fix Back button behaviorMasahiro Yamada
Clicking the Back button may navigate to a non-menu hierarchy level. [Example] menu "menu1" config A bool "A" default y config B bool "B" depends on A default y menu "menu2" depends on B config C bool "C" default y endmenu endmenu After being re-parented by menu_finalize(), the menu tree is structured like follows: menu "menu1" \-- A \-- B \-- menu "menu2" \-- C In Single view, visit "menu2" and click the Back button. It should go up to "menu1" and show A, B and "menu2", but instead goes up to A and show only B and "menu2". This is a bug in on_back_clicked(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26kconfig: gconf: fix single view to display dependent symbols correctlyMasahiro Yamada
In the following example, the symbol C was never displayed in Single view. Fix the recursion logic so that all symbols are shown. menu "menu" config A bool "A" config B bool "B" depends on A config C bool "C" depends on B endmenu Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26kconfig: gconf: show GTK version in About dialogMasahiro Yamada
Likewise xconfig, it is useful to display the GTK version in the About dialog. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26kconfig: gconf: replace GdkColor with GdkRGBAMasahiro Yamada
GdkColor 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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26kconfig: gconf: migrate to GTK 3Masahiro Yamada
This commit switches from GTK 2.x to GTK 3, applying the following necessary changes: - Do not include individual headers - GtkObject is gone - Convert Glade to GtkBuilder Link: https://docs.gtk.org/gtk3/migrating-2to3.html Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26kconfig: gconf: rename gconf.glade to gconf.uiMasahiro Yamada
The next commit will convert this file to GtkBuilder format. Rename it in advance to reflect the intended format. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26kconfig: gconf: rename display_tree_part()Masahiro Yamada
This function recreates the tree store to update the menu content. Rename it to recreate_tree() to better reflect its purpose. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26kconfig: gconf: use configure-event handler to adjust pane separatorMasahiro Yamada
The size-request event handler is currently used to adjust the position of the horizontal separator in the right pane. However, the size-request signal is not available in GTK 3. Use the configure-event signal instead. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26kconfig: gconf: fix behavior of a menu under a symbol in split viewMasahiro Yamada
A menu can be created under a symbol. [Example] menu "outer menu" config A bool "A" menu "inner menu" depends on A config B bool "B" endmenu endmenu After being re-parented by menu_finalize(), the menu tree is structured like follows: menu "outer menu" \-- A \-- menu "inner menu" \-- B In split view, the symbol A is shown in the right pane, so all of its descendants must also be shown there. This has never worked correctly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: use gtk_dialog_get_content_area() accessorMasahiro Yamada
GTK 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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: use gtk_check_menu_item_get_active() accessorMasahiro Yamada
GTK 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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}Masahiro Yamada
These 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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: replace GDK_space with GDK_KEY_spaceMasahiro Yamada
In GTK3, keysyms changed to have a KEY_ prefix. [1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gdk/gdkkeysyms-compat.h#L24 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: remove dead code in display_tree_part()Masahiro Yamada
This function is no longer called in the FULL_VIEW mode, so remove the dead code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: inline display_list() into set_view_mode()Masahiro Yamada
This function is now only called by set_view_mode(), so inline it for simplicity. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: do not reconstruct tree store when a symbol is changedMasahiro Yamada
There 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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: inline fill_row() into set_node()Masahiro Yamada
The 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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: remove init_tree_model()Masahiro Yamada
Move the relevant code into init_left_tree() or init_right_tree(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: remove global 'model1' and 'model2' variablesMasahiro Yamada
These variables are unnecessary because the current model can be retrieved using gtk_tree_view_get_model(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02kconfig: gconf: use GtkTreeModelFilter to control row visibilityMasahiro Yamada
Currently, 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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: preserve menu selection when switching view modeMasahiro Yamada
Preserve the current menu selection when switching to a different view mode, as it improves usability. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: merge 'current' and 'browsed' global variablesMasahiro Yamada
The 'current' (SINGLE view) and 'browsed' (SPLIT_VIEW) variables serve similar purposes and are not needed at the same time. Merge them. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: remove global 'tree' variableMasahiro Yamada
Pass the tree store as a function parameter to make it clearer which tree is being updated. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: make introduction, about, license dialogs modalMasahiro Yamada
These are modal dialogs in xconfig. Make them modal in gconfig as well. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02kconfig: gconf: refactor replace_button_icon()Masahiro Yamada
The "window" and "style" arguments for replace_button_icon() are now unused. Remove them and refactor the function accordingly. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: use GdkPixbuf in replace_button_icon()Masahiro Yamada
gdk_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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: use GtkFileChooser in on_save_as1_activate()Masahiro Yamada
gtk_file_selection_new() is deprecated, and gtk_file_chooser_dialog_new() should be used instead. [1] [1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/tmpl/gtkfilesel.sgml?ref_type=tags#L156 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02kconfig: gconf: use GtkFileChooser in on_load1_activate()Masahiro Yamada
gtk_file_selection_new() is deprecated, and gtk_file_chooser_dialog_new() should be used instead. [1] [1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/tmpl/gtkfilesel.sgml?ref_type=tags#L156 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02kconfig: gconf: add on_save_clicked() event handlerMasahiro Yamada
The "clicked" event handler for GtkToolButton takes the GtkToolButton* as the first parameter. This is different from the existing on_save_activate() handler. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: avoid hardcoding model* in on_treeview*_button_press_event()Masahiro Yamada
It is better not to hardcode model1 or model2 for consistency. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: avoid hardcoding model2 in renderer_edited()Masahiro Yamada
Although this is only used in the right tree view, it is better not to hardcode model2 for consistency. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()Masahiro Yamada
The 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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: make key_press_event work in left pane tooMasahiro Yamada
Currently, 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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: remove glade_xml_signal_autoconnect() callMasahiro Yamada
Now that all signals are connected manually, this is no longer necessary. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: add static qualifiers to event handlersMasahiro Yamada
This fixes several -Wmissing-prototypes warnings. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02kconfig: gconf: move button1 and save1 initialization codeMasahiro Yamada
Move the relevant initialization code closer together. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: move the main window event handlers belowMasahiro Yamada
This allows removal of the forward delcaration of on_save_activate(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02kconfig: gconf: grey out button for current viewMasahiro Yamada
This clarifies which view is currently selected. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02kconfig: gconf: refactor view setting codeMasahiro Yamada
Factor out common code for setting the view into a new function, set_view_mode(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01kconfig: gconf: move init_*() functions belowMasahiro Yamada
This allows removal of the forward declaration of renderer_edited(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: add static qualifiers to variablesMasahiro Yamada
I also removed unnecessary initializers. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: remove unused 'color' variableMasahiro Yamada
This is not used at all. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: remove unneeded variables in on_treeview*_button_press_event()Masahiro Yamada
Not 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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: remove unneeded variable in on_split_clicked()Masahiro Yamada
The 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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2Masahiro Yamada
The tree1 and tree2 variables are initialized earlier in init_tree_model(), so the NULL checks are redundant. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: remove parents[] array and indent variableMasahiro Yamada
The 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. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01kconfig: gconf: remove unnecessary gtk_set_locale() callMasahiro Yamada
gtk_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 Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>