PATCH: Scaffold sessions



Sessions now save and load the project and open documents correctly. 
For now I use a property project-root which holds the location of the
project file.  Perhaps in the future we may want to expand this into a
group that saves the state of the project tree also.  For now it works
and I am happy with it.  Patch attached.

--
J5

> John: do you think you're session fixes are done by that time?
> (hopefully sometime this weekend or otherwise next week).
> 
> Regards,
> 
> Jeroen
> 
> _______________________________________________
> gnome-devtools mailing list
> gnome-devtools gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devtools
? scaffold_session.patch
? autom4te.cache/output.0
? autom4te.cache/requests
? autom4te.cache/traces.0
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/scaffold/ChangeLog,v
retrieving revision 1.264
diff -u -r1.264 ChangeLog
--- ChangeLog	31 Jul 2003 08:55:10 -0000	1.264
+++ ChangeLog	1 Aug 2003 04:59:23 -0000
@@ -1,3 +1,9 @@
+2003-07-31  John (J5) Palmieri  <johnp martianrock com>
+
+	Session Code now saves and loads last project and open files:
+	* plugins/project-manager/project-tool.c: Load and save project session
+	* src/scaffold-windows.c: Trigger session_save event on exit
+
 2003-07-31  Jeroen Zwartepoorte  <jeroen xs4all nl>
 
 	Way too many files to list. Renamed all the anjuta strings to scaffold.
Index: plugins/project-manager/project-tool.c
===================================================================
RCS file: /cvs/gnome/scaffold/plugins/project-manager/project-tool.c,v
retrieving revision 1.47
diff -u -r1.47 project-tool.c
--- plugins/project-manager/project-tool.c	31 Jul 2003 08:55:31 -0000	1.47
+++ plugins/project-manager/project-tool.c	1 Aug 2003 04:59:24 -0000
@@ -896,6 +896,8 @@
 	ProjectTool *proj_tool = (ProjectTool *)tool;
 	const char **args;
 	int i;
+	gchar *project_root = NULL;
+	ScaffoldSession *session;
 
 	/* If the user startup scaffold with the intention to display a source
 	 * file then don't load the previous session but only the files on the
@@ -912,13 +914,40 @@
 				break;
 			}
 		}
-	}
+		return;
+	} 
+	
+	/*load previous project*/
+	scaffold_shell_get (tool->shell,
+			  "Shell::CurrentSession",
+			  SCAFFOLD_TYPE_SESSION,
+			  &session,
+			  NULL);
+	
+	scaffold_session_get (session, "project-root", &project_root, NULL);
+	set_build (proj_tool, project_root);
+	gdl_recent_add (proj_tool->recent, project_root);
 }
 
 static void
 session_save_cb (ScaffoldShell *shell,
 		 ScaffoldTool *tool)
 {
+	/*save previous project*/
+	ProjectTool *project_tool = (ProjectTool *)tool;
+	ScaffoldSession *session;
+	gchar *project_root = NULL;
+	
+	scaffold_shell_get (tool->shell,
+			  "Shell::CurrentSession",
+			  SCAFFOLD_TYPE_SESSION,
+			  &session,
+			  NULL);
+		
+	scaffold_session_set (session, 
+			       "project-root", 
+			       project_tool->project_root,NULL);
+	
 }
 
 static void
Index: src/scaffold-windows.c
===================================================================
RCS file: /cvs/gnome/scaffold/src/scaffold-windows.c,v
retrieving revision 1.17
diff -u -r1.17 scaffold-windows.c
--- src/scaffold-windows.c	31 Jul 2003 08:55:48 -0000	1.17
+++ src/scaffold-windows.c	1 Aug 2003 04:59:24 -0000
@@ -69,6 +69,9 @@
 static void
 scaffold_window_close (ScaffoldWindow *window, gpointer data)
 {
+	/*save session before unloading any plugins*/
+	g_signal_emit_by_name (window, "session_save", window);
+	
 	/* Check if there are plugins which don't want to quit (unsaved data). */
 	if (!scaffold_tool_unload (window))
 		return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]