gedit r6247 - in branches/jessevdk-plugins: . bindings/python gedit gedit/dialogs gedit/plugins plugins/changecase plugins/docinfo plugins/filebrowser plugins/filebrowser/bindings plugins/indent plugins/modelines plugins/sample plugins/sort plugins/spell plugins/taglist plugins/time



Author: jessevdk
Date: Mon Apr  7 21:16:46 2008
New Revision: 6247
URL: http://svn.gnome.org/viewvc/gedit?rev=6247&view=rev

Log:
	* Reverted back to having plugins in the root directory again, tried to
	  fix problem with unused functions being stripped from libplugins, but
	  the same problem occurs of course with libgedit now. So currently gedit
	  builds, but misses a symbol (which is required by the file browser plugin)
	  It can be made to work manually, but needs to be fixed soon
	* Implemented python bindings for the file browser (and they actually work!)
	  C plugins can use the plugin_python_utils to register bindings when the
	  virtual function register_binding is called. The bindings will then be
	  installed in gedit.plugins in a module derived from the GType name of 
	  the plugin. For instance for GeditFileBrowserPlugin, this results in
	  gedit.plugins.FileBrowser


Added:
   branches/jessevdk-plugins/gedit/gedit-module.c
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-module.c
   branches/jessevdk-plugins/gedit/gedit-module.h
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-module.h
   branches/jessevdk-plugins/gedit/gedit-plugin-info-priv.h
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-info-priv.h
   branches/jessevdk-plugins/gedit/gedit-plugin-info.c
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-info.c
   branches/jessevdk-plugins/gedit/gedit-plugin-info.h
      - copied, changed from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-info.h
   branches/jessevdk-plugins/gedit/gedit-plugin-manager.c
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-manager.c
   branches/jessevdk-plugins/gedit/gedit-plugin-manager.h
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-manager.h
   branches/jessevdk-plugins/gedit/gedit-plugin-python-utils.c
      - copied, changed from r6246, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-python-utils.c
   branches/jessevdk-plugins/gedit/gedit-plugin-python-utils.h
      - copied, changed from r6246, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-python-utils.h
   branches/jessevdk-plugins/gedit/gedit-plugin.c
      - copied unchanged from r6244, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin.c
   branches/jessevdk-plugins/gedit/gedit-plugin.h
      - copied unchanged from r6244, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin.h
   branches/jessevdk-plugins/gedit/gedit-plugins-engine.c
      - copied unchanged from r6243, /branches/jessevdk-plugins/gedit/plugins/gedit-plugins-engine.c
   branches/jessevdk-plugins/gedit/gedit-plugins-engine.h
      - copied, changed from r6243, /branches/jessevdk-plugins/gedit/plugins/gedit-plugins-engine.h
   branches/jessevdk-plugins/gedit/gedit-python-module.c
      - copied unchanged from r6243, /branches/jessevdk-plugins/gedit/plugins/gedit-python-module.c
   branches/jessevdk-plugins/gedit/gedit-python-module.h
      - copied unchanged from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-python-module.h
   branches/jessevdk-plugins/gedit/gedit-python-plugin.c
      - copied unchanged from r6243, /branches/jessevdk-plugins/gedit/plugins/gedit-python-plugin.c
   branches/jessevdk-plugins/gedit/gedit-python-plugin.h
      - copied unchanged from r6243, /branches/jessevdk-plugins/gedit/plugins/gedit-python-plugin.h
   branches/jessevdk-plugins/plugins/filebrowser/bindings/
   branches/jessevdk-plugins/plugins/filebrowser/bindings/Makefile.am
   branches/jessevdk-plugins/plugins/filebrowser/bindings/filebrowser.defs
   branches/jessevdk-plugins/plugins/filebrowser/bindings/filebrowser.override
Removed:
   branches/jessevdk-plugins/gedit/plugins/
Modified:
   branches/jessevdk-plugins/bindings/python/gedit.override
   branches/jessevdk-plugins/bindings/python/geditplugin.override
   branches/jessevdk-plugins/bindings/python/geditplugins.override
   branches/jessevdk-plugins/configure.ac
   branches/jessevdk-plugins/gedit/Makefile.am
   branches/jessevdk-plugins/gedit/dialogs/gedit-preferences-dialog.c
   branches/jessevdk-plugins/gedit/gedit-session.c
   branches/jessevdk-plugins/gedit/gedit-window.c
   branches/jessevdk-plugins/gedit/gedit.c
   branches/jessevdk-plugins/plugins/changecase/gedit-changecase-plugin.h
   branches/jessevdk-plugins/plugins/docinfo/gedit-docinfo-plugin.h
   branches/jessevdk-plugins/plugins/filebrowser/Makefile.am
   branches/jessevdk-plugins/plugins/filebrowser/gedit-file-bookmarks-store.c
   branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.c
   branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.h
   branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-store.c
   branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-view.c
   branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-widget.c
   branches/jessevdk-plugins/plugins/indent/gedit-indent-plugin.h
   branches/jessevdk-plugins/plugins/modelines/gedit-modeline-plugin.h
   branches/jessevdk-plugins/plugins/sample/gedit-sample-plugin.h
   branches/jessevdk-plugins/plugins/sort/gedit-sort-plugin.h
   branches/jessevdk-plugins/plugins/spell/gedit-spell-plugin.h
   branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin-panel.c
   branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.c
   branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.h
   branches/jessevdk-plugins/plugins/time/gedit-time-plugin.h

Modified: branches/jessevdk-plugins/bindings/python/gedit.override
==============================================================================
--- branches/jessevdk-plugins/bindings/python/gedit.override	(original)
+++ branches/jessevdk-plugins/bindings/python/gedit.override	Mon Apr  7 21:16:46 2008
@@ -5,8 +5,8 @@
 #include <pygtk/pygtk.h>
 
 #include "gedit-language-manager.h"
-#include "plugins/gedit-plugin.h"
-#include "plugins/gedit-python-plugin.h"
+#include "gedit-plugin.h"
+#include "gedit-python-plugin.h"
 #include "gedit-app.h"
 #include "gedit-encodings.h"
 #include "gedit-enum-types.h"

Modified: branches/jessevdk-plugins/bindings/python/geditplugin.override
==============================================================================
--- branches/jessevdk-plugins/bindings/python/geditplugin.override	(original)
+++ branches/jessevdk-plugins/bindings/python/geditplugin.override	Mon Apr  7 21:16:46 2008
@@ -1,6 +1,6 @@
 %%
 headers
-#include "plugins/gedit-plugin.h"
+#include "gedit-plugin.h"
 #include "gedit-window.h"
 %%
 override gedit_plugin_activate kwargs

Modified: branches/jessevdk-plugins/bindings/python/geditplugins.override
==============================================================================
--- branches/jessevdk-plugins/bindings/python/geditplugins.override	(original)
+++ branches/jessevdk-plugins/bindings/python/geditplugins.override	Mon Apr  7 21:16:46 2008
@@ -4,10 +4,10 @@
 #include "pygobject.h"
 #include <pygtk/pygtk.h>
 
