From 33e1f7e8d0dda263b73fbba2a05f930679f2766a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 17 Dec 2006 19:31:32 +0000 Subject: [PATCH] Fixed wrong insert position when the cursor was moved by keyboard and comments, includes or a date was inserted. Also fixed some segfault when inserting comments, dates and includes at a position prior to some deleted text. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1112 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 +++ geany.glade | 30 +++++------ src/callbacks.c | 70 +++++++++++++++++++++++-- src/callbacks.h | 16 ++++++ src/interface.c | 134 ++++++++++++++++++++++++------------------------ src/ui_utils.c | 14 ++--- 6 files changed, 177 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94dcbfa3..164e6d2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ * geany.glade, src/interface.c: Made the sidebar notebook tabs scrollable. + * geany.glade, src/callbacks.c, src/callbacks.h, src/interface.c, + src/ui_utils.c: + Fixed wrong insert position when the cursor was moved by keyboard + and comments, includes or a date was inserted. + Also fixed some segfault when inserting comments, dates and includes + at a position prior to some deleted text. 2006-12-17 Nick Treleaven diff --git a/geany.glade b/geany.glade index c95e3bf2..5e9b8bd2 100644 --- a/geany.glade +++ b/geany.glade @@ -57,7 +57,7 @@ True - + True gtk-new 1 @@ -138,7 +138,7 @@ - + True gtk-save 1 @@ -159,7 +159,7 @@ - + True gtk-revert-to-saved 1 @@ -179,7 +179,7 @@ True - + True gtk-revert-to-saved 1 @@ -259,7 +259,7 @@ - + True gtk-close 1 @@ -467,7 +467,7 @@ - + True gtk-indent 1 @@ -488,7 +488,7 @@ - + True gtk-unindent 1 @@ -518,7 +518,7 @@ True - + True gtk-add 1 @@ -550,7 +550,7 @@ True - + True gtk-add 1 @@ -600,7 +600,7 @@ Inserts a multiline comment Insert Multiline Comment True - + @@ -610,7 +610,7 @@ Inserts a GPL notice (should be done at the beginning of the file) Insert GPL Notice True - + @@ -710,7 +710,7 @@ - + True gtk-find-and-replace 1 @@ -752,7 +752,7 @@ - + True gtk-jump-to 1 @@ -787,7 +787,7 @@ - + True gtk-select-font 1 @@ -1137,7 +1137,7 @@ - + True gtk-select-color 1 diff --git a/src/callbacks.c b/src/callbacks.c index ea729ed7..d59fec64 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -69,6 +69,11 @@ static gboolean closing_all = FALSE; // toggled callback should ignore the change since it is not triggered by the user static gboolean ignore_toolbar_toggle = FALSE; +// flag to indicate that an insert callback was triggered from the file menu, +// so we need to store the current cursor position in editor_info.click_pos. +/// TODO rename me +static gboolean insert_callback_from_menu = FALSE; + // represents the state at switching a notebook page(in the left treeviews widget), to not emit // the selection-changed signal from tv.tree_openfiles //static gboolean switch_tv_notebook_page = FALSE; @@ -116,6 +121,18 @@ static gboolean account_for_unsaved() } +// set editor_info.click_pos to the current cursor position if insert_callback_from_menu is TRUE +// to prevent invalid cursor positions which can cause segfaults +static void verify_click_pos(gint idx) +{ + if (insert_callback_from_menu) + { + editor_info.click_pos = sci_get_current_position(doc_list[idx].sci); + insert_callback_from_menu = FALSE; + } +} + + // should only be called from on_exit_clicked static void quit_app() { @@ -1489,6 +1506,8 @@ on_comments_multiline_activate (GtkMenuItem *menuitem, } } + verify_click_pos(idx); // make sure that the click_pos is valid + sci_insert_text(doc_list[idx].sci, editor_info.click_pos, text); g_free(text); } @@ -1503,6 +1522,8 @@ on_comments_gpl_activate (GtkMenuItem *menuitem, text = templates_get_template_gpl(FILETYPE_ID(doc_list[idx].file_type)); + verify_click_pos(idx); // make sure that the click_pos is valid + sci_insert_text(doc_list[idx].sci, editor_info.click_pos, text); g_free(text); } @@ -1611,7 +1632,8 @@ on_insert_date_activate (GtkMenuItem *menuitem, tm = localtime(&t); if (strftime(time_str, sizeof time_str, format, tm) != 0) { - /// FIXME inserts at wrong position if not clicked and the cursor was moved by keyboard + verify_click_pos(idx); // make sure that the click_pos is valid + sci_insert_text(doc_list[idx].sci, editor_info.click_pos, time_str); } else @@ -1627,9 +1649,14 @@ void on_insert_include_activate (GtkMenuItem *menuitem, gpointer user_data) { - gint idx = document_get_cur_idx(), pos = -1; + gint idx = document_get_cur_idx(); + gint pos = -1; gchar *text; + if (! DOC_IDX_VALID(idx) || user_data == NULL) return; + + verify_click_pos(idx); // make sure that the click_pos is valid + if (utils_str_equal(user_data, "blank")) { text = g_strdup("#include \"\"\n"); @@ -1640,10 +1667,10 @@ on_insert_include_activate (GtkMenuItem *menuitem, text = g_strconcat("#include <", user_data, ">\n", NULL); } - /// FIXME inserts at wrong position if not clicked and the cursor was moved by keyboard sci_insert_text(doc_list[idx].sci, editor_info.click_pos, text); g_free(text); - if (pos > 0) sci_goto_pos(doc_list[idx].sci, pos, FALSE); + if (pos >= 0) + sci_goto_pos(doc_list[idx].sci, pos, FALSE); } @@ -2012,3 +2039,38 @@ on_menu_insert_special_chars1_activate (GtkMenuItem *menuitem, tools_show_dialog_insert_special_chars(); } + +void +on_menu_comments_multiline_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + insert_callback_from_menu = TRUE; + on_comments_multiline_activate(menuitem, user_data); +} + + +void +on_menu_comments_gpl_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + insert_callback_from_menu = TRUE; + on_comments_gpl_activate(menuitem, user_data); +} + + +void +on_menu_insert_include_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + insert_callback_from_menu = TRUE; + on_insert_include_activate(menuitem, user_data); +} + + +void +on_menu_insert_date_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + insert_callback_from_menu = TRUE; + on_insert_date_activate(menuitem, user_data); +} diff --git a/src/callbacks.h b/src/callbacks.h index 188a1879..04f734e2 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -546,3 +546,19 @@ on_next_message1_activate (GtkMenuItem *menuitem, void on_menu_insert_special_chars1_activate (GtkMenuItem *menuitem, gpointer user_data); + +void +on_menu_comments_multiline_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_menu_comments_gpl_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_menu_insert_include_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_menu_insert_date_activate (GtkMenuItem *menuitem, + gpointer user_data); diff --git a/src/interface.c b/src/interface.c index 03842412..54c72ff4 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 *image1319; + GtkWidget *image1331; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -47,11 +47,11 @@ create_window1 (void) GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image1320; + GtkWidget *image1332; GtkWidget *menu_reload1; - GtkWidget *image1321; + GtkWidget *image1333; GtkWidget *menu_reload_as1; - GtkWidget *image1322; + GtkWidget *image1334; GtkWidget *menu_reload_as1_menu; GtkWidget *invisible7; GtkWidget *separator21; @@ -61,7 +61,7 @@ create_window1 (void) GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *menu_close_all1; - GtkWidget *image1323; + GtkWidget *image1335; GtkWidget *menu_separatormenuitem1; GtkWidget *menu_quit1; GtkWidget *edit1; @@ -87,16 +87,16 @@ create_window1 (void) GtkWidget *menu_duplicate_line1; GtkWidget *separator29; GtkWidget *menu_increase_indent1; - GtkWidget *image1324; + GtkWidget *image1336; GtkWidget *menu_decrease_indent1; - GtkWidget *image1325; + GtkWidget *image1337; GtkWidget *separator18; GtkWidget *insert_include2; - GtkWidget *image1326; + GtkWidget *image1338; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *add_comments1; - GtkWidget *image1327; + GtkWidget *image1339; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -115,16 +115,16 @@ create_window1 (void) GtkWidget *find_previous1; GtkWidget *find_in_files1; GtkWidget *replace1; - GtkWidget *image1328; + GtkWidget *image1340; GtkWidget *separator33; GtkWidget *next_message1; GtkWidget *separator32; GtkWidget *go_to_line1; - GtkWidget *image1329; + GtkWidget *image1341; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *menu_change_font1; - GtkWidget *image1330; + GtkWidget *image1342; GtkWidget *menu_separator4; GtkWidget *menu_fullscreen1; GtkWidget *menu_show_messages_window1; @@ -166,7 +166,7 @@ create_window1 (void) GtkWidget *tools1; GtkWidget *tools1_menu; GtkWidget *menu_choose_color1; - GtkWidget *image1331; + GtkWidget *image1343; GtkWidget *menu_count_words1; GtkWidget *menu_insert_special_chars1; GtkWidget *menu_item5; @@ -267,9 +267,9 @@ create_window1 (void) gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1); - image1319 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1319); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1319); + image1331 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1331); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1331); 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); @@ -308,25 +308,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); - image1320 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1320); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1320); + image1332 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1332); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1332); menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload")); gtk_widget_show (menu_reload1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload1); - image1321 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1321); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1321); + image1333 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1333); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1333); 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); - image1322 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1322); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1322); + image1334 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1334); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1334); menu_reload_as1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu); @@ -367,9 +367,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); - image1323 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1323); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1323); + image1335 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1335); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1335); menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -477,17 +477,17 @@ create_window1 (void) gtk_widget_show (menu_increase_indent1); gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1); - image1324 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1324); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image1324); + image1336 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1336); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image1336); menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent")); gtk_widget_show (menu_decrease_indent1); gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1); - image1325 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1325); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image1325); + image1337 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1337); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image1337); separator18 = gtk_separator_menu_item_new (); gtk_widget_show (separator18); @@ -498,9 +498,9 @@ create_window1 (void) gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2); - image1326 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1326); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1326); + image1338 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1338); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1338); insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -512,9 +512,9 @@ create_window1 (void) gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1); - image1327 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1327); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1327); + image1339 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1339); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1339); add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -590,9 +590,9 @@ create_window1 (void) gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1); - image1328 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1328); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1328); + image1340 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1340); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1340); separator33 = gtk_separator_menu_item_new (); gtk_widget_show (separator33); @@ -612,9 +612,9 @@ create_window1 (void) gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1); - image1329 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1329); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1329); + image1341 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1341); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1341); menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menuitem3); @@ -628,9 +628,9 @@ 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); - image1330 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1330); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1330); + image1342 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1342); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1342); menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -815,9 +815,9 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (tools1_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); - image1331 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1331); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1331); + image1343 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1343); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1343); menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count")); gtk_widget_show (menu_count_words1); @@ -1220,10 +1220,10 @@ create_window1 (void) G_CALLBACK (on_comments_function_activate), NULL); g_signal_connect ((gpointer) insert_multiline_comment2, "activate", - G_CALLBACK (on_comments_multiline_activate), + G_CALLBACK (on_menu_comments_multiline_activate), NULL); g_signal_connect ((gpointer) insert_gpl_notice2, "activate", - G_CALLBACK (on_comments_gpl_activate), + G_CALLBACK (on_menu_comments_gpl_activate), NULL); g_signal_connect ((gpointer) preferences1, "activate", G_CALLBACK (on_preferences1_activate), @@ -1412,7 +1412,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, image1319, "image1319"); + GLADE_HOOKUP_OBJECT (window1, image1331, "image1331"); 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"); @@ -1422,11 +1422,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, image1320, "image1320"); + GLADE_HOOKUP_OBJECT (window1, image1332, "image1332"); GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1"); - GLADE_HOOKUP_OBJECT (window1, image1321, "image1321"); + GLADE_HOOKUP_OBJECT (window1, image1333, "image1333"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1"); - GLADE_HOOKUP_OBJECT (window1, image1322, "image1322"); + GLADE_HOOKUP_OBJECT (window1, image1334, "image1334"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); @@ -1436,7 +1436,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, image1323, "image1323"); + GLADE_HOOKUP_OBJECT (window1, image1335, "image1335"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1"); GLADE_HOOKUP_OBJECT (window1, edit1, "edit1"); @@ -1462,16 +1462,16 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1"); GLADE_HOOKUP_OBJECT (window1, separator29, "separator29"); GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1"); - GLADE_HOOKUP_OBJECT (window1, image1324, "image1324"); + GLADE_HOOKUP_OBJECT (window1, image1336, "image1336"); GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1"); - GLADE_HOOKUP_OBJECT (window1, image1325, "image1325"); + GLADE_HOOKUP_OBJECT (window1, image1337, "image1337"); GLADE_HOOKUP_OBJECT (window1, separator18, "separator18"); GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2"); - GLADE_HOOKUP_OBJECT (window1, image1326, "image1326"); + GLADE_HOOKUP_OBJECT (window1, image1338, "image1338"); 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, image1327, "image1327"); + GLADE_HOOKUP_OBJECT (window1, image1339, "image1339"); 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"); @@ -1490,16 +1490,16 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1"); GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1"); GLADE_HOOKUP_OBJECT (window1, replace1, "replace1"); - GLADE_HOOKUP_OBJECT (window1, image1328, "image1328"); + GLADE_HOOKUP_OBJECT (window1, image1340, "image1340"); GLADE_HOOKUP_OBJECT (window1, separator33, "separator33"); GLADE_HOOKUP_OBJECT (window1, next_message1, "next_message1"); GLADE_HOOKUP_OBJECT (window1, separator32, "separator32"); GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1"); - GLADE_HOOKUP_OBJECT (window1, image1329, "image1329"); + GLADE_HOOKUP_OBJECT (window1, image1341, "image1341"); 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, image1330, "image1330"); + GLADE_HOOKUP_OBJECT (window1, image1342, "image1342"); 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"); @@ -1540,7 +1540,7 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, tools1, "tools1"); GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu"); GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1"); - GLADE_HOOKUP_OBJECT (window1, image1331, "image1331"); + GLADE_HOOKUP_OBJECT (window1, image1343, "image1343"); GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1"); GLADE_HOOKUP_OBJECT (window1, menu_insert_special_chars1, "menu_insert_special_chars1"); GLADE_HOOKUP_OBJECT (window1, menu_item5, "menu_item5"); diff --git a/src/ui_utils.c b/src/ui_utils.c index 8a023ca0..4c5db529 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -467,10 +467,10 @@ static void insert_include_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gch tmp_popup = gtk_menu_item_new_with_label(includes[i]); gtk_container_add(GTK_CONTAINER(edit_menu), tmp_menu); gtk_container_add(GTK_CONTAINER(popup_menu), tmp_popup); - g_signal_connect((gpointer) tmp_menu, "activate", G_CALLBACK(on_insert_include_activate), - (gpointer) includes[i]); - g_signal_connect((gpointer) tmp_popup, "activate", G_CALLBACK(on_insert_include_activate), - (gpointer) includes[i]); + g_signal_connect((gpointer) tmp_menu, "activate", + G_CALLBACK(on_menu_insert_include_activate), (gpointer) includes[i]); + g_signal_connect((gpointer) tmp_popup, "activate", + G_CALLBACK(on_insert_include_activate), (gpointer) includes[i]); i++; } gtk_widget_show_all(edit_menu_item); @@ -508,7 +508,7 @@ void ui_create_insert_menu_items() blank = gtk_menu_item_new_with_label("#include \"...\""); gtk_container_add(GTK_CONTAINER(menu_edit), blank); gtk_widget_show(blank); - g_signal_connect((gpointer) blank, "activate", G_CALLBACK(on_insert_include_activate), + g_signal_connect((gpointer) blank, "activate", G_CALLBACK(on_menu_insert_include_activate), (gpointer) "blank"); blank = gtk_separator_menu_item_new (); gtk_container_add(GTK_CONTAINER(menu_edit), blank); @@ -538,7 +538,7 @@ static void insert_date_items(GtkMenu *me, GtkMenu *mp, gchar *label) item = gtk_menu_item_new_with_label(label); gtk_container_add(GTK_CONTAINER(me), item); gtk_widget_show(item); - g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate), label); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_menu_insert_date_activate), label); item = gtk_menu_item_new_with_label(label); gtk_container_add(GTK_CONTAINER(mp), item); @@ -580,7 +580,7 @@ void ui_create_insert_date_menu_items() item = gtk_menu_item_new_with_label(str); gtk_container_add(GTK_CONTAINER(menu_edit), item); gtk_widget_show(item); - g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate), + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_menu_insert_date_activate), str); g_object_set_data_full(G_OBJECT(app->window), "insert_date_custom1", gtk_widget_ref(item), (GDestroyNotify)gtk_widget_unref);