summaryrefslogtreecommitdiffstats
path: root/util/kconfig/gconf.c
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-11-22 16:55:58 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-07-13 20:28:14 +0000
commit53ea1d44f0435ca419de04e275e08b1bd296922c (patch)
treec1a3a39c36e9b53d0129f0e24a9a032bfea066ca /util/kconfig/gconf.c
parent8585eabc5d5b516f46b2980a40b25f49eef5e056 (diff)
downloadcoreboot-53ea1d44f0435ca419de04e275e08b1bd296922c.tar.gz
coreboot-53ea1d44f0435ca419de04e275e08b1bd296922c.tar.bz2
coreboot-53ea1d44f0435ca419de04e275e08b1bd296922c.zip
util/kconfig: Uprev to Linux 5.13's kconfig
This was originally several commits that had to be squashed into one because the intermediate states weren't able to build coreboot: - one to remove everything that wasn't our own code, leaving only regex.[ch], toada.c, description.md and Makefile.inc. - one to copy in Linux 5.13's scripts/kconfig and adapt Makefile.inc to make the original Makefile work again. - adapt abuild to use olddefconfig, simplifying matters. - apply patches in util/kconfig/patches. - Some more adaptations to the libpayload build system. The patches are now in util/kconfig/patches/, reverse applying them should lead to a util/kconfig/ tree that contains exactly the Linux version + our own 5 files. Change-Id: Ia0e8fe4e9022b278f34ab113a433ef4d45e5c355 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37152 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'util/kconfig/gconf.c')
-rw-r--r--util/kconfig/gconf.c128
1 files changed, 49 insertions, 79 deletions
diff --git a/util/kconfig/gconf.c b/util/kconfig/gconf.c
index faa1c59b8e5b..17adabfd6e6b 100644
--- a/util/kconfig/gconf.c
+++ b/util/kconfig/gconf.c
@@ -1,18 +1,11 @@
-/* Hey EMACS -*- linux-c -*- */
+// SPDX-License-Identifier: GPL-2.0
/*
- *
* Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info>
- * Released under the terms of the GNU GPL v2.0.
- *
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <stdlib.h>
#include "lkc.h"
-#include "images.c"
+#include "images.h"
#include <glade/glade.h>
#include <gtk/gtk.h>
@@ -21,13 +14,12 @@
#include <stdio.h>
#include <string.h>
+#include <strings.h>
#include <unistd.h>
#include <time.h>
//#define DEBUG
-int kconfig_warnings = 0;
-
enum {
SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW
};
@@ -80,8 +72,8 @@ static gchar **fill_row(struct menu *menu);
static void conf_changed(void);
/* Helping/Debugging Functions */
-
-const char *dbg_sym_flags(int val)
+#ifdef DEBUG
+static const char *dbg_sym_flags(int val)
{
static char buf[256];
@@ -103,16 +95,17 @@ const char *dbg_sym_flags(int val)
strcat(buf, "write/");
if (val & SYMBOL_CHANGED)
strcat(buf, "changed/");
- if (val & SYMBOL_AUTO)
- strcat(buf, "auto/");
+ if (val & SYMBOL_NO_WRITE)
+ strcat(buf, "no_write/");
buf[strlen(buf) - 1] = '\0';
return buf;
}
+#endif
-void replace_button_icon(GladeXML * xml, GdkDrawable * window,
- GtkStyle * style, gchar * btn_name, gchar ** xpm)
+static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
+ GtkStyle *style, gchar *btn_name, gchar **xpm)
{
GdkPixmap *pixmap;
GdkBitmap *mask;
@@ -130,7 +123,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window,
}
/* Main Window Initialization */
-void init_main_window(const gchar * glade_file)
+static void init_main_window(const gchar *glade_file)
{
GladeXML *xml;
GtkWidget *widget;
@@ -139,7 +132,7 @@ void init_main_window(const gchar * glade_file)
xml = glade_xml_new(glade_file, "window1", NULL);
if (!xml)
- g_error(_("GUI loading failed !\n"));
+ g_error("GUI loading failed !\n");
glade_xml_signal_autoconnect(xml);
main_wnd = glade_xml_get_widget(xml, "window1");
@@ -171,14 +164,6 @@ void init_main_window(const gchar * glade_file)
style = gtk_widget_get_style(main_wnd);
widget = glade_xml_get_widget(xml, "toolbar1");
-#if 0 /* Use stock Gtk icons instead */
- replace_button_icon(xml, main_wnd->window, style,
- "button1", (gchar **) xpm_back);
- replace_button_icon(xml, main_wnd->window, style,
- "button2", (gchar **) xpm_load);
- replace_button_icon(xml, main_wnd->window, style,
- "button3", (gchar **) xpm_save);
-#endif
replace_button_icon(xml, main_wnd->window, style,
"button4", (gchar **) xpm_single_view);
replace_button_icon(xml, main_wnd->window, style,
@@ -186,22 +171,6 @@ void init_main_window(const gchar * glade_file)
replace_button_icon(xml, main_wnd->window, style,
"button6", (gchar **) xpm_tree_view);
-#if 0
- switch (view_mode) {
- case SINGLE_VIEW:
- widget = glade_xml_get_widget(xml, "button4");
- g_signal_emit_by_name(widget, "clicked");
- break;
- case SPLIT_VIEW:
- widget = glade_xml_get_widget(xml, "button5");
- g_signal_emit_by_name(widget, "clicked");
- break;
- case FULL_VIEW:
- widget = glade_xml_get_widget(xml, "button6");
- g_signal_emit_by_name(widget, "clicked");
- break;
- }
-#endif
txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1",
"foreground", "red",
@@ -216,7 +185,7 @@ void init_main_window(const gchar * glade_file)
gtk_widget_show(main_wnd);
}
-void init_tree_model(void)
+static void init_tree_model(void)
{
gint i;
@@ -246,7 +215,7 @@ void init_tree_model(void)
model1 = GTK_TREE_MODEL(tree1);
}
-void init_left_tree(void)
+static void init_left_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
GtkCellRenderer *renderer;
@@ -259,7 +228,7 @@ void init_left_tree(void)
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
- gtk_tree_view_column_set_title(column, _("Options"));
+ 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),
@@ -288,7 +257,7 @@ static void renderer_edited(GtkCellRendererText * cell,
const gchar * path_string,
const gchar * new_text, gpointer user_data);
-void init_right_tree(void)
+static void init_right_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree2_w);
GtkCellRenderer *renderer;
@@ -302,7 +271,7 @@ void init_right_tree(void)
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
- gtk_tree_view_column_set_title(column, _("Options"));
+ 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),
@@ -331,7 +300,7 @@ void init_right_tree(void)
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(view, -1,
- _("Name"), renderer,
+ "Name", renderer,
"text", COL_NAME,
"foreground-gdk",
COL_COLOR, NULL);
@@ -355,7 +324,7 @@ void init_right_tree(void)
COL_COLOR, NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(view, -1,
- _("Value"), renderer,
+ "Value", renderer,
"text", COL_VALUE,
"editable",
COL_EDIT,
@@ -394,7 +363,7 @@ static void text_insert_help(struct menu *menu)
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
- const char *prompt = _(menu_get_prompt(menu));
+ const char *prompt = menu_get_prompt(menu);
struct gstr help = str_new();
menu_get_ext_help(menu, &help);
@@ -448,7 +417,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
if (!conf_get_changed())
return FALSE;
- dialog = gtk_dialog_new_with_buttons(_("Warning !"),
+ dialog = gtk_dialog_new_with_buttons("Warning !",
GTK_WINDOW(main_wnd),
(GtkDialogFlags)
(GTK_DIALOG_MODAL |
@@ -462,7 +431,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
GTK_RESPONSE_CANCEL);
- label = gtk_label_new(_("\nSave configuration ?\n"));
+ label = gtk_label_new("\nSave configuration ?\n");
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
gtk_widget_show(label);
@@ -522,7 +491,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)
(user_data));
if (conf_read(fn))
- text_insert_msg(_("Error"), _("Unable to load configuration !"));
+ text_insert_msg("Error", "Unable to load configuration !");
else
display_tree(&rootmenu);
}
@@ -531,7 +500,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *fs;
- fs = gtk_file_selection_new(_("Load file..."));
+ 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);
@@ -550,7 +519,8 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
void on_save_activate(GtkMenuItem * menuitem, gpointer user_data)
{
if (conf_write(NULL))
- text_insert_msg(_("Error"), _("Unable to save configuration !"));
+ text_insert_msg("Error", "Unable to save configuration !");
+ conf_write_autoconf(0);
}
@@ -563,7 +533,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
(user_data));
if (conf_write(fn))
- text_insert_msg(_("Error"), _("Unable to save configuration !"));
+ text_insert_msg("Error", "Unable to save configuration !");
gtk_widget_destroy(GTK_WIDGET(user_data));
}
@@ -572,7 +542,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *fs;
- fs = gtk_file_selection_new(_("Save file as..."));
+ 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);
@@ -665,7 +635,7 @@ on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data)
void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
- const gchar *intro_text = _(
+ const gchar *intro_text =
"Welcome to gkc, the GTK+ graphical configuration tool\n"
"For each option, a blank box indicates the feature is disabled, a\n"
"check indicates it is enabled, and a dot indicates that it is to\n"
@@ -680,7 +650,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
"option.\n"
"\n"
"Toggling Show Debug Info under the Options menu will show \n"
- "the dependencies, which you can then match by examining other options.");
+ "the dependencies, which you can then match by examining other options.";
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -697,8 +667,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
const gchar *about_text =
- _("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
- "Based on the source code from Roman Zippel.\n");
+ "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
+ "Based on the source code from Roman Zippel.\n";
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -715,9 +685,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
const gchar *license_text =
- _("gkc is released under the terms of the GNU GPL v2.\n"
+ "gkc is released under the terms of the GNU GPL v2.\n"
"For more information, please see the source code or\n"
- "visit http://www.fsf.org/licenses/licenses.html\n");
+ "visit http://www.fsf.org/licenses/licenses.html\n";
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -940,7 +910,7 @@ on_treeview2_button_press_event(GtkWidget * widget,
current = menu;
display_tree_part();
gtk_widget_set_sensitive(back_btn, TRUE);
- } else if ((col == COL_OPTION)) {
+ } else if (col == COL_OPTION) {
toggle_sym_value(menu);
gtk_tree_view_expand_row(view, path, TRUE);
}
@@ -1074,8 +1044,13 @@ static gchar **fill_row(struct menu *menu)
g_free(row[i]);
bzero(row, sizeof(row));
+ ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
+
row[COL_OPTION] =
- g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
+ 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))
@@ -1086,7 +1061,6 @@ static gchar **fill_row(struct menu *menu)
else
row[COL_COLOR] = g_strdup("Black");
- ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
switch (ptype) {
case P_MENU:
row[COL_PIXBUF] = (gchar *) xpm_menu;
@@ -1128,7 +1102,7 @@ static gchar **fill_row(struct menu *menu)
if (def_menu)
row[COL_VALUE] =
- g_strdup(_(menu_get_prompt(def_menu)));
+ g_strdup(menu_get_prompt(def_menu));
}
if (sym->flags & SYMBOL_CHOICEVAL)
row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
@@ -1237,8 +1211,8 @@ static GtkTreeIter found;
/*
* Find a menu in the GtkTree starting at parent.
*/
-GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent,
- struct menu *tofind)
+static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent,
+ struct menu *tofind)
{
GtkTreeIter iter;
GtkTreeIter *child = &iter;
@@ -1449,7 +1423,7 @@ static void display_list(void)
tree = tree2;
}
-void fixup_rootmenu(struct menu *menu)
+static void fixup_rootmenu(struct menu *menu)
{
struct menu *child;
static int menu_cnt = 0;
@@ -1473,18 +1447,11 @@ int main(int ac, char *av[])
char *env;
gchar *glade_file;
- bindtextdomain(PACKAGE, LOCALEDIR);
- bind_textdomain_codeset(PACKAGE, "UTF-8");
- textdomain(PACKAGE);
-
/* GTK stuffs */
gtk_set_locale();
gtk_init(&ac, &av);
glade_init();
- //add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
- //add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
-
/* Determine GUI path */
env = getenv(SRCTREE);
if (env)
@@ -1500,9 +1467,12 @@ int main(int ac, char *av[])
case 'a':
//showAll = 1;
break;
+ case 's':
+ conf_set_message_callback(NULL);
+ break;
case 'h':
case '?':
- printf("%s <config>\n", av[0]);
+ printf("%s [-s] <config>\n", av[0]);
exit(0);
}
name = av[2];