Commit 6bb16196 authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

plugins/snippets/data/lang/*

	* configure.ac:
	* plugins/snippets/data/Makefile.am:
	* plugins/snippets/data/snippets.lang:
	* plugins/snippets/data/lang/*
	* plugins/snippets/snippets/Library.py:
	* plugins/snippets/snippets/Manager.py:
	
	Let snippets manager use a custom GtkLanguageManager which adds
	search paths for the snippets language file. Install snippets language
	file in $prefix/share/gedit-2/plugins/snippets/lang instead of 
	the gtksourceview language directory because it's private to the 
	snippets plugin

svn path=/trunk/; revision=5751
parent ccb395fc
2007-07-27 Jesse van den Kieboom <jesse@icecrew.nl>
* configure.ac:
* plugins/snippets/data/Makefile.am:
* plugins/snippets/data/snippets.lang:
* plugins/snippets/data/lang/*
* plugins/snippets/snippets/Library.py:
* plugins/snippets/snippets/Manager.py:
Let snippets manager use a custom GtkLanguageManager which adds
search paths for the snippets language file. Install snippets language
file in $prefix/share/gedit-2/plugins/snippets/lang instead of
the gtksourceview language directory because it's private to the
snippets plugin
2007-07-27 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-window.c:
......
......@@ -350,6 +350,7 @@ plugins/sample/Makefile
plugins/snippets/Makefile
plugins/snippets/snippets/Makefile
plugins/snippets/data/Makefile
plugins/snippets/data/lang/Makefile
plugins/sort/Makefile
plugins/spell/Makefile
plugins/taglist/Makefile
......
# Python snippets plugin
SUBDIRS = lang
snippets_DATA = \
css.xml \
c.xml \
......@@ -22,9 +24,4 @@ snippets_DATA = \
snippetsdir = $(datadir)/gedit-2/plugins/snippets
lang_DATA = \
snippets.lang
langdir = $(datadir)/gtksourceview-2.0/language-specs
EXTRA_DIST = $(snippets_DATA) $(lang_DATA)
# Python snippets plugin
lang_DATA = \
snippets.lang
langdir = $(datadir)/gedit-2/plugins/snippets/lang
EXTRA_DIST = $(lang_DATA)
......@@ -833,9 +833,6 @@ class Library(Singleton):
# Determine what language this file provides snippets for
if os.path.isfile(f):
addcb(f)
elif os.path.isdir(f) and not f in searched:
# Recursion rules!
searched = self.find_libraries(self, f, searched, addcb)
return searched
......
......@@ -50,12 +50,14 @@ class Manager:
def __init__(self):
self.snippet = None
self.dlg = None
self.key_press_id = 0
self._temp_export = None
self.tooltips = gtk.Tooltips()
self.snippets_doc = None
self.run()
self.manager = None
self.key_press_id = 0
self.tooltips = gtk.Tooltips()
self.run()
def get_language_snippets(self, path, name = None):
library = Library()
......@@ -118,7 +120,7 @@ class Manager:
if not self.model or force_reload:
self.model = gtk.TreeStore(str, str, object)
self.model.set_sort_column_id(self.SORT_COLUMN, gtk.SORT_ASCENDING)
manager = gedit.get_language_manager()
manager = self.get_language_manager()
langs = gedit.language_manager_list_languages_sorted(manager, True)
piter = self.model.append(None, (_('Global'), '', None))
......@@ -274,6 +276,18 @@ class Manager:
selection.connect('changed', self.on_tree_view_selection_changed)
self.build_dnd()
def get_language_manager(self):
if not self.manager:
dirs = []
for d in Library().systemdirs:
dirs.append(os.path.join(d, 'lang'))
self.manager = gsv.LanguageManager()
self.manager.set_search_path(dirs + self.manager.get_search_path())
return self.manager
def custom_handler(self, xml, function_name, widget_name, str1, str2, \
int1 , int2):
......@@ -286,7 +300,7 @@ class Manager:
source_view.set_smart_home_end(gsv.SMART_HOME_END_AFTER)
source_view.set_tabs_width(4)
manager = gedit.get_language_manager()
manager = self.get_language_manager()
lang = manager.get_language_by_id('snippets')
if lang:
......@@ -606,6 +620,8 @@ class Manager:
if self.snippets_doc:
self.snippets_doc.stop()
self.manager = None
self.unref_languages()
self.snippet = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment