[geany/geany] 23d9ca: Start to make it easier to compile the core in isolation

Matthew Brush git-noreply at xxxxx
Wed May 21 19:17:59 UTC 2014


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <matt at geany.org>
Date:        Wed, 21 May 2014 19:17:59 UTC
Commit:      23d9cad7dcbc93e5f6cfcc5688bc928692c11bcd
             https://github.com/geany/geany/commit/23d9cad7dcbc93e5f6cfcc5688bc928692c11bcd

Log Message:
-----------
Start to make it easier to compile the core in isolation

This is for work on making the files scannable by GObject-Introspection
but is still useful otherwise (even fixes a FIXME in the comments). I
made this by using a simple GNU Make file and trying to compile the
sources each on their own without all the build system infrastructure.

* Add keybindingsprivate.h file to hold private GeanyKeyGroup structure
and remove it from the GEANY_PRIVATE guard in keybindings.h.
* Move private members that were guarded by GEANY_PRIVATE from
GeanyFiletypes to GeanyFiletypesPrivate and remove guarded build.h
include.
* Move private members that were guarded by GEANY_PRIVATE from
GeanyProject to GeanyProjectPrivate.


Modified Paths:
--------------
    src/Makefile.am
    src/build.c
    src/editor.c
    src/filetypes.c
    src/filetypes.h
    src/filetypesprivate.h
    src/keybindings.c
    src/keybindings.h
    src/keybindingsprivate.h
    src/keyfile.c
    src/main.c
    src/plugins.c
    src/prefs.c
    src/project.c
    src/project.h
    src/projectprivate.h
    src/support.h

Modified: src/Makefile.am
11 lines changed, 9 insertions(+), 2 deletions(-)
===================================================================
@@ -1,8 +1,15 @@
 ## Process this file with automake to produce Makefile.in
 
 
-EXTRA_DIST = gb.c win32.c win32.h plugindata.h \
-	documentprivate.h filetypesprivate.h pluginprivate.h projectprivate.h \
+EXTRA_DIST = \
+	gb.c \
+	win32.c win32.h \
+	plugindata.h \
+	documentprivate.h \
+	filetypesprivate.h \
+	keybindingsprivate.h \
+	pluginprivate.h \
+	projectprivate.h \
 	makefile.win32
 
 bin_PROGRAMS = geany


Modified: src/build.c
118 lines changed, 59 insertions(+), 59 deletions(-)
===================================================================
@@ -53,10 +53,10 @@
 #include "ui_utils.h"
 #include "dialogs.h"
 #include "msgwindow.h"
-#include "filetypes.h"
+#include "filetypesprivate.h"
 #include "keybindings.h"
 #include "vte.h"
-#include "project.h"
+#include "projectprivate.h"
 #include "editor.h"
 #include "win32.h"
 #include "toolbar.h"
@@ -249,13 +249,13 @@ static void printfcmds(void)
 	if (ft != NULL)
 	{
 		printf("filetype %s\n",ft->name);
-		cl[GEANY_GBG_FT][GEANY_BCS_FT] = &(ft->filecmds);
-		cl[GEANY_GBG_FT][GEANY_BCS_HOME_FT] = &(ft->homefilecmds);
-		cl[GEANY_GBG_FT][GEANY_BCS_PROJ] = &(ft->projfilecmds);
-		cl[GEANY_GBG_NON_FT][GEANY_BCS_FT] = &(ft->ftdefcmds);
-		cl[GEANY_GBG_EXEC][GEANY_BCS_FT] = &(ft->execcmds);
-		cl[GEANY_GBG_EXEC][GEANY_BCS_HOME_FT] = &(ft->homeexeccmds);
-		cl[GEANY_GBG_EXEC][GEANY_BCS_PROJ_FT] = &(ft->projexeccmds);
+		cl[GEANY_GBG_FT][GEANY_BCS_FT] = &(ft->priv->filecmds);
+		cl[GEANY_GBG_FT][GEANY_BCS_HOME_FT] = &(ft->priv->homefilecmds);
+		cl[GEANY_GBG_FT][GEANY_BCS_PROJ] = &(ft->priv->projfilecmds);
+		cl[GEANY_GBG_NON_FT][GEANY_BCS_FT] = &(ft->priv->ftdefcmds);
+		cl[GEANY_GBG_EXEC][GEANY_BCS_FT] = &(ft->priv->execcmds);
+		cl[GEANY_GBG_EXEC][GEANY_BCS_HOME_FT] = &(ft->priv->homeexeccmds);
+		cl[GEANY_GBG_EXEC][GEANY_BCS_PROJ_FT] = &(ft->priv->projexeccmds);
 	}
 	for (i = 0; i < GEANY_BCS_COUNT; ++i)
 	{
@@ -320,13 +320,13 @@ static void printfcmds(void)
 	}
 
 #define return_ft_cmd_if(src, cmds)\
