Revision: 3684 http://geany.svn.sourceforge.net/geany/?rev=3684&view=rev Author: eht16 Date: 2009-04-05 14:14:29 +0000 (Sun, 05 Apr 2009)
Log Message: ----------- Add "Recent Projects" menu to the Project menu (#2728630, patch by Elias Pschernig, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/THANKS trunk/TODO trunk/geany.glade trunk/src/about.c trunk/src/interface.c trunk/src/keyfile.c trunk/src/main.c trunk/src/plugindata.h trunk/src/project.c trunk/src/project.h trunk/src/ui_utils.c trunk/src/ui_utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/ChangeLog 2009-04-05 14:14:29 UTC (rev 3684) @@ -2,6 +2,11 @@
* src/ui_utils.c: Add sanity checks in ui_lookup_widget() just to be safe. + * THANKS, TODO, geany.glade, src/about.c, src/interface.c, + src/keyfile.c, src/main.c, src/plugindata.h, src/project.c, + src/project.h, src/ui_utils.c, src/ui_utils.h: + Add "Recent Projects" menu to the Project menu + (#2728630, patch by Elias Pschernig, thanks).
2009-04-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/THANKS 2009-04-05 14:14:29 UTC (rev 3684) @@ -63,6 +63,7 @@ David Gleich <dgleich(at)stanford(dot)edu> - Send Selection to Terminal patch Chris Macksey <cmacksey(at)users(dot)sourceforge(dot)net> - ActionScript filetype patch Simon Treny <simon(dot)treny(at)free(dot)fr> - Documents sidebar stock icons patch +Elias Pschernig <elias(at)users(dot)sourceforge(dot)net> - Recent Projects menu patch
Translators: ------------
Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/TODO 2009-04-05 14:14:29 UTC (rev 3684) @@ -12,7 +12,6 @@ programming languages o configurable filetype and project make commands (e.g. using bud for D) - o recent projects menu o MRU documents switching o (support for adding plugin filetypes - SCI_LOADLEXERLIBRARY?) o (selectable menu of arguments to use for Make, from Make Custom)
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/geany.glade 2009-04-05 14:14:29 UTC (rev 3684) @@ -67,7 +67,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image2831"> + <widget class="GtkImage" id="image2854"> <property name="visible">True</property> <property name="stock">gtk-new</property> <property name="icon_size">1</property> @@ -157,7 +157,7 @@ <signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2832"> + <widget class="GtkImage" id="image2855"> <property name="visible">True</property> <property name="stock">gtk-save</property> <property name="icon_size">1</property> @@ -178,7 +178,7 @@ <signal name="activate" handler="on_toolbutton_reload_clicked" last_modification_time="Mon, 01 Sep 2008 16:57:06 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2833"> + <widget class="GtkImage" id="image2856"> <property name="visible">True</property> <property name="stock">gtk-revert-to-saved</property> <property name="icon_size">1</property> @@ -198,7 +198,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image2834"> + <widget class="GtkImage" id="image2857"> <property name="visible">True</property> <property name="stock">gtk-revert-to-saved</property> <property name="icon_size">1</property> @@ -285,7 +285,7 @@ <signal name="activate" handler="on_close_other_documents1_activate" last_modification_time="Fri, 27 Jun 2008 15:19:28 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2835"> + <widget class="GtkImage" id="image2858"> <property name="visible">True</property> <property name="stock">gtk-close</property> <property name="icon_size">1</property> @@ -306,7 +306,7 @@ <signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2836"> + <widget class="GtkImage" id="image2859"> <property name="visible">True</property> <property name="stock">gtk-close</property> <property name="icon_size">1</property> @@ -503,7 +503,7 @@ <signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2837"> + <widget class="GtkImage" id="image2860"> <property name="visible">True</property> <property name="stock">gtk-indent</property> <property name="icon_size">1</property> @@ -524,7 +524,7 @@ <signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2838"> + <widget class="GtkImage" id="image2861"> <property name="visible">True</property> <property name="stock">gtk-unindent</property> <property name="icon_size">1</property> @@ -589,7 +589,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image2839"> + <widget class="GtkImage" id="image2862"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -668,7 +668,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image2840"> + <widget class="GtkImage" id="image2863"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -700,7 +700,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image2841"> + <widget class="GtkImage" id="image2864"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -739,7 +739,7 @@ <signal name="activate" handler="on_preferences1_activate" last_modification_time="Wed, 08 Jun 2005 11:35:19 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2842"> + <widget class="GtkImage" id="image2865"> <property name="visible">True</property> <property name="stock">gtk-preferences</property> <property name="icon_size">1</property> @@ -810,7 +810,7 @@ <signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2843"> + <widget class="GtkImage" id="image2866"> <property name="visible">True</property> <property name="stock">gtk-find-and-replace</property> <property name="icon_size">1</property> @@ -885,7 +885,7 @@ <signal name="activate" handler="on_go_to_line_activate" last_modification_time="Sat, 06 Dec 2008 17:41:21 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2844"> + <widget class="GtkImage" id="image2867"> <property name="visible">True</property> <property name="stock">gtk-jump-to</property> <property name="icon_size">1</property> @@ -919,7 +919,7 @@ <signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2845"> + <widget class="GtkImage" id="image2868"> <property name="visible">True</property> <property name="stock">gtk-select-font</property> <property name="icon_size">1</property> @@ -1391,7 +1391,7 @@ <signal name="activate" handler="on_project_new1_activate" last_modification_time="Thu, 18 Jan 2007 22:16:24 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2846"> + <widget class="GtkImage" id="image2869"> <property name="visible">True</property> <property name="stock">gtk-new</property> <property name="icon_size">1</property> @@ -1412,7 +1412,7 @@ <signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2847"> + <widget class="GtkImage" id="image2870"> <property name="visible">True</property> <property name="stock">gtk-open</property> <property name="icon_size">1</property> @@ -1426,6 +1426,14 @@ </child>
<child> + <widget class="GtkMenuItem" id="recent_projects1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Recent Projects</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> <widget class="GtkImageMenuItem" id="project_close1"> <property name="visible">True</property> <property name="label" translatable="yes">_Close</property> @@ -1433,7 +1441,7 @@ <signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2848"> + <widget class="GtkImage" id="image2871"> <property name="visible">True</property> <property name="stock">gtk-close</property> <property name="icon_size">1</property> @@ -1490,7 +1498,7 @@ <signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2849"> + <widget class="GtkImage" id="image2872"> <property name="visible">True</property> <property name="stock">gtk-select-color</property> <property name="icon_size">1</property> @@ -1529,7 +1537,7 @@ <signal name="activate" handler="on_menu_reload_configuration1_activate" last_modification_time="Mon, 30 Jun 2008 16:19:40 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2850"> + <widget class="GtkImage" id="image2873"> <property name="visible">True</property> <property name="stock">gtk-refresh</property> <property name="icon_size">1</property> @@ -1563,7 +1571,7 @@ <signal name="activate" handler="on_help1_activate" last_modification_time="Sun, 24 Jul 2005 15:23:11 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image2851"> + <widget class="GtkImage" id="image2874"> <property name="visible">True</property> <property name="stock">gtk-help</property> <property name="icon_size">1</property>
Modified: trunk/src/about.c =================================================================== --- trunk/src/about.c 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/about.c 2009-04-05 14:14:29 UTC (rev 3684) @@ -80,7 +80,7 @@ static const gchar *contributors = "Alexander Rodin, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, Bronisław Białek, Catalin Marinas, " "Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., Dave Moore, Dirk Weber, " -"Felipe Pena, François Cami, " +"Elias Pschernig, Felipe Pena, François Cami, " "Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, Jean-François Wauthy, Jeff Pohlmeyer, " "John Gabriele, Josef Whiter, Kevin Ellwood, Kristoffer A. Tjernås, Marko Peric, Matti Mårds, Moritz Barsnick, " "Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, Robert McGinley, Roland Baudin, S Jagannathan, Saleem Abdulrasool, "
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/interface.c 2009-04-05 14:14:29 UTC (rev 3684) @@ -38,7 +38,7 @@ GtkWidget *file1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image2831; + GtkWidget *image2854; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -49,11 +49,11 @@ GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image2832; + GtkWidget *image2855; GtkWidget *menu_reload1; - GtkWidget *image2833; + GtkWidget *image2856; GtkWidget *menu_reload_as1; - GtkWidget *image2834; + GtkWidget *image2857; GtkWidget *menu_reload_as1_menu; GtkWidget *invisible7; GtkWidget *separator21; @@ -64,9 +64,9 @@ GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *close_other_documents1; - GtkWidget *image2835; + GtkWidget *image2858; GtkWidget *menu_close_all1; - GtkWidget *image2836; + GtkWidget *image2859; GtkWidget *menu_separatormenuitem1; GtkWidget *menu_quit1; GtkWidget *edit1; @@ -91,9 +91,9 @@ GtkWidget *menu_duplicate_line1; GtkWidget *separator29; GtkWidget *menu_increase_indent1; - GtkWidget *image2837; + GtkWidget *image2860; GtkWidget *menu_decrease_indent1; - GtkWidget *image2838; + GtkWidget *image2861; GtkWidget *separator37; GtkWidget *send_selection_to_vte1; GtkWidget *send_selection_to2; @@ -101,7 +101,7 @@ GtkWidget *invisible13; GtkWidget *separator18; GtkWidget *add_comments1; - GtkWidget *image2839; + GtkWidget *image2862; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; @@ -110,16 +110,16 @@ GtkWidget *insert_gpl_notice2; GtkWidget *insert_bsd_license_notice2; GtkWidget *insert_date1; - GtkWidget *image2840; + GtkWidget *image2863; GtkWidget *insert_date1_menu; GtkWidget *invisible8; GtkWidget *insert_include2; - GtkWidget *image2841; + GtkWidget *image2864; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *separator9; GtkWidget *preferences1; - GtkWidget *image2842; + GtkWidget *image2865; GtkWidget *search1; GtkWidget *search1_menu; GtkWidget *find1; @@ -127,7 +127,7 @@ GtkWidget *find_previous1; GtkWidget *find_in_files1; GtkWidget *replace1; - GtkWidget *image2843; + GtkWidget *image2866; GtkWidget *separator33; GtkWidget *find_nextsel1; GtkWidget *find_prevsel1; @@ -136,11 +136,11 @@ GtkWidget *previous_message1; GtkWidget *separator32; GtkWidget *go_to_line1; - GtkWidget *image2844; + GtkWidget *image2867; GtkWidget *menu_view1; GtkWidget *menu_view1_menu; GtkWidget *menu_change_font1; - GtkWidget *image2845; + GtkWidget *image2868; GtkWidget *menu_separator4; GtkWidget *menu_toggle_all_additional_widgets1; GtkWidget *menu_fullscreen1; @@ -198,26 +198,27 @@ GtkWidget *menu_project1; GtkWidget *menu_project1_menu; GtkWidget *project_new1; - GtkWidget *image2846; + GtkWidget *image2869; GtkWidget *project_open1; - GtkWidget *image2847; + GtkWidget *image2870; + GtkWidget *recent_projects1; GtkWidget *project_close1; - GtkWidget *image2848; + GtkWidget *image2871; GtkWidget *separator34; GtkWidget *project_properties1; GtkWidget *menu_build1; GtkWidget *tools1; GtkWidget *tools1_menu; GtkWidget *menu_choose_color1; - GtkWidget *image2849; + GtkWidget *image2872; GtkWidget *menu_count_words1; GtkWidget *load_tags1; GtkWidget *menu_reload_configuration1; - GtkWidget *image2850; + GtkWidget *image2873; GtkWidget *menu_help1; GtkWidget *menu_help1_menu; GtkWidget *help1; - GtkWidget *image2851; + GtkWidget *image2874; GtkWidget *website1; GtkWidget *keyboard_shortcuts1; GtkWidget *debug_messages1; @@ -287,9 +288,9 @@ gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1);
- image2831 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2831); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2831); + image2854 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2854); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2854);
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); @@ -332,25 +333,25 @@ gtk_widget_show (menu_save_all1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1);
- image2832 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2832); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2832); + image2855 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2855); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2855);
menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload")); gtk_widget_show (menu_reload1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1);
- image2833 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2833); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2833); + image2856 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2856); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2856);
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);
- image2834 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2834); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2834); + image2857 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2857); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2857);
menu_reload_as1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu); @@ -393,17 +394,17 @@ gtk_widget_show (close_other_documents1); gtk_container_add (GTK_CONTAINER (file1_menu), close_other_documents1);
- image2835 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2835); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (close_other_documents1), image2835); + image2858 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2858); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (close_other_documents1), image2858);
menu_close_all1 = gtk_image_menu_item_new_with_mnemonic (_("C_lose All")); gtk_widget_show (menu_close_all1); gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1);
- image2836 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2836); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2836); + image2859 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2859); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2859);
menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -505,17 +506,17 @@ gtk_widget_show (menu_increase_indent1); gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
- image2837 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2837); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2837); + image2860 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2860); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2860);
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);
- image2838 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2838); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2838); + image2861 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2861); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2861);
separator37 = gtk_separator_menu_item_new (); gtk_widget_show (separator37); @@ -545,9 +546,9 @@ gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
- image2839 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2839); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2839); + image2862 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2862); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2862);
add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -580,9 +581,9 @@ gtk_widget_show (insert_date1); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
- image2840 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2840); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2840); + image2863 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2863); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2863);
insert_date1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu); @@ -594,9 +595,9 @@ gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
- image2841 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2841); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2841); + image2864 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2864); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2864);
insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -613,9 +614,9 @@ gtk_widget_show (preferences1); gtk_container_add (GTK_CONTAINER (edit1_menu), preferences1);
- image2842 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2842); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (preferences1), image2842); + image2865 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2865); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (preferences1), image2865);
search1 = gtk_menu_item_new_with_mnemonic (_("_Search")); gtk_widget_show (search1); @@ -644,9 +645,9 @@ gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
- image2843 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2843); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2843); + image2866 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2866); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2866);
separator33 = gtk_separator_menu_item_new (); gtk_widget_show (separator33); @@ -683,9 +684,9 @@ gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
- image2844 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2844); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2844); + image2867 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2867); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2867);
menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menu_view1); @@ -698,9 +699,9 @@ gtk_widget_show (menu_change_font1); gtk_container_add (GTK_CONTAINER (menu_view1_menu), menu_change_font1);
- image2845 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2845); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2845); + image2868 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2868); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2868);
menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -939,25 +940,29 @@ gtk_widget_show (project_new1); gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
- image2846 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2846); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2846); + image2869 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2869); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2869);
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);
- image2847 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2847); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2847); + image2870 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2870); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2870);
+ recent_projects1 = gtk_menu_item_new_with_mnemonic (_("_Recent Projects")); + gtk_widget_show (recent_projects1); + gtk_container_add (GTK_CONTAINER (menu_project1_menu), recent_projects1); + 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);
- image2848 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2848); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2848); + image2871 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2871); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2871);
separator34 = gtk_separator_menu_item_new (); gtk_widget_show (separator34); @@ -983,9 +988,9 @@ gtk_widget_show (menu_choose_color1); gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
- image2849 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2849); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2849); + image2872 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2872); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2872);
menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count")); gtk_widget_show (menu_count_words1); @@ -999,9 +1004,9 @@ gtk_widget_show (menu_reload_configuration1); gtk_container_add (GTK_CONTAINER (tools1_menu), menu_reload_configuration1);
- image2850 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2850); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_configuration1), image2850); + image2873 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2873); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_configuration1), image2873);
menu_help1 = gtk_menu_item_new_with_mnemonic (_("_Help")); gtk_widget_show (menu_help1); @@ -1014,9 +1019,9 @@ gtk_widget_show (help1); gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1);
- image2851 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2851); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2851); + image2874 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2874); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2874);
website1 = gtk_menu_item_new_with_mnemonic (_("_Website")); gtk_widget_show (website1); @@ -1480,7 +1485,7 @@ 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, image2831, "image2831"); + GLADE_HOOKUP_OBJECT (window1, image2854, "image2854"); 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"); @@ -1491,11 +1496,11 @@ 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, image2832, "image2832"); + GLADE_HOOKUP_OBJECT (window1, image2855, "image2855"); GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1"); - GLADE_HOOKUP_OBJECT (window1, image2833, "image2833"); + GLADE_HOOKUP_OBJECT (window1, image2856, "image2856"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1"); - GLADE_HOOKUP_OBJECT (window1, image2834, "image2834"); + GLADE_HOOKUP_OBJECT (window1, image2857, "image2857"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); @@ -1506,9 +1511,9 @@ GLADE_HOOKUP_OBJECT (window1, separator14, "separator14"); GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1"); GLADE_HOOKUP_OBJECT (window1, close_other_documents1, "close_other_documents1"); - GLADE_HOOKUP_OBJECT (window1, image2835, "image2835"); + GLADE_HOOKUP_OBJECT (window1, image2858, "image2858"); GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1"); - GLADE_HOOKUP_OBJECT (window1, image2836, "image2836"); + GLADE_HOOKUP_OBJECT (window1, image2859, "image2859"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1"); GLADE_HOOKUP_OBJECT (window1, edit1, "edit1"); @@ -1533,9 +1538,9 @@ 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, image2837, "image2837"); + GLADE_HOOKUP_OBJECT (window1, image2860, "image2860"); GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1"); - GLADE_HOOKUP_OBJECT (window1, image2838, "image2838"); + GLADE_HOOKUP_OBJECT (window1, image2861, "image2861"); GLADE_HOOKUP_OBJECT (window1, separator37, "separator37"); GLADE_HOOKUP_OBJECT (window1, send_selection_to_vte1, "send_selection_to_vte1"); GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2"); @@ -1543,7 +1548,7 @@ GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13"); GLADE_HOOKUP_OBJECT (window1, separator18, "separator18"); GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1"); - GLADE_HOOKUP_OBJECT (window1, image2839, "image2839"); + GLADE_HOOKUP_OBJECT (window1, image2862, "image2862"); 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"); @@ -1552,16 +1557,16 @@ 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, image2840, "image2840"); + GLADE_HOOKUP_OBJECT (window1, image2863, "image2863"); 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, image2841, "image2841"); + GLADE_HOOKUP_OBJECT (window1, image2864, "image2864"); GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu"); GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4"); GLADE_HOOKUP_OBJECT (window1, separator9, "separator9"); GLADE_HOOKUP_OBJECT (window1, preferences1, "preferences1"); - GLADE_HOOKUP_OBJECT (window1, image2842, "image2842"); + GLADE_HOOKUP_OBJECT (window1, image2865, "image2865"); GLADE_HOOKUP_OBJECT (window1, search1, "search1"); GLADE_HOOKUP_OBJECT (window1, search1_menu, "search1_menu"); GLADE_HOOKUP_OBJECT (window1, find1, "find1"); @@ -1569,7 +1574,7 @@ 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, image2843, "image2843"); + GLADE_HOOKUP_OBJECT (window1, image2866, "image2866"); GLADE_HOOKUP_OBJECT (window1, separator33, "separator33"); GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1"); GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1"); @@ -1578,11 +1583,11 @@ 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, image2844, "image2844"); + GLADE_HOOKUP_OBJECT (window1, image2867, "image2867"); 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, image2845, "image2845"); + GLADE_HOOKUP_OBJECT (window1, image2868, "image2868"); 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"); @@ -1638,26 +1643,27 @@ 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, image2846, "image2846"); + GLADE_HOOKUP_OBJECT (window1, image2869, "image2869"); GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1"); - GLADE_HOOKUP_OBJECT (window1, image2847, "image2847"); + GLADE_HOOKUP_OBJECT (window1, image2870, "image2870"); + GLADE_HOOKUP_OBJECT (window1, recent_projects1, "recent_projects1"); GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1"); - GLADE_HOOKUP_OBJECT (window1, image2848, "image2848"); + GLADE_HOOKUP_OBJECT (window1, image2871, "image2871"); 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, image2849, "image2849"); + GLADE_HOOKUP_OBJECT (window1, image2872, "image2872"); GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1"); GLADE_HOOKUP_OBJECT (window1, load_tags1, "load_tags1"); GLADE_HOOKUP_OBJECT (window1, menu_reload_configuration1, "menu_reload_configuration1"); - GLADE_HOOKUP_OBJECT (window1, image2850, "image2850"); + GLADE_HOOKUP_OBJECT (window1, image2873, "image2873"); 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, image2851, "image2851"); + GLADE_HOOKUP_OBJECT (window1, image2874, "image2874"); GLADE_HOOKUP_OBJECT (window1, website1, "website1"); GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1"); GLADE_HOOKUP_OBJECT (window1, debug_messages1, "debug_messages1");
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/keyfile.c 2009-04-05 14:14:29 UTC (rev 3684) @@ -200,18 +200,18 @@ }
-static void save_recent_files(GKeyFile *config) +static void save_recent_files(GKeyFile *config, GQueue *queue, gchar const *key) { gchar **recent_files = g_new0(gchar*, file_prefs.mru_length + 1); guint i;
for (i = 0; i < file_prefs.mru_length; i++) { - if (! g_queue_is_empty(ui_prefs.recent_queue)) + if (! g_queue_is_empty(queue)) { /* copy the values, this is necessary when this function is called from the * preferences dialog or when quitting is canceled to keep the queue intact */ - recent_files[i] = g_strdup(g_queue_peek_nth(ui_prefs.recent_queue, i)); + recent_files[i] = g_strdup(g_queue_peek_nth(queue, i)); } else { @@ -221,7 +221,7 @@ } /* There is a bug in GTK 2.6 g_key_file_set_string_list, we must NULL terminate. */ recent_files[file_prefs.mru_length] = NULL; - g_key_file_set_string_list(config, "files", "recent_files", + g_key_file_set_string_list(config, "files", key, (const gchar**)recent_files, file_prefs.mru_length); g_strfreev(recent_files); } @@ -505,7 +505,8 @@ save_dialog_prefs(config); save_ui_prefs(config); project_save_prefs(config); /* save project filename, etc. */ - save_recent_files(config); + save_recent_files(config, ui_prefs.recent_queue, "recent_files"); + save_recent_files(config, ui_prefs.recent_projects_queue, "recent_projects"); if (cl_options.load_session) configuration_save_session_files(config);
@@ -518,15 +519,32 @@ g_free(configfile); }
+ +static void load_recent_files(GKeyFile *config, GQueue *queue, const gchar *key) +{ + gchar **recent_files; + gsize i, len = 0; + + recent_files = g_key_file_get_string_list(config, "files", key, &len, NULL); + if (recent_files != NULL) + { + for (i = 0; (i < len) && (i < file_prefs.mru_length); i++) + { + gchar *filename = g_strdup(recent_files[i]); + g_queue_push_tail(queue, filename); + } + } + g_strfreev(recent_files); +} + + /* * Load session list from the given keyfile, and store it in the global * session_files variable for later file loading * */ void configuration_load_session_files(GKeyFile *config) { - gchar **recent_files; guint i; - gsize len = 0; gboolean have_session_files; gchar entry[16]; gchar **tmp_array; @@ -534,16 +552,8 @@
session_notebook_page = utils_get_setting_integer(config, "files", "current_page", -1);
- recent_files = g_key_file_get_string_list(config, "files", "recent_files", &len, NULL); - if (recent_files != NULL) - { - for (i = 0; (i < len) && (i < file_prefs.mru_length); i++) - { - gchar *filename = g_strdup(recent_files[i]); - g_queue_push_tail(ui_prefs.recent_queue, filename); - } - } - g_strfreev(recent_files); + load_recent_files(config, ui_prefs.recent_queue, "recent_files"); + load_recent_files(config, ui_prefs.recent_projects_queue, "recent_projects");
/* the project may load another list than the main setting */ if (session_files != NULL)
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/main.c 2009-04-05 14:14:29 UTC (rev 3684) @@ -270,14 +270,22 @@ ignore_callback = FALSE; app->tm_workspace = tm_get_workspace(); ui_prefs.recent_queue = g_queue_new(); - main_status.opening_session_files = FALSE; + ui_prefs.recent_projects_queue = g_queue_new(); + main_status.opening_session_files = FALSE;
main_widgets.window = create_window1(); + /* add recent files to the File menu */ ui_widgets.recent_files_menuitem = ui_lookup_widget(main_widgets.window, "recent_files1"); ui_widgets.recent_files_menu_menubar = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_files_menuitem), ui_widgets.recent_files_menu_menubar);
+ /* add recent projects to the Project menu */ + ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1"); + ui_widgets.recent_projects_menu_menubar = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_projects_menuitem), + ui_widgets.recent_projects_menu_menubar); + /* store important pointers for later reference */ main_widgets.toolbar = toolbar_init(); main_widgets.sidebar_notebook = ui_lookup_widget(main_widgets.window, "notebook3"); @@ -1020,7 +1028,7 @@ #ifdef HAVE_VTE vte_init(); #endif - ui_create_recent_menu(); + ui_create_recent_menus();
ui_set_statusbar(TRUE, _("This is Geany %s."), main_get_version_string()); if (config_dir_result != 0) @@ -1096,6 +1104,16 @@ }
+static void queue_free(GQueue *queue) +{ + while (! g_queue_is_empty(queue)) + { + g_free(g_queue_pop_tail(queue)); + } + g_queue_free(queue); +} + + void main_quit() { geany_debug("Quitting..."); @@ -1153,12 +1171,10 @@ g_free(printing_prefs.external_print_cmd); g_free(printing_prefs.page_header_datefmt); g_strfreev(ui_prefs.custom_commands); - while (! g_queue_is_empty(ui_prefs.recent_queue)) - { - g_free(g_queue_pop_tail(ui_prefs.recent_queue)); - } - g_queue_free(ui_prefs.recent_queue);
+ queue_free(ui_prefs.recent_queue); + queue_free(ui_prefs.recent_projects_queue); + if (ui_widgets.prefs_dialog && GTK_IS_WIDGET(ui_widgets.prefs_dialog)) gtk_widget_destroy(ui_widgets.prefs_dialog); if (ui_widgets.save_filesel && GTK_IS_WIDGET(ui_widgets.save_filesel)) gtk_widget_destroy(ui_widgets.save_filesel); if (ui_widgets.open_filesel && GTK_IS_WIDGET(ui_widgets.open_filesel)) gtk_widget_destroy(ui_widgets.open_filesel);
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/plugindata.h 2009-04-05 14:14:29 UTC (rev 3684) @@ -45,7 +45,7 @@ enum { /** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. */ - GEANY_API_VERSION = 138, + GEANY_API_VERSION = 139,
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. */
Modified: trunk/src/project.c =================================================================== --- trunk/src/project.c 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/project.c 2009-04-05 14:14:29 UTC (rev 3684) @@ -84,7 +84,6 @@ static gboolean update_config(const PropertyDialogElements *e); static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElements *e); static void on_file_open_button_clicked(GtkButton *button, PropertyDialogElements *e); -static gboolean close_open_project(void); static gboolean load_config(const gchar *filename); static gboolean write_config(gboolean emit_signal); static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e); @@ -110,7 +109,7 @@ PropertyDialogElements *e; gint response;
- if (! close_open_project()) return; + if (! project_ask_close()) return;
g_return_if_fail(app->project == NULL);
@@ -199,6 +198,22 @@ }
+gboolean project_load_file_with_session(const gchar *locale_file_name) +{ + if (project_load_file(locale_file_name)) + { + if (project_prefs.project_session) + { + configuration_open_files(); + /* open a new file if no other file was opened */ + document_new_file_if_non_open(); + } + return TRUE; + } + return FALSE; +} + + #ifndef G_OS_WIN32 static void run_open_dialog(GtkDialog *dialog) { @@ -212,7 +227,7 @@ gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
/* try to load the config */ - if (! project_load_file(filename)) + if (! project_load_file_with_session(filename)) { gchar *utf8_filename = utils_get_utf8_from_locale(filename);
@@ -223,12 +238,6 @@ goto retry; } g_free(filename); - if (project_prefs.project_session) - { - configuration_open_files(); - /* open a new file if no other file was opened */ - document_new_file_if_non_open(); - } } } #endif @@ -244,23 +253,17 @@ GtkFileFilter *filter; gchar *locale_path; #endif - if (! close_open_project()) return; + if (! project_ask_close()) return;
#ifdef G_OS_WIN32 file = win32_show_project_open_dialog(main_widgets.window, _("Open Project"), dir, FALSE, TRUE); if (file != NULL) { /* try to load the config */ - if (! project_load_file(file)) + if (! project_load_file_full(file)) { SHOW_ERR1(_("Project file "%s" could not be loaded."), file); } - else if (project_prefs.project_session) - { - configuration_open_files(); - /* open a new file if no other file was opened */ - document_new_file_if_non_open(); - } g_free(file); } #else @@ -561,7 +564,7 @@ /* checks whether there is an already open project and asks the user if he wants to close it or * abort the current action. Returns FALSE when the current action(the caller) should be cancelled * and TRUE if we can go ahead */ -static gboolean close_open_project() +gboolean project_ask_close(void) { if (app->project != NULL) { @@ -893,7 +896,12 @@
if (load_config(locale_file_name)) { + gchar *utf8_filename = utils_get_utf8_from_locale(locale_file_name); + ui_set_statusbar(TRUE, _("Project "%s" opened."), app->project->name); + + ui_add_recent_project_file(utf8_filename); + g_free(utf8_filename); return TRUE; } else
Modified: trunk/src/project.h =================================================================== --- trunk/src/project.h 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/project.h 2009-04-05 14:14:29 UTC (rev 3684) @@ -70,9 +70,13 @@
void project_properties(void);
+gboolean project_ask_close(void);
+ gboolean project_load_file(const gchar *locale_file_name);
+gboolean project_load_file_with_session(const gchar *locale_file_name); + gchar *project_get_base_path(void);
gchar *project_get_make_dir(void);
Modified: trunk/src/ui_utils.c =================================================================== --- trunk/src/ui_utils.c 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/ui_utils.c 2009-04-05 14:14:29 UTC (rev 3684) @@ -71,10 +71,19 @@ } widgets;
+typedef struct +{ + GQueue *recent_queue; + GtkWidget *menubar; + GtkWidget *toolbar; + void (*activate_cb)(GtkMenuItem *, gpointer); +} GeanyRecentFiles;
-static void update_recent_menu(void); -static void recent_file_loaded(const gchar *utf8_filename); + +static void update_recent_menu(GeanyRecentFiles *grf); +static void recent_file_loaded(const gchar *utf8_filename, GeanyRecentFiles *grf); static void recent_file_activate_cb(GtkMenuItem *menuitem, gpointer user_data); +static void recent_project_activate_cb(GtkMenuItem *menuitem, gpointer user_data); static GtkWidget *progress_bar_create(void);
@@ -886,49 +895,99 @@ }
-void ui_create_recent_menu(void) +static void recent_create_menu(GeanyRecentFiles *grf) { GtkWidget *tmp; guint i, len; gchar *filename;
- len = MIN(file_prefs.mru_length, g_queue_get_length(ui_prefs.recent_queue)); + len = MIN(file_prefs.mru_length, g_queue_get_length(grf->recent_queue)); for (i = 0; i < len; i++) { - filename = g_queue_peek_nth(ui_prefs.recent_queue, i); + filename = g_queue_peek_nth(grf->recent_queue, i); /* create menu item for the recent files menu in the menu bar */ tmp = gtk_menu_item_new_with_label(filename); gtk_widget_show(tmp); - gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar), tmp); - g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL); + gtk_container_add(GTK_CONTAINER(grf->menubar), tmp); + g_signal_connect(tmp, "activate", G_CALLBACK(grf->activate_cb), NULL); /* create menu item for the recent files menu in the toolbar */ - if (ui_widgets.recent_files_menu_toolbar != NULL) + if (grf->toolbar != NULL) { tmp = gtk_menu_item_new_with_label(filename); gtk_widget_show(tmp); - gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar), tmp); - g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL); + gtk_container_add(GTK_CONTAINER(grf->toolbar), tmp); + g_signal_connect(tmp, "activate", G_CALLBACK(grf->activate_cb), NULL); } } }
+static GeanyRecentFiles *recent_get_recent_files(void) +{ + static GeanyRecentFiles grf = { NULL, NULL, NULL, NULL }; + + if (grf.recent_queue == NULL) + { + grf.recent_queue = ui_prefs.recent_queue; + grf.menubar = ui_widgets.recent_files_menu_menubar; + grf.toolbar = ui_widgets.recent_files_menu_toolbar; + grf.activate_cb = recent_file_activate_cb; + } + return &grf; +} + + +static GeanyRecentFiles *recent_get_recent_projects(void) +{ + static GeanyRecentFiles grf = { NULL, NULL, NULL, NULL }; + + if (grf.recent_queue == NULL) + { + grf.recent_queue = ui_prefs.recent_projects_queue; + grf.menubar = ui_widgets.recent_projects_menu_menubar; + grf.toolbar = NULL; + grf.activate_cb = recent_project_activate_cb; + } + return &grf; +} + + +void ui_create_recent_menus(void) +{ + recent_create_menu(recent_get_recent_files()); + recent_create_menu(recent_get_recent_projects()); +} + + static void recent_file_activate_cb(GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { gchar *utf8_filename = ui_menu_item_get_text(menuitem); gchar *locale_filename = utils_get_locale_from_utf8(utf8_filename);
if (document_open_file(locale_filename, FALSE, NULL, NULL) != NULL) - recent_file_loaded(utf8_filename); + recent_file_loaded(utf8_filename, recent_get_recent_files());
g_free(locale_filename); g_free(utf8_filename); }
-void ui_add_recent_file(const gchar *utf8_filename) +static void recent_project_activate_cb(GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { - if (g_queue_find_custom(ui_prefs.recent_queue, utf8_filename, (GCompareFunc) strcmp) == NULL) + gchar *utf8_filename = ui_menu_item_get_text(menuitem); + gchar *locale_filename = utils_get_locale_from_utf8(utf8_filename); + + if (project_ask_close() && project_load_file_with_session(locale_filename)) + recent_file_loaded(utf8_filename, recent_get_recent_projects()); + + g_free(locale_filename); + g_free(utf8_filename); +} + + +static void add_recent_file(const gchar *utf8_filename, GeanyRecentFiles *grf) +{ + if (g_queue_find_custom(grf->recent_queue, utf8_filename, (GCompareFunc) strcmp) == NULL) { #if GTK_CHECK_VERSION(2, 10, 0) GtkRecentManager *manager = gtk_recent_manager_get_default(); @@ -939,17 +998,31 @@ g_free(uri); } #endif - g_queue_push_head(ui_prefs.recent_queue, g_strdup(utf8_filename)); - if (g_queue_get_length(ui_prefs.recent_queue) > file_prefs.mru_length) + g_queue_push_head(grf->recent_queue, g_strdup(utf8_filename)); + if (g_queue_get_length(grf->recent_queue) > file_prefs.mru_length) { - g_free(g_queue_pop_tail(ui_prefs.recent_queue)); + g_free(g_queue_pop_tail(grf->recent_queue)); } - update_recent_menu(); + update_recent_menu(grf); } - else recent_file_loaded(utf8_filename); /* filename already in recent list */ + /* filename already in recent list */ + else + recent_file_loaded(utf8_filename, grf); }
+void ui_add_recent_file(const gchar *utf8_filename) +{ + add_recent_file(utf8_filename, recent_get_recent_files()); +} + + +void ui_add_recent_project_file(const gchar *utf8_filename) +{ + add_recent_file(utf8_filename, recent_get_recent_projects()); +} + + /* Returns: newly allocated string with the UTF-8 menu text. */ gchar *ui_menu_item_get_text(GtkMenuItem *menu_item) { @@ -982,29 +1055,29 @@ }
-static void recent_file_loaded(const gchar *utf8_filename) +static void recent_file_loaded(const gchar *utf8_filename, GeanyRecentFiles *grf) { GList *item, *children; void *data; GtkWidget *tmp;
/* first reorder the queue */ - item = g_queue_find_custom(ui_prefs.recent_queue, utf8_filename, (GCompareFunc) strcmp); + item = g_queue_find_custom(grf->recent_queue, utf8_filename, (GCompareFunc) strcmp); g_return_if_fail(item != NULL);
data = item->data; - g_queue_remove(ui_prefs.recent_queue, data); - g_queue_push_head(ui_prefs.recent_queue, data); + g_queue_remove(grf->recent_queue, data); + g_queue_push_head(grf->recent_queue, data);
/* remove the old menuitem for the filename */ - children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar)); + children = gtk_container_get_children(GTK_CONTAINER(grf->menubar)); item = g_list_find_custom(children, utf8_filename, (GCompareFunc) find_recent_file_item); if (item != NULL) gtk_widget_destroy(GTK_WIDGET(item->data));
- if (ui_widgets.recent_files_menu_toolbar != NULL) + if (grf->toolbar != NULL) { - children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar)); + children = gtk_container_get_children(GTK_CONTAINER(grf->toolbar)); item = g_list_find_custom(children, utf8_filename, (GCompareFunc) find_recent_file_item); if (item != NULL) gtk_widget_destroy(GTK_WIDGET(item->data)); @@ -1013,33 +1086,33 @@ * first for the recent files menu in the menu bar */ tmp = gtk_menu_item_new_with_label(utf8_filename); gtk_widget_show(tmp); - gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_menu_menubar), tmp); - g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL); + gtk_menu_shell_prepend(GTK_MENU_SHELL(grf->menubar), tmp); + g_signal_connect(tmp, "activate", G_CALLBACK(grf->activate_cb), NULL); /* then for the recent files menu in the tool bar */ - if (ui_widgets.recent_files_menu_toolbar != NULL) + if (grf->toolbar != NULL) { tmp = gtk_menu_item_new_with_label(utf8_filename); gtk_widget_show(tmp); - gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar), tmp); + gtk_container_add(GTK_CONTAINER(grf->toolbar), tmp); /* this is a bit ugly, but we need to use gtk_container_add(). Using * gtk_menu_shell_prepend() doesn't emit GtkContainer's "add" signal which we need in * GeanyMenubuttonAction */ - gtk_menu_reorder_child(GTK_MENU(ui_widgets.recent_files_menu_toolbar), tmp, 0); - g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL); + gtk_menu_reorder_child(GTK_MENU(grf->toolbar), tmp, 0); + g_signal_connect(tmp, "activate", G_CALLBACK(grf->activate_cb), NULL); } }
-static void update_recent_menu(void) +static void update_recent_menu(GeanyRecentFiles *grf) { GtkWidget *tmp; gchar *filename; GList *children, *item;
- filename = g_queue_peek_head(ui_prefs.recent_queue); + filename = g_queue_peek_head(grf->recent_queue);
/* clean the MRU list before adding an item (menubar) */ - children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar)); + children = gtk_container_get_children(GTK_CONTAINER(grf->menubar)); if (g_list_length(children) > file_prefs.mru_length - 1) { item = g_list_nth(children, file_prefs.mru_length - 1); @@ -1053,13 +1126,13 @@ /* create item for the menu bar menu */ tmp = gtk_menu_item_new_with_label(filename); gtk_widget_show(tmp); - gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_menu_menubar), tmp); - g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL); + gtk_menu_shell_prepend(GTK_MENU_SHELL(grf->menubar), tmp); + g_signal_connect(tmp, "activate", G_CALLBACK(grf->activate_cb), NULL);
/* clean the MRU list before adding an item (toolbar) */ - if (ui_widgets.recent_files_menu_toolbar != NULL) + if (grf->toolbar != NULL) { - children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar)); + children = gtk_container_get_children(GTK_CONTAINER(grf->toolbar)); if (g_list_length(children) > file_prefs.mru_length - 1) { item = g_list_nth(children, file_prefs.mru_length - 1); @@ -1073,9 +1146,9 @@ /* create item for the tool bar menu */ tmp = gtk_menu_item_new_with_label(filename); gtk_widget_show(tmp); - gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar), tmp); - gtk_menu_reorder_child(GTK_MENU(ui_widgets.recent_files_menu_toolbar), tmp, 0); - g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL); + gtk_container_add(GTK_CONTAINER(grf->toolbar), tmp); + gtk_menu_reorder_child(GTK_MENU(grf->toolbar), tmp, 0); + g_signal_connect(tmp, "activate", G_CALLBACK(grf->activate_cb), NULL); } }
Modified: trunk/src/ui_utils.h =================================================================== --- trunk/src/ui_utils.h 2009-04-05 14:13:56 UTC (rev 3683) +++ trunk/src/ui_utils.h 2009-04-05 14:14:29 UTC (rev 3684) @@ -88,6 +88,7 @@
/* Menu-item related data */ GQueue *recent_queue; + GQueue *recent_projects_queue; gchar *custom_date_format; gchar **custom_commands; } @@ -106,6 +107,8 @@ GtkWidget *recent_files_menu_menubar; GtkWidget *recent_files_menu_toolbar; GtkWidget *print_page_setup; + GtkWidget *recent_projects_menuitem; + GtkWidget *recent_projects_menu_menubar;
/* dialogs */ GtkWidget *open_colorsel; @@ -252,11 +255,13 @@ GtkWidget *ui_new_image_from_inline(gint img);
-void ui_create_recent_menu(void); +void ui_create_recent_menus(void);
void ui_add_recent_file(const gchar *utf8_filename);
+void ui_add_recent_project_file(const gchar *utf8_filename);
+ void ui_update_tab_status(GeanyDocument *doc);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.