Commit Graph

9069 Commits

Author SHA1 Message Date
Masahiro Yamada
ea1438f720 kconfig: gconf: remove unnecessary default message in text view
This message looks odd because it is displayed when nothing is selected.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:36:06 +09:00
Masahiro Yamada
9d0e47c4c8 kconfig: gconf: replace "tooltip" property with "tooltip-text"
This is no longer available in GTK 3. Use "tooltip-text" instead.

Also reword "Goes up of one level" to "Goes up one level" while I am
here.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:33:47 +09:00
Masahiro Yamada
ad452c27ae kconfig: gconf: remove "tooltips" property from glade
The tips are still displayed without this.

This property does not exist in GtkBuilder with GTK 3.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada
7783290143 kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
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-02 11:11:52 +09:00
Masahiro Yamada
475c878f97 kconfig: gconf: replace GDK_space with GDK_KEY_space
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-02 11:11:52 +09:00
Masahiro Yamada
bf5792da5a kconfig: gconf: remove dead code in display_tree_part()
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-02 11:11:52 +09:00
Masahiro Yamada
063a274a5e kconfig: gconf: inline display_list() into set_view_mode()
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-02 11:11:52 +09:00
Masahiro Yamada
035c2f56f5 kconfig: gconf: do not reconstruct tree store when a symbol is changed
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-02 11:11:52 +09:00
Masahiro Yamada
64285dc5c4 kconfig: gconf: inline fill_row() into set_node()
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-02 11:11:52 +09:00
Masahiro Yamada
ed332436f3 kconfig: gconf: remove init_tree_model()
Move the relevant code into init_left_tree() or init_right_tree().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada
b674af6ec8 kconfig: gconf: remove global 'model1' and 'model2' variables
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-02 11:11:52 +09:00
Masahiro Yamada
e379547936 kconfig: gconf: use GtkTreeModelFilter to control row visibility
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-02 11:11:52 +09:00
Masahiro Yamada
ab026457d3 kconfig: gconf: preserve menu selection when switching view mode
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-02 11:11:48 +09:00
Masahiro Yamada
ecaa87d4e9 kconfig: gconf: merge 'current' and 'browsed' global variables
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-02 10:39:31 +09:00
Masahiro Yamada
1bd81df0b1 kconfig: gconf: remove global 'tree' variable
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-02 10:38:28 +09:00
Masahiro Yamada
20f375cbfe kconfig: gconf: make introduction, about, license dialogs modal
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-02 10:36:15 +09:00
Masahiro Yamada
b8f660aabc kconfig: gconf: refactor replace_button_icon()
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-02 10:36:15 +09:00
Masahiro Yamada
9517f47dbf kconfig: gconf: use GdkPixbuf in replace_button_icon()
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-02 10:36:15 +09:00
Masahiro Yamada
fd7fd8024c kconfig: gconf: use GtkFileChooser in on_save_as1_activate()
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-02 10:36:15 +09:00
Masahiro Yamada
30dda0fdf7 kconfig: gconf: use GtkFileChooser in on_load1_activate()
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-02 10:36:15 +09:00
Masahiro Yamada
4d89059a72 kconfig: gconf: add on_save_clicked() event handler
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-02 10:36:15 +09:00
Masahiro Yamada
59adbcd805 kconfig: gconf: avoid hardcoding model* in on_treeview*_button_press_event()
It is better not to hardcode model1 or model2 for consistency.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada
e6991e8004 kconfig: gconf: avoid hardcoding model2 in renderer_edited()
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-02 10:36:14 +09:00
Masahiro Yamada
cae9cdbcd9 kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
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-02 10:36:14 +09:00
Masahiro Yamada
3beae86595 kconfig: gconf: make key_press_event work in left pane too
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-02 10:36:14 +09:00
Masahiro Yamada
e06b176bf1 kconfig: gconf: remove glade_xml_signal_autoconnect() call
Now that all signals are connected manually, this is no longer
necessary.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
77e8ff9889 kconfig: gconf: add static qualifiers to event handlers
This fixes several -Wmissing-prototypes warnings.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
f0049c937d kconfig: gconf: move button1 and save1 initialization code
Move the relevant initialization code closer together.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada
3e0fb3ef01 kconfig: gconf: move the main window event handlers below
This allows removal of the forward delcaration of on_save_activate().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:13 +09:00
Masahiro Yamada
b22bbaea7f kconfig: gconf: grey out button for current view
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-02 10:34:57 +09:00
Masahiro Yamada
8d6b5c14ab kconfig: gconf: refactor view setting code
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-02 10:34:02 +09:00
Masahiro Yamada
7ef533938e kconfig: gconf: move init_*() functions below
This allows removal of the forward declaration of renderer_edited().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
290fc035df kconfig: gconf: add static qualifiers to variables
I also removed unnecessary initializers.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
b4809e25e2 kconfig: gconf: remove unused 'color' variable
This is not used at all.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:35 +09:00
Masahiro Yamada
57b63d17f7 kconfig: gconf: remove unneeded variables in on_treeview*_button_press_event()
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-01 20:07:35 +09:00
Masahiro Yamada
8e3136eb27 kconfig: gconf: remove unneeded variable in on_split_clicked()
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-01 20:07:34 +09:00
Masahiro Yamada
9b8338fd45 kconfig: gconf: remove unnecessary NULL checks for tree1 and tree2
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-01 20:07:34 +09:00
Masahiro Yamada
b3841b501c kconfig: gconf: remove parents[] array and indent variable
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-01 20:07:34 +09:00
Masahiro Yamada
a54b0397d3 kconfig: gconf: remove internal-child="image" nodes from glade
These nodes do not appear to serve anything useful.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
f931a5d37a kconfig: gconf: remove unnecessary gtk_set_locale() call
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>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
ace8bee836 kconfig: gconf: remove gtk_tree_view_set_rules_hint() calls
The 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

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
dc1de6c03b kconfig: gconf: remove gtk_widget_realize() calls
This function is primarily used in widget implementations, and isn't
very useful otherwise.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
ede0a43249 kconfig: gconf: remove gtk_tree_view_column_set_visible() calls
The columns are visible by default.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
0872643688 kconfig: gconf: remove unneeded gtk_tree_view_set_headers_visible() calls
The headers are visible by default.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
5575df3d3a kconfig: gconf: remove meaningless code in init_main_window()
The 'widget' variable is set, but not used in later code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
ab2924ab5e kconfig: gconf: remove empty if-block
This if-block is empty.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
bff576a2a9 kconfig: gconf: remove old #ifdef GTK_CHECK_VERSION
Remove old code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-01 20:07:34 +09:00
Masahiro Yamada
02bb13bd6c kconfig: gconf: always destroy dialog in on_window1_delete_event()
When gtk_dialog_run() returns GTK_RESPONSE_YES or GTK_RESPONSE_NO,
gtk_widget_destroy() is not called, resulting in a memory leak.

It is better to always destroy the dialog, even if the application
is about to exit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-01 20:07:25 +09:00
Masahiro Yamada
f72ed4c6a3 kconfig: gconf: fix potential memory leak in renderer_edited()
If gtk_tree_model_get_iter() fails, gtk_tree_path_free() is not called.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 13:20:56 +09:00
Masahiro Yamada
2f2d60f489 kconfig: gconf: make columns resizable
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 <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-06-30 13:20:42 +09:00