[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a663788-f67f-452a-93df-74654e9712bc@infradead.org>
Date: Sun, 29 Jun 2025 20:14:38 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Masahiro Yamada <masahiroy@...nel.org>, linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 36/66] kconfig: gconf: use GtkFileChooser in
on_load1_activate()
On 6/24/25 8:05 AM, Masahiro Yamada wrote:
> 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@...nel.org>
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.
Acked-by: Randy Dunlap <rdunlap@...radead.org>
Tested-by: Randy Dunlap <rdunlap@...radead.org>
> ---
>
> scripts/kconfig/gconf.c | 58 ++++++++++++++++++++---------------------
> 1 file changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
> index 8c60b9f25eaa..f33f39d50f3d 100644
> --- a/scripts/kconfig/gconf.c
> +++ b/scripts/kconfig/gconf.c
> @@ -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)
--
~Randy
Powered by blists - more mailing lists