[gedit] Add a sample python plugin.



commit 2786eba0d2a333b9e4d5675be410b4c42d48addd
Author: Steve Frécinaux <code istique net>
Date:   Sun Jun 13 21:52:35 2010 +0200

    Add a sample python plugin.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=606363

 configure.ac                              |    3 +++
 plugins/Makefile.am                       |    3 +++
 plugins/pysample/Makefile.am              |   15 +++++++++++++++
 plugins/pysample/pysample.gedit-plugin.in |    9 +++++++++
 plugins/pysample/pysample.py              |   15 +++++++++++++++
 5 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0b117ff..8fe0f25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,6 +372,8 @@ AC_SUBST(GEDIT_IMPLIB)
 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
 AC_SUBST(LOADER_LIBTOOL_FLAGS)
 
+AM_PATH_PYTHON(2.6)
+
 GEDIT_PLUGINS_DATA_DIR="$datadir/gedit-2/plugins"
 AC_SUBST(GEDIT_PLUGINS_DATA_DIR)
 
@@ -403,6 +405,7 @@ plugins/docinfo/Makefile
 plugins/filebrowser/org.gnome.gedit.file-browser.gschema.xml.in
 plugins/filebrowser/Makefile
 plugins/modelines/Makefile
+plugins/pysample/Makefile
 plugins/sort/Makefile
 plugins/spell/Makefile
 plugins/taglist/Makefile
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index ad444fe..6fbac4b 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -41,4 +41,7 @@ SUBDIRS = \
 #SUBDIRS      += checkupdate
 #endif
 
+DIST_SUBDIRS += pysample
+SUBDIRS += pysample
+
 -include $(top_srcdir)/git.mk
diff --git a/plugins/pysample/Makefile.am b/plugins/pysample/Makefile.am
new file mode 100644
index 0000000..a820c19
--- /dev/null
+++ b/plugins/pysample/Makefile.am
@@ -0,0 +1,15 @@
+# Quick Open Plugin
+plugindir = $(GEDIT_PLUGINS_LIBS_DIR)
+plugin_PYTHON =	pysample.py
+
+plugin_in_files = pysample.gedit-plugin.in
+%.gedit-plugin: %.gedit-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.gedit-plugin.in=.gedit-plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/pysample/pysample.gedit-plugin.in b/plugins/pysample/pysample.gedit-plugin.in
new file mode 100644
index 0000000..2005144
--- /dev/null
+++ b/plugins/pysample/pysample.gedit-plugin.in
@@ -0,0 +1,9 @@
+[Gedit Plugin]
+Loader=python
+Module=pysample
+IAge=3
+_Name=Python Sample
+_Description=Some Python Test
+Authors=Steve Frécinaux <code istique net>
+Copyright=Copyright © 2010 Steve Frécinaux
+Website=http://www.gedit.org
diff --git a/plugins/pysample/pysample.py b/plugins/pysample/pysample.py
new file mode 100644
index 0000000..4f14927
--- /dev/null
+++ b/plugins/pysample/pysample.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*- ex:set ts=4 et:
+
+from gi.repository import GObject, Peas
+
+class PySampleExtension(GObject.Object, Peas.Activatable):
+    __gtype_name__ = "PySampleExtension"
+
+    def do_activate(self, window):
+        print self, "activate", window
+    
+    def do_deactivate(self, window):
+        print self, "deactivate", window
+
+    def do_update_state(self, window):
+        print self, "update_state", window



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