Revision: 1758 http://geany.svn.sourceforge.net/geany/?rev=1758&view=rev Author: eht16 Date: 2007-07-28 10:44:02 -0700 (Sat, 28 Jul 2007)
Log Message: ----------- Make plugins working and compiling on Windows.
Modified Paths: -------------- trunk/ChangeLog trunk/makefile.win32 trunk/src/dialogs.c trunk/src/plugins.c trunk/win32-config.h
Added Paths: ----------- trunk/plugins/makefile.win32
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-07-28 15:18:01 UTC (rev 1757) +++ trunk/ChangeLog 2007-07-28 17:44:02 UTC (rev 1758) @@ -11,6 +11,8 @@ Use PACKAGE_LIB_DIR. Load plugins in ~/.geany/plugins/ prior to the default location. * src/symbols.c: Hide empty symbol types in the symbol list. + * makefile.win32, win32-config.h, plugins/makefile.win32, + src/plugins.c: Make plugins working and compiling on Windows.
2007-07-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/makefile.win32 =================================================================== --- trunk/makefile.win32 2007-07-28 15:18:01 UTC (rev 1757) +++ trunk/makefile.win32 2007-07-28 17:44:02 UTC (rev 1758) @@ -23,6 +23,7 @@ all: check-tools config.h cd tagmanager && make -f makefile.win32 && cd .. cd scintilla && make -f makefile.win32 && cd .. + cd plugins && make -f makefile.win32 && cd .. cd src && make -f makefile.win32 && cd ..
# first check the required tools are installed @@ -35,7 +36,7 @@ $(CP) $< $@
deps: - -$(RM) tagmanager\deps.mak scintilla\deps.mak src\deps.mak + -$(RM) tagmanager\deps.mak scintilla\deps.mak plugins\deps.mak src\deps.mak
# used by src/makefile.win32 to avoid del ../file which is an error clean-local: @@ -44,4 +45,5 @@ clean: deps cd tagmanager && make -f makefile.win32 clean && cd .. cd scintilla && make -f makefile.win32 clean && cd .. + cd plugins && make -f makefile.win32 clean && cd .. cd src && make -f makefile.win32 clean && cd ..
Added: trunk/plugins/makefile.win32 =================================================================== --- trunk/plugins/makefile.win32 (rev 0) +++ trunk/plugins/makefile.win32 2007-07-28 17:44:02 UTC (rev 1758) @@ -0,0 +1,58 @@ +# Adapted from Pidgin's plugins/Makefile.am, thanks + +CC = gcc +CXX = g++ +PREFIX = C:\libs +RM = del +-include ../localwin32.mk +.SUFFIXES: +.SUFFIXES: .c .dll + +GTK_INCLUDES= \ + -I$(PREFIX)/include/gtk-2.0 \ + -I$(PREFIX)/lib/gtk-2.0/include \ + -I$(PREFIX)/include/atk-1.0 \ + -I$(PREFIX)/include/pango-1.0 \ + -I$(PREFIX)/include/cairo \ + -I$(PREFIX)/include/glib-2.0 \ + -I$(PREFIX)/lib/glib-2.0/include \ + -I$(PREFIX)/include/gettext \ + -I$(PREFIX)/include + +INCLUDEDIRS= -I.. \ + -I../src \ + -I../scintilla/include \ + -I../tagmanager/include \ + $(GTK_INCLUDES) + +ALL_GTK_LIBS= \ + -L"$(PREFIX)/lib" \ + -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 \ + -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv + +CCFLAGS=-Wall -O2 -mms-bitfields + +.PHONY: all clean plugins + +all: plugins + +.c.dll: + $(CC) $(CCFLAGS) $(DEFINES) $(INCLUDEDIRS) -o $@.o -c $< + $(CC) -shared $@.o $(ALL_GTK_LIBS) $(DLL_LD_FLAGS) -o $@ + +plugins: \ + htmlchars.dll \ + demoplugin.dll \ + classbuilder.dll + +clean: + -$(RM) deps.mak *.o *.dll + +deps.mak: + $(CC) -MM $(CCFLAGS) $(DEFINES) $(INCLUDEDIRS) *.c >deps.mak + +# Generate header dependencies with "make deps.mak" +include deps.mak + +..\localwin32.mk: + echo # Set local variables here >$@
Modified: trunk/src/dialogs.c =================================================================== --- trunk/src/dialogs.c 2007-07-28 15:18:01 UTC (rev 1757) +++ trunk/src/dialogs.c 2007-07-28 17:44:02 UTC (rev 1758) @@ -652,6 +652,7 @@ }
+#ifndef G_OS_WIN32 static void on_font_apply_button_clicked (GtkButton *button, gpointer user_data) @@ -681,6 +682,7 @@ { gtk_widget_hide(app->open_fontsel); } +#endif
/* This shows the font selection dialog to choose a font. */
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2007-07-28 15:18:01 UTC (rev 1757) +++ trunk/src/plugins.c 2007-07-28 17:44:02 UTC (rev 1758) @@ -28,6 +28,8 @@
#ifdef HAVE_PLUGINS
+#include <string.h> + #include "plugins.h" #include "plugindata.h" #include "support.h" @@ -37,7 +39,13 @@ #include "sciwrappers.h" #include "ui_utils.h"
+#ifdef G_OS_WIN32 +# define PLUGIN_EXT "dll" +#else +# define PLUGIN_EXT "so" +#endif
+ typedef struct Plugin { GModule *module; @@ -267,14 +275,18 @@ load_plugins(const gchar *path) { GSList *list, *item; + gchar *fname, *tmp; + Plugin *plugin;
list = utils_get_file_list(path, NULL, NULL);
for (item = list; item != NULL; item = g_slist_next(item)) { - gchar *fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL); - Plugin *plugin; + tmp = strrchr(item->data, '.'); + if (tmp == NULL || strcasecmp(tmp, "." PLUGIN_EXT) != 0) + continue;
+ fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL); plugin = plugin_new(fname); if (plugin != NULL) { @@ -288,25 +300,43 @@ }
+#ifdef G_OS_WIN32 +static gchar *get_plugin_path() +{ + gchar *install_dir = g_win32_get_package_installation_directory("geany", NULL); + gchar *path; + + path = g_strconcat(install_dir, "\plugins", NULL); + + return path; +} +#endif + + void plugins_init() { GtkWidget *widget; - gchar *path_user; + gchar *path;
geany_data_init();
widget = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(geany_data.tools_menu), widget);
- path_user = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL); + path = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL); // first load plugins in ~/.geany/plugins/, then in $prefix/lib/geany - load_plugins(path_user); + load_plugins(path); +#ifdef G_OS_WIN32 + g_free(path); + path = get_plugin_path(); + load_plugins(path); +#else load_plugins(PACKAGE_LIB_DIR G_DIR_SEPARATOR_S "geany"); - +#endif if (g_list_length(plugin_list) > 0) gtk_widget_show(widget);
- g_free(path_user); + g_free(path); }
Modified: trunk/win32-config.h =================================================================== --- trunk/win32-config.h 2007-07-28 15:18:01 UTC (rev 1757) +++ trunk/win32-config.h 2007-07-28 17:44:02 UTC (rev 1758) @@ -138,7 +138,7 @@ /* #undef HAVE_NDIR_H */
/* Define if plugins are enabled. */ -//#define HAVE_PLUGINS 1 +#define HAVE_PLUGINS 1
/* Define to 1 if you have the `putenv' function. */ #define HAVE_PUTENV 1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.