-#include "plugins/gedit-plugins-engine.h"
-#include "plugins/gedit-plugin.h"
-#include "plugins/gedit-python-plugin.h"
-#include "plugins/gedit-plugin-info.h"
+#include "gedit-plugins-engine.h"
+#include "gedit-plugin.h"
+#include "gedit-python-plugin.h"
+#include "gedit-plugin-info.h"
 
 static PyObject *
 _helper_wrap_string_list (const gchar **list)

Modified: branches/jessevdk-plugins/configure.ac
==============================================================================
--- branches/jessevdk-plugins/configure.ac	(original)
+++ branches/jessevdk-plugins/configure.ac	Mon Apr  7 21:16:46 2008
@@ -359,7 +359,6 @@
 docs/Makefile
 docs/reference/Makefile
 gedit/dialogs/Makefile
-gedit/plugins/Makefile
 gedit/Makefile
 help/Makefile
 help/eu/Makefile

Modified: branches/jessevdk-plugins/gedit/Makefile.am
==============================================================================
--- branches/jessevdk-plugins/gedit/Makefile.am	(original)
+++ branches/jessevdk-plugins/gedit/Makefile.am	Mon Apr  7 21:16:46 2008
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-SUBDIRS = dialogs plugins
+SUBDIRS = dialogs
 
 bin_PROGRAMS = gedit
 
@@ -33,12 +33,11 @@
 gedit_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
 
 
-libgedit_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
+libgedit_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*" 
 
 libgedit_la_LIBADD =			\
 	$(GEDIT_LIBS)			\
-	dialogs/libdialogs.la		\
-	plugins/libplugins.la
+	dialogs/libdialogs.la
 
 if ENABLE_PYTHON
 libgedit_la_LIBADD += \
@@ -55,6 +54,9 @@
 	gedit-commands.h		\
 	gedit-language-manager.h	\
 	gedit-style-scheme-manager.h	\
+	gedit-plugin-info-priv.h	\
+	gedit-plugin-manager.h		\
+	gedit-module.h			\
 	gedit-ui.h			\
 	gedit-window-private.h		\
 	gedit-documents-panel.h		\
@@ -74,6 +76,12 @@
 	gedittextregion.h		\
 	gedit-session.h
 
+if ENABLE_PYTHON
+NOINST_H_FILES += \
+	gedit-python-module.h		\
+	gedit-python-plugin.h
+endif
+
 INST_H_FILES =				\
 	gedit-app.h			\
 	gedit-convert.h			\
@@ -87,6 +95,9 @@
 	gedit-metadata-manager.h	\
 	gedit-notebook.h		\
 	gedit-panel.h			\
+	gedit-plugin.h			\
+	gedit-plugin-info.h		\
+	gedit-plugins-engine.h		\
 	gedit-prefs-manager-app.h	\
 	gedit-prefs-manager.h		\
 	gedit-progress-message-area.h	\
@@ -96,6 +107,11 @@
 	gedit-view.h 			\
 	gedit-window.h
 
+if ENABLE_PYTHON
+INST_H_FILES += \
+	gedit-plugin-python-utils.h
+endif
+
 headerdir = $(prefix)/include/gedit- GEDIT_API_VERSION@/gedit
 
 header_DATA = 				\
@@ -131,8 +147,14 @@
 	gedit-language-manager.c	\
 	gedit-message-area.c		\
 	gedit-metadata-manager.c	\
+	gedit-module.c			\
 	gedit-notebook.c		\
 	gedit-panel.c			\
+	gedit-plugin-info.c		\
+	gedit-plugin.c			\
+	gedit-plugin-manager.c		\
+	gedit-plugins-engine.c		\
+	gedit-plugin-python-utils.c	\
 	gedit-prefs-manager-app.c	\
 	gedit-prefs-manager.c		\
 	gedit-prefs-manager-private.h	\
@@ -152,6 +174,15 @@
 	$(NOINST_H_FILES)		\
 	$(INST_H_FILES)
 
+
+if ENABLE_PYTHON
+libgedit_la_SOURCES += \
+	gedit-python-module.c		\
+	gedit-python-module.h		\
+	gedit-python-plugin.c		\
+	gedit-python-plugin.h	
+endif
+
 gedit-enum-types.h: gedit-enum-types.h.template $(INST_H_FILES) $(GLIB_MKENUMS)
 	(cd $(srcdir) && $(GLIB_MKENUMS) --template gedit-enum-types.h.template $(INST_H_FILES)) > $@
 	
@@ -179,7 +210,7 @@
 	gedit-enum-types.c.template	\
 	gedit-marshal.list
 
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = $(BUILT_SOURCES)	
 
 dist-hook:
 	cd $(distdir); rm -f $(BUILT_SOURCES)

Modified: branches/jessevdk-plugins/gedit/dialogs/gedit-preferences-dialog.c
==============================================================================
--- branches/jessevdk-plugins/gedit/dialogs/gedit-preferences-dialog.c	(original)
+++ branches/jessevdk-plugins/gedit/dialogs/gedit-preferences-dialog.c	Mon Apr  7 21:16:46 2008
@@ -46,7 +46,7 @@
 #include "gedit-debug.h"
 #include "gedit-document.h"
 #include "gedit-style-scheme-manager.h"
-#include "plugins/gedit-plugin-manager.h"
+#include "gedit-plugin-manager.h"
 #include "gedit-help.h"
 
 /*

Copied: branches/jessevdk-plugins/gedit/gedit-plugin-info.h (from r6237, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-info.h)
==============================================================================
--- /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-info.h	(original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-info.h	Mon Apr  7 21:16:46 2008
@@ -33,7 +33,7 @@
 #define __GEDIT_PLUGIN_INFO_H__
 
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Copied: branches/jessevdk-plugins/gedit/gedit-plugin-python-utils.c (from r6246, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-python-utils.c)
==============================================================================
--- /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-python-utils.c	(original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-python-utils.c	Mon Apr  7 21:16:46 2008
@@ -27,15 +27,16 @@
 #include "gedit-python-module.h"
 
 #define TYPE_PREFIX "Gedit"
+#define TYPE_SUFFIX "Plugin"
 
 PyObject *gedit_plugin_python_utils_init(GeditPlugin 			 *plugin,
 					 GeditPluginPythonUtilsClasses 	  classreg,
-					 const PyMethodDef 		 *functions,
+					 PyMethodDef	 		 *functions,
 					 GeditPluginPythonUtilsConstants  constreg,
 					 const gchar 			 *prefix)
 {
 	PyObject *plugins, *mdict, *module;
-	const gchar *name;
+	gchar *name, *ptr;
 	gchar *mname;
 	GeditPluginInfo *info;
 
@@ -66,15 +67,24 @@
 		return NULL;
 	}
 	
-	name = g_type_name (G_OBJECT_TYPE (plugin));
+	ptr = name = g_strdup (G_OBJECT_TYPE_NAME (plugin));
+
+	if (g_str_has_prefix (ptr, TYPE_PREFIX))
+		ptr = ptr + strlen(TYPE_PREFIX);
 	
-	if (g_str_has_prefix (name, TYPE_PREFIX))
-		name = name + strlen(TYPE_PREFIX);
+	if (g_str_has_suffix (ptr, TYPE_SUFFIX))
+		ptr[strlen(ptr) - strlen(TYPE_SUFFIX)] = 0;
 	
-	mname = g_strdup_printf ("gedit.plugins.%s", name);
+	mname = g_strconcat ("gedit.plugins.", ptr, NULL);
+
 	module = Py_InitModule (mname, functions);
 	g_free (mname);
 	
+	/* Set module name in gedit.plugins dict */
+	PyDict_SetItemString (mdict, ptr, module);
+	g_free (name);
+	
+	/* Register classes and const values in the dict of the module */
 	mdict = PyModule_GetDict (module);
 	
 	if (classreg)
