Revision: 5038 http://geany.svn.sourceforge.net/geany/?rev=5038&view=rev Author: statc Date: 2010-06-17 14:53:59 +0000 (Thu, 17 Jun 2010)
Log Message: ----------- Refactor main.c:load_startup_files() and properly handle unchecked "Load last session" option: it should not affect loading the project passed via command-line
Modified Paths: -------------- branches/sm/src/main.c branches/sm/src/main.h branches/sm/src/socket.c
Modified: branches/sm/src/main.c =================================================================== --- branches/sm/src/main.c 2010-06-17 14:53:39 UTC (rev 5037) +++ branches/sm/src/main.c 2010-06-17 14:53:59 UTC (rev 5038) @@ -888,7 +888,7 @@ }
-void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session) +void main_load_project_from_command_line(const gchar *locale_filename) { gchar *pfile = NULL;
@@ -898,12 +898,8 @@ pfile = g_strdup(locale_filename);
if (pfile != NULL) - { - if (use_session) - project_load_file_with_session(pfile); - else - project_load_file(pfile); - } + project_load_file_with_session(pfile); + g_free(pfile); }
@@ -911,50 +907,27 @@ static void load_startup_files(gint argc, gchar **argv) { gboolean load_default_session = TRUE; - gboolean load_session = FALSE;
- if (!prefs.load_session) - { - open_cl_files(argc, argv); - return; - } + if (!prefs.load_session || \ + !cl_options.load_session || \ + (argc > 1 && !prefs.load_session_even_if_any_files_opened)) + load_default_session = FALSE;
if (cl_options.project) { - main_load_project_from_command_line(cl_options.project, FALSE); - + main_load_project_from_command_line(cl_options.project); load_default_session = FALSE; - if (project_prefs.project_session) - /* project filenames are loaded into global session_files variable */ - load_session = TRUE; }
- if (!cl_options.load_session) - load_default_session = FALSE; - - if (argc > 1 && !prefs.load_session_even_if_any_files_opened) - 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(); }
open_cl_files(argc, argv); - - if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0) - { - ui_update_popup_copy_items(NULL); - ui_update_popup_reundo_items(NULL); - } }
Modified: branches/sm/src/main.h =================================================================== --- branches/sm/src/main.h 2010-06-17 14:53:39 UTC (rev 5037) +++ branches/sm/src/main.h 2010-06-17 14:53:59 UTC (rev 5038) @@ -84,6 +84,6 @@
gboolean main_is_realized(void);
-void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session); +void main_load_project_from_command_line(const gchar *locale_filename);
#endif
Modified: branches/sm/src/socket.c =================================================================== --- branches/sm/src/socket.c 2010-06-17 14:53:39 UTC (rev 5037) +++ branches/sm/src/socket.c 2010-06-17 14:53:59 UTC (rev 5038) @@ -573,7 +573,7 @@ if (project) { if (project_ask_close()) - main_load_project_from_command_line(locale_filename, TRUE); + main_load_project_from_command_line(locale_filename); } else main_handle_filename(locale_filename);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.