From e1f79b7d3e74af4de68d64eb9ab24d0e1aa65e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Mon, 24 Jul 2006 20:23:56 +0000 Subject: [PATCH] Added menu item to the document menu to add/remove BOM. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@620 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 + geany.glade | 101 ++++++++++++++++++++++++++-------------- src/callbacks.c | 43 +++++++++++++---- src/callbacks.h | 7 ++- src/document.c | 33 +++++++------ src/interface.c | 121 +++++++++++++++++++++++++----------------------- src/main.c | 17 ++++--- 7 files changed, 200 insertions(+), 124 deletions(-) diff --git a/ChangeLog b/ChangeLog index ced57bc0..fbcc7626 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * src/geany.h, tagmanager/strlist.c, tagmanager/tm_project.c, tagmanager/parse.c, tagmanager/general.h, tagmanager/ctags.c, tagmanager/tm_workspace.c: Fixed some cross compiling/Win32 issues. + * geany.glade, src/callbacks.c, src/document.c, src/interface.c, + src/main.c: Added menu item to the document menu to add/remove BOM. 2006-07-24 Nick Treleaven diff --git a/geany.glade b/geany.glade index 7e4ad6a1..4e6cb91a 100644 --- a/geany.glade +++ b/geany.glade @@ -57,7 +57,7 @@ True - + True gtk-new 1 @@ -150,7 +150,7 @@ - + True gtk-save 1 @@ -164,11 +164,55 @@ - + True - gtk-revert-to-saved - True - + _Reload + True + + + + + True + gtk-revert-to-saved + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + True + R_eload as + True + + + + True + gtk-revert-to-saved + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + + invisible + True + + + + @@ -187,27 +231,6 @@ - - - True - Reload as - True - - - - - - - - invisible - True - - - - - - - True @@ -248,7 +271,7 @@ - + True gtk-close 1 @@ -379,7 +402,7 @@ True - + True gtk-add 1 @@ -411,7 +434,7 @@ True - + True gtk-add 1 @@ -589,7 +612,7 @@ - + True gtk-find-and-replace 1 @@ -631,7 +654,7 @@ - + True gtk-jump-to 1 @@ -666,7 +689,7 @@ - + True gtk-select-font 1 @@ -688,7 +711,7 @@ - + True gtk-select-color 1 @@ -849,6 +872,16 @@ + + + True + _Write Unicode BOM + True + False + + + + True diff --git a/src/callbacks.c b/src/callbacks.c index c5e89533..8c58ea29 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -66,9 +66,6 @@ gchar current_word[GEANY_MAX_WORD_LENGTH]; // represents the state while closing all tabs(used to prevent notebook switch page signals) static gboolean closing_all = FALSE; -// represents the state at switching a notebook page, to update check menu items in document menu -static gboolean switch_notebook_page = FALSE; - // flag to indicate the explicit change of a toggle button of the toolbar menu and so the // toggled callback should ignore the change since it is not triggered by the user static gboolean ignore_toolbar_toggle = FALSE; @@ -739,7 +736,7 @@ on_notebook1_switch_page (GtkNotebook *notebook, if (idx >= 0 && app->opening_session_files == FALSE) { - switch_notebook_page = TRUE; + app->ignore_callback = TRUE; gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_line_breaking1")), doc_list[idx].line_breaking); @@ -749,6 +746,12 @@ on_notebook1_switch_page (GtkNotebook *notebook, gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "set_file_readonly1")), doc_list[idx].readonly); + gtk_check_menu_item_set_active( + GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_write_unicode_bom1")), + doc_list[idx].has_bom); + + gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"), + utils_is_unicode_charset(doc_list[idx].encoding)); gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx)); @@ -758,7 +761,7 @@ on_notebook1_switch_page (GtkNotebook *notebook, utils_set_window_title(idx); utils_update_tag_list(idx, FALSE); - switch_notebook_page = FALSE; + app->ignore_callback = FALSE; } } @@ -1183,7 +1186,7 @@ on_openfiles_tree_selection_changed (GtkTreeSelection *selection, gint idx = 0; // use switch_notebook_page to ignore changing the notebook page because it is already done - if (gtk_tree_selection_get_selected(selection, &model, &iter) && ! switch_notebook_page) + if (gtk_tree_selection_get_selected(selection, &model, &iter) && ! app->ignore_callback) { gtk_tree_model_get(model, &iter, 1, &idx, -1); gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), @@ -1287,7 +1290,7 @@ void on_line_breaking1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - if (! switch_notebook_page) + if (! app->ignore_callback) { gint idx = document_get_cur_idx(); if (idx == -1 || ! doc_list[idx].is_valid) return; @@ -1301,7 +1304,7 @@ void on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - if (! switch_notebook_page) + if (! app->ignore_callback) { gint idx = document_get_cur_idx(); if (idx == -1 || ! doc_list[idx].is_valid) return; @@ -1316,7 +1319,7 @@ void on_use_auto_indention1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - if (! switch_notebook_page) + if (! app->ignore_callback) { gint idx = document_get_cur_idx(); if (idx == -1 || ! doc_list[idx].is_valid) return; @@ -2587,6 +2590,8 @@ on_encoding_change (GtkMenuItem *menuitem, doc_list[idx].changed = TRUE; document_set_text_changed(idx); utils_update_statusbar(idx, -1); + gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"), + utils_is_unicode_charset(doc_list[idx].encoding)); } @@ -2649,3 +2654,23 @@ on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem, } utils_treeviews_showhide(TRUE); } + + +void +on_menu_write_unicode_bom1_toggled (GtkCheckMenuItem *checkmenuitem, + gpointer user_data) +{ + if (! app->ignore_callback) + { + gint idx = document_get_cur_idx(); + + if (idx == -1 || ! doc_list[idx].is_valid) return; + + doc_list[idx].has_bom = ! doc_list[idx].has_bom; + + doc_list[idx].changed = TRUE; + document_set_text_changed(idx); + utils_update_statusbar(idx, -1); + } +} + diff --git a/src/callbacks.h b/src/callbacks.h index 943edf52..8d46a89d 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -617,6 +617,9 @@ on_menu_select_all1_activate (GtkMenuItem *menuitem, gpointer user_data); void -on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem, + gpointer user_data); +void +on_menu_write_unicode_bom1_toggled (GtkCheckMenuItem *checkmenuitem, + gpointer user_data); diff --git a/src/document.c b/src/document.c index 22a33b7b..07d44d00 100644 --- a/src/document.c +++ b/src/document.c @@ -597,25 +597,28 @@ int document_open_file(gint idx, const gchar *filename, gint pos, gboolean reado sci_goto_pos(doc_list[idx].sci, pos, TRUE); + app->ignore_callback = TRUE; + + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM( + lookup_widget(app->window, "menu_write_unicode_bom1")), doc_list[idx].has_bom); + gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"), + utils_is_unicode_charset(doc_list[idx].encoding)); + + app->ignore_callback = FALSE; + if (! reload) { filetype *use_ft = (ft != NULL) ? ft : filetypes_get_from_filename(utf8_filename); - if (readonly) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM( - lookup_widget(app->window, "set_file_readonly1")), TRUE); - /* This is so ugly, but the checkbox in the file menu can be still checked from a previous - * read only file, a won't be checked out since notebook-switch-signal is ignored - * so we need to check it out by hand and this emits the toggled-signal and therefore - * we must set the file to read only and the toggle-callback will set it again to not - * read only. It's ugly. Any ideas are welcome. */ - else if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM( - lookup_widget(app->window, "set_file_readonly1")))) - { - doc_list[idx].readonly = TRUE; - sci_set_readonly(doc_list[idx].sci, TRUE); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM( - lookup_widget(app->window, "set_file_readonly1")), FALSE); - } + app->ignore_callback = TRUE; + + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "set_file_readonly1")), + readonly); + + app->ignore_callback = FALSE; + + doc_list[idx].readonly = readonly; + sci_set_readonly(doc_list[idx].sci, readonly); document_set_filetype(idx, use_ft); utils_build_show_hide(idx); diff --git a/src/interface.c b/src/interface.c index e08fc59b..33070714 100644 --- a/src/interface.c +++ b/src/interface.c @@ -37,7 +37,7 @@ create_window1 (void) GtkWidget *menuitem1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image956; + GtkWidget *image929; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -49,11 +49,11 @@ create_window1 (void) GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image957; + GtkWidget *image930; GtkWidget *menu_reload1; - GtkWidget *image958; + GtkWidget *image931; GtkWidget *menu_reload_as1; - GtkWidget *image959; + GtkWidget *image932; GtkWidget *menu_reload_as1_menu; GtkWidget *invisible7; GtkWidget *separator21; @@ -63,7 +63,7 @@ create_window1 (void) GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *menu_close_all1; - GtkWidget *image960; + GtkWidget *image933; GtkWidget *menu_separatormenuitem1; GtkWidget *menu_quit1; GtkWidget *edit1; @@ -79,11 +79,11 @@ create_window1 (void) GtkWidget *menu_select_all1; GtkWidget *separator25; GtkWidget *insert_include2; - GtkWidget *image961; + GtkWidget *image934; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *add_comments1; - GtkWidget *image962; + GtkWidget *image935; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -104,18 +104,18 @@ create_window1 (void) GtkWidget *find_next1; GtkWidget *find_previous1; GtkWidget *replace1; - GtkWidget *image963; + GtkWidget *image936; GtkWidget *separator27; GtkWidget *find_in_files1; GtkWidget *separator11; GtkWidget *go_to_line1; - GtkWidget *image964; + GtkWidget *image937; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *menu_change_font1; - GtkWidget *image965; + GtkWidget *image938; GtkWidget *menu_choose_color1; - GtkWidget *image966; + GtkWidget *image939; GtkWidget *menu_separator4; GtkWidget *menu_fullscreen1; GtkWidget *menu_show_messages_window1; @@ -132,6 +132,7 @@ create_window1 (void) GtkWidget *menu_line_breaking1; GtkWidget *menu_use_auto_indention1; GtkWidget *set_file_readonly1; + GtkWidget *menu_write_unicode_bom1; GtkWidget *separator10; GtkWidget *set_filetype1; GtkWidget *set_filetype1_menu; @@ -250,9 +251,9 @@ create_window1 (void) gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1); - image956 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image956); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image956); + image929 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image929); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image929); menu_new_with_template1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu); @@ -297,27 +298,25 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_save_all1); gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL); - image957 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image957); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image957); + image930 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image930); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image930); menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload")); gtk_widget_show (menu_reload1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload1); - gtk_tooltips_set_tip (tooltips, menu_reload1, _("Reload the current file from disk"), NULL); - image958 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image958); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image958); + image931 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image931); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image931); menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload as")); gtk_widget_show (menu_reload_as1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload_as1); - gtk_tooltips_set_tip (tooltips, menu_reload_as1, _("Reloads the current file with the specified encoding"), NULL); - image959 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image959); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image959); + image932 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image932); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image932); menu_reload_as1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu); @@ -358,9 +357,9 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_close_all1); gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL); - image960 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image960); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image960); + image933 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image933); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image933); menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -426,9 +425,9 @@ create_window1 (void) gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2); - image961 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image961); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image961); + image934 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image934); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image934); insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -440,9 +439,9 @@ create_window1 (void) gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1); - image962 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image962); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image962); + image935 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image935); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image935); add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -529,9 +528,9 @@ create_window1 (void) gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1); - image963 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image963); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image963); + image936 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image936); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image936); separator27 = gtk_separator_menu_item_new (); gtk_widget_show (separator27); @@ -551,9 +550,9 @@ create_window1 (void) gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1); - image964 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image964); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image964); + image937 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image937); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image937); menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menuitem3); @@ -567,18 +566,18 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_change_font1); gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL); - image965 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image965); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image965); + image938 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image938); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image938); menu_choose_color1 = gtk_image_menu_item_new_with_mnemonic (_("Show _Colour Chooser")); gtk_widget_show (menu_choose_color1); gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_choose_color1); gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL); - image966 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image966); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image966); + image939 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image939); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image939); menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -658,6 +657,10 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (menu_item4_menu), set_file_readonly1); gtk_tooltips_set_tip (tooltips, set_file_readonly1, _("Treat this file as read-only. No changes can be made."), NULL); + menu_write_unicode_bom1 = gtk_check_menu_item_new_with_mnemonic (_("_Write Unicode BOM")); + gtk_widget_show (menu_write_unicode_bom1); + gtk_container_add (GTK_CONTAINER (menu_item4_menu), menu_write_unicode_bom1); + separator10 = gtk_separator_menu_item_new (); gtk_widget_show (separator10); gtk_container_add (GTK_CONTAINER (menu_item4_menu), separator10); @@ -1185,6 +1188,9 @@ create_window1 (void) g_signal_connect ((gpointer) set_file_readonly1, "toggled", G_CALLBACK (on_set_file_readonly1_toggled), NULL); + g_signal_connect ((gpointer) menu_write_unicode_bom1, "toggled", + G_CALLBACK (on_menu_write_unicode_bom1_toggled), + NULL); g_signal_connect ((gpointer) crlf, "activate", G_CALLBACK (on_crlf_activate), NULL); @@ -1297,7 +1303,7 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, menuitem1_menu, "menuitem1_menu"); GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1"); GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1"); - GLADE_HOOKUP_OBJECT (window1, image956, "image956"); + GLADE_HOOKUP_OBJECT (window1, image929, "image929"); GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2"); GLADE_HOOKUP_OBJECT (window1, separator12, "separator12"); @@ -1309,11 +1315,11 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1"); GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1"); GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1"); - GLADE_HOOKUP_OBJECT (window1, image957, "image957"); + GLADE_HOOKUP_OBJECT (window1, image930, "image930"); GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1"); - GLADE_HOOKUP_OBJECT (window1, image958, "image958"); + GLADE_HOOKUP_OBJECT (window1, image931, "image931"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1"); - GLADE_HOOKUP_OBJECT (window1, image959, "image959"); + GLADE_HOOKUP_OBJECT (window1, image932, "image932"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); @@ -1323,7 +1329,7 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, separator14, "separator14"); GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1"); GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1"); - GLADE_HOOKUP_OBJECT (window1, image960, "image960"); + GLADE_HOOKUP_OBJECT (window1, image933, "image933"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1"); GLADE_HOOKUP_OBJECT (window1, edit1, "edit1"); @@ -1339,11 +1345,11 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, menu_select_all1, "menu_select_all1"); GLADE_HOOKUP_OBJECT (window1, separator25, "separator25"); GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2"); - GLADE_HOOKUP_OBJECT (window1, image961, "image961"); + GLADE_HOOKUP_OBJECT (window1, image934, "image934"); GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu"); GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4"); GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1"); - GLADE_HOOKUP_OBJECT (window1, image962, "image962"); + GLADE_HOOKUP_OBJECT (window1, image935, "image935"); GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu"); GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1"); GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1"); @@ -1364,18 +1370,18 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, find_next1, "find_next1"); GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1"); GLADE_HOOKUP_OBJECT (window1, replace1, "replace1"); - GLADE_HOOKUP_OBJECT (window1, image963, "image963"); + GLADE_HOOKUP_OBJECT (window1, image936, "image936"); GLADE_HOOKUP_OBJECT (window1, separator27, "separator27"); GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1"); GLADE_HOOKUP_OBJECT (window1, separator11, "separator11"); GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1"); - GLADE_HOOKUP_OBJECT (window1, image964, "image964"); + GLADE_HOOKUP_OBJECT (window1, image937, "image937"); GLADE_HOOKUP_OBJECT (window1, menuitem3, "menuitem3"); GLADE_HOOKUP_OBJECT (window1, menuitem3_menu, "menuitem3_menu"); GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1"); - GLADE_HOOKUP_OBJECT (window1, image965, "image965"); + GLADE_HOOKUP_OBJECT (window1, image938, "image938"); GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1"); - GLADE_HOOKUP_OBJECT (window1, image966, "image966"); + GLADE_HOOKUP_OBJECT (window1, image939, "image939"); GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4"); GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1"); GLADE_HOOKUP_OBJECT (window1, menu_show_messages_window1, "menu_show_messages_window1"); @@ -1392,6 +1398,7 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, menu_line_breaking1, "menu_line_breaking1"); GLADE_HOOKUP_OBJECT (window1, menu_use_auto_indention1, "menu_use_auto_indention1"); GLADE_HOOKUP_OBJECT (window1, set_file_readonly1, "set_file_readonly1"); + GLADE_HOOKUP_OBJECT (window1, menu_write_unicode_bom1, "menu_write_unicode_bom1"); GLADE_HOOKUP_OBJECT (window1, separator10, "separator10"); GLADE_HOOKUP_OBJECT (window1, set_filetype1, "set_filetype1"); GLADE_HOOKUP_OBJECT (window1, set_filetype1_menu, "set_filetype1_menu"); diff --git a/src/main.c b/src/main.c index 9f61f6a4..cb764574 100644 --- a/src/main.c +++ b/src/main.c @@ -181,10 +181,12 @@ static void apply_settings(void) gtk_window_set_default_size(GTK_WINDOW(app->window), app->geometry[2], app->geometry[3]); } - g_object_set(G_OBJECT(lookup_widget(app->window, "menu_line_breaking1")), "active", - GINT_TO_POINTER(app->pref_editor_line_breaking), NULL); - g_object_set(G_OBJECT(lookup_widget(app->window, "menu_use_auto_indention1")), "active", - GINT_TO_POINTER(app->pref_editor_use_auto_indention), NULL); + app->ignore_callback = TRUE; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM( + lookup_widget(app->window, "menu_line_breaking1")), app->pref_editor_line_breaking); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM( + lookup_widget(app->window, "menu_use_auto_indention1")), app->pref_editor_use_auto_indention); + app->ignore_callback = FALSE; gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON( lookup_widget(app->window, "menutoolbutton1")), app->new_file_menu); @@ -227,6 +229,7 @@ static void main_init(void) app->main_window_realized= FALSE; app->tab_order_ltr = FALSE; app->quitting = FALSE; + app->ignore_callback = FALSE; #ifdef HAVE_FIFO app->ignore_fifo = ignore_fifo; #endif @@ -613,11 +616,11 @@ gint main(gint argc, gchar **argv) configuration_apply_settings(); - dialogs_show_info( + dialogs_show_info( // will be removed soon "Please use this SVN version not for production use!\nWe added recently some experimental features which" " can really damage your files when saving or make cofusing things with your file when opening.\n" - "Read the mailing list for more information. I'm very sorry, please be patient.\n\n" - "(to disable this message, edit src/main.c at line 616)."); + "Read the mailing list for more information. I'm very sorry, please be patient.\nThis dialog " + "will be removed soon.\n\n(to disable this message, edit src/main.c at line %d).", __LINE__ - 4); //g_timeout_add(0, (GSourceFunc)destroyapp, NULL); // useful for start time tests gtk_main();