SF.net SVN: geany:[5703] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Apr 10 13:53:05 UTC 2011


Revision: 5703
          http://geany.svn.sourceforge.net/geany/?rev=5703&view=rev
Author:   eht16
Date:     2011-04-10 13:53:05 +0000 (Sun, 10 Apr 2011)

Log Message:
-----------
Add and use signal "document-reload" to the plugin API.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/pluginsignals.c
    trunk/src/document.c
    trunk/src/geanyobject.c
    trunk/src/geanyobject.h
    trunk/src/plugindata.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-04-10 12:08:24 UTC (rev 5702)
+++ trunk/ChangeLog	2011-04-10 13:53:05 UTC (rev 5703)
@@ -2,6 +2,9 @@
 
  * src/editor.c:
    Ignore scrolling events in on_update_ui().
+ * src/geanyobject.c, src/plugindata.h, src/geanyobject.h,
+   src/document.c, doc/pluginsignals.c:
+   Add and use signal "document-reload" to the plugin API.
 
 
 2011-04-08  Colomban Wendling  <colomban(at)geany(dot)org>

Modified: trunk/doc/pluginsignals.c
===================================================================
--- trunk/doc/pluginsignals.c	2011-04-10 12:08:24 UTC (rev 5702)
+++ trunk/doc/pluginsignals.c	2011-04-10 13:53:05 UTC (rev 5703)
@@ -82,6 +82,18 @@
  */
 signal void (*document_open)(GObject *obj, GeanyDocument *doc, gpointer user_data);
 
+/** Sent when an existing document is reloaded.
+ *
+ *  You need to include "document.h" for the declaration of GeanyDocument.
+ *
+ *  @param obj a GeanyObject instance, should be ignored.
+ *  @param doc the re-opened document.
+ *  @param user_data user data.
+ *
+ *  @since 0.21
+ */
+signal void (*document_reload)(GObject *obj, GeanyDocument *doc, gpointer user_data);
+
 /** Sent before a document is saved.
  *
  *  You need to include "document.h" for the declaration of GeanyDocument.

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2011-04-10 12:08:24 UTC (rev 5702)
+++ trunk/src/document.c	2011-04-10 13:53:05 UTC (rev 5703)
@@ -1253,18 +1253,21 @@
 		if (! main_status.opening_session_files)
 			ui_add_recent_file(utf8_filename);
 
-		if (! reload)
-			g_signal_emit_by_name(geany_object, "document-open", doc);
-
 		if (reload)
+		{
+			g_signal_emit_by_name(geany_object, "document-reload", doc);
 			ui_set_statusbar(TRUE, _("File %s reloaded."), display_filename);
+		}
 		else
+		{
+			g_signal_emit_by_name(geany_object, "document-open", doc);
 			/* For translators: this is the status window message for opening a file. %d is the number
 			 * of the newly opened file, %s indicates whether the file is opened read-only
 			 * (it is replaced with the string ", read-only"). */
 			msgwin_status_add(_("File %s opened(%d%s)."),
 				display_filename, gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)),
 				(readonly) ? _(", read-only") : "");
+		}
 	}
 
 	g_free(display_filename);

Modified: trunk/src/geanyobject.c
===================================================================
--- trunk/src/geanyobject.c	2011-04-10 12:08:24 UTC (rev 5702)
+++ trunk/src/geanyobject.c	2011-04-10 13:53:05 UTC (rev 5703)
@@ -189,6 +189,15 @@
 		g_cclosure_marshal_VOID__POINTER,
 		G_TYPE_NONE, 1,
 		G_TYPE_POINTER);
+	geany_object_signals[GCB_DOCUMENT_RELOAD] = g_signal_new (
+		"document-reload",
+		G_OBJECT_CLASS_TYPE (g_object_class),
+		G_SIGNAL_RUN_FIRST,
+		G_STRUCT_OFFSET (GeanyObjectClass, document_reload),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__POINTER,
+		G_TYPE_NONE, 1,
+		G_TYPE_POINTER);
 	geany_object_signals[GCB_DOCUMENT_BEFORE_SAVE] = g_signal_new (
 		"document-before-save",
 		G_OBJECT_CLASS_TYPE (g_object_class),

Modified: trunk/src/geanyobject.h
===================================================================
--- trunk/src/geanyobject.h	2011-04-10 12:08:24 UTC (rev 5702)
+++ trunk/src/geanyobject.h	2011-04-10 13:53:05 UTC (rev 5703)
@@ -34,6 +34,7 @@
 {
 	GCB_DOCUMENT_NEW,
 	GCB_DOCUMENT_OPEN,
+	GCB_DOCUMENT_RELOAD,
 	GCB_DOCUMENT_BEFORE_SAVE,
 	GCB_DOCUMENT_SAVE,
 	GCB_DOCUMENT_FILETYPE_SET,
@@ -82,6 +83,7 @@
 
 	void (*document_new)(GeanyDocument *doc);
 	void (*document_open)(GeanyDocument *doc);
+	void (*document_reload)(GeanyDocument *doc);
 	void (*document_before_save)(GeanyDocument *doc);
 	void (*document_save)(GeanyDocument *doc);
 	void (*document_filetype_set)(GeanyDocument *doc, GeanyFiletype *filetype_old);

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2011-04-10 12:08:24 UTC (rev 5702)
+++ trunk/src/plugindata.h	2011-04-10 13:53:05 UTC (rev 5703)
@@ -54,7 +54,7 @@
  * @warning You should not test for values below 200 as previously
  * @c GEANY_API_VERSION was defined as an enum value, not a macro.
  */
-#define GEANY_API_VERSION 205
+#define GEANY_API_VERSION 206
 
 /** The Application Binary Interface (ABI) version, incremented whenever
  * existing fields in the plugin data types have to be changed or reordered.


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