-	if (ft != NULL && ft->cmds != NULL \
-		&& ft->cmds[cmdindex].exists && below>src)\
+	if (ft != NULL && ft->priv->cmds != NULL \
+		&& ft->priv->cmds[cmdindex].exists && below>src)\
 		{ \
 			*fr=src; \
 			if (printbuildcmds) \
 				printf("cmd[%u,%u]=%u\n",cmdgrp,cmdindex,src); \
-			return &(ft->cmds[cmdindex]); \
+			return &(ft->priv->cmds[cmdindex]); \
 		}
 
 
@@ -412,8 +412,8 @@ gchar **build_get_regex(GeanyBuildGroup grp, GeanyFiletype *ft, guint *from)
 		}
 		if (ft == NULL)
 			return NULL;
-		return_nonblank_regex(GEANY_BCS_PROJ, ft->projerror_regex_string);
-		return_nonblank_regex(GEANY_BCS_HOME_FT, ft->homeerror_regex_string);
+		return_nonblank_regex(GEANY_BCS_PROJ, ft->priv->projerror_regex_string);
+		return_nonblank_regex(GEANY_BCS_HOME_FT, ft->priv->homeerror_regex_string);
 		return_nonblank_regex(GEANY_BCS_FT, ft->error_regex_string);
 	}
 	else if (grp == GEANY_GBG_NON_FT)
