All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly
@ 2025-07-16 23:24 Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 2/6] kconfig: gconf: Fix Back button behavior Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-07-16 23:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

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>
---

 scripts/kconfig/gconf.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 7725d2c9d92a..c67b35807e8e 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -914,9 +914,7 @@ static gboolean on_treeview1_button_press_event(GtkWidget *widget,
 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) {
@@ -929,9 +927,6 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu,
 		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;
@@ -943,16 +938,7 @@ static void _display_tree(GtkTreeStore *tree, struct menu *menu,
 		gtk_tree_store_append(tree, &iter, parent);
 		set_node(tree, &iter, child);
 
-		if ((view_mode == SINGLE_VIEW) && (ptype == P_MENU))
-			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))
+		if (view_mode != SINGLE_VIEW || child->type != M_MENU)
 			_display_tree(tree, child, &iter);
 	}
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/6] kconfig: gconf: Fix Back button behavior
  2025-07-16 23:24 [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly Masahiro Yamada
@ 2025-07-16 23:24 ` Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 3/6] kconfig: gconf: replace GtkImageMenuItem with GtkMenuItem Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-07-16 23:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

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>
---

 scripts/kconfig/gconf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index c67b35807e8e..d9ea71664412 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -553,12 +553,8 @@ static void on_license1_activate(GtkMenuItem *menuitem, gpointer user_data)
 /* toolbar handlers */
 static void on_back_clicked(GtkButton *button, gpointer user_data)
 {
-	enum prop_type ptype;
+	browsed = menu_get_parent_menu(browsed) ?: &rootmenu;
 
-	browsed = browsed->parent;
-	ptype = browsed->prompt ? browsed->prompt->type : P_UNKNOWN;
-	if (ptype != P_MENU)
-		browsed = browsed->parent;
 	recreate_tree();
 
 	if (browsed == &rootmenu)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/6] kconfig: gconf: replace GtkImageMenuItem with GtkMenuItem
  2025-07-16 23:24 [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 2/6] kconfig: gconf: Fix Back button behavior Masahiro Yamada
@ 2025-07-16 23:24 ` Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 4/6] kconfig: gconf: use hyphens in signals Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-07-16 23:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

GtkImageMenuItem is deprecated with GTK 3.10. [1]

Use GtkMenuItem instead.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.10.0/gtk/deprecated/gtkimagemenuitem.c#L797

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/gconf.ui | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/gconf.ui b/scripts/kconfig/gconf.ui
index c37807e8b782..ab4431255fa7 100644
--- a/scripts/kconfig/gconf.ui
+++ b/scripts/kconfig/gconf.ui
@@ -39,7 +39,7 @@
 		<object class="GtkMenu" id="file1_menu">
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="load1">
+		    <object class="GtkMenuItem" id="load1">
 		      <property name="visible">True</property>
 		      <property name="tooltip-text" translatable="yes">Load a config file</property>
 		      <property name="label" translatable="yes">_Load</property>
@@ -49,7 +49,7 @@
 		  </child>
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="save1">
+		    <object class="GtkMenuItem" id="save1">
 		      <property name="visible">True</property>
 		      <property name="tooltip-text" translatable="yes">Save the config in .config</property>
 		      <property name="label" translatable="yes">_Save</property>
@@ -59,7 +59,7 @@
 		  </child>
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="save_as1">
+		    <object class="GtkMenuItem" id="save_as1">
 		      <property name="visible">True</property>
 		      <property name="tooltip-text" translatable="yes">Save the config in a file</property>
 		      <property name="label" translatable="yes">Save _as</property>
@@ -74,7 +74,7 @@
 		  </child>
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="quit1">
+		    <object class="GtkMenuItem" id="quit1">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">_Quit</property>
 		      <property name="use_underline">True</property>
@@ -178,7 +178,7 @@
 		<object class="GtkMenu" id="help1_menu">
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="introduction1">
+		    <object class="GtkMenuItem" id="introduction1">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">_Introduction</property>
 		      <property name="use_underline">True</property>
@@ -187,7 +187,7 @@
 		  </child>
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="about1">
+		    <object class="GtkMenuItem" id="about1">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">_About</property>
 		      <property name="use_underline">True</property>
@@ -196,7 +196,7 @@
 		  </child>
 
 		  <child>
-		    <object class="GtkImageMenuItem" id="license1">
+		    <object class="GtkMenuItem" id="license1">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">_License</property>
 		      <property name="use_underline">True</property>
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/6] kconfig: gconf: use hyphens in signals
  2025-07-16 23:24 [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 2/6] kconfig: gconf: Fix Back button behavior Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 3/6] kconfig: gconf: replace GtkImageMenuItem with GtkMenuItem Masahiro Yamada
