Save project session file list when project is closed.
Don't load default session files in a second instance after a project was closed. Fix not updating symbol list (and other things) when changing tabs after a project was opened or closed in a second instance. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2171 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
0a0ec0b491
commit
748d552168
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2008-01-13 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* src/keyfile.c, src/project.c:
|
||||
Save project session file list when project is closed.
|
||||
Don't load default session files in a second instance after a project
|
||||
was closed.
|
||||
Fix not updating symbol list (and other things) when changing tabs
|
||||
after a project was opened or closed in a second instance.
|
||||
|
||||
|
||||
2008-01-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* src/keyfile.c:
|
||||
|
@ -807,13 +807,18 @@ gboolean configuration_load()
|
||||
}
|
||||
|
||||
|
||||
// open session files
|
||||
/* Open session files
|
||||
* Note: notebook page switch handler and adding to recent files list is always disabled
|
||||
* for all files opened within this function */
|
||||
gboolean configuration_open_files()
|
||||
{
|
||||
gint i;
|
||||
guint pos;
|
||||
gboolean ret = FALSE, failure = FALSE;
|
||||
|
||||
// necessary to set it to TRUE for project session support
|
||||
main_status.opening_session_files = TRUE;
|
||||
|
||||
document_delay_colourise();
|
||||
|
||||
i = prefs.tab_order_ltr ? 0 : (session_files->len - 1);
|
||||
@ -885,9 +890,8 @@ gboolean configuration_open_files()
|
||||
/// TODO if session_notebook_page is equal to the current notebook tab(the last opened)
|
||||
/// the notebook switch page callback isn't triggered and e.g. menu items are not updated
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), session_notebook_page);
|
||||
// reset status to leave in any case with the same state as when entering
|
||||
main_status.opening_session_files = TRUE;
|
||||
}
|
||||
main_status.opening_session_files = FALSE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,9 @@ void project_close(gboolean open_default)
|
||||
|
||||
ui_set_statusbar(TRUE, _("Project \"%s\" closed."), app->project->name);
|
||||
|
||||
// use write_config() to save project session files
|
||||
write_config(FALSE);
|
||||
|
||||
g_free(app->project->name);
|
||||
g_free(app->project->description);
|
||||
g_free(app->project->file_name);
|
||||
@ -317,7 +320,7 @@ void project_close(gboolean open_default)
|
||||
}
|
||||
|
||||
// after closing all tabs let's open the tabs found in the default config
|
||||
if (open_default == TRUE)
|
||||
if (open_default == TRUE && cl_options.load_session)
|
||||
{
|
||||
configuration_reload_default_session();
|
||||
configuration_open_files();
|
||||
@ -675,7 +678,7 @@ static gboolean update_config(const PropertyDialogElements *e)
|
||||
g_free(tmp);
|
||||
#endif
|
||||
}
|
||||
write_config();
|
||||
write_config(TRUE);
|
||||
if (new_project)
|
||||
ui_set_statusbar(TRUE, _("Project \"%s\" created."), p->name);
|
||||
else
|
||||
@ -884,7 +887,7 @@ static gboolean load_config(const gchar *filename)
|
||||
// save current (non-project) session (it could has been changed since program startup)
|
||||
configuration_save_default_session();
|
||||
|
||||
// fetch session files too
|
||||
// read session files so they can be opened with configuration_open_files()
|
||||
configuration_load_session_files(config);
|
||||
|
||||
if (geany_object)
|
||||
@ -898,8 +901,12 @@ static gboolean load_config(const gchar *filename)
|
||||
}
|
||||
|
||||
|
||||
// Returns: TRUE if project file was written successfully.
|
||||
static gboolean write_config()
|
||||
/* Write the project settings as well as the project session files into its configuration files.
|
||||
* emit_signal defines whether the project-save signal should be emitted. When write_config()
|
||||
* is called while closing a project, this is used to skip emitting the signal because
|
||||
* project-close will be emitted afterwards.
|
||||
* Returns: TRUE if project file was written successfully. */
|
||||
static gboolean write_config(gboolean emit_signal)
|
||||
{
|
||||
GeanyProject *p;
|
||||
GKeyFile *config;
|
||||
@ -932,7 +939,7 @@ static gboolean write_config()
|
||||
/// TODO maybe it is useful to store relative file names if base_path is relative
|
||||
configuration_save_session_files(config);
|
||||
|
||||
if (geany_object)
|
||||
if (geany_object && emit_signal)
|
||||
{
|
||||
g_signal_emit_by_name(geany_object, "project-save", config);
|
||||
}
|
||||
@ -1002,7 +1009,7 @@ void project_save_prefs(GKeyFile *config)
|
||||
NVL(local_prefs.project_file_path, ""));
|
||||
|
||||
if (project != NULL)
|
||||
write_config(); // to store project session files
|
||||
write_config(TRUE); // to store project session files
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user