Revision: 5040 http://geany.svn.sourceforge.net/geany/?rev=5040&view=rev Author: statc Date: 2010-06-17 14:54:46 +0000 (Thu, 17 Jun 2010)
Log Message: ----------- Update for previous revision: do not load filenames from session files when they are not needed
Modified Paths: -------------- branches/sm/src/main.c branches/sm/src/main.h branches/sm/src/project.c branches/sm/src/project.h
Modified: branches/sm/src/main.c =================================================================== --- branches/sm/src/main.c 2010-06-17 14:54:23 UTC (rev 5039) +++ branches/sm/src/main.c 2010-06-17 14:54:46 UTC (rev 5040) @@ -856,7 +856,7 @@ }
-static void load_session_project_file(void) +static void load_session_project_file(gboolean load_filenames) { gchar *locale_filename;
@@ -865,7 +865,7 @@ locale_filename = utils_get_locale_from_utf8(project_prefs.session_file);
if (NZV(locale_filename)) - project_load_file(locale_filename); + project_load_file(locale_filename, load_filenames);
g_free(locale_filename); g_free(project_prefs.session_file); /* no longer needed */ @@ -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, gboolean load_files) { gchar *pfile = NULL;
@@ -899,10 +899,10 @@
if (pfile != NULL) { - if (use_session) + if (load_files) project_load_file_with_session(pfile); else - project_load_file(pfile); + project_load_file(pfile, FALSE); }
g_free(pfile); @@ -920,16 +920,18 @@
if (cl_options.project) { - /* when being restored by session manager, do not open file names from project session file, - * because required file names are passed via command-line and handled by open_cl_files() */ + /* Do not load project session files if we are being restored by session manager: + * corresponding file names are passed via command-line and will be handled by open_cl_files() */ main_load_project_from_command_line(cl_options.project, !restoring); load_default_session = FALSE; }
if (load_default_session) { - /* load filenames from the default session into global session_files variable */ - load_session_project_file(); + /* Load project session file (if any) writing its filenames into global session_files variable. + * Don't load filenames when being restored by session manager: in that case file names are + * passed via command line and will be opened by open_cl_files() */ + load_session_project_file(!restoring); /* load files into tabs, as they are found in the session_files variable */ if (!restoring) configuration_open_files();
Modified: branches/sm/src/main.h =================================================================== --- branches/sm/src/main.h 2010-06-17 14:54:23 UTC (rev 5039) +++ branches/sm/src/main.h 2010-06-17 14:54:46 UTC (rev 5040) @@ -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, gboolean load_files);
#endif
Modified: branches/sm/src/project.c =================================================================== --- branches/sm/src/project.c 2010-06-17 14:54:23 UTC (rev 5039) +++ branches/sm/src/project.c 2010-06-17 14:54:46 UTC (rev 5040) @@ -81,7 +81,7 @@
static gboolean update_config(const PropertyDialogElements *e); static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElements *e); -static gboolean load_config(const gchar *filename); +static gboolean load_config(const gchar *filename, gboolean load_filenames); static gboolean write_config(gboolean emit_signal, GeanyProjectSettingsTypes flags); static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e); static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e); @@ -201,7 +201,7 @@
gboolean project_load_file_with_session(const gchar *locale_file_name) { - if (project_load_file(locale_file_name)) + if (project_load_file(locale_file_name, TRUE)) { if (project_prefs.project_session) { @@ -949,11 +949,11 @@ }
-gboolean project_load_file(const gchar *locale_file_name) +gboolean project_load_file(const gchar *locale_file_name, gboolean load_filenames) { g_return_val_if_fail(locale_file_name != NULL, FALSE);
- if (load_config(locale_file_name)) + if (load_config(locale_file_name, load_filenames)) { ui_set_statusbar(TRUE, _("Project "%s" opened."), app->project->name); ui_add_recent_project_file(app->project->file_name); @@ -974,7 +974,7 @@ * At this point there should not be an already opened project in Geany otherwise it will just * return. * The filename is expected in the locale encoding. */ -static gboolean load_config(const gchar *filename) +static gboolean load_config(const gchar *filename, gboolean load_filenames) { GKeyFile *config; GeanyProject *p; @@ -1014,8 +1014,12 @@ configuration_save_default_session(); /* now close all open files */ document_close_all(FALSE); - /* read session files so they can be opened with configuration_open_files() */ - configuration_load_session_files(config, FALSE); + + if (load_filenames) + { + /* read session files so they can be opened with configuration_open_files() */ + configuration_load_session_files(config, FALSE); + } } g_signal_emit_by_name(geany_object, "project-open", config); g_key_file_free(config);
Modified: branches/sm/src/project.h =================================================================== --- branches/sm/src/project.h 2010-06-17 14:54:23 UTC (rev 5039) +++ branches/sm/src/project.h 2010-06-17 14:54:46 UTC (rev 5040) @@ -87,7 +87,7 @@ gboolean project_ask_close(void);
-gboolean project_load_file(const gchar *locale_file_name); +gboolean project_load_file(const gchar *locale_file_name, gboolean load_filenames);
gboolean project_load_file_with_session(const gchar *locale_file_name);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.