@ 2025-07-16 23:24 ` Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 5/6] kconfig: gconf: remove unneeded variable in text_insert_msg Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 6/6] kconfig: gconf: refactor text_insert_help() Masahiro Yamada
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-07-16 23:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

Using hyphens in signal names is the official convention, even though
underscores also work.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/gconf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index d9ea71664412..e4f89270d19f 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -997,25 +997,25 @@ static void init_main_window(const gchar *glade_file)
 			 G_CALLBACK(on_window1_destroy), NULL);
 	g_signal_connect(main_wnd, "configure-event",
 			 G_CALLBACK(on_window1_configure), NULL);
-	g_signal_connect(main_wnd, "delete_event",
+	g_signal_connect(main_wnd, "delete-event",
 			 G_CALLBACK(on_window1_delete_event), NULL);
 
 	hpaned = GTK_WIDGET(gtk_builder_get_object(builder, "hpaned1"));
 	vpaned = GTK_WIDGET(gtk_builder_get_object(builder, "vpaned1"));
 	tree1_w = GTK_WIDGET(gtk_builder_get_object(builder, "treeview1"));
-	g_signal_connect(tree1_w, "cursor_changed",
+	g_signal_connect(tree1_w, "cursor-changed",
 			 G_CALLBACK(on_treeview2_cursor_changed), NULL);
-	g_signal_connect(tree1_w, "button_press_event",
+	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_signal_connect(tree1_w, "key-press-event",
 			 G_CALLBACK(on_treeview2_key_press_event), NULL);
 
 	tree2_w = GTK_WIDGET(gtk_builder_get_object(builder, "treeview2"));
-	g_signal_connect(tree2_w, "cursor_changed",
+	g_signal_connect(tree2_w, "cursor-changed",
 			 G_CALLBACK(on_treeview2_cursor_changed), NULL);
-	g_signal_connect(tree2_w, "button_press_event",
+	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_signal_connect(tree2_w, "key-press-event",
 			 G_CALLBACK(on_treeview2_key_press_event), NULL);
 
 	text_w = GTK_WIDGET(gtk_builder_get_object(builder, "textview3"));
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/6] kconfig: gconf: remove unneeded variable in text_insert_msg
  2025-07-16 23:24 [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly Masahiro Yamada
                   ` (2 preceding siblings ...)
  2025-07-16 23:24 ` [PATCH 4/6] kconfig: gconf: use hyphens in signals Masahiro Yamada
@ 2025-07-16 23:24 ` Masahiro Yamada
  2025-07-16 23:24 ` [PATCH 6/6] kconfig: gconf: refactor text_insert_help() Masahiro Yamada
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-07-16 23:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

The 'msg' and 'message' refer to the same pointer.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/gconf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index e4f89270d19f..651140af7d13 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -90,11 +90,10 @@ static void text_insert_help(struct menu *menu)
 }
 
 
-static void text_insert_msg(const char *title, const char *message)
+static void text_insert_msg(const char *title, const char *msg)
 {
 	GtkTextBuffer *buffer;
 	GtkTextIter start, end;
-	const char *msg = message;
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
 	gtk_text_buffer_get_bounds(buffer, &start, &end);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 6/6] kconfig: gconf: refactor text_insert_help()
  2025-07-16 23:24 [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly Masahiro Yamada
                   ` (3 preceding siblings ...)
  2025-07-16 23:24 ` [PATCH 5/6] kconfig: gconf: remove unneeded variable in text_insert_msg Masahiro Yamada
@ 2025-07-16 23:24 ` Masahiro Yamada
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2025-07-16 23:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

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>
---

 scripts/kconfig/gconf.c | 35 +++++++++--------------------------
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 651140af7d13..8b164ccfa008 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -64,32 +64,6 @@ static void conf_changed(bool dirty)
 
 /* Utility Functions */
 
-
-static void text_insert_help(struct menu *menu)
-{
-	GtkTextBuffer *buffer;
-	GtkTextIter start, end;
-	const char *prompt = menu_get_prompt(menu);
-	struct gstr help = str_new();
-
-	menu_get_ext_help(menu, &help);
-
-	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
-	gtk_text_buffer_get_bounds(buffer, &start, &end);
-	gtk_text_buffer_delete(buffer, &start, &end);
-	gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15);
-
-	gtk_text_buffer_get_end_iter(buffer, &end);
-	gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1,
-					 NULL);
-	gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2);
-	gtk_text_buffer_get_end_iter(buffer, &end);
-	gtk_text_buffer_insert_with_tags(buffer, &end, str_get(&help), -1, tag2,
-					 NULL);
-	str_free(&help);
-}
-
-
 static void text_insert_msg(const char *title, const char *msg)
 {
 	GtkTextBuffer *buffer;
@@ -109,6 +83,15 @@ static void text_insert_msg(const char *title, const char *msg)
 					 NULL);
 }
 
+static void text_insert_help(struct menu *menu)
+{
+	struct gstr help = str_new();
+
+	menu_get_ext_help(menu, &help);
+	text_insert_msg(menu_get_prompt(menu), str_get(&help));
+	str_free(&help);
+}
+
 static void _select_menu(GtkTreeView *view, GtkTreeModel *model,
 			 GtkTreeIter *parent, struct menu *match)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-16 23:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 23:24 [PATCH 1/6] kconfig: gconf: fix single view to display dependent symbols correctly Masahiro Yamada
2025-07-16 23:24 ` [PATCH 2/6] kconfig: gconf: Fix Back button behavior Masahiro Yamada
2025-07-16 23:24 ` [PATCH 3/6] kconfig: gconf: replace GtkImageMenuItem with GtkMenuItem Masahiro Yamada
2025-07-16 23:24 ` [PATCH 4/6] kconfig: gconf: use hyphens in signals Masahiro Yamada
2025-07-16 23:24 ` [PATCH 5/6] kconfig: gconf: remove unneeded variable in text_insert_msg Masahiro Yamada
2025-07-16 23:24 ` [PATCH 6/6] kconfig: gconf: refactor text_insert_help() Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.