kconfig: missing macros in gconfig
[linux-2.6.git] / scripts / kconfig / gconf.c
index 6fdbe6e..dfe748c 100644 (file)
@@ -38,11 +38,6 @@ static gboolean show_all = FALSE;
 static gboolean show_debug = FALSE;
 static gboolean resizeable = FALSE;
 
-static gboolean config_changed = FALSE;
-
-static char nohelp_text[] =
-    "Sorry, no help available for this option yet.\n";
-
 GtkWidget *main_wnd = NULL;
 GtkWidget *tree1_w = NULL;     // left  frame
 GtkWidget *tree2_w = NULL;     // right frame
@@ -50,6 +45,8 @@ GtkWidget *text_w = NULL;
 GtkWidget *hpaned = NULL;
 GtkWidget *vpaned = NULL;
 GtkWidget *back_btn = NULL;
+GtkWidget *save_btn = NULL;
+GtkWidget *save_menu_item = NULL;
 
 GtkTextTag *tag1, *tag2;
 GdkColor color;
@@ -75,7 +72,7 @@ static void display_tree_part(void);
 static void update_tree(struct menu *src, GtkTreeIter * dst);
 static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row);
 static gchar **fill_row(struct menu *menu);
-
+static void conf_changed(void);
 
 /* Helping/Debugging Functions */
 
@@ -114,12 +111,6 @@ const char *dbg_print_flags(int val)
 
        bzero(buf, 256);
 
-       if (val & SYMBOL_YES)
-               strcat(buf, "yes/");
-       if (val & SYMBOL_MOD)
-               strcat(buf, "mod/");
-       if (val & SYMBOL_NO)
-               strcat(buf, "no/");
        if (val & SYMBOL_CONST)
                strcat(buf, "const/");
        if (val & SYMBOL_CHECK)
@@ -128,8 +119,6 @@ const char *dbg_print_flags(int val)
                strcat(buf, "choice/");
        if (val & SYMBOL_CHOICEVAL)
                strcat(buf, "choiceval/");
-       if (val & SYMBOL_PRINTED)
-               strcat(buf, "printed/");
        if (val & SYMBOL_VALID)
                strcat(buf, "valid/");
        if (val & SYMBOL_OPTIONAL)
@@ -138,8 +127,6 @@ const char *dbg_print_flags(int val)
                strcat(buf, "write/");
        if (val & SYMBOL_CHANGED)
                strcat(buf, "changed/");
-       if (val & SYMBOL_NEW)
-               strcat(buf, "new/");
        if (val & SYMBOL_AUTO)
                strcat(buf, "auto/");
 
@@ -178,22 +165,36 @@ const char *dbg_print_ptype(int val)
 }
 
 
-/* Main Window Initialization */
+void replace_button_icon(GladeXML * xml, GdkDrawable * window,
+                        GtkStyle * style, gchar * btn_name, gchar ** xpm)
+{
+       GdkPixmap *pixmap;
+       GdkBitmap *mask;
+       GtkToolButton *button;
+       GtkWidget *image;
 
+       pixmap = gdk_pixmap_create_from_xpm_d(window, &mask,
+                                             &style->bg[GTK_STATE_NORMAL],
+                                             xpm);
 
+       button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, btn_name));
+       image = gtk_image_new_from_pixmap(pixmap, mask);
+       gtk_widget_show(image);
+       gtk_tool_button_set_icon_widget(button, image);
+}
+
+/* Main Window Initialization */
 void init_main_window(const gchar * glade_file)
 {
        GladeXML *xml;
        GtkWidget *widget;
        GtkTextBuffer *txtbuf;
        char title[256];
-       GdkPixmap *pixmap;
-       GdkBitmap *mask;
        GtkStyle *style;
 
        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");
@@ -218,39 +219,29 @@ void init_main_window(const gchar * glade_file)
        gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget,
                                       show_value);
 
+       save_btn = glade_xml_get_widget(xml, "button3");
+       save_menu_item = glade_xml_get_widget(xml, "save1");
+       conf_set_changed_callback(conf_changed);
+
        style = gtk_widget_get_style(main_wnd);
        widget = glade_xml_get_widget(xml, "toolbar1");
 