@@ -439,11 +439,11 @@ static GeanyBuildCommand **get_build_group_pointer(const GeanyBuildSource src, c
 				return NULL;
 			switch (src)
 			{
-				case GEANY_BCS_DEF:	 return &(ft->ftdefcmds);
-				case GEANY_BCS_FT:	  return &(ft->filecmds);
-				case GEANY_BCS_HOME_FT: return &(ft->homefilecmds);
-				case GEANY_BCS_PREF:	return &(ft->homefilecmds);
-				case GEANY_BCS_PROJ:	return &(ft->projfilecmds);
+				case GEANY_BCS_DEF:	 return &(ft->priv->ftdefcmds);
+				case GEANY_BCS_FT:	  return &(ft->priv->filecmds);
+				case GEANY_BCS_HOME_FT: return &(ft->priv->homefilecmds);
+				case GEANY_BCS_PREF:	return &(ft->priv->homefilecmds);
+				case GEANY_BCS_PROJ:	return &(ft->priv->projfilecmds);
 				default: return NULL;
 			}
 			break;
@@ -462,9 +462,9 @@ static GeanyBuildCommand **get_build_group_pointer(const GeanyBuildSource src, c
 			switch (src)
 			{
 				case GEANY_BCS_DEF:	 return &(exec_def);
-				case GEANY_BCS_FT:	  return ft ? &(ft->execcmds): NULL;
-				case GEANY_BCS_HOME_FT: return ft ? &(ft->homeexeccmds): NULL;
-				case GEANY_BCS_PROJ_FT: return ft ? &(ft->projexeccmds): NULL;
+				case GEANY_BCS_FT:	  return ft ? &(ft->priv->execcmds): NULL;
+				case GEANY_BCS_HOME_FT: return ft ? &(ft->priv->homeexeccmds): NULL;
+				case GEANY_BCS_PROJ_FT: return ft ? &(ft->priv->projexeccmds): NULL;
 				case GEANY_BCS_PREF:	return &(exec_pref);
 				case GEANY_BCS_PROJ:	return &(exec_proj);
 				default: return NULL;
@@ -2320,8 +2320,8 @@ void build_read_project(GeanyFiletype *ft, BuildTableData build_properties)
 
 	if (ft != NULL)
 	{
-		menu_dst.dst[GEANY_GBG_FT] = &(ft->projfilecmds);
-		menu_dst.fileregexstr = &(ft->projerror_regex_string);
+		menu_dst.dst[GEANY_GBG_FT] = &(ft->priv->projfilecmds);
+		menu_dst.fileregexstr = &(ft->priv->projerror_regex_string);
 	}
 	else
 	{
@@ -2362,9 +2362,9 @@ static void show_build_commands_dialog(void)
 	prefdsts.dst[GEANY_GBG_NON_FT] = &non_ft_pref;
 	if (ft != NULL)
 	{
-		prefdsts.dst[GEANY_GBG_FT] = &(ft->homefilecmds);
-		prefdsts.fileregexstr = &(ft->homeerror_regex_string);
-		prefdsts.dst[GEANY_GBG_EXEC] = &(ft->homeexeccmds);
+		prefdsts.dst[GEANY_GBG_FT] = &(ft->priv->homefilecmds);
+		prefdsts.fileregexstr = &(ft->priv->homeerror_regex_string);
+		prefdsts.dst[GEANY_GBG_EXEC] = &(ft->priv->homeexeccmds);
 	}
 	else
 	{
@@ -2474,9 +2474,9 @@ void build_load_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
 				ft = (GeanyFiletype*)p;
 				if (ft == NULL)
 					return;
-				build_load_menu_grp(config, &(ft->filecmds), GEANY_GBG_FT, NULL, TRUE);
-				build_load_menu_grp(config, &(ft->ftdefcmds), GEANY_GBG_NON_FT, NULL, TRUE);
-				build_load_menu_grp(config, &(ft->execcmds), GEANY_GBG_EXEC, NULL, TRUE);
+				build_load_menu_grp(config, &(ft->priv->filecmds), GEANY_GBG_FT, NULL, TRUE);
+				build_load_menu_grp(config, &(ft->priv->ftdefcmds), GEANY_GBG_NON_FT, NULL, TRUE);
+				build_load_menu_grp(config, &(ft->priv->execcmds), GEANY_GBG_EXEC, NULL, TRUE);
 				SETPTR(ft->error_regex_string,
 						g_key_file_get_string(config, build_grp_name, "error_regex", NULL));
 				break;
@@ -2484,9 +2484,9 @@ void build_load_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
 				ft = (GeanyFiletype*)p;
 				if (ft == NULL)
 					return;
-				build_load_menu_grp(config, &(ft->homefilecmds), GEANY_GBG_FT, NULL, FALSE);
-				build_load_menu_grp(config, &(ft->homeexeccmds), GEANY_GBG_EXEC, NULL, FALSE);
-				SETPTR(ft->homeerror_regex_string,
+				build_load_menu_grp(config, &(ft->priv->homefilecmds), GEANY_GBG_FT, NULL, FALSE);
+				build_load_menu_grp(config, &(ft->priv->homeexeccmds), GEANY_GBG_EXEC, NULL, FALSE);
+				SETPTR(ft->priv->homeerror_regex_string,
 						g_key_file_get_string(config, build_grp_name, "error_regex", NULL));
 				break;
 			case GEANY_BCS_PREF:
@@ -2505,21 +2505,21 @@ void build_load_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
 				if (ftlist != NULL)
 				{
 					gchar **ftname;
-					if (pj->build_filetypes_list == NULL)
-						pj->build_filetypes_list = g_ptr_array_new();
-					g_ptr_array_set_size(pj->build_filetypes_list, 0);
+					if (pj->priv->build_filetypes_list == NULL)
+						pj->priv->build_filetypes_list = g_ptr_array_new();
+					g_ptr_array_set_size(pj->priv->build_filetypes_list, 0);
 					for (ftname = ftlist; *ftname != NULL; ++ftname)
 					{
 						ft = filetypes_lookup_by_name(*ftname);
 						if (ft != NULL)
 						{
 							gchar *regkey = g_strdup_printf("%serror_regex", *ftname);
-							g_ptr_array_add(pj->build_filetypes_list, ft);
-							SETPTR(ft->projerror_regex_string,
+							g_ptr_array_add(pj->priv->build_filetypes_list, ft);
+							SETPTR(ft->priv->projerror_regex_string,
 									g_key_file_get_string(config, build_grp_name, regkey, NULL));
 							g_free(regkey);
-							build_load_menu_grp(config, &(ft->projfilecmds), GEANY_GBG_FT, *ftname, FALSE);
-							build_load_menu_grp(config, &(ft->projexeccmds), GEANY_GBG_EXEC, *ftname, FALSE);
+							build_load_menu_grp(config, &(ft->priv->projfilecmds), GEANY_GBG_FT, *ftname, FALSE);
+							build_load_menu_grp(config, &(ft->priv->projexeccmds), GEANY_GBG_EXEC, *ftname, FALSE);
 						}
 					}
 					g_free(ftlist);
@@ -2554,23 +2554,23 @@ void build_load_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
 			value = g_key_file_get_string(config, "build_settings", "compiler", NULL);
 			if (value != NULL)
 			{
-				if (ft->filecmds == NULL)
-					ft->filecmds = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_FT]);
-				ASSIGNIF(ft->filecmds, GEANY_GBO_COMPILE, _("_Compile"), value);
+				if (ft->priv->filecmds == NULL)
+					ft->priv->filecmds = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_FT]);
+				ASSIGNIF(ft->priv->filecmds, GEANY_GBO_COMPILE, _("_Compile"), value);
 			}
 			value = g_key_file_get_string(config, "build_settings", "linker", NULL);
 			if (value != NULL)
 			{
-				if (ft->filecmds == NULL)
-					ft->filecmds = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_FT]);
-				ASSIGNIF(ft->filecmds, GEANY_GBO_BUILD, _("_Build"), value);
+				if (ft->priv->filecmds == NULL)
+					ft->priv->filecmds = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_FT]);
+				ASSIGNIF(ft->priv->filecmds, GEANY_GBO_BUILD, _("_Build"), value);
 			}
 			value = g_key_file_get_string(config, "build_settings", "run_cmd", NULL);
 			if (value != NULL)
 			{
-				if (ft->execcmds == NULL)
-					ft->execcmds = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_EXEC]);
-				ASSIGNIF(ft->execcmds, GEANY_GBO_EXEC, _("_Execute"), value);
+				if (ft->priv->execcmds == NULL)
+					ft->priv->execcmds = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_EXEC]);
+				ASSIGNIF(ft->priv->execcmds, GEANY_GBO_EXEC, _("_Execute"), value);
 			}
 			if (ft->error_regex_string == NULL)
 				ft->error_regex_string = g_key_file_get_string(config, "build_settings", "error_regex", NULL);