@@ -82,6 +92,6 @@
 	
 	if (constreg)
 		constreg (module, prefix);
-	
+
 	return module;
 }

Copied: branches/jessevdk-plugins/gedit/gedit-plugin-python-utils.h (from r6246, /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-python-utils.h)
==============================================================================
--- /branches/jessevdk-plugins/gedit/plugins/gedit-plugin-python-utils.h	(original)
+++ branches/jessevdk-plugins/gedit/gedit-plugin-python-utils.h	Mon Apr  7 21:16:46 2008
@@ -23,7 +23,7 @@
 #ifndef __GEDIT_PLUGIN_PYTHON_UTILS_H__
 #define __GEDIT_PLUGIN_PYTHON_UTILS_H__
 
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 #include <pygobject.h>
 
 /* Utility functions which C plugins can use to register python bindings */
@@ -32,7 +32,7 @@
 
 PyObject *gedit_plugin_python_utils_init (GeditPlugin				*plugin,
 					  GeditPluginPythonUtilsClasses		 classreg,
-					  const PyMethodDef			*functions,
+					  PyMethodDef				*functions,
 					  GeditPluginPythonUtilsConstants	 constreg,
 					  const gchar				*prefix);
 				     

Copied: branches/jessevdk-plugins/gedit/gedit-plugins-engine.h (from r6243, /branches/jessevdk-plugins/gedit/plugins/gedit-plugins-engine.h)
==============================================================================
--- /branches/jessevdk-plugins/gedit/plugins/gedit-plugins-engine.h	(original)
+++ branches/jessevdk-plugins/gedit/gedit-plugins-engine.h	Mon Apr  7 21:16:46 2008
@@ -33,8 +33,8 @@
 
 #include <glib.h>
 #include <gedit/gedit-window.h>
-#include <gedit/plugins/gedit-plugin-info.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin-info.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/gedit/gedit-session.c
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit-session.c	(original)
+++ branches/jessevdk-plugins/gedit/gedit-session.c	Mon Apr  7 21:16:46 2008
@@ -47,7 +47,7 @@
 #include "gedit-session.h"
 
 #include "gedit-debug.h"
-#include "plugins/gedit-plugins-engine.h"
+#include "gedit-plugins-engine.h"
 #include "gedit-prefs-manager-app.h"
 #include "gedit-metadata-manager.h"
 #include "gedit-window.h"

Modified: branches/jessevdk-plugins/gedit/gedit-window.c
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit-window.c	(original)
+++ branches/jessevdk-plugins/gedit/gedit-window.c	Mon Apr  7 21:16:46 2008
@@ -52,7 +52,7 @@
 #include "gedit-prefs-manager-app.h"
 #include "gedit-panel.h"
 #include "gedit-documents-panel.h"
-#include "plugins/gedit-plugins-engine.h"
+#include "gedit-plugins-engine.h"
 #include "gedit-enum-types.h"
 
 #define LANGUAGE_NONE (const gchar *)"LangNone"

Modified: branches/jessevdk-plugins/gedit/gedit.c
==============================================================================
--- branches/jessevdk-plugins/gedit/gedit.c	(original)
+++ branches/jessevdk-plugins/gedit/gedit.c	Mon Apr  7 21:16:46 2008
@@ -47,7 +47,7 @@
 #include "gedit-debug.h"
 #include "gedit-encodings.h"
 #include "gedit-metadata-manager.h"
-#include "plugins/gedit-plugins-engine.h"
+#include "gedit-plugins-engine.h"
 #include "gedit-prefs-manager-app.h"
 #include "gedit-session.h"
 #include "gedit-utils.h"

Modified: branches/jessevdk-plugins/plugins/changecase/gedit-changecase-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/changecase/gedit-changecase-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/changecase/gedit-changecase-plugin.h	Mon Apr  7 21:16:46 2008
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/docinfo/gedit-docinfo-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/docinfo/gedit-docinfo-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/docinfo/gedit-docinfo-plugin.h	Mon Apr  7 21:16:46 2008
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/filebrowser/Makefile.am
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/Makefile.am	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/Makefile.am	Mon Apr  7 21:16:46 2008
@@ -16,6 +16,14 @@
 	-DGEDIT_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" 	\
 	-DGEDIT_FILE_BROWSER_DIR=\""$(filebrowserdir)/"\"
 
+if ENABLE_PYTHON
+INCLUDES += 				\
+	$(NO_STRICT_ALIASING_CFLAGS)	\
+	$(PYGTK_CFLAGS)			\
+	$(PYTHON_CFLAGS)		\
+	$(AM_CFLAGS)
+endif
+
 BUILT_SOURCES = \
 	gedit-file-browser-enum-types.h		\
 	gedit-file-browser-enum-types.c		\
@@ -46,6 +54,10 @@
 libfilebrowser_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
 libfilebrowser_la_LIBADD = $(GEDIT_LIBS)
 
+if ENABLE_PYTHON
+libfilebrowser_la_LIBADD += $(top_builddir)/plugins/filebrowser/bindings/filebrowser.la
+endif
+
 # Glade files (if you use glade for your plugin, list those files here)
 gladedir = $(datadir)/gedit-2/glade
 glade_DATA =

Added: branches/jessevdk-plugins/plugins/filebrowser/bindings/Makefile.am
==============================================================================
--- (empty file)
+++ branches/jessevdk-plugins/plugins/filebrowser/bindings/Makefile.am	Mon Apr  7 21:16:46 2008
@@ -0,0 +1,64 @@
+noinst_LTLIBRARIES = \
+	filebrowser.la
+
+nodist_filebrowser_la_SOURCES = \
+	filebrowser.c
+
+filebrowser_la_LDFLAGS = \
+	-module -avoid-version
+
+filebrowser_la_LIBADD = \
+	$(PYTHON_LIB_LOC)       \
+	$(PYTHON_LIBS)		\
+	$(PYTHON_EXTRA_LIBS)	\
+	$(PYGTK_LIBS)
+
+filebrowser_la_CFLAGS = \
+	-I$(top_srcdir)			\
+	-I$(top_builddir)		\
+	-I$(top_srcdir)/gedit		\
+	-I$(top_builddir)/gedit		\
+	$(GEDIT_CFLAGS)			\
+	$(NO_STRICT_ALIASING_CFLAGS)	\
+	$(PYGTK_CFLAGS)			\
+	$(PYTHON_CFLAGS)		\
+	$(AM_CFLAGS)
+
+$(builddir)/../gedit-file-browser-enum-types.h:
+	cd $(builddir)/../ && $(MAKE) gedit-file-browser-enum-types.h
+
+filebrowser.c: filebrowser.defs filebrowser.override $(builddir)/../gedit-file-browser-enum-types.h
+	( cd $(srcdir) && $(PYGTK_CODEGEN) \
+		--override $*.override \
+		--register $(top_builddir)/bindings/python/gedit.defs \
+		--register $(PYGTK_DEFSDIR)/gtk-types.defs \
+		--register $(PYGTK_DEFSDIR)/gtk-base.defs \
+		--prefix py$* $(<F) ) > $@ 
+
+BINDING_HEADERS_BUILDDIR_IN = 
+
+BINDING_HEADERS_SRCDIR_IN = \
+	plugins/filebrowser/gedit-file-browser-error.h \
+	plugins/filebrowser/gedit-file-bookmarks-store.h \
+	plugins/filebrowser/gedit-file-browser-store.h \
+	plugins/filebrowser/gedit-file-browser-view.h \
+	plugins/filebrowser/gedit-file-browser-widget.h \
+	plugins/filebrowser/gedit-file-browser-plugin.h
+
+BINDING_HEADERS_SRCDIR := $(addprefix $(top_srcdir)/,$(BINDING_HEADERS_SRCDIR_IN))
+BINDING_HEADERS_BUILDDIR := $(addprefix $(top_builddir)/,$(BINDING_HEADERS_BUILDDIR_IN))
+
+regenerate-python-binding:
+	$(PYGTK_H2DEF) $(sort $(BINDING_HEADERS_SRCDIR) $(BINDING_HEADERS_BUILDDIR)) > filebrowser.defs.new
+	
+BUILT_SOURCES = \
+	filebrowser.c
+
+EXTRA_DIST = \
+	filebrowser.override		\
+	filebrowser.defs
+
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+	cd $(distdir); rm -f $(BUILT_SOURCES)

