diff options
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/gconf.c | 35 | ||||
-rw-r--r-- | scripts/kconfig/gconf.glade | 4 |
2 files changed, 20 insertions, 19 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; | |||
38 | static gboolean show_debug = FALSE; | 38 | static gboolean show_debug = FALSE; |
39 | static gboolean resizeable = FALSE; | 39 | static gboolean resizeable = FALSE; |
40 | 40 | ||
41 | static gboolean config_changed = FALSE; | ||
42 | |||
43 | static char nohelp_text[] = | 41 | static 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; | |||
50 | GtkWidget *hpaned = NULL; | 48 | GtkWidget *hpaned = NULL; |
51 | GtkWidget *vpaned = NULL; | 49 | GtkWidget *vpaned = NULL; |
52 | GtkWidget *back_btn = NULL; | 50 | GtkWidget *back_btn = NULL; |
51 | GtkWidget *save_btn = NULL; | ||
52 | GtkWidget *save_menu_item = NULL; | ||
53 | 53 | ||
54 | GtkTextTag *tag1, *tag2; | 54 | GtkTextTag *tag1, *tag2; |
55 | GdkColor color; | 55 | GdkColor color; |
@@ -75,7 +75,7 @@ static void display_tree_part(void); | |||
75 | static void update_tree(struct menu *src, GtkTreeIter * dst); | 75 | static void update_tree(struct menu *src, GtkTreeIter * dst); |
76 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row); | 76 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row); |
77 | static gchar **fill_row(struct menu *menu); | 77 | static gchar **fill_row(struct menu *menu); |
78 | 78 | static 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 | ||
515 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data); | 519 | void on_save_activate(GtkMenuItem * menuitem, gpointer user_data); |
516 | gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, | 520 | gboolean 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 | ||
624 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) | 628 | void 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 | ||
822 | void on_save_clicked(GtkButton * button, gpointer user_data) | ||
823 | { | ||
824 | on_save1_activate(NULL, user_data); | ||
825 | } | ||
826 | |||
827 | |||
828 | void on_single_clicked(GtkButton * button, gpointer user_data) | 824 | void 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 | |||
1631 | static 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 | } | ||
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade index f8744ed64967..803233fdd6dd 100644 --- a/scripts/kconfig/gconf.glade +++ b/scripts/kconfig/gconf.glade | |||
@@ -70,7 +70,7 @@ | |||
70 | <property name="tooltip" translatable="yes">Save the config in .config</property> | 70 | <property name="tooltip" translatable="yes">Save the config in .config</property> |
71 | <property name="label" translatable="yes">_Save</property> | 71 | <property name="label" translatable="yes">_Save</property> |
72 | <property name="use_underline">True</property> | 72 | <property name="use_underline">True</property> |
73 | <signal name="activate" handler="on_save1_activate"/> | 73 | <signal name="activate" handler="on_save_activate"/> |
74 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 74 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
75 | 75 | ||
76 | <child internal-child="image"> | 76 | <child internal-child="image"> |
@@ -380,7 +380,7 @@ | |||
380 | <property name="visible_horizontal">True</property> | 380 | <property name="visible_horizontal">True</property> |
381 | <property name="visible_vertical">True</property> | 381 | <property name="visible_vertical">True</property> |
382 | <property name="is_important">False</property> | 382 | <property name="is_important">False</property> |
383 | <signal name="clicked" handler="on_save_clicked"/> | 383 | <signal name="clicked" handler="on_save_activate"/> |
384 | </widget> | 384 | </widget> |
385 | <packing> | 385 | <packing> |
386 | <property name="expand">False</property> | 386 | <property name="expand">False</property> |