@@ -2688,11 +2688,11 @@ static void foreach_project_filetype(gpointer data, gpointer user_data)
 	guint i = 0;
 	gchar *regkey = g_strdup_printf("%serror_regex", ft->name);
 
-	i += build_save_menu_grp(d->config, ft->projfilecmds, GEANY_GBG_FT, ft->name);
-	i += build_save_menu_grp(d->config, ft->projexeccmds, GEANY_GBG_EXEC, ft->name);
-	if (!EMPTY(ft->projerror_regex_string))
+	i += build_save_menu_grp(d->config, ft->priv->projfilecmds, GEANY_GBG_FT, ft->name);
+	i += build_save_menu_grp(d->config, ft->priv->projexeccmds, GEANY_GBG_EXEC, ft->name);
+	if (!EMPTY(ft->priv->projerror_regex_string))
 	{
-		g_key_file_set_string(d->config, build_grp_name, regkey, ft->projerror_regex_string);
+		g_key_file_set_string(d->config, build_grp_name, regkey, ft->priv->projerror_regex_string);
 		i++;
 	}
 	else
@@ -2716,10 +2716,10 @@ void build_save_menu(GKeyFile *config, gpointer ptr, GeanyBuildSource src)
 			ft = (GeanyFiletype*)ptr;
 			if (ft == NULL)
 				return;
-			build_save_menu_grp(config, ft->homefilecmds, GEANY_GBG_FT, NULL);
-			build_save_menu_grp(config, ft->homeexeccmds, GEANY_GBG_EXEC, NULL);
-			if (!EMPTY(ft->homeerror_regex_string))
-				g_key_file_set_string(config, build_grp_name, "error_regex", ft->homeerror_regex_string);
+			build_save_menu_grp(config, ft->priv->homefilecmds, GEANY_GBG_FT, NULL);
+			build_save_menu_grp(config, ft->priv->homeexeccmds, GEANY_GBG_EXEC, NULL);
+			if (!EMPTY(ft->priv->homeerror_regex_string))
+				g_key_file_set_string(config, build_grp_name, "error_regex", ft->priv->homeerror_regex_string);
 			else
 				g_key_file_remove_key(config, build_grp_name, "error_regex", NULL);
 			break;
@@ -2739,11 +2739,11 @@ void build_save_menu(GKeyFile *config, gpointer ptr, GeanyBuildSource src)
 				g_key_file_set_string(config, build_grp_name, "error_regex", regex_proj);
 			else
 				g_key_file_remove_key(config, build_grp_name, "error_regex", NULL);