-       pixmap = gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask,
-                                             &style->bg[GTK_STATE_NORMAL],
-                                             (gchar **) xpm_single_view);
-       gtk_image_set_from_pixmap(GTK_IMAGE
-                                 (((GtkToolbarChild
-                                    *) (g_list_nth(GTK_TOOLBAR(widget)->
-                                                   children,
-                                                   5)->data))->icon),
-                                 pixmap, mask);
-       pixmap =
-           gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask,
-                                        &style->bg[GTK_STATE_NORMAL],
-                                        (gchar **) xpm_split_view);
-       gtk_image_set_from_pixmap(GTK_IMAGE
-                                 (((GtkToolbarChild
-                                    *) (g_list_nth(GTK_TOOLBAR(widget)->
-                                                   children,
-                                                   6)->data))->icon),
-                                 pixmap, mask);
-       pixmap =
-           gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask,
-                                        &style->bg[GTK_STATE_NORMAL],
-                                        (gchar **) xpm_tree_view);
-       gtk_image_set_from_pixmap(GTK_IMAGE
-                                 (((GtkToolbarChild
-                                    *) (g_list_nth(GTK_TOOLBAR(widget)->
-                                                   children,
-                                                   7)->data))->icon),
-                                 pixmap, mask);
-
+#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,
+                           "button5", (gchar **) xpm_split_view);
+       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");
@@ -265,7 +256,7 @@ void init_main_window(const gchar * glade_file)
                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",
@@ -275,8 +266,8 @@ void init_main_window(const gchar * glade_file)
                                          /*"style", PANGO_STYLE_OBLIQUE, */
                                          NULL);
 
-       sprintf(title, "Linux Kernel v%s Configuration",
-               getenv("KERNELRELEASE"));
+       sprintf(title, _("Linux Kernel v%s Configuration"),
+               getenv("KERNELVERSION"));
        gtk_window_set_title(GTK_WINDOW(main_wnd), title);
 
        gtk_widget_show(main_wnd);
@@ -322,10 +313,10 @@ void init_left_tree(void)
        gtk_tree_view_set_model(view, model1);
        gtk_tree_view_set_headers_visible(view, TRUE);
        gtk_tree_view_set_rules_hint(view, FALSE);
-       
+
        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),
@@ -334,11 +325,11 @@ void init_left_tree(void)
                                            renderer,
                                            "active", COL_BTNACT,
                                            "inconsistent", COL_BTNINC,
-                                           "visible", COL_BTNVIS, 
+                                           "visible", COL_BTNVIS,
                                            "radio", COL_BTNRAD, NULL);
        renderer = gtk_cell_renderer_text_new();
        gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
-                                       renderer, FALSE);       
+                                       renderer, FALSE);
        gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column),
                                            renderer,
                                            "text", COL_OPTION,
@@ -370,7 +361,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),
@@ -386,7 +377,7 @@ void init_right_tree(void)
                                            renderer,
                                            "active", COL_BTNACT,
                                            "inconsistent", COL_BTNINC,
-                                           "visible", COL_BTNVIS, 
+                                           "visible", COL_BTNVIS,
                                            "radio", COL_BTNRAD, NULL);
        /*g_signal_connect(G_OBJECT(renderer), "toggled",
           G_CALLBACK(renderer_toggled), NULL); */
@@ -401,7 +392,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);
@@ -425,7 +416,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,
@@ -464,17 +455,18 @@ 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));
        gchar *name;
-       const char *help = nohelp_text;
+       const char *help;
 
-       if (!menu->sym)
-               help = "";
-       else if (menu->sym->help)
-               help = menu->sym->help;
+       help = menu_get_help(menu);
+
+       /* Gettextize if the help text not empty */
+       if ((help != 0) && (help[0] != 0))
+               help = _(help);
 
        if (menu->sym && menu->sym->name)
-               name = g_strdup_printf(menu->sym->name);
+               name = g_strdup_printf(_(menu->sym->name));
        else
                name = g_strdup("");
 
@@ -520,17 +512,17 @@ static void text_insert_msg(const char *title, const char *message)
 
 /* Main Windows Callbacks */
 
