SF.net SVN: geany: [2453] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Apr 8 14:07:26 UTC 2008


Revision: 2453
          http://geany.svn.sourceforge.net/geany/?rev=2453&view=rev
Author:   eht16
Date:     2008-04-08 07:07:17 -0700 (Tue, 08 Apr 2008)

Log Message:
-----------
Add document_new_file_if_non_open() to open new documents if no other documents are open.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-07 16:40:55 UTC (rev 2452)
+++ trunk/ChangeLog	2008-04-08 14:07:17 UTC (rev 2453)
@@ -1,3 +1,10 @@
+2008-04-08  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/document.c, src/document.h, src/main.c, src/project.c:
+   Add document_new_file_if_non_open() to open new documents if no
+   other documents are open.
+
+
 2008-04-06  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
 
  * THANKS: Added Dominic Hopf to list of translation supporters.
@@ -7,7 +14,7 @@
 
  * Makefile.am: Fix issue on make dist with intl_stats.sh-script.
  * scripts/changelist.pl: Make help output better readable if there are
-   not enough arguments given.
+                          not enough arguments given.
 
 
 2008-04-03  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2008-04-07 16:40:55 UTC (rev 2452)
+++ trunk/src/document.c	2008-04-08 14:07:17 UTC (rev 2453)
@@ -579,6 +579,16 @@
 }
 
 
+/* Opens a new empty document only if there are no other documents open */
+gint document_new_file_if_non_open()
+{
+	if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
+		return document_new_file(NULL, NULL, NULL);
+
+	return -1;
+}
+
+
 /**
  *  Creates a new %document.
  *  After all, the "document-new" signal is emitted for plugins.

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2008-04-07 16:40:55 UTC (rev 2452)
+++ trunk/src/document.h	2008-04-08 14:07:17 UTC (rev 2453)
@@ -153,6 +153,8 @@
 
 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);
 
 gint document_clone(gint old_idx, const gchar *utf8_filename);

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2008-04-07 16:40:55 UTC (rev 2452)
+++ trunk/src/main.c	2008-04-08 14:07:17 UTC (rev 2453)
@@ -875,8 +875,7 @@
 	main_status.opening_session_files = FALSE;
 
 	/* open a new file if no other file was opened */
-	if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
-		document_new_file(NULL, NULL, NULL);
+	document_new_file_if_non_open();
 
 	ui_document_buttons_update();
 	ui_save_buttons_toggle(FALSE);

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2008-04-07 16:40:55 UTC (rev 2452)
+++ trunk/src/project.c	2008-04-08 14:07:17 UTC (rev 2453)
@@ -217,9 +217,7 @@
 		{
 			configuration_open_files();
 			/* open a new file if no other file was opened */
-			/** TODO refactor the following into a function to be used here and in main() */
-			if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
-				document_new_file(NULL, NULL, NULL);
+			document_new_file_if_non_open();
 		}
 	}
 }
@@ -251,8 +249,7 @@
 		{
 			configuration_open_files();
 			/* open a new file if no other file was opened */
-			if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
-				document_new_file(NULL, NULL, NULL);
+			document_new_file_if_non_open();
 		}
 		g_free(file);
 	}
@@ -343,8 +340,7 @@
 			configuration_reload_default_session();
 			configuration_open_files();
 			/* open a new file if no other file was opened */
-			if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
-				document_new_file(NULL, NULL, NULL);
+			document_new_file_if_non_open();
 		}
 	}
 


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