diff --git a/ChangeLog b/ChangeLog index 19a2b32d..9c583d69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,14 @@ Add SettingEntry struct which is used for an array containing keyfile key and group information; currently only used for 3 search-related gboolean settings. + * src/interface.c, src/ui_utils.h, src/msgwindow.c, src/callbacks.c, + src/callbacks.h, src/ui_utils.c, geany.glade: + Add Previous Message menu item. + Don't abbreviate Find Prev Selected. + Add ui_tree_view_find_previous(). + Set Next Message menu item sensitivity when clicking on Search menu. + Thanks to Beau Barker (skip76) for an initial version of + ui_tree_view_find_previous() (see #1931125). 2008-06-24 Nick Treleaven diff --git a/geany.glade b/geany.glade index fff063f4..81c24d84 100644 --- a/geany.glade +++ b/geany.glade @@ -58,7 +58,7 @@ True - + True gtk-new 1 @@ -148,7 +148,7 @@ - + True gtk-save 1 @@ -169,7 +169,7 @@ - + True gtk-revert-to-saved 1 @@ -189,7 +189,7 @@ True - + True gtk-revert-to-saved 1 @@ -278,7 +278,7 @@ - + True gtk-close 1 @@ -477,7 +477,7 @@ - + True gtk-indent 1 @@ -498,7 +498,7 @@ - + True gtk-unindent 1 @@ -554,7 +554,7 @@ True - + True gtk-add 1 @@ -639,7 +639,7 @@ True - + True gtk-add 1 @@ -671,7 +671,7 @@ True - + True gtk-add 1 @@ -720,6 +720,7 @@ True _Search True + @@ -768,7 +769,7 @@ - + True gtk-find-and-replace 1 @@ -799,7 +800,7 @@ True - Find Pre_v Selected + Find Pre_vious Selected True @@ -820,6 +821,15 @@ + + + True + Pr_evious Message + True + + + + True @@ -834,7 +844,7 @@ - + True gtk-jump-to 1 @@ -869,7 +879,7 @@ - + True gtk-select-font 1 @@ -1298,7 +1308,7 @@ - + True gtk-new 1 @@ -1319,7 +1329,7 @@ - + True gtk-open 1 @@ -1340,7 +1350,7 @@ - + True gtk-close 1 @@ -1399,7 +1409,7 @@ - + True gtk-select-color 1 @@ -1453,7 +1463,7 @@ - + True gtk-help 1 diff --git a/src/callbacks.c b/src/callbacks.c index 507eb284..1fed507f 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1764,6 +1764,16 @@ on_next_message1_activate (GtkMenuItem *menuitem, } +void +on_previous_message1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + if (! ui_tree_view_find_previous(GTK_TREE_VIEW(msgwindow.tree_msg), + msgwin_goto_messages_file_line)) + ui_set_statusbar(FALSE, _("No more message items.")); +} + + void on_menu_comments_multiline_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -2155,3 +2165,20 @@ on_replace_spaces_activate (GtkMenuItem *menuitem, editor_replace_spaces(doc); } + +void +on_search1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + GtkWidget *next_message = lookup_widget(main_widgets.window, "next_message1"); + GtkWidget *previous_message = lookup_widget(main_widgets.window, "previous_message1"); + gboolean have_messages; + + /* enable commands if the messages window has any items */ + have_messages = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_msg), + NULL) > 0; + + gtk_widget_set_sensitive(next_message, have_messages); + gtk_widget_set_sensitive(previous_message, have_messages); +} + diff --git a/src/callbacks.h b/src/callbacks.h index 4588546e..e84071a1 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -606,3 +606,11 @@ on_line_breaking1_activate (GtkMenuItem *menuitem, void on_replace_spaces_activate (GtkMenuItem *menuitem, gpointer user_data); + +void +on_previous_message1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_search1_activate (GtkMenuItem *menuitem, + gpointer user_data); diff --git a/src/interface.c b/src/interface.c index 9038bc26..2dadfef2 100644 --- a/src/interface.c +++ b/src/interface.c @@ -37,7 +37,7 @@ create_window1 (void) GtkWidget *file1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image2409; + GtkWidget *image2443; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -48,11 +48,11 @@ create_window1 (void) GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image2410; + GtkWidget *image2444; GtkWidget *menu_reload1; - GtkWidget *image2411; + GtkWidget *image2445; GtkWidget *menu_reload_as1; - GtkWidget *image2412; + GtkWidget *image2446; 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 *image2413; + GtkWidget *image2447; GtkWidget *menu_separatormenuitem1; GtkWidget *menu_quit1; GtkWidget *edit1; @@ -88,16 +88,16 @@ create_window1 (void) GtkWidget *menu_duplicate_line1; GtkWidget *separator29; GtkWidget *menu_increase_indent1; - GtkWidget *image2414; + GtkWidget *image2448; GtkWidget *menu_decrease_indent1; - GtkWidget *image2415; + GtkWidget *image2449; GtkWidget *separator37; GtkWidget *send_selection_to2; GtkWidget *send_selection_to2_menu; GtkWidget *invisible13; GtkWidget *separator18; GtkWidget *add_comments1; - GtkWidget *image2416; + GtkWidget *image2450; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -106,11 +106,11 @@ create_window1 (void) GtkWidget *insert_gpl_notice2; GtkWidget *insert_bsd_license_notice2; GtkWidget *insert_date1; - GtkWidget *image2417; + GtkWidget *image2451; GtkWidget *insert_date1_menu; GtkWidget *invisible8; GtkWidget *insert_include2; - GtkWidget *image2418; + GtkWidget *image2452; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *separator9; @@ -122,19 +122,20 @@ create_window1 (void) GtkWidget *find_previous1; GtkWidget *find_in_files1; GtkWidget *replace1; - GtkWidget *image2419; + GtkWidget *image2453; GtkWidget *separator33; GtkWidget *find_nextsel1; GtkWidget *find_prevsel1; GtkWidget *separator35; GtkWidget *next_message1; + GtkWidget *previous_message1; GtkWidget *separator32; GtkWidget *go_to_line1; - GtkWidget *image2420; + GtkWidget *image2454; GtkWidget *menu_view1; GtkWidget *menu_view1_menu; GtkWidget *menu_change_font1; - GtkWidget *image2421; + GtkWidget *image2455; GtkWidget *menu_separator4; GtkWidget *menu_toggle_all_additional_widgets1; GtkWidget *menu_fullscreen1; @@ -186,24 +187,24 @@ create_window1 (void) GtkWidget *menu_project1; GtkWidget *menu_project1_menu; GtkWidget *project_new1; - GtkWidget *image2422; + GtkWidget *image2456; GtkWidget *project_open1; - GtkWidget *image2423; + GtkWidget *image2457; GtkWidget *project_close1; - GtkWidget *image2424; + GtkWidget *image2458; GtkWidget *separator34; GtkWidget *project_properties1; GtkWidget *menu_build1; GtkWidget *tools1; GtkWidget *tools1_menu; GtkWidget *menu_choose_color1; - GtkWidget *image2425; + GtkWidget *image2459; GtkWidget *menu_count_words1; GtkWidget *load_tags1; GtkWidget *menu_help1; GtkWidget *menu_help1_menu; GtkWidget *help1; - GtkWidget *image2426; + GtkWidget *image2460; GtkWidget *keyboard_shortcuts1; GtkWidget *website1; GtkWidget *separator16; @@ -306,9 +307,9 @@ create_window1 (void) gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1); - image2409 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2409); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2409); + image2443 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2443); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2443); 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); @@ -351,25 +352,25 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1); gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL); - image2410 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2410); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2410); + image2444 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2444); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2444); menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload")); gtk_widget_show (menu_reload1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1); - image2411 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2411); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2411); + image2445 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2445); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2445); menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload As")); gtk_widget_show (menu_reload_as1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload_as1); - image2412 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2412); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2412); + image2446 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2446); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2446); menu_reload_as1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu); @@ -414,9 +415,9 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1); gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL); - image2413 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2413); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2413); + image2447 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2447); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2447); menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -520,17 +521,17 @@ create_window1 (void) gtk_widget_show (menu_increase_indent1); gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1); - image2414 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2414); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2414); + image2448 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2448); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2448); 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); - image2415 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2415); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2415); + image2449 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2449); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2449); separator37 = gtk_separator_menu_item_new (); gtk_widget_show (separator37); @@ -556,9 +557,9 @@ create_window1 (void) gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1); - image2416 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2416); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2416); + image2450 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2450); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2450); add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -597,9 +598,9 @@ create_window1 (void) gtk_widget_show (insert_date1); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1); - image2417 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2417); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2417); + image2451 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2451); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2451); insert_date1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu); @@ -611,9 +612,9 @@ create_window1 (void) gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2); - image2418 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2418); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2418); + image2452 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2452); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2452); insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -657,9 +658,9 @@ create_window1 (void) gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1); - image2419 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2419); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2419); + image2453 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2453); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2453); separator33 = gtk_separator_menu_item_new (); gtk_widget_show (separator33); @@ -670,7 +671,7 @@ create_window1 (void) gtk_widget_show (find_nextsel1); gtk_container_add (GTK_CONTAINER (search1_menu), find_nextsel1); - find_prevsel1 = gtk_menu_item_new_with_mnemonic (_("Find Pre_v Selected")); + find_prevsel1 = gtk_menu_item_new_with_mnemonic (_("Find Pre_vious Selected")); gtk_widget_show (find_prevsel1); gtk_container_add (GTK_CONTAINER (search1_menu), find_prevsel1); @@ -683,6 +684,10 @@ create_window1 (void) gtk_widget_show (next_message1); gtk_container_add (GTK_CONTAINER (search1_menu), next_message1); + previous_message1 = gtk_menu_item_new_with_mnemonic (_("Pr_evious Message")); + gtk_widget_show (previous_message1); + gtk_container_add (GTK_CONTAINER (search1_menu), previous_message1); + separator32 = gtk_separator_menu_item_new (); gtk_widget_show (separator32); gtk_container_add (GTK_CONTAINER (search1_menu), separator32); @@ -692,9 +697,9 @@ create_window1 (void) gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1); - image2420 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2420); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2420); + image2454 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2454); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2454); menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menu_view1); @@ -708,9 +713,9 @@ create_window1 (void) gtk_container_add (GTK_CONTAINER (menu_view1_menu), menu_change_font1); gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL); - image2421 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2421); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2421); + image2455 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2455); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2455); menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -935,25 +940,25 @@ create_window1 (void) gtk_widget_show (project_new1); gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1); - image2422 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2422); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2422); + image2456 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2456); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2456); project_open1 = gtk_image_menu_item_new_with_mnemonic (_("_Open")); gtk_widget_show (project_open1); gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_open1); - image2423 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2423); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2423); + image2457 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2457); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2457); project_close1 = gtk_image_menu_item_new_with_mnemonic (_("_Close")); gtk_widget_show (project_close1); gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_close1); - image2424 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2424); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2424); + image2458 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2458); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2458); separator34 = gtk_separator_menu_item_new (); gtk_widget_show (separator34); @@ -980,9 +985,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); - image2425 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2425); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2425); + image2459 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2459); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2459); menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count")); gtk_widget_show (menu_count_words1); @@ -1005,9 +1010,9 @@ create_window1 (void) gtk_widget_show (help1); gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1); - image2426 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2426); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2426); + image2460 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2460); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2460); keyboard_shortcuts1 = gtk_menu_item_new_with_mnemonic (_("_Keyboard Shortcuts")); gtk_widget_show (keyboard_shortcuts1); @@ -1446,6 +1451,9 @@ create_window1 (void) g_signal_connect ((gpointer) preferences1, "activate", G_CALLBACK (on_preferences1_activate), NULL); + g_signal_connect ((gpointer) search1, "activate", + G_CALLBACK (on_search1_activate), + NULL); g_signal_connect ((gpointer) find1, "activate", G_CALLBACK (on_find1_activate), NULL); @@ -1470,6 +1478,9 @@ create_window1 (void) g_signal_connect ((gpointer) next_message1, "activate", G_CALLBACK (on_next_message1_activate), NULL); + g_signal_connect ((gpointer) previous_message1, "activate", + G_CALLBACK (on_previous_message1_activate), + NULL); g_signal_connect ((gpointer) go_to_line1, "activate", G_CALLBACK (on_go_to_line1_activate), NULL); @@ -1696,7 +1707,7 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, file1_menu, "file1_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, image2409, "image2409"); + GLADE_HOOKUP_OBJECT (window1, image2443, "image2443"); 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"); @@ -1707,11 +1718,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, image2410, "image2410"); + GLADE_HOOKUP_OBJECT (window1, image2444, "image2444"); GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1"); - GLADE_HOOKUP_OBJECT (window1, image2411, "image2411"); + GLADE_HOOKUP_OBJECT (window1, image2445, "image2445"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1"); - GLADE_HOOKUP_OBJECT (window1, image2412, "image2412"); + GLADE_HOOKUP_OBJECT (window1, image2446, "image2446"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); @@ -1722,7 +1733,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, image2413, "image2413"); + GLADE_HOOKUP_OBJECT (window1, image2447, "image2447"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1"); GLADE_HOOKUP_OBJECT (window1, edit1, "edit1"); @@ -1747,16 +1758,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, image2414, "image2414"); + GLADE_HOOKUP_OBJECT (window1, image2448, "image2448"); GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1"); - GLADE_HOOKUP_OBJECT (window1, image2415, "image2415"); + GLADE_HOOKUP_OBJECT (window1, image2449, "image2449"); GLADE_HOOKUP_OBJECT (window1, separator37, "separator37"); GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2"); GLADE_HOOKUP_OBJECT (window1, send_selection_to2_menu, "send_selection_to2_menu"); GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13"); GLADE_HOOKUP_OBJECT (window1, separator18, "separator18"); GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1"); - GLADE_HOOKUP_OBJECT (window1, image2416, "image2416"); + GLADE_HOOKUP_OBJECT (window1, image2450, "image2450"); 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"); @@ -1765,11 +1776,11 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2"); GLADE_HOOKUP_OBJECT (window1, insert_bsd_license_notice2, "insert_bsd_license_notice2"); GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1"); - GLADE_HOOKUP_OBJECT (window1, image2417, "image2417"); + GLADE_HOOKUP_OBJECT (window1, image2451, "image2451"); GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8"); GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2"); - GLADE_HOOKUP_OBJECT (window1, image2418, "image2418"); + GLADE_HOOKUP_OBJECT (window1, image2452, "image2452"); GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu"); GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4"); GLADE_HOOKUP_OBJECT (window1, separator9, "separator9"); @@ -1781,19 +1792,20 @@ 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, image2419, "image2419"); + GLADE_HOOKUP_OBJECT (window1, image2453, "image2453"); GLADE_HOOKUP_OBJECT (window1, separator33, "separator33"); GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1"); GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1"); GLADE_HOOKUP_OBJECT (window1, separator35, "separator35"); GLADE_HOOKUP_OBJECT (window1, next_message1, "next_message1"); + GLADE_HOOKUP_OBJECT (window1, previous_message1, "previous_message1"); GLADE_HOOKUP_OBJECT (window1, separator32, "separator32"); GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1"); - GLADE_HOOKUP_OBJECT (window1, image2420, "image2420"); + GLADE_HOOKUP_OBJECT (window1, image2454, "image2454"); GLADE_HOOKUP_OBJECT (window1, menu_view1, "menu_view1"); GLADE_HOOKUP_OBJECT (window1, menu_view1_menu, "menu_view1_menu"); GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1"); - GLADE_HOOKUP_OBJECT (window1, image2421, "image2421"); + GLADE_HOOKUP_OBJECT (window1, image2455, "image2455"); GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4"); GLADE_HOOKUP_OBJECT (window1, menu_toggle_all_additional_widgets1, "menu_toggle_all_additional_widgets1"); GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1"); @@ -1843,24 +1855,24 @@ create_window1 (void) GLADE_HOOKUP_OBJECT (window1, menu_project1, "menu_project1"); GLADE_HOOKUP_OBJECT (window1, menu_project1_menu, "menu_project1_menu"); GLADE_HOOKUP_OBJECT (window1, project_new1, "project_new1"); - GLADE_HOOKUP_OBJECT (window1, image2422, "image2422"); + GLADE_HOOKUP_OBJECT (window1, image2456, "image2456"); GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1"); - GLADE_HOOKUP_OBJECT (window1, image2423, "image2423"); + GLADE_HOOKUP_OBJECT (window1, image2457, "image2457"); GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1"); - GLADE_HOOKUP_OBJECT (window1, image2424, "image2424"); + GLADE_HOOKUP_OBJECT (window1, image2458, "image2458"); GLADE_HOOKUP_OBJECT (window1, separator34, "separator34"); GLADE_HOOKUP_OBJECT (window1, project_properties1, "project_properties1"); GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1"); 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, image2425, "image2425"); + GLADE_HOOKUP_OBJECT (window1, image2459, "image2459"); GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1"); GLADE_HOOKUP_OBJECT (window1, load_tags1, "load_tags1"); GLADE_HOOKUP_OBJECT (window1, menu_help1, "menu_help1"); GLADE_HOOKUP_OBJECT (window1, menu_help1_menu, "menu_help1_menu"); GLADE_HOOKUP_OBJECT (window1, help1, "help1"); - GLADE_HOOKUP_OBJECT (window1, image2426, "image2426"); + GLADE_HOOKUP_OBJECT (window1, image2460, "image2460"); GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1"); GLADE_HOOKUP_OBJECT (window1, website1, "website1"); GLADE_HOOKUP_OBJECT (window1, separator16, "separator16"); diff --git a/src/msgwindow.c b/src/msgwindow.c index 65f77066..1a00781f 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -81,8 +81,6 @@ void msgwin_init() msgwindow.tree_compiler = lookup_widget(main_widgets.window, "treeview5"); msgwindow.find_in_files_dir = NULL; - gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), FALSE); - prepare_status_tree_view(); prepare_msg_tree_view(); prepare_compiler_tree_view(); @@ -311,8 +309,6 @@ void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar * gtk_list_store_append(msgwindow.store_msg, &iter); gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, doc, 2, color, 3, tmp, -1); - gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), TRUE); - g_free(tmp); } @@ -1013,7 +1009,6 @@ void msgwin_clear_tab(gint tabnum) switch (tabnum) { case MSG_MESSAGE: - gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), FALSE); store = msgwindow.store_msg; break; diff --git a/src/ui_utils.c b/src/ui_utils.c index 9ae217da..26919e76 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -1221,8 +1221,25 @@ void ui_update_tab_status(GeanyDocument *doc) } -/* Returns FALSE if the treeview has items but no matching next item. */ -gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb) +static gboolean tree_model_iter_get_next(GtkTreeModel *model, GtkTreeIter *iter, + gboolean down) +{ + GtkTreePath *path; + gboolean result; + + if (down) + return gtk_tree_model_iter_next(model, iter); + + path = gtk_tree_model_get_path(model, iter); + result = gtk_tree_path_prev(path) && gtk_tree_model_get_iter(model, iter, path); + gtk_tree_path_free(path); + return result; +} + + +/* note: the while loop might be more efficient when searching upwards if it + * used tree paths instead of tree iters, but in practice it probably doesn't matter much. */ +static gboolean tree_view_find(GtkTreeView *treeview, TVMatchCallback cb, gboolean down) { GtkTreeSelection *treesel; GtkTreeIter iter; @@ -1232,7 +1249,7 @@ gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb) if (gtk_tree_selection_get_selected(treesel, &model, &iter)) { /* get the next selected item */ - if (! gtk_tree_model_iter_next(model, &iter)) + if (! tree_model_iter_get_next(model, &iter, down)) return FALSE; /* no more items */ } else /* no selection */ @@ -1246,7 +1263,7 @@ gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb) if (cb()) break; /* found next message */ - if (! gtk_tree_model_iter_next(model, &iter)) + if (! tree_model_iter_get_next(model, &iter, down)) return FALSE; /* no more items */ } /* scroll item in view */ @@ -1262,6 +1279,20 @@ gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb) } +/* Returns FALSE if the treeview has items but no matching next item. */ +gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb) +{ + return tree_view_find(treeview, cb, TRUE); +} + + +/* Returns FALSE if the treeview has items but no matching next item. */ +gboolean ui_tree_view_find_previous(GtkTreeView *treeview, TVMatchCallback cb) +{ + return tree_view_find(treeview, cb, FALSE); +} + + void ui_widget_modify_font_from_string(GtkWidget *wid, const gchar *str) { PangoFontDescription *pfd; diff --git a/src/ui_utils.h b/src/ui_utils.h index 47618248..2337a311 100644 --- a/src/ui_utils.h +++ b/src/ui_utils.h @@ -233,6 +233,8 @@ typedef gboolean TVMatchCallback(void); gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb); +gboolean ui_tree_view_find_previous(GtkTreeView *treeview, TVMatchCallback cb); + void ui_statusbar_showhide(gboolean state);