-void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data);
+void on_save_activate(GtkMenuItem * menuitem, gpointer user_data);
 gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
                                 gpointer user_data)
 {
        GtkWidget *dialog, *label;
        gint result;
 
-       if (config_changed == FALSE)
+       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 |
@@ -544,14 +536,14 @@ 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);
 
        result = gtk_dialog_run(GTK_DIALOG(dialog));
        switch (result) {
        case GTK_RESPONSE_YES:
-               on_save1_activate(NULL, NULL);
+               on_save_activate(NULL, NULL);
                return FALSE;
        case GTK_RESPONSE_NO:
                return FALSE;
@@ -604,7 +596,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);
 }
@@ -613,7 +605,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);
@@ -629,12 +621,10 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
 }
 
 
-void on_save1_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 !");
-
-       config_changed = FALSE;
+               text_insert_msg(_("Error"), _("Unable to save configuration !"));
 }
 
 
@@ -647,7 +637,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));
 }
@@ -656,7 +646,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);
@@ -740,7 +730,7 @@ on_show_debug_info1_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 kernel configuration tool\n"
            "for Linux.\n"
            "For each option, a blank box indicates the feature is disabled, a\n"
@@ -756,7 +746,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,
@@ -773,8 +763,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,
@@ -791,9 +781,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"
-           "For more information, please see the source code or\n"
-           "visit http://www.fsf.org/licenses/licenses.html\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");
 
        dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
                                        GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -806,7 +796,7 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
 }
 
 
-void on_back_pressed(GtkButton * button, gpointer user_data)
+void on_back_clicked(GtkButton * button, gpointer user_data)
 {
        enum prop_type ptype;
 
@@ -821,18 +811,12 @@ void on_back_pressed(GtkButton * button, gpointer user_data)
 }
 
 
-void on_load_pressed(GtkButton * button, gpointer user_data)
+void on_load_clicked(GtkButton * button, gpointer user_data)
 {
        on_load1_activate(NULL, user_data);
 }
 
 
-void on_save_pressed(GtkButton * button, gpointer user_data)
-{
-       on_save1_activate(NULL, user_data);
-}
-
-
 void on_single_clicked(GtkButton * button, gpointer user_data)
 {
        view_mode = SINGLE_VIEW;
@@ -850,9 +834,12 @@ void on_split_clicked(GtkButton * button, gpointer user_data)
        gtk_widget_show(tree1_w);
        gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h);
        gtk_paned_set_position(GTK_PANED(hpaned), w / 2);
-       if (tree2)      
+       if (tree2)
                gtk_tree_store_clear(tree2);
        display_list();
+
+       /* Disable back btn, like in full mode. */
+       gtk_widget_set_sensitive(back_btn, FALSE);
 }
 
 
@@ -868,13 +855,13 @@ void on_full_clicked(GtkButton * button, gpointer user_data)
 }
 
 
-void on_collapse_pressed(GtkButton * button, gpointer user_data)
+void on_collapse_clicked(GtkButton * button, gpointer user_data)
 {
        gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w));
 }
 
 
-void on_expand_pressed(GtkButton * button, gpointer user_data)
+void on_expand_clicked(GtkButton * button, gpointer user_data)
 {
        gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w));
 }
@@ -904,7 +891,6 @@ static void renderer_edited(GtkCellRendererText * cell,
 
        sym_set_string_value(sym, new_def);
 
-       config_changed = TRUE;
        update_tree(&rootmenu, NULL);
 
        gtk_tree_path_free(path);
@@ -935,7 +921,6 @@ static void change_sym_value(struct menu *menu, gint col)
                if (!sym_tristate_within_range(sym, newval))
                        newval = yes;
                sym_set_tristate_value(sym, newval);
-               config_changed = TRUE;
                if (view_mode == FULL_VIEW)
                        update_tree(&rootmenu, NULL);
                else if (view_mode == SPLIT_VIEW) {
@@ -1188,10 +1173,8 @@ static gchar **fill_row(struct menu *menu)
        bzero(row, sizeof(row));
 
        row[COL_OPTION] =
-           g_strdup_printf("%s %s", menu_get_prompt(menu),
-                           sym ? (sym->
-                                  flags & SYMBOL_NEW ? "(NEW)" : "") :
-                           "");
+           g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
+                           sym && sym_has_value(sym) ? "(NEW)" : "");
 
        if (show_all && !menu_is_visible(menu))
                row[COL_COLOR] = g_strdup("DarkGray");
@@ -1240,15 +1223,15 @@ 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)
+       if (sym->flags & SYMBOL_CHOICEVAL)
                row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
 
        stype = sym_get_type(sym);
        switch (stype) {
        case S_BOOLEAN:
-               if(GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE)
+               if (GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE)
                        row[COL_BTNVIS] = GINT_TO_POINTER(TRUE);
                if (sym_is_choice(sym))
                        break;
@@ -1423,7 +1406,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
                                                                 child2);
                                gtk_tree_store_remove(tree2, &tmp);
                                if (!valid)
