[geany/geany] 6098f5: encodings: move private stuff into private header

Thomas Martitz git-noreply at xxxxx
Mon Jan 18 02:47:05 UTC 2016


Branch:      refs/heads/master
Author:      Thomas Martitz <kugel at rockbox.org>
Committer:   Thomas Martitz <kugel at rockbox.org>
Date:        Thu, 17 Dec 2015 08:52:49 UTC
Commit:      6098f550329bb1d9a17eafda18670645d5b7abfb
             https://github.com/geany/geany/commit/6098f550329bb1d9a17eafda18670645d5b7abfb

Log Message:
-----------
encodings: move private stuff into private header

encodings.h had a pretty large GEANY_PRIVATE part so it's worthwhile to
separate that into its own header (as per HACKING). What's left is used by the
plugin API.


Modified Paths:
--------------
    src/Makefile.am
    src/dialogs.c
    src/document.c
    src/encodings.c
    src/encodings.h
    src/encodingsprivate.h
    src/keyfile.c
    src/libmain.c
    src/prefs.c
    src/search.c
    src/templates.c
    src/ui_utils.c

Modified: src/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -5,6 +5,7 @@ EXTRA_DIST = \
 	gb.c \
 	plugindata.h \
 	documentprivate.h \
+	encodingsprivate.h \
 	filetypesprivate.h \
 	keybindingsprivate.h \
 	pluginprivate.h \


Modified: src/dialogs.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -33,6 +33,7 @@
 #include "build.h"
 #include "document.h"
 #include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypes.h"
 #include "main.h"
 #include "support.h"


Modified: src/document.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -35,6 +35,7 @@
 #include "dialogs.h"
 #include "documentprivate.h"
 #include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypesprivate.h"
 #include "geany.h" /* FIXME: why is this needed for DOC_FILENAME()? should come from documentprivate.h/document.h */
 #include "geanyobject.h"


Modified: src/encodings.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -35,6 +35,7 @@
 #endif
 
 #include "encodings.h"
+#include "encodingsprivate.h"
 
 #include "app.h"
 #include "callbacks.h"


Modified: src/encodings.h
70 lines changed, 2 insertions(+), 68 deletions(-)
===================================================================
@@ -40,19 +40,6 @@
 
 G_BEGIN_DECLS
 
-typedef enum
-{
-	NONE = 0,
-	WESTEUROPEAN,
-	EASTEUROPEAN,
-	EASTASIAN,
-	ASIAN,
-	MIDDLEEASTERN,
-	UNICODE,
-
-	GEANY_ENCODING_GROUPS_MAX
-} GeanyEncodingGroup;
-
 /*
  * The original versions of the following tables are taken from profterm
  *
@@ -139,23 +126,8 @@ typedef enum
 	GEANY_ENCODING_CP_932,
 
 	GEANY_ENCODINGS_MAX
-} GeanyEncodingIndex;
-
-/** Structure to represent an encoding to be used in Geany. */
-typedef struct
-{
-	/** The index of the encoding, must be one of GeanyEncodingIndex. */
-	gint   				 idx;
-	/** Internally used member for grouping */
-	gint   				 order;
-	/** Internally used member for grouping */
-	GeanyEncodingGroup   group;
-	/** String representation of the encoding, e.g. "ISO-8859-3" */
-	const gchar			*charset;
-	/** Translatable and descriptive name of the encoding, e.g. "South European" */
-	const gchar			*name;
-} GeanyEncoding;
-
+}
+GeanyEncodingIndex;
 
 gchar *encodings_convert_to_utf8(const gchar *buffer, gssize size, gchar **used_encoding);
 
@@ -166,44 +138,6 @@ gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gssize size,
 
 const gchar* encodings_get_charset_from_index(gint idx);
 
-
-#ifdef GEANY_PRIVATE
-
-const GeanyEncoding* encodings_get_from_charset(const gchar *charset);
-const GeanyEncoding* encodings_get_from_index(gint idx);
-
-gchar* encodings_to_string(const GeanyEncoding* enc);
-const gchar* encodings_get_charset(const GeanyEncoding* enc);
-
-void encodings_select_radio_item(const gchar *charset);
-
-void encodings_init(void);
-void encodings_finalize(void);
-
-GtkTreeStore *encodings_encoding_store_new(gboolean has_detect);
-
-gint encodings_encoding_store_get_encoding(GtkTreeStore *store, GtkTreeIter *iter);
-
-gboolean encodings_encoding_store_get_iter(GtkTreeStore *store, GtkTreeIter *iter, gint enc);
-
-void encodings_encoding_store_cell_data_func(GtkCellLayout *cell_layout, GtkCellRenderer *cell,
-		GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data);
-
-gboolean encodings_is_unicode_charset(const gchar *string);
-
-gboolean encodings_convert_to_utf8_auto(gchar **buf, gsize *size, const gchar *forced_enc,
-		gchar **used_encoding, gboolean *has_bom, gboolean *partial);
-
-
-extern GeanyEncoding encodings[GEANY_ENCODINGS_MAX];
-
-
-GeanyEncodingIndex encodings_scan_unicode_bom(const gchar *string, gsize len, guint *bom_len);
-
-GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset);
-
-#endif /* GEANY_PRIVATE */
-
 G_END_DECLS
 
 #endif /* GEANY_ENCODINGS_H */


