Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush matt@geany.org Date: Wed, 21 May 2014 19:18:25 UTC Commit: fec15c61c4a8e5c1f8054b17d21a599790ed1b5c https://github.com/geany/geany/commit/fec15c61c4a8e5c1f8054b17d21a599790ed1b...
Log Message: ----------- Move typedefs out of geany.h and into their own headers
This helps to avoid the requirement that geany.h be included before using any of the changed headers.
Modified Paths: -------------- src/build.h src/dialogs.h src/document.h src/editor.h src/filetypes.h src/geany.h src/geanyobject.h src/highlighting.h src/notebook.h src/plugindata.h src/printing.h src/search.h src/sidebar.h src/symbols.h src/templates.h src/tools.h src/ui_utils.h
Modified: src/build.h 12 lines changed, 8 insertions(+), 4 deletions(-) =================================================================== @@ -26,6 +26,10 @@
G_BEGIN_DECLS
+/* Forward-declared to avoid including their headers here */ +struct GeanyDocument; +struct GeanyFiletype; + /* Order is important (see GBO_TO_GBG, GBO_TO_CMD below) */ /* * Geany Known Build Commands. * These commands are named after their default use. @@ -164,9 +168,9 @@ void build_init(void); void build_finalize(void);
/* menu configuration dialog functions */ -GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildTableData *data, GeanyFiletype *ft); +GtkWidget *build_commands_table(struct GeanyDocument *doc, GeanyBuildSource dst, BuildTableData *data, struct GeanyFiletype *ft);
-void build_read_project(GeanyFiletype *ft, BuildTableData build_properties); +void build_read_project(struct GeanyFiletype *ft, BuildTableData build_properties);
void build_free_fields(BuildTableData data);
@@ -175,7 +179,7 @@ gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
/* build menu functions */
-void build_menu_update(GeanyDocument *doc); +void build_menu_update(struct GeanyDocument *doc);
void build_toolbutton_build_clicked(GtkAction *action, gpointer user_data);
@@ -202,7 +206,7 @@ void build_set_group_count(GeanyBuildGroup grp, gint count);
guint build_get_group_count(const GeanyBuildGroup grp);
-gchar **build_get_regex(GeanyBuildGroup grp, GeanyFiletype *ft, guint *from); +gchar **build_get_regex(GeanyBuildGroup grp, struct GeanyFiletype *ft, guint *from);
G_END_DECLS
Modified: src/dialogs.h 7 lines changed, 5 insertions(+), 2 deletions(-) =================================================================== @@ -28,6 +28,9 @@ #ifndef GEANY_DIALOGS_H #define GEANY_DIALOGS_H 1
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument; + typedef void (*GeanyInputCallback)(const gchar *text);
@@ -35,7 +38,7 @@ void dialogs_show_open_file(void);
gboolean dialogs_show_save_as(void);
-gboolean dialogs_show_unsaved_file(GeanyDocument *doc); +gboolean dialogs_show_unsaved_file(struct GeanyDocument *doc);
void dialogs_show_open_font(void);
@@ -55,7 +58,7 @@ GtkWidget *dialogs_show_input_persistent(const gchar *title, GtkWindow *parent, gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text, gdouble *value, gdouble min, gdouble max, gdouble step);
-void dialogs_show_file_properties(GeanyDocument *doc); +void dialogs_show_file_properties(struct GeanyDocument *doc);
gboolean dialogs_show_question(const gchar *text, ...) G_GNUC_PRINTF (1, 2);
Modified: src/document.h 20 lines changed, 12 insertions(+), 8 deletions(-) =================================================================== @@ -36,6 +36,9 @@ G_BEGIN_DECLS #include "editor.h" #include "search.h"
+/* Forward-declared to avoid including filetypes.h here */ +struct GeanyFiletype; + #if defined(G_OS_WIN32) # define GEANY_DEFAULT_EOL_CHARACTER SC_EOL_CRLF #elif defined(G_OS_UNIX) @@ -75,7 +78,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; @@ -96,7 +99,7 @@ struct GeanyDocument struct 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; + struct GeanyFiletype *file_type; /** TMWorkObject object for this document, or @c NULL. */ TMWorkObject *tm_file; /** Whether this document is read-only. */ @@ -113,7 +116,8 @@ struct GeanyDocument gchar *real_path;
struct GeanyDocumentPrivate *priv; /* should be last, append fields before this item */ -}; +} +GeanyDocument;
extern GPtrArray *documents_array;
@@ -170,7 +174,7 @@ extern GPtrArray *documents_array;
/* 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); +GeanyDocument* document_new_file(const gchar *filename, struct GeanyFiletype *ft, const gchar *text);
GeanyDocument* document_new_file_if_non_open(void);
@@ -183,13 +187,13 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force); gboolean document_save_file_as(GeanyDocument *doc, const gchar *utf8_fname);
GeanyDocument* document_open_file(const gchar *locale_filename, gboolean readonly, - GeanyFiletype *ft, const gchar *forced_enc); + struct GeanyFiletype *ft, const gchar *forced_enc);
gboolean document_reload_file(GeanyDocument *doc, const gchar *forced_enc);
void document_set_text_changed(GeanyDocument *doc, gboolean changed);
-void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type); +void document_set_filetype(GeanyDocument *doc, struct GeanyFiletype *type);
void document_reload_config(GeanyDocument *doc);
@@ -222,11 +226,11 @@ gboolean document_account_for_unsaved(void); gboolean document_close_all(void);
GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename, gint pos, - gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc); + gboolean readonly, struct GeanyFiletype *ft, const gchar *forced_enc);
void document_open_file_list(const gchar *data, gsize length);
-void document_open_files(const GSList *filenames, gboolean readonly, GeanyFiletype *ft, +void document_open_files(const GSList *filenames, gboolean readonly, struct GeanyFiletype *ft, const gchar *forced_enc);
gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gint flags, gboolean inc,
Modified: src/editor.h 16 lines changed, 10 insertions(+), 6 deletions(-) =================================================================== @@ -23,11 +23,14 @@ #ifndef GEANY_EDITOR_H #define GEANY_EDITOR_H 1
-G_BEGIN_DECLS - #include "Scintilla.h" #include "ScintillaWidget.h"
+G_BEGIN_DECLS + +/* Forward-declared to avoid including document.h here */ +struct GeanyDocument; + /** Default character set to define which characters should be treated as part of a word. */ #define GEANY_WORDCHARS "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" #define GEANY_MAX_WORD_LENGTH 192 @@ -155,9 +158,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 +169,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 +186,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);
Modified: src/filetypes.h 15 lines changed, 9 insertions(+), 6 deletions(-) =================================================================== @@ -23,11 +23,13 @@ #ifndef GEANY_FILETYPES_H #define GEANY_FILETYPES_H 1
-G_BEGIN_DECLS - #include "Scintilla.h" #include "ScintillaWidget.h"
+G_BEGIN_DECLS + +/* Forward-declared to avoid including document.h here */ +struct GeanyDocument;
/* Do not change the order, only append. */ typedef enum @@ -114,7 +116,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 @@ -134,7 +136,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 */ @@ -143,7 +145,8 @@ struct GeanyFiletype gint indent_width;
struct GeanyFiletypePrivate *priv; /* must be last, append fields before this item */ -}; +} +GeanyFiletype;
extern GPtrArray *filetypes_array;
@@ -175,7 +178,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);
Modified: src/geany.h 7 lines changed, 0 insertions(+), 7 deletions(-) =================================================================== @@ -58,13 +58,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 {
Modified: src/geanyobject.h 25 lines changed, 15 insertions(+), 10 deletions(-) =================================================================== @@ -27,6 +27,11 @@
G_BEGIN_DECLS
+/* Forward-declared to avoid including their headers here */ +struct GeanyDocument; +struct GeanyEditor; +struct GeanyFiletype; + typedef enum { GCB_DOCUMENT_NEW, @@ -79,22 +84,22 @@ struct _GeanyObjectClass { GObjectClass parent_class;
- void (*document_new)(GeanyDocument *doc); - void (*document_open)(GeanyDocument *doc); - void (*document_reload)(GeanyDocument *doc); - void (*document_before_save)(GeanyDocument *doc); - void (*document_save)(GeanyDocument *doc); - void (*document_filetype_set)(GeanyDocument *doc, GeanyFiletype *filetype_old); - void (*document_activate)(GeanyDocument *doc); - void (*document_close)(GeanyDocument *doc); + void (*document_new)(struct GeanyDocument *doc); + void (*document_open)(struct GeanyDocument *doc); + void (*document_reload)(struct GeanyDocument *doc); + void (*document_before_save)(struct GeanyDocument *doc); + void (*document_save)(struct GeanyDocument *doc); + void (*document_filetype_set)(struct GeanyDocument *doc, struct GeanyFiletype *filetype_old); + void (*document_activate)(struct GeanyDocument *doc); + void (*document_close)(struct GeanyDocument *doc); void (*project_open)(GKeyFile *keyfile); void (*project_save)(GKeyFile *keyfile); void (*project_close)(void); void (*project_dialog_open)(GtkWidget *notebook); void (*project_dialog_confirmed)(GtkWidget *notebook); void (*project_dialog_close)(GtkWidget *notebook); - void (*update_editor_menu)(const gchar *word, gint click_pos, GeanyDocument *doc); - gboolean (*editor_notify)(GeanyEditor *editor, gpointer scnt); + void (*update_editor_menu)(const gchar *word, gint click_pos, struct GeanyDocument *doc); + gboolean (*editor_notify)(struct GeanyEditor *editor, gpointer scnt); void (*geany_startup_complete)(void); void (*build_start)(void); void (*save_settings)(GKeyFile *keyfile);
Modified: src/highlighting.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -28,6 +28,8 @@ G_BEGIN_DECLS #include "Scintilla.h" #include "ScintillaWidget.h"
+/* Forward-declared to avoid including filetypes.h here */ +struct GeanyFiletype;
/** Fields representing the different attributes of a Scintilla lexer style. * @see Scintilla messages @c SCI_STYLEGETFORE, etc, for use with scintilla_send_message(). */ @@ -43,7 +45,7 @@ GeanyLexerStyle;
void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *configh);
-void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft); +void highlighting_set_styles(ScintillaObject *sci, struct GeanyFiletype *ft);
const GeanyLexerStyle *highlighting_get_style(gint ft_id, gint style_id);
Modified: src/notebook.h 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -22,12 +22,15 @@ #ifndef GEANY_NOTEBOOK_H #define GEANY_NOTEBOOK_H 1
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument; + void notebook_init(void);
void notebook_free(void);
/* Returns page number of notebook page, or -1 on error */ -gint notebook_new_tab(GeanyDocument *doc); +gint notebook_new_tab(struct GeanyDocument *doc);
/* Always use this instead of gtk_notebook_remove_page(). */ void notebook_remove_page(gint page_num);
Modified: src/plugindata.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -39,8 +39,10 @@ G_BEGIN_DECLS #undef GEANY #define GEANY(symbol_name) geany->symbol_name
-#include "editor.h" /* GeanyIndentType */ #include "build.h" /* GeanyBuildGroup, GeanyBuildSource, GeanyBuildCmdEntries enums */ +#include "document.h" /* GeanyDocument */ +#include "editor.h" /* GeanyEditor, GeanyIndentType */ +#include "filetypes.h" /* GeanyFiletype */ #include "gtkcompat.h"
Modified: src/printing.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -23,6 +23,8 @@ #ifndef GEANY_PRINTING_H #define GEANY_PRINTING_H 1
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument;
/* General printing preferences. */ typedef struct PrintingPrefs @@ -41,6 +43,6 @@ extern PrintingPrefs printing_prefs;
void printing_page_setup_gtk(void);
-void printing_print_doc(GeanyDocument *doc); +void printing_print_doc(struct GeanyDocument *doc);
#endif
Modified: src/search.h 7 lines changed, 5 insertions(+), 2 deletions(-) =================================================================== @@ -30,6 +30,9 @@
G_BEGIN_DECLS
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument; + /* the flags given in the search dialog for "find next", also used by the search bar */ typedef struct GeanySearchData { @@ -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);
Modified: src/sidebar.h 12 lines changed, 7 insertions(+), 5 deletions(-) =================================================================== @@ -24,6 +24,8 @@ #ifndef GEANY_SIDEBAR_H #define GEANY_SIDEBAR_H 1
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument;
typedef struct SidebarTreeviews { @@ -48,17 +50,17 @@ void sidebar_init(void);
void sidebar_finalize(void);
-void sidebar_update_tag_list(GeanyDocument *doc, gboolean update); +void sidebar_update_tag_list(struct GeanyDocument *doc, gboolean update);
-void sidebar_openfiles_add(GeanyDocument *doc); +void sidebar_openfiles_add(struct GeanyDocument *doc);
-void sidebar_openfiles_update(GeanyDocument *doc); +void sidebar_openfiles_update(struct GeanyDocument *doc);
void sidebar_openfiles_update_all(void);
-void sidebar_select_openfiles_item(GeanyDocument *doc); +void sidebar_select_openfiles_item(struct GeanyDocument *doc);
-void sidebar_remove_document(GeanyDocument *doc); +void sidebar_remove_document(struct GeanyDocument *doc);
void sidebar_add_common_menu_items(GtkMenu *menu);
Modified: src/symbols.h 11 lines changed, 7 insertions(+), 4 deletions(-) =================================================================== @@ -23,6 +23,9 @@ #ifndef GEANY_SYMBOLS_H #define GEANY_SYMBOLS_H 1
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument; + extern const guint TM_GLOBAL_TYPE_MASK;
enum @@ -45,13 +48,13 @@ GString *symbols_find_tags_as_string(GPtrArray *tags_array, guint tag_types, gin
const gchar *symbols_get_context_separator(gint ft_id);
-const GList *symbols_get_tag_list(GeanyDocument *doc, guint tag_types); +const GList *symbols_get_tag_list(struct GeanyDocument *doc, guint tag_types);
GString *symbols_get_macro_list(gint lang);
const gchar **symbols_get_html_entities(void);
-gboolean symbols_recreate_tag_list(GeanyDocument *doc, gint sort_mode); +gboolean symbols_recreate_tag_list(struct GeanyDocument *doc, gint sort_mode);
gint symbols_generate_global_tags(gint argc, gchar **argv, gboolean want_preprocess);
@@ -59,8 +62,8 @@ void symbols_show_load_tags_dialog(void);
gboolean symbols_goto_tag(const gchar *name, gboolean definition);
-gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname); +gint symbols_get_current_function(struct GeanyDocument *doc, const gchar **tagname);
-gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname); +gint symbols_get_current_scope(struct GeanyDocument *doc, const gchar **tagname);
#endif
Modified: src/templates.h 12 lines changed, 8 insertions(+), 4 deletions(-) =================================================================== @@ -30,6 +30,10 @@
G_BEGIN_DECLS
+/* Forward-declared to avoid including their headers here */ +struct GeanyDocument; +struct GeanyFiletype; + #define GEANY_TEMPLATES_INDENT 3 #define GEANY_TEMPLATES_FORMAT_YEAR C_("DefaultYear", "%Y") #define GEANY_TEMPLATES_FORMAT_DATE C_("DefaultDate", "%Y-%m-%d") @@ -69,14 +73,14 @@ void templates_init(void);
gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname);
-gchar *templates_get_template_changelog(GeanyDocument *doc); +gchar *templates_get_template_changelog(struct GeanyDocument *doc);
-gchar *templates_get_template_function(GeanyDocument *doc, const gchar *func_name); +gchar *templates_get_template_function(struct GeanyDocument *doc, const gchar *func_name);
-gchar *templates_get_template_licence(GeanyDocument *doc, gint licence_type); +gchar *templates_get_template_licence(struct GeanyDocument *doc, gint licence_type);
void templates_replace_common(GString *tmpl, const gchar *fname, - GeanyFiletype *ft, const gchar *func_name); + struct GeanyFiletype *ft, const gchar *func_name);
void templates_replace_valist(GString *text, const gchar *first_wildcard, ...) G_GNUC_NULL_TERMINATED;
Modified: src/tools.h 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -23,9 +23,12 @@ #ifndef GEANY_TOOLS_H #define GEANY_TOOLS_H 1
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument; + void tools_create_insert_custom_command_menu_items(void);
-void tools_execute_custom_command(GeanyDocument *doc, const gchar *command); +void tools_execute_custom_command(struct GeanyDocument *doc, const gchar *command);
void tools_word_count(void);
Modified: src/ui_utils.h 24 lines changed, 13 insertions(+), 11 deletions(-) =================================================================== @@ -27,6 +27,8 @@
G_BEGIN_DECLS
+/* Forward-declared to avoid including document.h here */ +struct GeanyDocument;
/** Sets a name to lookup @a widget from @a owner. * @param owner Usually a window, dialog or popup menu. @@ -253,34 +255,34 @@ void ui_init_stock_items(void); void ui_add_config_file_menu_item(const gchar *real_path, const gchar *label, GtkContainer *parent);
-void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback callback); +void ui_menu_add_document_items(GtkMenu *menu, struct GeanyDocument *active, GCallback callback);
-void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, +void ui_menu_add_document_items_sorted(GtkMenu *menu, struct GeanyDocument *active, GCallback callback, GCompareFunc sort_func);
void ui_set_statusbar(gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
-void ui_update_statusbar(GeanyDocument *doc, gint pos); +void ui_update_statusbar(struct GeanyDocument *doc, gint pos);
/* This sets the window title according to the current filename. */ -void ui_set_window_title(GeanyDocument *doc); +void ui_set_window_title(struct GeanyDocument *doc);
void ui_set_editor_font(const gchar *font_name);
void ui_set_fullscreen(void);
-void ui_update_popup_reundo_items(GeanyDocument *doc); +void ui_update_popup_reundo_items(struct GeanyDocument *doc);
-void ui_update_popup_copy_items(GeanyDocument *doc); +void ui_update_popup_copy_items(struct GeanyDocument *doc);
void ui_update_popup_goto_items(gboolean enable);
-void ui_update_menu_copy_items(GeanyDocument *doc); +void ui_update_menu_copy_items(struct GeanyDocument *doc);
-void ui_update_insert_include_item(GeanyDocument *doc, gint item); +void ui_update_insert_include_item(struct GeanyDocument *doc, gint item);
void ui_update_fold_items(void);
@@ -297,19 +299,19 @@ void ui_document_buttons_update(void);
void ui_sidebar_show_hide(void);
-void ui_document_show_hide(GeanyDocument *doc); +void ui_document_show_hide(struct GeanyDocument *doc);
void ui_set_search_entry_background(GtkWidget *widget, gboolean success);
void ui_create_recent_menus(void);
-void ui_add_recent_document(GeanyDocument *doc); +void ui_add_recent_document(struct GeanyDocument *doc);
void ui_add_recent_project_file(const gchar *utf8_filename);
-void ui_update_tab_status(GeanyDocument *doc); +void ui_update_tab_status(struct GeanyDocument *doc);
typedef gboolean TVMatchCallback(gboolean);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).