-                                       return; // next parent 
+                                       return; // next parent
                                else
                                        goto reparse;   // next child
                        } else
@@ -1448,7 +1431,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
                                                                 child2);
                                gtk_tree_store_remove(tree2, &tmp);
                                if (!valid)
-                                       return; // next parent 
+                                       return; // next parent
                                else
                                        goto reparse;   // next child
                        }
@@ -1486,12 +1469,12 @@ static void display_tree(struct menu *menu)
                if (sym)
                        sym->flags &= ~SYMBOL_CHANGED;
 
-               if ((view_mode == SPLIT_VIEW) && !(child->flags & MENU_ROOT) &&
-                   (tree == tree1))
+               if ((view_mode == SPLIT_VIEW)
+                   && !(child->flags & MENU_ROOT) && (tree == tree1))
                        continue;
 
-               if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) &&
-                   (tree == tree2))
+               if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT)
+                   && (tree == tree2))
                        continue;
 
                if (menu_is_visible(child) || show_all)
@@ -1513,11 +1496,12 @@ static void display_tree(struct menu *menu)
                    && (tree == tree2))
                        continue;
 /*
-               if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) ||
-                   (view_mode == FULL_VIEW)
+                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)) {
+                   || (view_mode == FULL_VIEW)
+                   || (view_mode == SPLIT_VIEW)) {
                        indent++;
                        display_tree(child);
                        indent--;
@@ -1530,9 +1514,9 @@ static void display_tree_part(void)
 {
        if (tree2)
                gtk_tree_store_clear(tree2);
-       if(view_mode == SINGLE_VIEW)
+       if (view_mode == SINGLE_VIEW)
                display_tree(current);
-       else if(view_mode == SPLIT_VIEW)
+       else if (view_mode == SPLIT_VIEW)
                display_tree(browsed);
        gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w));
 }
@@ -1551,24 +1535,22 @@ static void display_list(void)
 
 void fixup_rootmenu(struct menu *menu)
 {
-        struct menu *child;
-        static int menu_cnt = 0;
-
-        menu->flags |= MENU_ROOT;
-        for (child = menu->list; child; child = child->next) {
-                if (child->prompt && child->prompt->type == P_MENU) {
-                        menu_cnt++;
-                        fixup_rootmenu(child);
-                        menu_cnt--;
-                } else if (!menu_cnt)
-                        fixup_rootmenu(child);
-        }
+       struct menu *child;
+       static int menu_cnt = 0;
+
+       menu->flags |= MENU_ROOT;
+       for (child = menu->list; child; child = child->next) {
+               if (child->prompt && child->prompt->type == P_MENU) {
+                       menu_cnt++;
+                       fixup_rootmenu(child);
+                       menu_cnt--;
+               } else if (!menu_cnt)
+                       fixup_rootmenu(child);
+       }
 }
 
 
 /* Main */
-
-
 int main(int ac, char *av[])
 {
        const char *name;
@@ -1579,6 +1561,10 @@ int main(int ac, char *av[])
        kconfig_load();
 #endif
 
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset(PACKAGE, "UTF-8");
+       textdomain(PACKAGE);
+
        /* GTK stuffs */
        gtk_set_locale();
        gtk_init(&ac, &av);
@@ -1637,3 +1623,10 @@ int main(int ac, char *av[])
 
        return 0;
 }
+
+static void conf_changed(void)
+{
+       bool changed = conf_get_changed();
+       gtk_widget_set_sensitive(save_btn, changed);
+       gtk_widget_set_sensitive(save_menu_item, changed);
+}