aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/gconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/gconf.c')
-rw-r--r--scripts/kconfig/gconf.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 7b0d3a93d5c0..61d8166166ef 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -38,8 +38,6 @@ static gboolean show_all = FALSE;
38static gboolean show_debug = FALSE; 38static gboolean show_debug = FALSE;
39static gboolean resizeable = FALSE; 39static gboolean resizeable = FALSE;
40 40
41static gboolean config_changed = FALSE;
42
43static char nohelp_text[] = 41static char nohelp_text[] =
44 N_("Sorry, no help available for this option yet.\n"); 42 N_("Sorry, no help available for this option yet.\n");
45 43
@@ -50,6 +48,8 @@ GtkWidget *text_w = NULL;
50GtkWidget *hpaned = NULL; 48GtkWidget *hpaned = NULL;
51GtkWidget *vpaned = NULL; 49GtkWidget *vpaned = NULL;
52GtkWidget *back_btn = NULL; 50GtkWidget *back_btn = NULL;
51GtkWidget *save_btn = NULL;
52GtkWidget *save_menu_item = NULL;
53 53
54GtkTextTag *tag1, *tag2; 54GtkTextTag *tag1, *tag2;
55GdkColor color; 55GdkColor color;
@@ -75,7 +75,7 @@ static void display_tree_part(void);
75static void update_tree(struct menu *src, GtkTreeIter * dst); 75static void update_tree(struct menu *src, GtkTreeIter * dst);
76static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row); 76static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row);
77static gchar **fill_row(struct menu *menu); 77static gchar **fill_row(struct menu *menu);
78 78static void conf_changed(void);
79 79
80/* Helping/Debugging Functions */ 80/* Helping/Debugging Functions */
81 81
@@ -224,6 +224,10 @@ void init_main_window(const gchar * glade_file)
224 gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, 224 gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget,
225 show_value); 225 show_value);
226 226
227 save_btn = glade_xml_get_widget(xml, "button3");
228 save_menu_item = glade_xml_get_widget(xml, "save1");
229 conf_set_changed_callback(conf_changed);
230
227 style = gtk_widget_get_style(main_wnd); 231 style = gtk_widget_get_style(main_wnd);
228 widget = glade_xml_get_widget(xml, "toolbar1"); 232 widget = glade_xml_get_widget(xml, "toolbar1");
229 233
@@ -512,14 +516,14 @@ static void text_insert_msg(const char *title, const char *message)
512 516
513/* Main Windows Callbacks */ 517/* Main Windows Callbacks */
514 518
515void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data); 519void on_save_activate(GtkMenuItem * menuitem, gpointer user_data);
516gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, 520gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
517 gpointer user_data) 521 gpointer user_data)
518{ 522{
519 GtkWidget *dialog, *label; 523 GtkWidget *dialog, *label;
520 gint result; 524 gint result;
521 525
522 if (config_changed == FALSE) 526 if (!conf_get_changed())
523 return FALSE; 527 return FALSE;
524 528
525 dialog = gtk_dialog_new_with_buttons(_("Warning !"), 529 dialog = gtk_dialog_new_with_buttons(_("Warning !"),
@@ -543,7 +547,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
543 result = gtk_dialog_run(GTK_DIALOG(dialog)); 547 result = gtk_dialog_run(GTK_DIALOG(dialog));
544 switch (result) { 548 switch (result) {
545 case GTK_RESPONSE_YES: 549 case GTK_RESPONSE_YES:
546 on_save1_activate(NULL, NULL); 550 on_save_activate(NULL, NULL);
547 return FALSE; 551 return FALSE;
548 case GTK_RESPONSE_NO: 552 case GTK_RESPONSE_NO:
549 return FALSE; 553 return FALSE;
@@ -621,12 +625,10 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
621} 625}
622 626
623 627
624void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) 628void on_save_activate(GtkMenuItem * menuitem, gpointer user_data)
625{ 629{
626 if (conf_write(NULL)) 630 if (conf_write(NULL))
627 text_insert_msg(_("Error"), _("Unable to save configuration !")); 631 text_insert_msg(_("Error"), _("Unable to save configuration !"));
628
629 config_changed = FALSE;
630} 632}
631 633
632 634
@@ -819,12 +821,6 @@ void on_load_clicked(GtkButton * button, gpointer user_data)
819} 821}
820 822
821 823
822void on_save_clicked(GtkButton * button, gpointer user_data)
823{
824 on_save1_activate(NULL, user_data);
825}
826
827
828void on_single_clicked(GtkButton * button, gpointer user_data) 824void on_single_clicked(GtkButton * button, gpointer user_data)
829{ 825{
830 view_mode = SINGLE_VIEW; 826 view_mode = SINGLE_VIEW;
@@ -899,7 +895,6 @@ static void renderer_edited(GtkCellRendererText * cell,
899 895
900 sym_set_string_value(sym, new_def); 896 sym_set_string_value(sym, new_def);
901 897
902 config_changed = TRUE;
903 update_tree(&rootmenu, NULL); 898 update_tree(&rootmenu, NULL);
904 899
905 gtk_tree_path_free(path); 900 gtk_tree_path_free(path);
@@ -930,7 +925,6 @@ static void change_sym_value(struct menu *menu, gint col)
930 if (!sym_tristate_within_range(sym, newval)) 925 if (!sym_tristate_within_range(sym, newval))
931 newval = yes; 926 newval = yes;
932 sym_set_tristate_value(sym, newval); 927 sym_set_tristate_value(sym, newval);
933 config_changed = TRUE;
934 if (view_mode == FULL_VIEW) 928 if (view_mode == FULL_VIEW)
935 update_tree(&rootmenu, NULL); 929 update_tree(&rootmenu, NULL);
936 else if (view_mode == SPLIT_VIEW) { 930 else if (view_mode == SPLIT_VIEW) {
@@ -1633,3 +1627,10 @@ int main(int ac, char *av[])
1633 1627
1634 return 0; 1628 return 0;
1635} 1629}
1630
1631static void conf_changed(void)
1632{
1633 bool changed = conf_get_changed();
1634 gtk_widget_set_sensitive(save_btn, changed);
1635 gtk_widget_set_sensitive(save_menu_item, changed);
1636}