Revision: 4651 http://geany.svn.sourceforge.net/geany/?rev=4651&view=rev Author: statc Date: 2010-02-07 08:31:37 +0000 (Sun, 07 Feb 2010)
Log Message: ----------- Rewrite `load_startup_files' function.
Fix the bug with opening a project while specifying -s command line option. E.g., `geany -s project.geany' now correctly loads the project instead of showing a blank document and clearing the project silently.
Modified Paths: -------------- branches/sm/ChangeLog branches/sm/src/main.c
Modified: branches/sm/ChangeLog =================================================================== --- branches/sm/ChangeLog 2010-02-07 08:31:03 UTC (rev 4650) +++ branches/sm/ChangeLog 2010-02-07 08:31:37 UTC (rev 4651) @@ -1,3 +1,12 @@ +2010-02-07 Eugene Arshinov <earshinov(at)gmail(dot)com> + + * src/main.c: + Rewrite load_startup_files() function. Fix the bug with opening a + project while specifying -s command line option. E.g., + `geany -s project.geany' now correctly loads the project instead of + showing a blank document and clearing the project silently. + + 2010-01-24 Eugene Arshinov <earshinov(at)gmail(dot)com>
* doc/Doxyfile.in, src/Makefile.am, src/main.c, src/makefile.win32,
Modified: branches/sm/src/main.c =================================================================== --- branches/sm/src/main.c 2010-02-07 08:31:03 UTC (rev 4650) +++ branches/sm/src/main.c 2010-02-07 08:31:37 UTC (rev 4651) @@ -891,37 +891,55 @@
static void load_startup_files(gint argc, gchar **argv) { - gboolean load_project_from_cl = FALSE; + gboolean load_files = TRUE; + gboolean load_default_session = TRUE; + gboolean load_session = FALSE;
- /* ATM when opening a project file any other filenames are ignored */ - load_project_from_cl = (argc > 1) && g_str_has_suffix(argv[1], ".geany"); - if (load_project_from_cl && argc > 2) - g_print("Ignoring extra filenames after %s", argv[1]); + if (!prefs.load_session) + { + open_cl_files(argc, argv); + return; + }
- if (load_project_from_cl || ! open_cl_files(argc, argv)) + if ((argc > 1) && g_str_has_suffix(argv[1], ".geany")) { - if (prefs.load_session) - { - if (load_project_from_cl) - { - main_load_project_from_command_line(argv[1], FALSE); - } - else if (cl_options.load_session && !cl_options.new_instance) - load_session_project_file(); + /* load project filenames into global session_files variable */ + main_load_project_from_command_line(argv[1], FALSE);
- /* when we want a new instance, we still load project session files unless -s - * was passed */ - if (!cl_options.load_session || (!load_project_from_cl && cl_options.new_instance)) - return; + load_files = FALSE; + if (argc > 2) + g_print("Ignoring extra filenames after %s", argv[1]);
- /* load session files into tabs, as they are found in the session_files variable */ - configuration_open_files(); + load_default_session = FALSE; + load_session = TRUE; + }
- if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0) - { - ui_update_popup_copy_items(NULL); - ui_update_popup_reundo_items(NULL); - } + if (load_files) + { + gboolean any_files_opened = open_cl_files(argc, argv); + if (any_files_opened) + load_default_session = FALSE; + } + + if (!cl_options.load_session || cl_options.new_instance) + load_default_session = FALSE; + + if (load_default_session) + { + /* load filenames from the default session into global session_files variable */ + load_session_project_file(); + load_session = TRUE; + } + + if (load_session) + { + /* load files into tabs, as they are found in the session_files variable */ + configuration_open_files(); + + if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0) + { + ui_update_popup_copy_items(NULL); + ui_update_popup_reundo_items(NULL); } } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.