SF.net SVN: geany: [1958] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Oct 18 18:03:28 UTC 2007


Revision: 1958
          http://geany.svn.sourceforge.net/geany/?rev=1958&view=rev
Author:   eht16
Date:     2007-10-18 11:03:28 -0700 (Thu, 18 Oct 2007)

Log Message:
-----------
Add encoding related functions to the plugin API.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-10-18 12:00:43 UTC (rev 1957)
+++ trunk/ChangeLog	2007-10-18 18:03:28 UTC (rev 1958)
@@ -1,3 +1,9 @@
+2007-10-18  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/plugindata.h, src/plugins.c:
+   Add encoding related functions to the plugin API.
+
+
 2007-10-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/vte.c:

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-10-18 12:00:43 UTC (rev 1957)
+++ trunk/src/document.c	2007-10-18 18:03:28 UTC (rev 1958)
@@ -520,7 +520,7 @@
  * filename is either the UTF-8 file name, or NULL.
  * If ft is NULL and filename is not NULL, then the filetype will be guessed
  * from the given filename.
- * text is the contents of the new file, or NULL.
+ * text is the contents of the new file in valid UTF-8 encoding, or NULL.
  * Returns: idx of new file in doc_list. */
 gint document_new_file(const gchar *filename, filetype *ft, const gchar *text)
 {

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2007-10-18 12:00:43 UTC (rev 1957)
+++ trunk/src/plugindata.h	2007-10-18 18:03:28 UTC (rev 1958)
@@ -71,7 +71,7 @@
 
 /* The API version should be incremented whenever any plugin data types below are
  * modified or appended to. */
-static const gint api_version = 24;
+static const gint api_version = 25;
 
 /* The ABI version should be incremented whenever existing fields in the plugin
  * data types below have to be changed or reordered. It should stay the same if fields
@@ -158,6 +158,7 @@
 	struct SupportFuncs		*support;
 	struct DialogFuncs		*dialogs;
 	struct MsgWinFuncs		*msgwindow;
+	struct EncodingFuncs	*encoding;
 }
 GeanyData;
 
@@ -181,6 +182,7 @@
 			const gchar *forced_enc);
 	gboolean (*remove)(guint page_num);
 	gboolean (*reload_file)(gint idx, const gchar *forced_enc);
+	void	(*set_encoding)(gint idx, const gchar *new_encoding);
 }
 DocumentFuncs;
 
@@ -278,6 +280,15 @@
 MsgWinFuncs;
 
 
+typedef struct EncodingFuncs
+{
+	gchar*	(*convert_to_utf8) (const gchar *buffer, gsize size, gchar **used_encoding);
+	gchar* 	(*convert_to_utf8_from_charset) (const gchar *buffer, gsize size,
+											const gchar *charset, gboolean fast);
+}
+EncodingFuncs;
+
+
 typedef struct GeanyCallback
 {
 	gchar		*signal_name;

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2007-10-18 12:00:43 UTC (rev 1957)
+++ trunk/src/plugins.c	2007-10-18 18:03:28 UTC (rev 1958)
@@ -48,6 +48,7 @@
 #include "prefs.h"
 #include "geanyobject.h"
 #include "build.h"
+#include "encodings.h"
 
 
 #ifdef G_OS_WIN32
@@ -82,7 +83,8 @@
 	&document_open_file,
 	&document_open_files,
 	&document_remove,
-	&document_reload_file
+	&document_reload_file,
+	&document_set_encoding
 };
 
 static ScintillaFuncs sci_funcs = {
@@ -177,6 +179,12 @@
 };
 
 
+static EncodingFuncs encoding_funcs = {
+	&encodings_convert_to_utf8,
+	&encodings_convert_to_utf8_from_charset
+};
+
+
 static GeanyData geany_data = {
 	NULL,
 	NULL,
@@ -193,7 +201,8 @@
 	&uiutils_funcs,
 	&support_funcs,
 	&dialog_funcs,
-	&msgwin_funcs
+	&msgwin_funcs,
+	&encoding_funcs
 };
 
 


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