Modified: src/encodingsprivate.h
84 lines changed, 84 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,84 @@
+/*
+ *      encodingsprivate.h - this file is part of Geany, a fast and lightweight IDE
+ *
+ *      Copyright 2005-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+ *      Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+ *
+ *      This program is free software; you can redistribute it and/or modify
+ *      it under the terms of the GNU General Public License as published by
+ *      the Free Software Foundation; either version 2 of the License, or
+ *      (at your option) any later version.
+ *
+ *      This program is distributed in the hope that it will be useful,
+ *      but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *      GNU General Public License for more details.
+ *
+ *      You should have received a copy of the GNU General Public License along
+ *      with this program; if not, write to the Free Software Foundation, Inc.,
+ *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef ENCODINGSPRIVATE_H
+#define ENCODINGSPRIVATE_H
+
+#include "encodings.h"
+
+/* Groups of encodings */
+typedef enum
+{
+	NONE = 0,
+	WESTEUROPEAN,
+	EASTEUROPEAN,
+	EASTASIAN,
+	ASIAN,
+	MIDDLEEASTERN,
+	UNICODE,
+
+	GEANY_ENCODING_GROUPS_MAX
+}
+GeanyEncodingGroup;
+
+/* Structure to represent an encoding to be used in Geany. */
+typedef struct GeanyEncoding
+{
+	GeanyEncodingIndex      idx; /* The index of the encoding inside globa encodes array.*/
+	gint                    order; /* Internally used member for grouping */
+	GeanyEncodingGroup      group; /* Internally used member for grouping */
+	const gchar            *charset; /* String representation of the encoding, e.g. "ISO-8859-3" */
+	const gchar            *name; /* Translatable and descriptive name of the encoding, e.g. "South European" */
+}
+GeanyEncoding;
+
+const GeanyEncoding* encodings_get_from_charset(const gchar *charset);
+const GeanyEncoding* encodings_get_from_index(gint idx);
+
+gchar* encodings_to_string(const GeanyEncoding* enc);
+const gchar* encodings_get_charset(const GeanyEncoding* enc);
+
+void encodings_select_radio_item(const gchar *charset);
+
+void encodings_init(void);
+void encodings_finalize(void);
+
+GtkTreeStore *encodings_encoding_store_new(gboolean has_detect);
+
+gint encodings_encoding_store_get_encoding(GtkTreeStore *store, GtkTreeIter *iter);
+
+gboolean encodings_encoding_store_get_iter(GtkTreeStore *store, GtkTreeIter *iter, gint enc);
+
+void encodings_encoding_store_cell_data_func(GtkCellLayout *cell_layout, GtkCellRenderer *cell,
+                                             GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data);
+
+gboolean encodings_is_unicode_charset(const gchar *string);
+
+gboolean encodings_convert_to_utf8_auto(gchar **buf, gsize *size, const gchar *forced_enc,
+                                        gchar **used_encoding, gboolean *has_bom, gboolean *partial);
+
+GeanyEncodingIndex encodings_scan_unicode_bom(const gchar *string, gsize len, guint *bom_len);
+
+GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset);
+
+extern GeanyEncoding encodings[GEANY_ENCODINGS_MAX];
+
+#endif /* ENCODINGSPRIVATE_H */


Modified: src/keyfile.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -38,6 +38,7 @@
 #include "build.h"
 #include "document.h"
 #include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypes.h"
 #include "geanyobject.h"
 #include "main.h"


Modified: src/libmain.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -36,7 +36,7 @@
 #include "callbacks.h"
 #include "dialogs.h"
 #include "document.h"
-#include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypes.h"
 #include "geanyobject.h"
 #include "highlighting.h"


Modified: src/prefs.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -39,7 +39,7 @@
 #include "dialogs.h"
 #include "documentprivate.h"
 #include "editor.h"
-#include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypes.h"
 #include "geanywraplabel.h"
 #include "keybindingsprivate.h"


Modified: src/search.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -33,6 +33,7 @@
 #include "app.h"
 #include "document.h"
 #include "encodings.h"
+#include "encodingsprivate.h"
 #include "keyfile.h"
 #include "msgwindow.h"
 #include "prefs.h"


Modified: src/templates.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -32,7 +32,7 @@
 
 #include "app.h"
 #include "document.h"
-#include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypes.h"
 #include "geany.h"
 #include "geanymenubuttonaction.h"


Modified: src/ui_utils.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -34,7 +34,7 @@
 #include "callbacks.h"
 #include "dialogs.h"
 #include "documentprivate.h"
-#include "encodings.h"
+#include "encodingsprivate.h"
 #include "filetypes.h"
 #include "geanymenubuttonaction.h"
 #include "keyfile.h"



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list