Add encoding related functions to the plugin API.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1958 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
e20883cdcb
commit
62d31d6c92
@ -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:
|
||||
|
@ -520,7 +520,7 @@ static void store_saved_encoding(gint idx)
|
||||
* 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)
|
||||
{
|
||||
|
@ -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 @@ typedef struct GeanyData
|
||||
struct SupportFuncs *support;
|
||||
struct DialogFuncs *dialogs;
|
||||
struct MsgWinFuncs *msgwindow;
|
||||
struct EncodingFuncs *encoding;
|
||||
}
|
||||
GeanyData;
|
||||
|
||||
@ -181,6 +182,7 @@ typedef struct DocumentFuncs
|
||||
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 @@ typedef struct MsgWinFuncs
|
||||
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;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "prefs.h"
|
||||
#include "geanyobject.h"
|
||||
#include "build.h"
|
||||
#include "encodings.h"
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@ -82,7 +83,8 @@ static DocumentFuncs doc_funcs = {
|
||||
&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 MsgWinFuncs msgwin_funcs = {
|
||||
};
|
||||
|
||||
|
||||
static EncodingFuncs encoding_funcs = {
|
||||
&encodings_convert_to_utf8,
|
||||
&encodings_convert_to_utf8_from_charset
|
||||
};
|
||||
|
||||
|
||||
static GeanyData geany_data = {
|
||||
NULL,
|
||||
NULL,
|
||||
@ -193,7 +201,8 @@ static GeanyData geany_data = {
|
||||
&uiutils_funcs,
|
||||
&support_funcs,
|
||||
&dialog_funcs,
|
||||
&msgwin_funcs
|
||||
&msgwin_funcs,
|
||||
&encoding_funcs
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user