-			if (pj->build_filetypes_list != NULL)
+			if (pj->priv->build_filetypes_list != NULL)
 			{
 				data.config = config;
 				data.ft_names = g_ptr_array_new();
-				g_ptr_array_foreach(pj->build_filetypes_list, foreach_project_filetype, (gpointer)(&data));
+				g_ptr_array_foreach(pj->priv->build_filetypes_list, foreach_project_filetype, (gpointer)(&data));
 				if (data.ft_names->pdata != NULL)
 					g_key_file_set_string_list(config, build_grp_name, "filetypes",
 								(const gchar**)(data.ft_names->pdata), data.ft_names->len);


Modified: src/editor.c
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -375,7 +375,7 @@ static gboolean is_style_php(gint style)
 static gint editor_get_long_line_type(void)
 {
 	if (app->project)
-		switch (app->project->long_line_behaviour)
+		switch (app->project->priv->long_line_behaviour)
 		{
 			case 0: /* marker disabled */
 				return 2;
@@ -394,8 +394,8 @@ static gint editor_get_long_line_type(void)
 
 static gint editor_get_long_line_column(void)
 {
-	if (app->project && app->project->long_line_behaviour != 1 /* use global settings */)
-		return app->project->long_line_column;
+	if (app->project && app->project->priv->long_line_behaviour != 1 /* use global settings */)
+		return app->project->priv->long_line_column;
 	else
 		return editor_prefs.long_line_column;
 }


Modified: src/filetypes.c
9 lines changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -201,11 +201,12 @@ static GeanyFiletype *filetype_new(void)
 	ft->lang = -2;	/* assume no tagmanager parser */
 	/* pattern must not be null */
 	ft->pattern = g_new0(gchar*, 1);
-	ft->project_list_entry = -1; /* no entry */
 	ft->indent_width = -1;
 	ft->indent_type = -1;
 
 	ft->priv = g_new0(GeanyFiletypePrivate, 1);
+	ft->priv->project_list_entry = -1; /* no entry */
+
 	return ft;
 }
 
@@ -805,9 +806,9 @@ static void filetype_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
 	g_free(ft->comment_close);
 	g_free(ft->comment_single);
 	g_free(ft->context_action_cmd);
-	g_free(ft->filecmds);
-	g_free(ft->ftdefcmds);
-	g_free(ft->execcmds);
+	g_free(ft->priv->filecmds);
+	g_free(ft->priv->ftdefcmds);
+	g_free(ft->priv->execcmds);
 	g_free(ft->error_regex_string);
 	if (ft->icon)
 		g_object_unref(ft->icon);


Modified: src/filetypes.h
18 lines changed, 0 insertions(+), 18 deletions(-)
===================================================================
@@ -28,10 +28,6 @@ G_BEGIN_DECLS
 #include "Scintilla.h"
 #include "ScintillaWidget.h"
 
-#ifdef GEANY_PRIVATE
-#include "build.h"
-#endif
-
 
 /* Do not change the order, only append. */
 typedef enum
@@ -147,20 +143,6 @@ struct GeanyFiletype
 	gint			  indent_width;
 
 	struct GeanyFiletypePrivate	*priv;	/* must be last, append fields before this item */
-#ifdef GEANY_PRIVATE
-	/* Do not use following fields in plugins */
-	/* TODO: move these fields into filetypesprivate.h */
-	GeanyBuildCommand *filecmds;
-	GeanyBuildCommand *ftdefcmds;
-	GeanyBuildCommand *execcmds;
-	GeanyBuildCommand *homefilecmds;
-	GeanyBuildCommand *homeexeccmds;
-	GeanyBuildCommand *projfilecmds;
-	GeanyBuildCommand *projexeccmds;
-	gint			 project_list_entry;
-	gchar			 *projerror_regex_string;
-	gchar			 *homeerror_regex_string;
-#endif
 };
 
 extern GPtrArray *filetypes_array;


Modified: src/filetypesprivate.h
15 lines changed, 15 insertions(+), 0 deletions(-)
===================================================================
@@ -23,6 +23,9 @@
 #ifndef GEANY_FILETYPES_PRIVATE_H
 #define GEANY_FILETYPES_PRIVATE_H
 
+#include "filetypes.h"
+#include "build.h"
+
 /* Private GeanyFiletype fields */
 typedef struct GeanyFiletypePrivate
 {
@@ -35,6 +38,18 @@ typedef struct GeanyFiletypePrivate
 	gboolean	xml_indent_tags; /* XML tag autoindentation, for HTML and XML filetypes */
 	GSList		*tag_files;
 	gboolean	warn_color_scheme;
+
+	/* TODO: move to structure in build.h and only put a pointer here */
+	GeanyBuildCommand *filecmds;
+	GeanyBuildCommand *ftdefcmds;
+	GeanyBuildCommand *execcmds;
+	GeanyBuildCommand *homefilecmds;
+	GeanyBuildCommand *homeexeccmds;
+	GeanyBuildCommand *projfilecmds;
+	GeanyBuildCommand *projexeccmds;
+	gint			 project_list_entry;
+	gchar			 *projerror_regex_string;
+	gchar			 *homeerror_regex_string;
 }
 GeanyFiletypePrivate;
 


Modified: src/keybindings.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -33,7 +33,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <string.h>
 
-#include "keybindings.h"
+#include "keybindingsprivate.h"
 #include "support.h"
 #include "utils.h"
 #include "ui_utils.h"


Modified: src/keybindings.h
14 lines changed, 0 insertions(+), 14 deletions(-)
===================================================================
@@ -57,20 +57,6 @@ typedef gboolean (*GeanyKeyGroupCallback) (guint key_id);
 /** A collection of keybindings grouped together. */
 typedef struct GeanyKeyGroup GeanyKeyGroup;
 
-/* Plugins should not set these fields. */
-#ifdef GEANY_PRIVATE
-struct GeanyKeyGroup
-{
-	const gchar *name;		/* Group name used in the configuration file, such as @c "html_chars" */
-	const gchar *label;		/* Group label used in the preferences dialog keybindings tab */
-	GeanyKeyGroupCallback callback;	/* use this or individual keybinding callbacks */
-	gboolean plugin;		/* used by plugin */
-	GPtrArray *key_items;	/* pointers to GeanyKeyBinding structs */
-	gsize plugin_key_count;			/* number of keybindings the group holds */
-	GeanyKeyBinding *plugin_keys;	/* array of GeanyKeyBinding structs */
-};
-#endif
-
 
 extern GPtrArray *keybinding_groups;	/* array of GeanyKeyGroup pointers */
 


Modified: src/keybindingsprivate.h
44 lines changed, 44 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,44 @@
+/*
+ *      keybindingsprivate.h - this file is part of Geany, a fast and lightweight IDE
+ *
+ *      Copyright 2006-2014 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+ *      Copyright 2006-2014 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+ *      Copyright 2014 Matthew Brush <matt at geany.org>
+ *
+ *      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 GEANY_KEYBINDINGS_PRIVATE_H
+#define GEANY_KEYBINDINGS_PRIVATE_H 1
+
+#include <glib.h>
+#include "keybindings.h"
+
+G_BEGIN_DECLS
+
+struct GeanyKeyGroup
+{
+	const gchar *name;		/* Group name used in the configuration file, such as @c "html_chars" */
+	const gchar *label;		/* Group label used in the preferences dialog keybindings tab */
+	GeanyKeyGroupCallback callback;	/* use this or individual keybinding callbacks */
+	gboolean plugin;		/* used by plugin */
+	GPtrArray *key_items;	/* pointers to GeanyKeyBinding structs */
+	gsize plugin_key_count;			/* number of keybindings the group holds */
+	GeanyKeyBinding *plugin_keys;	/* array of GeanyKeyBinding structs */
+};
+
+G_END_DECLS
+
+#endif /* GEANY_KEYBINDINGS_PRIVATE_H */