Added: branches/jessevdk-plugins/plugins/filebrowser/bindings/filebrowser.defs
==============================================================================
--- (empty file)
+++ branches/jessevdk-plugins/plugins/filebrowser/bindings/filebrowser.defs	Mon Apr  7 21:16:46 2008
@@ -0,0 +1,568 @@
+;; -*- scheme -*-
+; object definitions ...
+(define-object BookmarksStore
+  (in-module "Gedit")
+  (parent "GtkTreeStore")
+  (c-name "GeditFileBookmarksStore")
+  (gtype-id "GEDIT_TYPE_FILE_BOOKMARKS_STORE")
+)
+
+(define-object Plugin
+  (in-module "Gedit")
+  (parent "GeditPlugin")
+  (c-name "GeditFileBrowserPlugin")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_PLUGIN")
+)
+
+(define-object Store
+  (in-module "Gedit")
+  (parent "GObject")
+  (c-name "GeditFileBrowserStore")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_STORE")
+)
+
+(define-object View
+  (in-module "Gedit")
+  (parent "GtkTreeView")
+  (c-name "GeditFileBrowserView")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_VIEW")
+)
+
+(define-object Widget
+  (in-module "Gedit")
+  (parent "GtkVBox")
+  (c-name "GeditFileBrowserWidget")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_WIDGET")
+)
+
+;; Enumerations and flags ...
+
+(define-enum Error
+  (in-module "Gedit")
+  (c-name "GeditFileBrowserError")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_ERROR")
+  (values
+    '("none" "GEDIT_FILE_BROWSER_ERROR_NONE")
+    '("rename" "GEDIT_FILE_BROWSER_ERROR_RENAME")
+    '("delete" "GEDIT_FILE_BROWSER_ERROR_DELETE")
+    '("new-file" "GEDIT_FILE_BROWSER_ERROR_NEW_FILE")
+    '("new-directory" "GEDIT_FILE_BROWSER_ERROR_NEW_DIRECTORY")
+    '("open-directory" "GEDIT_FILE_BROWSER_ERROR_OPEN_DIRECTORY")
+    '("set-root" "GEDIT_FILE_BROWSER_ERROR_SET_ROOT")
+    '("load-directory" "GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY")
+    '("num" "GEDIT_FILE_BROWSER_ERROR_NUM")
+  )
+)
+
+(define-enum StoreColumn
+  (in-module "Gedit")
+  (c-name "GeditFileBrowserStoreColumn")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_STORE_COLUMN")
+  (values
+    '("icon" "GEDIT_FILE_BROWSER_STORE_COLUMN_ICON")
+    '("name" "GEDIT_FILE_BROWSER_STORE_COLUMN_NAME")
+    '("uri" "GEDIT_FILE_BROWSER_STORE_COLUMN_URI")
+    '("flags" "GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS")
+    '("emblem" "GEDIT_FILE_BROWSER_STORE_COLUMN_EMBLEM")
+    '("num" "GEDIT_FILE_BROWSER_STORE_COLUMN_NUM")
+  )
+)
+
+(define-flags StoreFlag
+  (in-module "Gedit")
+  (c-name "GeditFileBrowserStoreFlag")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_STORE_FLAG")
+  (values
+    '("is-directory" "GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY")
+    '("is-hidden" "GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN")
+    '("is-text" "GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT")
+    '("loaded" "GEDIT_FILE_BROWSER_STORE_FLAG_LOADED")
+    '("is-filtered" "GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED")
+    '("is-dummy" "GEDIT_FILE_BROWSER_STORE_FLAG_IS_DUMMY")
+  )
+)
+
+(define-enum StoreResult
+  (in-module "Gedit")
+  (c-name "GeditFileBrowserStoreResult")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_STORE_RESULT")
+  (values
+    '("ok" "GEDIT_FILE_BROWSER_STORE_RESULT_OK")
+    '("no-change" "GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE")
+    '("error" "GEDIT_FILE_BROWSER_STORE_RESULT_ERROR")
+    '("no-trash" "GEDIT_FILE_BROWSER_STORE_RESULT_NO_TRASH")
+    '("num" "GEDIT_FILE_BROWSER_STORE_RESULT_NUM")
+  )
+)
+
+(define-flags StoreFilterMode
+  (in-module "Gedit")
+  (c-name "GeditFileBrowserStoreFilterMode")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_STORE_FILTER_MODE")
+  (values
+    '("none" "GEDIT_FILE_BROWSER_STORE_FILTER_MODE_NONE")
+    '("hide-hidden" "GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN")
+    '("hide-binary" "GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY")
+  )
+)
+
+(define-enum ViewClickPolicy
+  (in-module "Gedit")
+  (c-name "GeditFileBrowserViewClickPolicy")
+  (gtype-id "GEDIT_TYPE_FILE_BROWSER_VIEW_CLICK_POLICY")
+  (values
+    '("double" "GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE")
+    '("single" "GEDIT_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE")
+  )
+)
+
+
+;; From gedit-file-bookmarks-store.h
+
+(define-function gedit_file_bookmarks_store_get_type
+  (c-name "gedit_file_bookmarks_store_get_type")
+  (return-type "GType")
+)
+
+(define-function gedit_file_bookmarks_store_register_type
+  (c-name "gedit_file_bookmarks_store_register_type")
+  (return-type "GType")
+  (parameters
+    '("GTypeModule*" "module")
+  )
+)
+
+(define-function gedit_file_bookmarks_store_new
+  (c-name "gedit_file_bookmarks_store_new")
+  (is-constructor-of "GeditFileBookmarksStore")
+  (return-type "GeditFileBookmarksStore*")
+)
+
+(define-method get_uri
+  (of-object "GeditFileBookmarksStore")
+  (c-name "gedit_file_bookmarks_store_get_uri")
+  (return-type "gchar*")
+  (parameters
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method refresh
+  (of-object "GeditFileBookmarksStore")
+  (c-name "gedit_file_bookmarks_store_refresh")
+  (return-type "none")
+)
+
+
+
+;; From gedit-file-browser-error.h
+
+
+
+;; From gedit-file-browser-plugin.h
+
+(define-function gedit_file_browser_plugin_get_type
+  (c-name "gedit_file_browser_plugin_get_type")
+  (return-type "GType")
+)
+
+(define-method get_widget
+  (of-object "GeditFileBrowserPlugin")
+  (c-name "gedit_file_browser_plugin_get_widget")
+  (return-type "GeditFileBrowserWidget*")
+  (parameters
+    '("GeditWindow*" "window")
+  )
+)
+
+;; From gedit-file-browser-store.h
+
+(define-function gedit_file_browser_store_get_type
+  (c-name "gedit_file_browser_store_get_type")
+  (return-type "GType")
+)
+
+(define-function gedit_file_browser_store_register_type
+  (c-name "gedit_file_browser_store_register_type")
+  (return-type "GType")
+  (parameters
+    '("GTypeModule*" "module")
+  )
+)
+
+(define-function gedit_file_browser_store_new
+  (c-name "gedit_file_browser_store_new")
+  (is-constructor-of "GeditFileBrowserStore")
+  (return-type "GeditFileBrowserStore*")
+  (properties
+    '("root" (argname "str") (optional))
+  )
+)
+
+(define-method set_root_and_virtual_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_root_and_virtual_root")
+  (return-type "GeditFileBrowserStoreResult")
+  (parameters
+    '("gchar-const*" "root")
+    '("gchar-const*" "virtual_root")
+  )
+)
+
+(define-method set_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_root")
+  (return-type "GeditFileBrowserStoreResult")
+  (parameters
+    '("gchar-const*" "root")
+  )
+)
+
+(define-method set_virtual_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_virtual_root")
+  (return-type "GeditFileBrowserStoreResult")
+  (parameters
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method set_virtual_root_from_string
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_virtual_root_from_string")
+  (return-type "GeditFileBrowserStoreResult")
+  (parameters
+    '("gchar-const*" "root")
+  )
+)
+
+(define-method set_virtual_root_up
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_virtual_root_up")
+  (return-type "GeditFileBrowserStoreResult")
+)
+
+(define-method set_virtual_root_top
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_virtual_root_top")
+  (return-type "GeditFileBrowserStoreResult")
+)
+
+(define-method get_iter_virtual_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_get_iter_virtual_root")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method get_iter_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_get_iter_root")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method get_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_get_root")
+  (return-type "gchar*")
+)
+
+(define-method get_virtual_root
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_get_virtual_root")
+  (return-type "gchar*")
+)
+
+(define-method iter_equal
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_iter_equal")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "iter1")
+    '("GtkTreeIter*" "iter2")
+  )
+)
+
+(define-method set_value
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_value")
+  (return-type "none")
+  (parameters
+    '("GtkTreeIter*" "iter")
+    '("gint" "column")
+    '("GValue*" "value")
+  )
+)
+
+(define-method get_filter_mode
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_get_filter_mode")
+  (return-type "GeditFileBrowserStoreFilterMode")
+)
+
+(define-method set_filter_mode
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_filter_mode")
+  (return-type "none")
+  (parameters
+    '("GeditFileBrowserStoreFilterMode" "mode")
+  )
+)
+
+(define-method set_filter_func
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_set_filter_func")
+  (return-type "none")
+  (parameters
+    '("GeditFileBrowserStoreFilterFunc" "func")
+    '("gpointer" "user_data")
+    '("GDestroyNotify" "destroy_func")
+  )
+)
+
+(define-method refilter
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_refilter")
+  (return-type "none")
+)
+
+(define-function gedit_file_browser_store_filter_mode_get_default
+  (c-name "gedit_file_browser_store_filter_mode_get_default")
+  (return-type "GeditFileBrowserStoreFilterMode")
+)
+
+(define-method refresh
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_refresh")
+  (return-type "none")
+)
+
+(define-method rename
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_rename")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "iter")
+    '("gchar-const*" "new_name")
+    '("GError**" "error")
+  )
+)
+
+(define-method delete
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_delete")
+  (return-type "GeditFileBrowserStoreResult")
+  (parameters
+    '("GtkTreeIter*" "iter")
+    '("gboolean" "trash")
+  )
+)
+
+(define-method delete_all
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_delete_all")
+  (return-type "GeditFileBrowserStoreResult")
+  (parameters
+    '("GList*" "rows")
+    '("gboolean" "trash")
+  )
+)
+
+(define-method new_file
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_new_file")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "parent")
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method new_directory
+  (of-object "GeditFileBrowserStore")
+  (c-name "gedit_file_browser_store_new_directory")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "parent")
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+
+
+;; From gedit-file-browser-view.h
+
+(define-function gedit_file_browser_view_get_type
+  (c-name "gedit_file_browser_view_get_type")
+  (return-type "GType")
+)
+
+(define-function gedit_file_browser_view_register_type
+  (c-name "gedit_file_browser_view_register_type")
+  (return-type "GType")
+  (parameters
+    '("GTypeModule*" "module")
+  )
+)
+
+(define-function gedit_file_browser_view_new
+  (c-name "gedit_file_browser_view_new")
+  (is-constructor-of "GeditFileBrowserView")
+  (return-type "GtkWidget*")
+)
+
+(define-method set_model
+  (of-object "GeditFileBrowserView")
+  (c-name "gedit_file_browser_view_set_model")
+  (return-type "none")
+  (parameters
+    '("GtkTreeModel*" "model")
+  )
+)
+
+(define-method start_rename
+  (of-object "GeditFileBrowserView")
+  (c-name "gedit_file_browser_view_start_rename")
+  (return-type "none")
+  (parameters
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method set_click_policy
+  (of-object "GeditFileBrowserView")
+  (c-name "gedit_file_browser_view_set_click_policy")
+  (return-type "none")
+  (parameters
+    '("GeditFileBrowserViewClickPolicy" "policy")
+  )
+)
+
+
+
+;; From gedit-file-browser-widget.h
+
+(define-function gedit_file_browser_widget_get_type
+  (c-name "gedit_file_browser_widget_get_type")
+  (return-type "GType")
+)
+
+(define-function gedit_file_browser_widget_register_type
+  (c-name "gedit_file_browser_widget_register_type")
+  (return-type "GType")
+  (parameters
+    '("GTypeModule*" "module")
+  )
+)
+
+(define-function gedit_file_browser_widget_new
+  (c-name "gedit_file_browser_widget_new")
+  (is-constructor-of "GeditFileBrowserWidget")
+  (return-type "GtkWidget*")
+)
+
+(define-method show_bookmarks
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_show_bookmarks")
+  (return-type "none")
+)
+
+(define-method set_root
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_set_root")
+  (return-type "none")
+  (parameters
+    '("gchar-const*" "root")
+    '("gboolean" "virtual_root")
+  )
+)
+
+(define-method set_root_and_virtual_root
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_set_root_and_virtual_root")
+  (return-type "none")
+  (parameters
+    '("gchar-const*" "root")
+    '("gchar-const*" "virtual_root")
+  )
+)
+
+(define-method get_selected_directory
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_selected_directory")
+  (return-type "gboolean")
+  (parameters
+    '("GtkTreeIter*" "iter")
+  )
+)
+
+(define-method get_num_selected_files_or_directories
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_num_selected_files_or_directories")
+  (return-type "guint")
+)
+
+(define-method get_browser_store
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_browser_store")
+  (return-type "GeditFileBrowserStore*")
+)
+
+(define-method get_bookmarks_store
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_bookmarks_store")
+  (return-type "GeditFileBookmarksStore*")
+)
+
+(define-method get_browser_view
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_browser_view")
+  (return-type "GeditFileBrowserView*")
+)
+
+(define-method get_filter_entry
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_filter_entry")
+  (return-type "GtkWidget*")
+)
+
+(define-method get_ui_manager
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_get_ui_manager")
+  (return-type "GtkUIManager*")
+)
+
+(define-method add_filter
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_add_filter")
+  (return-type "gulong")
+  (parameters
+    '("GeditFileBrowserWidgetFilterFunc" "func")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method remove_filter
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_remove_filter")
+  (return-type "none")
+  (parameters
+    '("gulong" "id")
+  )
+)
+
+(define-method set_filter_pattern
+  (of-object "GeditFileBrowserWidget")
+  (c-name "gedit_file_browser_widget_set_filter_pattern")
+  (return-type "none")
+  (parameters
+    '("gchar-const*" "pattern")
+  )
+)
+
+

Added: branches/jessevdk-plugins/plugins/filebrowser/bindings/filebrowser.override
==============================================================================
--- (empty file)
+++ branches/jessevdk-plugins/plugins/filebrowser/bindings/filebrowser.override	Mon Apr  7 21:16:46 2008
@@ -0,0 +1,351 @@
+%%
+headers
+#define NO_IMPORT_PYGOBJECT
+#include "pygobject.h"
+#include <pygtk/pygtk.h>
+
+#include "gedit-plugin.h"
+#include "gedit-window.h"
+#include "../gedit-file-browser-enum-types.h"
+#include "../gedit-file-browser-error.h"
+#include "../gedit-file-bookmarks-store.h"
+#include "../gedit-file-browser-store.h"
+#include "../gedit-file-browser-view.h"
+#include "../gedit-file-browser-widget.h"
+#include "../gedit-file-browser-plugin.h"
+
+typedef struct {
+	PyObject *func;
+	PyObject *data;
+} CustomNotify;
+
+static void
+pygedit_custom_destroy_notify (gpointer user_data)
+{
+	CustomNotify *cunote = user_data;
+	PyGILState_STATE state;
+
+	g_return_if_fail(user_data);
+	
+	state = pyg_gil_state_ensure();
+	Py_XDECREF(cunote->func);
+	Py_XDECREF(cunote->data);
+	pyg_gil_state_release(state);
+
+	g_free(cunote);
+}
+
+%%
+modulename gedit.plugins.FileBrowser
+%%
+import gtk.TreeModel as PyGtkTreeModel_Type
+import gtk.TreeStore as PyGtkTreeStore_Type
+import gedit.__Plugin as PyGeditPlugin_Type
+import gedit.Window as PyGeditWindow_Type
+import gobject.GObject as PyGObject_Type
+import gtk.TreeView as PyGtkTreeView_Type
+import gtk.VBox as PyGtkVBox_Type
+%%
+ignore-glob
+  _*
+  *_register_type
+  *_get_type
+%%
+override gedit_file_browser_store_set_value kwargs
+static PyObject *
+_wrap_gedit_file_browser_store_set_value (PyGObject *self, 
+					        PyObject *args,
+					        PyObject *kwargs)
+{
+	static char *kwlist[] = {"iter", "column", "value", NULL};
+	PyObject *iter, *pyvalue;
+	gint column;
+	GValue value = {0};
+
+	if (!PyArg_ParseTupleAndKeywords (args, 
+					  kwargs, 
+					  "OiO:GeditFileBrowserStore.set_value",
+					  kwlist, 
+					  &iter, 
+					  &column, 
+					  &pyvalue))
+		return NULL;
+
+	if (column < 0 || 
+	    column >= gtk_tree_model_get_n_columns (GTK_TREE_MODEL (self->obj))) {
+		PyErr_SetString (PyExc_ValueError, "column number is out of range");
+		return NULL;
+	}
+	
+	if (!pyg_boxed_check (iter, GTK_TYPE_TREE_ITER)) {
+		PyErr_SetString (PyExc_TypeError, "iter must be a GtkTreeIter");
+		return NULL;
+	}
+
+	g_value_init (&value, 
+		      gtk_tree_model_get_column_type (GTK_TREE_MODEL( self->obj),
+		      column));
+		      
+	if (pyg_value_from_pyobject (&value, pyvalue)) {
+		PyErr_SetString (PyExc_TypeError, 
+				 "value is of the wrong type for this column");
+		return NULL;
+	}
+	
+	gedit_file_browser_store_set_value (GEDIT_FILE_BROWSER_STORE (self->obj),
+					    pyg_boxed_get (iter, GtkTreeIter), 
+					    column, 
+					    &value);
+
+	g_value_unset(&value);
+	Py_INCREF(Py_None);
+
+	return Py_None;
+}
+%%
+override gedit_file_browser_store_delete_all kwargs
+static PyObject *
+_wrap_gedit_file_browser_store_delete_all (PyGObject *self, 
+					   PyObject *args,
+					   PyObject *kwargs)
+{
+	static char *kwlist[] = {"rows", "trash"};
+	PyObject *list, *trash;
+	PyObject *item;
+	GtkTreePath *path;
+	GList *clist = NULL;
+	gint len, i;
+	
+	if (!PyArg_ParseTupleAndKeywords (args, 
+					  kwargs, 
+					  "OO:GeditFileBrowserStore.delete_all",
+					  kwlist, 
+					  &list, 
+					  &trash))
+		return NULL;
+
+	/* Convert the python list to a GList of GtkTreePath */
+	if (!PySequence_Check (list)) {
+		PyErr_SetString (PyExc_TypeError, "first argument must be a sequence");
+        	return NULL;
+        }
+        
+	len = PySequence_Length (list);
+	
+	for (i = 0; i < len; i++) {
+		item = PySequence_GetItem(list, i);
+		
+		Py_DECREF(item);
+		
+		path = pygtk_tree_path_from_pyobject (item);
+		
+		if (!path) {
+			PyErr_SetString (PyExc_TypeError,
+					 "sequence item not a valid tree path");
+			g_list_free (clist);
+			return NULL;
+		}
+		
+		clist = g_list_append(clist, path);
+	}
+
+	gedit_file_browser_store_delete_all (GEDIT_FILE_BROWSER_STORE (self->obj),
+					     clist, 
+					     PyObject_IsTrue(trash));
+
+	g_list_foreach (clist, (GFunc)gtk_tree_path_free, NULL);
+	g_list_free(clist);
+	
+	Py_INCREF(Py_None);
+
+	return Py_None;
+}
+%%
+override gedit_file_browser_store_set_filter_func args
+static gboolean
+pygedit_file_browser_store_set_filter_func_cb (GeditFileBrowserStore *store,
+					       GtkTreeIter *iter,
+					       gpointer user_data)
+{
+	PyGILState_STATE state;
+	CustomNotify *cunote = (CustomNotify*)user_data;
+	PyObject *py_store, *py_iter;
+	gboolean ret = FALSE;
+	PyObject *retobj;
+
+	g_assert(cunote->func);
+
+	state = pyg_gil_state_ensure();
+
+	py_store = pygobject_new((GObject *)store);
+	py_iter = pyg_boxed_new(GTK_TYPE_TREE_ITER, iter, TRUE, TRUE);
+
+	if (cunote->data) {
+		retobj = PyEval_CallFunction (cunote->func, 
+					      "(NNO)", 
+					      py_store,
+					      py_iter, 
+					      cunote->data);
+	} else {
+		retobj = PyEval_CallFunction (cunote->func, 
+					      "(NN)", 
+					      py_store,
+					      py_iter);
+	}
+
+	if (retobj != NULL) {
+		ret = PyObject_IsTrue (retobj);
+		Py_DECREF(retobj);
+	} else {
+		PyErr_Print();
+	}
+
+	pyg_gil_state_release(state);
+	return ret;
+}
+
+static PyObject *
+_wrap_gedit_file_browser_store_set_filter_func (PyGObject *self, 
+						PyObject *args)
+{
+	PyObject *pyfunc, *pyarg = NULL;
+	CustomNotify *cunote;
+	gulong id;
+	
+	if (!PyArg_ParseTuple (args,  
+			       "O|O:GeditFileBrowserStore.set_filter_func",
+			       &pyfunc, 
+			       &pyarg))
+		return NULL;
+	
+	if (!PyCallable_Check (pyfunc)) {
+		PyErr_SetString(PyExc_TypeError, "func must be a callable object");
+		return NULL;
+	}
+	
+	cunote = g_new0(CustomNotify, 1);
+	cunote->func = pyfunc;
+	cunote->data = pyarg;
+	
+	Py_INCREF(cunote->func);
+	Py_XINCREF(cunote->data);
+
+	gedit_file_browser_store_set_filter_func (GEDIT_FILE_BROWSER_STORE (self->obj),
+						  pygedit_file_browser_store_set_filter_func_cb,
+						  cunote, 
+						  pygedit_custom_destroy_notify);
+
+	Py_INCREF(Py_None);
+	return Py_None;
+}
+%%
+override gedit_file_browser_widget_add_filter args
+static gboolean
+pygedit_file_browser_widget_add_filter_cb (GeditFileBrowserWidget *widget,
+					   GeditFileBrowserStore *store,
+					   GtkTreeIter *iter,
+					   gpointer user_data)
+{
+	PyGILState_STATE state;
+	CustomNotify *cunote = (CustomNotify*)user_data;
+	PyObject *py_store, *py_widget, *py_iter;
+	gboolean ret = FALSE;
+	PyObject *retobj;
+
+	g_assert(cunote->func);
+
+	state = pyg_gil_state_ensure();
+
+	py_widget = pygobject_new((GObject *)widget);
+	py_store = pygobject_new((GObject *)store);
+	py_iter = pyg_boxed_new(GTK_TYPE_TREE_ITER, iter, TRUE, TRUE);
+
+	if (cunote->data) {
+		retobj = PyEval_CallFunction (cunote->func, 
+					      "(NNNO)", 
+					      py_widget,
+					      py_store,
+					      py_iter, 
+					      cunote->data);
+	} else {
+		retobj = PyEval_CallFunction (cunote->func, 
+					      "(NNN)", 
+					      py_widget,
+					      py_store,
+					      py_iter);
+	}
+
+	if (retobj != NULL) {
+		ret = PyObject_IsTrue (retobj);
+		Py_DECREF(retobj);
+	} else {
+		PyErr_Print();
+	}
+
+	pyg_gil_state_release(state);
+	return ret;
+}
+
+static PyObject *
+_wrap_gedit_file_browser_widget_add_filter (PyGObject *self, 
+					    PyObject *args)
+{
+	PyObject *pyfunc, *pyarg = NULL;
+	CustomNotify *cunote;
+	gulong id;
+	
+	if (!PyArg_ParseTuple (args,  
+			       "O|O:GeditFileBrowserWidget.add_filter",
+			       &pyfunc, 
+			       &pyarg))
+		return NULL;
+	
+	if (!PyCallable_Check (pyfunc)) {
+		PyErr_SetString(PyExc_TypeError, "func must be a callable object");
+		return NULL;
+	}
+	
+	cunote = g_new0(CustomNotify, 1);
+	cunote->func = pyfunc;
+	cunote->data = pyarg;
+	
+	Py_INCREF(cunote->func);
+	Py_XINCREF(cunote->data);
+
+	id = gedit_file_browser_widget_add_filter (GEDIT_FILE_BROWSER_WIDGET (self->obj),
+						   pygedit_file_browser_widget_add_filter_cb,
+						   cunote, 
+						   pygedit_custom_destroy_notify);
+
+	return Py_BuildValue("K", id);
+}
+%%
+override gedit_file_browser_store_new kwargs
+static int
+_wrap_gedit_file_browser_store_new(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+	static char *kwlist[] = {"root", NULL};
+	char *root = NULL;
+
+	if (!PyArg_ParseTupleAndKeywords (args, 
+					  kwargs, 
+					  "|s:GeditFileBrowserStore.__init__", 
+					  kwlist, 
+					  &root))
+		return -1;
+
+	if (root)
+		pygobject_construct (self, "root", root, NULL);
+	else
+		pygobject_construct (self, NULL);
+	
+	if (!self->obj) {
+		PyErr_SetString(PyExc_RuntimeError,
+				"could not create GeditFileBrowserStore object");
+		return -1;
+	}
+	
+	return 0;
+}
+%%
+new-constructor GEDIT_TYPE_FILE_BROWSER_STORE

Modified: branches/jessevdk-plugins/plugins/filebrowser/gedit-file-bookmarks-store.c
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/gedit-file-bookmarks-store.c	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/gedit-file-bookmarks-store.c	Mon Apr  7 21:16:46 2008
@@ -23,7 +23,7 @@
 #include <glib/gi18n.h>
 #include <libgnomevfs/gnome-vfs.h>
 #include <gedit/gedit-utils.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 #include "gedit-file-bookmarks-store.h"
 #include "gedit-file-browser-utils.h"

Modified: branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.c
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.c	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.c	Mon Apr  7 21:16:46 2008
@@ -26,6 +26,7 @@
 
 #include <gedit/gedit-commands.h>
 #include <gedit/gedit-utils.h>
+#include <gedit/gedit-plugin-python-utils.h>
 #include <glib/gi18n-lib.h>
 #include <gedit/gedit-debug.h>
 #include <gconf/gconf-client.h>
@@ -47,6 +48,14 @@
 
 #define GEDIT_FILE_BROWSER_PLUGIN_GET_PRIVATE(object)	(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_FILE_BROWSER_PLUGIN, GeditFileBrowserPluginPrivate))
 
+#ifdef ENABLE_PYTHON
+#include <pygobject.h>
+
+extern PyMethodDef pyfilebrowser_functions[];
+void pyfilebrowser_register_classes(PyObject *d);
+void pyfilebrowser_add_constants(PyObject *module, const gchar *strip_prefix);
+#endif
+
 struct _GeditFileBrowserPluginPrivate 
 {
 	gpointer dummy;
@@ -101,6 +110,8 @@
                                           GtkTreeIter                * iter,
                                           GeditFileBrowserPluginData * data);
 
+static GeditPluginClass *parent_class;
+
 GEDIT_PLUGIN_REGISTER_TYPE_WITH_CODE (GeditFileBrowserPlugin, gedit_file_browser_plugin, 	\
 	gedit_file_browser_enum_and_flag_register_type (module);		\
 	gedit_file_browser_store_register_type         (module);		\
@@ -130,6 +141,18 @@
 	return (GeditFileBrowserPluginData *) (g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY));
 }
 
+GeditFileBrowserWidget *
+gedit_file_browser_plugin_get_widget (GeditFileBrowserPlugin 	*plugin,
+				      GeditWindow		*window)
+{
+	GeditFileBrowserPluginData * data = get_plugin_data (window);
+	
+	if (!data)
+		return NULL;
+	
+	return data->tree_widget;
+}
+
 static void
 prepare_auto_root (GeditFileBrowserPluginData *data)
 {
@@ -815,17 +838,43 @@
 	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
 }
 
+#ifdef ENABLE_PYTHON
+static gboolean
+impl_register_binding (GeditPlugin * plugin, const gchar * language)
+{
+	if (g_strcmp0 (language, "python") != 0)
+		return GEDIT_PLUGIN_CLASS (parent_class)->register_binding (plugin, language);
+	
+	/* Register the actual bindings */
+	gedit_plugin_python_utils_init (plugin,
+					pyfilebrowser_register_classes,
+					pyfilebrowser_functions,
+					pyfilebrowser_add_constants,
+					"GEDIT_FILE_BROWSER_");
+
+	/* Chain up to let the plugin set the binding to be registered for
+	   python */
+	GEDIT_PLUGIN_CLASS (parent_class)->register_binding (plugin, language);
+	return TRUE;
+}
+#endif
+
 static void
 gedit_file_browser_plugin_class_init (GeditFileBrowserPluginClass * klass)
 {
 	GObjectClass  *object_class = G_OBJECT_CLASS (klass);
 	GeditPluginClass * plugin_class = GEDIT_PLUGIN_CLASS (klass);
 
+	parent_class = g_type_class_peek_parent (klass);
 	object_class->finalize = gedit_file_browser_plugin_finalize;
 
 	plugin_class->activate = impl_activate;
 	plugin_class->deactivate = impl_deactivate;
 	plugin_class->update_ui = impl_updateui;
+	
+	#ifdef ENABLE_PYTHON
+	plugin_class->register_binding = impl_register_binding;
+	#endif
 
 	g_type_class_add_private (object_class,
 				  sizeof (GeditFileBrowserPluginPrivate));

Modified: branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-plugin.h	Mon Apr  7 21:16:46 2008
@@ -24,7 +24,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
+#include "gedit-file-browser-widget.h"
 
 G_BEGIN_DECLS
 /*
@@ -60,6 +61,11 @@
  */
 GType gedit_file_browser_plugin_get_type              (void) G_GNUC_CONST;
 
+/* Utility functions */
+GeditFileBrowserWidget * gedit_file_browser_plugin_get_widget (
+						GeditFileBrowserPlugin 	*plugin,
+						GeditWindow		*window);
+
 /* All the plugins must implement this function */
 G_MODULE_EXPORT GType register_gedit_plugin (GTypeModule * module);
 

Modified: branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-store.c
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-store.c	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-store.c	Mon Apr  7 21:16:46 2008
@@ -25,8 +25,8 @@
 
 #include <string.h>
 #include <glib/gi18n-lib.h>
-#include <gedit/plugins/gedit-plugin.h>
 #include <gedit/gedit-utils.h>
+#include <gedit/gedit-plugin.h>
 
 #include "gedit-file-browser-store.h"
 #include "gedit-file-browser-marshal.h"

Modified: branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-view.c
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-view.c	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-view.c	Mon Apr  7 21:16:46 2008
@@ -20,8 +20,8 @@
  */
 
 #include <string.h>
-#include <gedit/plugins/gedit-plugin.h>
 #include <gdk/gdkkeysyms.h>
+#include <gedit/gedit-plugin.h>
 
 #include "gedit-file-browser-store.h"
 #include "gedit-file-bookmarks-store.h"

Modified: branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-widget.c
==============================================================================
--- branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-widget.c	(original)
+++ branches/jessevdk-plugins/plugins/filebrowser/gedit-file-browser-widget.c	Mon Apr  7 21:16:46 2008
@@ -31,7 +31,7 @@
 #include <libgnomevfs/gnome-vfs.h>
 #include <libgnomeui/libgnomeui.h>
 #include <gedit/gedit-utils.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 #include "gedit-file-browser-utils.h"
 #include "gedit-file-browser-error.h"

Modified: branches/jessevdk-plugins/plugins/indent/gedit-indent-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/indent/gedit-indent-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/indent/gedit-indent-plugin.h	Mon Apr  7 21:16:46 2008
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/modelines/gedit-modeline-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/modelines/gedit-modeline-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/modelines/gedit-modeline-plugin.h	Mon Apr  7 21:16:46 2008
@@ -24,7 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/sample/gedit-sample-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/sample/gedit-sample-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/sample/gedit-sample-plugin.h	Mon Apr  7 21:16:46 2008
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/sort/gedit-sort-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/sort/gedit-sort-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/sort/gedit-sort-plugin.h	Mon Apr  7 21:16:46 2008
@@ -23,7 +23,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/spell/gedit-spell-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/spell/gedit-spell-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/spell/gedit-spell-plugin.h	Mon Apr  7 21:16:46 2008
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin-panel.c
==============================================================================
--- branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin-panel.c	(original)
+++ branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin-panel.c	Mon Apr  7 21:16:46 2008
@@ -39,7 +39,7 @@
 
 #include <gedit/gedit-utils.h>
 #include <gedit/gedit-debug.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>

Modified: branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.c
==============================================================================
--- branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.c	(original)
+++ branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.c	Mon Apr  7 21:16:46 2008
@@ -38,7 +38,6 @@
 #include <glib/gi18n-lib.h>
 #include <gmodule.h>
 
-#include <gedit/plugins/gedit-plugin.h>
 #include <gedit/gedit-debug.h>
 
 #define WINDOW_DATA_KEY "GeditTaglistPluginWindowData"

Modified: branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/taglist/gedit-taglist-plugin.h	Mon Apr  7 21:16:46 2008
@@ -32,7 +32,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 

Modified: branches/jessevdk-plugins/plugins/time/gedit-time-plugin.h
==============================================================================
--- branches/jessevdk-plugins/plugins/time/gedit-time-plugin.h	(original)
+++ branches/jessevdk-plugins/plugins/time/gedit-time-plugin.h	Mon Apr  7 21:16:46 2008
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gedit/plugins/gedit-plugin.h>
+#include <gedit/gedit-plugin.h>
 
 G_BEGIN_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]