From a40ab0a4d9715b5f2c334f777e46ecb0fb6c5530 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 14:00:41 -0700 Subject: [PATCH 01/40] Explicitly list symbols to dynamically export Uses a Python script to generate a listing used by the linker to determine which symbols to dynamically export. This provides finer grained control of which symbols are dynamically exported, limiting only to the ones needed for GtkBuilder signal connections. The build system integration could probably be done a little cleaner. --- configure.ac | 2 +- scripts/dynamicsymbols.py | 73 +++++++++++++++++ src/Makefile.am | 11 ++- src/dynamicsymbols.list | 161 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 245 insertions(+), 2 deletions(-) create mode 100755 scripts/dynamicsymbols.py create mode 100644 src/dynamicsymbols.list diff --git a/configure.ac b/configure.ac index e3f6c510..8d8ee6b9 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ AM_CONDITIONAL([GTK3], [test "x$gtk_package" = "xgtk+-3.0"]) # GTK/GLib/GIO checks gtk_modules="$gtk_package >= $gtk_min_version glib-2.0 >= 2.20" -gtk_modules_private="gio-2.0 >= 2.20 gmodule-2.0" +gtk_modules_private="gio-2.0 >= 2.20 gmodule-no-export-2.0" PKG_CHECK_MODULES([GTK], [$gtk_modules $gtk_modules_private]) AC_SUBST([DEPENDENCIES], [$gtk_modules]) AC_SUBST([GTK_CFLAGS]) diff --git a/scripts/dynamicsymbols.py b/scripts/dynamicsymbols.py new file mode 100755 index 00000000..6a8b4fd9 --- /dev/null +++ b/scripts/dynamicsymbols.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +""" +Script to parse GtkBuilder XML file for signal handler references and list +them in a linker file for which symbols to dynamically export. +""" + +import optparse +import os +import re +import sys +from xml.etree import ElementTree as ET + +def find_handlers(xml_filename, excludes=[]): + def is_excluded(name, excludes): + for exclude in excludes: + m = re.match(exclude, name) + if m: + return True + return False + + tree = ET.parse(xml_filename) + root = tree.getroot() + handlers = [] + signals = root.findall(".//signal") + + for signal in signals: + handler = signal.attrib["handler"] + if not is_excluded(handler, excludes): + handlers.append(handler) + + return sorted(handlers) + +def write_dynamic_list(handlers, output_file): + output_file.write("""\ +/* This file was auto-generated by the `%s' script, do not edit. */ +{ +""" % os.path.basename(__file__)) + for handler in handlers: + output_file.write("\t%s;\n" % handler) + output_file.write("};\n") + +def main(args): + p = optparse.OptionParser(usage="%prog [-o FILE] XMLFILE") + p.add_option("-o", "--output", metavar="FILE", dest="output_file", + default="-", help="write the output to this file (default `-' for stdin)") + + opts, args = p.parse_args(args) + + output_file = None + try: + if opts.output_file == "-": + output_file = sys.stdout + else: + output_file = open(opts.output_file, 'w') + + args = args[1:] + if len(args) == 0: + p.error("invalid XMLFILE argument, expecting a filename, got none") + elif len(args) > 1: + p.error("too many XMLFILE arguments, expecting a single filename") + + handlers = find_handlers(args[0], ["gtk_.+"]) + write_dynamic_list(handlers, output_file) + + finally: + if output_file is not None and output_file is not sys.stdout: + output_file.close() + + return 0 + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/src/Makefile.am b/src/Makefile.am index 741f7622..34d6e623 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,8 @@ EXTRA_DIST = \ keybindingsprivate.h \ pluginprivate.h \ projectprivate.h \ - makefile.win32 + makefile.win32 \ + $(top_srcdir)/src/dynamicsymbols.list bin_PROGRAMS = geany @@ -146,6 +147,8 @@ geany_LDADD = \ $(MAC_INTEGRATION_LIBS) \ $(INTLLIBS) +geany_LDFLAGS = -Wl,--dynamic-list="$(srcdir)/dynamicsymbols.list" + AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGEANY_DOCDIR=\""$(docdir)"\" \ -DGEANY_LIBDIR=\""$(libdir)"\" \ @@ -157,5 +160,11 @@ AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ clean-local: +# Helper rule to rebuild the dynamicsymbols.list file when handlers are +# added to data/geany.glade. Run `make dynamic-symbols' from the src builddir. +$(top_srcdir)/src/dynamicsymbols.list: $(top_srcdir)/data/geany.glade + -python $(top_srcdir)/scripts/dynamicsymbols.py -o $@ $(top_srcdir)/data/geany.glade +dynamic-symbols: $(top_srcdir)/src/dynamicsymbols.list + endif diff --git a/src/dynamicsymbols.list b/src/dynamicsymbols.list new file mode 100644 index 00000000..d3117f0f --- /dev/null +++ b/src/dynamicsymbols.list @@ -0,0 +1,161 @@ +/* This file was auto-generated by the `dynamicsymbols.py' script, do not edit. */ +{ + on_button_customize_toolbar_clicked; + on_change_font1_activate; + on_clone1_activate; + on_close1_activate; + on_close_all1_activate; + on_close_other_documents1_activate; + on_comments_bsd_activate; + on_comments_changelog_activate; + on_comments_changelog_activate; + on_comments_fileheader_activate; + on_comments_fileheader_activate; + on_comments_function_activate; + on_comments_function_activate; + on_comments_gpl_activate; + on_comments_multiline_activate; + on_context_action1_activate; + on_copy1_activate; + on_copy1_activate; + on_copy_current_lines1_activate; + on_count_words1_activate; + on_cr_activate; + on_crlf_activate; + on_customize_toolbar1_activate; + on_cut1_activate; + on_cut1_activate; + on_cut_current_lines1_activate; + on_debug_messages1_activate; + on_delete1_activate; + on_delete1_activate; + on_delete_current_lines1_activate; + on_detect_type_from_file_activate; + on_detect_width_from_file_activate; + on_duplicate_line_or_selection1_activate; + on_edit1_activate; + on_escape_key_press_event; + on_file1_activate; + on_file_properties_activate; + on_find1_activate; + on_find_document_usage1_activate; + on_find_document_usage1_activate; + on_find_in_files1_activate; + on_find_next1_activate; + on_find_nextsel1_activate; + on_find_previous1_activate; + on_find_prevsel1_activate; + on_find_usage1_activate; + on_find_usage1_activate; + on_fullscreen1_toggled; + on_go_to_line_activate; + on_go_to_next_marker1_activate; + on_go_to_previous_marker1_activate; + on_goto_tag_declaration1; + on_goto_tag_definition1; + on_goto_tag_definition1; + on_help1_activate; + on_help_menu_item_bug_report_activate; + on_help_menu_item_donate_activate; + on_help_menu_item_wiki_activate; + on_help_shortcuts1_activate; + on_hide_toolbar1_activate; + on_indent_width_activate; + on_indent_width_activate; + on_indent_width_activate; + on_indent_width_activate; + on_indent_width_activate; + on_indent_width_activate; + on_indent_width_activate; + on_indent_width_activate; + on_info1_activate; + on_insert_alternative_white_space1_activate; + on_insert_alternative_white_space1_activate; + on_lf_activate; + on_line_breaking1_activate; + on_line_wrapping1_toggled; + on_load_tags1_activate; + on_mark_all1_activate; + on_markers_margin1_toggled; + on_menu_color_schemes_activate; + on_menu_comment_line1_activate; + on_menu_comments_bsd_activate; + on_menu_comments_gpl_activate; + on_menu_comments_multiline_activate; + on_menu_decrease_indent1_activate; + on_menu_fold_all1_activate; + on_menu_increase_indent1_activate; + on_menu_open_selected_file1_activate; + on_menu_open_selected_file1_activate; + on_menu_project1_activate; + on_menu_reload_configuration1_activate; + on_menu_remove_indicators1_activate; + on_menu_select_all1_activate; + on_menu_select_all1_activate; + on_menu_show_indentation_guides1_toggled; + on_menu_show_line_endings1_toggled; + on_menu_show_sidebar1_toggled; + on_menu_show_white_space1_toggled; + on_menu_toggle_all_additional_widgets1_activate; + on_menu_toggle_line_commentation1_activate; + on_menu_uncomment_line1_activate; + on_menu_unfold_all1_activate; + on_menu_write_unicode_bom1_toggled; + on_motion_event; + on_move_lines_down1_activate; + on_move_lines_up1_activate; + on_new1_activate; + on_next_message1_activate; + on_normal_size1_activate; + on_notebook1_switch_page_after; + on_open1_activate; + on_page_setup1_activate; + on_paste1_activate; + on_paste1_activate; + on_plugin_preferences1_activate; + on_preferences1_activate; + on_previous_message1_activate; + on_print1_activate; + on_project_close1_activate; + on_project_new1_activate; + on_project_open1_activate; + on_project_properties1_activate; + on_quit1_activate; + on_redo1_activate; + on_redo1_activate; + on_reflow_lines_block1_activate; + on_remove_markers1_activate; + on_replace1_activate; + on_replace_spaces_activate; + on_replace_tabs_activate; + on_reset_indentation1_activate; + on_save1_activate; + on_save_all1_activate; + on_save_as1_activate; + on_search1_activate; + on_select_current_lines1_activate; + on_select_current_paragraph1_activate; + on_send_selection_to_vte1_activate; + on_set_file_readonly1_toggled; + on_show_color_chooser1_activate; + on_show_line_numbers1_toggled; + on_show_messages_window1_toggled; + on_show_toolbar1_toggled; + on_smart_line_indent1_activate; + on_spaces1_activate; + on_strip_trailing_spaces1_activate; + on_tabs1_activate; + on_tabs_and_spaces1_activate; + on_toggle_case1_activate; + on_toolbutton_reload_clicked; + on_tv_notebook_switch_page; + on_tv_notebook_switch_page_after; + on_undo1_activate; + on_undo1_activate; + on_use_auto_indentation1_toggled; + on_website1_activate; + on_window_delete_event; + on_window_state_event; + on_zoom_in1_activate; + on_zoom_out1_activate; +}; From 2f0867076368fdd0333cfe61805f4fdebce34fe9 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 16:36:36 -0700 Subject: [PATCH 02/40] Mark all plugin API functions to have "default" (public) visibility Adds a new header `pluginexport.h` to put the macros in, could be moved into an existing header (support.h?) by I didn't want to drag a bunch of existing stuff into the source files for this one macro. TagManager has relative include, this could be fixed by changing the include directories for it if it's a problem. Mark the Scintilla functions exported by re-declaring them in sciwrappers.c with the attribute to avoid changing upstream Scintilla code. --- src/Makefile.am | 2 +- src/build.c | 9 +++-- src/dialogs.c | 6 ++++ src/document.c | 25 +++++++++++++ src/editor.c | 16 +++++++++ src/encodings.c | 4 +++ src/filetypes.c | 6 ++++ src/highlighting.c | 6 ++++ src/keybindings.c | 5 +++ src/main.c | 4 +++ src/msgwindow.c | 7 ++++ src/navqueue.c | 2 ++ src/pluginexport.h | 34 ++++++++++++++++++ src/pluginutils.c | 10 ++++++ src/sciwrappers.c | 62 +++++++++++++++++++++++++++++++++ src/search.c | 2 ++ src/stash.c | 21 +++++++++++ src/symbols.c | 2 ++ src/templates.c | 2 ++ src/ui_utils.c | 22 ++++++++++++ src/utils.c | 24 +++++++++++++ tagmanager/src/tm_source_file.c | 4 +++ tagmanager/src/tm_workspace.c | 5 +++ 23 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 src/pluginexport.h diff --git a/src/Makefile.am b/src/Makefile.am index 34d6e623..a34aadf3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,6 +40,7 @@ SRCS = \ navqueue.c navqueue.h \ notebook.c notebook.h \ osx.c osx.h \ + pluginexport.h \ plugins.c plugins.h \ pluginutils.c pluginutils.h \ prefix.c prefix.h \ @@ -167,4 +168,3 @@ $(top_srcdir)/src/dynamicsymbols.list: $(top_srcdir)/data/geany.glade dynamic-symbols: $(top_srcdir)/src/dynamicsymbols.list endif - diff --git a/src/build.c b/src/build.c index 542590f2..ed164872 100644 --- a/src/build.c +++ b/src/build.c @@ -41,6 +41,7 @@ #include "geanyobject.h" #include "keybindingsprivate.h" #include "msgwindow.h" +#include "pluginexport.h" #include "prefs.h" #include "projectprivate.h" #include "sciwrappers.h" @@ -509,6 +510,7 @@ static GeanyBuildCommand *get_build_group(const GeanyBuildSource src, const Gean * Updates the menu. * **/ +GEANY_API_SYMBOL void build_remove_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const gint cmd) { GeanyBuildCommand *bc; @@ -569,6 +571,7 @@ GeanyBuildCommand *build_get_menu_item(GeanyBuildSource src, GeanyBuildGroup grp * This is a pointer to an internal structure and must not be freed. * **/ +GEANY_API_SYMBOL const gchar *build_get_current_menu_item(const GeanyBuildGroup grp, const guint cmd, const GeanyBuildCmdEntries fld) { @@ -609,7 +612,7 @@ const gchar *build_get_current_menu_item(const GeanyBuildGroup grp, const guint * @param val the value to set the field to, is copied * **/ - +GEANY_API_SYMBOL void build_set_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const guint cmd, const GeanyBuildCmdEntries fld, const gchar *val) { @@ -654,7 +657,7 @@ void build_set_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, * @param cmd the index of the command within the group. * **/ - +GEANY_API_SYMBOL void build_activate_menu_item(const GeanyBuildGroup grp, const guint cmd) { on_build_menu_item(NULL, GRP_CMD_TO_POINTER(grp, cmd)); @@ -2782,7 +2785,7 @@ void build_set_group_count(GeanyBuildGroup grp, gint count) * @return a count of the number of commands in the group * **/ - +GEANY_API_SYMBOL guint build_get_group_count(const GeanyBuildGroup grp) { g_return_val_if_fail(grp < GEANY_GBG_COUNT, 0); diff --git a/src/dialogs.c b/src/dialogs.c index 55750c8a..544977dd 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -35,6 +35,7 @@ #include "encodings.h" #include "filetypes.h" #include "main.h" +#include "pluginexport.h" #include "support.h" #include "utils.h" #include "ui_utils.h" @@ -665,6 +666,7 @@ static gboolean show_save_as_gtk(GeanyDocument *doc) * * @return @c TRUE if the file was saved, otherwise @c FALSE. **/ +GEANY_API_SYMBOL gboolean dialogs_show_save_as(void) { GeanyDocument *doc = document_get_current(); @@ -726,6 +728,7 @@ static void show_msgbox_dialog(GtkWidget *dialog, GtkMessageType type, GtkWindow * @param text Printf()-style format string. * @param ... Arguments for the @a text format string. **/ +GEANY_API_SYMBOL void dialogs_show_msgbox(GtkMessageType type, const gchar *text, ...) { #ifndef G_OS_WIN32 @@ -1067,6 +1070,7 @@ static void on_dialog_input(const gchar *str, gpointer data) * @param default_text Text to display in the input field, or @c NULL. * @return New copy of user input or @c NULL if cancelled. * @since 0.20. */ +GEANY_API_SYMBOL gchar *dialogs_show_input(const gchar *title, GtkWindow *parent, const gchar *label_text, const gchar *default_text) { @@ -1107,6 +1111,7 @@ gchar *dialogs_show_input_goto_line(const gchar *title, GtkWindow *parent, const * * @since 0.16 **/ +GEANY_API_SYMBOL gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text, gdouble *value, gdouble min, gdouble max, gdouble step) { @@ -1372,6 +1377,7 @@ static gint show_prompt(GtkWidget *parent, * * @return @c TRUE if the user answered with Yes, otherwise @c FALSE. **/ +GEANY_API_SYMBOL gboolean dialogs_show_question(const gchar *text, ...) { gchar *string; diff --git a/src/document.c b/src/document.c index 8a57d93b..cdf77e41 100644 --- a/src/document.c +++ b/src/document.c @@ -44,6 +44,7 @@ #include "msgwindow.h" #include "navqueue.h" #include "notebook.h" +#include "pluginexport.h" #include "project.h" #include "sciwrappers.h" #include "sidebar.h" @@ -148,6 +149,7 @@ static GtkWidget* document_show_message(GeanyDocument *doc, GtkMessageType msgty * * @since 0.15 **/ +GEANY_API_SYMBOL GeanyDocument* document_find_by_real_path(const gchar *realname) { guint i; @@ -193,6 +195,7 @@ static gchar *get_real_path_from_utf8(const gchar *utf8_filename) * @return The matching document, or @c NULL. * @see document_find_by_real_path(). **/ +GEANY_API_SYMBOL GeanyDocument *document_find_by_filename(const gchar *utf8_filename) { guint i; @@ -256,6 +259,7 @@ GeanyDocument *document_find_by_sci(ScintillaObject *sci) * gboolean still_open = (doc != NULL); * @endcode * @since 1.25. */ +GEANY_API_SYMBOL GeanyDocument *document_find_by_id(guint id) { guint i; @@ -297,6 +301,7 @@ static GtkWidget *document_get_notebook_child(GeanyDocument *doc) * @param doc The document. * @return The index. * @since 0.19 */ +GEANY_API_SYMBOL gint document_get_notebook_page(GeanyDocument *doc) { GtkWidget *child = document_get_notebook_child(doc); @@ -359,6 +364,7 @@ GeanyDocument *document_get_from_notebook_child(GtkWidget *page) * * @return The corresponding document for the given notebook page, or @c NULL. **/ +GEANY_API_SYMBOL GeanyDocument *document_get_from_page(guint page_num) { GtkWidget *parent; @@ -377,6 +383,7 @@ GeanyDocument *document_get_from_page(guint page_num) * * @return A pointer to the current document or @c NULL if there are no opened documents. **/ +GEANY_API_SYMBOL GeanyDocument *document_get_current(void) { gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook)); @@ -417,6 +424,7 @@ void document_finalize(void) * @since 0.17 */ /* TODO make more use of this */ +GEANY_API_SYMBOL gchar *document_get_basename_for_display(GeanyDocument *doc, gint length) { gchar *base_name, *short_name; @@ -464,6 +472,7 @@ void document_update_tab_label(GeanyDocument *doc) * @param doc The document to use. * @param changed Whether the document state should indicate changes have been made. **/ +GEANY_API_SYMBOL void document_set_text_changed(GeanyDocument *doc, gboolean changed) { g_return_if_fail(doc != NULL); @@ -687,6 +696,7 @@ static GeanyDocument *document_create(const gchar *utf8_filename) * * @since 0.15 **/ +GEANY_API_SYMBOL gboolean document_close(GeanyDocument *doc) { g_return_val_if_fail(doc, FALSE); @@ -776,6 +786,7 @@ static gboolean remove_page(guint page_num) * * @return @c TRUE if the document was actually removed or @c FALSE otherwise. **/ +GEANY_API_SYMBOL gboolean document_remove_page(guint page_num) { gboolean done = remove_page(page_num); @@ -817,6 +828,7 @@ GeanyDocument *document_new_file_if_non_open(void) * * @return The new document. **/ +GEANY_API_SYMBOL GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft, const gchar *text) { GeanyDocument *doc; @@ -900,6 +912,7 @@ GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft, * * @return The document opened or @c NULL. **/ +GEANY_API_SYMBOL GeanyDocument *document_open_file(const gchar *locale_filename, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc) { @@ -1495,6 +1508,7 @@ void document_open_file_list(const gchar *data, gsize length) * @param ft The filetype for the document or @c NULL to auto-detect the filetype. * @param forced_enc The file encoding to use or @c NULL to auto-detect the file encoding. **/ +GEANY_API_SYMBOL void document_open_files(const GSList *filenames, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc) { @@ -1516,6 +1530,7 @@ void document_open_files(const GSList *filenames, gboolean readonly, GeanyFilety * * @return @c TRUE if the document was actually reloaded or @c FALSE otherwise. **/ +GEANY_API_SYMBOL gboolean document_reload_force(GeanyDocument *doc, const gchar *forced_enc) { gint pos = 0; @@ -1661,6 +1676,7 @@ static void replace_header_filename(GeanyDocument *doc) * * @since 0.16 **/ +GEANY_API_SYMBOL void document_rename_file(GeanyDocument *doc, const gchar *new_filename) { gchar *old_locale_filename = utils_get_locale_from_utf8(doc->file_name); @@ -1726,6 +1742,7 @@ gboolean document_need_save_as(GeanyDocument *doc) * * @since 0.16 **/ +GEANY_API_SYMBOL gboolean document_save_file_as(GeanyDocument *doc, const gchar *utf8_fname) { gboolean ret; @@ -2013,6 +2030,7 @@ static gboolean save_file_handle_infobars(GeanyDocument *doc, gboolean force) * * @return @c TRUE if the file was saved or @c FALSE if the file could not or should not be saved. **/ +GEANY_API_SYMBOL gboolean document_save_file(GeanyDocument *doc, gboolean force) { gchar *errmsg; @@ -2726,6 +2744,7 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type, /** Sets the filetype of the document (which controls syntax highlighting and tags) * @param doc The document to use. * @param type The filetype. */ +GEANY_API_SYMBOL void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type) { gboolean ft_changed; @@ -2778,6 +2797,7 @@ void document_reload_config(GeanyDocument *doc) * @param doc The document to use. * @param new_encoding The encoding to be set for the document. **/ +GEANY_API_SYMBOL void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding) { if (doc == NULL || new_encoding == NULL || @@ -3141,6 +3161,7 @@ const gchar *document_get_status_widget_class(GeanyDocument *doc) * * @since 0.16 */ +GEANY_API_SYMBOL const GdkColor *document_get_status_color(GeanyDocument *doc) { gint status; @@ -3192,6 +3213,7 @@ const GdkColor *document_get_status_color(GeanyDocument *doc) * * @since 0.16 */ +GEANY_API_SYMBOL GeanyDocument *document_index(gint idx) { return (idx >= 0 && idx < (gint) documents_array->len) ? documents[idx] : NULL; @@ -3633,6 +3655,7 @@ gboolean document_check_disk_status(GeanyDocument *doc, gboolean force) * * @since 0.21 */ +GEANY_API_SYMBOL gint document_compare_by_display_name(gconstpointer a, gconstpointer b) { GeanyDocument *doc_a = *((GeanyDocument**) a); @@ -3662,6 +3685,7 @@ gint document_compare_by_display_name(gconstpointer a, gconstpointer b) * * @since 0.21 (GEANY_API_VERSION 209) */ +GEANY_API_SYMBOL gint document_compare_by_tab_order(gconstpointer a, gconstpointer b) { GeanyDocument *doc_a = *((GeanyDocument**) a); @@ -3691,6 +3715,7 @@ gint document_compare_by_tab_order(gconstpointer a, gconstpointer b) * * @since 0.21 (GEANY_API_VERSION 209) */ +GEANY_API_SYMBOL gint document_compare_by_tab_order_reverse(gconstpointer a, gconstpointer b) { return -1 * document_compare_by_tab_order(a, b); diff --git a/src/editor.c b/src/editor.c index fc04ac6b..63ca8e93 100644 --- a/src/editor.c +++ b/src/editor.c @@ -48,6 +48,7 @@ #include "highlighting.h" #include "keybindings.h" #include "main.h" +#include "pluginexport.h" #include "prefs.h" #include "projectprivate.h" #include "sciwrappers.h" @@ -1202,6 +1203,7 @@ get_default_indent_prefs(void) * settings may have changed, or if this function has been called for a different editor. * @param editor The editor, or @c NULL to get the default indent prefs. * @return The indent prefs. */ +GEANY_API_SYMBOL const GeanyIndentPrefs * editor_get_indent_prefs(GeanyEditor *editor) { @@ -1725,6 +1727,7 @@ void editor_find_current_word_sciwc(GeanyEditor *editor, gint pos, gchar *word, * * @since 0.16 */ +GEANY_API_SYMBOL gchar *editor_get_word_at_pos(GeanyEditor *editor, gint pos, const gchar *wordchars) { static gchar cword[GEANY_MAX_WORD_LENGTH]; @@ -2342,6 +2345,7 @@ static void fix_indentation(GeanyEditor *editor, GString *buf) * @warning Make sure all \\t tab chars in @a text are intended as indent widths or alignment, * not hard tabs, as those won't be preserved. * @note This doesn't scroll the cursor in view afterwards. **/ +GEANY_API_SYMBOL void editor_insert_text_block(GeanyEditor *editor, const gchar *text, gint insert_pos, gint cursor_index, gint newline_indent_size, gboolean replace_newlines) { @@ -4061,6 +4065,7 @@ void editor_indicator_clear_errors(GeanyEditor *editor) * * @since 0.16 */ +GEANY_API_SYMBOL void editor_indicator_clear(GeanyEditor *editor, gint indic) { glong last_pos; @@ -4086,6 +4091,7 @@ void editor_indicator_clear(GeanyEditor *editor, gint indic) * * @since 0.16 */ +GEANY_API_SYMBOL void editor_indicator_set_on_line(GeanyEditor *editor, gint indic, gint line) { gint start, end; @@ -4135,6 +4141,7 @@ void editor_indicator_set_on_line(GeanyEditor *editor, gint indic, gint line) * * @since 0.16 */ +GEANY_API_SYMBOL void editor_indicator_set_on_range(GeanyEditor *editor, gint indic, gint start, gint end) { g_return_if_fail(editor != NULL); @@ -4188,6 +4195,7 @@ void editor_insert_color(GeanyEditor *editor, const gchar *colour) * * @since 0.20 */ +GEANY_API_SYMBOL gint editor_get_eol_char_mode(GeanyEditor *editor) { gint mode = file_prefs.default_eol_character; @@ -4209,6 +4217,7 @@ gint editor_get_eol_char_mode(GeanyEditor *editor) * * @since 0.19 */ +GEANY_API_SYMBOL const gchar *editor_get_eol_char_name(GeanyEditor *editor) { gint mode = file_prefs.default_eol_character; @@ -4230,6 +4239,7 @@ const gchar *editor_get_eol_char_name(GeanyEditor *editor) * * @since 0.19 */ +GEANY_API_SYMBOL gint editor_get_eol_char_len(GeanyEditor *editor) { gint mode = file_prefs.default_eol_character; @@ -4255,6 +4265,7 @@ gint editor_get_eol_char_len(GeanyEditor *editor) * * @since 0.19 */ +GEANY_API_SYMBOL const gchar *editor_get_eol_char(GeanyEditor *editor) { gint mode = file_prefs.default_eol_character; @@ -4489,6 +4500,7 @@ void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap) * * @since 0.16 */ +GEANY_API_SYMBOL void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type) { editor_set_indent(editor, type, editor->indent_width); @@ -4564,6 +4576,7 @@ gboolean editor_goto_line(GeanyEditor *editor, gint line_no, gint offset) * * @since 0.20 **/ +GEANY_API_SYMBOL gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark) { g_return_val_if_fail(editor, FALSE); @@ -4808,6 +4821,7 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor) * * @since 0.15 **/ +GEANY_API_SYMBOL ScintillaObject *editor_create_widget(GeanyEditor *editor) { const GeanyIndentPrefs *iprefs = get_default_indent_prefs(); @@ -5137,6 +5151,7 @@ void editor_indent(GeanyEditor *editor, gboolean increase) * @param snippet_name Snippet name. * @return snippet or @c NULL if it was not found. Must not be freed. */ +GEANY_API_SYMBOL const gchar *editor_find_snippet(GeanyEditor *editor, const gchar *snippet_name) { const gchar *subhash_name = editor ? editor->document->file_type->name : "Default"; @@ -5153,6 +5168,7 @@ const gchar *editor_find_snippet(GeanyEditor *editor, const gchar *snippet_name) * @param pos . * @param snippet . */ +GEANY_API_SYMBOL void editor_insert_snippet(GeanyEditor *editor, gint pos, const gchar *snippet) { GString *pattern; diff --git a/src/encodings.c b/src/encodings.c index 4bc2a9ac..07204b1c 100644 --- a/src/encodings.c +++ b/src/encodings.c @@ -39,6 +39,7 @@ #include "app.h" #include "callbacks.h" #include "documentprivate.h" +#include "pluginexport.h" #include "support.h" #include "ui_utils.h" #include "utils.h" @@ -263,6 +264,7 @@ const GeanyEncoding *encodings_get_from_index(gint idx) * * @since 0.13 **/ +GEANY_API_SYMBOL const gchar* encodings_get_charset_from_index(gint idx) { g_return_val_if_fail(idx >= 0 && idx < GEANY_ENCODINGS_MAX, NULL); @@ -639,6 +641,7 @@ void encodings_encoding_store_cell_data_func(GtkCellLayout *cell_layout, * @return If the conversion was successful, a newly allocated nul-terminated string, * which must be freed with @c g_free(). Otherwise @c NULL. **/ +GEANY_API_SYMBOL gchar *encodings_convert_to_utf8_from_charset(const gchar *buffer, gssize size, const gchar *charset, gboolean fast) { @@ -797,6 +800,7 @@ static gchar *encodings_convert_to_utf8_with_suggestion(const gchar *buffer, gss * @return If the conversion was successful, a newly allocated nul-terminated string, * which must be freed with @c g_free(). Otherwise @c NULL. **/ +GEANY_API_SYMBOL gchar *encodings_convert_to_utf8(const gchar *buffer, gssize size, gchar **used_encoding) { gchar *regex_charset; diff --git a/src/filetypes.c b/src/filetypes.c index 626bb5f4..abc5df45 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -40,6 +40,7 @@ #include "geany.h" #include "geanyobject.h" #include "highlighting.h" +#include "pluginexport.h" #include "projectprivate.h" #include "sciwrappers.h" #include "support.h" @@ -234,6 +235,7 @@ static gint cmp_filetype(gconstpointer pft1, gconstpointer pft2, gpointer data) * The list does not change on subsequent calls. * @return The list - do not free. * @see filetypes_by_title. */ +GEANY_API_SYMBOL const GSList *filetypes_get_sorted_by_name(void) { static GSList *list = NULL; @@ -733,6 +735,7 @@ GeanyFiletype *filetypes_detect_from_document(GeanyDocument *doc) * @return The detected filetype for @a utf8_filename or @c filetypes[GEANY_FILETYPES_NONE] * if it could not be detected. **/ +GEANY_API_SYMBOL GeanyFiletype *filetypes_detect_from_file(const gchar *utf8_filename) { gchar line[1024]; @@ -1215,6 +1218,7 @@ gboolean filetype_has_tags(GeanyFiletype *ft) * * @since 0.15 **/ +GEANY_API_SYMBOL GeanyFiletype *filetypes_lookup_by_name(const gchar *name) { GeanyFiletype *ft; @@ -1460,6 +1464,7 @@ void filetypes_reload_extensions(void) * * @since 0.16 */ +GEANY_API_SYMBOL GeanyFiletype *filetypes_index(gint idx) { return (idx >= 0 && idx < (gint) filetypes_array->len) ? filetypes[idx] : NULL; @@ -1497,6 +1502,7 @@ void filetypes_reload(void) * @param ft . * @return . * @since Geany 0.20 */ +GEANY_API_SYMBOL const gchar *filetypes_get_display_name(GeanyFiletype *ft) { return ft->id == GEANY_FILETYPES_NONE ? _("None") : ft->name; diff --git a/src/highlighting.c b/src/highlighting.c index bbaf9b6f..9f46de3a 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -37,6 +37,7 @@ #include "document.h" #include "editor.h" #include "filetypesprivate.h" +#include "pluginexport.h" #include "sciwrappers.h" #include "support.h" #include "symbols.h" @@ -1071,6 +1072,7 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co /** Sets up highlighting and other visual settings. * @param sci Scintilla widget. * @param ft Filetype settings to use. */ +GEANY_API_SYMBOL void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) { guint lexer_id = get_lexer_filetype(ft); @@ -1159,6 +1161,7 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) * @param style_id A Scintilla lexer style, e.g. @c SCE_DIFF_ADDED. See scintilla/include/SciLexer.h. * @return A pointer to the style struct. * @see Scintilla messages @c SCI_STYLEGETFORE, etc, for use with scintilla_send_message(). */ +GEANY_API_SYMBOL const GeanyLexerStyle *highlighting_get_style(gint ft_id, gint style_id) { g_return_val_if_fail(ft_id >= 0 && (guint) ft_id < filetypes_array->len, NULL); @@ -1381,6 +1384,7 @@ void highlighting_show_color_scheme_dialog(void) * * @return @c TRUE if the style is a string, @c FALSE otherwise. */ +GEANY_API_SYMBOL gboolean highlighting_is_string_style(gint lexer, gint style) { /* Don't forget STRINGEOL, to prevent completion whilst typing a string with no closing char. */ @@ -1567,6 +1571,7 @@ gboolean highlighting_is_string_style(gint lexer, gint style) * * @return @c TRUE if the style is a comment, @c FALSE otherwise. */ +GEANY_API_SYMBOL gboolean highlighting_is_comment_style(gint lexer, gint style) { switch (lexer) @@ -1738,6 +1743,7 @@ gboolean highlighting_is_comment_style(gint lexer, gint style) * * @return @c TRUE if the style is code, @c FALSE otherwise. */ +GEANY_API_SYMBOL gboolean highlighting_is_code_style(gint lexer, gint style) { switch (lexer) diff --git a/src/keybindings.c b/src/keybindings.c index 071ac365..e71739e1 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -43,6 +43,7 @@ #include "msgwindow.h" #include "navqueue.h" #include "notebook.h" +#include "pluginexport.h" #include "prefs.h" #include "sciwrappers.h" #include "sidebar.h" @@ -119,6 +120,7 @@ static void add_popup_menu_accels(void); * @param mods GdkModifierType mask. * @return Significant modifiers from the mask. * @since 1.25. */ +GEANY_API_SYMBOL GdkModifierType keybindings_get_modifiers(GdkModifierType mods) { #ifdef __APPLE__ @@ -134,6 +136,7 @@ GdkModifierType keybindings_get_modifiers(GdkModifierType mods) * @param key_id Keybinding index for the group. * @return The keybinding. * @since 0.19. */ +GEANY_API_SYMBOL GeanyKeyBinding *keybindings_get_item(GeanyKeyGroup *group, gsize key_id) { if (group->plugin) @@ -163,6 +166,7 @@ GeanyKeyBinding *keybindings_get_item(GeanyKeyGroup *group, gsize key_id) * underscores - these won't be displayed. * @param menu_item Optional widget to set an accelerator for, or @c NULL. * @return The keybinding - normally this is ignored. */ +GEANY_API_SYMBOL GeanyKeyBinding *keybindings_set_item(GeanyKeyGroup *group, gsize key_id, GeanyKeyCallback callback, guint key, GdkModifierType mod, const gchar *kf_name, const gchar *label, GtkWidget *menu_item) @@ -1289,6 +1293,7 @@ GeanyKeyBinding *keybindings_lookup_item(guint group_id, guint key_id) * Example: @code keybindings_send_command(GEANY_KEY_GROUP_FILE, GEANY_KEYS_FILE_OPEN); @endcode * @param group_id @ref GeanyKeyGroupID keybinding group index that contains the @a key_id keybinding. * @param key_id @ref GeanyKeyBindingID keybinding index. */ +GEANY_API_SYMBOL void keybindings_send_command(guint group_id, guint key_id) { GeanyKeyBinding *kb; diff --git a/src/main.c b/src/main.c index fc9cd128..11370c7a 100644 --- a/src/main.c +++ b/src/main.c @@ -46,6 +46,7 @@ #include "msgwindow.h" #include "navqueue.h" #include "notebook.h" +#include "pluginexport.h" #include "plugins.h" #include "prefs.h" #include "printing.h" @@ -415,6 +416,7 @@ static void setup_paths(void) * * @since 0.19 **/ +GEANY_API_SYMBOL gboolean main_is_realized(void) { return main_status.main_window_realized; @@ -445,6 +447,7 @@ gboolean main_is_realized(void) * * @since 0.16 **/ +GEANY_API_SYMBOL void main_locale_init(const gchar *locale_dir, const gchar *package) { #ifdef HAVE_LOCALE_H @@ -1381,6 +1384,7 @@ gboolean main_quit(void) * * @since 0.15 **/ +GEANY_API_SYMBOL void main_reload_configuration(void) { /* reload templates */ diff --git a/src/msgwindow.c b/src/msgwindow.c index 21f66fc3..403b5470 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -40,6 +40,7 @@ #include "keybindings.h" #include "main.h" #include "navqueue.h" +#include "pluginexport.h" #include "prefs.h" #include "support.h" #include "ui_utils.h" @@ -104,6 +105,7 @@ void msgwin_show_hide_tabs(void) /** Sets the Messages path for opening any parsed filenames without absolute path * from message lines. * @param messages_dir The directory. **/ +GEANY_API_SYMBOL void msgwin_set_messages_dir(const gchar *messages_dir) { g_free(msgwindow.messages_dir); @@ -286,6 +288,7 @@ static const GdkColor *get_color(gint msg_color) * @param format @c printf()-style format string. * @param ... Arguments for the @c format string. **/ +GEANY_API_SYMBOL void msgwin_compiler_add(gint msg_color, const gchar *format, ...) { gchar *string; @@ -359,6 +362,7 @@ void msgwin_show_hide(gboolean show) * * @since 0.15 **/ +GEANY_API_SYMBOL void msgwin_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *format, ...) { gchar *string; @@ -417,6 +421,7 @@ void msgwin_msg_add_string(gint msg_color, gint line, GeanyDocument *doc, const * @param format @c printf()-style format string. * @param ... Arguments for the @c format string. **/ +GEANY_API_SYMBOL void msgwin_status_add(const gchar *format, ...) { GtkTreeIter iter; @@ -1199,6 +1204,7 @@ static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton * * * @since 0.15 **/ +GEANY_API_SYMBOL void msgwin_switch_tab(gint tabnum, gboolean show) { GtkWidget *widget = NULL; /* widget to focus */ @@ -1233,6 +1239,7 @@ void msgwin_switch_tab(gint tabnum, gboolean show) * * @since 0.15 **/ +GEANY_API_SYMBOL void msgwin_clear_tab(gint tabnum) { GtkListStore *store = NULL; diff --git a/src/navqueue.c b/src/navqueue.c index 26d3a2a7..d6ea01fe 100644 --- a/src/navqueue.c +++ b/src/navqueue.c @@ -32,6 +32,7 @@ #include "document.h" #include "geanyobject.h" +#include "pluginexport.h" #include "sciwrappers.h" #include "toolbar.h" #include "utils.h" @@ -149,6 +150,7 @@ static void add_new_position(const gchar *utf8_filename, gint pos) * * @return @c TRUE if the cursor has changed the position to @a line or @c FALSE otherwise. **/ +GEANY_API_SYMBOL gboolean navqueue_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint line) { gint pos; diff --git a/src/pluginexport.h b/src/pluginexport.h new file mode 100644 index 00000000..89fb137c --- /dev/null +++ b/src/pluginexport.h @@ -0,0 +1,34 @@ +/* + * pluginexport.h - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2014 Matthew Brush + * + * 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_PLUGINEXPORT_H +#define GEANY_PLUGINEXPORT_H 1 + +#if defined(_WIN32) || defined(__CYGWIN__) +# define GEANY_EXPORT_SYMBOL __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define GEANY_EXPORT_SYMBOL __attribute__((visibility ("default"))) +#else +# define GEANY_API_SYMBOL +#endif + +#define GEANY_API_SYMBOL GEANY_EXPORT_SYMBOL + +#endif /* GEANY_PLUGINEXPORT_H */ diff --git a/src/pluginutils.c b/src/pluginutils.c index 317aed60..09c38cb2 100644 --- a/src/pluginutils.c +++ b/src/pluginutils.c @@ -34,6 +34,7 @@ #include "app.h" #include "geanyobject.h" #include "plugindata.h" +#include "pluginexport.h" #include "pluginprivate.h" #include "plugins.h" #include "support.h" @@ -48,6 +49,7 @@ * @note You should still destroy @a item yourself, usually in @ref plugin_cleanup(). * @param plugin Must be @ref geany_plugin. * @param item The item to add. */ +GEANY_API_SYMBOL void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item) { GtkToolbar *toolbar = GTK_TOOLBAR(main_widgets.toolbar); @@ -91,6 +93,7 @@ void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item) * * @since 0.16 */ +GEANY_API_SYMBOL void plugin_module_make_resident(GeanyPlugin *plugin) { g_return_if_fail(plugin); @@ -126,6 +129,7 @@ void plugin_module_make_resident(GeanyPlugin *plugin) * @note Since version 1.25 (API >= 218), the object lifetime is watched and so the above * restriction does not apply. However, for objects destroyed by the plugin, * @c g_signal_connect() is safe and has lower overhead. */ +GEANY_API_SYMBOL void plugin_signal_connect(GeanyPlugin *plugin, GObject *object, const gchar *signal_name, gboolean after, GCallback callback, gpointer user_data) @@ -238,6 +242,7 @@ static guint plugin_source_add(GeanyPlugin *plugin, GSource *source, GSourceFunc * @see g_timeout_add() * @since 0.21, plugin API 205. */ +GEANY_API_SYMBOL guint plugin_timeout_add(GeanyPlugin *plugin, guint interval, GSourceFunc function, gpointer data) { return plugin_source_add(plugin, g_timeout_source_new(interval), function, data); @@ -257,6 +262,7 @@ guint plugin_timeout_add(GeanyPlugin *plugin, guint interval, GSourceFunc functi * @see g_timeout_add_seconds() * @since 0.21, plugin API 205. */ +GEANY_API_SYMBOL guint plugin_timeout_add_seconds(GeanyPlugin *plugin, guint interval, GSourceFunc function, gpointer data) { @@ -276,6 +282,7 @@ guint plugin_timeout_add_seconds(GeanyPlugin *plugin, guint interval, GSourceFun * @see g_idle_add() * @since 0.21, plugin API 205. */ +GEANY_API_SYMBOL guint plugin_idle_add(GeanyPlugin *plugin, GSourceFunc function, gpointer data) { return plugin_source_add(plugin, g_idle_source_new(), function, data); @@ -290,6 +297,7 @@ guint plugin_idle_add(GeanyPlugin *plugin, GSourceFunc function, gpointer data) * @param callback Group callback, or @c NULL if you only want individual keybinding callbacks. * @return The plugin's keybinding group. * @since 0.19. */ +GEANY_API_SYMBOL GeanyKeyGroup *plugin_set_key_group(GeanyPlugin *plugin, const gchar *section_name, gsize count, GeanyKeyGroupCallback callback) { @@ -402,6 +410,7 @@ static void configure_plugins(Plugin *current_plugin) * @param plugin Must be @ref geany_plugin. * @since 0.19. */ /* if NULL, show all plugins */ +GEANY_API_SYMBOL void plugin_show_configure(GeanyPlugin *plugin) { Plugin *p; @@ -489,6 +498,7 @@ static void connect_plugin_signals(GtkBuilder *builder, GObject *object, * * @since 1.24, plugin API 217. */ +GEANY_API_SYMBOL void plugin_builder_connect_signals(GeanyPlugin *plugin, GtkBuilder *builder, gpointer user_data) { diff --git a/src/sciwrappers.c b/src/sciwrappers.c index 95ed8b30..722f28ca 100644 --- a/src/sciwrappers.c +++ b/src/sciwrappers.c @@ -37,6 +37,7 @@ #include "sciwrappers.h" +#include "pluginexport.h" #include "utils.h" #include @@ -44,6 +45,15 @@ #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l) + +/* These functions need to be exported for the plugin API but to avoid + * modifying upstream sources, they are (re-)declared here with the + * needed export attribute. */ +GEANY_API_SYMBOL sptr_t scintilla_send_message(ScintillaObject *sci, + unsigned int iMessage, uptr_t wParam, sptr_t lParam); +GEANY_API_SYMBOL GtkWidget* scintilla_new(void); + + /* line numbers visibility */ void sci_set_line_numbers(ScintillaObject *sci, gboolean set) { @@ -181,6 +191,7 @@ void sci_add_text(ScintillaObject *sci, const gchar *text) /** Sets all text. * @param sci Scintilla widget. * @param text Text. */ +GEANY_API_SYMBOL void sci_set_text(ScintillaObject *sci, const gchar *text) { if( text != NULL ){ /* if null text is passed to scintilla will segfault */ @@ -218,6 +229,7 @@ void sci_redo(ScintillaObject *sci) /** Begins grouping a set of edits together as one Undo action. * You must call sci_end_undo_action() after making your edits. * @param sci Scintilla @c GtkWidget. */ +GEANY_API_SYMBOL void sci_start_undo_action(ScintillaObject *sci) { SSM(sci, SCI_BEGINUNDOACTION, 0, 0); @@ -227,6 +239,7 @@ void sci_start_undo_action(ScintillaObject *sci) /** Ends grouping a set of edits together as one Undo action. * @param sci Scintilla @c GtkWidget. * @see sci_start_undo_action(). */ +GEANY_API_SYMBOL void sci_end_undo_action(ScintillaObject *sci) { SSM(sci, SCI_ENDUNDOACTION, 0, 0); @@ -279,6 +292,7 @@ gint sci_get_zoom(ScintillaObject *sci) * @param sci Scintilla widget. * @param line_number Line number. * @param marker Marker number. */ +GEANY_API_SYMBOL void sci_set_marker_at_line(ScintillaObject *sci, gint line_number, gint marker) { SSM(sci, SCI_MARKERADD, (uptr_t) line_number, marker); @@ -289,6 +303,7 @@ void sci_set_marker_at_line(ScintillaObject *sci, gint line_number, gint marker) * @param sci Scintilla widget. * @param line_number Line number. * @param marker Marker number. */ +GEANY_API_SYMBOL void sci_delete_marker_at_line(ScintillaObject *sci, gint line_number, gint marker) { SSM(sci, SCI_MARKERDELETE, (uptr_t) line_number, marker); @@ -300,6 +315,7 @@ void sci_delete_marker_at_line(ScintillaObject *sci, gint line_number, gint mark * @param line Line number. * @param marker Marker number. * @return Whether it's set. */ +GEANY_API_SYMBOL gboolean sci_is_marker_set_at_line(ScintillaObject *sci, gint line, gint marker) { gint state; @@ -357,6 +373,7 @@ gint sci_marker_previous(ScintillaObject *sci, gint line, gint marker_mask, gboo * @param sci Scintilla widget. * @param position Position. * @return The line. */ +GEANY_API_SYMBOL gint sci_get_line_from_position(ScintillaObject *sci, gint position) { return (gint) SSM(sci, SCI_LINEFROMPOSITION, (uptr_t) position, 0); @@ -367,6 +384,7 @@ gint sci_get_line_from_position(ScintillaObject *sci, gint position) * @param sci Scintilla widget. * @param position Position. * @return The column. */ +GEANY_API_SYMBOL gint sci_get_col_from_position(ScintillaObject *sci, gint position) { return (gint) SSM(sci, SCI_GETCOLUMN, (uptr_t) position, 0); @@ -383,6 +401,7 @@ gint sci_get_position_from_col(ScintillaObject *sci, gint line, gint col) * @param sci Scintilla widget. * @param line Line. * @return Position. */ +GEANY_API_SYMBOL gint sci_get_position_from_line(ScintillaObject *sci, gint line) { return (gint) SSM(sci, SCI_POSITIONFROMLINE, (uptr_t) line, 0); @@ -392,6 +411,7 @@ gint sci_get_position_from_line(ScintillaObject *sci, gint line) /** Gets the cursor position. * @param sci Scintilla widget. * @return Position. */ +GEANY_API_SYMBOL gint sci_get_current_position(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETCURRENTPOS, 0, 0); @@ -413,6 +433,7 @@ gint sci_get_cursor_virtual_space(ScintillaObject *sci) * @param sci Scintilla widget. * @param position Position. * @param scroll_to_caret Whether to scroll the cursor in view. */ +GEANY_API_SYMBOL void sci_set_current_position(ScintillaObject *sci, gint position, gboolean scroll_to_caret) { if (scroll_to_caret) @@ -438,6 +459,7 @@ void sci_set_current_line(ScintillaObject *sci, gint line) /** Gets the total number of lines. * @param sci Scintilla widget. * @return The line count. */ +GEANY_API_SYMBOL gint sci_get_line_count(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETLINECOUNT, 0, 0); @@ -447,6 +469,7 @@ gint sci_get_line_count(ScintillaObject *sci) /** Sets the selection start position. * @param sci Scintilla widget. * @param position Position. */ +GEANY_API_SYMBOL void sci_set_selection_start(ScintillaObject *sci, gint position) { SSM(sci, SCI_SETSELECTIONSTART, (uptr_t) position, 0); @@ -456,6 +479,7 @@ void sci_set_selection_start(ScintillaObject *sci, gint position) /** Sets the selection end position. * @param sci Scintilla widget. * @param position Position. */ +GEANY_API_SYMBOL void sci_set_selection_end(ScintillaObject *sci, gint position) { SSM(sci, SCI_SETSELECTIONEND, (uptr_t) position, 0); @@ -472,6 +496,7 @@ void sci_set_selection(ScintillaObject *sci, gint anchorPos, gint currentPos) * @param sci Scintilla widget. * @param line Line. * @return The position at the end of the line. */ +GEANY_API_SYMBOL gint sci_get_line_end_position(ScintillaObject *sci, gint line) { return (gint) SSM(sci, SCI_GETLINEENDPOSITION, (uptr_t) line, 0); @@ -505,6 +530,7 @@ void sci_clear(ScintillaObject *sci) /** Gets the selection start position. * @param sci Scintilla widget. * @return Position. */ +GEANY_API_SYMBOL gint sci_get_selection_start(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETSELECTIONSTART, 0, 0); @@ -514,6 +540,7 @@ gint sci_get_selection_start(ScintillaObject *sci) /** Gets the selection end position. * @param sci Scintilla widget. * @return Position. */ +GEANY_API_SYMBOL gint sci_get_selection_end(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETSELECTIONEND, 0, 0); @@ -523,6 +550,7 @@ gint sci_get_selection_end(ScintillaObject *sci) /** Replaces selection. * @param sci Scintilla widget. * @param text Text. */ +GEANY_API_SYMBOL void sci_replace_sel(ScintillaObject *sci, const gchar *text) { SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text); @@ -532,6 +560,7 @@ void sci_replace_sel(ScintillaObject *sci, const gchar *text) /** Gets the length of all text. * @param sci Scintilla widget. * @return Length. */ +GEANY_API_SYMBOL gint sci_get_length(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETLENGTH, 0, 0); @@ -542,6 +571,7 @@ gint sci_get_length(ScintillaObject *sci) * @param sci Scintilla widget. * @returns The lexer ID */ +GEANY_API_SYMBOL gint sci_get_lexer(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETLEXER, 0, 0); @@ -563,6 +593,7 @@ void sci_set_lexer(ScintillaObject *sci, guint lexer_id) * @param sci Scintilla widget. * @param line Line number. * @return Length. */ +GEANY_API_SYMBOL gint sci_get_line_length(ScintillaObject *sci, gint line) { return (gint) SSM(sci, SCI_LINELENGTH, (uptr_t) line, 0); @@ -586,6 +617,7 @@ gchar *sci_get_string(ScintillaObject *sci, guint msg, gulong wParam) * @param sci Scintilla widget. * @param line_num Line number. * @return A @c NULL-terminated copy of the line text. */ +GEANY_API_SYMBOL gchar *sci_get_line(ScintillaObject *sci, gint line_num) { return sci_get_string(sci, SCI_GETLINE, (gulong) line_num); @@ -599,6 +631,7 @@ gchar *sci_get_line(ScintillaObject *sci, gint line_num) * @param sci Scintilla widget. * @param len Length of @a text buffer, usually sci_get_length() + 1. * @param text Text buffer; must be allocated @a len + 1 bytes for null-termination. */ +GEANY_API_SYMBOL void sci_get_text(ScintillaObject *sci, gint len, gchar *text) { SSM(sci, SCI_GETTEXT, (uptr_t) len, (sptr_t) text); @@ -614,6 +647,7 @@ void sci_get_text(ScintillaObject *sci, gint len, gchar *text) * * @since 1.23 (0.17) */ +GEANY_API_SYMBOL gchar *sci_get_contents(ScintillaObject *sci, gint buffer_len) { gchar *text; @@ -634,6 +668,7 @@ gchar *sci_get_contents(ScintillaObject *sci, gint buffer_len) * @param sci Scintilla widget. * @param text Text buffer; must be allocated sci_get_selected_text_length() + 1 bytes * for null-termination. */ +GEANY_API_SYMBOL void sci_get_selected_text(ScintillaObject *sci, gchar *text) { SSM(sci, SCI_GETSELTEXT, 0, (sptr_t) text); @@ -647,6 +682,7 @@ void sci_get_selected_text(ScintillaObject *sci, gchar *text) * * @since 0.17 */ +GEANY_API_SYMBOL gchar *sci_get_selection_contents(ScintillaObject *sci) { return sci_get_string(sci, SCI_GETSELTEXT, 0); @@ -656,6 +692,7 @@ gchar *sci_get_selection_contents(ScintillaObject *sci) /** Gets selected text length. * @param sci Scintilla widget. * @return Length. */ +GEANY_API_SYMBOL gint sci_get_selected_text_length(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETSELTEXT, 0, 0); @@ -673,6 +710,7 @@ gint sci_get_position_from_xy(ScintillaObject *sci, gint x, gint y, gboolean nea * @param sci Scintilla widget. * @param line Line number. * @return Whether @a line will be drawn on the screen. */ +GEANY_API_SYMBOL gboolean sci_get_line_is_visible(ScintillaObject *sci, gint line) { return SSM(sci, SCI_GETLINEVISIBLE, (uptr_t) line, 0) != FALSE; @@ -682,6 +720,7 @@ gboolean sci_get_line_is_visible(ScintillaObject *sci, gint line) /** Makes @a line visible (folding may have hidden it). * @param sci Scintilla widget. * @param line Line number. */ +GEANY_API_SYMBOL void sci_ensure_line_is_visible(ScintillaObject *sci, gint line) { SSM(sci, SCI_ENSUREVISIBLE, (uptr_t) line, 0); @@ -743,6 +782,7 @@ void sci_set_tab_width(ScintillaObject *sci, gint width) * * @since 0.15 **/ +GEANY_API_SYMBOL gint sci_get_tab_width(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETTABWIDTH, 0, 0); @@ -753,6 +793,7 @@ gint sci_get_tab_width(ScintillaObject *sci) * @param sci Scintilla widget. * @param pos Position. * @return Char. */ +GEANY_API_SYMBOL gchar sci_get_char_at(ScintillaObject *sci, gint pos) { return (gchar) SSM(sci, SCI_GETCHARAT, (uptr_t) pos, 0); @@ -783,6 +824,7 @@ void sci_use_popup(ScintillaObject *sci, gboolean enable) * * @since 0.15 **/ +GEANY_API_SYMBOL gboolean sci_has_selection(ScintillaObject *sci) { if (SSM(sci, SCI_GETSELECTIONEND, 0, 0) - SSM(sci, SCI_GETSELECTIONSTART, 0, 0)) @@ -817,6 +859,7 @@ void sci_set_anchor(ScintillaObject *sci, gint pos) /** Scrolls the cursor in view. * @param sci Scintilla widget. */ +GEANY_API_SYMBOL void sci_scroll_caret(ScintillaObject *sci) { SSM(sci, SCI_SCROLLCARET, 0, 0); @@ -862,6 +905,7 @@ gint sci_search_prev(ScintillaObject *sci, gint flags, const gchar *text) * The @c chrgText.cpMin and @c chrgText.cpMax members of @c TextToFind are filled in * with the start and end positions of the found text. */ +GEANY_API_SYMBOL gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf) { return (gint) SSM(sci, SCI_FINDTEXT, (uptr_t) flags, (sptr_t) ttf); @@ -873,6 +917,7 @@ gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf) * @param style The style. * @param font The font name. * @param size The font size. */ +GEANY_API_SYMBOL void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size) { SSM(sci, SCI_STYLESETFONT, (uptr_t) style, (sptr_t) font); @@ -887,6 +932,7 @@ void sci_set_font(ScintillaObject *sci, gint style, const gchar *font, gint size * @param line Line. * @param unfold Whether to unfold first. */ +GEANY_API_SYMBOL void sci_goto_line(ScintillaObject *sci, gint line, gboolean unfold) { if (unfold) SSM(sci, SCI_ENSUREVISIBLE, (uptr_t) line, 0); @@ -904,6 +950,7 @@ void sci_marker_delete_all(ScintillaObject *sci, gint marker) * @param sci Scintilla widget. * @param position Position. * @return Style ID. */ +GEANY_API_SYMBOL gint sci_get_style_at(ScintillaObject *sci, gint position) { return (gint) SSM(sci, SCI_GETSTYLEAT, (uptr_t) position, 0); @@ -937,6 +984,7 @@ void sci_clear_cmdkey(ScintillaObject *sci, gint key) * @param start Start. * @param end End. * @param text Text will be zero terminated and must be allocated (end - start + 1) bytes. */ +GEANY_API_SYMBOL void sci_get_text_range(ScintillaObject *sci, gint start, gint end, gchar *text) { struct Sci_TextRange tr; @@ -955,6 +1003,7 @@ void sci_get_text_range(ScintillaObject *sci, gint start, gint end, gchar *text) * * @since 0.17 */ +GEANY_API_SYMBOL gchar *sci_get_contents_range(ScintillaObject *sci, gint start, gint end) { gchar *text; @@ -983,6 +1032,7 @@ void sci_selection_duplicate(ScintillaObject *sci) * @param sci Scintilla widget. * @param pos Position, or -1 for current. * @param text Text. */ +GEANY_API_SYMBOL void sci_insert_text(ScintillaObject *sci, gint pos, const gchar *text) { SSM(sci, SCI_INSERTTEXT, (uptr_t) pos, (sptr_t) text); @@ -995,18 +1045,21 @@ void sci_target_from_selection(ScintillaObject *sci) } +GEANY_API_SYMBOL void sci_set_target_start(ScintillaObject *sci, gint start) { SSM(sci, SCI_SETTARGETSTART, (uptr_t) start, 0); } +GEANY_API_SYMBOL void sci_set_target_end(ScintillaObject *sci, gint end) { SSM(sci, SCI_SETTARGETEND, (uptr_t) end, 0); } +GEANY_API_SYMBOL gint sci_replace_target(ScintillaObject *sci, const gchar *text, gboolean regex) { return (gint) SSM(sci, (regex) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET, (uptr_t) -1, (sptr_t) text); @@ -1032,6 +1085,7 @@ void sci_set_readonly(ScintillaObject *sci, gboolean readonly) * * @since 0.16 */ +GEANY_API_SYMBOL void sci_send_command(ScintillaObject *sci, gint cmd) { SSM(sci, cmd, 0, 0); @@ -1041,6 +1095,7 @@ void sci_send_command(ScintillaObject *sci, gint cmd) /** Gets current line number. * @param sci Scintilla widget. * @return Line number. */ +GEANY_API_SYMBOL gint sci_get_current_line(ScintillaObject *sci) { return (gint) SSM(sci, SCI_LINEFROMPOSITION, (uptr_t) SSM(sci, SCI_GETCURRENTPOS, 0, 0), 0); @@ -1084,6 +1139,7 @@ gint sci_get_first_visible_line(ScintillaObject *sci) * * @since 0.16 */ +GEANY_API_SYMBOL void sci_indicator_set(ScintillaObject *sci, gint indic) { SSM(sci, SCI_SETINDICATORCURRENT, (uptr_t) indic, 0); @@ -1108,6 +1164,7 @@ void sci_indicator_fill(ScintillaObject *sci, gint pos, gint len) * * @since 0.16 */ +GEANY_API_SYMBOL void sci_indicator_clear(ScintillaObject *sci, gint pos, gint len) { SSM(sci, SCI_INDICATORCLEARRANGE, (uptr_t) pos, len); @@ -1139,6 +1196,7 @@ void sci_set_autoc_max_height(ScintillaObject *sci, gint val) * * @since 0.15 **/ +GEANY_API_SYMBOL gint sci_find_matching_brace(ScintillaObject *sci, gint pos) { return (gint) SSM(sci, SCI_BRACEMATCH, (uptr_t) pos, 0); @@ -1178,6 +1236,7 @@ gint sci_get_pos_at_line_sel_end(ScintillaObject *sci, gint line) /** Gets selection mode. * @param sci Scintilla widget. * @return Selection mode. */ +GEANY_API_SYMBOL gint sci_get_selection_mode(ScintillaObject *sci) { return (gint) SSM(sci, SCI_GETSELECTIONMODE, 0, 0); @@ -1187,6 +1246,7 @@ gint sci_get_selection_mode(ScintillaObject *sci) /** Sets selection mode. * @param sci Scintilla widget. * @param mode Mode. */ +GEANY_API_SYMBOL void sci_set_selection_mode(ScintillaObject *sci, gint mode) { SSM(sci, SCI_SETSELECTIONMODE, (uptr_t) mode, 0); @@ -1207,6 +1267,7 @@ void sci_set_scrollbar_mode(ScintillaObject *sci, gboolean visible) * * @since 0.19 */ +GEANY_API_SYMBOL void sci_set_line_indentation(ScintillaObject *sci, gint line, gint indent) { SSM(sci, SCI_SETLINEINDENTATION, (uptr_t) line, indent); @@ -1220,6 +1281,7 @@ void sci_set_line_indentation(ScintillaObject *sci, gint line, gint indent) * * @since 0.19 */ +GEANY_API_SYMBOL gint sci_get_line_indentation(ScintillaObject *sci, gint line) { return (gint) SSM(sci, SCI_GETLINEINDENTATION, (uptr_t) line, 0); diff --git a/src/search.c b/src/search.c index 2bdbe544..903735d4 100644 --- a/src/search.c +++ b/src/search.c @@ -35,6 +35,7 @@ #include "encodings.h" #include "keyfile.h" #include "msgwindow.h" +#include "pluginexport.h" #include "prefs.h" #include "sciwrappers.h" #include "stash.h" @@ -1034,6 +1035,7 @@ static void create_fif_dialog(void) * * @since 0.14, plugin API 53 */ +GEANY_API_SYMBOL void search_show_find_in_files_dialog(const gchar *dir) { search_show_find_in_files_dialog_full(NULL, dir); diff --git a/src/stash.c b/src/stash.c index 6e8f750e..a7628bd6 100644 --- a/src/stash.c +++ b/src/stash.c @@ -78,6 +78,7 @@ #include "stash.h" +#include "pluginexport.h" /* for GEANY_API_SYMBOL */ #include "support.h" /* only for _("text") */ #include "utils.h" /* only for foreach_*, utils_get_setting_*(). Stash should not depend on Geany. */ @@ -274,6 +275,7 @@ static void keyfile_action(SettingAction action, StashGroup *group, GKeyFile *ke * so that all Stash settings are initialized to defaults. * @param group . * @param keyfile Usually loaded from a configuration file first. */ +GEANY_API_SYMBOL void stash_group_load_from_key_file(StashGroup *group, GKeyFile *keyfile) { keyfile_action(SETTING_READ, group, keyfile); @@ -284,6 +286,7 @@ void stash_group_load_from_key_file(StashGroup *group, GKeyFile *keyfile) * @a keyfile is usually written to a configuration file afterwards. * @param group . * @param keyfile . */ +GEANY_API_SYMBOL void stash_group_save_to_key_file(StashGroup *group, GKeyFile *keyfile) { keyfile_action(SETTING_WRITE, group, keyfile); @@ -298,6 +301,7 @@ void stash_group_save_to_key_file(StashGroup *group, GKeyFile *keyfile) * @return @c TRUE if a key file could be loaded. * @see stash_group_load_from_key_file(). **/ +GEANY_API_SYMBOL gboolean stash_group_load_from_file(StashGroup *group, const gchar *filename) { GKeyFile *keyfile; @@ -322,6 +326,7 @@ gboolean stash_group_load_from_file(StashGroup *group, const gchar *filename) * failed operation is returned. * @see stash_group_save_to_key_file(). **/ +GEANY_API_SYMBOL gint stash_group_save_to_file(StashGroup *group, const gchar *filename, GKeyFileFlags flags) { @@ -346,6 +351,7 @@ gint stash_group_save_to_file(StashGroup *group, const gchar *filename, /** Creates a new group. * @param name Name used for @c GKeyFile group. * @return Group. */ +GEANY_API_SYMBOL StashGroup *stash_group_new(const gchar *name) { StashGroup *group = g_new0(StashGroup, 1); @@ -361,6 +367,7 @@ StashGroup *stash_group_new(const gchar *name) * Useful e.g. to avoid freeing strings individually. * @note This is *not* called by stash_group_free(). * @param group . */ +GEANY_API_SYMBOL void stash_group_free_settings(StashGroup *group) { StashPref *entry; @@ -382,6 +389,7 @@ void stash_group_free_settings(StashGroup *group) /** Frees a group. * @param group . */ +GEANY_API_SYMBOL void stash_group_free(StashGroup *group) { StashPref *entry; @@ -442,6 +450,7 @@ add_pref(StashGroup *group, GType type, gpointer setting, * @param setting Address of setting variable. * @param key_name Name for key in a @c GKeyFile. * @param default_value Value to use if the key doesn't exist when loading. */ +GEANY_API_SYMBOL void stash_group_add_boolean(StashGroup *group, gboolean *setting, const gchar *key_name, gboolean default_value) { @@ -454,6 +463,7 @@ void stash_group_add_boolean(StashGroup *group, gboolean *setting, * @param setting Address of setting variable. * @param key_name Name for key in a @c GKeyFile. * @param default_value Value to use if the key doesn't exist when loading. */ +GEANY_API_SYMBOL void stash_group_add_integer(StashGroup *group, gint *setting, const gchar *key_name, gint default_value) { @@ -467,6 +477,7 @@ void stash_group_add_integer(StashGroup *group, gint *setting, * @param setting Address of setting variable. * @param key_name Name for key in a @c GKeyFile. * @param default_value String to copy if the key doesn't exist when loading, or @c NULL. */ +GEANY_API_SYMBOL void stash_group_add_string(StashGroup *group, gchar **setting, const gchar *key_name, const gchar *default_value) { @@ -480,6 +491,7 @@ void stash_group_add_string(StashGroup *group, gchar **setting, * @param setting Address of setting variable. * @param key_name Name for key in a @c GKeyFile. * @param default_value Vector to copy if the key doesn't exist when loading. Usually @c NULL. */ +GEANY_API_SYMBOL void stash_group_add_string_vector(StashGroup *group, gchar ***setting, const gchar *key_name, const gchar **default_value) { @@ -734,6 +746,7 @@ static void pref_action(PrefAction action, StashGroup *group, GtkWidget *owner) * @param owner If non-NULL, used to lookup widgets by name, otherwise * widget pointers are assumed. * @see stash_group_update(). */ +GEANY_API_SYMBOL void stash_group_display(StashGroup *group, GtkWidget *owner) { pref_action(PREF_DISPLAY, group, owner); @@ -746,6 +759,7 @@ void stash_group_display(StashGroup *group, GtkWidget *owner) * @param owner If non-NULL, used to lookup widgets by name, otherwise * widget pointers are assumed. * @see stash_group_display(). */ +GEANY_API_SYMBOL void stash_group_update(StashGroup *group, GtkWidget *owner) { pref_action(PREF_UPDATE, group, owner); @@ -773,6 +787,7 @@ add_widget_pref(StashGroup *group, GType setting_type, gpointer setting, * @param default_value Value to use if the key doesn't exist when loading. * @param widget_id @c GtkWidget pointer or string to lookup widget later. * @see stash_group_add_radio_buttons(). */ +GEANY_API_SYMBOL void stash_group_add_toggle_button(StashGroup *group, gboolean *setting, const gchar *key_name, gboolean default_value, StashWidgetID widget_id) { @@ -795,6 +810,7 @@ void stash_group_add_toggle_button(StashGroup *group, gboolean *setting, * stash_group_add_radio_buttons(group, &which_one_setting, "which_one", BAR, * "radio_foo", FOO, "radio_bar", BAR, NULL); * @endcode */ +GEANY_API_SYMBOL void stash_group_add_radio_buttons(StashGroup *group, gint *setting, const gchar *key_name, gint default_value, StashWidgetID widget_id, gint enum_id, ...) @@ -845,6 +861,7 @@ void stash_group_add_radio_buttons(StashGroup *group, gint *setting, * @param key_name Name for key in a @c GKeyFile. * @param default_value Value to use if the key doesn't exist when loading. * @param widget_id @c GtkWidget pointer or string to lookup widget later. */ +GEANY_API_SYMBOL void stash_group_add_spin_button_integer(StashGroup *group, gint *setting, const gchar *key_name, gint default_value, StashWidgetID widget_id) { @@ -860,6 +877,7 @@ void stash_group_add_spin_button_integer(StashGroup *group, gint *setting, * @param default_value Value to use if the key doesn't exist when loading. * @param widget_id @c GtkWidget pointer or string to lookup widget later. * @see stash_group_add_combo_box_entry(). */ +GEANY_API_SYMBOL void stash_group_add_combo_box(StashGroup *group, gint *setting, const gchar *key_name, gint default_value, StashWidgetID widget_id) { @@ -876,6 +894,7 @@ void stash_group_add_combo_box(StashGroup *group, gint *setting, * @param widget_id @c GtkWidget pointer or string to lookup widget later. */ /* We could maybe also have something like stash_group_add_combo_box_entry_with_menu() * for the history list - or should that be stored as a separate setting? */ +GEANY_API_SYMBOL void stash_group_add_combo_box_entry(StashGroup *group, gchar **setting, const gchar *key_name, const gchar *default_value, StashWidgetID widget_id) { @@ -890,6 +909,7 @@ void stash_group_add_combo_box_entry(StashGroup *group, gchar **setting, * @param key_name Name for key in a @c GKeyFile. * @param default_value Value to use if the key doesn't exist when loading. * @param widget_id @c GtkWidget pointer or string to lookup widget later. */ +GEANY_API_SYMBOL void stash_group_add_entry(StashGroup *group, gchar **setting, const gchar *key_name, const gchar *default_value, StashWidgetID widget_id) { @@ -922,6 +942,7 @@ static GType object_get_property_type(GObject *object, const gchar *property_nam * @c GObject data. * @warning Currently only string GValue properties will be freed before setting; patch for * other types - see @c handle_widget_property(). */ +GEANY_API_SYMBOL void stash_group_add_widget_property(StashGroup *group, gpointer setting, const gchar *key_name, gpointer default_value, StashWidgetID widget_id, const gchar *property_name, GType type) diff --git a/src/symbols.c b/src/symbols.c index f02a59b5..d34087fd 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -47,6 +47,7 @@ #include "geanyobject.h" #include "main.h" #include "navqueue.h" +#include "pluginexport.h" #include "sciwrappers.h" #include "sidebar.h" #include "support.h" @@ -292,6 +293,7 @@ GString *symbols_find_typenames_as_string(gint lang, gboolean global) * * @since 0.19 */ +GEANY_API_SYMBOL const gchar *symbols_get_context_separator(gint ft_id) { switch (ft_id) diff --git a/src/templates.c b/src/templates.c index 77c0c718..b0518922 100644 --- a/src/templates.c +++ b/src/templates.c @@ -37,6 +37,7 @@ #include "geany.h" #include "geanymenubuttonaction.h" #include "geanyobject.h" +#include "pluginexport.h" #include "support.h" #include "toolbar.h" #include "ui_utils.h" @@ -456,6 +457,7 @@ static gchar *get_template_fileheader(GeanyFiletype *ft) /* TODO change the signature to take a GeanyDocument? this would break plugin API/ABI */ +GEANY_API_SYMBOL gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname) { GeanyFiletype *ft = filetypes[filetype_idx]; diff --git a/src/ui_utils.c b/src/ui_utils.c index 6d7fa641..4f049451 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -40,6 +40,7 @@ #include "keyfile.h" #include "main.h" #include "msgwindow.h" +#include "pluginexport.h" #include "prefs.h" #include "project.h" #include "sciwrappers.h" @@ -165,6 +166,7 @@ static void set_statusbar(const gchar *text, gboolean allow_override) /** Displays text on the statusbar. * @param log Whether the message should be recorded in the Status window. * @param format A @c printf -style string. */ +GEANY_API_SYMBOL void ui_set_statusbar(gboolean log, const gchar *format, ...) { gchar *string; @@ -966,6 +968,7 @@ static void on_doc_sensitive_widget_destroy(GtkWidget *widget, G_GNUC_UNUSED gpo * * @since 0.15 **/ +GEANY_API_SYMBOL void ui_add_document_sensitive(GtkWidget *widget) { gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) > 0; @@ -1459,6 +1462,7 @@ void ui_update_view_editor_menu_items(void) * @param label_text The label text. * @param alignment An address to store the alignment widget pointer. * @return The frame widget, setting the alignment container for packing child widgets. */ +GEANY_API_SYMBOL GtkWidget *ui_frame_new_with_alignment(const gchar *label_text, GtkWidget **alignment) { GtkWidget *label, *align; @@ -1481,6 +1485,7 @@ GtkWidget *ui_frame_new_with_alignment(const gchar *label_text, GtkWidget **alig /** Makes a fixed border for dialogs without increasing the button box border. * @param dialog The parent container for the @c GtkVBox. * @return The packed @c GtkVBox. */ +GEANY_API_SYMBOL GtkWidget *ui_dialog_vbox_new(GtkDialog *dialog) { GtkWidget *vbox = gtk_vbox_new(FALSE, 12); /* need child vbox to set a separate border. */ @@ -1555,6 +1560,7 @@ void ui_dialog_set_primary_button_order(GtkDialog *dialog, gint response, ...) * @param text Button label text, can include mnemonics. * @return The new @c GtkButton. */ +GEANY_API_SYMBOL GtkWidget *ui_button_new_with_image(const gchar *stock_id, const gchar *text) { GtkWidget *image, *button; @@ -1575,6 +1581,7 @@ GtkWidget *ui_button_new_with_image(const gchar *stock_id, const gchar *text) * * @since 0.16 */ +GEANY_API_SYMBOL GtkWidget * ui_image_menu_item_new(const gchar *stock_id, const gchar *label) { @@ -1605,6 +1612,7 @@ static void entry_clear_icon_release_cb(GtkEntry *entry, gint icon_pos, * * @since 0.16 */ +GEANY_API_SYMBOL void ui_entry_add_clear_icon(GtkEntry *entry) { g_object_set(entry, "secondary-icon-stock", GTK_STOCK_CLEAR, @@ -1697,6 +1705,7 @@ static gboolean tree_model_find_text(GtkTreeModel *model, * @param combo_entry . * @param text Text to add, or @c NULL for current entry text. * @param history_len Max number of items, or @c 0 for default. */ +GEANY_API_SYMBOL void ui_combo_box_add_to_history(GtkComboBoxText *combo_entry, const gchar *text, gint history_len) { @@ -1875,6 +1884,7 @@ static gboolean ui_tree_view_query_tooltip_cb(GtkWidget *widget, gint x, gint y, */ /* Note: @p column is int and not uint both to match gtk_tree_view_set_tooltip_column() signature * and to allow future support of -1 to unset if ever wanted */ +GEANY_API_SYMBOL void ui_tree_view_set_tooltip_text_column(GtkTreeView *tree_view, gint column) { g_return_if_fail(column >= 0); @@ -1892,6 +1902,7 @@ void ui_tree_view_set_tooltip_text_column(GtkTreeView *tree_view, gint column) * @param widget The widget. * @param str The font name as expected by pango_font_description_from_string(). */ +GEANY_API_SYMBOL void ui_widget_modify_font_from_string(GtkWidget *widget, const gchar *str) { PangoFontDescription *pfd; @@ -1913,6 +1924,7 @@ void ui_widget_modify_font_from_string(GtkWidget *widget, const gchar *str) * @return The @c GtkHBox. */ /* @see ui_setup_open_button_callback(). */ +GEANY_API_SYMBOL GtkWidget *ui_path_box_new(const gchar *title, GtkFileChooserAction action, GtkEntry *entry) { GtkWidget *vbox, *dirbtn, *openimg, *hbox, *path_entry; @@ -2063,6 +2075,7 @@ void ui_statusbar_showhide(gboolean state) * @param table * @param row The row number of the table. */ +GEANY_API_SYMBOL void ui_table_add_row(GtkTable *table, gint row, ...) { va_list args; @@ -2642,6 +2655,7 @@ void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item) * @since 0.16 * @deprecated 0.21 use gtk_widget_set_tooltip_text() instead */ +GEANY_API_SYMBOL void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text) { gtk_widget_set_tooltip_text(widget, text); @@ -2659,6 +2673,7 @@ void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text) * * @since 0.16 */ +GEANY_API_SYMBOL GtkWidget *ui_lookup_widget(GtkWidget *widget, const gchar *widget_name) { GtkWidget *parent, *found_widget; @@ -2737,6 +2752,7 @@ static gboolean progress_bar_pulse(gpointer data) * * @since 0.16 **/ +GEANY_API_SYMBOL void ui_progress_bar_start(const gchar *text) { g_return_if_fail(progress_bar_timer_id == 0); @@ -2756,6 +2772,7 @@ void ui_progress_bar_start(const gchar *text) * * @since 0.16 **/ +GEANY_API_SYMBOL void ui_progress_bar_stop(void) { gtk_widget_hide(GTK_WIDGET(main_widgets.progressbar)); @@ -2837,6 +2854,7 @@ GtkWidget *ui_label_new_bold(const gchar *text) * the corresponding document pointer as @c user_data. * @warning You should check @c doc->is_valid in the callback. * @since 0.19 */ +GEANY_API_SYMBOL void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback callback) { ui_menu_add_document_items_sorted(menu, active, callback, NULL); @@ -2857,6 +2875,7 @@ void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback * @param compare_func is used to sort the list. Might be @c NULL to not sort the list. * @warning You should check @c doc->is_valid in the callback. * @since 0.21 */ +GEANY_API_SYMBOL void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, GCallback callback, GCompareFunc compare_func) { @@ -2916,6 +2935,7 @@ void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, * @param keyval A keyval. * @return @c TRUE if @a keyval is the one of the Enter/Return key values, otherwise @c FALSE. * @since 0.19 */ +GEANY_API_SYMBOL gboolean ui_is_keyval_enter_or_return(guint keyval) { return (keyval == GDK_Return || keyval == GDK_ISO_Enter|| keyval == GDK_KP_Enter); @@ -2928,6 +2948,7 @@ gboolean ui_is_keyval_enter_or_return(guint keyval) * @param default_value The default value in case the value could not be read. * @return The value for the property if it exists, otherwise the @a default_value. * @since 0.19 */ +GEANY_API_SYMBOL gint ui_get_gtk_settings_integer(const gchar *property_name, gint default_value) { if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT( @@ -3017,6 +3038,7 @@ void ui_focus_current_document(void) * @param stock_id stock_id to lookup e.g. @c GTK_STOCK_OPEN. * @return The label text for stock * @since Geany 1.22 */ +GEANY_API_SYMBOL const gchar *ui_lookup_stock_label(const gchar *stock_id) { GtkStockItem item; diff --git a/src/utils.c b/src/utils.c index 7a71a52e..1f64d1ed 100644 --- a/src/utils.c +++ b/src/utils.c @@ -32,6 +32,7 @@ #include "app.h" #include "dialogs.h" #include "document.h" +#include "pluginexport.h" #include "prefs.h" #include "sciwrappers.h" #include "support.h" @@ -69,6 +70,7 @@ * * @since 0.16 **/ +GEANY_API_SYMBOL void utils_open_browser(const gchar *uri) { #ifdef G_OS_WIN32 @@ -210,6 +212,7 @@ gboolean utils_is_opening_brace(gchar c, gboolean include_angles) * @return 0 if the file was successfully written, otherwise the @c errno of the * failed operation is returned. **/ +GEANY_API_SYMBOL gint utils_write_file(const gchar *filename, const gchar *text) { g_return_val_if_fail(filename != NULL, ENOENT); @@ -269,6 +272,7 @@ gint utils_write_file(const gchar *filename, const gchar *text) * @param size . * @return The tag name (newly allocated) or @c NULL if no opening tag was found. */ +GEANY_API_SYMBOL gchar *utils_find_open_xml_tag(const gchar sel[], gint size) { const gchar *cur, *begin; @@ -293,6 +297,7 @@ gchar *utils_find_open_xml_tag(const gchar sel[], gint size) * @param size . * @return pointer to '<' of the found opening tag within @a sel, or @c NULL if no opening tag was found. */ +GEANY_API_SYMBOL const gchar *utils_find_open_xml_tag_pos(const gchar sel[], gint size) { /* stolen from anjuta and modified */ @@ -500,6 +505,7 @@ static gchar *utf8_strdown(const gchar *str) * * @since 0.16 */ +GEANY_API_SYMBOL gint utils_str_casecmp(const gchar *s1, const gchar *s2) { gchar *tmp1, *tmp2; @@ -542,6 +548,7 @@ gint utils_str_casecmp(const gchar *s1, const gchar *s2) * @since 0.17 */ /* This following function is taken from Gedit. */ +GEANY_API_SYMBOL gchar *utils_str_middle_truncate(const gchar *string, guint truncate_length) { GString *truncated; @@ -591,6 +598,7 @@ gchar *utils_str_middle_truncate(const gchar *string, guint truncate_length) * * @return @c TRUE if @a a equals @a b, else @c FALSE. **/ +GEANY_API_SYMBOL gboolean utils_str_equal(const gchar *a, const gchar *b) { /* (taken from libexo from os-cillation) */ @@ -608,6 +616,7 @@ gboolean utils_str_equal(const gchar *a, const gchar *b) * * @return A newly-allocated string, should be freed when no longer needed. **/ +GEANY_API_SYMBOL gchar *utils_remove_ext_from_filename(const gchar *filename) { gchar *last_dot; @@ -726,6 +735,7 @@ gint utils_strpos(const gchar *haystack, const gchar *needle) * * @since 0.16 */ +GEANY_API_SYMBOL gchar *utils_get_date_time(const gchar *format, time_t *time_to_use) { const struct tm *tm; @@ -794,6 +804,7 @@ gchar *utils_get_initials(const gchar *name) * @return The value associated with @a key as an integer, or the given default value if the value * could not be retrieved. **/ +GEANY_API_SYMBOL gint utils_get_setting_integer(GKeyFile *config, const gchar *section, const gchar *key, const gint default_value) { @@ -824,6 +835,7 @@ gint utils_get_setting_integer(GKeyFile *config, const gchar *section, const gch * @return The value associated with @a key as a boolean, or the given default value if the value * could not be retrieved. **/ +GEANY_API_SYMBOL gboolean utils_get_setting_boolean(GKeyFile *config, const gchar *section, const gchar *key, const gboolean default_value) { @@ -854,6 +866,7 @@ gboolean utils_get_setting_boolean(GKeyFile *config, const gchar *section, const * @return A newly allocated string, either the value for @a key or a copy of the given * default value if it could not be retrieved. **/ +GEANY_API_SYMBOL gchar *utils_get_setting_string(GKeyFile *config, const gchar *section, const gchar *key, const gchar *default_value) { @@ -1247,6 +1260,7 @@ gboolean utils_wrap_string(gchar *string, gint wrapstart) * @return The converted string in locale encoding, or a copy of the input string if conversion * failed. Should be freed with g_free(). If @a utf8_text is @c NULL, @c NULL is returned. **/ +GEANY_API_SYMBOL gchar *utils_get_locale_from_utf8(const gchar *utf8_text) { #ifdef G_OS_WIN32 @@ -1275,6 +1289,7 @@ gchar *utils_get_locale_from_utf8(const gchar *utf8_text) * @return The converted string in UTF-8 encoding, or a copy of the input string if conversion * failed. Should be freed with g_free(). If @a locale_text is @c NULL, @c NULL is returned. **/ +GEANY_API_SYMBOL gchar *utils_get_utf8_from_locale(const gchar *locale_text) { #ifdef G_OS_WIN32 @@ -1364,6 +1379,7 @@ gchar **utils_strv_new(const gchar *first, ...) * @return 0 if the directory was successfully created, otherwise the @c errno of the * failed operation is returned. **/ +GEANY_API_SYMBOL gint utils_mkdir(const gchar *path, gboolean create_parent_dirs) { gint mode = 0700; @@ -1400,6 +1416,7 @@ gint utils_mkdir(const gchar *path, gboolean create_parent_dirs) * freed when no longer needed. * @see utils_get_file_list(). **/ +GEANY_API_SYMBOL GSList *utils_get_file_list_full(const gchar *path, gboolean full_path, gboolean sort, GError **error) { GSList *list = NULL; @@ -1444,6 +1461,7 @@ GSList *utils_get_file_list_full(const gchar *path, gboolean full_path, gboolean * freed when no longer needed. * @see utils_get_file_list_full(). **/ +GEANY_API_SYMBOL GSList *utils_get_file_list(const gchar *path, guint *length, GError **error) { GSList *list = utils_get_file_list_full(path, FALSE, TRUE, error); @@ -1531,6 +1549,7 @@ gint utils_string_replace(GString *str, gint pos, gint len, const gchar *replace * * @return Number of replacements made. **/ +GEANY_API_SYMBOL guint utils_string_replace_all(GString *haystack, const gchar *needle, const gchar *replace) { guint count = 0; @@ -1564,6 +1583,7 @@ guint utils_string_replace_all(GString *haystack, const gchar *needle, const gch * * @since 0.16 */ +GEANY_API_SYMBOL guint utils_string_replace_first(GString *haystack, const gchar *needle, const gchar *replace) { gint pos = utils_string_find(haystack, 0, -1, needle); @@ -1648,6 +1668,7 @@ const gchar *utils_get_default_dir_utf8(void) * * @return @c TRUE on success, @c FALSE if an error was set. **/ +GEANY_API_SYMBOL gboolean utils_spawn_sync(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, gpointer user_data, gchar **std_out, gchar **std_err, gint *exit_status, GError **error) @@ -1691,6 +1712,7 @@ gboolean utils_spawn_sync(const gchar *dir, gchar **argv, gchar **env, GSpawnFla * * @return @c TRUE on success, @c FALSE if an error was set. **/ +GEANY_API_SYMBOL gboolean utils_spawn_async(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid, GError **error) @@ -1859,6 +1881,7 @@ void utils_tidy_path(gchar *filename) * * @see @c g_strdelimit. **/ +GEANY_API_SYMBOL gchar *utils_str_remove_chars(gchar *string, const gchar *chars) { const gchar *r; @@ -1970,6 +1993,7 @@ static gboolean str_in_array(const gchar **haystack, const gchar *needle) * * @return The new environment array. **/ +GEANY_API_SYMBOL gchar **utils_copy_environment(const gchar **exclude_vars, const gchar *first_varname, ...) { gchar **result; diff --git a/tagmanager/src/tm_source_file.c b/tagmanager/src/tm_source_file.c index 40118a9b..a90f3850 100644 --- a/tagmanager/src/tm_source_file.c +++ b/tagmanager/src/tm_source_file.c @@ -34,6 +34,7 @@ #define LIBCTAGS_DEFINED #include "tm_source_file.h" #include "tm_tag.h" +#include "../src/pluginexport.h" /* for GEANY_API_SYMBOL */ static TMSourceFile *current_source_file = NULL; @@ -84,6 +85,7 @@ static char *realpath (const char *pathname, char *resolved_path) @param file_name The original file_name @return A newly allocated string containing the real path to the file. NULL if none is available. */ +GEANY_API_SYMBOL gchar *tm_get_real_path(const gchar *file_name) { if (file_name) @@ -195,6 +197,7 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_ * @param name Name of the used programming language, NULL for autodetection. * @return The created unparsed TMSourceFile object. * */ +GEANY_API_SYMBOL TMSourceFile *tm_source_file_new(const char *file_name, const char *name) { TMSourceFile *source_file = g_new(TMSourceFile, 1); @@ -225,6 +228,7 @@ static void tm_source_file_destroy(TMSourceFile *source_file) function the TMSourceFile has to be removed from the TMWorkspace. @param source_file The source file to free. */ +GEANY_API_SYMBOL void tm_source_file_free(TMSourceFile *source_file) { if (NULL != source_file) diff --git a/tagmanager/src/tm_workspace.c b/tagmanager/src/tm_workspace.c index 5edf1e4f..b15ead81 100644 --- a/tagmanager/src/tm_workspace.c +++ b/tagmanager/src/tm_workspace.c @@ -32,6 +32,7 @@ #include "tm_workspace.h" #include "tm_tag.h" +#include "../src/pluginexport.h" /* for GEANY_API_SYMBOL */ /* when changing, always keep the three sort criteria below in sync */ @@ -157,6 +158,7 @@ static void update_source_file(TMSourceFile *source_file, guchar* text_buf, /** Adds a source file to the workspace, parses it and updates the workspace tags. @param source_file The source file to add to the workspace. */ +GEANY_API_SYMBOL void tm_workspace_add_source_file(TMSourceFile *source_file) { g_return_if_fail(source_file != NULL); @@ -199,6 +201,7 @@ void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* t pointer call tm_source_file_free() on it. @param source_file Pointer to the source file to be removed. */ +GEANY_API_SYMBOL void tm_workspace_remove_source_file(TMSourceFile *source_file) { guint i; @@ -266,6 +269,7 @@ static void tm_workspace_update(void) tm_workspace_update_source_file() separately for each of the files. @param source_files The source files to be added to the workspace. */ +GEANY_API_SYMBOL void tm_workspace_add_source_files(GPtrArray *source_files) { guint i; @@ -290,6 +294,7 @@ void tm_workspace_add_source_files(GPtrArray *source_files) call tm_source_file_free() on each of them. @param source_files The source files to be removed from the workspace. */ +GEANY_API_SYMBOL void tm_workspace_remove_source_files(GPtrArray *source_files) { guint i, j; From 056e7cb4c8bd193e85f1c834a3c9f0beb06b8828 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 18:04:16 -0700 Subject: [PATCH 03/40] Change to GEANY_EXPORT_SYMBOL for callback functions This allows them to be dynamically exported when -fvisibility=hidden is applied. TODO: remove the CFLAGS hack in configure.ac --- configure.ac | 3 + src/callbacks.c | 422 ++++++++++++++++++++++++------------------------ src/callbacks.h | 121 +++++++------- src/project.c | 3 +- 4 files changed, 277 insertions(+), 272 deletions(-) diff --git a/configure.ac b/configure.ac index 8d8ee6b9..2b828bb5 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,9 @@ AC_SUBST([pkgdatadir]) GEANY_CHECK_DOCUTILS GEANY_CHECK_DOXYGEN +#FIXME: replace this with a real check that the compiler supports the argument +CFLAGS="${CFLAGS} -fvisibility=hidden" + # Output AC_CONFIG_FILES([ Makefile diff --git a/src/callbacks.c b/src/callbacks.c index 48d426c1..056372e8 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -74,82 +74,82 @@ /* prototypes of Glade-only callback to let the compiler know they really are meant to be exported */ -G_MODULE_EXPORT gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata); -G_MODULE_EXPORT void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data); -G_MODULE_EXPORT void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data); -G_MODULE_EXPORT void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data); -G_MODULE_EXPORT void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data); -G_MODULE_EXPORT void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); -G_MODULE_EXPORT void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); -G_MODULE_EXPORT void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); -G_MODULE_EXPORT void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data); -G_MODULE_EXPORT void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata); +GEANY_EXPORT_SYMBOL void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data); /* represents the state at switching a notebook page(in the left treeviews widget), to not emit @@ -159,7 +159,7 @@ G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_dat /* wrapper function to abort exit process if cancel button is pressed */ -G_MODULE_EXPORT gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata) +GEANY_EXPORT_SYMBOL gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata) { return !main_quit(); } @@ -169,14 +169,14 @@ G_MODULE_EXPORT gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *eve * GUI callbacks */ -G_MODULE_EXPORT void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data) { document_new_file(NULL, NULL, NULL); } /* create a new file and copy file content and properties */ -G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *old_doc = document_get_current(); @@ -185,7 +185,7 @@ G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_dat } -G_MODULE_EXPORT void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -196,13 +196,13 @@ G_MODULE_EXPORT void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data } -G_MODULE_EXPORT void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data) { dialogs_show_save_as(); } -G_MODULE_EXPORT void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i, max = (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); GeanyDocument *doc, *cur_doc = document_get_current(); @@ -229,13 +229,13 @@ G_MODULE_EXPORT void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_ } -G_MODULE_EXPORT void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { document_close_all(); } -G_MODULE_EXPORT void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -244,13 +244,13 @@ G_MODULE_EXPORT void on_close1_activate(GtkMenuItem *menuitem, gpointer user_dat } -G_MODULE_EXPORT void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) { main_quit(); } -G_MODULE_EXPORT void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data) { gtk_widget_set_sensitive(ui_widgets.recent_files_menuitem, g_queue_get_length(ui_prefs.recent_queue) > 0); @@ -260,7 +260,7 @@ G_MODULE_EXPORT void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data /* edit actions, c&p & co, from menu bar and from popup menu */ -G_MODULE_EXPORT void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *item; GeanyDocument *doc = document_get_current(); @@ -277,7 +277,7 @@ G_MODULE_EXPORT void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data } -G_MODULE_EXPORT void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -291,7 +291,7 @@ G_MODULE_EXPORT void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data } -G_MODULE_EXPORT void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -305,7 +305,7 @@ G_MODULE_EXPORT void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data } -G_MODULE_EXPORT void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -325,7 +325,7 @@ G_MODULE_EXPORT void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data) } -G_MODULE_EXPORT void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -345,7 +345,7 @@ G_MODULE_EXPORT void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data } -G_MODULE_EXPORT void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -368,7 +368,7 @@ G_MODULE_EXPORT void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_dat } -G_MODULE_EXPORT void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -388,28 +388,28 @@ G_MODULE_EXPORT void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_da } -G_MODULE_EXPORT void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) { prefs_show_dialog(); } /* about menu item */ -G_MODULE_EXPORT void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data) { about_dialog_show(); } /* open file */ -G_MODULE_EXPORT void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data) { dialogs_show_open_file(); } /* reload file */ -G_MODULE_EXPORT void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -419,7 +419,7 @@ G_MODULE_EXPORT void on_toolbutton_reload_clicked(GtkAction *action, gpointer us } -G_MODULE_EXPORT void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data) { dialogs_show_open_font(); } @@ -484,7 +484,7 @@ void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data) /* hides toolbar from toolbar popup menu */ -G_MODULE_EXPORT void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *tool_item = ui_lookup_widget(GTK_WIDGET(main_widgets.window), "menu_show_toolbar1"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tool_item), FALSE); @@ -492,7 +492,7 @@ G_MODULE_EXPORT void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer u /* zoom in from menu bar and popup menu */ -G_MODULE_EXPORT void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -503,7 +503,7 @@ G_MODULE_EXPORT void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_d /* zoom out from menu bar and popup menu */ -G_MODULE_EXPORT void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -513,7 +513,7 @@ G_MODULE_EXPORT void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_ } -G_MODULE_EXPORT void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -532,7 +532,7 @@ static gboolean delayed_check_disk_status(gpointer data) /* Changes window-title after switching tabs and lots of other things. * note: using 'after' makes Scintilla redraw before the UI, appearing more responsive */ -G_MODULE_EXPORT void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, +GEANY_EXPORT_SYMBOL void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { GeanyDocument *doc; @@ -568,7 +568,7 @@ G_MODULE_EXPORT void on_notebook1_switch_page_after(GtkNotebook *notebook, gpoin } -G_MODULE_EXPORT void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, +GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { /* suppress selection changed signal when switching to the open files list */ @@ -576,7 +576,7 @@ G_MODULE_EXPORT void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer } -G_MODULE_EXPORT void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, +GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { ignore_callback = FALSE; @@ -595,7 +595,7 @@ static void convert_eol(gint mode) } -G_MODULE_EXPORT void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem)) return; @@ -604,7 +604,7 @@ G_MODULE_EXPORT void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_ } -G_MODULE_EXPORT void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem)) return; @@ -613,7 +613,7 @@ G_MODULE_EXPORT void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_da } -G_MODULE_EXPORT void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem)) return; @@ -622,7 +622,7 @@ G_MODULE_EXPORT void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_da } -G_MODULE_EXPORT void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -643,7 +643,7 @@ gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer u } -G_MODULE_EXPORT void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); ScintillaObject *sci; @@ -699,7 +699,7 @@ G_MODULE_EXPORT void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer us } -G_MODULE_EXPORT void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -708,7 +708,7 @@ G_MODULE_EXPORT void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, g } -G_MODULE_EXPORT void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -718,7 +718,7 @@ G_MODULE_EXPORT void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpo } -G_MODULE_EXPORT void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -728,13 +728,13 @@ G_MODULE_EXPORT void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmen } -G_MODULE_EXPORT void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data) { highlighting_show_color_scheme_dialog(); } -G_MODULE_EXPORT void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -744,7 +744,7 @@ G_MODULE_EXPORT void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, } -G_MODULE_EXPORT void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -754,7 +754,7 @@ G_MODULE_EXPORT void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuit } -G_MODULE_EXPORT void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -764,7 +764,7 @@ G_MODULE_EXPORT void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkme } -G_MODULE_EXPORT void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -774,7 +774,7 @@ G_MODULE_EXPORT void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkm } -G_MODULE_EXPORT void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -784,7 +784,7 @@ G_MODULE_EXPORT void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem * } -G_MODULE_EXPORT void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -796,7 +796,7 @@ G_MODULE_EXPORT void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, } -G_MODULE_EXPORT void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -811,7 +811,7 @@ G_MODULE_EXPORT void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuit } -G_MODULE_EXPORT void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -849,13 +849,13 @@ static void find_usage(gboolean in_session) } -G_MODULE_EXPORT void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) { find_usage(FALSE); } -G_MODULE_EXPORT void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) { find_usage(TRUE); } @@ -879,25 +879,25 @@ static void goto_tag(gboolean definition) } -G_MODULE_EXPORT void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data) { goto_tag(TRUE); } -G_MODULE_EXPORT void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data) { goto_tag(FALSE); } -G_MODULE_EXPORT void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data) { tools_word_count(); } -G_MODULE_EXPORT void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data) { gchar colour[9]; GeanyDocument *doc = document_get_current(); @@ -917,19 +917,19 @@ void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data) } -G_MODULE_EXPORT void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_show_find_dialog(); } -G_MODULE_EXPORT void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_find_again(FALSE); } -G_MODULE_EXPORT void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data) { if (search_data.flags & GEANY_FIND_REGEXP) /* Can't reverse search order for a regex (find next ignores search backwards) */ @@ -939,25 +939,25 @@ G_MODULE_EXPORT void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_find_selection(document_get_current(), FALSE); } -G_MODULE_EXPORT void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_find_selection(document_get_current(), TRUE); } -G_MODULE_EXPORT void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_show_replace_dialog(); } -G_MODULE_EXPORT void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_show_find_in_files_dialog(NULL); } @@ -978,7 +978,7 @@ static void get_line_and_offset_from_text(const gchar *text, gint *line_no, gint } -G_MODULE_EXPORT void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data) { static gchar value[16] = ""; gchar *result; @@ -1036,7 +1036,7 @@ void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data) } -G_MODULE_EXPORT void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data) { gchar *uri; @@ -1046,37 +1046,37 @@ G_MODULE_EXPORT void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data } -G_MODULE_EXPORT void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_show_shortcuts(); } -G_MODULE_EXPORT void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data) { utils_open_browser(GEANY_HOMEPAGE); } -G_MODULE_EXPORT void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data) { utils_open_browser(GEANY_DONATE); } -G_MODULE_EXPORT void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data) { utils_open_browser(GEANY_WIKI); } -G_MODULE_EXPORT void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data) { utils_open_browser(GEANY_BUG_REPORT); } -G_MODULE_EXPORT void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *text; @@ -1130,13 +1130,13 @@ static void insert_multiline_comment(GeanyDocument *doc, gint pos) } -G_MODULE_EXPORT void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_multiline_comment(document_get_current(), editor_info.click_pos); } -G_MODULE_EXPORT void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_multiline_comment(document_get_current(), -1); } @@ -1162,31 +1162,31 @@ static void insert_comment_template(GeanyDocument *doc, gint pos, guint template } -G_MODULE_EXPORT void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), editor_info.click_pos, GEANY_TEMPLATE_GPL); } -G_MODULE_EXPORT void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), -1, GEANY_TEMPLATE_GPL); } -G_MODULE_EXPORT void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), editor_info.click_pos, GEANY_TEMPLATE_BSD); } -G_MODULE_EXPORT void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), -1, GEANY_TEMPLATE_BSD); } -G_MODULE_EXPORT void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *text; @@ -1205,7 +1205,7 @@ G_MODULE_EXPORT void on_comments_changelog_activate(GtkMenuItem *menuitem, gpoin } -G_MODULE_EXPORT void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *text; @@ -1226,7 +1226,7 @@ G_MODULE_EXPORT void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpoi } -G_MODULE_EXPORT void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1235,7 +1235,7 @@ G_MODULE_EXPORT void on_file_properties_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1244,7 +1244,7 @@ G_MODULE_EXPORT void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1259,7 +1259,7 @@ void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data) } -G_MODULE_EXPORT void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1268,7 +1268,7 @@ G_MODULE_EXPORT void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, } -G_MODULE_EXPORT void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1277,7 +1277,7 @@ G_MODULE_EXPORT void on_print1_activate(GtkMenuItem *menuitem, gpointer user_dat } -G_MODULE_EXPORT void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1286,7 +1286,7 @@ G_MODULE_EXPORT void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointe } -G_MODULE_EXPORT void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -1313,7 +1313,7 @@ G_MODULE_EXPORT void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuit } -G_MODULE_EXPORT void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -1335,7 +1335,7 @@ G_MODULE_EXPORT void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkm } -G_MODULE_EXPORT void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1344,7 +1344,7 @@ G_MODULE_EXPORT void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpoin } -G_MODULE_EXPORT void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1353,7 +1353,7 @@ G_MODULE_EXPORT void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpo } -G_MODULE_EXPORT void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1362,7 +1362,7 @@ G_MODULE_EXPORT void on_menu_toggle_line_commentation1_activate(GtkMenuItem *men } -G_MODULE_EXPORT void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1371,7 +1371,7 @@ G_MODULE_EXPORT void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gp } -G_MODULE_EXPORT void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1380,7 +1380,7 @@ G_MODULE_EXPORT void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gp } -G_MODULE_EXPORT void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data) { if (! ui_tree_view_find_next(GTK_TREE_VIEW(msgwindow.tree_msg), msgwin_goto_messages_file_line)) @@ -1388,7 +1388,7 @@ G_MODULE_EXPORT void on_next_message1_activate(GtkMenuItem *menuitem, gpointer u } -G_MODULE_EXPORT void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data) { if (! ui_tree_view_find_previous(GTK_TREE_VIEW(msgwindow.tree_msg), msgwin_goto_messages_file_line)) @@ -1396,31 +1396,31 @@ G_MODULE_EXPORT void on_previous_message1_activate(GtkMenuItem *menuitem, gpoint } -G_MODULE_EXPORT void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_new(); } -G_MODULE_EXPORT void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_open(); } -G_MODULE_EXPORT void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_close(TRUE); } -G_MODULE_EXPORT void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_properties(); } -G_MODULE_EXPORT void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data) { static GtkWidget *item_close = NULL; static GtkWidget *item_properties = NULL; @@ -1438,7 +1438,7 @@ G_MODULE_EXPORT void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer u } -G_MODULE_EXPORT void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *sel = NULL; @@ -1504,7 +1504,7 @@ G_MODULE_EXPORT void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, } -G_MODULE_EXPORT void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1515,13 +1515,13 @@ G_MODULE_EXPORT void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data) { symbols_show_load_tags_dialog(); } -G_MODULE_EXPORT void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data) { gchar *word, *command; GError *error = NULL; @@ -1565,7 +1565,7 @@ G_MODULE_EXPORT void on_context_action1_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data) { static gint hide_all = -1; GtkCheckMenuItem *msgw = GTK_CHECK_MENU_ITEM( @@ -1654,25 +1654,25 @@ static void set_indent_type(GtkCheckMenuItem *menuitem, GeanyIndentType type) } -G_MODULE_EXPORT void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { set_indent_type(menuitem, GEANY_INDENT_TYPE_TABS); } -G_MODULE_EXPORT void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { set_indent_type(menuitem, GEANY_INDENT_TYPE_SPACES); } -G_MODULE_EXPORT void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { set_indent_type(menuitem, GEANY_INDENT_TYPE_BOTH); } -G_MODULE_EXPORT void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc; @@ -1686,13 +1686,13 @@ G_MODULE_EXPORT void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, g } -G_MODULE_EXPORT void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data) { printing_page_setup_gtk(); } -G_MODULE_EXPORT gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) +GEANY_EXPORT_SYMBOL gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { guint state = keybindings_get_modifiers(event->state); @@ -1706,7 +1706,7 @@ G_MODULE_EXPORT gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKe } -G_MODULE_EXPORT void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc; @@ -1720,7 +1720,7 @@ G_MODULE_EXPORT void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -1730,7 +1730,7 @@ G_MODULE_EXPORT void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer } -G_MODULE_EXPORT void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *next_message = ui_lookup_widget(main_widgets.window, "next_message1"); GtkWidget *previous_message = ui_lookup_widget(main_widgets.window, "previous_message1"); @@ -1747,7 +1747,7 @@ G_MODULE_EXPORT void on_search1_activate(GtkMenuItem *menuitem, gpointer user_da /* simple implementation (vs. close all which doesn't close documents if cancelled), * if user_data is set, it is the GeanyDocument to keep */ -G_MODULE_EXPORT void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i; GeanyDocument *cur_doc = user_data; @@ -1768,19 +1768,19 @@ G_MODULE_EXPORT void on_close_other_documents1_activate(GtkMenuItem *menuitem, g } -G_MODULE_EXPORT void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data) { main_reload_configuration(); } -G_MODULE_EXPORT void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data) { log_show_debug_messages_dialog(); } -G_MODULE_EXPORT void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data) { #ifdef HAVE_VTE if (vte_info.have_vte) @@ -1789,7 +1789,7 @@ G_MODULE_EXPORT void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, g } -G_MODULE_EXPORT gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data) +GEANY_EXPORT_SYMBOL gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data) { if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) @@ -1823,7 +1823,7 @@ static void show_notebook_page(const gchar *notebook_name, const gchar *page_nam } -G_MODULE_EXPORT void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) { prefs_show_dialog(); @@ -1834,91 +1834,91 @@ G_MODULE_EXPORT void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpoin } -G_MODULE_EXPORT void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data) { toolbar_configure(GTK_WINDOW(ui_widgets.prefs_dialog)); } -G_MODULE_EXPORT void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_CLIPBOARD, GEANY_KEYS_CLIPBOARD_CUTLINE); } -G_MODULE_EXPORT void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_CLIPBOARD, GEANY_KEYS_CLIPBOARD_COPYLINE); } -G_MODULE_EXPORT void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_DELETELINE); } -G_MODULE_EXPORT void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_DUPLICATELINE); } -G_MODULE_EXPORT void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_LINE); } -G_MODULE_EXPORT void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_PARAGRAPH); } -G_MODULE_EXPORT void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_INSERT, GEANY_KEYS_INSERT_ALTWHITESPACE); } -G_MODULE_EXPORT void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_NEXTMARKER); } -G_MODULE_EXPORT void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_PREVIOUSMARKER); } -G_MODULE_EXPORT void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_FORMAT, GEANY_KEYS_FORMAT_REFLOWPARAGRAPH); } -G_MODULE_EXPORT void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_MOVELINEUP); } -G_MODULE_EXPORT void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_MOVELINEDOWN); } -G_MODULE_EXPORT void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_FORMAT, GEANY_KEYS_FORMAT_AUTOINDENT); } -G_MODULE_EXPORT void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) { #ifdef HAVE_PLUGINS plugin_show_configure(NULL); @@ -1926,7 +1926,7 @@ G_MODULE_EXPORT void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpoi } -G_MODULE_EXPORT void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc; gchar *label; @@ -1945,7 +1945,7 @@ G_MODULE_EXPORT void on_indent_width_activate(GtkMenuItem *menuitem, gpointer us } -G_MODULE_EXPORT void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i; @@ -1957,13 +1957,13 @@ G_MODULE_EXPORT void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpoin } -G_MODULE_EXPORT void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_SEARCH, GEANY_KEYS_SEARCH_MARKALL); } -G_MODULE_EXPORT void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GeanyIndentType type; @@ -1976,7 +1976,7 @@ G_MODULE_EXPORT void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gp } -G_MODULE_EXPORT void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) +GEANY_EXPORT_SYMBOL void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gint width; diff --git a/src/callbacks.h b/src/callbacks.h index 64410252..c1ea52d3 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -22,87 +22,88 @@ #ifndef GEANY_CALLBACKS_H #define GEANY_CALLBACKS_H 1 +#include "pluginexport.h" #include "gtkcompat.h" G_BEGIN_DECLS extern gboolean ignore_callback; -G_MODULE_EXPORT void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data); gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer user_data); -G_MODULE_EXPORT void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data); void on_toolbar_search_entry_activate(GtkAction *action, const gchar *text, gpointer user_data); -G_MODULE_EXPORT void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data); -G_MODULE_EXPORT void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data); -G_MODULE_EXPORT void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); void on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data); @@ -110,63 +111,63 @@ void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data); void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data); -G_MODULE_EXPORT void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbutton_back_activate(GtkAction *action, gpointer user_data); void on_toolbutton_forward_activate(GtkAction *action, gpointer user_data); -G_MODULE_EXPORT gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data); +GEANY_EXPORT_SYMBOL gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data); -G_MODULE_EXPORT gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data); +GEANY_EXPORT_SYMBOL gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data); -G_MODULE_EXPORT void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); +GEANY_EXPORT_SYMBOL void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); G_END_DECLS diff --git a/src/project.c b/src/project.c index 202a8b06..761061f0 100644 --- a/src/project.c +++ b/src/project.c @@ -38,6 +38,7 @@ #include "geanyobject.h" #include "keyfile.h" #include "main.h" +#include "pluginexport.h" #include "projectprivate.h" #include "sidebar.h" #include "stash.h" @@ -473,7 +474,7 @@ static void destroy_project(gboolean open_default) /* Shows the file chooser dialog when base path button is clicked * FIXME: this should be connected in Glade but 3.8.1 has a bug * where it won't pass any objects as user data (#588824). */ -G_MODULE_EXPORT void +GEANY_EXPORT_SYMBOL void on_project_properties_base_path_button_clicked(GtkWidget *button, GtkWidget *base_path_entry) { From 1e630e6f12c211a1b046d94421a8282682152eb6 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 18:07:48 -0700 Subject: [PATCH 04/40] Remove redundant GEANY_EXPORT_SYMBOL usage in callbacks.h It only needs to be specified in one place for each function. --- src/callbacks.c | 1 + src/callbacks.h | 121 ++++++++++++++++++++++++------------------------ 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index 056372e8..039f9030 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -45,6 +45,7 @@ #include "main.h" #include "msgwindow.h" #include "navqueue.h" +#include "pluginexport.h" #include "plugins.h" #include "pluginutils.h" #include "prefs.h" diff --git a/src/callbacks.h b/src/callbacks.h index c1ea52d3..de187958 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -22,88 +22,87 @@ #ifndef GEANY_CALLBACKS_H #define GEANY_CALLBACKS_H 1 -#include "pluginexport.h" #include "gtkcompat.h" G_BEGIN_DECLS extern gboolean ignore_callback; -GEANY_EXPORT_SYMBOL void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data); gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data); void on_toolbar_search_entry_activate(GtkAction *action, const gchar *text, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data); +void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); void on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data); @@ -111,63 +110,63 @@ void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data); void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data); void on_toolbutton_back_activate(GtkAction *action, gpointer user_data); void on_toolbutton_forward_activate(GtkAction *action, gpointer user_data); -GEANY_EXPORT_SYMBOL gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data); +gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data); -GEANY_EXPORT_SYMBOL gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data); +gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); +void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data); G_END_DECLS From 860df27696de75ab41765ed5700eb8e9991bccab Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 19:08:57 -0700 Subject: [PATCH 05/40] Remove struct/macro/funcptr linkage control for plugin API Add rest of headers needed for declarations of all public API functions. Add HAVE_PLUGINS define to geanyplugins.h since some headers need this and it should always be valid for this header. geanyfunctions.h left for source-level backwards compatibility for plugins which might `#include` this header directly. I don't know why they do it, but some Geany-Plugins do this. --- doc/Doxyfile.in | 1 - doc/Makefile.am | 1 - doc/plugins.dox | 7 +- plugins/Makefile.am | 14 +- plugins/geanyfunctions.h | 463 ++---------------------------------- plugins/geanyplugin.h | 15 +- plugins/genapi.py | 98 -------- src/Makefile.am | 6 + src/plugindata.h | 490 --------------------------------------- src/plugins.c | 326 +------------------------- 10 files changed, 47 insertions(+), 1374 deletions(-) delete mode 100755 plugins/genapi.py diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index d139fdfa..12098d1a 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -775,7 +775,6 @@ WARN_LOGFILE = INPUT = @top_srcdir@/src/ \ @top_srcdir@/doc/ \ @top_srcdir@/plugins/geanyplugin.h \ - @top_srcdir@/plugins/geanyfunctions.h \ @top_srcdir@/tagmanager/src/tm_source_file.c \ @top_srcdir@/tagmanager/src/tm_source_file.h \ @top_srcdir@/tagmanager/src/tm_workspace.c \ diff --git a/doc/Makefile.am b/doc/Makefile.am index 31985f76..a348cc9c 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -96,7 +96,6 @@ doxygen_sources = \ $(srcdir)/*.dox \ $(top_srcdir)/src/*.[ch] \ $(top_srcdir)/plugins/geanyplugin.h \ - $(top_srcdir)/plugins/geanyfunctions.h \ $(top_srcdir)/tagmanager/src/tm_source_file.[ch] \ $(top_srcdir)/tagmanager/src/tm_workspace.[ch] diff --git a/doc/plugins.dox b/doc/plugins.dox index 5e7acd11..1e46d4bb 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -187,14 +187,12 @@ so there is no need to include @a gtk/gtk.h yourself. @note @a plugindata.h contains the biggest part of the plugin API and provides some basic macros. -@a geanyfunctions.h provides some macros for convenient access to plugin API functions. -Then you should define three basic variables which will give access to data fields and -functions provided by the plugin API. +Then you should define two basic variables which will give access to data fields +provided by the plugin API. @code GeanyPlugin *geany_plugin; GeanyData *geany_data; -GeanyFunctions *geany_functions; @endcode Now you can go on and write your first lines for your new plugin. As mentioned before, @@ -363,7 +361,6 @@ Once this is done, your first plugin is ready. Congratulations! GeanyPlugin *geany_plugin; GeanyData *geany_data; -GeanyFunctions *geany_functions; PLUGIN_VERSION_CHECK(211) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index de37f1da..b3324a81 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,22 +1,14 @@ # Adapted from Pidgin's plugins/Makefile.am, thanks EXTRA_DIST = \ - makefile.win32 \ - genapi.py + makefile.win32 plugindir = $(libdir)/geany plugins_includedir = $(includedir)/geany plugins_include_HEADERS = \ - geanyplugin.h \ - geanyfunctions.h - -# systems without python should continue to build OK -geanyfunctions.h: genapi.py ../src/plugins.c - python genapi.py || true - -all: geanyfunctions.h - + geanyfunctions.h \ + geanyplugin.h demoplugin_la_LDFLAGS = -module -avoid-version -no-undefined classbuilder_la_LDFLAGS = -module -avoid-version -no-undefined diff --git a/plugins/geanyfunctions.h b/plugins/geanyfunctions.h index 26a0a28f..aaa2b985 100644 --- a/plugins/geanyfunctions.h +++ b/plugins/geanyfunctions.h @@ -1,448 +1,31 @@ -/* This file is generated automatically by genapi.py - do not edit. */ - -/** @file geanyfunctions.h @ref geany_functions wrappers. - * This allows the use of normal API function names in plugins by defining macros. +/* + * geanyfunctions.h - this file is part of Geany, a fast and lightweight IDE * - * E.g.:@code - * #define plugin_add_toolbar_item \ - * geany_functions->p_plugin->plugin_add_toolbar_item @endcode + * Copyright 2014 Matthew Brush * - * You need to declare the @ref geany_functions symbol yourself. + * 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. * - * Note: This must be included after all other API headers to prevent conflicts with - * other header's function prototypes - this is done for you when using geanyplugin.h. + * 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. */ +/* This file exists purely for backwards compatibility. */ + #ifndef GEANY_FUNCTIONS_H -#define GEANY_FUNCTIONS_H +#define GEANY_FUNCTIONS_H 1 -#define plugin_add_toolbar_item \ - geany_functions->p_plugin->plugin_add_toolbar_item -#define plugin_module_make_resident \ - geany_functions->p_plugin->plugin_module_make_resident -#define plugin_signal_connect \ - geany_functions->p_plugin->plugin_signal_connect -#define plugin_set_key_group \ - geany_functions->p_plugin->plugin_set_key_group -#define plugin_show_configure \ - geany_functions->p_plugin->plugin_show_configure -#define plugin_timeout_add \ - geany_functions->p_plugin->plugin_timeout_add -#define plugin_timeout_add_seconds \ - geany_functions->p_plugin->plugin_timeout_add_seconds -#define plugin_idle_add \ - geany_functions->p_plugin->plugin_idle_add -#define plugin_builder_connect_signals \ - geany_functions->p_plugin->plugin_builder_connect_signals -#define document_new_file \ - geany_functions->p_document->document_new_file -#define document_get_current \ - geany_functions->p_document->document_get_current -#define document_get_from_page \ - geany_functions->p_document->document_get_from_page -#define document_find_by_filename \ - geany_functions->p_document->document_find_by_filename -#define document_find_by_real_path \ - geany_functions->p_document->document_find_by_real_path -#define document_save_file \ - geany_functions->p_document->document_save_file -#define document_open_file \ - geany_functions->p_document->document_open_file -#define document_open_files \ - geany_functions->p_document->document_open_files -#define document_remove_page \ - geany_functions->p_document->document_remove_page -#define document_reload_force \ - geany_functions->p_document->document_reload_force -#define document_set_encoding \ - geany_functions->p_document->document_set_encoding -#define document_set_text_changed \ - geany_functions->p_document->document_set_text_changed -#define document_set_filetype \ - geany_functions->p_document->document_set_filetype -#define document_close \ - geany_functions->p_document->document_close -#define document_index \ - geany_functions->p_document->document_index -#define document_save_file_as \ - geany_functions->p_document->document_save_file_as -#define document_rename_file \ - geany_functions->p_document->document_rename_file -#define document_get_status_color \ - geany_functions->p_document->document_get_status_color -#define document_get_basename_for_display \ - geany_functions->p_document->document_get_basename_for_display -#define document_get_notebook_page \ - geany_functions->p_document->document_get_notebook_page -#define document_compare_by_display_name \ - geany_functions->p_document->document_compare_by_display_name -#define document_compare_by_tab_order \ - geany_functions->p_document->document_compare_by_tab_order -#define document_compare_by_tab_order_reverse \ - geany_functions->p_document->document_compare_by_tab_order_reverse -#define document_find_by_id \ - geany_functions->p_document->document_find_by_id -#define editor_get_indent_prefs \ - geany_functions->p_editor->editor_get_indent_prefs -#define editor_create_widget \ - geany_functions->p_editor->editor_create_widget -#define editor_indicator_set_on_range \ - geany_functions->p_editor->editor_indicator_set_on_range -#define editor_indicator_set_on_line \ - geany_functions->p_editor->editor_indicator_set_on_line -#define editor_indicator_clear \ - geany_functions->p_editor->editor_indicator_clear -#define editor_set_indent_type \ - geany_functions->p_editor->editor_set_indent_type -#define editor_get_word_at_pos \ - geany_functions->p_editor->editor_get_word_at_pos -#define editor_get_eol_char_name \ - geany_functions->p_editor->editor_get_eol_char_name -#define editor_get_eol_char_len \ - geany_functions->p_editor->editor_get_eol_char_len -#define editor_get_eol_char \ - geany_functions->p_editor->editor_get_eol_char -#define editor_insert_text_block \ - geany_functions->p_editor->editor_insert_text_block -#define editor_get_eol_char_mode \ - geany_functions->p_editor->editor_get_eol_char_mode -#define editor_goto_pos \ - geany_functions->p_editor->editor_goto_pos -#define editor_find_snippet \ - geany_functions->p_editor->editor_find_snippet -#define editor_insert_snippet \ - geany_functions->p_editor->editor_insert_snippet -#define scintilla_send_message \ - geany_functions->p_scintilla->scintilla_send_message -#define scintilla_new \ - geany_functions->p_scintilla->scintilla_new -#define sci_send_command \ - geany_functions->p_sci->sci_send_command -#define sci_start_undo_action \ - geany_functions->p_sci->sci_start_undo_action -#define sci_end_undo_action \ - geany_functions->p_sci->sci_end_undo_action -#define sci_set_text \ - geany_functions->p_sci->sci_set_text -#define sci_insert_text \ - geany_functions->p_sci->sci_insert_text -#define sci_get_text \ - geany_functions->p_sci->sci_get_text -#define sci_get_length \ - geany_functions->p_sci->sci_get_length -#define sci_get_current_position \ - geany_functions->p_sci->sci_get_current_position -#define sci_set_current_position \ - geany_functions->p_sci->sci_set_current_position -#define sci_get_col_from_position \ - geany_functions->p_sci->sci_get_col_from_position -#define sci_get_line_from_position \ - geany_functions->p_sci->sci_get_line_from_position -#define sci_get_position_from_line \ - geany_functions->p_sci->sci_get_position_from_line -#define sci_replace_sel \ - geany_functions->p_sci->sci_replace_sel -#define sci_get_selected_text \ - geany_functions->p_sci->sci_get_selected_text -#define sci_get_selected_text_length \ - geany_functions->p_sci->sci_get_selected_text_length -#define sci_get_selection_start \ - geany_functions->p_sci->sci_get_selection_start -#define sci_get_selection_end \ - geany_functions->p_sci->sci_get_selection_end -#define sci_get_selection_mode \ - geany_functions->p_sci->sci_get_selection_mode -#define sci_set_selection_mode \ - geany_functions->p_sci->sci_set_selection_mode -#define sci_set_selection_start \ - geany_functions->p_sci->sci_set_selection_start -#define sci_set_selection_end \ - geany_functions->p_sci->sci_set_selection_end -#define sci_get_text_range \ - geany_functions->p_sci->sci_get_text_range -#define sci_get_line \ - geany_functions->p_sci->sci_get_line -#define sci_get_line_length \ - geany_functions->p_sci->sci_get_line_length -#define sci_get_line_count \ - geany_functions->p_sci->sci_get_line_count -#define sci_get_line_is_visible \ - geany_functions->p_sci->sci_get_line_is_visible -#define sci_ensure_line_is_visible \ - geany_functions->p_sci->sci_ensure_line_is_visible -#define sci_scroll_caret \ - geany_functions->p_sci->sci_scroll_caret -#define sci_find_matching_brace \ - geany_functions->p_sci->sci_find_matching_brace -#define sci_get_style_at \ - geany_functions->p_sci->sci_get_style_at -#define sci_get_char_at \ - geany_functions->p_sci->sci_get_char_at -#define sci_get_current_line \ - geany_functions->p_sci->sci_get_current_line -#define sci_has_selection \ - geany_functions->p_sci->sci_has_selection -#define sci_get_tab_width \ - geany_functions->p_sci->sci_get_tab_width -#define sci_indicator_clear \ - geany_functions->p_sci->sci_indicator_clear -#define sci_indicator_set \ - geany_functions->p_sci->sci_indicator_set -#define sci_get_contents \ - geany_functions->p_sci->sci_get_contents -#define sci_get_contents_range \ - geany_functions->p_sci->sci_get_contents_range -#define sci_get_selection_contents \ - geany_functions->p_sci->sci_get_selection_contents -#define sci_set_font \ - geany_functions->p_sci->sci_set_font -#define sci_get_line_end_position \ - geany_functions->p_sci->sci_get_line_end_position -#define sci_set_target_start \ - geany_functions->p_sci->sci_set_target_start -#define sci_set_target_end \ - geany_functions->p_sci->sci_set_target_end -#define sci_replace_target \ - geany_functions->p_sci->sci_replace_target -#define sci_set_marker_at_line \ - geany_functions->p_sci->sci_set_marker_at_line -#define sci_delete_marker_at_line \ - geany_functions->p_sci->sci_delete_marker_at_line -#define sci_is_marker_set_at_line \ - geany_functions->p_sci->sci_is_marker_set_at_line -#define sci_goto_line \ - geany_functions->p_sci->sci_goto_line -#define sci_find_text \ - geany_functions->p_sci->sci_find_text -#define sci_set_line_indentation \ - geany_functions->p_sci->sci_set_line_indentation -#define sci_get_line_indentation \ - geany_functions->p_sci->sci_get_line_indentation -#define sci_get_lexer \ - geany_functions->p_sci->sci_get_lexer -#define templates_get_template_fileheader \ - geany_functions->p_templates->templates_get_template_fileheader -#define utils_str_equal \ - geany_functions->p_utils->utils_str_equal -#define utils_string_replace_all \ - geany_functions->p_utils->utils_string_replace_all -#define utils_get_file_list \ - geany_functions->p_utils->utils_get_file_list -#define utils_write_file \ - geany_functions->p_utils->utils_write_file -#define utils_get_locale_from_utf8 \ - geany_functions->p_utils->utils_get_locale_from_utf8 -#define utils_get_utf8_from_locale \ - geany_functions->p_utils->utils_get_utf8_from_locale -#define utils_remove_ext_from_filename \ - geany_functions->p_utils->utils_remove_ext_from_filename -#define utils_mkdir \ - geany_functions->p_utils->utils_mkdir -#define utils_get_setting_boolean \ - geany_functions->p_utils->utils_get_setting_boolean -#define utils_get_setting_integer \ - geany_functions->p_utils->utils_get_setting_integer -#define utils_get_setting_string \ - geany_functions->p_utils->utils_get_setting_string -#define utils_spawn_sync \ - geany_functions->p_utils->utils_spawn_sync -#define utils_spawn_async \ - geany_functions->p_utils->utils_spawn_async -#define utils_str_casecmp \ - geany_functions->p_utils->utils_str_casecmp -#define utils_get_date_time \ - geany_functions->p_utils->utils_get_date_time -#define utils_open_browser \ - geany_functions->p_utils->utils_open_browser -#define utils_string_replace_first \ - geany_functions->p_utils->utils_string_replace_first -#define utils_str_middle_truncate \ - geany_functions->p_utils->utils_str_middle_truncate -#define utils_str_remove_chars \ - geany_functions->p_utils->utils_str_remove_chars -#define utils_get_file_list_full \ - geany_functions->p_utils->utils_get_file_list_full -#define utils_copy_environment \ - geany_functions->p_utils->utils_copy_environment -#define utils_find_open_xml_tag \ - geany_functions->p_utils->utils_find_open_xml_tag -#define utils_find_open_xml_tag_pos \ - geany_functions->p_utils->utils_find_open_xml_tag_pos -#define ui_dialog_vbox_new \ - geany_functions->p_ui->ui_dialog_vbox_new -#define ui_frame_new_with_alignment \ - geany_functions->p_ui->ui_frame_new_with_alignment -#define ui_set_statusbar \ - geany_functions->p_ui->ui_set_statusbar -#define ui_table_add_row \ - geany_functions->p_ui->ui_table_add_row -#define ui_path_box_new \ - geany_functions->p_ui->ui_path_box_new -#define ui_button_new_with_image \ - geany_functions->p_ui->ui_button_new_with_image -#define ui_add_document_sensitive \ - geany_functions->p_ui->ui_add_document_sensitive -#define ui_widget_set_tooltip_text \ - geany_functions->p_ui->ui_widget_set_tooltip_text -#define ui_image_menu_item_new \ - geany_functions->p_ui->ui_image_menu_item_new -#define ui_lookup_widget \ - geany_functions->p_ui->ui_lookup_widget -#define ui_progress_bar_start \ - geany_functions->p_ui->ui_progress_bar_start -#define ui_progress_bar_stop \ - geany_functions->p_ui->ui_progress_bar_stop -#define ui_entry_add_clear_icon \ - geany_functions->p_ui->ui_entry_add_clear_icon -#define ui_menu_add_document_items \ - geany_functions->p_ui->ui_menu_add_document_items -#define ui_widget_modify_font_from_string \ - geany_functions->p_ui->ui_widget_modify_font_from_string -#define ui_is_keyval_enter_or_return \ - geany_functions->p_ui->ui_is_keyval_enter_or_return -#define ui_get_gtk_settings_integer \ - geany_functions->p_ui->ui_get_gtk_settings_integer -#define ui_combo_box_add_to_history \ - geany_functions->p_ui->ui_combo_box_add_to_history -#define ui_menu_add_document_items_sorted \ - geany_functions->p_ui->ui_menu_add_document_items_sorted -#define ui_lookup_stock_label \ - geany_functions->p_ui->ui_lookup_stock_label -#define ui_tree_view_set_tooltip_text_column \ - geany_functions->p_ui->ui_tree_view_set_tooltip_text_column -#define dialogs_show_question \ - geany_functions->p_dialogs->dialogs_show_question -#define dialogs_show_msgbox \ - geany_functions->p_dialogs->dialogs_show_msgbox -#define dialogs_show_save_as \ - geany_functions->p_dialogs->dialogs_show_save_as -#define dialogs_show_input_numeric \ - geany_functions->p_dialogs->dialogs_show_input_numeric -#define dialogs_show_input \ - geany_functions->p_dialogs->dialogs_show_input -#define msgwin_status_add \ - geany_functions->p_msgwin->msgwin_status_add -#define msgwin_compiler_add \ - geany_functions->p_msgwin->msgwin_compiler_add -#define msgwin_msg_add \ - geany_functions->p_msgwin->msgwin_msg_add -#define msgwin_clear_tab \ - geany_functions->p_msgwin->msgwin_clear_tab -#define msgwin_switch_tab \ - geany_functions->p_msgwin->msgwin_switch_tab -#define msgwin_set_messages_dir \ - geany_functions->p_msgwin->msgwin_set_messages_dir -#define encodings_convert_to_utf8 \ - geany_functions->p_encodings->encodings_convert_to_utf8 -#define encodings_convert_to_utf8_from_charset \ - geany_functions->p_encodings->encodings_convert_to_utf8_from_charset -#define encodings_get_charset_from_index \ - geany_functions->p_encodings->encodings_get_charset_from_index -#define keybindings_send_command \ - geany_functions->p_keybindings->keybindings_send_command -#define keybindings_set_item \ - geany_functions->p_keybindings->keybindings_set_item -#define keybindings_get_item \ - geany_functions->p_keybindings->keybindings_get_item -#define keybindings_get_modifiers \ - geany_functions->p_keybindings->keybindings_get_modifiers -#define tm_get_real_path \ - geany_functions->p_tm->tm_get_real_path -#define tm_source_file_new \ - geany_functions->p_tm->tm_source_file_new -#define tm_source_file_free \ - geany_functions->p_tm->tm_source_file_free -#define tm_workspace_add_source_file \ - geany_functions->p_tm->tm_workspace_add_source_file -#define tm_workspace_remove_source_file \ - geany_functions->p_tm->tm_workspace_remove_source_file -#define tm_workspace_add_source_files \ - geany_functions->p_tm->tm_workspace_add_source_files -#define tm_workspace_remove_source_files \ - geany_functions->p_tm->tm_workspace_remove_source_files -#define search_show_find_in_files_dialog \ - geany_functions->p_search->search_show_find_in_files_dialog -#define highlighting_get_style \ - geany_functions->p_highlighting->highlighting_get_style -#define highlighting_set_styles \ - geany_functions->p_highlighting->highlighting_set_styles -#define highlighting_is_string_style \ - geany_functions->p_highlighting->highlighting_is_string_style -#define highlighting_is_comment_style \ - geany_functions->p_highlighting->highlighting_is_comment_style -#define highlighting_is_code_style \ - geany_functions->p_highlighting->highlighting_is_code_style -#define filetypes_detect_from_file \ - geany_functions->p_filetypes->filetypes_detect_from_file -#define filetypes_lookup_by_name \ - geany_functions->p_filetypes->filetypes_lookup_by_name -#define filetypes_index \ - geany_functions->p_filetypes->filetypes_index -#define filetypes_get_display_name \ - geany_functions->p_filetypes->filetypes_get_display_name -#define filetypes_get_sorted_by_name \ - geany_functions->p_filetypes->filetypes_get_sorted_by_name -#define navqueue_goto_line \ - geany_functions->p_navqueue->navqueue_goto_line -#define main_reload_configuration \ - geany_functions->p_main->main_reload_configuration -#define main_locale_init \ - geany_functions->p_main->main_locale_init -#define main_is_realized \ - geany_functions->p_main->main_is_realized -#define stash_group_new \ - geany_functions->p_stash->stash_group_new -#define stash_group_add_boolean \ - geany_functions->p_stash->stash_group_add_boolean -#define stash_group_add_integer \ - geany_functions->p_stash->stash_group_add_integer -#define stash_group_add_string \ - geany_functions->p_stash->stash_group_add_string -#define stash_group_add_string_vector \ - geany_functions->p_stash->stash_group_add_string_vector -#define stash_group_load_from_key_file \ - geany_functions->p_stash->stash_group_load_from_key_file -#define stash_group_save_to_key_file \ - geany_functions->p_stash->stash_group_save_to_key_file -#define stash_group_free \ - geany_functions->p_stash->stash_group_free -#define stash_group_load_from_file \ - geany_functions->p_stash->stash_group_load_from_file -#define stash_group_save_to_file \ - geany_functions->p_stash->stash_group_save_to_file -#define stash_group_add_toggle_button \ - geany_functions->p_stash->stash_group_add_toggle_button -#define stash_group_add_radio_buttons \ - geany_functions->p_stash->stash_group_add_radio_buttons -#define stash_group_add_spin_button_integer \ - geany_functions->p_stash->stash_group_add_spin_button_integer -#define stash_group_add_combo_box \ - geany_functions->p_stash->stash_group_add_combo_box -#define stash_group_add_combo_box_entry \ - geany_functions->p_stash->stash_group_add_combo_box_entry -#define stash_group_add_entry \ - geany_functions->p_stash->stash_group_add_entry -#define stash_group_add_widget_property \ - geany_functions->p_stash->stash_group_add_widget_property -#define stash_group_display \ - geany_functions->p_stash->stash_group_display -#define stash_group_update \ - geany_functions->p_stash->stash_group_update -#define stash_group_free_settings \ - geany_functions->p_stash->stash_group_free_settings -#define symbols_get_context_separator \ - geany_functions->p_symbols->symbols_get_context_separator -#define build_activate_menu_item \ - geany_functions->p_build->build_activate_menu_item -#define build_get_current_menu_item \ - geany_functions->p_build->build_get_current_menu_item -#define build_remove_menu_item \ - geany_functions->p_build->build_remove_menu_item -#define build_set_menu_item \ - geany_functions->p_build->build_set_menu_item -#define build_get_group_count \ - geany_functions->p_build->build_get_group_count -#define project_write_config \ - geany_functions->p_project->project_write_config +/* This remains so that older plugins that contain a `GeanyFunctions *geany_functions;` + * variable in their plugin - as was previously required - will still compile + * without changes. */ +typedef struct GeanyFunctionsUndefined GeanyFunctions; -#endif +#endif /* GEANY_FUNCTIONS */ diff --git a/plugins/geanyplugin.h b/plugins/geanyplugin.h index 3df9fd3e..2c5c82ef 100644 --- a/plugins/geanyplugin.h +++ b/plugins/geanyplugin.h @@ -28,27 +28,36 @@ #ifndef GEANY_PLUGIN_H #define GEANY_PLUGIN_H 1 -/* Note: only include headers that define types or macros, not just functions */ +#ifndef HAVE_PLUGINS +# define HAVE_PLUGINS 1 +#endif + +/* Only include public headers here */ #include "app.h" +#include "dialogs.h" #include "document.h" #include "editor.h" #include "encodings.h" #include "filetypes.h" #include "geany.h" +#include "geanyfunctions.h" #include "highlighting.h" #include "keybindings.h" +#include "main.h" #include "msgwindow.h" +#include "navqueue.h" #include "plugindata.h" +#include "pluginutils.h" #include "prefs.h" #include "project.h" +#include "sciwrappers.h" #include "search.h" #include "stash.h" #include "support.h" +#include "symbols.h" #include "templates.h" #include "toolbar.h" #include "ui_utils.h" #include "utils.h" -#include "geanyfunctions.h" - #endif diff --git a/plugins/genapi.py b/plugins/genapi.py deleted file mode 100755 index 5c798f82..00000000 --- a/plugins/genapi.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# genapi.py - this file is part of Geany, a fast and lightweight IDE -# -# Copyright 2008-2011 Nick Treleaven btinternet.com> -# Copyright 2008-2011 Enrico Tröger -# -# 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. -# -# $(Id) - -r""" -Creates macros for each plugin API function pointer, e.g.: - -#define plugin_add_toolbar_item \ - geany_functions->p_plugin->plugin_add_toolbar_item -""" - - -import re -import sys - - -def get_function_names(): - names = [] - filep = open('../src/plugins.c') - while 1: - line = filep.readline() - if line == "": - break - match = re.match("^\t&([a-z][a-z0-9_]+)", line) - if match: - symbol = match.group(1) - if not symbol.endswith('_funcs'): - names.append(symbol) - filep.close() - return names - - -def get_api_tuple(source): - match = re.match("^([a-z]+)_([a-z][a-z0-9_]+)$", source) - return 'p_' + match.group(1), match.group(2) - - -header = \ -r'''/* This file is generated automatically by genapi.py - do not edit. */ - -/** @file %s @ref geany_functions wrappers. - * This allows the use of normal API function names in plugins by defining macros. - * - * E.g.:@code - * #define plugin_add_toolbar_item \ - * geany_functions->p_plugin->plugin_add_toolbar_item @endcode - * - * You need to declare the @ref geany_functions symbol yourself. - * - * Note: This must be included after all other API headers to prevent conflicts with - * other header's function prototypes - this is done for you when using geanyplugin.h. - */ - -#ifndef GEANY_FUNCTIONS_H -#define GEANY_FUNCTIONS_H - -''' - -if __name__ == "__main__": - outfile = 'geanyfunctions.h' - - fnames = get_function_names() - if not fnames: - sys.exit("No function names read!") - - f = open(outfile, 'w') - f.write(header % (outfile)) - - for fname in fnames: - ptr, name = get_api_tuple(fname) - # note: name no longer needed - f.write('#define %s \\\n\tgeany_functions->%s->%s\n' % (fname, ptr, fname)) - - f.write('\n#endif\n') - f.close() - - if not '-q' in sys.argv: - sys.stdout.write('Generated %s\n' % outfile) diff --git a/src/Makefile.am b/src/Makefile.am index a34aadf3..d6302b85 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -67,6 +67,7 @@ geany_includedir = $(includedir)/geany geany_include_HEADERS = \ app.h \ build.h \ + dialogs.h \ document.h \ editor.h \ encodings.h \ @@ -75,13 +76,18 @@ geany_include_HEADERS = \ gtkcompat.h \ highlighting.h \ keybindings.h \ + main.h \ msgwindow.h \ + navqueue.h \ plugindata.h \ + pluginutils.h \ prefs.h \ project.h \ + sciwrappers.h \ search.h \ stash.h \ support.h \ + symbols.h \ templates.h \ toolbar.h \ ui_utils.h \ diff --git a/src/plugindata.h b/src/plugindata.h index 0e944e5d..940c89d7 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -265,496 +265,6 @@ void plugin_cleanup(void); #endif - -/** This contains pointers to functions owned by Geany for plugins to use. - * Functions from the core can be appended when needed by plugin authors, but may - * require some changes. */ -typedef struct GeanyFunctions -{ - struct DocumentFuncs *p_document; /**< See document.h */ - struct SciFuncs *p_sci; /**< See sciwrappers.h */ - struct TemplateFuncs *p_templates; /**< See templates.h */ - struct UtilsFuncs *p_utils; /**< See utils.h */ - struct UIUtilsFuncs *p_ui; /**< See ui_utils.h */ - /** @deprecated Use ui_lookup_widget() instead. */ - struct SupportFuncs *p_support; - struct DialogFuncs *p_dialogs; /**< See dialogs.h */ - /** @deprecated Use @ref GeanyFunctions::p_msgwin instead. */ - struct MsgWinFuncs *p_msgwindow; - struct EncodingFuncs *p_encodings; /**< See encodings.h */ - struct KeybindingFuncs *p_keybindings; /**< See keybindings.h */ - struct TagManagerFuncs *p_tm; /**< See tagmanager/src */ - struct SearchFuncs *p_search; /**< See search.h */ - struct HighlightingFuncs *p_highlighting; /**< See highlighting.h */ - struct FiletypeFuncs *p_filetypes; /**< See filetypes.h */ - struct NavQueueFuncs *p_navqueue; /**< See navqueue.h */ - struct EditorFuncs *p_editor; /**< See editor.h */ - struct MainFuncs *p_main; /**< See main.h */ - struct PluginFuncs *p_plugin; /**< See pluginutils.c */ - struct ScintillaFuncs *p_scintilla; /**< See ScintillaFuncs */ - struct MsgWinFuncs *p_msgwin; /**< See msgwindow.h */ - struct StashFuncs *p_stash; /**< See stash.h */ - struct SymbolsFuncs *p_symbols; /**< See symbols.h */ - struct BuildFuncs *p_build; /**< See build.h */ - struct ProjectFuncs *p_project; /**< See project.h */ -} -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 -{ - struct GeanyDocument* (*document_new_file) (const gchar *utf8_filename, struct GeanyFiletype *ft, - const gchar *text); - struct GeanyDocument* (*document_get_current) (void); - struct GeanyDocument* (*document_get_from_page) (guint page_num); - struct GeanyDocument* (*document_find_by_filename) (const gchar *utf8_filename); - struct GeanyDocument* (*document_find_by_real_path) (const gchar *realname); - gboolean (*document_save_file) (struct GeanyDocument *doc, gboolean force); - struct GeanyDocument* (*document_open_file) (const gchar *locale_filename, gboolean readonly, - struct GeanyFiletype *ft, const gchar *forced_enc); - void (*document_open_files) (const GSList *filenames, gboolean readonly, - struct GeanyFiletype *ft, const gchar *forced_enc); - gboolean (*document_remove_page) (guint page_num); - gboolean (*document_reload_force) (struct GeanyDocument *doc, const gchar *forced_enc); - void (*document_set_encoding) (struct GeanyDocument *doc, const gchar *new_encoding); - void (*document_set_text_changed) (struct GeanyDocument *doc, gboolean changed); - void (*document_set_filetype) (struct GeanyDocument *doc, struct GeanyFiletype *type); - gboolean (*document_close) (struct GeanyDocument *doc); - struct GeanyDocument* (*document_index)(gint idx); - gboolean (*document_save_file_as) (struct GeanyDocument *doc, const gchar *utf8_fname); - void (*document_rename_file) (struct GeanyDocument *doc, const gchar *new_filename); - const GdkColor* (*document_get_status_color) (struct GeanyDocument *doc); - gchar* (*document_get_basename_for_display) (struct GeanyDocument *doc, gint length); - gint (*document_get_notebook_page) (struct GeanyDocument *doc); - gint (*document_compare_by_display_name) (gconstpointer a, gconstpointer b); - gint (*document_compare_by_tab_order) (gconstpointer a, gconstpointer b); - gint (*document_compare_by_tab_order_reverse) (gconstpointer a, gconstpointer b); - GeanyDocument* (*document_find_by_id)(guint id); -} -DocumentFuncs; - - -struct _ScintillaObject; - -/** See http://scintilla.org for the full documentation. */ -typedef struct ScintillaFuncs -{ - /** Send Scintilla a message. */ - long int (*scintilla_send_message) (struct _ScintillaObject *sci, unsigned int iMessage, - long unsigned int wParam, long int lParam); - /** Create a new ScintillaObject widget. */ - GtkWidget* (*scintilla_new)(void); -} -ScintillaFuncs; - - -/** Wrapper functions for Scintilla messages. - * See sciwrappers.h for the list of functions. */ -typedef struct SciFuncs -{ - /** @deprecated Use @c scintilla_send_message() instead. */ - long int (*sci_send_message) (struct _ScintillaObject *sci, unsigned int iMessage, - long unsigned int wParam, long int lParam); - void (*sci_send_command) (struct _ScintillaObject *sci, gint cmd); - - void (*sci_start_undo_action) (struct _ScintillaObject *sci); - void (*sci_end_undo_action) (struct _ScintillaObject *sci); - void (*sci_set_text) (struct _ScintillaObject *sci, const gchar *text); - void (*sci_insert_text) (struct _ScintillaObject *sci, gint pos, const gchar *text); - void (*sci_get_text) (struct _ScintillaObject *sci, gint len, gchar *text); - gint (*sci_get_length) (struct _ScintillaObject *sci); - gint (*sci_get_current_position) (struct _ScintillaObject *sci); - void (*sci_set_current_position) (struct _ScintillaObject *sci, gint position, - gboolean scroll_to_caret); - gint (*sci_get_col_from_position) (struct _ScintillaObject *sci, gint position); - gint (*sci_get_line_from_position) (struct _ScintillaObject *sci, gint position); - gint (*sci_get_position_from_line) (struct _ScintillaObject *sci, gint line); - void (*sci_replace_sel) (struct _ScintillaObject *sci, const gchar *text); - void (*sci_get_selected_text) (struct _ScintillaObject *sci, gchar *text); - gint (*sci_get_selected_text_length) (struct _ScintillaObject *sci); - gint (*sci_get_selection_start) (struct _ScintillaObject *sci); - gint (*sci_get_selection_end) (struct _ScintillaObject *sci); - gint (*sci_get_selection_mode) (struct _ScintillaObject *sci); - void (*sci_set_selection_mode) (struct _ScintillaObject *sci, gint mode); - void (*sci_set_selection_start) (struct _ScintillaObject *sci, gint position); - void (*sci_set_selection_end) (struct _ScintillaObject *sci, gint position); - void (*sci_get_text_range) (struct _ScintillaObject *sci, gint start, gint end, gchar *text); - gchar* (*sci_get_line) (struct _ScintillaObject *sci, gint line_num); - gint (*sci_get_line_length) (struct _ScintillaObject *sci, gint line); - gint (*sci_get_line_count) (struct _ScintillaObject *sci); - gboolean (*sci_get_line_is_visible) (struct _ScintillaObject *sci, gint line); - void (*sci_ensure_line_is_visible) (struct _ScintillaObject *sci, gint line); - void (*sci_scroll_caret) (struct _ScintillaObject *sci); - gint (*sci_find_matching_brace) (struct _ScintillaObject *sci, gint pos); - gint (*sci_get_style_at) (struct _ScintillaObject *sci, gint position); - gchar (*sci_get_char_at) (struct _ScintillaObject *sci, gint pos); - gint (*sci_get_current_line) (struct _ScintillaObject *sci); - gboolean (*sci_has_selection) (struct _ScintillaObject *sci); - gint (*sci_get_tab_width) (struct _ScintillaObject *sci); - void (*sci_indicator_clear) (struct _ScintillaObject *sci, gint start, gint end); - void (*sci_indicator_set) (struct _ScintillaObject *sci, gint indic); - gchar* (*sci_get_contents) (struct _ScintillaObject *sci, gint len); - gchar* (*sci_get_contents_range) (struct _ScintillaObject *sci, gint start, gint end); - gchar* (*sci_get_selection_contents) (struct _ScintillaObject *sci); - void (*sci_set_font) (struct _ScintillaObject *sci, gint style, const gchar *font, gint size); - gint (*sci_get_line_end_position) (struct _ScintillaObject *sci, gint line); - void (*sci_set_target_start) (struct _ScintillaObject *sci, gint start); - void (*sci_set_target_end) (struct _ScintillaObject *sci, gint end); - gint (*sci_replace_target) (struct _ScintillaObject *sci, const gchar *text, gboolean regex); - void (*sci_set_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker); - void (*sci_delete_marker_at_line) (struct _ScintillaObject *sci, gint line_number, gint marker); - gboolean (*sci_is_marker_set_at_line) (struct _ScintillaObject *sci, gint line, gint marker); - void (*sci_goto_line) (struct _ScintillaObject *sci, gint line, gboolean unfold); - gint (*sci_find_text) (struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf); - void (*sci_set_line_indentation) (struct _ScintillaObject *sci, gint line, gint indent); - gint (*sci_get_line_indentation) (struct _ScintillaObject *sci, gint line); - gint (*sci_get_lexer) (struct _ScintillaObject *sci); -} -SciFuncs; - - -/* See templates.h */ -typedef struct TemplateFuncs -{ - gchar* (*templates_get_template_fileheader) (gint filetype_idx, const gchar *fname); -} -TemplateFuncs; - - -/* See utils.h */ -typedef struct UtilsFuncs -{ - gboolean (*utils_str_equal) (const gchar *a, const gchar *b); - guint (*utils_string_replace_all) (GString *haystack, const gchar *needle, - const gchar *replacement); - GSList* (*utils_get_file_list) (const gchar *path, guint *length, GError **error); - gint (*utils_write_file) (const gchar *filename, const gchar *text); - gchar* (*utils_get_locale_from_utf8) (const gchar *utf8_text); - gchar* (*utils_get_utf8_from_locale) (const gchar *locale_text); - gchar* (*utils_remove_ext_from_filename) (const gchar *filename); - gint (*utils_mkdir) (const gchar *path, gboolean create_parent_dirs); - gboolean (*utils_get_setting_boolean) (GKeyFile *config, const gchar *section, const gchar *key, - const gboolean default_value); - gint (*utils_get_setting_integer) (GKeyFile *config, const gchar *section, const gchar *key, - const gint default_value); - gchar* (*utils_get_setting_string) (GKeyFile *config, const gchar *section, const gchar *key, - const gchar *default_value); - gboolean (*utils_spawn_sync) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, gpointer user_data, gchar **std_out, - gchar **std_err, gint *exit_status, GError **error); - gboolean (*utils_spawn_async) (const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, gpointer user_data, GPid *child_pid, - GError **error); - gint (*utils_str_casecmp) (const gchar *s1, const gchar *s2); - gchar* (*utils_get_date_time) (const gchar *format, time_t *time_to_use); - void (*utils_open_browser) (const gchar *uri); - guint (*utils_string_replace_first) (GString *haystack, const gchar *needle, - const gchar *replace); - gchar* (*utils_str_middle_truncate) (const gchar *string, guint truncate_length); - gchar* (*utils_str_remove_chars) (gchar *string, const gchar *chars); - GSList* (*utils_get_file_list_full)(const gchar *path, gboolean full_path, gboolean sort, - GError **error); - gchar** (*utils_copy_environment)(const gchar **exclude_vars, const gchar *first_varname, ...); - gchar* (*utils_find_open_xml_tag) (const gchar sel[], gint size); - const gchar* (*utils_find_open_xml_tag_pos) (const gchar sel[], gint size); -} -UtilsFuncs; - - -/* See main.h */ -typedef struct MainFuncs -{ - void (*main_reload_configuration) (void); - void (*main_locale_init) (const gchar *locale_dir, const gchar *package); - gboolean (*main_is_realized) (void); -} -MainFuncs; - - -/* See ui_utils.h */ -typedef struct UIUtilsFuncs -{ - GtkWidget* (*ui_dialog_vbox_new) (GtkDialog *dialog); - GtkWidget* (*ui_frame_new_with_alignment) (const gchar *label_text, GtkWidget **alignment); - void (*ui_set_statusbar) (gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3); - void (*ui_table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED; - GtkWidget* (*ui_path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry); - GtkWidget* (*ui_button_new_with_image) (const gchar *stock_id, const gchar *text); - void (*ui_add_document_sensitive) (GtkWidget *widget); - void (*ui_widget_set_tooltip_text) (GtkWidget *widget, const gchar *text); - GtkWidget* (*ui_image_menu_item_new) (const gchar *stock_id, const gchar *label); - GtkWidget* (*ui_lookup_widget) (GtkWidget *widget, const gchar *widget_name); - void (*ui_progress_bar_start) (const gchar *text); - void (*ui_progress_bar_stop) (void); - void (*ui_entry_add_clear_icon) (GtkEntry *entry); - void (*ui_menu_add_document_items) (GtkMenu *menu, struct GeanyDocument *active, - GCallback callback); - void (*ui_widget_modify_font_from_string) (GtkWidget *widget, const gchar *str); - gboolean (*ui_is_keyval_enter_or_return) (guint keyval); - gint (*ui_get_gtk_settings_integer) (const gchar *property_name, gint default_value); - void (*ui_combo_box_add_to_history) (GtkComboBoxText *combo_entry, - const gchar *text, gint history_len); - void (*ui_menu_add_document_items_sorted) (GtkMenu *menu, struct GeanyDocument *active, - GCallback callback, GCompareFunc compare_func); - const gchar* (*ui_lookup_stock_label)(const gchar *stock_id); - void (*ui_tree_view_set_tooltip_text_column) (GtkTreeView *tree_view, gint column); -} -UIUtilsFuncs; - - -/* See dialogs.h */ -typedef struct DialogFuncs -{ - gboolean (*dialogs_show_question) (const gchar *text, ...) G_GNUC_PRINTF (1, 2); - void (*dialogs_show_msgbox) (GtkMessageType type, const gchar *text, ...) G_GNUC_PRINTF (2, 3); - gboolean (*dialogs_show_save_as) (void); - gboolean (*dialogs_show_input_numeric) (const gchar *title, const gchar *label_text, - gdouble *value, gdouble min, gdouble max, gdouble step); - gchar* (*dialogs_show_input)(const gchar *title, GtkWindow *parent, const gchar *label_text, - const gchar *default_text); -} -DialogFuncs; - - -/* @deprecated Use ui_lookup_widget() instead. */ -typedef struct SupportFuncs -{ - GtkWidget* (*support_lookup_widget) (GtkWidget *widget, const gchar *widget_name); -} -SupportFuncs; - - -/* See msgwindow.h */ -typedef struct MsgWinFuncs -{ - /* status_add() does not set the status bar - use ui->set_statusbar() instead. */ - void (*msgwin_status_add) (const gchar *format, ...) G_GNUC_PRINTF (1, 2); - void (*msgwin_compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3); - void (*msgwin_msg_add) (gint msg_color, gint line, struct GeanyDocument *doc, - const gchar *format, ...) G_GNUC_PRINTF (4, 5); - void (*msgwin_clear_tab) (gint tabnum); - void (*msgwin_switch_tab) (gint tabnum, gboolean show); - void (*msgwin_set_messages_dir) (const gchar *messages_dir); -} -MsgWinFuncs; - - -/* See encodings.h */ -typedef struct EncodingFuncs -{ - gchar* (*encodings_convert_to_utf8) (const gchar *buffer, gssize size, gchar **used_encoding); - gchar* (*encodings_convert_to_utf8_from_charset) (const gchar *buffer, gssize size, - const gchar *charset, gboolean fast); - const gchar* (*encodings_get_charset_from_index) (gint idx); -} -EncodingFuncs; - - -struct GeanyKeyGroup; -/* avoid including keybindings.h */ -typedef void (*_GeanyKeyCallback) (guint key_id); - -/* See keybindings.h */ -typedef struct KeybindingFuncs -{ - void (*keybindings_send_command) (guint group_id, guint key_id); - struct GeanyKeyBinding* (*keybindings_set_item) (struct GeanyKeyGroup *group, gsize key_id, - _GeanyKeyCallback callback, guint key, GdkModifierType mod, - const gchar *name, const gchar *label, GtkWidget *menu_item); - struct GeanyKeyBinding* (*keybindings_get_item)(struct GeanyKeyGroup *group, gsize key_id); - GdkModifierType (*keybindings_get_modifiers)(GdkModifierType mods); -} -KeybindingFuncs; - - -/* See highlighting.h */ -typedef struct HighlightingFuncs -{ - const struct GeanyLexerStyle* (*highlighting_get_style) (gint ft_id, gint style_id); - void (*highlighting_set_styles) (struct _ScintillaObject *sci, struct GeanyFiletype *ft); - gboolean (*highlighting_is_string_style) (gint lexer, gint style); - gboolean (*highlighting_is_comment_style) (gint lexer, gint style); - gboolean (*highlighting_is_code_style) (gint lexer, gint style); -} -HighlightingFuncs; - - -/* See filetypes.h */ -typedef struct FiletypeFuncs -{ - GeanyFiletype* (*filetypes_detect_from_file) (const gchar *utf8_filename); - GeanyFiletype* (*filetypes_lookup_by_name) (const gchar *name); - GeanyFiletype* (*filetypes_index)(gint idx); - const gchar* (*filetypes_get_display_name)(GeanyFiletype *ft); - const GSList* (*filetypes_get_sorted_by_name)(void); - /* Remember to convert any filetype_id arguments to GeanyFiletype pointers in any - * appended functions */ -} -FiletypeFuncs; - - -/* See search.h */ -typedef struct SearchFuncs -{ - void (*search_show_find_in_files_dialog) (const gchar *dir); -} -SearchFuncs; - - -/* See tagmanager/include */ -typedef struct TagManagerFuncs -{ - gchar* (*tm_get_real_path) (const gchar *file_name); - TMSourceFile* (*tm_source_file_new) (const char *file_name, const char *name); - void (*tm_source_file_free) (TMSourceFile *source_file); - void (*tm_workspace_add_source_file) (TMSourceFile *source_file); - void (*tm_workspace_remove_source_file) (TMSourceFile *source_file); - void (*tm_workspace_add_source_files) (GPtrArray *source_files); - void (*tm_workspace_remove_source_files) (GPtrArray *source_files); -} -TagManagerFuncs; - - -/* See navqueue.h */ -typedef struct NavQueueFuncs -{ - gboolean (*navqueue_goto_line) (struct GeanyDocument *old_doc, struct GeanyDocument *new_doc, - gint line); -} -NavQueueFuncs; - - -struct GeanyEditor; - -/* See editor.h */ -typedef struct EditorFuncs -{ - const struct GeanyIndentPrefs* (*editor_get_indent_prefs)(struct GeanyEditor *editor); - struct _ScintillaObject* (*editor_create_widget)(struct GeanyEditor *editor); - - void (*editor_indicator_set_on_range) (struct GeanyEditor *editor, gint indic, gint start, gint end); - void (*editor_indicator_set_on_line) (struct GeanyEditor *editor, gint indic, gint line); - void (*editor_indicator_clear) (struct GeanyEditor *editor, gint indic); - - void (*editor_set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type); - gchar* (*editor_get_word_at_pos) (struct GeanyEditor *editor, gint pos, const gchar *wordchars); - - const gchar* (*editor_get_eol_char_name) (struct GeanyEditor *editor); - gint (*editor_get_eol_char_len) (struct GeanyEditor *editor); - const gchar* (*editor_get_eol_char) (struct GeanyEditor *editor); - - void (*editor_insert_text_block) (struct GeanyEditor *editor, const gchar *text, - gint insert_pos, gint cursor_index, gint newline_indent_size, - gboolean replace_newlines); - - gint (*editor_get_eol_char_mode) (struct GeanyEditor *editor); - gboolean (*editor_goto_pos) (struct GeanyEditor *editor, gint pos, gboolean mark); - - const gchar* (*editor_find_snippet) (struct GeanyEditor *editor, const gchar *snippet_name); - void (*editor_insert_snippet) (struct GeanyEditor *editor, gint pos, const gchar *snippet); -} -EditorFuncs; - - -/* avoid including keybindings.h */ -typedef gboolean (*_GeanyKeyGroupCallback) (guint key_id); - -/* See pluginutils.c */ -typedef struct PluginFuncs -{ - void (*plugin_add_toolbar_item)(GeanyPlugin *plugin, GtkToolItem *item); - void (*plugin_module_make_resident) (GeanyPlugin *plugin); - void (*plugin_signal_connect) (GeanyPlugin *plugin, - GObject *object, const gchar *signal_name, gboolean after, - GCallback callback, gpointer user_data); - struct GeanyKeyGroup* (*plugin_set_key_group)(GeanyPlugin *plugin, - const gchar *section_name, gsize count, _GeanyKeyGroupCallback callback); - void (*plugin_show_configure)(GeanyPlugin *plugin); - guint (*plugin_timeout_add) (GeanyPlugin *plugin, guint interval, GSourceFunc function, - gpointer data); - guint (*plugin_timeout_add_seconds) (GeanyPlugin *plugin, guint interval, - GSourceFunc function, gpointer data); - guint (*plugin_idle_add) (GeanyPlugin *plugin, GSourceFunc function, gpointer data); - void (*plugin_builder_connect_signals) (GeanyPlugin *plugin, GtkBuilder *builder, gpointer user_data); -} -PluginFuncs; - - -struct StashGroup; - -/* See stash.h */ -typedef struct StashFuncs -{ - struct StashGroup *(*stash_group_new)(const gchar *name); - void (*stash_group_add_boolean)(struct StashGroup *group, gboolean *setting, - const gchar *key_name, gboolean default_value); - void (*stash_group_add_integer)(struct StashGroup *group, gint *setting, - const gchar *key_name, gint default_value); - void (*stash_group_add_string)(struct StashGroup *group, gchar **setting, - const gchar *key_name, const gchar *default_value); - void (*stash_group_add_string_vector)(struct StashGroup *group, gchar ***setting, - const gchar *key_name, const gchar **default_value); - void (*stash_group_load_from_key_file)(struct StashGroup *group, GKeyFile *keyfile); - void (*stash_group_save_to_key_file)(struct StashGroup *group, GKeyFile *keyfile); - void (*stash_group_free)(struct StashGroup *group); - gboolean (*stash_group_load_from_file)(struct StashGroup *group, const gchar *filename); - gint (*stash_group_save_to_file)(struct StashGroup *group, const gchar *filename, - GKeyFileFlags flags); - void (*stash_group_add_toggle_button)(struct StashGroup *group, gboolean *setting, - const gchar *key_name, gboolean default_value, gconstpointer widget_id); - void (*stash_group_add_radio_buttons)(struct StashGroup *group, gint *setting, - const gchar *key_name, gint default_value, - gconstpointer widget_id, gint enum_id, ...) G_GNUC_NULL_TERMINATED; - void (*stash_group_add_spin_button_integer)(struct StashGroup *group, gint *setting, - const gchar *key_name, gint default_value, gconstpointer widget_id); - void (*stash_group_add_combo_box)(struct StashGroup *group, gint *setting, - const gchar *key_name, gint default_value, gconstpointer widget_id); - void (*stash_group_add_combo_box_entry)(struct StashGroup *group, gchar **setting, - const gchar *key_name, const gchar *default_value, gconstpointer widget_id); - void (*stash_group_add_entry)(struct StashGroup *group, gchar **setting, - const gchar *key_name, const gchar *default_value, gconstpointer widget_id); - void (*stash_group_add_widget_property)(struct StashGroup *group, gpointer setting, - const gchar *key_name, gpointer default_value, gconstpointer widget_id, - const gchar *property_name, GType type); - void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner); - void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner); - void (*stash_group_free_settings)(struct StashGroup *group); -} -StashFuncs; - - -/* See symbols.h */ -typedef struct SymbolsFuncs -{ - const gchar* (*symbols_get_context_separator)(gint ft_id); -} -SymbolsFuncs; - -/* See build.h */ -typedef struct BuildFuncs -{ - void (*build_activate_menu_item)(const GeanyBuildGroup grp, const guint cmd); - const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd, - const GeanyBuildCmdEntries field); - void (*build_remove_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp, - const gint cmd); - void (*build_set_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp, - const guint cmd, const GeanyBuildCmdEntries field, const gchar *value); - guint (*build_get_group_count)(const GeanyBuildGroup grp); -} -BuildFuncs; - -/* See project.h */ -typedef struct ProjectFuncs -{ - void (*project_write_config)(void); -} -ProjectFuncs; - /* Deprecated aliases */ #ifndef GEANY_DISABLE_DEPRECATED diff --git a/src/plugins.c b/src/plugins.c index 385de11a..3b724ac0 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -75,326 +75,6 @@ static GtkWidget *menu_separator = NULL; static gchar *get_plugin_path(void); static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data); - -static PluginFuncs plugin_funcs = { - &plugin_add_toolbar_item, - &plugin_module_make_resident, - &plugin_signal_connect, - &plugin_set_key_group, - &plugin_show_configure, - &plugin_timeout_add, - &plugin_timeout_add_seconds, - &plugin_idle_add, - &plugin_builder_connect_signals -}; - -static DocumentFuncs doc_funcs = { - &document_new_file, - &document_get_current, - &document_get_from_page, - &document_find_by_filename, - &document_find_by_real_path, - &document_save_file, - &document_open_file, - &document_open_files, - &document_remove_page, - &document_reload_force, - &document_set_encoding, - &document_set_text_changed, - &document_set_filetype, - &document_close, - &document_index, - &document_save_file_as, - &document_rename_file, - &document_get_status_color, - &document_get_basename_for_display, - &document_get_notebook_page, - &document_compare_by_display_name, - &document_compare_by_tab_order, - &document_compare_by_tab_order_reverse, - &document_find_by_id -}; - -static EditorFuncs editor_funcs = { - &editor_get_indent_prefs, - &editor_create_widget, - &editor_indicator_set_on_range, - &editor_indicator_set_on_line, - &editor_indicator_clear, - &editor_set_indent_type, - &editor_get_word_at_pos, - &editor_get_eol_char_name, - &editor_get_eol_char_len, - &editor_get_eol_char, - &editor_insert_text_block, - &editor_get_eol_char_mode, - &editor_goto_pos, - &editor_find_snippet, - &editor_insert_snippet -}; - -static ScintillaFuncs scintilla_funcs = { - &scintilla_send_message, - &scintilla_new -}; - -/* Macro to prevent a duplicate macro being generated in geanyfunctions.h */ -#define _scintilla_send_message_macro scintilla_send_message - -static SciFuncs sci_funcs = { - &_scintilla_send_message_macro, - &sci_send_command, - &sci_start_undo_action, - &sci_end_undo_action, - &sci_set_text, - &sci_insert_text, - &sci_get_text, - &sci_get_length, - &sci_get_current_position, - &sci_set_current_position, - &sci_get_col_from_position, - &sci_get_line_from_position, - &sci_get_position_from_line, - &sci_replace_sel, - &sci_get_selected_text, - &sci_get_selected_text_length, - &sci_get_selection_start, - &sci_get_selection_end, - &sci_get_selection_mode, - &sci_set_selection_mode, - &sci_set_selection_start, - &sci_set_selection_end, - &sci_get_text_range, - &sci_get_line, - &sci_get_line_length, - &sci_get_line_count, - &sci_get_line_is_visible, - &sci_ensure_line_is_visible, - &sci_scroll_caret, - &sci_find_matching_brace, - &sci_get_style_at, - &sci_get_char_at, - &sci_get_current_line, - &sci_has_selection, - &sci_get_tab_width, - &sci_indicator_clear, - &sci_indicator_set, - &sci_get_contents, - &sci_get_contents_range, - &sci_get_selection_contents, - &sci_set_font, - &sci_get_line_end_position, - &sci_set_target_start, - &sci_set_target_end, - &sci_replace_target, - &sci_set_marker_at_line, - &sci_delete_marker_at_line, - &sci_is_marker_set_at_line, - &sci_goto_line, - &sci_find_text, - &sci_set_line_indentation, - &sci_get_line_indentation, - &sci_get_lexer -}; - -static TemplateFuncs template_funcs = { - &templates_get_template_fileheader -}; - -static UtilsFuncs utils_funcs = { - &utils_str_equal, - &utils_string_replace_all, - &utils_get_file_list, - &utils_write_file, - &utils_get_locale_from_utf8, - &utils_get_utf8_from_locale, - &utils_remove_ext_from_filename, - &utils_mkdir, - &utils_get_setting_boolean, - &utils_get_setting_integer, - &utils_get_setting_string, - &utils_spawn_sync, - &utils_spawn_async, - &utils_str_casecmp, - &utils_get_date_time, - &utils_open_browser, - &utils_string_replace_first, - &utils_str_middle_truncate, - &utils_str_remove_chars, - &utils_get_file_list_full, - &utils_copy_environment, - &utils_find_open_xml_tag, - &utils_find_open_xml_tag_pos -}; - -static UIUtilsFuncs uiutils_funcs = { - &ui_dialog_vbox_new, - &ui_frame_new_with_alignment, - &ui_set_statusbar, - &ui_table_add_row, - &ui_path_box_new, - &ui_button_new_with_image, - &ui_add_document_sensitive, - &ui_widget_set_tooltip_text, - &ui_image_menu_item_new, - &ui_lookup_widget, - &ui_progress_bar_start, - &ui_progress_bar_stop, - &ui_entry_add_clear_icon, - &ui_menu_add_document_items, - &ui_widget_modify_font_from_string, - &ui_is_keyval_enter_or_return, - &ui_get_gtk_settings_integer, - &ui_combo_box_add_to_history, - &ui_menu_add_document_items_sorted, - &ui_lookup_stock_label, - &ui_tree_view_set_tooltip_text_column -}; - -static DialogFuncs dialog_funcs = { - &dialogs_show_question, - &dialogs_show_msgbox, - &dialogs_show_save_as, - &dialogs_show_input_numeric, - &dialogs_show_input -}; - -/* Macro to prevent confusing macro being generated in geanyfunctions.h */ -#define _lookup_widget_macro ui_lookup_widget - -/* deprecated */ -static SupportFuncs support_funcs = { - &_lookup_widget_macro -}; - -static MsgWinFuncs msgwin_funcs = { - &msgwin_status_add, - &msgwin_compiler_add, - &msgwin_msg_add, - &msgwin_clear_tab, - &msgwin_switch_tab, - &msgwin_set_messages_dir -}; - -static EncodingFuncs encoding_funcs = { - &encodings_convert_to_utf8, - &encodings_convert_to_utf8_from_charset, - &encodings_get_charset_from_index -}; - -static KeybindingFuncs keybindings_funcs = { - &keybindings_send_command, - &keybindings_set_item, - &keybindings_get_item, - &keybindings_get_modifiers -}; - -static TagManagerFuncs tagmanager_funcs = { - &tm_get_real_path, - &tm_source_file_new, - &tm_source_file_free, - &tm_workspace_add_source_file, - &tm_workspace_remove_source_file, - &tm_workspace_add_source_files, - &tm_workspace_remove_source_files -}; - -static SearchFuncs search_funcs = { - &search_show_find_in_files_dialog -}; - -static HighlightingFuncs highlighting_funcs = { - &highlighting_get_style, - &highlighting_set_styles, - &highlighting_is_string_style, - &highlighting_is_comment_style, - &highlighting_is_code_style -}; - -static FiletypeFuncs filetype_funcs = { - &filetypes_detect_from_file, - &filetypes_lookup_by_name, - &filetypes_index, - &filetypes_get_display_name, - &filetypes_get_sorted_by_name -}; - -static NavQueueFuncs navqueue_funcs = { - &navqueue_goto_line -}; - -static MainFuncs main_funcs = { - &main_reload_configuration, - &main_locale_init, - &main_is_realized -}; - -static StashFuncs stash_funcs = { - &stash_group_new, - &stash_group_add_boolean, - &stash_group_add_integer, - &stash_group_add_string, - &stash_group_add_string_vector, - &stash_group_load_from_key_file, - &stash_group_save_to_key_file, - &stash_group_free, - &stash_group_load_from_file, - &stash_group_save_to_file, - &stash_group_add_toggle_button, - &stash_group_add_radio_buttons, - &stash_group_add_spin_button_integer, - &stash_group_add_combo_box, - &stash_group_add_combo_box_entry, - &stash_group_add_entry, - &stash_group_add_widget_property, - &stash_group_display, - &stash_group_update, - &stash_group_free_settings -}; - -static SymbolsFuncs symbols_funcs = { - &symbols_get_context_separator -}; - -static BuildFuncs build_funcs = { - &build_activate_menu_item, - &build_get_current_menu_item, - &build_remove_menu_item, - &build_set_menu_item, - &build_get_group_count -}; - -static ProjectFuncs project_funcs = { - &project_write_config -}; - -static GeanyFunctions geany_functions = { - &doc_funcs, - &sci_funcs, - &template_funcs, - &utils_funcs, - &uiutils_funcs, - &support_funcs, - &dialog_funcs, - &msgwin_funcs, - &encoding_funcs, - &keybindings_funcs, - &tagmanager_funcs, - &search_funcs, - &highlighting_funcs, - &filetype_funcs, - &navqueue_funcs, - &editor_funcs, - &main_funcs, - &plugin_funcs, - &scintilla_funcs, - &msgwin_funcs, - &stash_funcs, - &symbols_funcs, - &build_funcs, - &project_funcs -}; - static GeanyData geany_data; @@ -598,7 +278,7 @@ plugin_load(Plugin *plugin) PluginFields **plugin_fields; /* set these symbols before plugin_init() is called - * we don't set geany_functions and geany_data since they are set directly by plugin_new() */ + * we don't set geany_data since it is set directly by plugin_new() */ g_module_symbol(plugin->module, "geany_plugin", (void *) &p_geany_plugin); if (p_geany_plugin) *p_geany_plugin = &plugin->public; @@ -663,7 +343,6 @@ plugin_new(const gchar *fname, gboolean load_plugin, gboolean add_to_list) Plugin *plugin; GModule *module; GeanyData **p_geany_data; - GeanyFunctions **p_geany_functions; void (*plugin_set_info)(PluginInfo*); g_return_val_if_fail(fname, NULL); @@ -731,9 +410,6 @@ plugin_new(const gchar *fname, gboolean load_plugin, gboolean add_to_list) g_module_symbol(module, "geany_data", (void *) &p_geany_data); if (p_geany_data) *p_geany_data = &geany_data; - g_module_symbol(module, "geany_functions", (void *) &p_geany_functions); - if (p_geany_functions) - *p_geany_functions = &geany_functions; /* read plugin name, etc. */ plugin_set_info(&plugin->info); From d33758da926ca124db674240c431b8b07bb0e683 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 19:29:36 -0700 Subject: [PATCH 06/40] Move Geany's core into a library (libgeany) This will allow plugins to link against the core when accessing API functions, now that the macro/struct/funcptr stuff is gone. Also convert the helper libraries into Libtool helper libraries as linking a shared library against static libraries is (apparently) not portable. --- configure.ac | 3 - geany.pc.in | 2 +- plugins/Makefile.am | 15 +- po/POTFILES.in | 2 +- scintilla/Makefile.am | 7 +- src/Makefile.am | 45 +- src/libmain.c | 1406 ++++++++++++++++++++++++++++++++++ src/main.c | 1385 +-------------------------------- src/main.h | 2 + tagmanager/ctags/Makefile.am | 7 +- tagmanager/mio/Makefile.am | 6 +- tagmanager/src/Makefile.am | 7 +- 12 files changed, 1462 insertions(+), 1425 deletions(-) create mode 100644 src/libmain.c diff --git a/configure.ac b/configure.ac index 2b828bb5..8d8ee6b9 100644 --- a/configure.ac +++ b/configure.ac @@ -122,9 +122,6 @@ AC_SUBST([pkgdatadir]) GEANY_CHECK_DOCUTILS GEANY_CHECK_DOXYGEN -#FIXME: replace this with a real check that the compiler supports the argument -CFLAGS="${CFLAGS} -fvisibility=hidden" - # Output AC_CONFIG_FILES([ Makefile diff --git a/geany.pc.in b/geany.pc.in index 3556d58a..3ff76f6c 100644 --- a/geany.pc.in +++ b/geany.pc.in @@ -10,5 +10,5 @@ Name: Geany Description: A fast and lightweight IDE using GTK2 Requires: @DEPENDENCIES@ Version: @VERSION@ -Libs: -L${libdir} +Libs: -L${libdir} -lgeany Cflags: -DGTK -I${includedir}/geany -I${includedir}/geany/tagmanager -I${includedir}/geany/scintilla diff --git a/plugins/Makefile.am b/plugins/Makefile.am index b3324a81..6daac80a 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -19,7 +19,6 @@ filebrowser_la_LDFLAGS = -module -avoid-version -no-undefined splitwindow_la_LDFLAGS = -module -avoid-version -no-undefined if PLUGINS - # Plugins to be installed plugin_LTLIBRARIES = \ classbuilder.la \ @@ -49,13 +48,13 @@ saveactions_la_CFLAGS = -DG_LOG_DOMAIN=\""SaveActions"\" filebrowser_la_CFLAGS = -DG_LOG_DOMAIN=\""FileBrowser"\" splitwindow_la_CFLAGS = -DG_LOG_DOMAIN=\""SplitWindow"\" -demoplugin_la_LIBADD = $(GTK_LIBS) -classbuilder_la_LIBADD = $(GTK_LIBS) -htmlchars_la_LIBADD = $(GTK_LIBS) -export_la_LIBADD = $(GTK_LIBS) -lm -saveactions_la_LIBADD = $(GTK_LIBS) -filebrowser_la_LIBADD = $(GTK_LIBS) -splitwindow_la_LIBADD = $(GTK_LIBS) +demoplugin_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) +classbuilder_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) +htmlchars_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) +export_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) -lm +saveactions_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) +filebrowser_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) +splitwindow_la_LIBADD = $(top_builddir)/src/libgeany.la $(GTK_LIBS) endif # PLUGINS diff --git a/po/POTFILES.in b/po/POTFILES.in index bea1d8c8..5d934d43 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -16,8 +16,8 @@ src/geanyentryaction.c src/highlighting.c src/keybindings.c src/keyfile.c +src/libmain.c src/log.c -src/main.c src/msgwindow.c src/navqueue.c src/notebook.c diff --git a/scintilla/Makefile.am b/scintilla/Makefile.am index 0fac9a42..cf2377a2 100644 --- a/scintilla/Makefile.am +++ b/scintilla/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = include -noinst_LIBRARIES=libscintilla.a +noinst_LTLIBRARIES=libscintilla.la AM_CXXFLAGS = -DNDEBUG -DGTK -DSCI_LEXER -DG_THREADS_IMPL_NONE @@ -139,9 +139,10 @@ src/XPM.cxx \ src/XPM.h \ $(LEXER_SRCS) -libscintilla_a_SOURCES = $(SRCS) +libscintilla_la_SOURCES = $(SRCS) -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir)/include -I$(srcdir)/src -I$(srcdir)/lexlib @GTK_CFLAGS@ +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir)/include -I$(srcdir)/src -I$(srcdir)/lexlib @GTK_CFLAGS@ \ + -fvisibility=hidden marshallers: gtk/scintilla-marshal.list glib-genmarshal --prefix scintilla_marshal gtk/scintilla-marshal.list --header > gtk/scintilla-marshal.h diff --git a/src/Makefile.am b/src/Makefile.am index d6302b85..eb4d4789 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,10 @@ EXTRA_DIST = \ $(top_srcdir)/src/dynamicsymbols.list bin_PROGRAMS = geany +lib_LTLIBRARIES = libgeany.la + +geany_SOURCES = main.c +geany_LDADD = libgeany.la $(GTK_LIBS) $(GTHREAD_LIBS) $(INTLLIBS) SRCS = \ about.c about.h \ @@ -35,7 +39,7 @@ SRCS = \ keybindings.c keybindings.h \ keyfile.c keyfile.h \ log.c log.h \ - main.c main.h geany.h \ + libmain.c main.h geany.h \ msgwindow.c msgwindow.h \ navqueue.c navqueue.h \ notebook.c notebook.h \ @@ -107,18 +111,19 @@ nodist_EXTRA_geany_SOURCES = dummy.cxx if MINGW # build Geany for Windows on non-Windows systems (cross-compile) -geany_SOURCES = $(SRCS) win32.c win32.h +libgeany_la_SOURCES = $(SRCS) win32.c win32.h -geany_LDADD = \ - $(top_builddir)/scintilla/libscintilla.a \ - $(top_builddir)/tagmanager/ctags/libctags.a \ - $(top_builddir)/tagmanager/mio/libmio.a \ - $(top_builddir)/tagmanager/src/libtagmanager.a \ +libgeany_la_LIBADD = \ + $(top_builddir)/scintilla/libscintilla.la \ + $(top_builddir)/tagmanager/ctags/libctags.la \ + $(top_builddir)/tagmanager/mio/libmio.la \ + $(top_builddir)/tagmanager/src/libtagmanager.la \ @GTK_LIBS@ \ @GTHREAD_LIBS@ \ $(INTLLIBS) \ - -lole32 -luuid -lwsock32 \ - geany_private.res + -lole32 -luuid -lwsock32 -lcomdlg32 + +geany_LDADD += geany_private.res -lcomdlg32 AM_CFLAGS = -DGEANY_DATADIR=\"data\" \ -DGEANY_DOCDIR=\"\" \ @@ -127,9 +132,10 @@ AM_CFLAGS = -DGEANY_DATADIR=\"data\" \ -DGEANY_PREFIX=\"\" \ -DGEANY_PRIVATE \ -DGTK \ - -DG_LOG_DOMAIN=\""Geany"\" + -DG_LOG_DOMAIN=\""Geany"\" \ + -fvisibility=hidden -geany_LDFLAGS = -mwindows -mms-bitfields +libgeany_la_LDFLAGS = -mwindows -mms-bitfields -no-undefined WINDRES = $(host_alias)-windres @@ -142,19 +148,19 @@ clean-local: else # build Geany for all other platforms -geany_SOURCES = $(SRCS) vte.c vte.h +libgeany_la_SOURCES = $(SRCS) vte.c vte.h -geany_LDADD = \ - $(top_builddir)/scintilla/libscintilla.a \ - $(top_builddir)/tagmanager/ctags/libctags.a \ - $(top_builddir)/tagmanager/mio/libmio.a \ - $(top_builddir)/tagmanager/src/libtagmanager.a \ +libgeany_la_LIBADD = \ + $(top_builddir)/scintilla/libscintilla.la \ + $(top_builddir)/tagmanager/ctags/libctags.la \ + $(top_builddir)/tagmanager/mio/libmio.la \ + $(top_builddir)/tagmanager/src/libtagmanager.la \ @GTK_LIBS@ \ @GTHREAD_LIBS@ \ $(MAC_INTEGRATION_LIBS) \ $(INTLLIBS) -geany_LDFLAGS = -Wl,--dynamic-list="$(srcdir)/dynamicsymbols.list" +libgeany_la_LDFLAGS = -Wl,--dynamic-list="$(srcdir)/dynamicsymbols.list" AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGEANY_DOCDIR=\""$(docdir)"\" \ @@ -163,7 +169,8 @@ AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGEANY_PREFIX=\""$(prefix)"\" \ -DGEANY_PRIVATE \ -DGTK \ - -DG_LOG_DOMAIN=\""Geany"\" + -DG_LOG_DOMAIN=\""Geany"\" \ + -fvisibility=hidden clean-local: diff --git a/src/libmain.c b/src/libmain.c new file mode 100644 index 00000000..7e3f74ea --- /dev/null +++ b/src/libmain.c @@ -0,0 +1,1406 @@ +/* + * libmain.c - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2005-2012 Enrico Tröger + * Copyright 2006-2012 Nick Treleaven + * + * 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: main.h + * Main program-related commands. + * Handles program initialization and cleanup. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "main.h" + +#include "app.h" +#include "build.h" +#include "callbacks.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 "log.h" +#include "msgwindow.h" +#include "navqueue.h" +#include "notebook.h" +#include "pluginexport.h" +#include "plugins.h" +#include "prefs.h" +#include "printing.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 "win32.h" +#include "osx.h" + +#include "gtkcompat.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef HAVE_LOCALE_H +# include +#endif + + +GeanyApp *app; +gboolean ignore_callback; /* hack workaround for GTK+ toggle button callback problem */ + +GeanyStatus main_status; +CommandLineOptions cl_options; /* fields initialised in parse_command_line_options */ + +static gchar *original_cwd = NULL; + +static const gchar geany_lib_versions[] = "GTK %u.%u.%u, GLib %u.%u.%u"; + +static gboolean want_plugins; + +/* command-line options */ +static gboolean verbose_mode = FALSE; +static gboolean ignore_global_tags = FALSE; +static gboolean no_msgwin = FALSE; +static gboolean show_version = FALSE; +static gchar *alternate_config = NULL; +#ifdef HAVE_VTE +static gboolean no_vte = FALSE; +static gchar *lib_vte = NULL; +#endif +static gboolean generate_tags = FALSE; +static gboolean no_preprocessing = FALSE; +static gboolean ft_names = FALSE; +static gboolean print_prefix = FALSE; +#ifdef HAVE_PLUGINS +static gboolean no_plugins = FALSE; +#endif +static gboolean dummy = FALSE; + +/* in alphabetical order of short options */ +static GOptionEntry entries[] = +{ + { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, + { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, + { "ft-names", 0, 0, G_OPTION_ARG_NONE, &ft_names, N_("Print internal filetype names"), NULL }, + { "generate-tags", 'g', 0, G_OPTION_ARG_NONE, &generate_tags, N_("Generate global tags file (see documentation)"), NULL }, + { "no-preprocessing", 'P', 0, G_OPTION_ARG_NONE, &no_preprocessing, N_("Don't preprocess C/C++ files when generating tags"), NULL }, +#ifdef HAVE_SOCKET + { "new-instance", 'i', 0, G_OPTION_ARG_NONE, &cl_options.new_instance, N_("Don't open files in a running instance, force opening a new instance"), NULL }, + { "socket-file", 0, 0, G_OPTION_ARG_FILENAME, &cl_options.socket_filename, N_("Use this socket filename for communication with a running Geany instance"), NULL }, + { "list-documents", 0, 0, G_OPTION_ARG_NONE, &cl_options.list_documents, N_("Return a list of open documents in a running Geany instance"), NULL }, +#endif + { "line", 'l', 0, G_OPTION_ARG_INT, &cl_options.goto_line, N_("Set initial line number for the first opened file"), NULL }, + { "no-msgwin", 'm', 0, G_OPTION_ARG_NONE, &no_msgwin, N_("Don't show message window at startup"), NULL }, + { "no-ctags", 'n', 0, G_OPTION_ARG_NONE, &ignore_global_tags, N_("Don't load auto completion data (see documentation)"), NULL }, +#ifdef HAVE_PLUGINS + { "no-plugins", 'p', 0, G_OPTION_ARG_NONE, &no_plugins, N_("Don't load plugins"), NULL }, +#endif + { "print-prefix", 0, 0, G_OPTION_ARG_NONE, &print_prefix, N_("Print Geany's installation prefix"), NULL }, + { "read-only", 'r', 0, G_OPTION_ARG_NONE, &cl_options.readonly, N_("Open all FILES in read-only mode (see documention)"), NULL }, + { "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("Don't load the previous session's files"), NULL }, +#ifdef HAVE_VTE + { "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("Don't load terminal support"), NULL }, + { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), NULL }, +#endif + { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_mode, N_("Be verbose"), NULL }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &show_version, N_("Show version and exit"), NULL }, + { "dummy", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &dummy, NULL, NULL }, /* for +NNN line number arguments */ + { NULL, 0, 0, 0, NULL, NULL, NULL } +}; + + +static void setup_window_position(void) +{ + /* interprets the saved window geometry */ + if (!prefs.save_winpos) + return; + + if (ui_prefs.geometry[0] != -1 && ui_prefs.geometry[1] != -1) + gtk_window_move(GTK_WINDOW(main_widgets.window), + ui_prefs.geometry[0], ui_prefs.geometry[1]); + + if (ui_prefs.geometry[2] != -1 && ui_prefs.geometry[3] != -1) + gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), + ui_prefs.geometry[2], ui_prefs.geometry[3]); + + if (ui_prefs.geometry[4] == 1) + gtk_window_maximize(GTK_WINDOW(main_widgets.window)); +} + + +/* special things for the initial setup of the checkboxes and related stuff + * an action on a setting is only performed if the setting is not equal to the program default + * (all the following code is not perfect but it works for the moment) */ +static void apply_settings(void) +{ + ui_update_fold_items(); + + /* toolbar, message window and sidebar are by default visible, so don't change it if it is true */ + toolbar_show_hide(); + if (! ui_prefs.msgwindow_visible) + { + ignore_callback = TRUE; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_messages_window1")), FALSE); + gtk_widget_hide(main_widgets.message_window_notebook); + ignore_callback = FALSE; + } + if (! ui_prefs.sidebar_visible) + { + ignore_callback = TRUE; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_sidebar1")), FALSE); + ignore_callback = FALSE; + } + + toolbar_apply_settings(); + toolbar_update_ui(); + + ui_update_view_editor_menu_items(); + + /* hide statusbar if desired */ + if (! interface_prefs.statusbar_visible) + { + gtk_widget_hide(ui_widgets.statusbar); + } + + /* set the tab placements of the notebooks */ + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor); + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin); + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar); + + /* whether to show notebook tabs or not */ + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs); + +#ifdef HAVE_VTE + if (! vte_info.have_vte) +#endif + { + gtk_widget_set_sensitive( + ui_lookup_widget(main_widgets.window, "send_selection_to_vte1"), FALSE); + } + + if (interface_prefs.sidebar_pos != GTK_POS_LEFT) + ui_swap_sidebar_pos(); + + gtk_orientable_set_orientation(GTK_ORIENTABLE(ui_lookup_widget(main_widgets.window, "vpaned1")), + interface_prefs.msgwin_orientation); +} + + +static void main_init(void) +{ + /* add our icon path in case we aren't installed in the system prefix */ + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), utils_resource_dir(RESOURCE_DIR_ICON)); + + /* inits */ + ui_init_stock_items(); + + ui_init_builder(); + + main_widgets.window = NULL; + app->project = NULL; + ui_widgets.open_fontsel = NULL; + ui_widgets.open_colorsel = NULL; + ui_widgets.prefs_dialog = NULL; + main_status.main_window_realized = FALSE; + file_prefs.tab_order_ltr = FALSE; + file_prefs.tab_order_beside = FALSE; + main_status.quitting = FALSE; + ignore_callback = FALSE; + app->tm_workspace = tm_get_workspace(); + ui_prefs.recent_queue = g_queue_new(); + ui_prefs.recent_projects_queue = g_queue_new(); + main_status.opening_session_files = FALSE; + + main_widgets.window = create_window1(); + + /* add recent projects to the Project menu */ + ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1"); + ui_widgets.recent_projects_menu_menubar = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_projects_menuitem), + ui_widgets.recent_projects_menu_menubar); + + /* store important pointers for later reference */ + main_widgets.toolbar = toolbar_init(); + main_widgets.sidebar_notebook = ui_lookup_widget(main_widgets.window, "notebook3"); + main_widgets.notebook = ui_lookup_widget(main_widgets.window, "notebook1"); + main_widgets.editor_menu = create_edit_menu1(); + main_widgets.tools_menu = ui_lookup_widget(main_widgets.window, "tools1_menu"); + main_widgets.message_window_notebook = ui_lookup_widget(main_widgets.window, "notebook_info"); + main_widgets.project_menu = ui_lookup_widget(main_widgets.window, "menu_project1_menu"); + + ui_widgets.toolbar_menu = create_toolbar_popup_menu1(); + ui_init(); +#ifdef MAC_INTEGRATION + osx_ui_init(); +#endif + + /* set widget names for matching with .gtkrc-2.0 */ + gtk_widget_set_name(main_widgets.window, "GeanyMainWindow"); + gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu"); + gtk_widget_set_name(main_widgets.editor_menu, "GeanyEditMenu"); + gtk_widget_set_name(ui_lookup_widget(main_widgets.window, "menubar1"), "GeanyMenubar"); + gtk_widget_set_name(main_widgets.toolbar, "GeanyToolbar"); + + gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), + GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT); +} + + +const gchar *main_get_version_string(void) +{ + static gchar full[] = VERSION " (git >= " REVISION ")"; + + if (utils_str_equal(REVISION, "-1")) + return VERSION; + else + return full; +} + + +/* get the full file path of a command-line argument + * N.B. the result should be freed and may contain '/../' or '/./ ' */ +gchar *main_get_argv_filename(const gchar *filename) +{ + gchar *result; + + if (g_path_is_absolute(filename) || utils_is_uri(filename)) + result = g_strdup(filename); + else + { + /* use current dir */ + gchar *cur_dir = NULL; + if (original_cwd == NULL) + cur_dir = g_get_current_dir(); + else + cur_dir = g_strdup(original_cwd); + + result = g_strjoin( + G_DIR_SEPARATOR_S, cur_dir, filename, NULL); + g_free(cur_dir); + } + return result; +} + + +/* get a :line:column specifier from the end of a filename (if present), + * return the line/column values, and remove the specifier from the string + * (Note that *line and *column must both be set to -1 initially) */ +static void get_line_and_column_from_filename(gchar *filename, gint *line, gint *column) +{ + gsize i; + gint colon_count = 0; + gboolean have_number = FALSE; + gsize len; + + g_assert(*line == -1 && *column == -1); + + if (G_UNLIKELY(EMPTY(filename))) + return; + + /* allow to open files like "test:0" */ + if (g_file_test(filename, G_FILE_TEST_EXISTS)) + return; + + len = strlen(filename); + for (i = len - 1; i >= 1; i--) + { + gboolean is_colon = filename[i] == ':'; + gboolean is_digit = g_ascii_isdigit(filename[i]); + + if (! is_colon && ! is_digit) + break; + + if (is_colon) + { + if (++colon_count > 1) + break; /* bail on 2+ colons in a row */ + } + else + colon_count = 0; + + if (is_digit) + have_number = TRUE; + + if (is_colon && have_number) + { + gint number = atoi(&filename[i + 1]); + + filename[i] = '\0'; + have_number = FALSE; + + *column = *line; + *line = number; + } + + if (*column >= 0) + break; /* line and column are set, so we're done */ + } +} + + +#ifdef G_OS_WIN32 +static void change_working_directory_on_windows(void) +{ + gchar *install_dir = win32_get_installation_dir(); + + /* remember original working directory for use with opening files from the command line */ + original_cwd = g_get_current_dir(); + + /* On Windows, change the working directory to the Geany installation path to not lock + * the directory of a file passed as command line argument (see bug #2626124). + * This also helps if plugins or other code uses relative paths to load + * any additional resources (e.g. share/geany-plugins/...). */ + win32_set_working_directory(install_dir); + + g_free(install_dir); +} +#endif + + +static void setup_paths(void) +{ + /* convert path names to locale encoding */ + app->datadir = utils_get_locale_from_utf8(utils_resource_dir(RESOURCE_DIR_DATA)); + app->docdir = utils_get_locale_from_utf8(utils_resource_dir(RESOURCE_DIR_DOC)); +} + + +/** + * Checks whether the main window has been realized. + * This is an easy indicator whether Geany is right now starting up (main window is not + * yet realized) or whether it has finished the startup process (main window is realized). + * This is because the main window is realized (i.e. actually drawn on the screen) at the + * end of the startup process. + * + * @note Maybe you want to use the @link pluginsignals.c @c "geany-startup-complete" signal @endlink + * to get notified about the completed startup process. + * + * @return @c TRUE if the Geany main window has been realized or @c FALSE otherwise. + * + * @since 0.19 + **/ +GEANY_API_SYMBOL +gboolean main_is_realized(void) +{ + return main_status.main_window_realized; +} + + +/** + * Initialises the gettext translation system. + * This is a convenience function to set up gettext for internationalisation support + * in external plugins. You should call this function early in @ref plugin_init(). + * If the macro HAVE_LOCALE_H is defined, @c setlocale(LC_ALL, "") is called. + * The codeset for the message translations is set to UTF-8. + * + * Note that this function only setups the gettext textdomain for you. You still have + * to adjust the build system of your plugin to get internationalisation support + * working properly. + * + * If you have already used @ref PLUGIN_SET_TRANSLATABLE_INFO() you + * don't need to call main_locale_init() again as it has already been done. + * + * @param locale_dir The location where the translation files should be searched. This is + * usually the @c LOCALEDIR macro, defined by the build system. + * E.g. @c $prefix/share/locale. + * Only used on non-Windows systems. On Windows, the directory is determined + * by @c g_win32_get_package_installation_directory(). + * @param package The package name, usually this is the @c GETTEXT_PACKAGE macro, + * defined by the build system. + * + * @since 0.16 + **/ +GEANY_API_SYMBOL +void main_locale_init(const gchar *locale_dir, const gchar *package) +{ +#ifdef HAVE_LOCALE_H + setlocale(LC_ALL, ""); +#endif + +#ifdef G_OS_WIN32 + locale_dir = utils_resource_dir(RESOURCE_DIR_LOCALE); +#endif + (void) bindtextdomain(package, locale_dir); + (void) bind_textdomain_codeset(package, "UTF-8"); +} + + +static void print_filetypes(void) +{ + const GSList *list, *node; + + filetypes_init_types(); + printf("Geany's filetype names:\n"); + + list = filetypes_get_sorted_by_name(); + foreach_slist(node, list) + { + GeanyFiletype *ft = node->data; + + printf("%s\n", ft->name); + } + filetypes_free_types(); +} + + +static void wait_for_input_on_windows(void) +{ +#ifdef G_OS_WIN32 + if (verbose_mode) + { + geany_debug("Press any key to continue"); + getchar(); + } +#endif +} + + +static void parse_command_line_options(gint *argc, gchar ***argv) +{ + GError *error = NULL; + GOptionContext *context; + gint i; + CommandLineOptions def_clo = {FALSE, NULL, TRUE, -1, -1, FALSE, FALSE, FALSE}; + + /* first initialise cl_options fields with default values */ + cl_options = def_clo; + + /* the GLib option parser can't handle the +NNN (line number) option, + * so we grab that here and replace it with a no-op */ + for (i = 1; i < (*argc); i++) + { + if ((*argv)[i][0] != '+') + continue; + + cl_options.goto_line = atoi((*argv)[i] + 1); + (*argv)[i] = (gchar *) "--dummy"; + } + + 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)); + g_option_context_parse(context, argc, argv, &error); + g_option_context_free(context); + + if (error != NULL) + { + g_printerr("Geany: %s\n", error->message); + g_error_free(error); + exit(1); + } + + app->debug_mode = verbose_mode; + if (app->debug_mode) + { + /* Since GLib 2.32 messages logged with levels INFO and DEBUG aren't output by the + * default log handler unless the G_MESSAGES_DEBUG environment variable contains the + * domain of the message or is set to the special value "all" */ + g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + } + +#ifdef G_OS_WIN32 + win32_init_debug_code(); +#endif + + if (show_version) + { + gchar *build_date = utils_parse_and_format_build_date(__DATE__); + + printf(PACKAGE " %s (", main_get_version_string()); + /* note for translators: library versions are printed after this */ + printf(_("built on %s with "), build_date); + printf(geany_lib_versions, + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf(")\n"); + g_free(build_date); + wait_for_input_on_windows(); + exit(0); + } + + if (print_prefix) + { + printf("%s\n", GEANY_PREFIX); + printf("%s\n", GEANY_DATADIR); + printf("%s\n", GEANY_LIBDIR); + printf("%s\n", GEANY_LOCALEDIR); + wait_for_input_on_windows(); + exit(0); + } + + if (alternate_config) + { + geany_debug("alternate config: %s", alternate_config); + app->configdir = alternate_config; + } + else + { + app->configdir = utils_get_user_config_dir(); + } + + if (generate_tags) + { + gboolean ret; + + filetypes_init_types(); + ret = symbols_generate_global_tags(*argc, *argv, ! no_preprocessing); + filetypes_free_types(); + wait_for_input_on_windows(); + exit(ret); + } + + if (ft_names) + { + print_filetypes(); + wait_for_input_on_windows(); + exit(0); + } + +#ifdef HAVE_SOCKET + socket_info.ignore_socket = cl_options.new_instance; + if (cl_options.socket_filename) + { + socket_info.file_name = cl_options.socket_filename; + } +#endif + +#ifdef HAVE_VTE + vte_info.lib_vte = lib_vte; +#endif + cl_options.ignore_global_tags = ignore_global_tags; + + if (! gtk_init_check(NULL, NULL)) + { /* check whether we have a valid X display and exit if not */ + g_printerr("Geany: cannot open display\n"); + exit(1); + } + +#ifdef MAC_INTEGRATION + /* Create GtkosxApplication singleton - should be created shortly after gtk_init() */ + gtkosx_application_get(); +#endif +} + + +static gint create_config_dir(void) +{ + gint saved_errno = 0; + gchar *conf_file = NULL; + gchar *filedefs_dir = NULL; + gchar *templates_dir = NULL; + + if (! g_file_test(app->configdir, G_FILE_TEST_EXISTS)) + { +#ifndef G_OS_WIN32 + /* if we are *not* using an alternate config directory, we check whether the old one + * in ~/.geany still exists and try to move it */ + if (alternate_config == NULL) + { + gchar *old_dir = g_build_filename(g_get_home_dir(), ".geany", NULL); + /* move the old config dir if it exists */ + if (g_file_test(old_dir, G_FILE_TEST_EXISTS)) + { + if (! dialogs_show_question_full(main_widgets.window, + GTK_STOCK_YES, GTK_STOCK_QUIT, _("Move it now?"), + "%s", + _("Geany needs to move your old configuration directory before starting."))) + exit(0); + + if (! g_file_test(app->configdir, G_FILE_TEST_IS_DIR)) + utils_mkdir(app->configdir, TRUE); + + if (g_rename(old_dir, app->configdir) == 0) + { + dialogs_show_msgbox(GTK_MESSAGE_INFO, + _("Your configuration directory has been successfully moved from \"%s\" to \"%s\"."), + old_dir, app->configdir); + g_free(old_dir); + return 0; + } + else + { + dialogs_show_msgbox(GTK_MESSAGE_WARNING, + /* for translators: the third %s in brackets is the error message which + * describes why moving the dir didn't work */ + _("Your old configuration directory \"%s\" could not be moved to \"%s\" (%s). " + "Please move manually the directory to the new location."), + old_dir, app->configdir, g_strerror(errno)); + } + } + g_free(old_dir); + } +#endif + geany_debug("creating config directory %s", app->configdir); + saved_errno = utils_mkdir(app->configdir, TRUE); + } + + conf_file = g_build_filename(app->configdir, "geany.conf", NULL); + filedefs_dir = g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, NULL); + templates_dir = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, NULL); + + if (saved_errno == 0 && ! g_file_test(conf_file, G_FILE_TEST_EXISTS)) + { /* check whether geany.conf can be written */ + saved_errno = utils_is_file_writable(app->configdir); + } + + /* make subdir for filetype definitions */ + if (saved_errno == 0) + { + gchar *filedefs_readme = g_build_filename(app->configdir, + GEANY_FILEDEFS_SUBDIR, "filetypes.README", NULL); + + if (! g_file_test(filedefs_dir, G_FILE_TEST_EXISTS)) + { + saved_errno = utils_mkdir(filedefs_dir, FALSE); + } + if (saved_errno == 0 && ! g_file_test(filedefs_readme, G_FILE_TEST_EXISTS)) + { + gchar *text = g_strconcat( +"Copy files from ", app->datadir, " to this directory to overwrite " +"them. To use the defaults, just delete the file in this directory.\nFor more information read " +"the documentation (in ", app->docdir, G_DIR_SEPARATOR_S "index.html or visit " GEANY_HOMEPAGE ").", NULL); + utils_write_file(filedefs_readme, text); + g_free(text); + } + g_free(filedefs_readme); + } + + /* make subdir for template files */ + if (saved_errno == 0) + { + gchar *templates_readme = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, + "templates.README", NULL); + + if (! g_file_test(templates_dir, G_FILE_TEST_EXISTS)) + { + saved_errno = utils_mkdir(templates_dir, FALSE); + } + if (saved_errno == 0 && ! g_file_test(templates_readme, G_FILE_TEST_EXISTS)) + { + gchar *text = g_strconcat( +"There are several template files in this directory. For these templates you can use wildcards.\n\ +For more information read the documentation (in ", app->docdir, G_DIR_SEPARATOR_S "index.html or visit " GEANY_HOMEPAGE ").", + NULL); + utils_write_file(templates_readme, text); + g_free(text); + } + g_free(templates_readme); + } + + g_free(filedefs_dir); + g_free(templates_dir); + g_free(conf_file); + + return saved_errno; +} + + +/* Returns 0 if config dir is OK. */ +static gint setup_config_dir(void) +{ + gint mkdir_result = 0; + + /* convert configdir to locale encoding to avoid troubles */ + SETPTR(app->configdir, utils_get_locale_from_utf8(app->configdir)); + + mkdir_result = create_config_dir(); + if (mkdir_result != 0) + { + if (! dialogs_show_question( + _("Configuration directory could not be created (%s).\nThere could be some problems " + "using Geany without a configuration directory.\nStart Geany anyway?"), + g_strerror(mkdir_result))) + { + exit(0); + } + } + /* make configdir a real path */ + if (g_file_test(app->configdir, G_FILE_TEST_EXISTS)) + SETPTR(app->configdir, tm_get_real_path(app->configdir)); + + return mkdir_result; +} + +/* Signal handling removed since main_quit() uses functions that are + * illegal in signal handlers +static void signal_cb(gint sig) +{ + if (sig == SIGTERM) + { + main_quit(); + } +} + */ + +/* Used for command-line arguments at startup or from socket. + * this will strip any :line:col filename suffix from locale_filename */ +gboolean main_handle_filename(const gchar *locale_filename) +{ + GeanyDocument *doc; + gint line = -1, column = -1; + gchar *filename; + + g_return_val_if_fail(locale_filename, FALSE); + + /* check whether the passed filename is an URI */ + filename = utils_get_path_from_uri(locale_filename); + if (filename == NULL) + return FALSE; + + get_line_and_column_from_filename(filename, &line, &column); + if (line >= 0) + cl_options.goto_line = line; + if (column >= 0) + cl_options.goto_column = column; + + if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) + { + doc = document_open_file(filename, cl_options.readonly, NULL, NULL); + /* add recent file manually if opening_session_files is set */ + if (doc != NULL && main_status.opening_session_files) + ui_add_recent_document(doc); + g_free(filename); + return TRUE; + } + else if (file_prefs.cmdline_new_files) + { /* create new file with the given filename */ + gchar *utf8_filename = utils_get_utf8_from_locale(filename); + + doc = document_new_file(utf8_filename, NULL, NULL); + if (doc != NULL) + ui_add_recent_document(doc); + g_free(utf8_filename); + g_free(filename); + return TRUE; + } + g_free(filename); + return FALSE; +} + + +/* open files from command line */ +static void open_cl_files(gint argc, gchar **argv) +{ + gint i; + + for (i = 1; i < argc; i++) + { + gchar *filename = main_get_argv_filename(argv[i]); + + if (g_file_test(filename, G_FILE_TEST_IS_DIR)) + { + g_free(filename); + continue; + } + +#ifdef G_OS_WIN32 + /* It seems argv elements are encoded in CP1252 on a German Windows */ + SETPTR(filename, g_locale_to_utf8(filename, -1, NULL, NULL, NULL)); +#endif + if (filename && ! main_handle_filename(filename)) + { + const gchar *msg = _("Could not find file '%s'."); + + g_printerr(msg, filename); /* also print to the terminal */ + g_printerr("\n"); + ui_set_statusbar(TRUE, msg, filename); + } + g_free(filename); + } +} + + +static void load_session_project_file(void) +{ + gchar *locale_filename; + + g_return_if_fail(project_prefs.session_file != NULL); + + locale_filename = utils_get_locale_from_utf8(project_prefs.session_file); + + if (G_LIKELY(!EMPTY(locale_filename))) + project_load_file(locale_filename); + + g_free(locale_filename); + g_free(project_prefs.session_file); /* no longer needed */ +} + + +static void load_settings(void) +{ + configuration_load(); + /* let cmdline options overwrite configuration settings */ +#ifdef HAVE_VTE + vte_info.have_vte = (no_vte) ? FALSE : vte_info.load_vte; +#endif + if (no_msgwin) + ui_prefs.msgwindow_visible = FALSE; + +#ifdef HAVE_PLUGINS + want_plugins = prefs.load_plugins && !no_plugins; +#endif +} + + +void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session) +{ + gchar *pfile; + + pfile = utils_get_path_from_uri(locale_filename); + if (pfile != NULL) + { + if (use_session) + project_load_file_with_session(pfile); + else + project_load_file(pfile); + } + g_free(pfile); +} + + +static void load_startup_files(gint argc, gchar **argv) +{ + gboolean load_session = FALSE; + + if (argc > 1 && g_str_has_suffix(argv[1], ".geany")) + { + gchar *filename = main_get_argv_filename(argv[1]); + + /* project file specified: load it, but decide the session later */ + main_load_project_from_command_line(filename, FALSE); + argc--, argv++; + /* force session load if using project-based session files */ + load_session = project_prefs.project_session; + g_free(filename); + } + + /* Load the default session if: + * 1. "Load files from the last session" is active. + * 2. --no-session is not specified. + * 3. We are a primary instance. + * Has no effect if a CL project is loaded and using project-based session files. */ + if (prefs.load_session && cl_options.load_session && !cl_options.new_instance) + { + if (app->project == NULL) + load_session_project_file(); + load_session = TRUE; + } + + if (load_session) + { + /* load session files into tabs, as they are found in the session_files variable */ + configuration_open_files(); + + if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0) + { + ui_update_popup_copy_items(NULL); + ui_update_popup_reundo_items(NULL); + } + } + + open_cl_files(argc, argv); +} + + +static gboolean send_startup_complete(gpointer data) +{ + g_signal_emit_by_name(geany_object, "geany-startup-complete"); + return FALSE; +} + + +static const gchar *get_locale(void) +{ + const gchar *locale = "unknown"; +#ifdef HAVE_LOCALE_H + locale = setlocale(LC_CTYPE, NULL); +#endif + return locale; +} + + +#if ! GTK_CHECK_VERSION(3, 0, 0) +/* This prepends our own gtkrc file to the list of RC files to be loaded by GTK at startup. + * This function *has* to be called before gtk_init(). + * + * We have a custom RC file defining various styles we need, and we want the user to be + * able to override them (e.g. if they want -- or need -- other colors). Fair enough, one + * would simply call gtk_rc_parse() with the appropriate filename. However, the styling + * rules applies in the order they are loaded, then if we load our styles after GTK has + * loaded the user's ones we'd override them. + * + * There are 2 solutions to fix this: + * 1) set our styles' priority to something with lower than "user" (actually "theme" + * priority because rules precedence are first calculated depending on the priority + * no matter of how precise the rules is, so we need to override the theme). + * 2) prepend our custom style to GTK's list while keeping priority to user (which is the + * default), so it gets loaded before real user's ones and so gets overridden by them. + * + * One would normally go for 1 because it's ways simpler and requires less code: you just + * have to add the priorities to your styles, which is a matter of adding a few ":theme" in + * the RC file. However, KDE being a bitch it doesn't set the gtk-theme-name but rather + * directly includes the style to use in a user gtkrc file, which makes the theme have + * "user" priority, hence overriding our styles. So, we cannot set priorities in the RC + * file if we want to support running under KDE, which pretty much leave us with no choice + * but to go with solution 2, which unfortunately requires writing ugly code since GTK + * don't have a gtk_rc_prepend_default_file() function. Thank you very much KDE. + * + * Though, as a side benefit it also makes the code work with people using gtk-chtheme, + * which also found it funny to include the theme in the user RC file. */ +static void setup_gtk2_styles(void) +{ + gchar **gtk_files = gtk_rc_get_default_files(); + gchar **new_files = g_malloc(sizeof *new_files * (g_strv_length(gtk_files) + 2)); + guint i = 0; + + new_files[i++] = g_build_filename(app->datadir, "geany.gtkrc", NULL); + for (; *gtk_files; gtk_files++) + new_files[i++] = g_strdup(*gtk_files); + new_files[i] = NULL; + + gtk_rc_set_default_files(new_files); + + g_strfreev(new_files); +} +#endif + + +GEANY_EXPORT_SYMBOL +gint main_lib(gint argc, gchar **argv) +{ + GeanyDocument *doc; + gint config_dir_result; + const gchar *locale; + +#if ! GLIB_CHECK_VERSION(2, 36, 0) + g_type_init(); +#endif + + log_handlers_init(); + + app = g_new0(GeanyApp, 1); + memset(&main_status, 0, sizeof(GeanyStatus)); + memset(&prefs, 0, sizeof(GeanyPrefs)); + memset(&interface_prefs, 0, sizeof(GeanyInterfacePrefs)); + memset(&toolbar_prefs, 0, sizeof(GeanyToolbarPrefs)); + memset(&file_prefs, 0, sizeof(GeanyFilePrefs)); + memset(&search_prefs, 0, sizeof(GeanySearchPrefs)); + memset(&tool_prefs, 0, sizeof(GeanyToolPrefs)); + memset(&template_prefs, 0, sizeof(GeanyTemplatePrefs)); + memset(&ui_prefs, 0, sizeof(UIPrefs)); + memset(&ui_widgets, 0, sizeof(UIWidgets)); + + setup_paths(); +#if ! GTK_CHECK_VERSION(3, 0, 0) + setup_gtk2_styles(); +#endif +#ifdef ENABLE_NLS + main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE); +#endif + parse_command_line_options(&argc, &argv); + +#if ! GLIB_CHECK_VERSION(2, 32, 0) + /* Initialize GLib's thread system in case any plugins want to use it or their + * dependencies (e.g. WebKit, Soup, ...). Deprecated since GLIB 2.32. */ + if (!g_thread_supported()) + g_thread_init(NULL); +#endif + + /* removed as signal handling was wrong, see signal_cb() + signal(SIGTERM, signal_cb); */ + +#ifdef G_OS_UNIX + /* ignore SIGPIPE signal for preventing sudden death of program */ + signal(SIGPIPE, SIG_IGN); +#endif + + config_dir_result = setup_config_dir(); +#ifdef HAVE_SOCKET + /* check and create (unix domain) socket for remote operation */ + if (! socket_info.ignore_socket) + { + socket_info.lock_socket = -1; + socket_info.lock_socket_tag = 0; + socket_info.lock_socket = socket_init(argc, argv); + /* Quit if filenames were sent to first instance or the list of open + * documents has been printed */ + if ((socket_info.lock_socket == -2 /* socket exists */ && argc > 1) || + cl_options.list_documents) + { + socket_finalize(); + gdk_notify_startup_complete(); + g_free(app->configdir); + g_free(app->datadir); + g_free(app->docdir); + g_free(app); + return 0; + } + /* Start a new instance if no command line strings were passed, + * even if the socket already exists */ + else if (socket_info.lock_socket == -2 /* socket already exists */) + { + socket_info.ignore_socket = TRUE; + cl_options.new_instance = TRUE; + } + } +#endif + +#ifdef G_OS_WIN32 + /* after we initialized the socket code and handled command line args, + * let's change the working directory on Windows to not lock it */ + change_working_directory_on_windows(); +#endif + + locale = get_locale(); + geany_debug("Geany %s, %s", + main_get_version_string(), + locale); + geany_debug(geany_lib_versions, + gtk_major_version, gtk_minor_version, gtk_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + geany_debug("System data dir: %s", app->datadir); + geany_debug("User config dir: %s", app->configdir); + + /* create the object so Geany signals can be connected in init() functions */ + geany_object = geany_object_new(); + + /* inits */ + main_init(); + + encodings_init(); + editor_init(); + + /* init stash groups before loading keyfile */ + configuration_init(); + ui_init_prefs(); + search_init(); + project_init(); +#ifdef HAVE_PLUGINS + plugins_init(); +#endif + sidebar_init(); + load_settings(); /* load keyfile */ + + msgwin_init(); + build_init(); + ui_create_insert_menu_items(); + ui_create_insert_date_menu_items(); + keybindings_init(); + notebook_init(); + filetypes_init(); + templates_init(); + navqueue_init(); + document_init_doclist(); + symbols_init(); + editor_snippets_init(); + +#ifdef HAVE_VTE + vte_init(); +#endif + ui_create_recent_menus(); + + ui_set_statusbar(TRUE, _("This is Geany %s."), main_get_version_string()); + if (config_dir_result != 0) + ui_set_statusbar(TRUE, _("Configuration directory could not be created (%s)."), + g_strerror(config_dir_result)); + + /* apply all configuration options */ + apply_settings(); + +#ifdef HAVE_PLUGINS + /* load any enabled plugins before we open any documents */ + if (want_plugins) + plugins_load_active(); +#endif + + ui_sidebar_show_hide(); + + /* set the active sidebar page after plugins have been loaded */ + gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), ui_prefs.sidebar_page); + + /* load keybinding settings after plugins have added their groups */ + keybindings_load_keyfile(); + + /* create the custom command menu after the keybindings have been loaded to have the proper + * accelerator shown for the menu items */ + tools_create_insert_custom_command_menu_items(); + + /* load any command line files or session files */ + main_status.opening_session_files = TRUE; + load_startup_files(argc, argv); + main_status.opening_session_files = FALSE; + + /* open a new file if no other file was opened */ + document_new_file_if_non_open(); + + ui_document_buttons_update(); + ui_save_buttons_toggle(FALSE); + + doc = document_get_current(); + sidebar_select_openfiles_item(doc); + build_menu_update(doc); + sidebar_update_tag_list(doc, FALSE); + +#ifdef G_OS_WIN32 + /* Manually realise the main window to be able to set the position but don't show it. + * We don't set the position after showing the window to avoid flickering. */ + gtk_widget_realize(main_widgets.window); +#endif + setup_window_position(); + + /* finally show the window */ + document_grab_focus(doc); + gtk_widget_show(main_widgets.window); + main_status.main_window_realized = TRUE; + + configuration_apply_settings(); + +#ifdef HAVE_SOCKET + /* register the callback of socket input */ + if (! socket_info.ignore_socket && socket_info.lock_socket > 0) + { + socket_info.read_ioc = g_io_channel_unix_new(socket_info.lock_socket); + socket_info.lock_socket_tag = g_io_add_watch(socket_info.read_ioc, + G_IO_IN | G_IO_PRI | G_IO_ERR, socket_lock_input_cb, main_widgets.window); + } +#endif + + /* when we are really done with setting everything up and the main event loop is running, + * tell other components, mainly plugins, that startup is complete */ + g_idle_add_full(G_PRIORITY_LOW, send_startup_complete, NULL, NULL); + +#ifdef MAC_INTEGRATION + /* OS X application ready - has to be called before entering main loop */ + gtkosx_application_ready(gtkosx_application_get()); +#endif + + gtk_main(); + return 0; +} + + +static void queue_free(GQueue *queue) +{ + while (! g_queue_is_empty(queue)) + { + g_free(g_queue_pop_tail(queue)); + } + g_queue_free(queue); +} + + +static void do_main_quit(void) +{ + geany_debug("Quitting..."); + + configuration_save(); + + if (app->project != NULL) + project_close(FALSE); /* save project session files */ + + document_close_all(); + + main_status.quitting = TRUE; + +#ifdef HAVE_SOCKET + socket_finalize(); +#endif + +#ifdef HAVE_PLUGINS + plugins_finalize(); +#endif + + navqueue_free(); + keybindings_free(); + notebook_free(); + highlighting_free_styles(); + templates_free_templates(); + msgwin_finalize(); + search_finalize(); + build_finalize(); + document_finalize(); + symbols_finalize(); + project_finalize(); + editor_finalize(); + editor_snippets_free(); + encodings_finalize(); + toolbar_finalize(); + sidebar_finalize(); + configuration_finalize(); + filetypes_free_types(); + log_finalize(); + + tm_workspace_free(); + g_free(app->configdir); + g_free(app->datadir); + g_free(app->docdir); + g_free(prefs.default_open_path); + g_free(prefs.custom_plugin_path); + g_free(ui_prefs.custom_date_format); + g_free(interface_prefs.editor_font); + g_free(interface_prefs.tagbar_font); + g_free(interface_prefs.msgwin_font); + g_free(editor_prefs.long_line_color); + g_free(editor_prefs.comment_toggle_mark); + g_free(editor_prefs.color_scheme); + g_free(tool_prefs.context_action_cmd); + g_free(template_prefs.developer); + g_free(template_prefs.company); + g_free(template_prefs.mail); + g_free(template_prefs.initials); + g_free(template_prefs.version); + g_free(tool_prefs.term_cmd); + g_free(tool_prefs.browser_cmd); + g_free(tool_prefs.grep_cmd); + g_free(printing_prefs.external_print_cmd); + g_free(printing_prefs.page_header_datefmt); + g_strfreev(ui_prefs.custom_commands); + g_strfreev(ui_prefs.custom_commands_labels); + + queue_free(ui_prefs.recent_queue); + queue_free(ui_prefs.recent_projects_queue); + + if (ui_widgets.prefs_dialog && GTK_IS_WIDGET(ui_widgets.prefs_dialog)) gtk_widget_destroy(ui_widgets.prefs_dialog); + if (ui_widgets.open_fontsel && GTK_IS_WIDGET(ui_widgets.open_fontsel)) gtk_widget_destroy(ui_widgets.open_fontsel); + if (ui_widgets.open_colorsel && GTK_IS_WIDGET(ui_widgets.open_colorsel)) gtk_widget_destroy(ui_widgets.open_colorsel); +#ifdef HAVE_VTE + if (vte_info.have_vte) vte_close(); + g_free(vte_info.lib_vte); + g_free(vte_info.dir); +#endif + gtk_widget_destroy(main_widgets.window); + + /* destroy popup menus */ + if (main_widgets.editor_menu && GTK_IS_WIDGET(main_widgets.editor_menu)) + gtk_widget_destroy(main_widgets.editor_menu); + if (ui_widgets.toolbar_menu && GTK_IS_WIDGET(ui_widgets.toolbar_menu)) + gtk_widget_destroy(ui_widgets.toolbar_menu); + if (msgwindow.popup_status_menu && GTK_IS_WIDGET(msgwindow.popup_status_menu)) + gtk_widget_destroy(msgwindow.popup_status_menu); + if (msgwindow.popup_msg_menu && GTK_IS_WIDGET(msgwindow.popup_msg_menu)) + gtk_widget_destroy(msgwindow.popup_msg_menu); + if (msgwindow.popup_compiler_menu && GTK_IS_WIDGET(msgwindow.popup_compiler_menu)) + gtk_widget_destroy(msgwindow.popup_compiler_menu); + + g_object_unref(geany_object); + geany_object = NULL; + + g_free(original_cwd); + g_free(app); + + ui_finalize_builder(); + + gtk_main_quit(); +} + + +static gboolean check_no_unsaved(void) +{ + guint i; + + for (i = 0; i < documents_array->len; i++) + { + if (documents[i]->is_valid && documents[i]->changed) + { + return FALSE; + } + } + return TRUE; /* no unsaved edits */ +} + + +/* Returns false when quitting is aborted due to user cancellation */ +gboolean main_quit(void) +{ + main_status.quitting = TRUE; + + if (! check_no_unsaved()) + { + if (document_account_for_unsaved()) + { + do_main_quit(); + return TRUE; + } + } + else + if (! prefs.confirm_exit || + dialogs_show_question_full(NULL, GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL, + _("Do you really want to quit?"))) + { + do_main_quit(); + return TRUE; + } + + main_status.quitting = FALSE; + return FALSE; +} + +/** + * Reloads most of Geany's configuration files without restarting. Currently the following + * files are reloaded: all template files, also new file templates and the 'New (with template)' + * menus will be updated, Snippets (snippets.conf), filetype extensions (filetype_extensions.conf), + * and 'settings' and 'build_settings' sections of the filetype definition files. + * + * Plugins may call this function if they changed any of these files (e.g. a configuration file + * editor plugin). + * + * @since 0.15 + **/ +GEANY_API_SYMBOL +void main_reload_configuration(void) +{ + /* reload templates */ + templates_free_templates(); + templates_init(); + + /* reload snippets */ + editor_snippets_free(); + editor_snippets_init(); + + filetypes_reload_extensions(); + filetypes_reload(); + + /* C tag names to ignore */ + symbols_reload_config_files(); + + ui_set_statusbar(TRUE, _("Configuration files reloaded.")); +} diff --git a/src/main.c b/src/main.c index 11370c7a..e8bf038f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,8 +1,7 @@ /* * main.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2005-2012 Enrico Tröger - * Copyright 2006-2012 Nick Treleaven + * Copyright 2014 Matthew Brush * * 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 @@ -19,1387 +18,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/** - * @file: main.h - * Main program-related commands. - * Handles program initialization and cleanup. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +/* See libmain.c for the real entry-point code. */ #include "main.h" -#include "app.h" -#include "build.h" -#include "callbacks.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 "log.h" -#include "msgwindow.h" -#include "navqueue.h" -#include "notebook.h" -#include "pluginexport.h" -#include "plugins.h" -#include "prefs.h" -#include "printing.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 "win32.h" -#include "osx.h" - -#include "gtkcompat.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef HAVE_LOCALE_H -# include -#endif - - -GeanyApp *app; -gboolean ignore_callback; /* hack workaround for GTK+ toggle button callback problem */ - -GeanyStatus main_status; -CommandLineOptions cl_options; /* fields initialised in parse_command_line_options */ - -static gchar *original_cwd = NULL; - -static const gchar geany_lib_versions[] = "GTK %u.%u.%u, GLib %u.%u.%u"; - -static gboolean want_plugins; - -/* command-line options */ -static gboolean verbose_mode = FALSE; -static gboolean ignore_global_tags = FALSE; -static gboolean no_msgwin = FALSE; -static gboolean show_version = FALSE; -static gchar *alternate_config = NULL; -#ifdef HAVE_VTE -static gboolean no_vte = FALSE; -static gchar *lib_vte = NULL; -#endif -static gboolean generate_tags = FALSE; -static gboolean no_preprocessing = FALSE; -static gboolean ft_names = FALSE; -static gboolean print_prefix = FALSE; -#ifdef HAVE_PLUGINS -static gboolean no_plugins = FALSE; -#endif -static gboolean dummy = FALSE; - -/* in alphabetical order of short options */ -static GOptionEntry entries[] = +int main(int argc, char **argv) { - { "column", 0, 0, G_OPTION_ARG_INT, &cl_options.goto_column, N_("Set initial column number for the first opened file (useful in conjunction with --line)"), NULL }, - { "config", 'c', 0, G_OPTION_ARG_FILENAME, &alternate_config, N_("Use an alternate configuration directory"), NULL }, - { "ft-names", 0, 0, G_OPTION_ARG_NONE, &ft_names, N_("Print internal filetype names"), NULL }, - { "generate-tags", 'g', 0, G_OPTION_ARG_NONE, &generate_tags, N_("Generate global tags file (see documentation)"), NULL }, - { "no-preprocessing", 'P', 0, G_OPTION_ARG_NONE, &no_preprocessing, N_("Don't preprocess C/C++ files when generating tags"), NULL }, -#ifdef HAVE_SOCKET - { "new-instance", 'i', 0, G_OPTION_ARG_NONE, &cl_options.new_instance, N_("Don't open files in a running instance, force opening a new instance"), NULL }, - { "socket-file", 0, 0, G_OPTION_ARG_FILENAME, &cl_options.socket_filename, N_("Use this socket filename for communication with a running Geany instance"), NULL }, - { "list-documents", 0, 0, G_OPTION_ARG_NONE, &cl_options.list_documents, N_("Return a list of open documents in a running Geany instance"), NULL }, -#endif - { "line", 'l', 0, G_OPTION_ARG_INT, &cl_options.goto_line, N_("Set initial line number for the first opened file"), NULL }, - { "no-msgwin", 'm', 0, G_OPTION_ARG_NONE, &no_msgwin, N_("Don't show message window at startup"), NULL }, - { "no-ctags", 'n', 0, G_OPTION_ARG_NONE, &ignore_global_tags, N_("Don't load auto completion data (see documentation)"), NULL }, -#ifdef HAVE_PLUGINS - { "no-plugins", 'p', 0, G_OPTION_ARG_NONE, &no_plugins, N_("Don't load plugins"), NULL }, -#endif - { "print-prefix", 0, 0, G_OPTION_ARG_NONE, &print_prefix, N_("Print Geany's installation prefix"), NULL }, - { "read-only", 'r', 0, G_OPTION_ARG_NONE, &cl_options.readonly, N_("Open all FILES in read-only mode (see documention)"), NULL }, - { "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("Don't load the previous session's files"), NULL }, -#ifdef HAVE_VTE - { "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("Don't load terminal support"), NULL }, - { "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("Filename of libvte.so"), NULL }, -#endif - { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_mode, N_("Be verbose"), NULL }, - { "version", 'V', 0, G_OPTION_ARG_NONE, &show_version, N_("Show version and exit"), NULL }, - { "dummy", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &dummy, NULL, NULL }, /* for +NNN line number arguments */ - { NULL, 0, 0, 0, NULL, NULL, NULL } -}; - - -static void setup_window_position(void) -{ - /* interprets the saved window geometry */ - if (!prefs.save_winpos) - return; - - if (ui_prefs.geometry[0] != -1 && ui_prefs.geometry[1] != -1) - gtk_window_move(GTK_WINDOW(main_widgets.window), - ui_prefs.geometry[0], ui_prefs.geometry[1]); - - if (ui_prefs.geometry[2] != -1 && ui_prefs.geometry[3] != -1) - gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), - ui_prefs.geometry[2], ui_prefs.geometry[3]); - - if (ui_prefs.geometry[4] == 1) - gtk_window_maximize(GTK_WINDOW(main_widgets.window)); -} - - -/* special things for the initial setup of the checkboxes and related stuff - * an action on a setting is only performed if the setting is not equal to the program default - * (all the following code is not perfect but it works for the moment) */ -static void apply_settings(void) -{ - ui_update_fold_items(); - - /* toolbar, message window and sidebar are by default visible, so don't change it if it is true */ - toolbar_show_hide(); - if (! ui_prefs.msgwindow_visible) - { - ignore_callback = TRUE; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_messages_window1")), FALSE); - gtk_widget_hide(main_widgets.message_window_notebook); - ignore_callback = FALSE; - } - if (! ui_prefs.sidebar_visible) - { - ignore_callback = TRUE; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ui_lookup_widget(main_widgets.window, "menu_show_sidebar1")), FALSE); - ignore_callback = FALSE; - } - - toolbar_apply_settings(); - toolbar_update_ui(); - - ui_update_view_editor_menu_items(); - - /* hide statusbar if desired */ - if (! interface_prefs.statusbar_visible) - { - gtk_widget_hide(ui_widgets.statusbar); - } - - /* set the tab placements of the notebooks */ - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar); - - /* whether to show notebook tabs or not */ - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs); - -#ifdef HAVE_VTE - if (! vte_info.have_vte) -#endif - { - gtk_widget_set_sensitive( - ui_lookup_widget(main_widgets.window, "send_selection_to_vte1"), FALSE); - } - - if (interface_prefs.sidebar_pos != GTK_POS_LEFT) - ui_swap_sidebar_pos(); - - gtk_orientable_set_orientation(GTK_ORIENTABLE(ui_lookup_widget(main_widgets.window, "vpaned1")), - interface_prefs.msgwin_orientation); -} - - -static void main_init(void) -{ - /* add our icon path in case we aren't installed in the system prefix */ - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), utils_resource_dir(RESOURCE_DIR_ICON)); - - /* inits */ - ui_init_stock_items(); - - ui_init_builder(); - - main_widgets.window = NULL; - app->project = NULL; - ui_widgets.open_fontsel = NULL; - ui_widgets.open_colorsel = NULL; - ui_widgets.prefs_dialog = NULL; - main_status.main_window_realized = FALSE; - file_prefs.tab_order_ltr = FALSE; - file_prefs.tab_order_beside = FALSE; - main_status.quitting = FALSE; - ignore_callback = FALSE; - app->tm_workspace = tm_get_workspace(); - ui_prefs.recent_queue = g_queue_new(); - ui_prefs.recent_projects_queue = g_queue_new(); - main_status.opening_session_files = FALSE; - - main_widgets.window = create_window1(); - - /* add recent projects to the Project menu */ - ui_widgets.recent_projects_menuitem = ui_lookup_widget(main_widgets.window, "recent_projects1"); - ui_widgets.recent_projects_menu_menubar = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_projects_menuitem), - ui_widgets.recent_projects_menu_menubar); - - /* store important pointers for later reference */ - main_widgets.toolbar = toolbar_init(); - main_widgets.sidebar_notebook = ui_lookup_widget(main_widgets.window, "notebook3"); - main_widgets.notebook = ui_lookup_widget(main_widgets.window, "notebook1"); - main_widgets.editor_menu = create_edit_menu1(); - main_widgets.tools_menu = ui_lookup_widget(main_widgets.window, "tools1_menu"); - main_widgets.message_window_notebook = ui_lookup_widget(main_widgets.window, "notebook_info"); - main_widgets.project_menu = ui_lookup_widget(main_widgets.window, "menu_project1_menu"); - - ui_widgets.toolbar_menu = create_toolbar_popup_menu1(); - ui_init(); -#ifdef MAC_INTEGRATION - osx_ui_init(); -#endif - - /* set widget names for matching with .gtkrc-2.0 */ - gtk_widget_set_name(main_widgets.window, "GeanyMainWindow"); - gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu"); - gtk_widget_set_name(main_widgets.editor_menu, "GeanyEditMenu"); - gtk_widget_set_name(ui_lookup_widget(main_widgets.window, "menubar1"), "GeanyMenubar"); - gtk_widget_set_name(main_widgets.toolbar, "GeanyToolbar"); - - gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), - GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT); -} - - -const gchar *main_get_version_string(void) -{ - static gchar full[] = VERSION " (git >= " REVISION ")"; - - if (utils_str_equal(REVISION, "-1")) - return VERSION; - else - return full; -} - - -/* get the full file path of a command-line argument - * N.B. the result should be freed and may contain '/../' or '/./ ' */ -gchar *main_get_argv_filename(const gchar *filename) -{ - gchar *result; - - if (g_path_is_absolute(filename) || utils_is_uri(filename)) - result = g_strdup(filename); - else - { - /* use current dir */ - gchar *cur_dir = NULL; - if (original_cwd == NULL) - cur_dir = g_get_current_dir(); - else - cur_dir = g_strdup(original_cwd); - - result = g_strjoin( - G_DIR_SEPARATOR_S, cur_dir, filename, NULL); - g_free(cur_dir); - } - return result; -} - - -/* get a :line:column specifier from the end of a filename (if present), - * return the line/column values, and remove the specifier from the string - * (Note that *line and *column must both be set to -1 initially) */ -static void get_line_and_column_from_filename(gchar *filename, gint *line, gint *column) -{ - gsize i; - gint colon_count = 0; - gboolean have_number = FALSE; - gsize len; - - g_assert(*line == -1 && *column == -1); - - if (G_UNLIKELY(EMPTY(filename))) - return; - - /* allow to open files like "test:0" */ - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - return; - - len = strlen(filename); - for (i = len - 1; i >= 1; i--) - { - gboolean is_colon = filename[i] == ':'; - gboolean is_digit = g_ascii_isdigit(filename[i]); - - if (! is_colon && ! is_digit) - break; - - if (is_colon) - { - if (++colon_count > 1) - break; /* bail on 2+ colons in a row */ - } - else - colon_count = 0; - - if (is_digit) - have_number = TRUE; - - if (is_colon && have_number) - { - gint number = atoi(&filename[i + 1]); - - filename[i] = '\0'; - have_number = FALSE; - - *column = *line; - *line = number; - } - - if (*column >= 0) - break; /* line and column are set, so we're done */ - } -} - - -#ifdef G_OS_WIN32 -static void change_working_directory_on_windows(void) -{ - gchar *install_dir = win32_get_installation_dir(); - - /* remember original working directory for use with opening files from the command line */ - original_cwd = g_get_current_dir(); - - /* On Windows, change the working directory to the Geany installation path to not lock - * the directory of a file passed as command line argument (see bug #2626124). - * This also helps if plugins or other code uses relative paths to load - * any additional resources (e.g. share/geany-plugins/...). */ - win32_set_working_directory(install_dir); - - g_free(install_dir); -} -#endif - - -static void setup_paths(void) -{ - /* convert path names to locale encoding */ - app->datadir = utils_get_locale_from_utf8(utils_resource_dir(RESOURCE_DIR_DATA)); - app->docdir = utils_get_locale_from_utf8(utils_resource_dir(RESOURCE_DIR_DOC)); -} - - -/** - * Checks whether the main window has been realized. - * This is an easy indicator whether Geany is right now starting up (main window is not - * yet realized) or whether it has finished the startup process (main window is realized). - * This is because the main window is realized (i.e. actually drawn on the screen) at the - * end of the startup process. - * - * @note Maybe you want to use the @link pluginsignals.c @c "geany-startup-complete" signal @endlink - * to get notified about the completed startup process. - * - * @return @c TRUE if the Geany main window has been realized or @c FALSE otherwise. - * - * @since 0.19 - **/ -GEANY_API_SYMBOL -gboolean main_is_realized(void) -{ - return main_status.main_window_realized; -} - - -/** - * Initialises the gettext translation system. - * This is a convenience function to set up gettext for internationalisation support - * in external plugins. You should call this function early in @ref plugin_init(). - * If the macro HAVE_LOCALE_H is defined, @c setlocale(LC_ALL, "") is called. - * The codeset for the message translations is set to UTF-8. - * - * Note that this function only setups the gettext textdomain for you. You still have - * to adjust the build system of your plugin to get internationalisation support - * working properly. - * - * If you have already used @ref PLUGIN_SET_TRANSLATABLE_INFO() you - * don't need to call main_locale_init() again as it has already been done. - * - * @param locale_dir The location where the translation files should be searched. This is - * usually the @c LOCALEDIR macro, defined by the build system. - * E.g. @c $prefix/share/locale. - * Only used on non-Windows systems. On Windows, the directory is determined - * by @c g_win32_get_package_installation_directory(). - * @param package The package name, usually this is the @c GETTEXT_PACKAGE macro, - * defined by the build system. - * - * @since 0.16 - **/ -GEANY_API_SYMBOL -void main_locale_init(const gchar *locale_dir, const gchar *package) -{ -#ifdef HAVE_LOCALE_H - setlocale(LC_ALL, ""); -#endif - -#ifdef G_OS_WIN32 - locale_dir = utils_resource_dir(RESOURCE_DIR_LOCALE); -#endif - (void) bindtextdomain(package, locale_dir); - (void) bind_textdomain_codeset(package, "UTF-8"); -} - - -static void print_filetypes(void) -{ - const GSList *list, *node; - - filetypes_init_types(); - printf("Geany's filetype names:\n"); - - list = filetypes_get_sorted_by_name(); - foreach_slist(node, list) - { - GeanyFiletype *ft = node->data; - - printf("%s\n", ft->name); - } - filetypes_free_types(); -} - - -static void wait_for_input_on_windows(void) -{ -#ifdef G_OS_WIN32 - if (verbose_mode) - { - geany_debug("Press any key to continue"); - getchar(); - } -#endif -} - - -static void parse_command_line_options(gint *argc, gchar ***argv) -{ - GError *error = NULL; - GOptionContext *context; - gint i; - CommandLineOptions def_clo = {FALSE, NULL, TRUE, -1, -1, FALSE, FALSE, FALSE}; - - /* first initialise cl_options fields with default values */ - cl_options = def_clo; - - /* the GLib option parser can't handle the +NNN (line number) option, - * so we grab that here and replace it with a no-op */ - for (i = 1; i < (*argc); i++) - { - if ((*argv)[i][0] != '+') - continue; - - cl_options.goto_line = atoi((*argv)[i] + 1); - (*argv)[i] = (gchar *) "--dummy"; - } - - 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)); - g_option_context_parse(context, argc, argv, &error); - g_option_context_free(context); - - if (error != NULL) - { - g_printerr("Geany: %s\n", error->message); - g_error_free(error); - exit(1); - } - - app->debug_mode = verbose_mode; - if (app->debug_mode) - { - /* Since GLib 2.32 messages logged with levels INFO and DEBUG aren't output by the - * default log handler unless the G_MESSAGES_DEBUG environment variable contains the - * domain of the message or is set to the special value "all" */ - g_setenv("G_MESSAGES_DEBUG", "all", FALSE); - } - -#ifdef G_OS_WIN32 - win32_init_debug_code(); -#endif - - if (show_version) - { - gchar *build_date = utils_parse_and_format_build_date(__DATE__); - - printf(PACKAGE " %s (", main_get_version_string()); - /* note for translators: library versions are printed after this */ - printf(_("built on %s with "), build_date); - printf(geany_lib_versions, - GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf(")\n"); - g_free(build_date); - wait_for_input_on_windows(); - exit(0); - } - - if (print_prefix) - { - printf("%s\n", GEANY_PREFIX); - printf("%s\n", GEANY_DATADIR); - printf("%s\n", GEANY_LIBDIR); - printf("%s\n", GEANY_LOCALEDIR); - wait_for_input_on_windows(); - exit(0); - } - - if (alternate_config) - { - geany_debug("alternate config: %s", alternate_config); - app->configdir = alternate_config; - } - else - { - app->configdir = utils_get_user_config_dir(); - } - - if (generate_tags) - { - gboolean ret; - - filetypes_init_types(); - ret = symbols_generate_global_tags(*argc, *argv, ! no_preprocessing); - filetypes_free_types(); - wait_for_input_on_windows(); - exit(ret); - } - - if (ft_names) - { - print_filetypes(); - wait_for_input_on_windows(); - exit(0); - } - -#ifdef HAVE_SOCKET - socket_info.ignore_socket = cl_options.new_instance; - if (cl_options.socket_filename) - { - socket_info.file_name = cl_options.socket_filename; - } -#endif - -#ifdef HAVE_VTE - vte_info.lib_vte = lib_vte; -#endif - cl_options.ignore_global_tags = ignore_global_tags; - - if (! gtk_init_check(NULL, NULL)) - { /* check whether we have a valid X display and exit if not */ - g_printerr("Geany: cannot open display\n"); - exit(1); - } - -#ifdef MAC_INTEGRATION - /* Create GtkosxApplication singleton - should be created shortly after gtk_init() */ - gtkosx_application_get(); -#endif -} - - -static gint create_config_dir(void) -{ - gint saved_errno = 0; - gchar *conf_file = NULL; - gchar *filedefs_dir = NULL; - gchar *templates_dir = NULL; - - if (! g_file_test(app->configdir, G_FILE_TEST_EXISTS)) - { -#ifndef G_OS_WIN32 - /* if we are *not* using an alternate config directory, we check whether the old one - * in ~/.geany still exists and try to move it */ - if (alternate_config == NULL) - { - gchar *old_dir = g_build_filename(g_get_home_dir(), ".geany", NULL); - /* move the old config dir if it exists */ - if (g_file_test(old_dir, G_FILE_TEST_EXISTS)) - { - if (! dialogs_show_question_full(main_widgets.window, - GTK_STOCK_YES, GTK_STOCK_QUIT, _("Move it now?"), - "%s", - _("Geany needs to move your old configuration directory before starting."))) - exit(0); - - if (! g_file_test(app->configdir, G_FILE_TEST_IS_DIR)) - utils_mkdir(app->configdir, TRUE); - - if (g_rename(old_dir, app->configdir) == 0) - { - dialogs_show_msgbox(GTK_MESSAGE_INFO, - _("Your configuration directory has been successfully moved from \"%s\" to \"%s\"."), - old_dir, app->configdir); - g_free(old_dir); - return 0; - } - else - { - dialogs_show_msgbox(GTK_MESSAGE_WARNING, - /* for translators: the third %s in brackets is the error message which - * describes why moving the dir didn't work */ - _("Your old configuration directory \"%s\" could not be moved to \"%s\" (%s). " - "Please move manually the directory to the new location."), - old_dir, app->configdir, g_strerror(errno)); - } - } - g_free(old_dir); - } -#endif - geany_debug("creating config directory %s", app->configdir); - saved_errno = utils_mkdir(app->configdir, TRUE); - } - - conf_file = g_build_filename(app->configdir, "geany.conf", NULL); - filedefs_dir = g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, NULL); - templates_dir = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, NULL); - - if (saved_errno == 0 && ! g_file_test(conf_file, G_FILE_TEST_EXISTS)) - { /* check whether geany.conf can be written */ - saved_errno = utils_is_file_writable(app->configdir); - } - - /* make subdir for filetype definitions */ - if (saved_errno == 0) - { - gchar *filedefs_readme = g_build_filename(app->configdir, - GEANY_FILEDEFS_SUBDIR, "filetypes.README", NULL); - - if (! g_file_test(filedefs_dir, G_FILE_TEST_EXISTS)) - { - saved_errno = utils_mkdir(filedefs_dir, FALSE); - } - if (saved_errno == 0 && ! g_file_test(filedefs_readme, G_FILE_TEST_EXISTS)) - { - gchar *text = g_strconcat( -"Copy files from ", app->datadir, " to this directory to overwrite " -"them. To use the defaults, just delete the file in this directory.\nFor more information read " -"the documentation (in ", app->docdir, G_DIR_SEPARATOR_S "index.html or visit " GEANY_HOMEPAGE ").", NULL); - utils_write_file(filedefs_readme, text); - g_free(text); - } - g_free(filedefs_readme); - } - - /* make subdir for template files */ - if (saved_errno == 0) - { - gchar *templates_readme = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, - "templates.README", NULL); - - if (! g_file_test(templates_dir, G_FILE_TEST_EXISTS)) - { - saved_errno = utils_mkdir(templates_dir, FALSE); - } - if (saved_errno == 0 && ! g_file_test(templates_readme, G_FILE_TEST_EXISTS)) - { - gchar *text = g_strconcat( -"There are several template files in this directory. For these templates you can use wildcards.\n\ -For more information read the documentation (in ", app->docdir, G_DIR_SEPARATOR_S "index.html or visit " GEANY_HOMEPAGE ").", - NULL); - utils_write_file(templates_readme, text); - g_free(text); - } - g_free(templates_readme); - } - - g_free(filedefs_dir); - g_free(templates_dir); - g_free(conf_file); - - return saved_errno; -} - - -/* Returns 0 if config dir is OK. */ -static gint setup_config_dir(void) -{ - gint mkdir_result = 0; - - /* convert configdir to locale encoding to avoid troubles */ - SETPTR(app->configdir, utils_get_locale_from_utf8(app->configdir)); - - mkdir_result = create_config_dir(); - if (mkdir_result != 0) - { - if (! dialogs_show_question( - _("Configuration directory could not be created (%s).\nThere could be some problems " - "using Geany without a configuration directory.\nStart Geany anyway?"), - g_strerror(mkdir_result))) - { - exit(0); - } - } - /* make configdir a real path */ - if (g_file_test(app->configdir, G_FILE_TEST_EXISTS)) - SETPTR(app->configdir, tm_get_real_path(app->configdir)); - - return mkdir_result; -} - -/* Signal handling removed since main_quit() uses functions that are - * illegal in signal handlers -static void signal_cb(gint sig) -{ - if (sig == SIGTERM) - { - main_quit(); - } -} - */ - -/* Used for command-line arguments at startup or from socket. - * this will strip any :line:col filename suffix from locale_filename */ -gboolean main_handle_filename(const gchar *locale_filename) -{ - GeanyDocument *doc; - gint line = -1, column = -1; - gchar *filename; - - g_return_val_if_fail(locale_filename, FALSE); - - /* check whether the passed filename is an URI */ - filename = utils_get_path_from_uri(locale_filename); - if (filename == NULL) - return FALSE; - - get_line_and_column_from_filename(filename, &line, &column); - if (line >= 0) - cl_options.goto_line = line; - if (column >= 0) - cl_options.goto_column = column; - - if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) - { - doc = document_open_file(filename, cl_options.readonly, NULL, NULL); - /* add recent file manually if opening_session_files is set */ - if (doc != NULL && main_status.opening_session_files) - ui_add_recent_document(doc); - g_free(filename); - return TRUE; - } - else if (file_prefs.cmdline_new_files) - { /* create new file with the given filename */ - gchar *utf8_filename = utils_get_utf8_from_locale(filename); - - doc = document_new_file(utf8_filename, NULL, NULL); - if (doc != NULL) - ui_add_recent_document(doc); - g_free(utf8_filename); - g_free(filename); - return TRUE; - } - g_free(filename); - return FALSE; -} - - -/* open files from command line */ -static void open_cl_files(gint argc, gchar **argv) -{ - gint i; - - for (i = 1; i < argc; i++) - { - gchar *filename = main_get_argv_filename(argv[i]); - - if (g_file_test(filename, G_FILE_TEST_IS_DIR)) - { - g_free(filename); - continue; - } - -#ifdef G_OS_WIN32 - /* It seems argv elements are encoded in CP1252 on a German Windows */ - SETPTR(filename, g_locale_to_utf8(filename, -1, NULL, NULL, NULL)); -#endif - if (filename && ! main_handle_filename(filename)) - { - const gchar *msg = _("Could not find file '%s'."); - - g_printerr(msg, filename); /* also print to the terminal */ - g_printerr("\n"); - ui_set_statusbar(TRUE, msg, filename); - } - g_free(filename); - } -} - - -static void load_session_project_file(void) -{ - gchar *locale_filename; - - g_return_if_fail(project_prefs.session_file != NULL); - - locale_filename = utils_get_locale_from_utf8(project_prefs.session_file); - - if (G_LIKELY(!EMPTY(locale_filename))) - project_load_file(locale_filename); - - g_free(locale_filename); - g_free(project_prefs.session_file); /* no longer needed */ -} - - -static void load_settings(void) -{ - configuration_load(); - /* let cmdline options overwrite configuration settings */ -#ifdef HAVE_VTE - vte_info.have_vte = (no_vte) ? FALSE : vte_info.load_vte; -#endif - if (no_msgwin) - ui_prefs.msgwindow_visible = FALSE; - -#ifdef HAVE_PLUGINS - want_plugins = prefs.load_plugins && !no_plugins; -#endif -} - - -void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session) -{ - gchar *pfile; - - pfile = utils_get_path_from_uri(locale_filename); - if (pfile != NULL) - { - if (use_session) - project_load_file_with_session(pfile); - else - project_load_file(pfile); - } - g_free(pfile); -} - - -static void load_startup_files(gint argc, gchar **argv) -{ - gboolean load_session = FALSE; - - if (argc > 1 && g_str_has_suffix(argv[1], ".geany")) - { - gchar *filename = main_get_argv_filename(argv[1]); - - /* project file specified: load it, but decide the session later */ - main_load_project_from_command_line(filename, FALSE); - argc--, argv++; - /* force session load if using project-based session files */ - load_session = project_prefs.project_session; - g_free(filename); - } - - /* Load the default session if: - * 1. "Load files from the last session" is active. - * 2. --no-session is not specified. - * 3. We are a primary instance. - * Has no effect if a CL project is loaded and using project-based session files. */ - if (prefs.load_session && cl_options.load_session && !cl_options.new_instance) - { - if (app->project == NULL) - load_session_project_file(); - load_session = TRUE; - } - - if (load_session) - { - /* load session files into tabs, as they are found in the session_files variable */ - configuration_open_files(); - - if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) == 0) - { - ui_update_popup_copy_items(NULL); - ui_update_popup_reundo_items(NULL); - } - } - - open_cl_files(argc, argv); -} - - -static gboolean send_startup_complete(gpointer data) -{ - g_signal_emit_by_name(geany_object, "geany-startup-complete"); - return FALSE; -} - - -static const gchar *get_locale(void) -{ - const gchar *locale = "unknown"; -#ifdef HAVE_LOCALE_H - locale = setlocale(LC_CTYPE, NULL); -#endif - return locale; -} - - -#if ! GTK_CHECK_VERSION(3, 0, 0) -/* This prepends our own gtkrc file to the list of RC files to be loaded by GTK at startup. - * This function *has* to be called before gtk_init(). - * - * We have a custom RC file defining various styles we need, and we want the user to be - * able to override them (e.g. if they want -- or need -- other colors). Fair enough, one - * would simply call gtk_rc_parse() with the appropriate filename. However, the styling - * rules applies in the order they are loaded, then if we load our styles after GTK has - * loaded the user's ones we'd override them. - * - * There are 2 solutions to fix this: - * 1) set our styles' priority to something with lower than "user" (actually "theme" - * priority because rules precedence are first calculated depending on the priority - * no matter of how precise the rules is, so we need to override the theme). - * 2) prepend our custom style to GTK's list while keeping priority to user (which is the - * default), so it gets loaded before real user's ones and so gets overridden by them. - * - * One would normally go for 1 because it's ways simpler and requires less code: you just - * have to add the priorities to your styles, which is a matter of adding a few ":theme" in - * the RC file. However, KDE being a bitch it doesn't set the gtk-theme-name but rather - * directly includes the style to use in a user gtkrc file, which makes the theme have - * "user" priority, hence overriding our styles. So, we cannot set priorities in the RC - * file if we want to support running under KDE, which pretty much leave us with no choice - * but to go with solution 2, which unfortunately requires writing ugly code since GTK - * don't have a gtk_rc_prepend_default_file() function. Thank you very much KDE. - * - * Though, as a side benefit it also makes the code work with people using gtk-chtheme, - * which also found it funny to include the theme in the user RC file. */ -static void setup_gtk2_styles(void) -{ - gchar **gtk_files = gtk_rc_get_default_files(); - gchar **new_files = g_malloc(sizeof *new_files * (g_strv_length(gtk_files) + 2)); - guint i = 0; - - new_files[i++] = g_build_filename(app->datadir, "geany.gtkrc", NULL); - for (; *gtk_files; gtk_files++) - new_files[i++] = g_strdup(*gtk_files); - new_files[i] = NULL; - - gtk_rc_set_default_files(new_files); - - g_strfreev(new_files); -} -#endif - - -gint main(gint argc, gchar **argv) -{ - GeanyDocument *doc; - gint config_dir_result; - const gchar *locale; - -#if ! GLIB_CHECK_VERSION(2, 36, 0) - g_type_init(); -#endif - - log_handlers_init(); - - app = g_new0(GeanyApp, 1); - memset(&main_status, 0, sizeof(GeanyStatus)); - memset(&prefs, 0, sizeof(GeanyPrefs)); - memset(&interface_prefs, 0, sizeof(GeanyInterfacePrefs)); - memset(&toolbar_prefs, 0, sizeof(GeanyToolbarPrefs)); - memset(&file_prefs, 0, sizeof(GeanyFilePrefs)); - memset(&search_prefs, 0, sizeof(GeanySearchPrefs)); - memset(&tool_prefs, 0, sizeof(GeanyToolPrefs)); - memset(&template_prefs, 0, sizeof(GeanyTemplatePrefs)); - memset(&ui_prefs, 0, sizeof(UIPrefs)); - memset(&ui_widgets, 0, sizeof(UIWidgets)); - - setup_paths(); -#if ! GTK_CHECK_VERSION(3, 0, 0) - setup_gtk2_styles(); -#endif -#ifdef ENABLE_NLS - main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE); -#endif - parse_command_line_options(&argc, &argv); - -#if ! GLIB_CHECK_VERSION(2, 32, 0) - /* Initialize GLib's thread system in case any plugins want to use it or their - * dependencies (e.g. WebKit, Soup, ...). Deprecated since GLIB 2.32. */ - if (!g_thread_supported()) - g_thread_init(NULL); -#endif - - /* removed as signal handling was wrong, see signal_cb() - signal(SIGTERM, signal_cb); */ - -#ifdef G_OS_UNIX - /* ignore SIGPIPE signal for preventing sudden death of program */ - signal(SIGPIPE, SIG_IGN); -#endif - - config_dir_result = setup_config_dir(); -#ifdef HAVE_SOCKET - /* check and create (unix domain) socket for remote operation */ - if (! socket_info.ignore_socket) - { - socket_info.lock_socket = -1; - socket_info.lock_socket_tag = 0; - socket_info.lock_socket = socket_init(argc, argv); - /* Quit if filenames were sent to first instance or the list of open - * documents has been printed */ - if ((socket_info.lock_socket == -2 /* socket exists */ && argc > 1) || - cl_options.list_documents) - { - socket_finalize(); - gdk_notify_startup_complete(); - g_free(app->configdir); - g_free(app->datadir); - g_free(app->docdir); - g_free(app); - return 0; - } - /* Start a new instance if no command line strings were passed, - * even if the socket already exists */ - else if (socket_info.lock_socket == -2 /* socket already exists */) - { - socket_info.ignore_socket = TRUE; - cl_options.new_instance = TRUE; - } - } -#endif - -#ifdef G_OS_WIN32 - /* after we initialized the socket code and handled command line args, - * let's change the working directory on Windows to not lock it */ - change_working_directory_on_windows(); -#endif - - locale = get_locale(); - geany_debug("Geany %s, %s", - main_get_version_string(), - locale); - geany_debug(geany_lib_versions, - gtk_major_version, gtk_minor_version, gtk_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - geany_debug("System data dir: %s", app->datadir); - geany_debug("User config dir: %s", app->configdir); - - /* create the object so Geany signals can be connected in init() functions */ - geany_object = geany_object_new(); - - /* inits */ - main_init(); - - encodings_init(); - editor_init(); - - /* init stash groups before loading keyfile */ - configuration_init(); - ui_init_prefs(); - search_init(); - project_init(); -#ifdef HAVE_PLUGINS - plugins_init(); -#endif - sidebar_init(); - load_settings(); /* load keyfile */ - - msgwin_init(); - build_init(); - ui_create_insert_menu_items(); - ui_create_insert_date_menu_items(); - keybindings_init(); - notebook_init(); - filetypes_init(); - templates_init(); - navqueue_init(); - document_init_doclist(); - symbols_init(); - editor_snippets_init(); - -#ifdef HAVE_VTE - vte_init(); -#endif - ui_create_recent_menus(); - - ui_set_statusbar(TRUE, _("This is Geany %s."), main_get_version_string()); - if (config_dir_result != 0) - ui_set_statusbar(TRUE, _("Configuration directory could not be created (%s)."), - g_strerror(config_dir_result)); - - /* apply all configuration options */ - apply_settings(); - -#ifdef HAVE_PLUGINS - /* load any enabled plugins before we open any documents */ - if (want_plugins) - plugins_load_active(); -#endif - - ui_sidebar_show_hide(); - - /* set the active sidebar page after plugins have been loaded */ - gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), ui_prefs.sidebar_page); - - /* load keybinding settings after plugins have added their groups */ - keybindings_load_keyfile(); - - /* create the custom command menu after the keybindings have been loaded to have the proper - * accelerator shown for the menu items */ - tools_create_insert_custom_command_menu_items(); - - /* load any command line files or session files */ - main_status.opening_session_files = TRUE; - load_startup_files(argc, argv); - main_status.opening_session_files = FALSE; - - /* open a new file if no other file was opened */ - document_new_file_if_non_open(); - - ui_document_buttons_update(); - ui_save_buttons_toggle(FALSE); - - doc = document_get_current(); - sidebar_select_openfiles_item(doc); - build_menu_update(doc); - sidebar_update_tag_list(doc, FALSE); - -#ifdef G_OS_WIN32 - /* Manually realise the main window to be able to set the position but don't show it. - * We don't set the position after showing the window to avoid flickering. */ - gtk_widget_realize(main_widgets.window); -#endif - setup_window_position(); - - /* finally show the window */ - document_grab_focus(doc); - gtk_widget_show(main_widgets.window); - main_status.main_window_realized = TRUE; - - configuration_apply_settings(); - -#ifdef HAVE_SOCKET - /* register the callback of socket input */ - if (! socket_info.ignore_socket && socket_info.lock_socket > 0) - { - socket_info.read_ioc = g_io_channel_unix_new(socket_info.lock_socket); - socket_info.lock_socket_tag = g_io_add_watch(socket_info.read_ioc, - G_IO_IN | G_IO_PRI | G_IO_ERR, socket_lock_input_cb, main_widgets.window); - } -#endif - - /* when we are really done with setting everything up and the main event loop is running, - * tell other components, mainly plugins, that startup is complete */ - g_idle_add_full(G_PRIORITY_LOW, send_startup_complete, NULL, NULL); - -#ifdef MAC_INTEGRATION - /* OS X application ready - has to be called before entering main loop */ - gtkosx_application_ready(gtkosx_application_get()); -#endif - - gtk_main(); - return 0; -} - - -static void queue_free(GQueue *queue) -{ - while (! g_queue_is_empty(queue)) - { - g_free(g_queue_pop_tail(queue)); - } - g_queue_free(queue); -} - - -static void do_main_quit(void) -{ - geany_debug("Quitting..."); - - configuration_save(); - - if (app->project != NULL) - project_close(FALSE); /* save project session files */ - - document_close_all(); - - main_status.quitting = TRUE; - -#ifdef HAVE_SOCKET - socket_finalize(); -#endif - -#ifdef HAVE_PLUGINS - plugins_finalize(); -#endif - - navqueue_free(); - keybindings_free(); - notebook_free(); - highlighting_free_styles(); - templates_free_templates(); - msgwin_finalize(); - search_finalize(); - build_finalize(); - document_finalize(); - symbols_finalize(); - project_finalize(); - editor_finalize(); - editor_snippets_free(); - encodings_finalize(); - toolbar_finalize(); - sidebar_finalize(); - configuration_finalize(); - filetypes_free_types(); - log_finalize(); - - tm_workspace_free(); - g_free(app->configdir); - g_free(app->datadir); - g_free(app->docdir); - g_free(prefs.default_open_path); - g_free(prefs.custom_plugin_path); - g_free(ui_prefs.custom_date_format); - g_free(interface_prefs.editor_font); - g_free(interface_prefs.tagbar_font); - g_free(interface_prefs.msgwin_font); - g_free(editor_prefs.long_line_color); - g_free(editor_prefs.comment_toggle_mark); - g_free(editor_prefs.color_scheme); - g_free(tool_prefs.context_action_cmd); - g_free(template_prefs.developer); - g_free(template_prefs.company); - g_free(template_prefs.mail); - g_free(template_prefs.initials); - g_free(template_prefs.version); - g_free(tool_prefs.term_cmd); - g_free(tool_prefs.browser_cmd); - g_free(tool_prefs.grep_cmd); - g_free(printing_prefs.external_print_cmd); - g_free(printing_prefs.page_header_datefmt); - g_strfreev(ui_prefs.custom_commands); - g_strfreev(ui_prefs.custom_commands_labels); - - queue_free(ui_prefs.recent_queue); - queue_free(ui_prefs.recent_projects_queue); - - if (ui_widgets.prefs_dialog && GTK_IS_WIDGET(ui_widgets.prefs_dialog)) gtk_widget_destroy(ui_widgets.prefs_dialog); - if (ui_widgets.open_fontsel && GTK_IS_WIDGET(ui_widgets.open_fontsel)) gtk_widget_destroy(ui_widgets.open_fontsel); - if (ui_widgets.open_colorsel && GTK_IS_WIDGET(ui_widgets.open_colorsel)) gtk_widget_destroy(ui_widgets.open_colorsel); -#ifdef HAVE_VTE - if (vte_info.have_vte) vte_close(); - g_free(vte_info.lib_vte); - g_free(vte_info.dir); -#endif - gtk_widget_destroy(main_widgets.window); - - /* destroy popup menus */ - if (main_widgets.editor_menu && GTK_IS_WIDGET(main_widgets.editor_menu)) - gtk_widget_destroy(main_widgets.editor_menu); - if (ui_widgets.toolbar_menu && GTK_IS_WIDGET(ui_widgets.toolbar_menu)) - gtk_widget_destroy(ui_widgets.toolbar_menu); - if (msgwindow.popup_status_menu && GTK_IS_WIDGET(msgwindow.popup_status_menu)) - gtk_widget_destroy(msgwindow.popup_status_menu); - if (msgwindow.popup_msg_menu && GTK_IS_WIDGET(msgwindow.popup_msg_menu)) - gtk_widget_destroy(msgwindow.popup_msg_menu); - if (msgwindow.popup_compiler_menu && GTK_IS_WIDGET(msgwindow.popup_compiler_menu)) - gtk_widget_destroy(msgwindow.popup_compiler_menu); - - g_object_unref(geany_object); - geany_object = NULL; - - g_free(original_cwd); - g_free(app); - - ui_finalize_builder(); - - gtk_main_quit(); -} - - -static gboolean check_no_unsaved(void) -{ - guint i; - - for (i = 0; i < documents_array->len; i++) - { - if (documents[i]->is_valid && documents[i]->changed) - { - return FALSE; - } - } - return TRUE; /* no unsaved edits */ -} - - -/* Returns false when quitting is aborted due to user cancellation */ -gboolean main_quit(void) -{ - main_status.quitting = TRUE; - - if (! check_no_unsaved()) - { - if (document_account_for_unsaved()) - { - do_main_quit(); - return TRUE; - } - } - else - if (! prefs.confirm_exit || - dialogs_show_question_full(NULL, GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL, - _("Do you really want to quit?"))) - { - do_main_quit(); - return TRUE; - } - - main_status.quitting = FALSE; - return FALSE; -} - -/** - * Reloads most of Geany's configuration files without restarting. Currently the following - * files are reloaded: all template files, also new file templates and the 'New (with template)' - * menus will be updated, Snippets (snippets.conf), filetype extensions (filetype_extensions.conf), - * and 'settings' and 'build_settings' sections of the filetype definition files. - * - * Plugins may call this function if they changed any of these files (e.g. a configuration file - * editor plugin). - * - * @since 0.15 - **/ -GEANY_API_SYMBOL -void main_reload_configuration(void) -{ - /* reload templates */ - templates_free_templates(); - templates_init(); - - /* reload snippets */ - editor_snippets_free(); - editor_snippets_init(); - - filetypes_reload_extensions(); - filetypes_reload(); - - /* C tag names to ignore */ - symbols_reload_config_files(); - - ui_set_statusbar(TRUE, _("Configuration files reloaded.")); + return main_lib(argc, argv); } diff --git a/src/main.h b/src/main.h index d5bb6248..f2babac3 100644 --- a/src/main.h +++ b/src/main.h @@ -75,6 +75,8 @@ gboolean main_handle_filename(const gchar *locale_filename); void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session); +gint main_lib(gint argc, gchar **argv); + #endif /* GEANY_PRIVATE */ G_END_DECLS diff --git a/tagmanager/ctags/Makefile.am b/tagmanager/ctags/Makefile.am index 9061ebf2..ca3eb523 100644 --- a/tagmanager/ctags/Makefile.am +++ b/tagmanager/ctags/Makefile.am @@ -3,12 +3,13 @@ AM_CPPFLAGS = \ -I$(srcdir)/.. \ -DG_LOG_DOMAIN=\"CTags\" AM_CFLAGS = \ - $(GTK_CFLAGS) + $(GTK_CFLAGS) \ + -fvisibility=hidden EXTRA_DIST = \ makefile.win32 -noinst_LIBRARIES = libctags.a +noinst_LTLIBRARIES = libctags.la parsers = \ abaqus.c \ @@ -53,7 +54,7 @@ parsers = \ verilog.c \ vhdl.c -libctags_a_SOURCES = \ +libctags_la_SOURCES = \ args.c \ args.h \ ctags.c \ diff --git a/tagmanager/mio/Makefile.am b/tagmanager/mio/Makefile.am index ccb9ff60..189250b4 100644 --- a/tagmanager/mio/Makefile.am +++ b/tagmanager/mio/Makefile.am @@ -1,9 +1,9 @@ -noinst_LIBRARIES = libmio.a +noinst_LTLIBRARIES = libmio.la AM_CPPFLAGS = -DG_LOG_DOMAIN=\"MIO\" #-DMIO_DEBUG -AM_CFLAGS = $(GTK_CFLAGS) +AM_CFLAGS = $(GTK_CFLAGS) -fvisibility=hidden -libmio_a_SOURCES = mio.c +libmio_la_SOURCES = mio.c EXTRA_DIST = \ mio.h \ diff --git a/tagmanager/src/Makefile.am b/tagmanager/src/Makefile.am index ec8bf8f6..97d5cb26 100644 --- a/tagmanager/src/Makefile.am +++ b/tagmanager/src/Makefile.am @@ -5,12 +5,13 @@ AM_CPPFLAGS = \ -DGEANY_PRIVATE \ -DG_LOG_DOMAIN=\"Tagmanager\" AM_CFLAGS = \ - $(GTK_CFLAGS) + $(GTK_CFLAGS) \ + -fvisibility=hidden EXTRA_DIST = \ makefile.win32 -noinst_LIBRARIES = libtagmanager.a +noinst_LTLIBRARIES = libtagmanager.la tagmanager_includedir = $(includedir)/geany/tagmanager tagmanager_include_HEADERS = \ @@ -20,7 +21,7 @@ tagmanager_include_HEADERS = \ tm_workspace.h -libtagmanager_a_SOURCES =\ +libtagmanager_la_SOURCES =\ tm_tagmanager.h \ tm_parser.h \ tm_source_file.h \ From eb36500ac425c2b4f038bbcb1d3e38f353f0402c Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Mon, 13 Oct 2014 23:07:11 -0700 Subject: [PATCH 07/40] Improve Autotools build system for libgeany Checks if the compiler supports -fvisibility and the linker supports -dynamic-list arguments and use them instead of hardcoding. The new geany-lib.m4 also accomodates future use of Libtool versioning. --- configure.ac | 3 +++ m4/geany-lib.m4 | 48 ++++++++++++++++++++++++++++++++++++ scintilla/Makefile.am | 5 ++-- src/Makefile.am | 21 ++++++++-------- tagmanager/ctags/Makefile.am | 3 ++- tagmanager/mio/Makefile.am | 3 ++- tagmanager/src/Makefile.am | 4 ++- 7 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 m4/geany-lib.m4 diff --git a/configure.ac b/configure.ac index 8d8ee6b9..0efd4011 100644 --- a/configure.ac +++ b/configure.ac @@ -122,6 +122,9 @@ AC_SUBST([pkgdatadir]) GEANY_CHECK_DOCUTILS GEANY_CHECK_DOXYGEN +# libgeany +GEANY_LIB_INIT + # Output AC_CONFIG_FILES([ Makefile diff --git a/m4/geany-lib.m4 b/m4/geany-lib.m4 new file mode 100644 index 00000000..90323342 --- /dev/null +++ b/m4/geany-lib.m4 @@ -0,0 +1,48 @@ +AC_DEFUN([GEANY_LIB_INIT], +[ + +dnl In the future, if we want to use libtool/library versioning, we can +dnl set these variables accordingly. For now its the same as if not specified (0:0:0) + libgeany_current=0 + libgeany_revision=0 + libgeany_age=0 + +dnl Try and see if we can use -fvisibility compiler option and GCC`s +dnl `__attribute__((visibility(...)))` extension and use it if so. + AC_MSG_CHECKING([whether compiler supports -fvisibility]) + libgeany_backup_cflags=$CFLAGS + CFLAGS=-fvisibility=hidden + AC_TRY_COMPILE([], [ + __attribute__ ((visibility ("default"))) + int main(int argc, char **argv) { return 0; } + ], [ + LIBGEANY_CFLAGS="${CFLAGS}" + AC_MSG_RESULT([yes]) + ], [ + LIBGEANY_CFLAGS="" + AC_MSG_RESULT([no]) + ]) + CFLAGS="${libgeany_backup_cflags}" + +dnl Try and see if we can use our list of dynamically exported symbols with +dnl the linker and use it if so. + AC_MSG_CHECKING([whether linker supports --dynamic-list]) + libgeany_backup_ldflags=$LDFLAGS + LDFLAGS=-Wl,--dynamic-list="${srcdir}/src/dynamicsymbols.list" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([], []) + ], [ + LIBGEANY_LIBS="-Wl,--dynamic-list=\"\$(top_srcdir)/src/dynamicsymbols.list\"" + AC_MSG_RESULT([yes]) + ], [ + LIBGEANY_LIBS="" + AC_MSG_RESULT([no]) + ]) + LDFLAGS="${libgeany_backup_ldflags}" + + LIBGEANY_LIBS="${LIBGEANY_LIBS} -version-info ${libgeany_current}:${libgeany_revision}:${libgeany_age}" + + AC_SUBST([LIBGEANY_CFLAGS]) + AC_SUBST([LIBGEANY_LIBS]) + +]) diff --git a/scintilla/Makefile.am b/scintilla/Makefile.am index cf2377a2..022f38c8 100644 --- a/scintilla/Makefile.am +++ b/scintilla/Makefile.am @@ -140,9 +140,10 @@ src/XPM.h \ $(LEXER_SRCS) libscintilla_la_SOURCES = $(SRCS) +libscintilla_la_LDFLAGS = @LIBGEANY_LIBS@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir)/include -I$(srcdir)/src -I$(srcdir)/lexlib @GTK_CFLAGS@ \ - -fvisibility=hidden +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir)/include -I$(srcdir)/src -I$(srcdir)/lexlib \ + @GTK_CFLAGS@ @LIBGEANY_CFLAGS@ marshallers: gtk/scintilla-marshal.list glib-genmarshal --prefix scintilla_marshal gtk/scintilla-marshal.list --header > gtk/scintilla-marshal.h diff --git a/src/Makefile.am b/src/Makefile.am index eb4d4789..636e636b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -102,11 +102,11 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/scintilla/include \ -I$(top_srcdir)/tagmanager/src \ - @GTK_CFLAGS@ @GTHREAD_CFLAGS@ $(MAC_INTEGRATION_CFLAGS) + @GTK_CFLAGS@ @GTHREAD_CFLAGS@ $(MAC_INTEGRATION_CFLAGS) @LIBGEANY_CFLAGS@ # tell automake we have a C++ file so it uses the C++ linker we need for Scintilla nodist_EXTRA_geany_SOURCES = dummy.cxx - +nodist_EXTRA_libgeany_la_SOURCES = dummy1.cxx if MINGW # build Geany for Windows on non-Windows systems (cross-compile) @@ -121,8 +121,10 @@ libgeany_la_LIBADD = \ @GTK_LIBS@ \ @GTHREAD_LIBS@ \ $(INTLLIBS) \ - -lole32 -luuid -lwsock32 -lcomdlg32 + @LIBGEANY_LIBS@ \ + -lole32 -lwsock32 -lcomdlg32 +libgeany_la_LDFLAGS = -Wl,-luuid $(AM_LDFLAGS) geany_LDADD += geany_private.res -lcomdlg32 AM_CFLAGS = -DGEANY_DATADIR=\"data\" \ @@ -132,10 +134,9 @@ AM_CFLAGS = -DGEANY_DATADIR=\"data\" \ -DGEANY_PREFIX=\"\" \ -DGEANY_PRIVATE \ -DGTK \ - -DG_LOG_DOMAIN=\""Geany"\" \ - -fvisibility=hidden + -DG_LOG_DOMAIN=\""Geany"\" -libgeany_la_LDFLAGS = -mwindows -mms-bitfields -no-undefined +libgeany_la_LDFLAGS += -mwindows -mms-bitfields -no-undefined WINDRES = $(host_alias)-windres @@ -158,9 +159,8 @@ libgeany_la_LIBADD = \ @GTK_LIBS@ \ @GTHREAD_LIBS@ \ $(MAC_INTEGRATION_LIBS) \ - $(INTLLIBS) - -libgeany_la_LDFLAGS = -Wl,--dynamic-list="$(srcdir)/dynamicsymbols.list" + $(INTLLIBS) \ + @LIBGEANY_LIBS@ AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGEANY_DOCDIR=\""$(docdir)"\" \ @@ -169,8 +169,7 @@ AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGEANY_PREFIX=\""$(prefix)"\" \ -DGEANY_PRIVATE \ -DGTK \ - -DG_LOG_DOMAIN=\""Geany"\" \ - -fvisibility=hidden + -DG_LOG_DOMAIN=\""Geany"\" clean-local: diff --git a/tagmanager/ctags/Makefile.am b/tagmanager/ctags/Makefile.am index ca3eb523..c81ccf73 100644 --- a/tagmanager/ctags/Makefile.am +++ b/tagmanager/ctags/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = \ -DG_LOG_DOMAIN=\"CTags\" AM_CFLAGS = \ $(GTK_CFLAGS) \ - -fvisibility=hidden + @LIBGEANY_CFLAGS@ EXTRA_DIST = \ makefile.win32 @@ -84,3 +84,4 @@ libctags_la_SOURCES = \ vstring.h \ $(parsers) +libctags_la_LDFLAGS = @LIBGEANY_LIBS@ diff --git a/tagmanager/mio/Makefile.am b/tagmanager/mio/Makefile.am index 189250b4..c1981072 100644 --- a/tagmanager/mio/Makefile.am +++ b/tagmanager/mio/Makefile.am @@ -1,9 +1,10 @@ noinst_LTLIBRARIES = libmio.la AM_CPPFLAGS = -DG_LOG_DOMAIN=\"MIO\" #-DMIO_DEBUG -AM_CFLAGS = $(GTK_CFLAGS) -fvisibility=hidden +AM_CFLAGS = $(GTK_CFLAGS) @LIBGEANY_CFLAGS@ libmio_la_SOURCES = mio.c +libmio_la_LDFLAGS = @LIBGEANY_LIBS@ EXTRA_DIST = \ mio.h \ diff --git a/tagmanager/src/Makefile.am b/tagmanager/src/Makefile.am index 97d5cb26..c7e64095 100644 --- a/tagmanager/src/Makefile.am +++ b/tagmanager/src/Makefile.am @@ -6,7 +6,7 @@ AM_CPPFLAGS = \ -DG_LOG_DOMAIN=\"Tagmanager\" AM_CFLAGS = \ $(GTK_CFLAGS) \ - -fvisibility=hidden + @LIBGEANY_CFLAGS@ EXTRA_DIST = \ makefile.win32 @@ -30,3 +30,5 @@ libtagmanager_la_SOURCES =\ tm_tag.c \ tm_workspace.h \ tm_workspace.c + +libtagmanager_la_LDFLAGS = @LIBGEANY_LIBS@ From 1d64d5211fc7c660d9facbc5c927bbce32029863 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Sun, 19 Oct 2014 13:49:58 -0700 Subject: [PATCH 08/40] Replace dynamic exports with codegen for GtkBuilder callbacks This prevents having to export those callbacks and put them in the global namespace. Also, use inline shell script in Makefile.am instead of a Python script which should be more portable (by default) and gets rid of the helper script. --- m4/geany-lib.m4 | 23 ++---- scripts/dynamicsymbols.py | 73 ----------------- src/Makefile.am | 24 ++++-- src/callbacks.c | 2 + src/callbacks.h | 3 + src/dynamicsymbols.list | 161 -------------------------------------- src/signalconn.c.in | 32 ++++++++ src/ui_utils.c | 2 +- 8 files changed, 61 insertions(+), 259 deletions(-) delete mode 100755 scripts/dynamicsymbols.py delete mode 100644 src/dynamicsymbols.list create mode 100644 src/signalconn.c.in diff --git a/m4/geany-lib.m4 b/m4/geany-lib.m4 index 90323342..3e63b09b 100644 --- a/m4/geany-lib.m4 +++ b/m4/geany-lib.m4 @@ -24,25 +24,14 @@ dnl `__attribute__((visibility(...)))` extension and use it if so. ]) CFLAGS="${libgeany_backup_cflags}" -dnl Try and see if we can use our list of dynamically exported symbols with -dnl the linker and use it if so. - AC_MSG_CHECKING([whether linker supports --dynamic-list]) - libgeany_backup_ldflags=$LDFLAGS - LDFLAGS=-Wl,--dynamic-list="${srcdir}/src/dynamicsymbols.list" - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([], []) - ], [ - LIBGEANY_LIBS="-Wl,--dynamic-list=\"\$(top_srcdir)/src/dynamicsymbols.list\"" - AC_MSG_RESULT([yes]) - ], [ - LIBGEANY_LIBS="" - AC_MSG_RESULT([no]) - ]) - LDFLAGS="${libgeany_backup_ldflags}" - - LIBGEANY_LIBS="${LIBGEANY_LIBS} -version-info ${libgeany_current}:${libgeany_revision}:${libgeany_age}" + LIBGEANY_LIBS="-version-info ${libgeany_current}:${libgeany_revision}:${libgeany_age}" AC_SUBST([LIBGEANY_CFLAGS]) AC_SUBST([LIBGEANY_LIBS]) +dnl Check for utilities needed to do codegen + AC_PATH_PROG([SORT], [sort], [ + AC_MSG_ERROR([The 'sort' utility is required, is it installed?])]) + AC_PATH_PROG([UNIQ], [uniq], [ + AC_MSG_ERROR([The 'uniq' utility is required, is it installed?])]) ]) diff --git a/scripts/dynamicsymbols.py b/scripts/dynamicsymbols.py deleted file mode 100755 index 6a8b4fd9..00000000 --- a/scripts/dynamicsymbols.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -""" -Script to parse GtkBuilder XML file for signal handler references and list -them in a linker file for which symbols to dynamically export. -""" - -import optparse -import os -import re -import sys -from xml.etree import ElementTree as ET - -def find_handlers(xml_filename, excludes=[]): - def is_excluded(name, excludes): - for exclude in excludes: - m = re.match(exclude, name) - if m: - return True - return False - - tree = ET.parse(xml_filename) - root = tree.getroot() - handlers = [] - signals = root.findall(".//signal") - - for signal in signals: - handler = signal.attrib["handler"] - if not is_excluded(handler, excludes): - handlers.append(handler) - - return sorted(handlers) - -def write_dynamic_list(handlers, output_file): - output_file.write("""\ -/* This file was auto-generated by the `%s' script, do not edit. */ -{ -""" % os.path.basename(__file__)) - for handler in handlers: - output_file.write("\t%s;\n" % handler) - output_file.write("};\n") - -def main(args): - p = optparse.OptionParser(usage="%prog [-o FILE] XMLFILE") - p.add_option("-o", "--output", metavar="FILE", dest="output_file", - default="-", help="write the output to this file (default `-' for stdin)") - - opts, args = p.parse_args(args) - - output_file = None - try: - if opts.output_file == "-": - output_file = sys.stdout - else: - output_file = open(opts.output_file, 'w') - - args = args[1:] - if len(args) == 0: - p.error("invalid XMLFILE argument, expecting a filename, got none") - elif len(args) > 1: - p.error("too many XMLFILE arguments, expecting a single filename") - - handlers = find_handlers(args[0], ["gtk_.+"]) - write_dynamic_list(handlers, output_file) - - finally: - if output_file is not None and output_file is not sys.stdout: - output_file.close() - - return 0 - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/src/Makefile.am b/src/Makefile.am index 636e636b..78c5436c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,7 +11,7 @@ EXTRA_DIST = \ pluginprivate.h \ projectprivate.h \ makefile.win32 \ - $(top_srcdir)/src/dynamicsymbols.list + $(srcdir)/signalconn.c.in bin_PROGRAMS = geany lib_LTLIBRARIES = libgeany.la @@ -173,10 +173,20 @@ AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ clean-local: -# Helper rule to rebuild the dynamicsymbols.list file when handlers are -# added to data/geany.glade. Run `make dynamic-symbols' from the src builddir. -$(top_srcdir)/src/dynamicsymbols.list: $(top_srcdir)/data/geany.glade - -python $(top_srcdir)/scripts/dynamicsymbols.py -o $@ $(top_srcdir)/data/geany.glade -dynamic-symbols: $(top_srcdir)/src/dynamicsymbols.list - endif + +callbacks.c: signalconn.c + +glade_file=$(top_srcdir)/data/geany.glade +template_file=$(srcdir)/signalconn.c.in + +signalconn.c: $(glade_file) $(template_file) + $(AM_V_GEN)( \ + echo '/* This file is auto-generated, do not edit. */' && \ + $(SED) -n '/@callback_map@/q;p' "$(template_file)" && \ + $(SED) -n 's/^.*handler="\([^"]\+\)".*$$/\tg_hash_table_insert(hash, "\1", G_CALLBACK(\1));/p' "$(glade_file)" \ + | $(SORT) | $(UNIQ) && \ + $(SED) -n '/@callback_map@/{:l;n;p;b l}' "$(template_file)" \ + ) > $@ || { $(RM) $@ && exit 1; } + +CLEANFILES = signalconn.c diff --git a/src/callbacks.c b/src/callbacks.c index 039f9030..4923050f 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1988,3 +1988,5 @@ GEANY_EXPORT_SYMBOL void on_detect_width_from_file_activate(GtkMenuItem *menuite ui_document_show_hide(doc); } } + +#include "signalconn.c" diff --git a/src/callbacks.h b/src/callbacks.h index de187958..6017b1ed 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -26,6 +26,9 @@ G_BEGIN_DECLS +/* Defined in auto-generated code in signalconn.c */ +void callbacks_connect(GtkBuilder *builder); + extern gboolean ignore_callback; void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data); diff --git a/src/dynamicsymbols.list b/src/dynamicsymbols.list deleted file mode 100644 index d3117f0f..00000000 --- a/src/dynamicsymbols.list +++ /dev/null @@ -1,161 +0,0 @@ -/* This file was auto-generated by the `dynamicsymbols.py' script, do not edit. */ -{ - on_button_customize_toolbar_clicked; - on_change_font1_activate; - on_clone1_activate; - on_close1_activate; - on_close_all1_activate; - on_close_other_documents1_activate; - on_comments_bsd_activate; - on_comments_changelog_activate; - on_comments_changelog_activate; - on_comments_fileheader_activate; - on_comments_fileheader_activate; - on_comments_function_activate; - on_comments_function_activate; - on_comments_gpl_activate; - on_comments_multiline_activate; - on_context_action1_activate; - on_copy1_activate; - on_copy1_activate; - on_copy_current_lines1_activate; - on_count_words1_activate; - on_cr_activate; - on_crlf_activate; - on_customize_toolbar1_activate; - on_cut1_activate; - on_cut1_activate; - on_cut_current_lines1_activate; - on_debug_messages1_activate; - on_delete1_activate; - on_delete1_activate; - on_delete_current_lines1_activate; - on_detect_type_from_file_activate; - on_detect_width_from_file_activate; - on_duplicate_line_or_selection1_activate; - on_edit1_activate; - on_escape_key_press_event; - on_file1_activate; - on_file_properties_activate; - on_find1_activate; - on_find_document_usage1_activate; - on_find_document_usage1_activate; - on_find_in_files1_activate; - on_find_next1_activate; - on_find_nextsel1_activate; - on_find_previous1_activate; - on_find_prevsel1_activate; - on_find_usage1_activate; - on_find_usage1_activate; - on_fullscreen1_toggled; - on_go_to_line_activate; - on_go_to_next_marker1_activate; - on_go_to_previous_marker1_activate; - on_goto_tag_declaration1; - on_goto_tag_definition1; - on_goto_tag_definition1; - on_help1_activate; - on_help_menu_item_bug_report_activate; - on_help_menu_item_donate_activate; - on_help_menu_item_wiki_activate; - on_help_shortcuts1_activate; - on_hide_toolbar1_activate; - on_indent_width_activate; - on_indent_width_activate; - on_indent_width_activate; - on_indent_width_activate; - on_indent_width_activate; - on_indent_width_activate; - on_indent_width_activate; - on_indent_width_activate; - on_info1_activate; - on_insert_alternative_white_space1_activate; - on_insert_alternative_white_space1_activate; - on_lf_activate; - on_line_breaking1_activate; - on_line_wrapping1_toggled; - on_load_tags1_activate; - on_mark_all1_activate; - on_markers_margin1_toggled; - on_menu_color_schemes_activate; - on_menu_comment_line1_activate; - on_menu_comments_bsd_activate; - on_menu_comments_gpl_activate; - on_menu_comments_multiline_activate; - on_menu_decrease_indent1_activate; - on_menu_fold_all1_activate; - on_menu_increase_indent1_activate; - on_menu_open_selected_file1_activate; - on_menu_open_selected_file1_activate; - on_menu_project1_activate; - on_menu_reload_configuration1_activate; - on_menu_remove_indicators1_activate; - on_menu_select_all1_activate; - on_menu_select_all1_activate; - on_menu_show_indentation_guides1_toggled; - on_menu_show_line_endings1_toggled; - on_menu_show_sidebar1_toggled; - on_menu_show_white_space1_toggled; - on_menu_toggle_all_additional_widgets1_activate; - on_menu_toggle_line_commentation1_activate; - on_menu_uncomment_line1_activate; - on_menu_unfold_all1_activate; - on_menu_write_unicode_bom1_toggled; - on_motion_event; - on_move_lines_down1_activate; - on_move_lines_up1_activate; - on_new1_activate; - on_next_message1_activate; - on_normal_size1_activate; - on_notebook1_switch_page_after; - on_open1_activate; - on_page_setup1_activate; - on_paste1_activate; - on_paste1_activate; - on_plugin_preferences1_activate; - on_preferences1_activate; - on_previous_message1_activate; - on_print1_activate; - on_project_close1_activate; - on_project_new1_activate; - on_project_open1_activate; - on_project_properties1_activate; - on_quit1_activate; - on_redo1_activate; - on_redo1_activate; - on_reflow_lines_block1_activate; - on_remove_markers1_activate; - on_replace1_activate; - on_replace_spaces_activate; - on_replace_tabs_activate; - on_reset_indentation1_activate; - on_save1_activate; - on_save_all1_activate; - on_save_as1_activate; - on_search1_activate; - on_select_current_lines1_activate; - on_select_current_paragraph1_activate; - on_send_selection_to_vte1_activate; - on_set_file_readonly1_toggled; - on_show_color_chooser1_activate; - on_show_line_numbers1_toggled; - on_show_messages_window1_toggled; - on_show_toolbar1_toggled; - on_smart_line_indent1_activate; - on_spaces1_activate; - on_strip_trailing_spaces1_activate; - on_tabs1_activate; - on_tabs_and_spaces1_activate; - on_toggle_case1_activate; - on_toolbutton_reload_clicked; - on_tv_notebook_switch_page; - on_tv_notebook_switch_page_after; - on_undo1_activate; - on_undo1_activate; - on_use_auto_indentation1_toggled; - on_website1_activate; - on_window_delete_event; - on_window_state_event; - on_zoom_in1_activate; - on_zoom_out1_activate; -}; diff --git a/src/signalconn.c.in b/src/signalconn.c.in new file mode 100644 index 00000000..d5983f0a --- /dev/null +++ b/src/signalconn.c.in @@ -0,0 +1,32 @@ + + +static void builder_connect_func(GtkBuilder *builder, GObject *object, + const gchar *signal_name, const gchar *handler_name, GObject *connect_obj, + GConnectFlags flags, gpointer user_data) +{ + GHashTable *hash = user_data; + GCallback callback; + + callback = g_hash_table_lookup(hash, handler_name); + g_return_if_fail(callback); + + if (connect_obj == NULL) + g_signal_connect_data(object, signal_name, callback, NULL, NULL, flags); + else + g_signal_connect_object(object, signal_name, callback, connect_obj, flags); +} + + +void callbacks_connect(GtkBuilder *builder) +{ + GHashTable *hash; + + g_return_if_fail(GTK_IS_BUILDER(builder)); + + hash = g_hash_table_new(g_str_hash, g_str_equal); + +@callback_map@ + + gtk_builder_connect_signals_full(builder, builder_connect_func, hash); + g_hash_table_destroy(hash); +} diff --git a/src/ui_utils.c b/src/ui_utils.c index 4f049451..e9f548a0 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -2448,7 +2448,7 @@ void ui_init_builder(void) } g_free(interface_file); - gtk_builder_connect_signals(builder, NULL); + callbacks_connect(builder); edit_menu1 = GTK_WIDGET(gtk_builder_get_object(builder, "edit_menu1")); prefs_dialog = GTK_WIDGET(gtk_builder_get_object(builder, "prefs_dialog")); From bcc7a35c062b947b244b0e9136c55201ef14a23f Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Sun, 19 Oct 2014 16:01:55 -0700 Subject: [PATCH 09/40] Don't export GtkBuilder callbacks anymore They are connected inside the library now rather than using GModule to find the symbols. Mark local callback handlers as static since they aren't global or exported anymore, they should be static. Since they're static now, all of the forward-declarations of the functions local to callbacks.c are pointless, so just remove them. --- src/callbacks.c | 350 +++++++++++++++++++----------------------------- src/project.c | 3 +- 2 files changed, 137 insertions(+), 216 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index 4923050f..1c4536a8 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -74,85 +74,6 @@ #include -/* prototypes of Glade-only callback to let the compiler know they really are meant to be exported */ -GEANY_EXPORT_SYMBOL gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata); -GEANY_EXPORT_SYMBOL void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); -GEANY_EXPORT_SYMBOL void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data); - - /* represents the state at switching a notebook page(in the left treeviews widget), to not emit * the selection-changed signal from tv.tree_openfiles */ /*static gboolean switch_tv_notebook_page = FALSE; */ @@ -160,7 +81,7 @@ GEANY_EXPORT_SYMBOL void on_clone1_activate(GtkMenuItem *menuitem, gpointer user /* wrapper function to abort exit process if cancel button is pressed */ -GEANY_EXPORT_SYMBOL gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata) +static gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata) { return !main_quit(); } @@ -170,14 +91,14 @@ GEANY_EXPORT_SYMBOL gboolean on_window_delete_event(GtkWidget *widget, GdkEvent * GUI callbacks */ -GEANY_EXPORT_SYMBOL void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data) { document_new_file(NULL, NULL, NULL); } /* create a new file and copy file content and properties */ -GEANY_EXPORT_SYMBOL void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *old_doc = document_get_current(); @@ -186,7 +107,7 @@ GEANY_EXPORT_SYMBOL void on_clone1_activate(GtkMenuItem *menuitem, gpointer user } -GEANY_EXPORT_SYMBOL void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -197,13 +118,13 @@ GEANY_EXPORT_SYMBOL void on_save1_activate(GtkMenuItem *menuitem, gpointer user_ } -GEANY_EXPORT_SYMBOL void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data) { dialogs_show_save_as(); } -GEANY_EXPORT_SYMBOL void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i, max = (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); GeanyDocument *doc, *cur_doc = document_get_current(); @@ -230,13 +151,13 @@ GEANY_EXPORT_SYMBOL void on_save_all1_activate(GtkMenuItem *menuitem, gpointer u } -GEANY_EXPORT_SYMBOL void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { document_close_all(); } -GEANY_EXPORT_SYMBOL void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -245,13 +166,13 @@ GEANY_EXPORT_SYMBOL void on_close1_activate(GtkMenuItem *menuitem, gpointer user } -GEANY_EXPORT_SYMBOL void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) { main_quit(); } -GEANY_EXPORT_SYMBOL void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data) { gtk_widget_set_sensitive(ui_widgets.recent_files_menuitem, g_queue_get_length(ui_prefs.recent_queue) > 0); @@ -261,7 +182,7 @@ GEANY_EXPORT_SYMBOL void on_file1_activate(GtkMenuItem *menuitem, gpointer user_ /* edit actions, c&p & co, from menu bar and from popup menu */ -GEANY_EXPORT_SYMBOL void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *item; GeanyDocument *doc = document_get_current(); @@ -278,7 +199,7 @@ GEANY_EXPORT_SYMBOL void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_ } -GEANY_EXPORT_SYMBOL void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -292,7 +213,7 @@ GEANY_EXPORT_SYMBOL void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_ } -GEANY_EXPORT_SYMBOL void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -306,7 +227,7 @@ GEANY_EXPORT_SYMBOL void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_ } -GEANY_EXPORT_SYMBOL void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -326,7 +247,7 @@ GEANY_EXPORT_SYMBOL void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_d } -GEANY_EXPORT_SYMBOL void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -346,7 +267,7 @@ GEANY_EXPORT_SYMBOL void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_ } -GEANY_EXPORT_SYMBOL void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -369,7 +290,7 @@ GEANY_EXPORT_SYMBOL void on_paste1_activate(GtkMenuItem *menuitem, gpointer user } -GEANY_EXPORT_SYMBOL void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window)); @@ -389,28 +310,28 @@ GEANY_EXPORT_SYMBOL void on_delete1_activate(GtkMenuItem *menuitem, gpointer use } -GEANY_EXPORT_SYMBOL void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) { prefs_show_dialog(); } /* about menu item */ -GEANY_EXPORT_SYMBOL void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data) { about_dialog_show(); } /* open file */ -GEANY_EXPORT_SYMBOL void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data) { dialogs_show_open_file(); } /* reload file */ -GEANY_EXPORT_SYMBOL void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data) +void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -420,7 +341,7 @@ GEANY_EXPORT_SYMBOL void on_toolbutton_reload_clicked(GtkAction *action, gpointe } -GEANY_EXPORT_SYMBOL void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data) { dialogs_show_open_font(); } @@ -485,7 +406,7 @@ void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data) /* hides toolbar from toolbar popup menu */ -GEANY_EXPORT_SYMBOL void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *tool_item = ui_lookup_widget(GTK_WIDGET(main_widgets.window), "menu_show_toolbar1"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tool_item), FALSE); @@ -493,7 +414,7 @@ GEANY_EXPORT_SYMBOL void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpoint /* zoom in from menu bar and popup menu */ -GEANY_EXPORT_SYMBOL void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -504,7 +425,7 @@ GEANY_EXPORT_SYMBOL void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer us /* zoom out from menu bar and popup menu */ -GEANY_EXPORT_SYMBOL void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -514,7 +435,7 @@ GEANY_EXPORT_SYMBOL void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer u } -GEANY_EXPORT_SYMBOL void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -533,7 +454,7 @@ static gboolean delayed_check_disk_status(gpointer data) /* Changes window-title after switching tabs and lots of other things. * note: using 'after' makes Scintilla redraw before the UI, appearing more responsive */ -GEANY_EXPORT_SYMBOL void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, +static void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { GeanyDocument *doc; @@ -569,7 +490,7 @@ GEANY_EXPORT_SYMBOL void on_notebook1_switch_page_after(GtkNotebook *notebook, g } -GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, +static void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { /* suppress selection changed signal when switching to the open files list */ @@ -577,7 +498,7 @@ GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page(GtkNotebook *notebook, gpoin } -GEANY_EXPORT_SYMBOL void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, +static void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { ignore_callback = FALSE; @@ -596,7 +517,7 @@ static void convert_eol(gint mode) } -GEANY_EXPORT_SYMBOL void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +static void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem)) return; @@ -605,7 +526,7 @@ GEANY_EXPORT_SYMBOL void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer u } -GEANY_EXPORT_SYMBOL void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +static void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem)) return; @@ -614,7 +535,7 @@ GEANY_EXPORT_SYMBOL void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer use } -GEANY_EXPORT_SYMBOL void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +static void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem)) return; @@ -623,7 +544,7 @@ GEANY_EXPORT_SYMBOL void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer use } -GEANY_EXPORT_SYMBOL void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -644,7 +565,7 @@ gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer u } -GEANY_EXPORT_SYMBOL void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); ScintillaObject *sci; @@ -700,7 +621,7 @@ GEANY_EXPORT_SYMBOL void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointe } -GEANY_EXPORT_SYMBOL void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -709,7 +630,7 @@ GEANY_EXPORT_SYMBOL void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuite } -GEANY_EXPORT_SYMBOL void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -719,7 +640,7 @@ GEANY_EXPORT_SYMBOL void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, } -GEANY_EXPORT_SYMBOL void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -729,13 +650,13 @@ GEANY_EXPORT_SYMBOL void on_show_messages_window1_toggled(GtkCheckMenuItem *chec } -GEANY_EXPORT_SYMBOL void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data) +static void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data) { highlighting_show_color_scheme_dialog(); } -GEANY_EXPORT_SYMBOL void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -745,7 +666,7 @@ GEANY_EXPORT_SYMBOL void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenui } -GEANY_EXPORT_SYMBOL void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -755,7 +676,7 @@ GEANY_EXPORT_SYMBOL void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkme } -GEANY_EXPORT_SYMBOL void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -765,7 +686,7 @@ GEANY_EXPORT_SYMBOL void on_menu_show_white_space1_toggled(GtkCheckMenuItem *che } -GEANY_EXPORT_SYMBOL void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -775,7 +696,7 @@ GEANY_EXPORT_SYMBOL void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *ch } -GEANY_EXPORT_SYMBOL void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -785,7 +706,7 @@ GEANY_EXPORT_SYMBOL void on_menu_show_indentation_guides1_toggled(GtkCheckMenuIt } -GEANY_EXPORT_SYMBOL void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -797,7 +718,7 @@ GEANY_EXPORT_SYMBOL void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuit } -GEANY_EXPORT_SYMBOL void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -812,7 +733,7 @@ GEANY_EXPORT_SYMBOL void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkme } -GEANY_EXPORT_SYMBOL void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -850,13 +771,13 @@ static void find_usage(gboolean in_session) } -GEANY_EXPORT_SYMBOL void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) { find_usage(FALSE); } -GEANY_EXPORT_SYMBOL void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data) { find_usage(TRUE); } @@ -880,25 +801,25 @@ static void goto_tag(gboolean definition) } -GEANY_EXPORT_SYMBOL void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data) +static void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data) { goto_tag(TRUE); } -GEANY_EXPORT_SYMBOL void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data) +static void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data) { goto_tag(FALSE); } -GEANY_EXPORT_SYMBOL void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data) { tools_word_count(); } -GEANY_EXPORT_SYMBOL void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data) { gchar colour[9]; GeanyDocument *doc = document_get_current(); @@ -918,19 +839,19 @@ void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data) } -GEANY_EXPORT_SYMBOL void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_show_find_dialog(); } -GEANY_EXPORT_SYMBOL void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_find_again(FALSE); } -GEANY_EXPORT_SYMBOL void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data) { if (search_data.flags & GEANY_FIND_REGEXP) /* Can't reverse search order for a regex (find next ignores search backwards) */ @@ -940,25 +861,25 @@ GEANY_EXPORT_SYMBOL void on_find_previous1_activate(GtkMenuItem *menuitem, gpoin } -GEANY_EXPORT_SYMBOL void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_find_selection(document_get_current(), FALSE); } -GEANY_EXPORT_SYMBOL void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_find_selection(document_get_current(), TRUE); } -GEANY_EXPORT_SYMBOL void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_show_replace_dialog(); } -GEANY_EXPORT_SYMBOL void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data) { search_show_find_in_files_dialog(NULL); } @@ -979,7 +900,7 @@ static void get_line_and_offset_from_text(const gchar *text, gint *line_no, gint } -GEANY_EXPORT_SYMBOL void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data) { static gchar value[16] = ""; gchar *result; @@ -1037,7 +958,7 @@ void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data) } -GEANY_EXPORT_SYMBOL void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data) { gchar *uri; @@ -1047,37 +968,37 @@ GEANY_EXPORT_SYMBOL void on_help1_activate(GtkMenuItem *menuitem, gpointer user_ } -GEANY_EXPORT_SYMBOL void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_show_shortcuts(); } -GEANY_EXPORT_SYMBOL void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data) { utils_open_browser(GEANY_HOMEPAGE); } -GEANY_EXPORT_SYMBOL void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data) +static void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data) { utils_open_browser(GEANY_DONATE); } -GEANY_EXPORT_SYMBOL void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data) +static void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data) { utils_open_browser(GEANY_WIKI); } -GEANY_EXPORT_SYMBOL void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data) +static void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data) { utils_open_browser(GEANY_BUG_REPORT); } -GEANY_EXPORT_SYMBOL void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *text; @@ -1131,13 +1052,13 @@ static void insert_multiline_comment(GeanyDocument *doc, gint pos) } -GEANY_EXPORT_SYMBOL void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_multiline_comment(document_get_current(), editor_info.click_pos); } -GEANY_EXPORT_SYMBOL void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_multiline_comment(document_get_current(), -1); } @@ -1163,31 +1084,31 @@ static void insert_comment_template(GeanyDocument *doc, gint pos, guint template } -GEANY_EXPORT_SYMBOL void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), editor_info.click_pos, GEANY_TEMPLATE_GPL); } -GEANY_EXPORT_SYMBOL void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), -1, GEANY_TEMPLATE_GPL); } -GEANY_EXPORT_SYMBOL void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), editor_info.click_pos, GEANY_TEMPLATE_BSD); } -GEANY_EXPORT_SYMBOL void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) { insert_comment_template(document_get_current(), -1, GEANY_TEMPLATE_BSD); } -GEANY_EXPORT_SYMBOL void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *text; @@ -1206,7 +1127,7 @@ GEANY_EXPORT_SYMBOL void on_comments_changelog_activate(GtkMenuItem *menuitem, g } -GEANY_EXPORT_SYMBOL void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *text; @@ -1227,7 +1148,7 @@ GEANY_EXPORT_SYMBOL void on_comments_fileheader_activate(GtkMenuItem *menuitem, } -GEANY_EXPORT_SYMBOL void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1236,7 +1157,7 @@ GEANY_EXPORT_SYMBOL void on_file_properties_activate(GtkMenuItem *menuitem, gpoi } -GEANY_EXPORT_SYMBOL void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1245,7 +1166,7 @@ GEANY_EXPORT_SYMBOL void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpoin } -GEANY_EXPORT_SYMBOL void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1260,7 +1181,7 @@ void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data) } -GEANY_EXPORT_SYMBOL void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1269,7 +1190,7 @@ GEANY_EXPORT_SYMBOL void on_menu_remove_indicators1_activate(GtkMenuItem *menuit } -GEANY_EXPORT_SYMBOL void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1278,7 +1199,7 @@ GEANY_EXPORT_SYMBOL void on_print1_activate(GtkMenuItem *menuitem, gpointer user } -GEANY_EXPORT_SYMBOL void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1287,7 +1208,7 @@ GEANY_EXPORT_SYMBOL void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpo } -GEANY_EXPORT_SYMBOL void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (ignore_callback) return; @@ -1314,7 +1235,7 @@ GEANY_EXPORT_SYMBOL void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkme } -GEANY_EXPORT_SYMBOL void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) +static void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data) { if (! ignore_callback) { @@ -1336,7 +1257,7 @@ GEANY_EXPORT_SYMBOL void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *ch } -GEANY_EXPORT_SYMBOL void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1345,7 +1266,7 @@ GEANY_EXPORT_SYMBOL void on_menu_comment_line1_activate(GtkMenuItem *menuitem, g } -GEANY_EXPORT_SYMBOL void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1354,7 +1275,7 @@ GEANY_EXPORT_SYMBOL void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, } -GEANY_EXPORT_SYMBOL void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1363,7 +1284,7 @@ GEANY_EXPORT_SYMBOL void on_menu_toggle_line_commentation1_activate(GtkMenuItem } -GEANY_EXPORT_SYMBOL void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1372,7 +1293,7 @@ GEANY_EXPORT_SYMBOL void on_menu_increase_indent1_activate(GtkMenuItem *menuitem } -GEANY_EXPORT_SYMBOL void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1381,7 +1302,7 @@ GEANY_EXPORT_SYMBOL void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem } -GEANY_EXPORT_SYMBOL void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data) { if (! ui_tree_view_find_next(GTK_TREE_VIEW(msgwindow.tree_msg), msgwin_goto_messages_file_line)) @@ -1389,7 +1310,7 @@ GEANY_EXPORT_SYMBOL void on_next_message1_activate(GtkMenuItem *menuitem, gpoint } -GEANY_EXPORT_SYMBOL void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data) { if (! ui_tree_view_find_previous(GTK_TREE_VIEW(msgwindow.tree_msg), msgwin_goto_messages_file_line)) @@ -1397,31 +1318,31 @@ GEANY_EXPORT_SYMBOL void on_previous_message1_activate(GtkMenuItem *menuitem, gp } -GEANY_EXPORT_SYMBOL void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_new(); } -GEANY_EXPORT_SYMBOL void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_open(); } -GEANY_EXPORT_SYMBOL void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_close(TRUE); } -GEANY_EXPORT_SYMBOL void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_properties(); } -GEANY_EXPORT_SYMBOL void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data) { static GtkWidget *item_close = NULL; static GtkWidget *item_properties = NULL; @@ -1439,7 +1360,7 @@ GEANY_EXPORT_SYMBOL void on_menu_project1_activate(GtkMenuItem *menuitem, gpoint } -GEANY_EXPORT_SYMBOL void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gchar *sel = NULL; @@ -1505,7 +1426,7 @@ GEANY_EXPORT_SYMBOL void on_menu_open_selected_file1_activate(GtkMenuItem *menui } -GEANY_EXPORT_SYMBOL void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); g_return_if_fail(doc != NULL); @@ -1516,13 +1437,13 @@ GEANY_EXPORT_SYMBOL void on_remove_markers1_activate(GtkMenuItem *menuitem, gpoi } -GEANY_EXPORT_SYMBOL void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data) { symbols_show_load_tags_dialog(); } -GEANY_EXPORT_SYMBOL void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data) { gchar *word, *command; GError *error = NULL; @@ -1566,7 +1487,7 @@ GEANY_EXPORT_SYMBOL void on_context_action1_activate(GtkMenuItem *menuitem, gpoi } -GEANY_EXPORT_SYMBOL void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data) { static gint hide_all = -1; GtkCheckMenuItem *msgw = GTK_CHECK_MENU_ITEM( @@ -1631,6 +1552,7 @@ void on_toolbutton_back_activate(GtkAction *menuitem, gpointer user_data) } +GEANY_EXPORT_SYMBOL gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { if (prefs.auto_focus && ! gtk_widget_has_focus(widget)) @@ -1655,25 +1577,25 @@ static void set_indent_type(GtkCheckMenuItem *menuitem, GeanyIndentType type) } -GEANY_EXPORT_SYMBOL void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +static void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { set_indent_type(menuitem, GEANY_INDENT_TYPE_TABS); } -GEANY_EXPORT_SYMBOL void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +static void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { set_indent_type(menuitem, GEANY_INDENT_TYPE_SPACES); } -GEANY_EXPORT_SYMBOL void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) +static void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data) { set_indent_type(menuitem, GEANY_INDENT_TYPE_BOTH); } -GEANY_EXPORT_SYMBOL void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc; @@ -1687,13 +1609,13 @@ GEANY_EXPORT_SYMBOL void on_strip_trailing_spaces1_activate(GtkMenuItem *menuite } -GEANY_EXPORT_SYMBOL void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data) { printing_page_setup_gtk(); } -GEANY_EXPORT_SYMBOL gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) +gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { guint state = keybindings_get_modifiers(event->state); @@ -1707,7 +1629,7 @@ GEANY_EXPORT_SYMBOL gboolean on_escape_key_press_event(GtkWidget *widget, GdkEve } -GEANY_EXPORT_SYMBOL void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc; @@ -1721,7 +1643,7 @@ GEANY_EXPORT_SYMBOL void on_line_breaking1_activate(GtkMenuItem *menuitem, gpoin } -GEANY_EXPORT_SYMBOL void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -1731,7 +1653,7 @@ GEANY_EXPORT_SYMBOL void on_replace_spaces_activate(GtkMenuItem *menuitem, gpoin } -GEANY_EXPORT_SYMBOL void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data) { GtkWidget *next_message = ui_lookup_widget(main_widgets.window, "next_message1"); GtkWidget *previous_message = ui_lookup_widget(main_widgets.window, "previous_message1"); @@ -1748,7 +1670,7 @@ GEANY_EXPORT_SYMBOL void on_search1_activate(GtkMenuItem *menuitem, gpointer use /* simple implementation (vs. close all which doesn't close documents if cancelled), * if user_data is set, it is the GeanyDocument to keep */ -GEANY_EXPORT_SYMBOL void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i; GeanyDocument *cur_doc = user_data; @@ -1769,19 +1691,19 @@ GEANY_EXPORT_SYMBOL void on_close_other_documents1_activate(GtkMenuItem *menuite } -GEANY_EXPORT_SYMBOL void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data) { main_reload_configuration(); } -GEANY_EXPORT_SYMBOL void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data) { log_show_debug_messages_dialog(); } -GEANY_EXPORT_SYMBOL void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data) { #ifdef HAVE_VTE if (vte_info.have_vte) @@ -1790,7 +1712,7 @@ GEANY_EXPORT_SYMBOL void on_send_selection_to_vte1_activate(GtkMenuItem *menuite } -GEANY_EXPORT_SYMBOL gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data) +static gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data) { if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) @@ -1824,7 +1746,7 @@ static void show_notebook_page(const gchar *notebook_name, const gchar *page_nam } -GEANY_EXPORT_SYMBOL void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data) { prefs_show_dialog(); @@ -1835,91 +1757,91 @@ GEANY_EXPORT_SYMBOL void on_customize_toolbar1_activate(GtkMenuItem *menuitem, g } -GEANY_EXPORT_SYMBOL void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data) +static void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data) { toolbar_configure(GTK_WINDOW(ui_widgets.prefs_dialog)); } -GEANY_EXPORT_SYMBOL void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_CLIPBOARD, GEANY_KEYS_CLIPBOARD_CUTLINE); } -GEANY_EXPORT_SYMBOL void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_CLIPBOARD, GEANY_KEYS_CLIPBOARD_COPYLINE); } -GEANY_EXPORT_SYMBOL void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_DELETELINE); } -GEANY_EXPORT_SYMBOL void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_DUPLICATELINE); } -GEANY_EXPORT_SYMBOL void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_LINE); } -GEANY_EXPORT_SYMBOL void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_PARAGRAPH); } -GEANY_EXPORT_SYMBOL void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_INSERT, GEANY_KEYS_INSERT_ALTWHITESPACE); } -GEANY_EXPORT_SYMBOL void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_NEXTMARKER); } -GEANY_EXPORT_SYMBOL void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_PREVIOUSMARKER); } -GEANY_EXPORT_SYMBOL void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_FORMAT, GEANY_KEYS_FORMAT_REFLOWPARAGRAPH); } -GEANY_EXPORT_SYMBOL void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_MOVELINEUP); } -GEANY_EXPORT_SYMBOL void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_MOVELINEDOWN); } -GEANY_EXPORT_SYMBOL void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_FORMAT, GEANY_KEYS_FORMAT_AUTOINDENT); } -GEANY_EXPORT_SYMBOL void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) { #ifdef HAVE_PLUGINS plugin_show_configure(NULL); @@ -1927,7 +1849,7 @@ GEANY_EXPORT_SYMBOL void on_plugin_preferences1_activate(GtkMenuItem *menuitem, } -GEANY_EXPORT_SYMBOL void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc; gchar *label; @@ -1946,7 +1868,7 @@ GEANY_EXPORT_SYMBOL void on_indent_width_activate(GtkMenuItem *menuitem, gpointe } -GEANY_EXPORT_SYMBOL void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i; @@ -1958,13 +1880,13 @@ GEANY_EXPORT_SYMBOL void on_reset_indentation1_activate(GtkMenuItem *menuitem, g } -GEANY_EXPORT_SYMBOL void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_SEARCH, GEANY_KEYS_SEARCH_MARKALL); } -GEANY_EXPORT_SYMBOL void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); GeanyIndentType type; @@ -1977,7 +1899,7 @@ GEANY_EXPORT_SYMBOL void on_detect_type_from_file_activate(GtkMenuItem *menuitem } -GEANY_EXPORT_SYMBOL void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) +static void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); gint width; diff --git a/src/project.c b/src/project.c index 761061f0..9eeece29 100644 --- a/src/project.c +++ b/src/project.c @@ -474,8 +474,7 @@ static void destroy_project(gboolean open_default) /* Shows the file chooser dialog when base path button is clicked * FIXME: this should be connected in Glade but 3.8.1 has a bug * where it won't pass any objects as user data (#588824). */ -GEANY_EXPORT_SYMBOL void -on_project_properties_base_path_button_clicked(GtkWidget *button, +static void on_project_properties_base_path_button_clicked(GtkWidget *button, GtkWidget *base_path_entry) { GtkWidget *dialog; From a264b7ab77ba13f9c4268c237a8b9051a3d77915 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 27 Oct 2014 00:47:23 +0100 Subject: [PATCH 10/40] Properly initialize Libtool --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 0efd4011..2ec3782a 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,7 @@ fi AC_USE_SYSTEM_EXTENSIONS m4_ifdef([AM_PROG_AR],[AM_PROG_AR]) +LT_INIT AC_PROG_CC AC_PROG_CC_C99 AM_PROG_CC_C_O From 361bf702e0b9ebf8052c39b15cba434ad4d85692 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 27 Oct 2014 00:48:24 +0100 Subject: [PATCH 11/40] Explicitly cast string literals to non-constant pointers --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 78c5436c..45f740bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -184,7 +184,7 @@ signalconn.c: $(glade_file) $(template_file) $(AM_V_GEN)( \ echo '/* This file is auto-generated, do not edit. */' && \ $(SED) -n '/@callback_map@/q;p' "$(template_file)" && \ - $(SED) -n 's/^.*handler="\([^"]\+\)".*$$/\tg_hash_table_insert(hash, "\1", G_CALLBACK(\1));/p' "$(glade_file)" \ + $(SED) -n 's/^.*handler="\([^"]\+\)".*$$/\tg_hash_table_insert(hash, (gpointer) "\1", G_CALLBACK(\1));/p' "$(glade_file)" \ | $(SORT) | $(UNIQ) && \ $(SED) -n '/@callback_map@/{:l;n;p;b l}' "$(template_file)" \ ) > $@ || { $(RM) $@ && exit 1; } From bc013ae9fea0d312a12b89098aa135f2ff9850a4 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 28 Oct 2014 15:27:41 +0100 Subject: [PATCH 12/40] Rename LIBGEANY_LIBS to LIBGEANY_LDFLAGS and only use it on libgeany.la The flags in this variables are used to tune the linker behavior on the final libgeany (currently set the version information), so should only used on really linked libraries, not Libtool helper libraries. --- m4/geany-lib.m4 | 4 ++-- scintilla/Makefile.am | 1 - src/Makefile.am | 8 ++++---- tagmanager/ctags/Makefile.am | 2 -- tagmanager/mio/Makefile.am | 1 - tagmanager/src/Makefile.am | 2 -- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/m4/geany-lib.m4 b/m4/geany-lib.m4 index 3e63b09b..83368629 100644 --- a/m4/geany-lib.m4 +++ b/m4/geany-lib.m4 @@ -24,10 +24,10 @@ dnl `__attribute__((visibility(...)))` extension and use it if so. ]) CFLAGS="${libgeany_backup_cflags}" - LIBGEANY_LIBS="-version-info ${libgeany_current}:${libgeany_revision}:${libgeany_age}" + LIBGEANY_LDFLAGS="-version-info ${libgeany_current}:${libgeany_revision}:${libgeany_age}" AC_SUBST([LIBGEANY_CFLAGS]) - AC_SUBST([LIBGEANY_LIBS]) + AC_SUBST([LIBGEANY_LDFLAGS]) dnl Check for utilities needed to do codegen AC_PATH_PROG([SORT], [sort], [ diff --git a/scintilla/Makefile.am b/scintilla/Makefile.am index 022f38c8..091c2169 100644 --- a/scintilla/Makefile.am +++ b/scintilla/Makefile.am @@ -140,7 +140,6 @@ src/XPM.h \ $(LEXER_SRCS) libscintilla_la_SOURCES = $(SRCS) -libscintilla_la_LDFLAGS = @LIBGEANY_LIBS@ AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir)/include -I$(srcdir)/src -I$(srcdir)/lexlib \ @GTK_CFLAGS@ @LIBGEANY_CFLAGS@ diff --git a/src/Makefile.am b/src/Makefile.am index 45f740bc..f2a9529a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -121,7 +121,6 @@ libgeany_la_LIBADD = \ @GTK_LIBS@ \ @GTHREAD_LIBS@ \ $(INTLLIBS) \ - @LIBGEANY_LIBS@ \ -lole32 -lwsock32 -lcomdlg32 libgeany_la_LDFLAGS = -Wl,-luuid $(AM_LDFLAGS) @@ -136,7 +135,7 @@ AM_CFLAGS = -DGEANY_DATADIR=\"data\" \ -DGTK \ -DG_LOG_DOMAIN=\""Geany"\" -libgeany_la_LDFLAGS += -mwindows -mms-bitfields -no-undefined +libgeany_la_LDFLAGS += @LIBGEANY_LDFLAGS@ -mwindows -mms-bitfields -no-undefined WINDRES = $(host_alias)-windres @@ -159,8 +158,7 @@ libgeany_la_LIBADD = \ @GTK_LIBS@ \ @GTHREAD_LIBS@ \ $(MAC_INTEGRATION_LIBS) \ - $(INTLLIBS) \ - @LIBGEANY_LIBS@ + $(INTLLIBS) AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGEANY_DOCDIR=\""$(docdir)"\" \ @@ -171,6 +169,8 @@ AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ -DGTK \ -DG_LOG_DOMAIN=\""Geany"\" +libgeany_la_LDFLAGS = @LIBGEANY_LDFLAGS@ + clean-local: endif diff --git a/tagmanager/ctags/Makefile.am b/tagmanager/ctags/Makefile.am index c81ccf73..8bd5d483 100644 --- a/tagmanager/ctags/Makefile.am +++ b/tagmanager/ctags/Makefile.am @@ -83,5 +83,3 @@ libctags_la_SOURCES = \ vstring.c \ vstring.h \ $(parsers) - -libctags_la_LDFLAGS = @LIBGEANY_LIBS@ diff --git a/tagmanager/mio/Makefile.am b/tagmanager/mio/Makefile.am index c1981072..ca27c1c1 100644 --- a/tagmanager/mio/Makefile.am +++ b/tagmanager/mio/Makefile.am @@ -4,7 +4,6 @@ AM_CPPFLAGS = -DG_LOG_DOMAIN=\"MIO\" #-DMIO_DEBUG AM_CFLAGS = $(GTK_CFLAGS) @LIBGEANY_CFLAGS@ libmio_la_SOURCES = mio.c -libmio_la_LDFLAGS = @LIBGEANY_LIBS@ EXTRA_DIST = \ mio.h \ diff --git a/tagmanager/src/Makefile.am b/tagmanager/src/Makefile.am index c7e64095..65ee42c5 100644 --- a/tagmanager/src/Makefile.am +++ b/tagmanager/src/Makefile.am @@ -30,5 +30,3 @@ libtagmanager_la_SOURCES =\ tm_tag.c \ tm_workspace.h \ tm_workspace.c - -libtagmanager_la_LDFLAGS = @LIBGEANY_LIBS@ From 2bfd394803cba185b3836d9c25b3d126f750ac13 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 28 Oct 2014 16:13:10 +0100 Subject: [PATCH 13/40] Don't export on_motion_event() callback unnecessarily --- src/callbacks.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/callbacks.c b/src/callbacks.c index 1c4536a8..23e18061 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1552,7 +1552,6 @@ void on_toolbutton_back_activate(GtkAction *menuitem, gpointer user_data) } -GEANY_EXPORT_SYMBOL gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { if (prefs.auto_focus && ! gtk_widget_has_focus(widget)) From 9644fb0ae21601b5acb6a5a5763a1e558a95c315 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 28 Oct 2014 15:31:01 +0100 Subject: [PATCH 14/40] Define GEANY_{EXPORT,API}_SYMBOL from the build system This makes it easier to define it consistently to what the compiler and platform supports, and avoids having to include a special header everywhere, which is some kind of a problem for separate libraries like TagManager and especially Scintilla. As we only use these macros from the source and not the headers, it is fine for it to be defined to a configure-time check from the build system. Warning: Although Waf and Windows makefiles are updated they are not tested an will probably required tuning. --- m4/geany-lib.m4 | 55 +++++++++++++++++++++++---------- scintilla/gtk/makefile.win32 | 4 ++- src/Makefile.am | 1 - src/build.c | 1 - src/callbacks.c | 1 - src/dialogs.c | 1 - src/document.c | 1 - src/editor.c | 1 - src/encodings.c | 1 - src/filetypes.c | 1 - src/highlighting.c | 1 - src/keybindings.c | 1 - src/libmain.c | 1 - src/makefile.win32 | 4 ++- src/msgwindow.c | 1 - src/navqueue.c | 1 - src/pluginexport.h | 34 -------------------- src/pluginutils.c | 1 - src/project.c | 1 - src/sciwrappers.c | 1 - src/search.c | 1 - src/stash.c | 1 - src/symbols.c | 1 - src/templates.c | 1 - src/ui_utils.c | 1 - src/utils.c | 1 - tagmanager/src/makefile.win32 | 4 ++- tagmanager/src/tm_source_file.c | 1 - tagmanager/src/tm_workspace.c | 1 - wscript | 13 ++++++++ 30 files changed, 60 insertions(+), 78 deletions(-) delete mode 100644 src/pluginexport.h diff --git a/m4/geany-lib.m4 b/m4/geany-lib.m4 index 83368629..ce4cf3b3 100644 --- a/m4/geany-lib.m4 +++ b/m4/geany-lib.m4 @@ -1,5 +1,42 @@ +dnl checks whether the compiler supports GCC4-style visibility +AC_DEFUN([GCC4_VISIBILITY], +[ + have_gcc4_visibility=no + AC_MSG_CHECKING([whether compiler supports GCC4-style visibility]) + gcc_visibility_backup_cflags=$CFLAGS + CFLAGS=-fvisibility=hidden + AC_LINK_IFELSE([AC_LANG_SOURCE([[__attribute__((visibility("default"))) + int main(int argc, char **argv) { return 0; }]])], + [have_gcc4_visibility=yes]) + AC_MSG_RESULT([$have_gcc4_visibility]) + CFLAGS="${gcc_visibility_backup_cflags}" +]) + +dnl Checks and fills LIBGEANY_EXPORT_CFLAGS +AC_DEFUN([GEANY_EXPORT], +[ + AC_REQUIRE([GEANY_CHECK_MINGW]) + AC_REQUIRE([GCC4_VISIBILITY]) + + dnl FIXME: better way to detect Windows? + AM_COND_IF([MINGW], [win32=yes], [win32=false]) + + export_CFLAGS= + AS_IF([test x$win32 = xyes], + [export_CFLAGS='-DGEANY_EXPORT_SYMBOL="__declspec(dllexport)"'], + [test x$have_gcc4_visibility = xyes], + [export_CFLAGS='-fvisibility=hidden -DGEANY_EXPORT_SYMBOL="__attribute__((visibility(\"default\")))"'], + [dnl GEANY_EXPORT_SYMBOL expands to nothing + export_CFLAGS='-DGEANY_EXPORT_SYMBOL']) + + LIBGEANY_EXPORT_CFLAGS="${export_CFLAGS} -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL" + + AC_SUBST([LIBGEANY_EXPORT_CFLAGS]) +]) + AC_DEFUN([GEANY_LIB_INIT], [ + AC_REQUIRE([GEANY_EXPORT]) dnl In the future, if we want to use libtool/library versioning, we can dnl set these variables accordingly. For now its the same as if not specified (0:0:0) @@ -7,23 +44,7 @@ dnl set these variables accordingly. For now its the same as if not specified (0 libgeany_revision=0 libgeany_age=0 -dnl Try and see if we can use -fvisibility compiler option and GCC`s -dnl `__attribute__((visibility(...)))` extension and use it if so. - AC_MSG_CHECKING([whether compiler supports -fvisibility]) - libgeany_backup_cflags=$CFLAGS - CFLAGS=-fvisibility=hidden - AC_TRY_COMPILE([], [ - __attribute__ ((visibility ("default"))) - int main(int argc, char **argv) { return 0; } - ], [ - LIBGEANY_CFLAGS="${CFLAGS}" - AC_MSG_RESULT([yes]) - ], [ - LIBGEANY_CFLAGS="" - AC_MSG_RESULT([no]) - ]) - CFLAGS="${libgeany_backup_cflags}" - + LIBGEANY_CFLAGS="${LIBGEANY_EXPORT_CFLAGS}" LIBGEANY_LDFLAGS="-version-info ${libgeany_current}:${libgeany_revision}:${libgeany_age}" AC_SUBST([LIBGEANY_CFLAGS]) diff --git a/scintilla/gtk/makefile.win32 b/scintilla/gtk/makefile.win32 index 836a4afa..12cedc3a 100644 --- a/scintilla/gtk/makefile.win32 +++ b/scintilla/gtk/makefile.win32 @@ -32,7 +32,9 @@ vpath %.h ../src ../include ../lexlib vpath %.cxx ../src ../lexlib ../lexers INCLUDEDIRS=-I ../include -I ../src -I ../lexlib -CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -DGTK -DSCI_LEXER $(INCLUDEDIRS) +CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -DGTK -DSCI_LEXER $(INCLUDEDIRS) \ + -DGEANY_EXPORT_SYMBOL="__declspec(dllexport)" \ + -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL ifdef THREADS THREADFLAGS= diff --git a/src/Makefile.am b/src/Makefile.am index f2a9529a..f431ccd1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,7 +44,6 @@ SRCS = \ navqueue.c navqueue.h \ notebook.c notebook.h \ osx.c osx.h \ - pluginexport.h \ plugins.c plugins.h \ pluginutils.c pluginutils.h \ prefix.c prefix.h \ diff --git a/src/build.c b/src/build.c index ed164872..73bfc7f0 100644 --- a/src/build.c +++ b/src/build.c @@ -41,7 +41,6 @@ #include "geanyobject.h" #include "keybindingsprivate.h" #include "msgwindow.h" -#include "pluginexport.h" #include "prefs.h" #include "projectprivate.h" #include "sciwrappers.h" diff --git a/src/callbacks.c b/src/callbacks.c index 23e18061..a2a6f453 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -45,7 +45,6 @@ #include "main.h" #include "msgwindow.h" #include "navqueue.h" -#include "pluginexport.h" #include "plugins.h" #include "pluginutils.h" #include "prefs.h" diff --git a/src/dialogs.c b/src/dialogs.c index 544977dd..7648b7ba 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -35,7 +35,6 @@ #include "encodings.h" #include "filetypes.h" #include "main.h" -#include "pluginexport.h" #include "support.h" #include "utils.h" #include "ui_utils.h" diff --git a/src/document.c b/src/document.c index cdf77e41..8d4630ad 100644 --- a/src/document.c +++ b/src/document.c @@ -44,7 +44,6 @@ #include "msgwindow.h" #include "navqueue.h" #include "notebook.h" -#include "pluginexport.h" #include "project.h" #include "sciwrappers.h" #include "sidebar.h" diff --git a/src/editor.c b/src/editor.c index 63ca8e93..dd6e9473 100644 --- a/src/editor.c +++ b/src/editor.c @@ -48,7 +48,6 @@ #include "highlighting.h" #include "keybindings.h" #include "main.h" -#include "pluginexport.h" #include "prefs.h" #include "projectprivate.h" #include "sciwrappers.h" diff --git a/src/encodings.c b/src/encodings.c index 07204b1c..84b75783 100644 --- a/src/encodings.c +++ b/src/encodings.c @@ -39,7 +39,6 @@ #include "app.h" #include "callbacks.h" #include "documentprivate.h" -#include "pluginexport.h" #include "support.h" #include "ui_utils.h" #include "utils.h" diff --git a/src/filetypes.c b/src/filetypes.c index abc5df45..d6356f02 100644 --- a/src/filetypes.c +++ b/src/filetypes.c @@ -40,7 +40,6 @@ #include "geany.h" #include "geanyobject.h" #include "highlighting.h" -#include "pluginexport.h" #include "projectprivate.h" #include "sciwrappers.h" #include "support.h" diff --git a/src/highlighting.c b/src/highlighting.c index 9f46de3a..124fe969 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -37,7 +37,6 @@ #include "document.h" #include "editor.h" #include "filetypesprivate.h" -#include "pluginexport.h" #include "sciwrappers.h" #include "support.h" #include "symbols.h" diff --git a/src/keybindings.c b/src/keybindings.c index e71739e1..642ea882 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -43,7 +43,6 @@ #include "msgwindow.h" #include "navqueue.h" #include "notebook.h" -#include "pluginexport.h" #include "prefs.h" #include "sciwrappers.h" #include "sidebar.h" diff --git a/src/libmain.c b/src/libmain.c index 7e3f74ea..8b366a46 100644 --- a/src/libmain.c +++ b/src/libmain.c @@ -46,7 +46,6 @@ #include "msgwindow.h" #include "navqueue.h" #include "notebook.h" -#include "pluginexport.h" #include "plugins.h" #include "prefs.h" #include "printing.h" diff --git a/src/makefile.win32 b/src/makefile.win32 index 6839485b..ba39cea3 100644 --- a/src/makefile.win32 +++ b/src/makefile.win32 @@ -6,7 +6,9 @@ DEFINES = -DHAVE_CONFIG_H \ -DGEANY_LOCALEDIR=\"\" \ -DGEANY_LIBDIR=\"\" \ -DGEANY_PREFIX=\"\" \ - -DGTK + -DGTK \ + -DGEANY_EXPORT_SYMBOL="__declspec(dllexport)" \ + -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL .SUFFIXES: .c .o .h .a WINDRES = windres.exe diff --git a/src/msgwindow.c b/src/msgwindow.c index 403b5470..c7d074a5 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -40,7 +40,6 @@ #include "keybindings.h" #include "main.h" #include "navqueue.h" -#include "pluginexport.h" #include "prefs.h" #include "support.h" #include "ui_utils.h" diff --git a/src/navqueue.c b/src/navqueue.c index d6ea01fe..01d74d99 100644 --- a/src/navqueue.c +++ b/src/navqueue.c @@ -32,7 +32,6 @@ #include "document.h" #include "geanyobject.h" -#include "pluginexport.h" #include "sciwrappers.h" #include "toolbar.h" #include "utils.h" diff --git a/src/pluginexport.h b/src/pluginexport.h deleted file mode 100644 index 89fb137c..00000000 --- a/src/pluginexport.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * pluginexport.h - this file is part of Geany, a fast and lightweight IDE - * - * Copyright 2014 Matthew Brush - * - * 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_PLUGINEXPORT_H -#define GEANY_PLUGINEXPORT_H 1 - -#if defined(_WIN32) || defined(__CYGWIN__) -# define GEANY_EXPORT_SYMBOL __declspec(dllexport) -#elif defined(__GNUC__) && __GNUC__ >= 4 -# define GEANY_EXPORT_SYMBOL __attribute__((visibility ("default"))) -#else -# define GEANY_API_SYMBOL -#endif - -#define GEANY_API_SYMBOL GEANY_EXPORT_SYMBOL - -#endif /* GEANY_PLUGINEXPORT_H */ diff --git a/src/pluginutils.c b/src/pluginutils.c index 09c38cb2..35271a8d 100644 --- a/src/pluginutils.c +++ b/src/pluginutils.c @@ -34,7 +34,6 @@ #include "app.h" #include "geanyobject.h" #include "plugindata.h" -#include "pluginexport.h" #include "pluginprivate.h" #include "plugins.h" #include "support.h" diff --git a/src/project.c b/src/project.c index 9eeece29..2361e93a 100644 --- a/src/project.c +++ b/src/project.c @@ -38,7 +38,6 @@ #include "geanyobject.h" #include "keyfile.h" #include "main.h" -#include "pluginexport.h" #include "projectprivate.h" #include "sidebar.h" #include "stash.h" diff --git a/src/sciwrappers.c b/src/sciwrappers.c index 722f28ca..fb38d7df 100644 --- a/src/sciwrappers.c +++ b/src/sciwrappers.c @@ -37,7 +37,6 @@ #include "sciwrappers.h" -#include "pluginexport.h" #include "utils.h" #include diff --git a/src/search.c b/src/search.c index 903735d4..ebec237a 100644 --- a/src/search.c +++ b/src/search.c @@ -35,7 +35,6 @@ #include "encodings.h" #include "keyfile.h" #include "msgwindow.h" -#include "pluginexport.h" #include "prefs.h" #include "sciwrappers.h" #include "stash.h" diff --git a/src/stash.c b/src/stash.c index a7628bd6..1b35a16e 100644 --- a/src/stash.c +++ b/src/stash.c @@ -78,7 +78,6 @@ #include "stash.h" -#include "pluginexport.h" /* for GEANY_API_SYMBOL */ #include "support.h" /* only for _("text") */ #include "utils.h" /* only for foreach_*, utils_get_setting_*(). Stash should not depend on Geany. */ diff --git a/src/symbols.c b/src/symbols.c index d34087fd..9f8d7dcc 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -47,7 +47,6 @@ #include "geanyobject.h" #include "main.h" #include "navqueue.h" -#include "pluginexport.h" #include "sciwrappers.h" #include "sidebar.h" #include "support.h" diff --git a/src/templates.c b/src/templates.c index b0518922..609b6a35 100644 --- a/src/templates.c +++ b/src/templates.c @@ -37,7 +37,6 @@ #include "geany.h" #include "geanymenubuttonaction.h" #include "geanyobject.h" -#include "pluginexport.h" #include "support.h" #include "toolbar.h" #include "ui_utils.h" diff --git a/src/ui_utils.c b/src/ui_utils.c index e9f548a0..c824e36f 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -40,7 +40,6 @@ #include "keyfile.h" #include "main.h" #include "msgwindow.h" -#include "pluginexport.h" #include "prefs.h" #include "project.h" #include "sciwrappers.h" diff --git a/src/utils.c b/src/utils.c index 1f64d1ed..c395f757 100644 --- a/src/utils.c +++ b/src/utils.c @@ -32,7 +32,6 @@ #include "app.h" #include "dialogs.h" #include "document.h" -#include "pluginexport.h" #include "prefs.h" #include "sciwrappers.h" #include "support.h" diff --git a/tagmanager/src/makefile.win32 b/tagmanager/src/makefile.win32 index f199d444..c408e341 100644 --- a/tagmanager/src/makefile.win32 +++ b/tagmanager/src/makefile.win32 @@ -29,7 +29,9 @@ GTK_INCLUDES= \ INCLUDEDIRS=-I ../ctags -I ../ -I . $(GTK_INCLUDES) -CBASEFLAGS=-Wall -pipe -mms-bitfields -DGEANY_PRIVATE -DPACKAGE=\"geany\" -Wno-missing-braces -Wno-char-subscripts $(INCLUDEDIRS) +CBASEFLAGS=-Wall -pipe -mms-bitfields -DGEANY_PRIVATE -DPACKAGE=\"geany\" -Wno-missing-braces -Wno-char-subscripts $(INCLUDEDIRS) \ + -DGEANY_EXPORT_SYMBOL="__declspec(dllexport)" \ + -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL ifdef DEBUG CFLAGS= -O0 -g $(CBASEFLAGS) else diff --git a/tagmanager/src/tm_source_file.c b/tagmanager/src/tm_source_file.c index a90f3850..a6861626 100644 --- a/tagmanager/src/tm_source_file.c +++ b/tagmanager/src/tm_source_file.c @@ -34,7 +34,6 @@ #define LIBCTAGS_DEFINED #include "tm_source_file.h" #include "tm_tag.h" -#include "../src/pluginexport.h" /* for GEANY_API_SYMBOL */ static TMSourceFile *current_source_file = NULL; diff --git a/tagmanager/src/tm_workspace.c b/tagmanager/src/tm_workspace.c index b15ead81..2e604200 100644 --- a/tagmanager/src/tm_workspace.c +++ b/tagmanager/src/tm_workspace.c @@ -32,7 +32,6 @@ #include "tm_workspace.h" #include "tm_tag.h" -#include "../src/pluginexport.h" /* for GEANY_API_SYMBOL */ /* when changing, always keep the three sort criteria below in sync */ diff --git a/wscript b/wscript index c68e3538..8dd0a933 100644 --- a/wscript +++ b/wscript @@ -305,6 +305,19 @@ but you then may not have a local copy of the HTML manual.''' conf.write_config_header('config.h', remove=False) + # GEANY_EXPORT_SYMBOL and GEANY_API_SYMBOL + # FIXME: should I put quoting in the appended values or are they passed as-is? + if is_win32: + conf.env.append_value('CFLAGS', ['-DGEANY_EXPORT_SYMBOL=__declspec(dllexport)']) + # FIXME: check for -fvisibility and the __attribute__((visibility)), or + # at least for GCC >= 4 + elif conf.env['CC_NAME'] == 'gcc': + conf.env.append_value('CFLAGS', ['-fvisibility=hidden', + '-DGEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))']) + else: # unknown, define to nothing + conf.env.append_value('CFLAGS', ['-DGEANY_EXPORT_SYMBOL=']) + conf.env.append_value('CFLAGS', ['-DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL']) + # some more compiler flags conf.env.append_value('CFLAGS', ['-DHAVE_CONFIG_H']) if conf.env['CC_NAME'] == 'gcc' and '-O' not in ''.join(conf.env['CFLAGS']): From 9eee68b71d322e7bbc74d48d4719e0713825d474 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 28 Oct 2014 15:38:12 +0100 Subject: [PATCH 15/40] Fix exporting Scintilla symbols --- scintilla/gtk/ScintillaGTK.cxx | 2 ++ scintilla/scintilla_changes.patch | 20 ++++++++++++++++++++ src/sciwrappers.c | 8 -------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx index 0871ca22..877659d7 100644 --- a/scintilla/gtk/ScintillaGTK.cxx +++ b/scintilla/gtk/ScintillaGTK.cxx @@ -3104,6 +3104,7 @@ sptr_t ScintillaGTK::DirectFunction( return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); } +GEANY_API_SYMBOL sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { ScintillaGTK *psci = reinterpret_cast(sci->pscin); return psci->WndProc(iMessage, wParam, lParam); @@ -3252,6 +3253,7 @@ static void scintilla_init(ScintillaObject *sci) { } } +GEANY_API_SYMBOL GtkWidget* scintilla_new() { GtkWidget *widget = GTK_WIDGET(g_object_new(scintilla_get_type(), NULL)); gtk_widget_set_direction(widget, GTK_TEXT_DIR_LTR); diff --git a/scintilla/scintilla_changes.patch b/scintilla/scintilla_changes.patch index 18383d5b..ac58376f 100644 --- a/scintilla/scintilla_changes.patch +++ b/scintilla/scintilla_changes.patch @@ -1,5 +1,25 @@ A patch to Scintilla 2.29 containing our changes to Scintilla (removing unused lexers and an updated marshallers file). +diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx +index 18e3358..5c405bc 100644 +--- scintilla/gtk/ScintillaGTK.cxx ++++ scintilla/gtk/ScintillaGTK.cxx +@@ -2959,6 +2959,7 @@ sptr_t ScintillaGTK::DirectFunction( + return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); + } + ++GEANY_API_SYMBOL + sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + ScintillaGTK *psci = reinterpret_cast(sci->pscin); + return psci->WndProc(iMessage, wParam, lParam); +@@ -3107,6 +3108,7 @@ static void scintilla_init(ScintillaObject *sci) { + } + } + ++GEANY_API_SYMBOL + GtkWidget* scintilla_new() { + GtkWidget *widget = GTK_WIDGET(g_object_new(scintilla_get_type(), NULL)); + gtk_widget_set_direction(widget, GTK_TEXT_DIR_LTR); diff -Naur scintilla_orig/gtk/scintilla-marshal.c scintilla/gtk/scintilla-marshal.c --- scintilla_orig/gtk/scintilla-marshal.c 2010-10-27 23:15:45.000000000 +0200 +++ scintilla/gtk/scintilla-marshal.c 2011-04-03 17:42:59.000000000 +0200 diff --git a/src/sciwrappers.c b/src/sciwrappers.c index fb38d7df..1a0020cc 100644 --- a/src/sciwrappers.c +++ b/src/sciwrappers.c @@ -45,14 +45,6 @@ #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l) -/* These functions need to be exported for the plugin API but to avoid - * modifying upstream sources, they are (re-)declared here with the - * needed export attribute. */ -GEANY_API_SYMBOL sptr_t scintilla_send_message(ScintillaObject *sci, - unsigned int iMessage, uptr_t wParam, sptr_t lParam); -GEANY_API_SYMBOL GtkWidget* scintilla_new(void); - - /* line numbers visibility */ void sci_set_line_numbers(ScintillaObject *sci, gboolean set) { From 616cbe3da9cfb69f6e9f265cdfd35715d7ab4e9d Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 25 Feb 2015 17:01:02 +0100 Subject: [PATCH 16/40] src: Makefile.am cleanup --- src/Makefile.am | 183 +++++++++++++++++++++++------------------------- 1 file changed, 86 insertions(+), 97 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index f431ccd1..245d75f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,13 +13,56 @@ EXTRA_DIST = \ makefile.win32 \ $(srcdir)/signalconn.c.in +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/scintilla/include \ + -I$(top_srcdir)/tagmanager/src \ + -DGTK \ + -DGEANY_PRIVATE \ + -DG_LOG_DOMAIN=\""Geany"\" \ + @LIBGEANY_CFLAGS@ \ + @GTK_CFLAGS@ @GTHREAD_CFLAGS@ \ + $(MAC_INTEGRATION_CFLAGS) + bin_PROGRAMS = geany lib_LTLIBRARIES = libgeany.la geany_SOURCES = main.c geany_LDADD = libgeany.la $(GTK_LIBS) $(GTHREAD_LIBS) $(INTLLIBS) -SRCS = \ +geany_includedir = $(includedir)/geany + +# only install headers that define types or macros, not just functions +geany_include_HEADERS = \ + app.h \ + build.h \ + dialogs.h \ + document.h \ + editor.h \ + encodings.h \ + filetypes.h \ + geany.h \ + gtkcompat.h \ + highlighting.h \ + keybindings.h \ + main.h \ + msgwindow.h \ + navqueue.h \ + plugindata.h \ + pluginutils.h \ + prefs.h \ + project.h \ + sciwrappers.h \ + search.h \ + stash.h \ + support.h \ + symbols.h \ + templates.h \ + toolbar.h \ + ui_utils.h \ + utils.h + +libgeany_la_SOURCES = \ about.c about.h \ app.h \ build.c build.h \ @@ -63,91 +106,7 @@ SRCS = \ ui_utils.c ui_utils.h \ utils.c utils.h - -geany_includedir = $(includedir)/geany - -# only install headers that define types or macros, not just functions -geany_include_HEADERS = \ - app.h \ - build.h \ - dialogs.h \ - document.h \ - editor.h \ - encodings.h \ - filetypes.h \ - geany.h \ - gtkcompat.h \ - highlighting.h \ - keybindings.h \ - main.h \ - msgwindow.h \ - navqueue.h \ - plugindata.h \ - pluginutils.h \ - prefs.h \ - project.h \ - sciwrappers.h \ - search.h \ - stash.h \ - support.h \ - symbols.h \ - templates.h \ - toolbar.h \ - ui_utils.h \ - utils.h - - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/scintilla/include \ - -I$(top_srcdir)/tagmanager/src \ - @GTK_CFLAGS@ @GTHREAD_CFLAGS@ $(MAC_INTEGRATION_CFLAGS) @LIBGEANY_CFLAGS@ - -# tell automake we have a C++ file so it uses the C++ linker we need for Scintilla -nodist_EXTRA_geany_SOURCES = dummy.cxx -nodist_EXTRA_libgeany_la_SOURCES = dummy1.cxx - -if MINGW -# build Geany for Windows on non-Windows systems (cross-compile) - -libgeany_la_SOURCES = $(SRCS) win32.c win32.h - -libgeany_la_LIBADD = \ - $(top_builddir)/scintilla/libscintilla.la \ - $(top_builddir)/tagmanager/ctags/libctags.la \ - $(top_builddir)/tagmanager/mio/libmio.la \ - $(top_builddir)/tagmanager/src/libtagmanager.la \ - @GTK_LIBS@ \ - @GTHREAD_LIBS@ \ - $(INTLLIBS) \ - -lole32 -lwsock32 -lcomdlg32 - -libgeany_la_LDFLAGS = -Wl,-luuid $(AM_LDFLAGS) -geany_LDADD += geany_private.res -lcomdlg32 - -AM_CFLAGS = -DGEANY_DATADIR=\"data\" \ - -DGEANY_DOCDIR=\"\" \ - -DGEANY_LIBDIR=\"\" \ - -DGEANY_LOCALEDIR=\"\" \ - -DGEANY_PREFIX=\"\" \ - -DGEANY_PRIVATE \ - -DGTK \ - -DG_LOG_DOMAIN=\""Geany"\" - -libgeany_la_LDFLAGS += @LIBGEANY_LDFLAGS@ -mwindows -mms-bitfields -no-undefined - -WINDRES = $(host_alias)-windres - -geany_private.res: $(top_srcdir)/geany_private.rc - $(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff - -clean-local: - rm -f geany_private.res - -else -# build Geany for all other platforms - -libgeany_la_SOURCES = $(SRCS) vte.c vte.h +libgeany_la_LDFLAGS = @LIBGEANY_LDFLAGS@ libgeany_la_LIBADD = \ $(top_builddir)/scintilla/libscintilla.la \ @@ -159,18 +118,48 @@ libgeany_la_LIBADD = \ $(MAC_INTEGRATION_LIBS) \ $(INTLLIBS) -AM_CFLAGS = -DGEANY_DATADIR=\""$(datadir)"\" \ - -DGEANY_DOCDIR=\""$(docdir)"\" \ - -DGEANY_LIBDIR=\""$(libdir)"\" \ - -DGEANY_LOCALEDIR=\""$(localedir)"\" \ - -DGEANY_PREFIX=\""$(prefix)"\" \ - -DGEANY_PRIVATE \ - -DGTK \ - -DG_LOG_DOMAIN=\""Geany"\" +# tell automake we have a C++ file so it uses the C++ linker we need for Scintilla +nodist_EXTRA_geany_SOURCES = dummy.cxx +nodist_EXTRA_libgeany_la_SOURCES = dummy1.cxx -libgeany_la_LDFLAGS = @LIBGEANY_LDFLAGS@ +CLEANFILES = -clean-local: +if MINGW + +AM_CPPFLAGS += \ + -DGEANY_DATADIR=\"data\" \ + -DGEANY_DOCDIR=\"\" \ + -DGEANY_LIBDIR=\"\" \ + -DGEANY_LOCALEDIR=\"\" \ + -DGEANY_PREFIX=\"\" + +geany_LDADD += geany_private.res + +WINDRES = $(host_alias)-windres + +geany_private.res: $(top_srcdir)/geany_private.rc + $(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff + +# build Geany for Windows on non-Windows systems (cross-compile) +libgeany_la_SOURCES += win32.c win32.h + +libgeany_la_LIBADD += -lole32 -lwsock32 -lcomdlg32 + +libgeany_la_LDFLAGS += -Wl,-luuid -mwindows -mms-bitfields -no-undefined + +CLEANFILES += geany_private.res + +else +# build Geany for all other platforms + +AM_CPPFLAGS += \ + -DGEANY_DATADIR=\""$(datadir)"\" \ + -DGEANY_DOCDIR=\""$(docdir)"\" \ + -DGEANY_LIBDIR=\""$(libdir)"\" \ + -DGEANY_LOCALEDIR=\""$(localedir)"\" \ + -DGEANY_PREFIX=\""$(prefix)"\" + +libgeany_la_SOURCES += vte.c vte.h endif @@ -188,4 +177,4 @@ signalconn.c: $(glade_file) $(template_file) $(SED) -n '/@callback_map@/{:l;n;p;b l}' "$(template_file)" \ ) > $@ || { $(RM) $@ && exit 1; } -CLEANFILES = signalconn.c +CLEANFILES += signalconn.c From abc5f3239b45d6a3853276678f72de59ebf67c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 18 Jan 2015 15:53:01 +0100 Subject: [PATCH 17/40] waf: Adjust to build and use libgeany --- wscript | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/wscript b/wscript index 8dd0a933..da4ae904 100644 --- a/wscript +++ b/wscript @@ -58,6 +58,8 @@ MINIMUM_GTK_VERSION = '2.16.0' MINIMUM_GTK3_VERSION = '3.0.0' MINIMUM_GLIB_VERSION = '2.20.0' +GEANY_LIB_VERSION = '0.0.0' + top = '.' out = '_build_' @@ -131,7 +133,7 @@ geany_sources = set([ 'src/editor.c', 'src/encodings.c', 'src/filetypes.c', 'src/geanyentryaction.c', 'src/geanymenubuttonaction.c', 'src/geanyobject.c', 'src/geanywraplabel.c', 'src/highlighting.c', 'src/keybindings.c', - 'src/keyfile.c', 'src/log.c', 'src/main.c', 'src/msgwindow.c', 'src/navqueue.c', 'src/notebook.c', 'src/osx.c', + 'src/keyfile.c', 'src/log.c', 'src/libmain.c', 'src/msgwindow.c', 'src/navqueue.c', 'src/notebook.c', 'src/osx.c', 'src/plugins.c', 'src/pluginutils.c', 'src/prefix.c', 'src/prefs.c', 'src/printing.c', 'src/project.c', 'src/sciwrappers.c', 'src/search.c', 'src/socket.c', 'src/stash.c', 'src/symbols.c', @@ -400,6 +402,7 @@ def build(bld): defines = 'G_LOG_DOMAIN="%s"' % plugin_name, target = plugin_name, uselib = ['GTK', 'GLIB', 'GMODULE'] + uselib_add, + use = ['geany'], install_path = instpath) # CTags @@ -454,23 +457,29 @@ def build(bld): geany_sources.add('src/win32.c') geany_sources.add('geany_private.rc') + base_uselibs = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M'] + # libgeany bld( - features = ['c', 'cxx', 'cprogram'], + features = ['c', 'cxx', 'cshlib'], name = 'geany', target = 'geany', source = geany_sources, includes = ['.', 'scintilla/include', 'tagmanager/src'], defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], - uselib = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M'], - use = ['scintilla', 'ctags', 'tagmanager', 'mio']) + uselib = base_uselibs, + use = ['scintilla', 'ctags', 'tagmanager', 'mio'], + vnum = GEANY_LIB_VERSION) - # geanyfunctions.h + # geany executable bld( - source = ['plugins/genapi.py', 'src/plugins.c'], - name = 'geanyfunctions.h', - before = ['c', 'cxx'], - cwd = '%s/plugins' % bld.path.abspath(), - rule = '%s genapi.py -q' % sys.executable) + features = ['c', 'cxx', 'cprogram'], + name = 'geany_bin', + target = 'geany', + source = ['src/main.c'], + includes = ['.', 'scintilla/include', 'tagmanager/src'], + defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], + uselib = base_uselibs, + use = ['geany']) # Plugins if bld.env['HAVE_PLUGINS'] == 1: From 3d0bdbd6da48ea2000aff937b34baec57f98bb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 18 Jan 2015 16:23:00 +0100 Subject: [PATCH 18/40] waf: The GEANY_*_SYMBOL flags also need to be defined for C++ In Waf, we need to add the new flags to CFLAGS *and* CXXFLAGS otherwise the Scintilla build would break. To keep it more reabable, we first populate a temporary list geany_symbol_flags which is then added to CFLAGS and CXXFLAGS. Concerning the quote FIXME: no further qoting is necessary here. --- wscript | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wscript b/wscript index da4ae904..49bdd891 100644 --- a/wscript +++ b/wscript @@ -308,17 +308,18 @@ but you then may not have a local copy of the HTML manual.''' conf.write_config_header('config.h', remove=False) # GEANY_EXPORT_SYMBOL and GEANY_API_SYMBOL - # FIXME: should I put quoting in the appended values or are they passed as-is? if is_win32: - conf.env.append_value('CFLAGS', ['-DGEANY_EXPORT_SYMBOL=__declspec(dllexport)']) + geany_symbol_flags = ['-DGEANY_EXPORT_SYMBOL=__declspec(dllexport)'] # FIXME: check for -fvisibility and the __attribute__((visibility)), or # at least for GCC >= 4 elif conf.env['CC_NAME'] == 'gcc': - conf.env.append_value('CFLAGS', ['-fvisibility=hidden', - '-DGEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))']) + geany_symbol_flags = ['-fvisibility=hidden', + '-DGEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))'] else: # unknown, define to nothing - conf.env.append_value('CFLAGS', ['-DGEANY_EXPORT_SYMBOL=']) - conf.env.append_value('CFLAGS', ['-DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL']) + geany_symbol_flags = ['-DGEANY_EXPORT_SYMBOL='] + geany_symbol_flags.append('-DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL') + conf.env.append_value('CFLAGS', geany_symbol_flags) + conf.env.append_value('CXXFLAGS', geany_symbol_flags) # some more compiler flags conf.env.append_value('CFLAGS', ['-DHAVE_CONFIG_H']) From 43037b379b10637eca15dc5c2ce4de80abd73f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 18 Jan 2015 16:44:57 +0100 Subject: [PATCH 19/40] waf: Implement check whether compiler supports -fvisibility=hidden This is a bit better than compiler == 'gcc'. Tested with gcc 4.9 (success) and gcc 3.4.5 (not supported). --- wscript | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wscript b/wscript index 49bdd891..9548d26d 100644 --- a/wscript +++ b/wscript @@ -186,6 +186,7 @@ def configure(conf): conf.load('compiler_c') is_win32 = _target_is_win32(conf) + visibility_hidden_supported = conf.check_cc(cflags=['-Werror', '-fvisibility=hidden'], mandatory=False) conf.check_cc(header_name='fcntl.h', mandatory=False) conf.check_cc(header_name='fnmatch.h', mandatory=False) conf.check_cc(header_name='glob.h', mandatory=False) @@ -310,9 +311,7 @@ but you then may not have a local copy of the HTML manual.''' # GEANY_EXPORT_SYMBOL and GEANY_API_SYMBOL if is_win32: geany_symbol_flags = ['-DGEANY_EXPORT_SYMBOL=__declspec(dllexport)'] - # FIXME: check for -fvisibility and the __attribute__((visibility)), or - # at least for GCC >= 4 - elif conf.env['CC_NAME'] == 'gcc': + elif visibility_hidden_supported: geany_symbol_flags = ['-fvisibility=hidden', '-DGEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))'] else: # unknown, define to nothing From 11d4bcf7c29b587b59a0bd1fbec754c7e1439c6f Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 10 Mar 2015 22:41:09 +0100 Subject: [PATCH 20/40] Only use LIBGEANY_CFLAGS on libgeany. It includes stuff like -fvisibility which isn't appropriate for the main binary. --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 245d75f6..81f84a7f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,7 +20,6 @@ AM_CPPFLAGS = \ -DGTK \ -DGEANY_PRIVATE \ -DG_LOG_DOMAIN=\""Geany"\" \ - @LIBGEANY_CFLAGS@ \ @GTK_CFLAGS@ @GTHREAD_CFLAGS@ \ $(MAC_INTEGRATION_CFLAGS) @@ -106,6 +105,7 @@ libgeany_la_SOURCES = \ ui_utils.c ui_utils.h \ utils.c utils.h +libgeany_la_CFLAGS = $(AM_CPPFLAGS) @LIBGEANY_CFLAGS@ libgeany_la_LDFLAGS = @LIBGEANY_LDFLAGS@ libgeany_la_LIBADD = \ From c85b846eeb08ff9c3260f35a51367736e8b87287 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 10 Mar 2015 22:41:06 +0100 Subject: [PATCH 21/40] Simplify automated signal connection Instead of processing a template C source in the build system, generate a list to be included by the preprocessor. This simplifies the build system code as it now only generates the list and doesn't take care of processing the template. It incidentally fixes build on systems with 4.2BSD sed (at least OSX and FreeBSD) as it removes some offending sed code. --- src/Makefile.am | 16 ++++++---------- src/callbacks.c | 34 +++++++++++++++++++++++++++++++++- src/signalconn.c.in | 32 -------------------------------- 3 files changed, 39 insertions(+), 43 deletions(-) delete mode 100644 src/signalconn.c.in diff --git a/src/Makefile.am b/src/Makefile.am index 81f84a7f..738d42f7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,8 +10,7 @@ EXTRA_DIST = \ keybindingsprivate.h \ pluginprivate.h \ projectprivate.h \ - makefile.win32 \ - $(srcdir)/signalconn.c.in + makefile.win32 AM_CPPFLAGS = \ -I$(top_srcdir) \ @@ -163,18 +162,15 @@ libgeany_la_SOURCES += vte.c vte.h endif -callbacks.c: signalconn.c +callbacks.c: signallist.i glade_file=$(top_srcdir)/data/geany.glade -template_file=$(srcdir)/signalconn.c.in -signalconn.c: $(glade_file) $(template_file) +signallist.i: $(glade_file) Makefile $(AM_V_GEN)( \ echo '/* This file is auto-generated, do not edit. */' && \ - $(SED) -n '/@callback_map@/q;p' "$(template_file)" && \ - $(SED) -n 's/^.*handler="\([^"]\+\)".*$$/\tg_hash_table_insert(hash, (gpointer) "\1", G_CALLBACK(\1));/p' "$(glade_file)" \ - | $(SORT) | $(UNIQ) && \ - $(SED) -n '/@callback_map@/{:l;n;p;b l}' "$(template_file)" \ + $(SED) -n 's/^.*handler="\([^"]\+\)".*$$/ITEM(\1)/p' "$(glade_file)" \ + | $(SORT) | $(UNIQ) \ ) > $@ || { $(RM) $@ && exit 1; } -CLEANFILES += signalconn.c +CLEANFILES += signallist.i diff --git a/src/callbacks.c b/src/callbacks.c index a2a6f453..1e7f546f 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1909,4 +1909,36 @@ static void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer u } } -#include "signalconn.c" + +static void builder_connect_func(GtkBuilder *builder, GObject *object, + const gchar *signal_name, const gchar *handler_name, GObject *connect_obj, + GConnectFlags flags, gpointer user_data) +{ + GHashTable *hash = user_data; + GCallback callback; + + callback = g_hash_table_lookup(hash, handler_name); + g_return_if_fail(callback); + + if (connect_obj == NULL) + g_signal_connect_data(object, signal_name, callback, NULL, NULL, flags); + else + g_signal_connect_object(object, signal_name, callback, connect_obj, flags); +} + + +void callbacks_connect(GtkBuilder *builder) +{ + GHashTable *hash; + + g_return_if_fail(GTK_IS_BUILDER(builder)); + + hash = g_hash_table_new(g_str_hash, g_str_equal); + +#define ITEM(n) g_hash_table_insert(hash, (gpointer) #n, G_CALLBACK(n)); +# include "signallist.i" +#undef ITEM + + gtk_builder_connect_signals_full(builder, builder_connect_func, hash); + g_hash_table_destroy(hash); +} diff --git a/src/signalconn.c.in b/src/signalconn.c.in deleted file mode 100644 index d5983f0a..00000000 --- a/src/signalconn.c.in +++ /dev/null @@ -1,32 +0,0 @@ - - -static void builder_connect_func(GtkBuilder *builder, GObject *object, - const gchar *signal_name, const gchar *handler_name, GObject *connect_obj, - GConnectFlags flags, gpointer user_data) -{ - GHashTable *hash = user_data; - GCallback callback; - - callback = g_hash_table_lookup(hash, handler_name); - g_return_if_fail(callback); - - if (connect_obj == NULL) - g_signal_connect_data(object, signal_name, callback, NULL, NULL, flags); - else - g_signal_connect_object(object, signal_name, callback, connect_obj, flags); -} - - -void callbacks_connect(GtkBuilder *builder) -{ - GHashTable *hash; - - g_return_if_fail(GTK_IS_BUILDER(builder)); - - hash = g_hash_table_new(g_str_hash, g_str_equal); - -@callback_map@ - - gtk_builder_connect_signals_full(builder, builder_connect_func, hash); - g_hash_table_destroy(hash); -} From 56b9189a6cf42d877de5cbab64b22e722a0097ab Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 10 Mar 2015 23:20:55 +0100 Subject: [PATCH 22/40] Fix generation of `signallist.i` with BSD sed 4.2BSD sed doesn't understand the `+` quantifier, so use `{1,}`. --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 738d42f7..d23116cd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -169,7 +169,7 @@ glade_file=$(top_srcdir)/data/geany.glade signallist.i: $(glade_file) Makefile $(AM_V_GEN)( \ echo '/* This file is auto-generated, do not edit. */' && \ - $(SED) -n 's/^.*handler="\([^"]\+\)".*$$/ITEM(\1)/p' "$(glade_file)" \ + $(SED) -n 's/^.*handler="\([^"]\{1,\}\)".*$$/ITEM(\1)/p' "$(glade_file)" \ | $(SORT) | $(UNIQ) \ ) > $@ || { $(RM) $@ && exit 1; } From dbe910ca5e059cc67b53b1dac62147e1fcdd7e3c Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 11 Mar 2015 08:02:04 +0100 Subject: [PATCH 23/40] GEANY_API_SYMBOL for project_write_config() --- src/project.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/project.c b/src/project.c index 2361e93a..b235160d 100644 --- a/src/project.c +++ b/src/project.c @@ -1153,6 +1153,7 @@ static gboolean write_config(gboolean emit_signal) * * @since 1.25 */ +GEANY_API_SYMBOL void project_write_config(void) { if (!write_config(TRUE)) From 90b5e9b76f6650ea016f665613c660d54a089432 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 15 Mar 2015 14:30:14 +0100 Subject: [PATCH 24/40] waf: Add rule to generate signallist.i Based on previous work from Matthew Brush. --- wscript | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 9548d26d..432238d6 100644 --- a/wscript +++ b/wscript @@ -457,6 +457,30 @@ def build(bld): geany_sources.add('src/win32.c') geany_sources.add('geany_private.rc') + def gen_signallist(task): + from xml.etree import ElementTree + + def find_handlers(xml_filename): + tree = ElementTree.parse(xml_filename) + signals = tree.getroot().findall(".//signal") + return [sig.attrib["handler"] for sig in signals] + + handlers = [] + for node in task.inputs: + handlers += find_handlers(node.abspath()) + handlers = sorted(set(handlers)) + + for node in task.outputs: + node.write("/* This file is auto-generated, do not edit. */\n" + + ''.join(["ITEM(%s)\n" % h for h in handlers])) + + # signallist.i + bld( + source = 'data/geany.glade', + target = 'src/signallist.i', + name = 'signallist.i', + rule = gen_signallist) + base_uselibs = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M'] # libgeany bld( @@ -464,7 +488,7 @@ def build(bld): name = 'geany', target = 'geany', source = geany_sources, - includes = ['.', 'scintilla/include', 'tagmanager/src'], + includes = ['.', 'scintilla/include', 'tagmanager/src', 'src'], defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], uselib = base_uselibs, use = ['scintilla', 'ctags', 'tagmanager', 'mio'], From e61948adbda8597fdaf1ffeb7b92f3dbfed63c01 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 15 Mar 2015 18:24:04 +0100 Subject: [PATCH 25/40] Fix or remove incorrect comments --- src/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index d23116cd..3103980b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,7 +30,6 @@ geany_LDADD = libgeany.la $(GTK_LIBS) $(GTHREAD_LIBS) $(INTLLIBS) geany_includedir = $(includedir)/geany -# only install headers that define types or macros, not just functions geany_include_HEADERS = \ app.h \ build.h \ @@ -124,6 +123,7 @@ nodist_EXTRA_libgeany_la_SOURCES = dummy1.cxx CLEANFILES = if MINGW +# build Geany for Windows (possibly on non-Windows systems -- cross-compile) AM_CPPFLAGS += \ -DGEANY_DATADIR=\"data\" \ @@ -139,7 +139,6 @@ WINDRES = $(host_alias)-windres geany_private.res: $(top_srcdir)/geany_private.rc $(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff -# build Geany for Windows on non-Windows systems (cross-compile) libgeany_la_SOURCES += win32.c win32.h libgeany_la_LIBADD += -lole32 -lwsock32 -lcomdlg32 From 4e02f5884770726fdb6464ff8dcd0a469fae5549 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 15 Mar 2015 20:39:52 +0100 Subject: [PATCH 26/40] autotools: Remove useless declaration There is no need for tricking Automake to use the C++ linker to link the main executable anymore, this is done for libgeany now. --- src/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3103980b..4795ebfa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -117,7 +117,6 @@ libgeany_la_LIBADD = \ $(INTLLIBS) # tell automake we have a C++ file so it uses the C++ linker we need for Scintilla -nodist_EXTRA_geany_SOURCES = dummy.cxx nodist_EXTRA_libgeany_la_SOURCES = dummy1.cxx CLEANFILES = From b2ba6c84d51890ce9366c6620f5a48ba720d14a1 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 15 Mar 2015 23:54:17 +0100 Subject: [PATCH 27/40] autotools: Cleanup makefile a little --- src/Makefile.am | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 4795ebfa..f1e58c64 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,6 @@ EXTRA_DIST = \ gb.c \ - win32.c win32.h \ plugindata.h \ documentprivate.h \ filetypesprivate.h \ @@ -29,7 +28,6 @@ geany_SOURCES = main.c geany_LDADD = libgeany.la $(GTK_LIBS) $(GTHREAD_LIBS) $(INTLLIBS) geany_includedir = $(includedir)/geany - geany_include_HEADERS = \ app.h \ build.h \ @@ -139,9 +137,7 @@ geany_private.res: $(top_srcdir)/geany_private.rc $(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff libgeany_la_SOURCES += win32.c win32.h - libgeany_la_LIBADD += -lole32 -lwsock32 -lcomdlg32 - libgeany_la_LDFLAGS += -Wl,-luuid -mwindows -mms-bitfields -no-undefined CLEANFILES += geany_private.res From 05f362b3bd5247dc9102c908d98b393cc0175242 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 1 Apr 2015 07:56:30 +0200 Subject: [PATCH 28/40] Have to include a few more headers for plugins --- plugins/geanyplugin.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/geanyplugin.h b/plugins/geanyplugin.h index 2c5c82ef..117f2b92 100644 --- a/plugins/geanyplugin.h +++ b/plugins/geanyplugin.h @@ -34,6 +34,7 @@ /* Only include public headers here */ #include "app.h" +#include "build.h" #include "dialogs.h" #include "document.h" #include "editor.h" @@ -60,4 +61,6 @@ #include "ui_utils.h" #include "utils.h" +#include "gtkcompat.h" + #endif From a320609d5f3e25104f072c196484ef8072bb4ea1 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 1 Apr 2015 07:18:46 +0200 Subject: [PATCH 29/40] waf: Fixes for libgeany - libgeany install dir was wrong on win32 - comdlg32 is required - more headers need to be installed - -fPIC is required on some platforms - LINKFLAGS_cprogram now have to be applied to libgeany.dll --- wscript | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/wscript b/wscript index 432238d6..df165d15 100644 --- a/wscript +++ b/wscript @@ -63,7 +63,6 @@ GEANY_LIB_VERSION = '0.0.0' top = '.' out = '_build_' - mio_sources = set(['tagmanager/mio/mio.c']) ctags_sources = set([ @@ -269,7 +268,7 @@ but you then may not have a local copy of the HTML manual.''' '-mwindows', '-static-libgcc', '-static-libstdc++']) - conf.env.append_value('LIB_WIN32', ['wsock32', 'uuid', 'ole32']) + conf.env.append_value('LIB_WIN32', ['wsock32', 'uuid', 'ole32', 'comdlg32']) # explicitly define Windows version for older Mingw environments conf.define('WINVER', '0x0501', quote=False) # for SHGetFolderPathAndSubDirW conf.define('_WIN32_IE', '0x0500', quote=False) # for SHGFP_TYPE @@ -285,6 +284,12 @@ but you then may not have a local copy of the HTML manual.''' _define_from_opt(conf, 'DOCDIR', conf.options.docdir, docdir) _define_from_opt(conf, 'LIBDIR', conf.options.libdir, libdir) _define_from_opt(conf, 'MANDIR', conf.options.mandir, mandir) + # The check could be improved, -fPIC iso only really necessary on 64bit linux + # It is needed because waf doesn't realize the static files go into + # a shared library + conf.env.append_value('CFLAGS_cstlib', '-fPIC') + conf.env.append_value('CFLAGS_cxxstlib', '-fPIC') + conf.env.append_value('CXXFLAGS_cxxstlib', '-fPIC') conf.define('ENABLE_NLS', 1) conf.define('GEANY_LOCALEDIR', '' if is_win32 else conf.env['LOCALEDIR'], quote=True) @@ -482,7 +487,11 @@ def build(bld): rule = gen_signallist) base_uselibs = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M'] + # libgeany + instpath = '${PREFIX}/bin' if is_win32 else '${LIBDIR}' + linkflags = bld.env['LINKFLAGS_cprogram'] + bld( features = ['c', 'cxx', 'cshlib'], name = 'geany', @@ -492,7 +501,9 @@ def build(bld): defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], uselib = base_uselibs, use = ['scintilla', 'ctags', 'tagmanager', 'mio'], - vnum = GEANY_LIB_VERSION) + linkflags = linkflags, + vnum = GEANY_LIB_VERSION, + install_path = instpath) # geany executable bld( @@ -598,11 +609,36 @@ def build(bld): ### # Headers bld.install_files('${PREFIX}/include/geany', ''' - src/app.h src/document.h src/editor.h src/encodings.h src/filetypes.h src/geany.h - src/highlighting.h src/keybindings.h src/msgwindow.h src/plugindata.h - src/prefs.h src/project.h src/search.h src/stash.h src/support.h - src/templates.h src/toolbar.h src/ui_utils.h src/utils.h src/build.h src/gtkcompat.h - plugins/geanyplugin.h plugins/geanyfunctions.h''') + src/app.h + src/build.h + src/dialogs.h + src/document.h + src/editor.h + src/encodings.h + src/filetypes.h + src/geany.h + src/highlighting.h + src/keybindings.h + src/main.h + src/msgwindow.h + src/navqueue.h + src/plugindata.h + src/pluginutils.h + src/prefs.h + src/project.h + src/sciwrappers.h + src/search.h + src/stash.h + src/support.h + src/symbols.h + src/templates.h + src/toolbar.h + src/ui_utils.h + src/utils.h + src/gtkcompat.h + plugins/geanyplugin.h + plugins/geanyfunctions.h + ''') bld.install_files('${PREFIX}/include/geany/scintilla', ''' scintilla/include/SciLexer.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/include/ScintillaWidget.h ''') From 1c27e41bfa4bee44ef425f05bf3eabb8bd4ca2fe Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 1 Apr 2015 07:19:59 +0200 Subject: [PATCH 30/40] The mkstemps special case for windows is not necessary --- tagmanager/ctags/ctags.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tagmanager/ctags/ctags.c b/tagmanager/ctags/ctags.c index a35e619d..56bf67fb 100644 --- a/tagmanager/ctags/ctags.c +++ b/tagmanager/ctags/ctags.c @@ -599,11 +599,7 @@ extern FILE *tempFile (const char *const mode, char **const pName) tmpdir = TMPDIR; name = xMalloc (strlen (tmpdir) + 1 + strlen (template) + 1, char); sprintf (name, "%s%c%s", tmpdir, OUTPUT_PATH_SEPARATOR, template); -#ifdef G_OS_WIN32 - fd = mkstemps(name, 0); -#else fd = mkstemp(name); -#endif #else name = xMalloc (L_tmpnam, char); if (tmpnam (name) != name) From 11b5c0216fab87a743ffa9adba66c60811ec8626 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 1 Apr 2015 21:13:00 +0200 Subject: [PATCH 31/40] stash_group_add_boolean is an API function, misplaced within GEANY_PRIVATE --- src/stash.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stash.h b/src/stash.h index 8ac8a10a..5e446742 100644 --- a/src/stash.h +++ b/src/stash.h @@ -36,6 +36,9 @@ typedef gconstpointer StashWidgetID; StashGroup *stash_group_new(const gchar *name); +void stash_group_add_boolean(StashGroup *group, gboolean *setting, + const gchar *key_name, gboolean default_value); + void stash_group_add_integer(StashGroup *group, gint *setting, const gchar *key_name, gint default_value); @@ -94,9 +97,6 @@ void stash_group_set_various(StashGroup *group, gboolean write_once); void stash_group_set_use_defaults(StashGroup *group, gboolean use_defaults); -void stash_group_add_boolean(StashGroup *group, gboolean *setting, - const gchar *key_name, gboolean default_value); - /* *** GTK-related functions *** */ void stash_tree_setup(GPtrArray *group_array, GtkTreeView *tree); From a1f2d0b94a8b49ce656f217afcc288fe49ff9aef Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 5 Apr 2015 16:54:55 +0200 Subject: [PATCH 32/40] waf: Don't use temp variables --- wscript | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wscript b/wscript index df165d15..af7f65c0 100644 --- a/wscript +++ b/wscript @@ -489,9 +489,6 @@ def build(bld): base_uselibs = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M'] # libgeany - instpath = '${PREFIX}/bin' if is_win32 else '${LIBDIR}' - linkflags = bld.env['LINKFLAGS_cprogram'] - bld( features = ['c', 'cxx', 'cshlib'], name = 'geany', @@ -501,9 +498,9 @@ def build(bld): defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], uselib = base_uselibs, use = ['scintilla', 'ctags', 'tagmanager', 'mio'], - linkflags = linkflags, + linkflags = bld.env['LINKFLAGS_cprogram'], vnum = GEANY_LIB_VERSION, - install_path = instpath) + install_path = '${PREFIX}/bin' if is_win32 else '${LIBDIR}') # geany executable bld( From 7649a6921fc36a518a38d0c35006ed100ad5486b Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 5 Apr 2015 16:55:11 +0200 Subject: [PATCH 33/40] waf: Fix core plugins on Linux The -fvisibility=hidden flag for libgeany.so is also applied to plugins. This is not desirable. --- wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wscript b/wscript index af7f65c0..9fbd2105 100644 --- a/wscript +++ b/wscript @@ -319,6 +319,7 @@ but you then may not have a local copy of the HTML manual.''' elif visibility_hidden_supported: geany_symbol_flags = ['-fvisibility=hidden', '-DGEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))'] + conf.env['CFLAGS_plugin'] = '-fvisibility=default' else: # unknown, define to nothing geany_symbol_flags = ['-DGEANY_EXPORT_SYMBOL='] geany_symbol_flags.append('-DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL') @@ -406,6 +407,7 @@ def build(bld): includes = ['.', 'src/', 'scintilla/include', 'tagmanager/src'], defines = 'G_LOG_DOMAIN="%s"' % plugin_name, target = plugin_name, + cflags = bld.env['CFLAGS_plugin'], uselib = ['GTK', 'GLIB', 'GMODULE'] + uselib_add, use = ['geany'], install_path = instpath) From e4ab28058d1482b1b7383138dfee8cfc6f4c5d7f Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 5 Apr 2015 20:03:59 +0200 Subject: [PATCH 34/40] waf: set rpath for executable Whether rpath is liked or not, it allows geany to Just Work and is consistent with autotools --- wscript | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 9fbd2105..40c5c262 100644 --- a/wscript +++ b/wscript @@ -505,7 +505,7 @@ def build(bld): install_path = '${PREFIX}/bin' if is_win32 else '${LIBDIR}') # geany executable - bld( + t = bld( features = ['c', 'cxx', 'cprogram'], name = 'geany_bin', target = 'geany', @@ -514,6 +514,9 @@ def build(bld): defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], uselib = base_uselibs, use = ['geany']) + if not is_win32: + # http://www.freehackers.org/~tnagy/testdoc/single.html#common_c + t.rpath = bld.env['LIBDIR'] # Plugins if bld.env['HAVE_PLUGINS'] == 1: From ede1faca54dcd96848047f4cde5fe989e9813e3a Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 5 Apr 2015 00:24:28 +0000 Subject: [PATCH 35/40] Move GeanyFunctions declaration back in plugindata.h This avoids breaking plugins that don't use geanyplugin.h as they should but include some random headers. --- plugins/geanyfunctions.h | 4 ---- src/plugindata.h | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/geanyfunctions.h b/plugins/geanyfunctions.h index aaa2b985..9a2f97b9 100644 --- a/plugins/geanyfunctions.h +++ b/plugins/geanyfunctions.h @@ -23,9 +23,5 @@ #ifndef GEANY_FUNCTIONS_H #define GEANY_FUNCTIONS_H 1 -/* This remains so that older plugins that contain a `GeanyFunctions *geany_functions;` - * variable in their plugin - as was previously required - will still compile - * without changes. */ -typedef struct GeanyFunctionsUndefined GeanyFunctions; #endif /* GEANY_FUNCTIONS */ diff --git a/src/plugindata.h b/src/plugindata.h index 940c89d7..f2daa424 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -268,6 +268,11 @@ void plugin_cleanup(void); /* Deprecated aliases */ #ifndef GEANY_DISABLE_DEPRECATED +/* This remains so that older plugins that contain a `GeanyFunctions *geany_functions;` + * variable in their plugin - as was previously required - will still compile + * without changes. */ +typedef struct GeanyFunctionsUndefined GeanyFunctions; + #define document_reload_file document_reload_force /** @deprecated - copy into your plugin code if needed. From 5b9bb1d7b20f61c092d31bff1dbfe89eda566d87 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 5 Apr 2015 00:27:47 +0000 Subject: [PATCH 36/40] Include geanyplugin.h from geanyfunctions.h for compatibility geanyfunctions.h used to bring all function declarations, and some plugins depend on this side effect instead of properly including geanyplugin.h directly. So, reintroduce the behavior for compatibility with those plugins. --- plugins/geanyfunctions.h | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/geanyfunctions.h b/plugins/geanyfunctions.h index 9a2f97b9..294685a1 100644 --- a/plugins/geanyfunctions.h +++ b/plugins/geanyfunctions.h @@ -23,5 +23,6 @@ #ifndef GEANY_FUNCTIONS_H #define GEANY_FUNCTIONS_H 1 +#include "geanyplugin.h" #endif /* GEANY_FUNCTIONS */ From 01db7f0cac907d283a84976ff3b542160c317a7a Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 5 Apr 2015 00:38:59 +0000 Subject: [PATCH 37/40] Add signallist.i to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0ae55162..a664e0ce 100644 --- a/.gitignore +++ b/.gitignore @@ -92,6 +92,7 @@ Makefile.in # /src/ #----------------------------------------------------------------------- /src/geany +/src/signallist.i #----------------------------------------------------------------------- # /doc/ From 7ac4bf3d24a08533e2557c30624aa961c3547c4e Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 6 Apr 2015 02:22:53 +0200 Subject: [PATCH 38/40] waf: Don't abuse static libraries Instead of abusing static libraries putting shared objects in them, and manually setting the flags required to build shared objects, use sets of objects and Waf's own cshlib/cxxshlib flags. Also explicitly call the appropriate build context method instead of only listing features in order to make it clear what is built. Some references: * http://docs.waf.googlecode.com/git/book_16/single.html#_predefined_task_generators * http://docs.waf.googlecode.com/git/book_16/single.html#_local_libraries * https://code.google.com/p/waf/issues/detail?id=1398 --- wscript | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/wscript b/wscript index 40c5c262..85cba040 100644 --- a/wscript +++ b/wscript @@ -284,12 +284,6 @@ but you then may not have a local copy of the HTML manual.''' _define_from_opt(conf, 'DOCDIR', conf.options.docdir, docdir) _define_from_opt(conf, 'LIBDIR', conf.options.libdir, libdir) _define_from_opt(conf, 'MANDIR', conf.options.mandir, mandir) - # The check could be improved, -fPIC iso only really necessary on 64bit linux - # It is needed because waf doesn't realize the static files go into - # a shared library - conf.env.append_value('CFLAGS_cstlib', '-fPIC') - conf.env.append_value('CFLAGS_cxxstlib', '-fPIC') - conf.env.append_value('CXXFLAGS_cxxstlib', '-fPIC') conf.define('ENABLE_NLS', 1) conf.define('GEANY_LOCALEDIR', '' if is_win32 else conf.env['LOCALEDIR'], quote=True) @@ -413,49 +407,45 @@ def build(bld): install_path = instpath) # CTags - bld( - features = ['c', 'cstlib'], + bld.objects( + features = ['c'], source = ctags_sources, name = 'ctags', target = 'ctags', includes = ['.', 'tagmanager', 'tagmanager/ctags'], defines = 'G_LOG_DOMAIN="CTags"', - uselib = ['GLIB'], - install_path = None) # do not install this library + uselib = ['cshlib', 'GLIB']) # Tagmanager - bld( - features = ['c', 'cstlib'], + bld.objects( + features = ['c'], source = tagmanager_sources, name = 'tagmanager', target = 'tagmanager', includes = ['.', 'tagmanager', 'tagmanager/ctags'], defines = ['GEANY_PRIVATE', 'G_LOG_DOMAIN="Tagmanager"'], - uselib = ['GTK', 'GLIB'], - install_path = None) # do not install this library + uselib = ['cshlib', 'GTK', 'GLIB']) # MIO - bld( - features = ['c', 'cstlib'], + bld.objects( + features = ['c'], source = mio_sources, name = 'mio', target = 'mio', includes = ['.', 'tagmanager/mio/'], defines = 'G_LOG_DOMAIN="MIO"', - uselib = ['GTK', 'GLIB'], - install_path = None) # do not install this library + uselib = ['cshlib', 'GTK', 'GLIB']) # Scintilla files = bld.srcnode.ant_glob('scintilla/**/*.cxx', src=True, dir=False) scintilla_sources.update([file.path_from(bld.srcnode) for file in files]) - bld( - features = ['c', 'cxx', 'cxxstlib'], + bld.objects( + features = ['c', 'cxx'], name = 'scintilla', target = 'scintilla', source = scintilla_sources, includes = ['.', 'scintilla/include', 'scintilla/src', 'scintilla/lexlib'], - uselib = ['GTK', 'GLIB', 'GMODULE', 'M'], - install_path = None) # do not install this library + uselib = ['cshlib', 'cxxshlib', 'GTK', 'GLIB', 'GMODULE', 'M']) # Geany if bld.env['HAVE_VTE'] == 1: @@ -491,8 +481,8 @@ def build(bld): base_uselibs = ['GTK', 'GLIB', 'GMODULE', 'GIO', 'GTHREAD', 'WIN32', 'MAC_INTEGRATION', 'SUNOS_SOCKET', 'M'] # libgeany - bld( - features = ['c', 'cxx', 'cshlib'], + bld.shlib( + features = ['c', 'cxx'], name = 'geany', target = 'geany', source = geany_sources, @@ -505,8 +495,8 @@ def build(bld): install_path = '${PREFIX}/bin' if is_win32 else '${LIBDIR}') # geany executable - t = bld( - features = ['c', 'cxx', 'cprogram'], + t = bld.program( + features = ['c', 'cxx'], name = 'geany_bin', target = 'geany', source = ['src/main.c'], From 07dacb66d23b58b34eee51aac28a8ad2fcf5693c Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 6 Apr 2015 01:52:38 +0200 Subject: [PATCH 39/40] waf: Improve passing of export and visibility flags --- wscript | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/wscript b/wscript index 85cba040..7ed3f042 100644 --- a/wscript +++ b/wscript @@ -309,16 +309,18 @@ but you then may not have a local copy of the HTML manual.''' # GEANY_EXPORT_SYMBOL and GEANY_API_SYMBOL if is_win32: - geany_symbol_flags = ['-DGEANY_EXPORT_SYMBOL=__declspec(dllexport)'] + geanyexport_cflags = [] + geanyexport_defines = ['GEANY_EXPORT_SYMBOL=__declspec(dllexport)'] elif visibility_hidden_supported: - geany_symbol_flags = ['-fvisibility=hidden', - '-DGEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))'] - conf.env['CFLAGS_plugin'] = '-fvisibility=default' + geanyexport_cflags = ['-fvisibility=hidden'] + geanyexport_defines = ['GEANY_EXPORT_SYMBOL=__attribute__((visibility("default")))'] else: # unknown, define to nothing - geany_symbol_flags = ['-DGEANY_EXPORT_SYMBOL='] - geany_symbol_flags.append('-DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL') - conf.env.append_value('CFLAGS', geany_symbol_flags) - conf.env.append_value('CXXFLAGS', geany_symbol_flags) + geanyexport_cflags = [] + geanyexport_defines = ['GEANY_EXPORT_SYMBOL='] + geanyexport_defines.append('GEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL') + conf.env['DEFINES_geanyexport'] = geanyexport_defines + conf.env['CFLAGS_geanyexport'] = geanyexport_cflags + conf.env['CXXFLAGS_geanyexport'] = geanyexport_cflags # some more compiler flags conf.env.append_value('CFLAGS', ['-DHAVE_CONFIG_H']) @@ -401,7 +403,6 @@ def build(bld): includes = ['.', 'src/', 'scintilla/include', 'tagmanager/src'], defines = 'G_LOG_DOMAIN="%s"' % plugin_name, target = plugin_name, - cflags = bld.env['CFLAGS_plugin'], uselib = ['GTK', 'GLIB', 'GMODULE'] + uselib_add, use = ['geany'], install_path = instpath) @@ -414,7 +415,7 @@ def build(bld): target = 'ctags', includes = ['.', 'tagmanager', 'tagmanager/ctags'], defines = 'G_LOG_DOMAIN="CTags"', - uselib = ['cshlib', 'GLIB']) + uselib = ['cshlib', 'GLIB', 'geanyexport']) # Tagmanager bld.objects( @@ -424,7 +425,7 @@ def build(bld): target = 'tagmanager', includes = ['.', 'tagmanager', 'tagmanager/ctags'], defines = ['GEANY_PRIVATE', 'G_LOG_DOMAIN="Tagmanager"'], - uselib = ['cshlib', 'GTK', 'GLIB']) + uselib = ['cshlib', 'GTK', 'GLIB', 'geanyexport']) # MIO bld.objects( @@ -434,7 +435,7 @@ def build(bld): target = 'mio', includes = ['.', 'tagmanager/mio/'], defines = 'G_LOG_DOMAIN="MIO"', - uselib = ['cshlib', 'GTK', 'GLIB']) + uselib = ['cshlib', 'GTK', 'GLIB', 'geanyexport']) # Scintilla files = bld.srcnode.ant_glob('scintilla/**/*.cxx', src=True, dir=False) @@ -445,7 +446,7 @@ def build(bld): target = 'scintilla', source = scintilla_sources, includes = ['.', 'scintilla/include', 'scintilla/src', 'scintilla/lexlib'], - uselib = ['cshlib', 'cxxshlib', 'GTK', 'GLIB', 'GMODULE', 'M']) + uselib = ['cshlib', 'cxxshlib', 'GTK', 'GLIB', 'GMODULE', 'M', 'geanyexport']) # Geany if bld.env['HAVE_VTE'] == 1: @@ -488,7 +489,7 @@ def build(bld): source = geany_sources, includes = ['.', 'scintilla/include', 'tagmanager/src', 'src'], defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], - uselib = base_uselibs, + uselib = base_uselibs + ['geanyexport'], use = ['scintilla', 'ctags', 'tagmanager', 'mio'], linkflags = bld.env['LINKFLAGS_cprogram'], vnum = GEANY_LIB_VERSION, @@ -502,7 +503,7 @@ def build(bld): source = ['src/main.c'], includes = ['.', 'scintilla/include', 'tagmanager/src'], defines = ['G_LOG_DOMAIN="Geany"', 'GEANY_PRIVATE'], - uselib = base_uselibs, + uselib = base_uselibs + ['geanyexport'], use = ['geany']) if not is_win32: # http://www.freehackers.org/~tnagy/testdoc/single.html#common_c From 5caf2b3e77780daf52d59a4088efa5b8628e3f22 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 10 Apr 2015 16:52:30 +0200 Subject: [PATCH 40/40] Bump ABI version for new linkage mechanism --- src/plugindata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugindata.h b/src/plugindata.h index f2daa424..98e83f7e 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -72,7 +72,7 @@ G_BEGIN_DECLS * Changing this forces all plugins to be recompiled before Geany can load them. */ /* This should usually stay the same if fields are only appended, assuming only pointers to * structs and not structs themselves are declared by plugins. */ -#define GEANY_ABI_VERSION (70 << GEANY_ABI_SHIFT) +#define GEANY_ABI_VERSION (71 << GEANY_ABI_SHIFT) /** Defines a function to check the plugin is safe to load.