Modified: src/keyfile.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -59,6 +59,7 @@
 #include "templates.h"
 #include "toolbar.h"
 #include "stash.h"
+#include "build.h"
 
 
 /* some default settings which are used at the very first start of Geany to fill


Modified: src/main.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -553,6 +553,7 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
 	}
 
 	context = g_option_context_new(_("[FILES...]"));
+
 	g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
 	g_option_group_set_translation_domain(g_option_context_get_main_group(context), GETTEXT_PACKAGE);
 	g_option_context_add_group(context, gtk_get_option_group(FALSE));


Modified: src/plugins.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -49,7 +49,7 @@
 #include "encodings.h"
 #include "search.h"
 #include "highlighting.h"
-#include "keybindings.h"
+#include "keybindingsprivate.h"
 #include "navqueue.h"
 #include "main.h"
 #include "toolbar.h"


Modified: src/prefs.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -45,7 +45,7 @@
 #include "documentprivate.h"
 #include "msgwindow.h"
 #include "keyfile.h"
-#include "keybindings.h"
+#include "keybindingsprivate.h"
 #include "encodings.h"
 #include "project.h"
 #include "editor.h"


Modified: src/project.c
52 lines changed, 26 insertions(+), 26 deletions(-)
===================================================================
@@ -45,7 +45,7 @@
 #include "editor.h"
 #include "stash.h"
 #include "sidebar.h"
-#include "filetypes.h"
+#include "filetypesprivate.h"
 
 
 ProjectPrefs project_prefs = { NULL, FALSE, FALSE };
@@ -338,10 +338,10 @@ static void remove_foreach_project_filetype(gpointer data, gpointer user_data)
 	GeanyFiletype *ft = data;
 	if (ft != NULL)
 	{
-		SETPTR(ft->projfilecmds, NULL);
-		SETPTR(ft->projexeccmds, NULL);
-		SETPTR(ft->projerror_regex_string, NULL);
-		ft->project_list_entry = -1;
+		SETPTR(ft->priv->projfilecmds, NULL);
+		SETPTR(ft->priv->projexeccmds, NULL);
+		SETPTR(ft->priv->projerror_regex_string, NULL);
+		ft->priv->project_list_entry = -1;
 	}
 }
 
@@ -366,10 +366,10 @@ void project_close(gboolean open_default)
 	ui_set_statusbar(TRUE, _("Project \"%s\" closed."), app->project->name);
 
 	/* remove project filetypes build entries */
-	if (app->project->build_filetypes_list != NULL)
+	if (app->project->priv->build_filetypes_list != NULL)
 	{
-		g_ptr_array_foreach(app->project->build_filetypes_list, remove_foreach_project_filetype, NULL);
-		g_ptr_array_free(app->project->build_filetypes_list, FALSE);
+		g_ptr_array_foreach(app->project->priv->build_filetypes_list, remove_foreach_project_filetype, NULL);
+		g_ptr_array_free(app->project->priv->build_filetypes_list, FALSE);
 	}
 
 	/* remove project non filetype build menu items */
@@ -523,7 +523,7 @@ static void show_project_properties(gboolean show_build)
 	gtk_entry_set_text(GTK_ENTRY(e.base_path), p->base_path);
 
 	radio_long_line_custom = ui_lookup_widget(e.dialog, "radio_long_line_custom_project");
-	switch (p->long_line_behaviour)
+	switch (p->priv->long_line_behaviour)
 	{
 		case 0: widget = ui_lookup_widget(e.dialog, "radio_long_line_disabled_project"); break;
 		case 1: widget = ui_lookup_widget(e.dialog, "radio_long_line_default_project"); break;
@@ -532,7 +532,7 @@ static void show_project_properties(gboolean show_build)
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
 
 	widget = ui_lookup_widget(e.dialog, "spin_long_line_project");
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (gdouble)p->long_line_column);
+	gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (gdouble)p->priv->long_line_column);
 	on_radio_long_line_custom_toggled(GTK_TOGGLE_BUTTON(radio_long_line_custom), widget);
 
 	if (p->description != NULL)
@@ -627,8 +627,8 @@ static GeanyProject *create_project(void)
 
 	project->file_patterns = NULL;
 
-	project->long_line_behaviour = 1 /* use global settings */;
-	project->long_line_column = editor_prefs.long_line_column;
+	project->priv->long_line_behaviour = 1 /* use global settings */;
+	project->priv->long_line_column = editor_prefs.long_line_column;
 
 	app->project = project;
 	return project;
@@ -756,33 +756,33 @@ static gboolean update_config(const PropertyDialogElements *e, gboolean new_proj
 			stash_group_update(node->data, e->dialog);
 
 		/* read the project build menu */
-		oldvalue = ft ? ft->projfilecmds : NULL;
+		oldvalue = ft ? ft->priv->projfilecmds : NULL;
 		build_read_project(ft, e->build_properties);
 
-		if (ft != NULL && ft->projfilecmds != oldvalue && ft->project_list_entry < 0)
+		if (ft != NULL && ft->priv->projfilecmds != oldvalue && ft->priv->project_list_entry < 0)
 		{
-			if (p->build_filetypes_list == NULL)
-				p->build_filetypes_list = g_ptr_array_new();
-			ft->project_list_entry = p->build_filetypes_list->len;
-			g_ptr_array_add(p->build_filetypes_list, ft);
+			if (p->priv->build_filetypes_list == NULL)
+				p->priv->build_filetypes_list = g_ptr_array_new();
+			ft->priv->project_list_entry = p->priv->build_filetypes_list->len;
+			g_ptr_array_add(p->priv->build_filetypes_list, ft);
 		}
 		build_menu_update(doc);
 
 		widget = ui_lookup_widget(e->dialog, "radio_long_line_disabled_project");
 		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-			p->long_line_behaviour = 0;
+			p->priv->long_line_behaviour = 0;
 		else
 		{
 			widget = ui_lookup_widget(e->dialog, "radio_long_line_default_project");
 			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
-				p->long_line_behaviour = 1;
+				p->priv->long_line_behaviour = 1;
 			else
 				/* "Custom" radio button must be checked */
-				p->long_line_behaviour = 2;
+				p->priv->long_line_behaviour = 2;
 		}
 
 		widget = ui_lookup_widget(e->dialog, "spin_long_line_project");
-		p->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+		p->priv->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
 		apply_editor_prefs();
 
 		/* get and set the project file patterns */
@@ -993,9 +993,9 @@ static gboolean load_config(const gchar *filename)
 	p->base_path = utils_get_setting_string(config, "project", "base_path", "");
 	p->file_patterns = g_key_file_get_string_list(config, "project", "file_patterns", NULL, NULL);
 
-	p->long_line_behaviour = utils_get_setting_integer(config, "long line marker",
+	p->priv->long_line_behaviour = utils_get_setting_integer(config, "long line marker",
 		"long_line_behaviour", 1 /* follow global */);
-	p->long_line_column = utils_get_setting_integer(config, "long line marker",
+	p->priv->long_line_column = utils_get_setting_integer(config, "long line marker",
 		"long_line_column", editor_prefs.long_line_column);
 	apply_editor_prefs();
 
@@ -1062,8 +1062,8 @@ static gboolean write_config(gboolean emit_signal)
 		g_key_file_set_string_list(config, "project", "file_patterns",
 			(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
 
-	g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->long_line_behaviour);
-	g_key_file_set_integer(config, "long line marker", "long_line_column", p->long_line_column);
+	g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->priv->long_line_behaviour);
+	g_key_file_set_integer(config, "long line marker", "long_line_column", p->priv->long_line_column);
 
 	/* store the session files into the project too */
 	if (project_prefs.project_session)


Modified: src/project.h
6 lines changed, 0 insertions(+), 6 deletions(-)
===================================================================
@@ -41,12 +41,6 @@ typedef struct GeanyProject
 	gchar **file_patterns;	/**< Array of filename extension patterns. */
 
 	struct GeanyProjectPrivate	*priv;	/* must be last, append fields before this item */
-#ifdef GEANY_PRIVATE
-	/* Do not use following fields in plugins */
-	GPtrArray *build_filetypes_list; /* Project has custom filetype builds for these. */
-	gint long_line_behaviour; /* 0 - disabled, 1 - follow global settings, 2 - enabled (custom) */
-	gint long_line_column; /* Long line marker position. */
-#endif
 }
 GeanyProject;
 


Modified: src/projectprivate.h
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -23,6 +23,7 @@
 #ifndef GEANY_PROJECTPRIVATE_H
 #define GEANY_PROJECTPRIVATE_H 1
 
+#include "project.h"
 
 typedef struct GeanyProjectPrivate
 {
@@ -31,6 +32,9 @@ typedef struct GeanyProjectPrivate
 	gboolean	strip_trailing_spaces;
 	gboolean	replace_tabs;
 	gboolean	ensure_convert_new_lines;
+	GPtrArray *build_filetypes_list; /* Project has custom filetype builds for these. */
+	gint long_line_behaviour; /* 0 - disabled, 1 - follow global settings, 2 - enabled (custom) */
+	gint long_line_column; /* Long line marker position. */
 }
 GeanyProjectPrivate;
 


Modified: src/support.h
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -25,9 +25,9 @@
  * @see GLib's @c gi18n-lib.h.
  **/
 
-G_BEGIN_DECLS
+#include <glib.h>
 
-#include "geany.h"
+G_BEGIN_DECLS
 
 #ifdef GETTEXT_PACKAGE
 # include <glib/gi18n-lib.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