Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush matt@geany.org Date: Wed, 21 May 2014 22:43:40 UTC Commit: 4d22aa48502ff818102af42495daaa55e6c6694e https://github.com/geany/geany/commit/4d22aa48502ff818102af42495daaa55e6c669...
Log Message: ----------- Merge branch 'header-cleanup'
Closes #272
Modified Paths: -------------- HACKING plugins/geanyplugin.h src/Makefile.am src/about.c src/about.h src/app.h src/build.c src/build.h src/callbacks.c src/callbacks.h src/dialogs.c src/dialogs.h src/document.c src/document.h src/documentprivate.h src/editor.c src/editor.h src/encodings.c src/encodings.h src/filetypes.c src/filetypes.h src/filetypesprivate.h src/gb.c src/geany.h src/geanyentryaction.c src/geanyentryaction.h src/geanymenubuttonaction.c src/geanymenubuttonaction.h src/geanyobject.c src/geanyobject.h src/geanywraplabel.c src/geanywraplabel.h src/gtkcompat.h src/highlighting.c src/highlighting.h src/highlightingmappings.h src/keybindings.c src/keybindings.h src/keybindingsprivate.h src/keyfile.c src/keyfile.h src/log.c src/log.h src/main.c src/main.h src/msgwindow.c src/msgwindow.h src/navqueue.c src/navqueue.h src/notebook.c src/notebook.h src/plugindata.h src/pluginprivate.h src/plugins.c src/plugins.h src/pluginutils.c src/pluginutils.h src/prefix.c src/prefix.h src/prefs.c src/prefs.h src/printing.c src/printing.h src/project.c src/project.h src/projectprivate.h src/sciwrappers.c src/sciwrappers.h src/search.c src/search.h src/sidebar.c src/sidebar.h src/socket.c src/socket.h src/stash.c src/stash.h src/support.h src/symbols.c src/symbols.h src/templates.c src/templates.h src/toolbar.c src/toolbar.h src/tools.c src/tools.h src/ui_utils.c src/ui_utils.h src/utils.c src/utils.h src/vte.c src/vte.h src/win32.c src/win32.h wscript
Modified: HACKING 72 lines changed, 72 insertions(+), 0 deletions(-) =================================================================== @@ -302,6 +302,78 @@ Example:: { ...
+Header Includes +--------------- + +In order to make including various headers in Geany more convenient, each +file should include what it uses. If there is a file named ``foo.c``, and a +file named ``foo.h``, it should be possible to include ``foo.h`` on its own +without depending on stuff in ``foo.c`` that is included for the first time +before ``foo.h``. + +Private Headers +^^^^^^^^^^^^^^^ + +If there is some data that needs to be shared between various parts of the +core code, put them in a "private header", that is, if the public header is +called ``foo.h``, then make a ``fooprivate.h`` header that contains the +non-public functions, types, globals, etc that are needed. Other core source +files can then just include the ``foo.h`` and/or ``fooprivate.h`` depending +what they need, without exposing that stuff to plugins. + +Order of Includes +^^^^^^^^^^^^^^^^^ + +Inside a source file the includes section should be ordered like this: + +1. Always include the ``config.h`` file at the start of every source file, + for example:: + + #ifdef HAVE_CONFIG_H + # include "config.h" + #endif + + This allows the Autotools and other build systems use the ``./configure`` + time settings. If you don't do this, there's likely to be a number of + macros that you'll have to define in the build system or custom headers. + + Warning: Never include ``config.h`` in headers, and especially in "public" + headers that plugins might include. + +2. Then include the header that has the same name as the source file (if + applicable). For example, for a source file named ``foo.c``, include + the ``foo.h`` below the ``config.h`` include. If there is a + ``fooprivate.h``, ``foo.c`` will most likely want to include that too, + put it in with includes in #3. + +3. At this point, it should be safe to include all the headers that declare + whatever is needed. If everything generally "includes what it uses" and + all files included contain the appropriate multiple-declaration guards + then the order of includes is fairly arbitrary. Prefer to use English + alphabetic order if possible. + +4. By now it doesn't really matter about the order, nothing below here is + "our problem". Semi-arbitrarily, you should use an include order like this: + + 1. Standard C headers + 2. Non-standard system headers (eg. ``windows.h`` or ``unistd.h``) + 3. GLib/GTK+ or related headers + +5. Everything else that should not influence 1-4. + +Including in Header Files +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Headers should also include what they use. All of the types should defined in +order to allow the header to be included stand-alone. For example, if a +header uses a ``GtkWidget*``, it should ``#include <gtk/gtk.h>``. Or, if a +headers uses a ``GPtrArray*``, it should ``#include <glib.h>`` to ensure that +all of the types are declared, whether by pointers/opaquely or fully, as +required. Since all headers will use a ``G_BEGIN_DECLS`` and ``G_END_DECLS`` +guard for C++, the bare minimum for a header is to include ``glib.h`` or +``<gtk/gtk.h>`` or ``gtkcompat.h`` or some other header that makes those +macros available. +
Committing ----------
Modified: plugins/geanyplugin.h 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -28,17 +28,17 @@ #ifndef GEANY_PLUGIN_H #define GEANY_PLUGIN_H 1
-#include "geany.h" -#include "plugindata.h" - /* Note: only include headers that define types or macros, not just functions */ +#include "app.h" #include "document.h" #include "editor.h" #include "encodings.h" #include "filetypes.h" +#include "geany.h" #include "highlighting.h" #include "keybindings.h" #include "msgwindow.h" +#include "plugindata.h" #include "prefs.h" #include "project.h" #include "search.h"
Modified: src/Makefile.am 13 lines changed, 11 insertions(+), 2 deletions(-) =================================================================== @@ -1,14 +1,22 @@ ## 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
SRCS = \ about.c about.h \ + app.h \ build.c build.h \ callbacks.c callbacks.h \ dialogs.c dialogs.h \ @@ -54,6 +62,7 @@ geany_includedir = $(includedir)/geany
# only install headers that define types or macros, not just functions geany_include_HEADERS = \ + app.h \ build.h \ document.h \ editor.h \
Modified: src/about.c 17 lines changed, 11 insertions(+), 6 deletions(-) =================================================================== @@ -24,17 +24,22 @@ * About dialog and credits. */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "about.h" + +#include "app.h" +#include "gb.c" #include "geany.h" -#include "utils.h" -#include "ui_utils.h" -#include "support.h" #include "geanywraplabel.h" #include "main.h" -#include "templates.h" - -#include "gb.c" +#include "support.h" +#include "ui_utils.h" +#include "utils.h"
+#include "gtkcompat.h"
#define HEADER "<span size="larger" weight="bold">Geany %s</span>" #define INFO "<span size="larger" weight="bold">%s</span>"
Modified: src/about.h 11 lines changed, 8 insertions(+), 3 deletions(-) =================================================================== @@ -20,10 +20,15 @@ */
-#ifndef GEANY_ABOUT_DIALOG_H -#define GEANY_ABOUT_DIALOG_H +#ifndef GEANY_ABOUT_H +#define GEANY_ABOUT_H 1
+#include <glib.h> + +G_BEGIN_DECLS
void about_dialog_show(void);
-#endif +G_END_DECLS + +#endif /* GEANY_ABOUT_H */
Modified: src/app.h 60 lines changed, 60 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,60 @@ +/* + * app.h - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2005-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@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. + */ + +/** + * @file app.h + * Contains the GeanyApp. + */ + +#ifndef GEANY_APP_H +#define GEANY_APP_H 1 + +#include "tm_tag.h" /* FIXME: should be included in tm_workspace.h */ +#include "tm_workspace.h" +#include "project.h" + +#include <glib.h> + +G_BEGIN_DECLS + +/** Important application fields. */ +typedef struct GeanyApp +{ + gboolean debug_mode; /**< @c TRUE if debug messages should be printed. */ + /** User configuration directory, usually @c ~/.config/geany. + * This is a full path read by @ref tm_get_real_path(). + * @note Plugin configuration files should be saved as: + * @code g_build_path(G_DIR_SEPARATOR_S, geany->app->configdir, "plugins", "pluginname", + * "file.conf", NULL); @endcode */ + gchar *configdir; + gchar *datadir; + gchar *docdir; + const TMWorkspace *tm_workspace; /**< TagManager workspace/session tags. */ + struct GeanyProject *project; /**< Currently active project or @c NULL if none is open. */ +} +GeanyApp; + +extern GeanyApp *app; + +G_END_DECLS + +#endif /* GEANY_APP_H */
Modified: src/build.c 152 lines changed, 78 insertions(+), 74 deletions(-) =================================================================== @@ -28,8 +28,28 @@ * Replace defines with enums. * Other TODOs in code. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "app.h" #include "build.h" +#include "dialogs.h" +#include "document.h" +#include "filetypesprivate.h" +#include "geanymenubuttonaction.h" +#include "geanyobject.h" +#include "keybindingsprivate.h" +#include "msgwindow.h" +#include "prefs.h" +#include "projectprivate.h" +#include "support.h" +#include "toolbar.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h" + +#include "gtkcompat.h"
#include <stdlib.h> #include <string.h> @@ -46,22 +66,6 @@ # include <windows.h> #endif
-#include "prefs.h" -#include "support.h" -#include "document.h" -#include "utils.h" -#include "ui_utils.h" -#include "dialogs.h" -#include "msgwindow.h" -#include "filetypes.h" -#include "keybindings.h" -#include "vte.h" -#include "project.h" -#include "editor.h" -#include "win32.h" -#include "toolbar.h" -#include "geanymenubuttonaction.h" -#include "gtkcompat.h"
/* g_spawn_async_with_pipes doesn't work on Windows */ #ifdef G_OS_WIN32 @@ -249,13 +253,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 +324,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 +416,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 +443,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 +466,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 +2324,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 +2366,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 +2478,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 +2488,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 +2509,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 +2558,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 +2692,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 +2720,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 +2743,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/build.h 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -24,6 +24,11 @@ #ifndef GEANY_BUILD_H #define GEANY_BUILD_H 1
+#include "document.h" +#include "filetypes.h" + +#include "gtkcompat.h" + G_BEGIN_DECLS
/* Order is important (see GBO_TO_GBG, GBO_TO_CMD below) */ @@ -206,4 +211,4 @@ gchar **build_get_regex(GeanyBuildGroup grp, GeanyFiletype *ft, guint *from);
G_END_DECLS
-#endif +#endif /* GEANY_BUILD_H */
Modified: src/callbacks.c 71 lines changed, 33 insertions(+), 38 deletions(-) =================================================================== @@ -24,58 +24,53 @@ * main window. Callbacks not used by Glade should go elsewhere. */
-#include "geany.h" - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <gdk/gdkkeysyms.h> -#include <glib/gstdio.h> -#include <time.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "callbacks.h" -#include "support.h"
-#include "keyfile.h" -#include "document.h" -#include "documentprivate.h" -#include "filetypes.h" -#include "sciwrappers.h" -#include "editor.h" -#include "ui_utils.h" -#include "utils.h" -#include "dialogs.h" #include "about.h" -#include "msgwindow.h" +#include "app.h" #include "build.h" -#include "prefs.h" -#include "templates.h" -#include "sidebar.h" -#include "keybindings.h" +#include "dialogs.h" +#include "documentprivate.h" #include "encodings.h" -#include "search.h" +#include "filetypes.h" +#include "geanyobject.h" +#include "highlighting.h" +#include "keybindings.h" +#include "keyfile.h" +#include "log.h" #include "main.h" -#include "symbols.h" -#include "tools.h" -#include "project.h" +#include "msgwindow.h" #include "navqueue.h" -#include "printing.h" #include "plugins.h" -#include "log.h" -#include "toolbar.h" -#include "highlighting.h" #include "pluginutils.h" -#include "gtkcompat.h" - - -#ifdef HAVE_VTE -# include "vte.h" -#endif - +#include "prefs.h" +#include "printing.h" +#include "sciwrappers.h" +#include "sidebar.h" #ifdef HAVE_SOCKET # include "socket.h" #endif +#include "support.h" +#include "symbols.h" +#include "templates.h" +#include "toolbar.h" +#include "tools.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h"
+#include "gtkcompat.h" + +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <gdk/gdkkeysyms.h> +#include <glib/gstdio.h> +#include <time.h>
/* flag to indicate that an insert callback was triggered from the file menu,
Modified: src/callbacks.h 11 lines changed, 10 insertions(+), 1 deletions(-) =================================================================== @@ -19,9 +19,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+#ifndef GEANY_CALLBACKS_H +#define GEANY_CALLBACKS_H 1
-#include "geany.h" /* necessary for interface.c */ +#include "gtkcompat.h"
+G_BEGIN_DECLS + +extern gboolean ignore_callback;
G_MODULE_EXPORT gboolean on_exit_clicked (GtkWidget *widget, gpointer gdata); @@ -678,3 +683,7 @@ on_detect_type_from_file_activate (GtkMenuItem *menuitem, G_MODULE_EXPORT void on_detect_width_from_file_activate (GtkMenuItem *menuitem, gpointer user_data); + +G_END_DECLS + +#endif /* GEANY_CALLBACKS_H */
Modified: src/dialogs.c 35 lines changed, 17 insertions(+), 18 deletions(-) =================================================================== @@ -23,7 +23,23 @@ * File related dialogs, miscellaneous dialogs, font dialog. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "dialogs.h" + +#include "app.h" +#include "build.h" +#include "document.h" +#include "encodings.h" +#include "filetypes.h" +#include "main.h" +#include "support.h" +#include "utils.h" +#include "ui_utils.h" + +#include "gtkcompat.h"
#include <gdk/gdkkeysyms.h> #include <string.h> @@ -40,23 +56,6 @@ /* gstdio.h also includes sys/stat.h */ #include <glib/gstdio.h>
-#include "dialogs.h" - -#include "callbacks.h" -#include "document.h" -#include "filetypes.h" -#include "win32.h" -#include "sciwrappers.h" -#include "support.h" -#include "utils.h" -#include "ui_utils.h" -#include "keybindings.h" -#include "encodings.h" -#include "build.h" -#include "main.h" -#include "project.h" -#include "gtkcompat.h" -
enum {
Modified: src/dialogs.h 10 lines changed, 9 insertions(+), 1 deletions(-) =================================================================== @@ -28,6 +28,12 @@ #ifndef GEANY_DIALOGS_H #define GEANY_DIALOGS_H 1
+#include "document.h" + +#include "gtkcompat.h" + +G_BEGIN_DECLS + typedef void (*GeanyInputCallback)(const gchar *text);
@@ -72,4 +78,6 @@ void dialogs_show_msgbox(GtkMessageType type, const gchar *text, ...) G_GNUC_PRI
void dialogs_show_msgbox_with_secondary(GtkMessageType type, const gchar *text, const gchar *secondary);
-#endif +G_END_DECLS + +#endif /* GEANY_DIALOGS_H */
Modified: src/document.c 56 lines changed, 28 insertions(+), 28 deletions(-) =================================================================== @@ -24,7 +24,33 @@ * Also Scintilla search actions. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "document.h" + +#include "app.h" +#include "callbacks.h" /* for ignore_callback */ +#include "dialogs.h" +#include "documentprivate.h" +#include "encodings.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" +#include "highlighting.h" +#include "main.h" +#include "msgwindow.h" +#include "navqueue.h" +#include "notebook.h" +#include "project.h" +#include "sciwrappers.h" +#include "sidebar.h" +#include "support.h" +#include "symbols.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h"
#ifdef HAVE_SYS_TIME_H # include <sys/time.h> @@ -48,36 +74,10 @@ /*#define USE_GIO_FILEMON 1*/ #include <gio/gio.h>
-#include "document.h" -#include "documentprivate.h" -#include "filetypes.h" -#include "support.h" -#include "sciwrappers.h" -#include "editor.h" -#include "dialogs.h" -#include "msgwindow.h" -#include "templates.h" -#include "sidebar.h" -#include "ui_utils.h" -#include "utils.h" -#include "encodings.h" -#include "notebook.h" -#include "main.h" -#include "vte.h" -#include "build.h" -#include "symbols.h" -#include "highlighting.h" -#include "navqueue.h" -#include "win32.h" -#include "search.h" -#include "filetypesprivate.h" -#include "project.h" - -#include "SciLexer.h" -
GeanyFilePrefs file_prefs;
+ /** Dynamic array of GeanyDocument pointers. * Once a pointer is added to this, it is never freed. This means you can keep a pointer * to a document over time, but it may represent a different
Modified: src/document.h 25 lines changed, 16 insertions(+), 9 deletions(-) =================================================================== @@ -29,13 +29,20 @@ #ifndef GEANY_DOCUMENT_H #define GEANY_DOCUMENT_H 1
-G_BEGIN_DECLS - -#include "Scintilla.h" -#include "ScintillaWidget.h" #include "editor.h" +#include "filetypes.h" +#include "geany.h" #include "search.h"
+#include "gtkcompat.h" /* Needed by ScintillaWidget.h */ +#include "Scintilla.h" /* Needed by ScintillaWidget.h */ +#include "ScintillaWidget.h" /* For ScintillaObject */ + +#include <glib.h> + + +G_BEGIN_DECLS + #if defined(G_OS_WIN32) # define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_CRLF #elif defined(G_OS_UNIX) @@ -75,7 +82,7 @@ extern GeanyFilePrefs file_prefs; /** * Structure for representing an open tab with all its properties. **/ -struct GeanyDocument +typedef struct GeanyDocument { /** Flag used to check if this document is valid when iterating @ref documents_array. */ gboolean is_valid; @@ -93,7 +100,7 @@ struct GeanyDocument gchar *encoding; /** Internally used flag to indicate whether the file of this document has a byte-order-mark. */ gboolean has_bom; - struct GeanyEditor *editor; /**< The editor associated with the document. */ + GeanyEditor *editor; /**< The editor associated with the document. */ /** The filetype for this document, it's only a reference to one of the elements of the global * filetypes array. */ GeanyFiletype *file_type; @@ -113,7 +120,8 @@ struct GeanyDocument gchar *real_path;
struct GeanyDocumentPrivate *priv; /* should be last, append fields before this item */ -}; +} +GeanyDocument;
extern GPtrArray *documents_array;
@@ -167,7 +175,6 @@ extern GPtrArray *documents_array; (G_LIKELY((doc)->file_name != NULL) ? ((doc)->file_name) : GEANY_STRING_UNTITLED)
- /* These functions will replace the older functions. For now they have a documents_ prefix. */
GeanyDocument* document_new_file(const gchar *filename, GeanyFiletype *ft, const gchar *text); @@ -297,4 +304,4 @@ GeanyDocument *document_clone(GeanyDocument *old_doc);
G_END_DECLS
-#endif +#endif /* GEANY_DOCUMENT_H */
Modified: src/documentprivate.h 9 lines changed, 7 insertions(+), 2 deletions(-) =================================================================== @@ -21,8 +21,11 @@
#ifndef GEANY_DOCUMENT_PRIVATE_H -#define GEANY_DOCUMENT_PRIVATE_H +#define GEANY_DOCUMENT_PRIVATE_H 1
+#include "gtkcompat.h" + +G_BEGIN_DECLS
/* available UNDO actions, UNDO_SCINTILLA is a pseudo action to trigger Scintilla's * undo management */ @@ -86,4 +89,6 @@ typedef struct GeanyDocumentPrivate } GeanyDocumentPrivate;
-#endif +G_END_DECLS + +#endif /* GEANY_DOCUMENT_PRIVATE_H */
Modified: src/editor.c 51 lines changed, 27 insertions(+), 24 deletions(-) =================================================================== @@ -33,41 +33,44 @@ * Also some general Scintilla-related functions. */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include <ctype.h> -#include <string.h> - -#include <gdk/gdkkeysyms.h> - -#include "SciLexer.h" -#include "geany.h" - -#include "support.h" #include "editor.h" -#include "document.h" + +#include "app.h" +#include "callbacks.h" +#include "dialogs.h" #include "documentprivate.h" -#include "filetypes.h" #include "filetypesprivate.h" +#include "geanyobject.h" +#include "highlighting.h" +#include "keybindings.h" +#include "main.h" +#include "prefs.h" +#include "projectprivate.h" #include "sciwrappers.h" -#include "ui_utils.h" -#include "utils.h" -#include "dialogs.h" +#include "support.h" #include "symbols.h" -#include "callbacks.h" #include "templates.h" -#include "keybindings.h" -#include "project.h" -#include "projectprivate.h" -#include "main.h" -#include "highlighting.h" +#include "ui_utils.h" +#include "utils.h" + +#include "SciLexer.h" + #include "gtkcompat.h"
+#include <ctype.h> +#include <string.h> + +#include <gdk/gdkkeysyms.h> +
/* Note: use sciwrappers.h instead where possible. * Do not use SSM in files unrelated to scintilla. */ #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
- static GHashTable *snippet_hash = NULL; static GQueue *snippet_offsets = NULL; static gint snippet_cursor_insert_pos; @@ -375,7 +378,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 +397,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/editor.h 24 lines changed, 17 insertions(+), 7 deletions(-) =================================================================== @@ -23,10 +23,19 @@ #ifndef GEANY_EDITOR_H #define GEANY_EDITOR_H 1
+#include "tm_tag.h" /* for TMTag */ + +#include "gtkcompat.h" /* Needed by ScintillaWidget.h */ +#include "Scintilla.h" /* Needed by ScintillaWidget.h */ +#include "ScintillaWidget.h" /* for ScintillaObject */ + +#include <glib.h> + + G_BEGIN_DECLS
-#include "Scintilla.h" -#include "ScintillaWidget.h" +/* Forward-declared to avoid including document.h since it includes this header */ +struct GeanyDocument;
/** Default character set to define which characters should be treated as part of a word. */ #define GEANY_WORDCHARS "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" @@ -155,9 +164,9 @@ extern GeanyEditorPrefs editor_prefs;
/** Editor-owned fields for each document. */ -struct GeanyEditor +typedef struct GeanyEditor { - GeanyDocument *document; /**< The document associated with the editor. */ + struct GeanyDocument *document; /**< The document associated with the editor. */ ScintillaObject *sci; /**< The Scintilla editor @c GtkWidget. */ gboolean line_wrapping; /**< @c TRUE if line wrapping is enabled. */ gboolean auto_indent; /**< @c TRUE if auto-indentation is enabled. */ @@ -166,7 +175,8 @@ struct GeanyEditor GeanyIndentType indent_type; /* Use editor_get_indent_prefs() instead. */ gboolean line_breaking; /**< Whether to split long lines as you type. */ gint indent_width; -}; +} +GeanyEditor;
typedef struct @@ -182,7 +192,7 @@ typedef struct SCNotification SCNotification;
void editor_init(void);
-GeanyEditor *editor_create(GeanyDocument *doc); +GeanyEditor *editor_create(struct GeanyDocument *doc);
void editor_destroy(GeanyEditor *editor);
@@ -321,4 +331,4 @@ void editor_insert_snippet(GeanyEditor *editor, gint pos, const gchar *snippet);
G_END_DECLS
-#endif +#endif /* GEANY_EDITOR_H */
Modified: src/encodings.c 18 lines changed, 11 insertions(+), 7 deletions(-) =================================================================== @@ -30,17 +30,21 @@ */ /* Stolen from anjuta */
-#include <string.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" -#include "utils.h" -#include "support.h" -#include "document.h" -#include "documentprivate.h" -#include "msgwindow.h" #include "encodings.h" + +#include "app.h" #include "callbacks.h" +#include "documentprivate.h" +#include "support.h" #include "ui_utils.h" +#include "utils.h" + +#include <string.h> +
/* <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> */ #define PATTERN_HTMLMETA "<meta\s+http-equiv\s*=\s*"?content-type"?\s+content\s*=\s*"text/x?html;\s*charset=([a-z0-9_-]+)"\s*/?>"
Modified: src/encodings.h 6 lines changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -34,7 +34,9 @@ /* Stolen from anjuta */
#ifndef GEANY_ENCODINGS_H -#define GEANY_ENCODINGS_H +#define GEANY_ENCODINGS_H 1 + +#include "gtkcompat.h"
G_BEGIN_DECLS
@@ -199,4 +201,4 @@ GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset);
G_END_DECLS
-#endif +#endif /* GEANY_ENCODINGS_H */
Modified: src/filetypes.c 36 lines changed, 21 insertions(+), 15 deletions(-) =================================================================== @@ -27,26 +27,31 @@ /* Note: we use filetype_id for some function arguments, but GeanyFiletype is better; we should * only use GeanyFiletype for API functions. */
-#include <string.h> -#include <glib/gstdio.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" #include "filetypes.h" + +#include "app.h" +#include "callbacks.h" /* FIXME: for ignore_callback */ +#include "document.h" #include "filetypesprivate.h" +#include "geany.h" +#include "geanyobject.h" #include "highlighting.h" -#include "support.h" -#include "templates.h" -#include "document.h" -#include "editor.h" -#include "msgwindow.h" -#include "utils.h" +#include "projectprivate.h" #include "sciwrappers.h" -#include "ui_utils.h" +#include "support.h" #include "symbols.h" - #include "tm_parser.h" +#include "utils.h" +#include "ui_utils.h"
#include <stdlib.h> +#include <string.h> + +#include <glib/gstdio.h>
#define GEANY_FILETYPE_SEARCH_LINES 2 /* lines of file to search for filetype */
@@ -201,11 +206,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 +811,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 42 lines changed, 17 insertions(+), 25 deletions(-) =================================================================== @@ -23,15 +23,20 @@ #ifndef GEANY_FILETYPES_H #define GEANY_FILETYPES_H 1
-G_BEGIN_DECLS +#include "geany.h" /* for GEANY() macro */ +#include "tm_source_file.h" /* for langType */ + +#include "gtkcompat.h" /* Needed by ScintillaWidget.h */ +#include "Scintilla.h" /* Needed by ScintillaWidget.h */ +#include "ScintillaWidget.h" /* for ScintillaObject */
-#include "Scintilla.h" -#include "ScintillaWidget.h" +#include <glib.h>
-#ifdef GEANY_PRIVATE -#include "build.h" -#endif
+G_BEGIN_DECLS + +/* Forward-declared to avoid including document.h since it includes this header */ +struct GeanyDocument;
/* Do not change the order, only append. */ typedef enum @@ -118,7 +123,7 @@ GeanyFiletypeGroupID; (((filetype_ptr) != NULL) ? (filetype_ptr)->id : GEANY_FILETYPES_NONE)
/** Represents a filetype. */ -struct GeanyFiletype +typedef struct GeanyFiletype { filetype_id id; /**< Index in @c filetypes_array. */ /** Represents the langType of tagmanager (see the table @@ -138,7 +143,7 @@ struct GeanyFiletype gboolean comment_use_indent; GeanyFiletypeGroupID group; gchar *error_regex_string; - GeanyFiletype *lexer_filetype; + struct GeanyFiletype *lexer_filetype; gchar *mime_type; GIcon *icon; gchar *comment_single; /* single-line comment */ @@ -147,21 +152,8 @@ 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 -}; +} +GeanyFiletype;
extern GPtrArray *filetypes_array;
@@ -193,7 +185,7 @@ const GSList *filetypes_get_sorted_by_name(void);
const gchar *filetypes_get_display_name(GeanyFiletype *ft);
-GeanyFiletype *filetypes_detect_from_document(GeanyDocument *doc); +GeanyFiletype *filetypes_detect_from_document(struct GeanyDocument *doc);
GeanyFiletype *filetypes_detect_from_extension(const gchar *utf8_filename);
@@ -221,4 +213,4 @@ gboolean filetype_get_comment_open_close(const GeanyFiletype *ft, gboolean singl
G_END_DECLS
-#endif +#endif /* GEANY_FILETYPES_H */
Modified: src/filetypesprivate.h 24 lines changed, 22 insertions(+), 2 deletions(-) =================================================================== @@ -21,7 +21,13 @@
#ifndef GEANY_FILETYPES_PRIVATE_H -#define GEANY_FILETYPES_PRIVATE_H +#define GEANY_FILETYPES_PRIVATE_H 1 + +#include "build.h" + +#include "gtkcompat.h" + +G_BEGIN_DECLS
/* Private GeanyFiletype fields */ typedef struct GeanyFiletypePrivate @@ -35,7 +41,21 @@ 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;
-#endif +G_END_DECLS + +#endif /* GEANY_FILETYPES_PRIVATE_H */
Modified: src/gb.c 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -23,13 +23,16 @@ * GTK-Bandit. */
+#include "utils.h" + +#include "gtkcompat.h" + #include <stdlib.h> #include <string.h> #include <time.h> #include <signal.h> #include <unistd.h> #include <gdk-pixbuf/gdk-pixdata.h> -#include "gtkcompat.h"
#define MAX_PICS 10 #define LOOP_DELAY 200000 /* micro seconds */
Modified: src/geany.h 61 lines changed, 14 insertions(+), 47 deletions(-) =================================================================== @@ -23,24 +23,18 @@ * externs and function prototypes are implemented in main.c. */
#ifndef GEANY_H -#define GEANY_H +#define GEANY_H 1
-#include <gtk/gtk.h> +/* This is included here for compatibility with when GeanyApp used to be + * defined in this header. Some plugins (ex. GeanyLua) include individual + * headers instead of geanyplugin.h for some reason so they wouldn't + * get the GeanyApp definition if this isn't here. */ +#include "app.h"
-G_BEGIN_DECLS - -#if defined(HAVE_CONFIG_H) && defined(GEANY_PRIVATE) -# include "config.h" -#endif +#include <glib.h>
-#include "tm_tagmanager.h" - -#ifndef PLAT_GTK -# define PLAT_GTK 1 /* needed when including ScintillaWidget.h */ -#endif
-/* Compatibility for sharing macros between API and core, overridden in plugindata.h */ -#define GEANY(symbol_name) symbol_name +G_BEGIN_DECLS
/* for detailed description look in the documentation, things are not @@ -58,38 +52,6 @@ G_BEGIN_DECLS #define GEANY_WINDOW_DEFAULT_HEIGHT 600
- -/* Common forward declarations */ -typedef struct GeanyDocument GeanyDocument; -typedef struct GeanyEditor GeanyEditor; -typedef struct GeanyFiletype GeanyFiletype; - - -/** Important application fields. */ -typedef struct GeanyApp -{ - gboolean debug_mode; /**< @c TRUE if debug messages should be printed. */ - /** User configuration directory, usually @c ~/.config/geany. - * This is a full path read by @ref tm_get_real_path(). - * @note Plugin configuration files should be saved as: - * @code g_build_path(G_DIR_SEPARATOR_S, geany->app->configdir, "plugins", "pluginname", - * "file.conf", NULL); @endcode */ - gchar *configdir; - gchar *datadir; - gchar *docdir; - const TMWorkspace *tm_workspace; /**< TagManager workspace/session tags. */ - struct GeanyProject *project; /**< Currently active project or @c NULL if none is open. */ -} -GeanyApp; - -extern GeanyApp *app; - -extern GObject *geany_object; - - -extern gboolean ignore_callback; - - /* prototype is here so that all files can use it. */ void geany_debug(gchar const *format, ...) G_GNUC_PRINTF (1, 2);
@@ -98,6 +60,11 @@ void geany_debug(gchar const *format, ...) G_GNUC_PRINTF (1, 2); #define G_GNUC_WARN_UNUSED_RESULT #endif
+/* Re-defined by plugindata.h as something else */ +#ifndef GEANY +# define GEANY(symbol_name) symbol_name +#endif + G_END_DECLS
-#endif +#endif /* GEANY_H */
Modified: src/geanyentryaction.c 9 lines changed, 6 insertions(+), 3 deletions(-) =================================================================== @@ -23,11 +23,14 @@ * This class is missing the action_create_menu_item() function and so can't be * used for creating menu items. */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" -#include "support.h" -#include "ui_utils.h" #include "geanyentryaction.h" + +#include "ui_utils.h" + #include <ctype.h>
Modified: src/geanyentryaction.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -21,7 +21,9 @@
#ifndef GEANY_ENTRY_ACTION_H -#define GEANY_ENTRY_ACTION_H +#define GEANY_ENTRY_ACTION_H 1 + +#include "gtkcompat.h"
G_BEGIN_DECLS
Modified: src/geanymenubuttonaction.c 7 lines changed, 4 insertions(+), 3 deletions(-) =================================================================== @@ -23,12 +23,13 @@ * This class is missing the action_create_menu_item() function and so can't be * used for creating menu items. */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" -#include "support.h" -#include "utils.h" #include "geanymenubuttonaction.h"
+#include "utils.h"
typedef struct _GeanyMenubuttonActionPrivate GeanyMenubuttonActionPrivate;
Modified: src/geanymenubuttonaction.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -21,7 +21,9 @@
#ifndef GEANY_MENU_BUTTON_ACTION_H -#define GEANY_MENU_BUTTON_ACTION_H +#define GEANY_MENU_BUTTON_ACTION_H 1 + +#include "gtkcompat.h"
G_BEGIN_DECLS
Modified: src/geanyobject.c 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -32,7 +32,10 @@ * Emitted just after loading main keyfile settings. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "geanyobject.h"
/* extern in geany.h */
Modified: src/geanyobject.h 17 lines changed, 12 insertions(+), 5 deletions(-) =================================================================== @@ -20,10 +20,17 @@ */
-#ifndef GEANYOBJECT_H -#define GEANYOBJECT_H +#ifndef GEANY_OBJECT_H +#define GEANY_OBJECT_H 1 + +#include "document.h" +#include "editor.h" +#include "filetypes.h" + +#include "Scintilla.h" + +#include "gtkcompat.h"
-#include <glib-object.h>
G_BEGIN_DECLS
@@ -73,7 +80,7 @@ struct _GeanyObject /* add your public declarations here */ };
-struct SCNotification; +extern GObject *geany_object;
struct _GeanyObjectClass { @@ -106,4 +113,4 @@ GObject* geany_object_new (void);
G_END_DECLS
-#endif /* GEANYOBJECT_H */ +#endif /* GEANY_OBJECT_H */
Modified: src/geanywraplabel.c 5 lines changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -24,9 +24,10 @@ * (inspired by libview's WrapLabel, http://view.sourceforge.net) */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" -#include "utils.h" #include "geanywraplabel.h"
Modified: src/geanywraplabel.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -20,7 +20,9 @@ */
#ifndef GEANY_WRAP_LABEL_H -#define GEANY_WRAP_LABEL_H +#define GEANY_WRAP_LABEL_H 1 + +#include "gtkcompat.h"
G_BEGIN_DECLS
Modified: src/gtkcompat.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -21,7 +21,7 @@ /* Compatibility macros to support older GTK+ versions */
#ifndef GTK_COMPAT_H -#define GTK_COMPAT_H +#define GTK_COMPAT_H 1
#include <gtk/gtk.h> #if GTK_CHECK_VERSION(3, 0, 0)
Modified: src/highlighting.c 37 lines changed, 19 insertions(+), 18 deletions(-) =================================================================== @@ -25,30 +25,31 @@ * Syntax highlighting for the different filetypes, using the Scintilla lexers. */
-#include "geany.h" - -#include <stdlib.h> -#include <ctype.h> -#include <string.h> -#include <glib.h> -#include <glib/gprintf.h> - -#include "SciLexer.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "highlighting.h" +#include "highlightingmappings.h" + +#include "app.h" +#include "dialogs.h" +#include "document.h" #include "editor.h" -#include "utils.h" -#include "filetypes.h" +#include "filetypesprivate.h" +#include "sciwrappers.h" +#include "support.h" #include "symbols.h" #include "ui_utils.h" #include "utils.h" -#include "main.h" -#include "support.h" -#include "sciwrappers.h" -#include "document.h" -#include "dialogs.h" -#include "filetypesprivate.h"
-#include "highlightingmappings.h" +#include "SciLexer.h" + +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include <glib.h> +#include <glib/gprintf.h>
#define GEANY_COLORSCHEMES_SUBDIR "colorschemes"
Modified: src/highlighting.h 13 lines changed, 9 insertions(+), 4 deletions(-) =================================================================== @@ -23,11 +23,16 @@ #ifndef GEANY_HIGHLIGHTING_H #define GEANY_HIGHLIGHTING_H 1
-G_BEGIN_DECLS +#include "filetypes.h" + +#include "gtkcompat.h" /* Needed by ScintillaWidget.h */ +#include "Scintilla.h" /* Needed by ScintillaWidget.h */ +#include "ScintillaWidget.h" /* for ScintillaObject */
-#include "Scintilla.h" -#include "ScintillaWidget.h"
+#include <glib.h> + +G_BEGIN_DECLS
/** Fields representing the different attributes of a Scintilla lexer style. * @see Scintilla messages @c SCI_STYLEGETFORE, etc, for use with scintilla_send_message(). */ @@ -57,4 +62,4 @@ void highlighting_show_color_scheme_dialog(void);
G_END_DECLS
-#endif +#endif /* GEANY_HIGHLIGHTING_H */
Modified: src/highlightingmappings.h 12 lines changed, 9 insertions(+), 3 deletions(-) =================================================================== @@ -21,11 +21,16 @@ */
-#ifndef GEANY_HIGHLIGHTINGMAPPINGS_H -#define GEANY_HIGHLIGHTINGMAPPINGS_H 1 +#ifndef GEANY_HIGHLIGHTING_MAPPINGS_H +#define GEANY_HIGHLIGHTING_MAPPINGS_H 1
#include "Scintilla.h" +#include "SciLexer.h"
+#include <glib.h> + + +G_BEGIN_DECLS
/* contains all filtypes informations in the form of: * - highlighting_lexer_LANG: the SCI lexer @@ -1560,5 +1565,6 @@ static const HLKeyword highlighting_keywords_YAML[] = }; #define highlighting_properties_YAML EMPTY_PROPERTIES
+G_END_DECLS
-#endif /* guard */ +#endif /* GEANY_HIGHLIGHTING_MAPPINGS_H */
Modified: src/keybindings.c 45 lines changed, 21 insertions(+), 24 deletions(-) =================================================================== @@ -27,39 +27,36 @@ * @see plugin_set_key_group(). **/
- -#include "geany.h" - -#include <gdk/gdkkeysyms.h> -#include <string.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "keybindings.h" -#include "support.h" -#include "utils.h" -#include "ui_utils.h" -#include "document.h" + +#include "app.h" +#include "build.h" +#include "callbacks.h" #include "documentprivate.h" #include "filetypes.h" -#include "callbacks.h" -#include "prefs.h" +#include "keybindingsprivate.h" #include "msgwindow.h" -#include "editor.h" -#include "sciwrappers.h" -#include "build.h" -#include "tools.h" #include "navqueue.h" +#include "notebook.h" +#include "prefs.h" +#include "sciwrappers.h" +#include "sidebar.h" +#include "support.h" #include "symbols.h" -#include "vte.h" #include "toolbar.h" -#include "sidebar.h" -#include "notebook.h" -#include "geanywraplabel.h" -#include "main.h" -#include "search.h" +#include "tools.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h" + #include "gtkcompat.h" -#ifdef HAVE_VTE -# include "vte.h" -#endif + +#include <gdk/gdkkeysyms.h> +#include <string.h>
GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers, in visual order */
Modified: src/keybindings.h 18 lines changed, 3 insertions(+), 15 deletions(-) =================================================================== @@ -22,6 +22,8 @@ #ifndef GEANY_KEYBINDINGS_H #define GEANY_KEYBINDINGS_H 1
+#include "gtkcompat.h" + G_BEGIN_DECLS
/** Function pointer type used for keybinding callbacks. */ @@ -57,20 +59,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 */
@@ -290,4 +278,4 @@ void keybindings_dialog_show_prefs_scroll(const gchar *name);
G_END_DECLS
-#endif +#endif /* GEANY_KEYBINDINGS_H */
Modified: src/keybindingsprivate.h 45 lines changed, 45 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,45 @@ +/* + * 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@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 "keybindings.h" + +#include <glib.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 46 lines changed, 25 insertions(+), 21 deletions(-) =================================================================== @@ -28,37 +28,41 @@ * filename_xx=pos;filetype UID;read only;Eencoding;use_tabs;auto_indent;line_wrapping;filename */
-#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -#include "geany.h" - -#ifdef HAVE_VTE -#include <pwd.h> -#include <sys/types.h> -#include <unistd.h> +#ifdef HAVE_CONFIG_H +# include "config.h" #endif
-#include "support.h" #include "keyfile.h" -#include "prefs.h" -#include "ui_utils.h" -#include "utils.h" + +#include "app.h" +#include "build.h" #include "document.h" -#include "filetypes.h" -#include "sciwrappers.h" #include "encodings.h" -#include "vte.h" +#include "filetypes.h" +#include "geanyobject.h" #include "main.h" #include "msgwindow.h" -#include "search.h" -#include "project.h" -#include "editor.h" +#include "prefs.h" #include "printing.h" +#include "project.h" +#include "sciwrappers.h" +#include "stash.h" +#include "support.h" #include "templates.h" #include "toolbar.h" -#include "stash.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h" + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#ifdef HAVE_VTE +#include <pwd.h> +#include <sys/types.h> +#include <unistd.h> +#endif
/* some default settings which are used at the very first start of Geany to fill
Modified: src/keyfile.h 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -23,6 +23,9 @@ #ifndef GEANY_KEYFILE_H #define GEANY_KEYFILE_H 1
+#include <glib.h> + +G_BEGIN_DECLS
extern GPtrArray *pref_groups;
@@ -55,4 +58,6 @@ void configuration_save_session_files(GKeyFile *config); * realisation of the main window */ void configuration_apply_settings(void);
-#endif +G_END_DECLS + +#endif /* GEANY_KEYFILE_H */
Modified: src/log.c 13 lines changed, 9 insertions(+), 4 deletions(-) =================================================================== @@ -23,17 +23,22 @@ * Logging functions and the debug messages window. */
-#include "geany.h" - -#ifdef HAVE_LOCALE_H -# include <locale.h> +#ifdef HAVE_CONFIG_H +# include "config.h" #endif
#include "log.h" + +#include "app.h" #include "support.h" #include "utils.h" #include "ui_utils.h"
+#include "gtkcompat.h" + +#ifdef HAVE_LOCALE_H +# include <locale.h> +#endif
static GString *log_buffer = NULL; static GtkTextBuffer *dialog_textbuffer = NULL;
Modified: src/log.h 10 lines changed, 8 insertions(+), 2 deletions(-) =================================================================== @@ -21,7 +21,11 @@
#ifndef GEANY_LOG_H -#define GEANY_LOG_H +#define GEANY_LOG_H 1 + +#include <glib.h> + +G_BEGIN_DECLS
void log_handlers_init(void);
@@ -29,4 +33,6 @@ void log_finalize(void);
void log_show_debug_messages_dialog(void);
-#endif +G_END_DECLS + +#endif /* GEANY_LOG_H */
Modified: src/main.c 81 lines changed, 38 insertions(+), 43 deletions(-) =================================================================== @@ -25,63 +25,57 @@ * Handles program initialization and cleanup. */
-#include <signal.h> -#include <time.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> - -#include "geany.h" -#include <glib/gstdio.h> - -#ifdef HAVE_LOCALE_H -# include <locale.h> +#ifdef HAVE_CONFIG_H +# include "config.h" #endif
#include "main.h" -#include "prefix.h" -#include "prefs.h" -#include "support.h" + +#include "app.h" +#include "build.h" #include "callbacks.h" -#include "log.h" -#include "ui_utils.h" -#include "utils.h" +#include "dialogs.h" #include "document.h" +#include "encodings.h" #include "filetypes.h" +#include "geanyobject.h" +#include "highlighting.h" +#include "keybindings.h" #include "keyfile.h" -#include "win32.h" +#include "log.h" #include "msgwindow.h" -#include "dialogs.h" -#include "templates.h" -#include "encodings.h" -#include "sidebar.h" -#include "notebook.h" -#include "keybindings.h" -#include "editor.h" -#include "search.h" -#include "build.h" -#include "highlighting.h" -#include "symbols.h" -#include "project.h" -#include "tools.h" #include "navqueue.h" +#include "notebook.h" #include "plugins.h" +#include "prefs.h" #include "printing.h" -#include "toolbar.h" -#include "geanyobject.h" - +#include "sidebar.h" #ifdef HAVE_SOCKET # include "socket.h" #endif +#include "support.h" +#include "symbols.h" +#include "templates.h" +#include "toolbar.h" +#include "tools.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h"
-#ifdef HAVE_VTE -# include "vte.h" -#endif +#include "gtkcompat.h"
-#ifndef N_ -# define N_(String) (String) +#include <signal.h> +#include <time.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> + +#include <glib/gstdio.h> + +#ifdef HAVE_LOCALE_H +# include <locale.h> #endif
@@ -495,8 +489,8 @@ void main_locale_init(const gchar *locale_dir, const gchar *package) l_locale_dir = g_strdup(locale_dir); #endif
- bindtextdomain(package, l_locale_dir); - bind_textdomain_codeset(package, "UTF-8"); + (void) bindtextdomain(package, l_locale_dir); + (void) bind_textdomain_codeset(package, "UTF-8"); g_free(l_locale_dir); }
@@ -553,6 +547,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/main.h 10 lines changed, 8 insertions(+), 2 deletions(-) =================================================================== @@ -21,7 +21,11 @@
#ifndef GEANY_MAIN_H -#define GEANY_MAIN_H +#define GEANY_MAIN_H 1 + +#include <glib.h> + +G_BEGIN_DECLS
typedef struct { @@ -68,4 +72,6 @@ gboolean main_is_realized(void);
void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session);
-#endif +G_END_DECLS + +#endif /* GEANY_MAIN_H */
Modified: src/msgwindow.c 24 lines changed, 13 insertions(+), 11 deletions(-) =================================================================== @@ -27,22 +27,24 @@ * @see GeanyMainWidgets::message_window_notebook to append a new notebook page. **/
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "support.h" -#include "prefs.h" -#include "callbacks.h" -#include "ui_utils.h" -#include "utils.h" +#include "msgwindow.h" + +#include "build.h" #include "document.h" +#include "callbacks.h" #include "filetypes.h" -#include "build.h" +#include "keybindings.h" #include "main.h" -#include "vte.h" #include "navqueue.h" -#include "editor.h" -#include "msgwindow.h" -#include "keybindings.h" +#include "prefs.h" +#include "support.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h"
#include <string.h> #include <stdlib.h>
Modified: src/msgwindow.h 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -22,6 +22,11 @@ #ifndef GEANY_MSGWINDOW_H #define GEANY_MSGWINDOW_H 1
+#include "document.h" + +#include "gtkcompat.h" + + G_BEGIN_DECLS
/** @@ -104,4 +109,4 @@ gboolean msgwin_goto_messages_file_line(gboolean focus_editor);
G_END_DECLS
-#endif +#endif /* GEANY_MSGWINDOW_H */
Modified: src/navqueue.c 17 lines changed, 10 insertions(+), 7 deletions(-) =================================================================== @@ -24,16 +24,19 @@ * Simple code navigation */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "sciwrappers.h" -#include "document.h" -#include "utils.h" -#include "support.h" -#include "ui_utils.h" -#include "editor.h" #include "navqueue.h" + +#include "document.h" +#include "geanyobject.h" +#include "sciwrappers.h" #include "toolbar.h" +#include "utils.h" + +#include "gtkcompat.h"
/* for the navigation history queue */
Modified: src/navqueue.h 9 lines changed, 7 insertions(+), 2 deletions(-) =================================================================== @@ -29,6 +29,11 @@ #ifndef GEANY_NAVQUEUE_H #define GEANY_NAVQUEUE_H 1
+#include "document.h" + +#include <glib.h> + +G_BEGIN_DECLS
void navqueue_init(void);
@@ -36,12 +41,12 @@ void navqueue_free(void);
void navqueue_remove_file(const gchar *filename);
- gboolean navqueue_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint line);
void navqueue_go_back(void);
void navqueue_go_forward(void);
+G_END_DECLS
-#endif +#endif /* GEANY_NAVQUEUE_H */
Modified: src/notebook.c 23 lines changed, 13 insertions(+), 10 deletions(-) =================================================================== @@ -23,23 +23,26 @@ * Notebook tab Drag 'n' Drop reordering and tab management. */
-#include "geany.h" - -#include <gdk/gdkkeysyms.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "notebook.h" -#include "document.h" -#include "editor.h" -#include "documentprivate.h" -#include "ui_utils.h" -#include "sidebar.h" -#include "support.h" + #include "callbacks.h" -#include "utils.h" +#include "documentprivate.h" +#include "geanyobject.h" #include "keybindings.h" #include "main.h" +#include "support.h" +#include "ui_utils.h" +#include "utils.h" + #include "gtkcompat.h"
+#include <gdk/gdkkeysyms.h> + + #define GEANY_DND_NOTEBOOK_TAB_TYPE "geany_dnd_notebook_tab"
static const GtkTargetEntry drag_targets[] =
Modified: src/notebook.h 10 lines changed, 9 insertions(+), 1 deletions(-) =================================================================== @@ -22,6 +22,12 @@ #ifndef GEANY_NOTEBOOK_H #define GEANY_NOTEBOOK_H 1
+#include "document.h" + +#include <glib.h> + +G_BEGIN_DECLS + void notebook_init(void);
void notebook_free(void); @@ -40,4 +46,6 @@ void notebook_switch_tablastused(void); * document yet). */ gboolean notebook_switch_in_progress(void);
-#endif +G_END_DECLS + +#endif /* GEANY_NOTEBOOK_H */
Modified: src/plugindata.h 18 lines changed, 10 insertions(+), 8 deletions(-) =================================================================== @@ -29,8 +29,15 @@ * when making changes (see 'Keeping the plugin ABI stable' in the HACKING file). */
-#ifndef GEANY_PLUGINDATA_H -#define GEANY_PLUGINDATA_H +#ifndef GEANY_PLUGIN_DATA_H +#define GEANY_PLUGIN_DATA_H 1 + +#include "build.h" /* GeanyBuildGroup, GeanyBuildSource, GeanyBuildCmdEntries enums */ +#include "document.h" /* GeanyDocument */ +#include "editor.h" /* GeanyEditor, GeanyIndentType */ +#include "filetypes.h" /* GeanyFiletype */ + +#include "gtkcompat.h"
G_BEGIN_DECLS
@@ -39,10 +46,6 @@ G_BEGIN_DECLS #undef GEANY #define GEANY(symbol_name) geany->symbol_name
-#include "editor.h" /* GeanyIndentType */ -#include "build.h" /* GeanyBuildGroup, GeanyBuildSource, GeanyBuildCmdEntries enums */ -#include "gtkcompat.h" -
/** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. @@ -292,7 +295,6 @@ GeanyFunctions; /* For more information about these functions, see the main source code. * E.g. for p_document->new_file(), see document_new_file() in document.c. */
- /* See document.h */ typedef struct DocumentFuncs { @@ -752,4 +754,4 @@ BuildFuncs;
G_END_DECLS
-#endif +#endif /* GEANY_PLUGIN_DATA_H */
Modified: src/pluginprivate.h 11 lines changed, 8 insertions(+), 3 deletions(-) =================================================================== @@ -20,13 +20,17 @@ */
-#ifndef GEANY_PLUGINPRIVATE_H -#define GEANY_PLUGINPRIVATE_H +#ifndef GEANY_PLUGIN_PRIVATE_H +#define GEANY_PLUGIN_PRIVATE_H 1
#include "plugindata.h" #include "ui_utils.h" /* GeanyAutoSeparator */ #include "keybindings.h" /* GeanyKeyGroup */
+#include "gtkcompat.h" + + +G_BEGIN_DECLS
typedef struct SignalConnection { @@ -63,5 +67,6 @@ typedef GeanyPluginPrivate Plugin; /* shorter alias */
void plugin_watch_object(Plugin *plugin, gpointer object);
+G_END_DECLS
-#endif /* GEANY_PLUGINPRIVATE_H */ +#endif /* GEANY_PLUGIN_PRIVATE_H */
Modified: src/plugins.c 53 lines changed, 25 insertions(+), 28 deletions(-) =================================================================== @@ -21,44 +21,41 @@
/* Code to manage, load and unload plugins. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#ifdef HAVE_PLUGINS
-#include <string.h> - -#include "Scintilla.h" -#include "ScintillaWidget.h" - -#include "prefix.h" #include "plugins.h" -#include "plugindata.h" -#include "support.h" -#include "utils.h" -#include "document.h" -#include "filetypes.h" -#include "templates.h" -#include "sciwrappers.h" -#include "ui_utils.h" -#include "editor.h" + +#include "app.h" #include "dialogs.h" -#include "msgwindow.h" -#include "prefs.h" -#include "geanywraplabel.h" -/* #include "build.h" included in plugindata.h so it can use enums */ #include "encodings.h" -#include "search.h" +#include "geanyobject.h" +#include "geanywraplabel.h" #include "highlighting.h" -#include "keybindings.h" -#include "navqueue.h" +#include "keybindingsprivate.h" +#include "keyfile.h" #include "main.h" -#include "toolbar.h" +#include "msgwindow.h" +#include "navqueue.h" +#include "plugindata.h" +#include "pluginprivate.h" +#include "pluginutils.h" +#include "prefs.h" +#include "sciwrappers.h" #include "stash.h" +#include "support.h" #include "symbols.h" -#include "keyfile.h" -#include "win32.h" -#include "pluginutils.h" -#include "pluginprivate.h" +#include "templates.h" +#include "toolbar.h" +#include "ui_utils.h" +#include "utils.h" + +#include "gtkcompat.h" + +#include <string.h>
GList *active_plugin_list = NULL; /* list of only actually loaded plugins, always valid */
Modified: src/plugins.h 12 lines changed, 9 insertions(+), 3 deletions(-) =================================================================== @@ -21,10 +21,14 @@
#ifndef GEANY_PLUGINS_H -#define GEANY_PLUGINS_H +#define GEANY_PLUGINS_H 1
#ifdef HAVE_PLUGINS
+#include <glib.h> + +G_BEGIN_DECLS + extern GList *active_plugin_list;
@@ -36,6 +40,8 @@ void plugins_load_active(void);
gboolean plugins_have_preferences(void);
-#endif +G_END_DECLS + +#endif /* HAVE_PLUGINS */
-#endif +#endif /* GEANY_PLUGINS_H */
Modified: src/pluginutils.c 15 lines changed, 10 insertions(+), 5 deletions(-) =================================================================== @@ -23,18 +23,23 @@ * Plugin utility functions. * These functions all take the @ref geany_plugin symbol as their first argument. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#ifdef HAVE_PLUGINS
#include "pluginutils.h" -#include "pluginprivate.h"
-#include "ui_utils.h" +#include "app.h" +#include "geanyobject.h" +#include "plugindata.h" +#include "pluginprivate.h" +#include "plugins.h" +#include "support.h" #include "toolbar.h" +#include "ui_utils.h" #include "utils.h" -#include "support.h" -#include "plugins.h"
/** Inserts a toolbar item before the Quit button, or after the previous plugin toolbar item.
Modified: src/pluginutils.h 11 lines changed, 8 insertions(+), 3 deletions(-) =================================================================== @@ -20,13 +20,16 @@ */
-#ifndef GEANY_PLUGINUTILS_H -#define GEANY_PLUGINUTILS_H +#ifndef GEANY_PLUGIN_UTILS_H +#define GEANY_PLUGIN_UTILS_H 1
#ifdef HAVE_PLUGINS
#include "keybindings.h" /* GeanyKeyGroupCallback */
+#include "gtkcompat.h" + +G_BEGIN_DECLS
/* avoid including plugindata.h otherwise this redefines the GEANY() macro */ struct GeanyPlugin; @@ -56,5 +59,7 @@ void plugin_show_configure(struct GeanyPlugin *plugin); void plugin_builder_connect_signals(struct GeanyPlugin *plugin, GtkBuilder *builder, gpointer user_data);
+G_END_DECLS + #endif /* HAVE_PLUGINS */ -#endif /* GEANY_PLUGINUTILS_H */ +#endif /* GEANY_PLUGIN_UTILS_H */
Modified: src/prefix.c 2 lines changed, 0 insertions(+), 2 deletions(-) =================================================================== @@ -11,12 +11,10 @@ * to br_*", try renaming prefix.c to prefix.cpp */
- #ifdef HAVE_CONFIG_H # include "config.h" #endif
- /* * enrico - all the code below is only compiled and used if ENABLE_BINRELOC is set in config.h, * this only happens if configure option --enable-binreloc was used
Modified: src/prefix.h 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -15,7 +15,7 @@ */
#ifndef GEANY_PREFIX_H -#define GEANY_PREFIX_H +#define GEANY_PREFIX_H 1
/* @@ -24,6 +24,10 @@ */ #ifdef ENABLE_BINRELOC
+#include <glib.h> + +G_BEGIN_DECLS +
/* WARNING, BEFORE YOU MODIFY PREFIX.C: * @@ -90,6 +94,7 @@ char *br_locate (void *symbol); char *br_locate_prefix (void *symbol); char *br_prepend_prefix (void *symbol, char *path);
+G_END_DECLS
#endif /* ENABLE_BINRELOC */
Modified: src/prefs.c 49 lines changed, 23 insertions(+), 26 deletions(-) =================================================================== @@ -29,42 +29,39 @@ * New 'simple' prefs should use Stash code in keyfile.c - init_pref_groups(). */
-#include <stdlib.h> -#include <string.h> -#include <gdk/gdkkeysyms.h> - -#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "prefs.h" -#include "support.h" + +#include "app.h" #include "dialogs.h" -#include "ui_utils.h" -#include "utils.h" -#include "sciwrappers.h" -#include "document.h" #include "documentprivate.h" -#include "msgwindow.h" -#include "keyfile.h" -#include "keybindings.h" -#include "encodings.h" -#include "project.h" #include "editor.h" -#include "main.h" -#include "sidebar.h" -#include "printing.h" +#include "encodings.h" +#include "filetypes.h" #include "geanywraplabel.h" +#include "keybindingsprivate.h" +#include "keyfile.h" +#include "msgwindow.h" +#include "prefs.h" +#include "printing.h" +#include "sidebar.h" +#include "stash.h" +#include "support.h" #include "templates.h" -#include "search.h" #include "toolbar.h" #include "tools.h" -#include "stash.h" -#include "keyfile.h" -#include "filetypes.h" -#include "win32.h" +#include "ui_utils.h" +#include "utils.h" +#include "vte.h"
-#ifdef HAVE_VTE -# include "vte.h" -#endif +#include "gtkcompat.h" + +#include <stdlib.h> +#include <string.h> +#include <gdk/gdkkeysyms.h>
GeanyPrefs prefs;
Modified: src/prefs.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -22,6 +22,8 @@ #ifndef GEANY_PREFS_H #define GEANY_PREFS_H 1
+#include <glib.h> + G_BEGIN_DECLS
/** General Preferences dialog settings. */ @@ -62,4 +64,4 @@ void prefs_kb_search_name(const gchar *search);
G_END_DECLS
-#endif +#endif /* GEANY_PREFS_H */
Modified: src/printing.c 24 lines changed, 14 insertions(+), 10 deletions(-) =================================================================== @@ -26,22 +26,26 @@ * (basic code layout were adopted from Sylpheed's printing implementation, thanks) */
-#include <math.h> -#include <time.h> -#include <string.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" #include "printing.h" + +#include "app.h" +#include "dialogs.h" #include "document.h" +#include "geany.h" +#include "highlighting.h" +#include "msgwindow.h" #include "sciwrappers.h" -#include "editor.h" -#include "utils.h" #include "support.h" -#include "dialogs.h" +#include "utils.h" #include "ui_utils.h" -#include "msgwindow.h" -#include "highlighting.h" -#include "Scintilla.h" + +#include <math.h> +#include <time.h> +#include <string.h>
PrintingPrefs printing_prefs;
Modified: src/printing.h 9 lines changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -23,6 +23,11 @@ #ifndef GEANY_PRINTING_H #define GEANY_PRINTING_H 1
+#include "document.h" + +#include <glib.h> + +G_BEGIN_DECLS
/* General printing preferences. */ typedef struct PrintingPrefs @@ -43,4 +48,6 @@ void printing_page_setup_gtk(void);
void printing_print_doc(GeanyDocument *doc);
-#endif +G_END_DECLS + +#endif /* GEANY_PRINTING_H */
Modified: src/project.c 84 lines changed, 43 insertions(+), 41 deletions(-) =================================================================== @@ -23,29 +23,31 @@ * Project Management. */
-#include "geany.h" - -#include <string.h> -#include <unistd.h> -#include <errno.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "project.h" -#include "projectprivate.h"
+#include "app.h" +#include "build.h" #include "dialogs.h" -#include "support.h" -#include "utils.h" -#include "ui_utils.h" #include "document.h" -#include "msgwindow.h" -#include "main.h" -#include "keyfile.h" -#include "win32.h" -#include "build.h" #include "editor.h" -#include "stash.h" +#include "filetypesprivate.h" +#include "geanyobject.h" +#include "keyfile.h" +#include "main.h" +#include "projectprivate.h" #include "sidebar.h" -#include "filetypes.h" +#include "stash.h" +#include "support.h" +#include "ui_utils.h" +#include "utils.h" + +#include <string.h> +#include <unistd.h> +#include <errno.h>
ProjectPrefs project_prefs = { NULL, FALSE, FALSE }; @@ -338,10 +340,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 +368,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 +525,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 +534,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 +629,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 +758,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 +995,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 +1064,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 10 lines changed, 3 insertions(+), 7 deletions(-) =================================================================== @@ -23,6 +23,8 @@ #ifndef GEANY_PROJECT_H #define GEANY_PROJECT_H 1
+#include <glib.h> + G_BEGIN_DECLS
#define GEANY_PROJECT_EXT "geany" @@ -41,12 +43,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;
@@ -98,4 +94,4 @@ void project_apply_prefs(void);
G_END_DECLS
-#endif +#endif /* GEANY_PROJECT_H */
Modified: src/projectprivate.h 11 lines changed, 10 insertions(+), 1 deletions(-) =================================================================== @@ -23,6 +23,11 @@ #ifndef GEANY_PROJECTPRIVATE_H #define GEANY_PROJECTPRIVATE_H 1
+#include "project.h" + +#include <glib.h> + +G_BEGIN_DECLS
typedef struct GeanyProjectPrivate { @@ -31,8 +36,12 @@ 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;
+G_END_DECLS
-#endif +#endif /* GEANY_PROJECT_H */
Modified: src/sciwrappers.c 11 lines changed, 7 insertions(+), 4 deletions(-) =================================================================== @@ -31,15 +31,18 @@ * @see scintilla_send_message(). */
-#include <string.h> - -#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "sciwrappers.h" + #include "utils.h"
-#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l) +#include <string.h> +
+#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
/* line numbers visibility */ void sci_set_line_numbers(ScintillaObject *sci, gboolean set, gint extra_width)
Modified: src/sciwrappers.h 15 lines changed, 10 insertions(+), 5 deletions(-) =================================================================== @@ -19,13 +19,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#ifndef GEANY_SCIWRAPPERS_H -#define GEANY_SCIWRAPPERS_H 1 +#ifndef GEANY_SCI_WRAPPERS_H +#define GEANY_SCI_WRAPPERS_H 1
-#include "Scintilla.h" -#include "ScintillaWidget.h" +#include "gtkcompat.h" /* Needed by ScintillaWidget.h */ +#include "Scintilla.h" /* Needed by ScintillaWidget.h */ +#include "ScintillaWidget.h" /* for ScintillaObject */
+G_BEGIN_DECLS + gchar* sci_get_string (ScintillaObject *sci, guint msg, gulong wParam);
void sci_set_line_numbers (ScintillaObject *sci, gboolean set, gint extra_width); @@ -189,4 +192,6 @@ gint sci_text_width (ScintillaObject *sci, gint styleNumber, const gchar * void sci_move_selected_lines_down (ScintillaObject *sci); void sci_move_selected_lines_up (ScintillaObject *sci);
-#endif +G_END_DECLS + +#endif /* GEANY_SCI_WRAPPERS_H */
Modified: src/search.c 23 lines changed, 13 insertions(+), 10 deletions(-) =================================================================== @@ -24,23 +24,25 @@ * Note that the basic text find functions are in document.c. */
-#include <gdk/gdkkeysyms.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" #include "search.h" -#include "prefs.h" -#include "support.h" -#include "utils.h" + +#include "app.h" #include "document.h" -#include "msgwindow.h" -#include "sciwrappers.h" -#include "ui_utils.h" -#include "editor.h" #include "encodings.h" -#include "project.h" #include "keyfile.h" +#include "msgwindow.h" +#include "prefs.h" +#include "sciwrappers.h" #include "stash.h" +#include "support.h" #include "toolbar.h" +#include "ui_utils.h" +#include "utils.h" + #include "gtkcompat.h"
#include <unistd.h> @@ -52,6 +54,7 @@ # include <sys/wait.h> #endif
+#include <gdk/gdkkeysyms.h>
enum {
Modified: src/search.h 17 lines changed, 10 insertions(+), 7 deletions(-) =================================================================== @@ -28,8 +28,15 @@ #ifndef GEANY_SEARCH_H #define GEANY_SEARCH_H 1
+#include <glib.h> + + G_BEGIN_DECLS
+struct GeanyDocument; /* document.h includes this header */ +struct _ScintillaObject; +struct Sci_TextToFind; + /* the flags given in the search dialog for "find next", also used by the search bar */ typedef struct GeanySearchData { @@ -96,10 +103,6 @@ void search_show_find_in_files_dialog(const gchar *dir);
void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
- -struct _ScintillaObject; -struct Sci_TextToFind; - void geany_match_info_free(GeanyMatchInfo *info);
gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, gint flags, GeanyMatchInfo **match_); @@ -112,9 +115,9 @@ void search_find_again(gboolean change_direction);
void search_find_usage(const gchar *search_text, const gchar *original_search_text, gint flags, gboolean in_session);
-void search_find_selection(GeanyDocument *doc, gboolean search_backwards); +void search_find_selection(struct GeanyDocument *doc, gboolean search_backwards);
-gint search_mark_all(GeanyDocument *doc, const gchar *search_text, gint flags); +gint search_mark_all(struct GeanyDocument *doc, const gchar *search_text, gint flags);
gint search_replace_match(struct _ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text);
@@ -123,4 +126,4 @@ guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *
G_END_DECLS
-#endif +#endif /* GEANY_SEARCH_H */
Modified: src/sidebar.c 29 lines changed, 15 insertions(+), 14 deletions(-) =================================================================== @@ -23,25 +23,26 @@ * Sidebar related code for the Symbol list and Open files GtkTreeViews. */
-#include <string.h> +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include "geany.h" -#include "support.h" -#include "callbacks.h" #include "sidebar.h" -#include "document.h" -#include "editor.h" + +#include "app.h" +#include "callbacks.h" /* FIXME: for ignore_callback */ #include "documentprivate.h" -#include "filetypes.h" -#include "utils.h" -#include "ui_utils.h" -#include "symbols.h" +#include "filetypesprivate.h" +#include "geanyobject.h" +#include "keyfile.h" #include "navqueue.h" -#include "project.h" #include "stash.h" -#include "keyfile.h" -#include "sciwrappers.h" -#include "search.h" +#include "support.h" +#include "symbols.h" +#include "ui_utils.h" +#include "utils.h" + +#include <string.h>
#include <gdk/gdkkeysyms.h>
Modified: src/sidebar.h 9 lines changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -24,6 +24,11 @@ #ifndef GEANY_SIDEBAR_H #define GEANY_SIDEBAR_H 1
+#include "document.h" + +#include "gtkcompat.h" + +G_BEGIN_DECLS
typedef struct SidebarTreeviews { @@ -66,4 +71,6 @@ void sidebar_focus_openfiles_tab(void);
void sidebar_focus_symbols_tab(void);
-#endif +G_END_DECLS + +#endif /* GEANY_SIDEBAR_H */
Modified: src/socket.c 28 lines changed, 16 insertions(+), 12 deletions(-) =================================================================== @@ -51,11 +51,25 @@ * */
- -#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#ifdef HAVE_SOCKET
+#include "socket.h" + +#include "app.h" +#include "dialogs.h" +#include "document.h" +#include "encodings.h" +#include "main.h" +#include "support.h" +#include "utils.h" + +#include "gtkcompat.h" + + #ifndef G_OS_WIN32 # include <sys/time.h> # include <sys/types.h> @@ -78,16 +92,6 @@ #include <gdk/gdkx.h> #endif
-#include "main.h" -#include "socket.h" -#include "document.h" -#include "support.h" -#include "ui_utils.h" -#include "utils.h" -#include "dialogs.h" -#include "encodings.h" -#include "project.h" -
#ifdef G_OS_WIN32 #define REMOTE_CMD_PORT 49876
Modified: src/socket.h 6 lines changed, 5 insertions(+), 1 deletions(-) =================================================================== @@ -23,6 +23,9 @@ #ifndef GEANY_SOCKET_H #define GEANY_SOCKET_H 1
+#include <glib.h> + +G_BEGIN_DECLS
struct socket_info_struct { @@ -41,5 +44,6 @@ gboolean socket_lock_input_cb(GIOChannel *source, GIOCondition condition, gpoint
gint socket_finalize(void);
+G_END_DECLS
-#endif +#endif /* GEANY_SOCKET_H */
Modified: src/stash.c 9 lines changed, 4 insertions(+), 5 deletions(-) =================================================================== @@ -76,13 +76,12 @@ * should be efficient enough. */
+#include "stash.h"
-#include "geany.h" /* necessary for utils.h, otherwise use gtk/gtk.h */ -#include <stdlib.h> /* only for atoi() */ -#include "support.h" /* only for _("text") */ -#include "utils.h" /* only for foreach_*, utils_get_setting_*(). Stash should not depend on Geany. */ +#include "support.h" /* only for _("text") */ +#include "utils.h" /* only for foreach_*, utils_get_setting_*(). Stash should not depend on Geany. */
-#include "stash.h" +#include <stdlib.h> /* only for atoi() */
/* GTK3 removed ComboBoxEntry, but we need a value to differentiate combo box with and
Modified: src/stash.h 6 lines changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -20,7 +20,9 @@ */
#ifndef GEANY_STASH_H -#define GEANY_STASH_H +#define GEANY_STASH_H 1 + +#include "gtkcompat.h"
G_BEGIN_DECLS
@@ -101,4 +103,4 @@ void stash_tree_update(GtkTreeView *tree);
G_END_DECLS
-#endif +#endif /* GEANY_STASH_H */
Modified: src/support.h 18 lines changed, 12 insertions(+), 6 deletions(-) =================================================================== @@ -25,20 +25,26 @@ * @see GLib's @c gi18n-lib.h. **/
-G_BEGIN_DECLS +#ifndef GEANY_SUPPORT_H +#define GEANY_SUPPORT_H 1 + +#include <glib.h>
-#include "geany.h" +G_BEGIN_DECLS
#ifdef GETTEXT_PACKAGE # include <glib/gi18n-lib.h> #else +# define GETTEXT_PACKAGE NULL # define textdomain(String) (String) -# define bind_textdomain_codeset(String) (String) -# define bindtextdomain(Domain,Charset) (Domain) -# define ngettext(String) (String) +# define bind_textdomain_codeset(Domain,Codeset) (Codeset) +# define bindtextdomain(Domain,Dir) (Dir) +# define ngettext(String,PluralString,Number) (((Number) == 1) ? (String) : (PluralString)) # define _(String) String -# define Q_(String) g_strip_context((String), (String)) # define N_(String) String +# define C_(Context,String) (String) #endif
G_END_DECLS + +#endif /* GEANY_SUPPORT_H */
Modified: src/symbols.c 41 lines changed, 23 insertions(+), 18 deletions(-) =================================================================== @@ -32,30 +32,35 @@ * matching filetype is first loaded. */
-#include "SciLexer.h" -#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
-#include <ctype.h> -#include <string.h> -#include <stdlib.h> - -#include "prefix.h" #include "symbols.h" -#include "utils.h" -#include "filetypes.h" -#include "encodings.h" -#include "document.h" + +#include "app.h" +#include "callbacks.h" /* FIXME: for ignore_callback */ #include "documentprivate.h" -#include "support.h" -#include "msgwindow.h" -#include "sidebar.h" +#include "editor.h" +#include "encodings.h" +#include "filetypesprivate.h" +#include "geanyobject.h" #include "main.h" #include "navqueue.h" -#include "ui_utils.h" -#include "editor.h" #include "sciwrappers.h" -#include "filetypesprivate.h" -#include "search.h" +#include "sidebar.h" +#include "support.h" +#include "tm_tag.h" +#include "ui_utils.h" +#include "utils.h" + +#include "SciLexer.h" + +#include "gtkcompat.h" + +#include <ctype.h> +#include <string.h> +#include <stdlib.h>
const guint TM_GLOBAL_TYPE_MASK =
Modified: src/symbols.h 10 lines changed, 9 insertions(+), 1 deletions(-) =================================================================== @@ -23,6 +23,12 @@ #ifndef GEANY_SYMBOLS_H #define GEANY_SYMBOLS_H 1
+#include "document.h" + +#include <glib.h> + +G_BEGIN_DECLS + extern const guint TM_GLOBAL_TYPE_MASK;
enum @@ -63,4 +69,6 @@ gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname);
gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname);
-#endif +G_END_DECLS + +#endif /* GEANY_SYMBOLS_H */
Modified: src/templates.c 26 lines changed, 16 insertions(+), 10 deletions(-) =================================================================== @@ -24,22 +24,28 @@ * document from. */
-#include <time.h> -#include <string.h> - -#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif
#include "templates.h" -#include "support.h" -#include "utils.h" + +#include "app.h" #include "document.h" #include "encodings.h" -#include "editor.h" #include "filetypes.h" -#include "ui_utils.h" -#include "toolbar.h" +#include "geany.h" #include "geanymenubuttonaction.h" -#include "project.h" +#include "geanyobject.h" +#include "support.h" +#include "toolbar.h" +#include "ui_utils.h" +#include "utils.h" + +#include "gtkcompat.h" + +#include <time.h> +#include <string.h>
GeanyTemplatePrefs template_prefs;
Modified: src/templates.h 11 lines changed, 8 insertions(+), 3 deletions(-) =================================================================== @@ -28,8 +28,15 @@ #ifndef GEANY_TEMPLATES_H #define GEANY_TEMPLATES_H 1
+#include "document.h" +#include "filetypes.h" + +#include <glib.h> + G_BEGIN_DECLS
+struct filetype; + #define GEANY_TEMPLATES_INDENT 3 #define GEANY_TEMPLATES_FORMAT_YEAR C_("DefaultYear", "%Y") #define GEANY_TEMPLATES_FORMAT_DATE C_("DefaultDate", "%Y-%m-%d") @@ -63,8 +70,6 @@ GeanyTemplatePrefs; extern GeanyTemplatePrefs template_prefs;
-struct filetype; - void templates_init(void);
gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname); @@ -85,4 +90,4 @@ void templates_free_templates(void);
G_END_DECLS
-#endif +#endif /* GEANY_TEMPLATES_H */
Modified: src/toolbar.c 20 lines changed, 12 insertions(+), 8 deletions(-) =================================================================== @@ -25,18 +25,22 @@ */ /* Utility functions to create the toolbar */
-#include "geany.h" -#include "support.h" -#include "ui_utils.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "toolbar.h" + +#include "app.h" +#include "build.h" #include "callbacks.h" -#include "utils.h" -#include "dialogs.h" #include "document.h" -#include "build.h" -#include "main.h" -#include "geanymenubuttonaction.h" #include "geanyentryaction.h" +#include "geanymenubuttonaction.h" +#include "main.h" +#include "support.h" +#include "ui_utils.h" +#include "utils.h"
#include <string.h> #include <glib/gstdio.h>
Modified: src/toolbar.h 6 lines changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -20,7 +20,9 @@ */
#ifndef GEANY_TOOLBAR_H -#define GEANY_TOOLBAR_H +#define GEANY_TOOLBAR_H 1 + +#include "gtkcompat.h"
G_BEGIN_DECLS
@@ -63,4 +65,4 @@ void toolbar_configure(GtkWindow *parent);
G_END_DECLS
-#endif +#endif /* GEANY_TOOLBAR_H */
Modified: src/tools.c 28 lines changed, 14 insertions(+), 14 deletions(-) =================================================================== @@ -24,7 +24,20 @@ * For Plugins code see plugins.c. */
-#include "geany.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "tools.h" + +#include "document.h" +#include "keybindings.h" +#include "sciwrappers.h" +#include "support.h" +#include "ui_utils.h" +#include "utils.h" + +#include "gtkcompat.h"
#include <stdlib.h> #include <unistd.h> @@ -37,19 +50,6 @@ # include <signal.h> #endif
-#include "tools.h" -#include "support.h" -#include "document.h" -#include "editor.h" -#include "sciwrappers.h" -#include "utils.h" -#include "ui_utils.h" -#include "msgwindow.h" -#include "keybindings.h" -#include "templates.h" @@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).