SF.net SVN: geany: [2521] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Apr 23 17:07:53 UTC 2008


Revision: 2521
          http://geany.svn.sourceforge.net/geany/?rev=2521&view=rev
Author:   ntrel
Date:     2008-04-23 10:07:52 -0700 (Wed, 23 Apr 2008)

Log Message:
-----------
Add document_close_all() and use it in project.c.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/project.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-23 16:53:40 UTC (rev 2520)
+++ trunk/ChangeLog	2008-04-23 17:07:52 UTC (rev 2521)
@@ -8,6 +8,8 @@
    geany.glade:
    Make disk check timeout configurable in the prefs dialog Files tab.
    Make a value of zero disable disk checks.
+ * src/project.c, src/document.c, src/document.h:
+   Add document_close_all() and use it in project.c.
 
 
 2008-04-22  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2008-04-23 16:53:40 UTC (rev 2520)
+++ trunk/src/document.c	2008-04-23 17:07:52 UTC (rev 2521)
@@ -516,6 +516,14 @@
 }
 
 
+void document_close_all()
+{
+	/* the code is in callbacks.c because when quitting, checking for changes
+	 * has to be done before saving the session */
+	on_close_all1_activate(NULL, NULL);
+}
+
+
 /**
  *  Remove the given notebook tab at @a page_num and clear all related information
  *  in the document list.

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2008-04-23 16:53:40 UTC (rev 2520)
+++ trunk/src/document.h	2008-04-23 17:07:52 UTC (rev 2521)
@@ -148,11 +148,14 @@
 
 void document_set_text_changed(gint idx);
 
-
 void document_apply_update_prefs(gint idx);
 
+
+void document_close_all();
+
 gboolean document_remove(guint page_num);
 
+
 gint document_new_file_if_non_open();
 
 gint document_new_file(const gchar *filename, filetype *ft, const gchar *text);

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2008-04-23 16:53:40 UTC (rev 2520)
+++ trunk/src/project.c	2008-04-23 17:07:52 UTC (rev 2521)
@@ -44,7 +44,6 @@
 #include "build.h"
 #include "document.h"
 #include "geanyobject.h"
-#include "callbacks.h"
 
 
 ProjectPrefs project_prefs = { NULL, 0 };
@@ -306,7 +305,6 @@
 /* open_default will make function reload default session files on close */
 void project_close(gboolean open_default)
 {
-	gint i, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
 	g_return_if_fail(app->project != NULL);
 
 	ui_set_statusbar(TRUE, _("Project \"%s\" closed."), app->project->name);
@@ -326,13 +324,7 @@
 	if (project_prefs.project_session)
 	{
 		/* close all existing tabs first */
-		main_status.closing_all = TRUE;
-		for (i = 0; i < max; i++)
-		{
-			if (! document_remove(0))
-				break;
-		}
-		main_status.closing_all = FALSE;
+		document_close_all(NULL, NULL);
 
 		/* after closing all tabs let's open the tabs found in the default config */
 		if (open_default == TRUE && cl_options.load_session)
@@ -348,8 +340,6 @@
 	{
 		g_signal_emit_by_name(geany_object, "project-close");
 	}
-
-	tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
 	update_ui();
 }
 
@@ -915,9 +905,7 @@
 		/* save current (non-project) session (it could has been changed since program startup) */
 		configuration_save_default_session();
 		/* now close all open files */
-		/** TODO make this a general, non-callback function, use it also in project_close()
-		  * and remove include of callbacks.h */
-		on_close_all1_activate(NULL, NULL);
+		document_close_all(NULL, NULL);
 		/* read session files so they can be opened with configuration_open_files() */
 		configuration_load_session_files(config);
 	}


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