Skip to content

Instantly share code, notes, and snippets.

@codebrainz
Created March 28, 2012 05:11
Show Gist options
  • Select an option

  • Save codebrainz/2223810 to your computer and use it in GitHub Desktop.

Select an option

Save codebrainz/2223810 to your computer and use it in GitHub Desktop.
Allow writing Geany plugins in C++
diff --git a/src/build.h b/src/build.h
index 4e92290..543c329 100644
--- a/src/build.h
+++ b/src/build.h
@@ -24,6 +24,8 @@
#ifndef GEANY_BUILD_H
#define GEANY_BUILD_H 1
+G_BEGIN_DECLS
+
/* Order is important (see GBO_TO_GBG, GBO_TO_CMD below) */
/* * Geany Known Build Commands.
* These commands are named after their default use.
@@ -181,7 +183,7 @@ void build_remove_menu_item(const GeanyBuildSource src, const GeanyBuildGroup gr
GeanyBuildCommand *build_get_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const guint cmd);
-const gchar *build_get_current_menu_item(const GeanyBuildGroup grp, const guint cmd,
+const gchar *build_get_current_menu_item(const GeanyBuildGroup grp, const guint cmd,
const GeanyBuildCmdEntries field);
void build_set_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp,
@@ -202,4 +204,6 @@ guint build_get_group_count(const GeanyBuildGroup grp);
gchar **build_get_regex(GeanyBuildGroup grp, GeanyFiletype *ft, guint *from);
+G_END_DECLS
+
#endif
diff --git a/src/document.h b/src/document.h
index 13bbd65..9f93af3 100644
--- a/src/document.h
+++ b/src/document.h
@@ -29,6 +29,8 @@
#ifndef GEANY_DOCUMENT_H
#define GEANY_DOCUMENT_H 1
+G_BEGIN_DECLS
+
#include "Scintilla.h"
#include "ScintillaWidget.h"
#include "editor.h"
@@ -279,4 +281,6 @@ gint document_compare_by_tab_order_reverse(gconstpointer a, gconstpointer b);
void document_grab_focus(GeanyDocument *doc);
+G_END_DECLS
+
#endif
diff --git a/src/editor.h b/src/editor.h
index e56854f..a35fa44 100644
--- a/src/editor.h
+++ b/src/editor.h
@@ -23,6 +23,8 @@
#ifndef GEANY_EDITOR_H
#define GEANY_EDITOR_H 1
+G_BEGIN_DECLS
+
#include "Scintilla.h"
#include "ScintillaWidget.h"
@@ -317,4 +319,6 @@ const gchar *editor_find_snippet(GeanyEditor *editor, const gchar *snippet_name)
void editor_insert_snippet(GeanyEditor *editor, gint pos, const gchar *snippet);
+G_END_DECLS
+
#endif
diff --git a/src/encodings.h b/src/encodings.h
index c62dd2c..d85949b 100644
--- a/src/encodings.h
+++ b/src/encodings.h
@@ -36,6 +36,7 @@
#ifndef GEANY_ENCODINGS_H
#define GEANY_ENCODINGS_H
+G_BEGIN_DECLS
typedef enum
{
@@ -187,4 +188,6 @@ GeanyEncodingIndex encodings_scan_unicode_bom(const gchar *string, gsize len, gu
GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset);
+G_END_DECLS
+
#endif
diff --git a/src/filetypes.h b/src/filetypes.h
index 5863577..65eec1a 100644
--- a/src/filetypes.h
+++ b/src/filetypes.h
@@ -23,6 +23,8 @@
#ifndef GEANY_FILETYPES_H
#define GEANY_FILETYPES_H 1
+G_BEGIN_DECLS
+
#include "Scintilla.h"
#include "ScintillaWidget.h"
@@ -212,4 +214,6 @@ gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message,
gboolean filetype_get_comment_open_close(const GeanyFiletype *ft, gboolean single_first,
const gchar **co, const gchar **cc);
+G_END_DECLS
+
#endif
diff --git a/src/geany.h b/src/geany.h
index 1108f91..ff53f11 100644
--- a/src/geany.h
+++ b/src/geany.h
@@ -25,12 +25,14 @@
#ifndef GEANY_H
#define GEANY_H
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
#if defined(HAVE_CONFIG_H) && defined(GEANY_PRIVATE)
# include "config.h"
#endif
-#include <gtk/gtk.h>
-
#include "tm_tagmanager.h"
#ifndef PLAT_GTK
@@ -96,4 +98,6 @@ void geany_debug(gchar const *format, ...) G_GNUC_PRINTF (1, 2);
#define G_GNUC_WARN_UNUSED_RESULT
#endif
+G_END_DECLS
+
#endif
diff --git a/src/highlighting.h b/src/highlighting.h
index 13ab476..3cb6582 100644
--- a/src/highlighting.h
+++ b/src/highlighting.h
@@ -23,6 +23,8 @@
#ifndef GEANY_HIGHLIGHTING_H
#define GEANY_HIGHLIGHTING_H 1
+G_BEGIN_DECLS
+
#include "Scintilla.h"
#include "ScintillaWidget.h"
@@ -53,4 +55,6 @@ gboolean highlighting_is_string_style(gint lexer, gint style);
gboolean highlighting_is_comment_style(gint lexer, gint style);
gboolean highlighting_is_code_style(gint lexer, gint style);
+G_END_DECLS
+
#endif
diff --git a/src/keybindings.h b/src/keybindings.h
index b012af2..51e94e3 100644
--- a/src/keybindings.h
+++ b/src/keybindings.h
@@ -22,6 +22,8 @@
#ifndef GEANY_KEYBINDINGS_H
#define GEANY_KEYBINDINGS_H 1
+G_BEGIN_DECLS
+
/** Function pointer type used for keybinding callbacks. */
typedef void (*GeanyKeyCallback) (guint key_id);
@@ -279,4 +281,6 @@ void keybindings_show_shortcuts(void);
gboolean keybindings_check_event(GdkEventKey *ev, GeanyKeyBinding *kb);
+G_END_DECLS
+
#endif
diff --git a/src/msgwindow.h b/src/msgwindow.h
index b5ece96..bf2718d 100644
--- a/src/msgwindow.h
+++ b/src/msgwindow.h
@@ -22,6 +22,7 @@
#ifndef GEANY_MSGWINDOW_H
#define GEANY_MSGWINDOW_H 1
+G_BEGIN_DECLS
/**
* Various colors for use in the compiler and messages treeviews when adding messages.
@@ -101,4 +102,6 @@ void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir,
gboolean msgwin_goto_messages_file_line(gboolean focus_editor);
+G_END_DECLS
+
#endif
diff --git a/src/plugindata.h b/src/plugindata.h
index 91af27b..5e418e0 100644
--- a/src/plugindata.h
+++ b/src/plugindata.h
@@ -33,6 +33,8 @@
#ifndef GEANY_PLUGINDATA_H
#define GEANY_PLUGINDATA_H
+G_BEGIN_DECLS
+
/* Compatibility for sharing macros between API and core.
* First include geany.h, then plugindata.h, then other API headers. */
#undef GEANY
@@ -714,7 +716,7 @@ SymbolsFuncs;
typedef struct BuildFuncs
{
void (*build_activate_menu_item)(const GeanyBuildGroup grp, const guint cmd);
- const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
+ const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
const GeanyBuildCmdEntries field);
void (*build_remove_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp,
const gint cmd);
@@ -739,4 +741,6 @@ BuildFuncs;
#endif /* GEANY_DISABLE_DEPRECATED */
+G_END_DECLS
+
#endif
diff --git a/src/prefs.h b/src/prefs.h
index e0d587a..67ba7a0 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -23,6 +23,8 @@
#ifndef GEANY_PREFS_H
#define GEANY_PREFS_H 1
+G_BEGIN_DECLS
+
/** General Preferences dialog settings. */
typedef struct GeanyPrefs
{
@@ -57,4 +59,6 @@ extern GeanyToolPrefs tool_prefs;
void prefs_show_dialog(void);
+G_END_DECLS
+
#endif
diff --git a/src/project.h b/src/project.h
index 1da8731..543a09c 100644
--- a/src/project.h
+++ b/src/project.h
@@ -23,6 +23,8 @@
#ifndef GEANY_PROJECT_H
#define GEANY_PROJECT_H 1
+G_BEGIN_DECLS
+
#define GEANY_PROJECT_EXT "geany"
@@ -94,4 +96,6 @@ void project_setup_prefs(void);
void project_apply_prefs(void);
+G_END_DECLS
+
#endif
diff --git a/src/search.h b/src/search.h
index 6d84cef..ed0bbcc 100644
--- a/src/search.h
+++ b/src/search.h
@@ -28,6 +28,8 @@
#ifndef GEANY_SEARCH_H
#define GEANY_SEARCH_H 1
+G_BEGIN_DECLS
+
/* the flags given in the search dialog for "find next", also used by the search bar */
typedef struct GeanySearchData
{
@@ -98,4 +100,6 @@ gint search_replace_target(struct _ScintillaObject *sci, const gchar *replace_te
guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
gint flags, const gchar *replace_text);
+G_END_DECLS
+
#endif
diff --git a/src/stash.h b/src/stash.h
index 13c3b4c..949fb2d 100644
--- a/src/stash.h
+++ b/src/stash.h
@@ -23,6 +23,8 @@
#ifndef GEANY_STASH_H
#define GEANY_STASH_H
+G_BEGIN_DECLS
+
/** Opaque type for a group of settings. */
typedef struct StashGroup StashGroup;
@@ -96,4 +98,6 @@ void stash_tree_display(GtkTreeView *tree);
void stash_tree_update(GtkTreeView *tree);
+G_END_DECLS
+
#endif
diff --git a/src/support.h b/src/support.h
index e039155..1c7bef0 100644
--- a/src/support.h
+++ b/src/support.h
@@ -25,6 +25,7 @@
* @see GLib's @c gi18n-lib.h.
**/
+G_BEGIN_DECLS
#include "geany.h"
@@ -39,3 +40,5 @@
# define Q_(String) g_strip_context((String), (String))
# define N_(String) String
#endif
+
+G_END_DECLS
diff --git a/src/templates.h b/src/templates.h
index 990d3c5..a4ce1df 100644
--- a/src/templates.h
+++ b/src/templates.h
@@ -28,6 +28,8 @@
#ifndef GEANY_TEMPLATES_H
#define GEANY_TEMPLATES_H 1
+G_BEGIN_DECLS
+
#define GEANY_TEMPLATES_INDENT 3
enum
@@ -73,7 +75,7 @@ gchar *templates_get_template_function(GeanyDocument *doc, const gchar *func_nam
gchar *templates_get_template_licence(GeanyDocument *doc, gint licence_type);
-void templates_replace_common(GString *template, const gchar *fname,
+void templates_replace_common(GString *tmpl, const gchar *fname,
GeanyFiletype *ft, const gchar *func_name);
void templates_replace_valist(GString *text,
@@ -81,4 +83,6 @@ void templates_replace_valist(GString *text,
void templates_free_templates(void);
+G_END_DECLS
+
#endif
diff --git a/src/toolbar.h b/src/toolbar.h
index 37ab9bb..62e6de9 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -22,6 +22,8 @@
#ifndef GEANY_TOOLBAR_H
#define GEANY_TOOLBAR_H
+G_BEGIN_DECLS
+
/** Toolbar settings. */
typedef struct GeanyToolbarPrefs
{
@@ -59,4 +61,6 @@ void toolbar_finalize(void);
void toolbar_configure(GtkWindow *parent);
+G_END_DECLS
+
#endif
diff --git a/src/ui_utils.h b/src/ui_utils.h
index 57a1724..8780c4f 100644
--- a/src/ui_utils.h
+++ b/src/ui_utils.h
@@ -22,6 +22,8 @@
#ifndef GEANY_UI_UTILS_H
#define GEANY_UI_UTILS_H 1
+G_BEGIN_DECLS
+
/** Sets a name to lookup @a widget from @a owner.
* @param owner Usually a window, dialog or popup menu.
@@ -345,5 +347,6 @@ GdkPixbuf *ui_get_mime_icon(const gchar *mime_type, GtkIconSize size);
void ui_focus_current_document(void);
+G_END_DECLS
#endif
diff --git a/src/utils.h b/src/utils.h
index 64834be..e1ff31c 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -27,6 +27,7 @@
#ifndef GEANY_UTILS_H
#define GEANY_UTILS_H 1
+G_BEGIN_DECLS
#include <time.h>
@@ -276,4 +277,6 @@ gchar *utils_str_remove_chars(gchar *string, const gchar *chars);
gchar **utils_copy_environment(const gchar **exclude_vars, const gchar *first_varname, ...) G_GNUC_NULL_TERMINATED;
+G_END_DECLS
+
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment