SF.net SVN: geany: [2171] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Jan 13 17:50:08 UTC 2008


Revision: 2171
          http://geany.svn.sourceforge.net/geany/?rev=2171&view=rev
Author:   eht16
Date:     2008-01-13 09:50:04 -0800 (Sun, 13 Jan 2008)

Log Message:
-----------
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.	       

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keyfile.c
    trunk/src/project.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-01-13 10:13:15 UTC (rev 2170)
+++ trunk/ChangeLog	2008-01-13 17:50:04 UTC (rev 2171)
@@ -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:

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2008-01-13 10:13:15 UTC (rev 2170)
+++ trunk/src/keyfile.c	2008-01-13 17:50:04 UTC (rev 2171)
@@ -807,13 +807,18 @@
 }
 
 
-// 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 @@
 		/// 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;
 }
 

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2008-01-13 10:13:15 UTC (rev 2170)
+++ trunk/src/project.c	2008-01-13 17:50:04 UTC (rev 2171)
@@ -300,6 +300,9 @@
 
 	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 @@
 	}
 
 	// 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 @@
 		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 @@
 	// 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 @@
 }
 
 
-// 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 @@
 	/// 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 @@
 		NVL(local_prefs.project_file_path, ""));
 
 	if (project != NULL)
-		write_config(); // to store project session files
+		write_config(TRUE); // to store project session files
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list