зеркало из
1
0
Форкнуть 0

2007-11-16 Michael Hutchinson <mhutchinson@novell.com>

* sample/SourceViewTest.cs: List search paths in help message.
	
	* gtksourceview/SourceLanguageManager.custom: Fixed some custom 
	  marshalling thanks to ki9a on #monodevelop.
	
	* gtksourceview/SourceStyleSchemeManager.custom: 
	* gtksourceview/Gtk.metadata:
	* gtksourceview/Makefile.am: Add more custom marshalling.


svn path=/trunk/gtksourceview2-sharp/; revision=89788
This commit is contained in:
Michael Hutchinson 2007-11-16 20:16:38 +00:00
Родитель 2d3f025911
Коммит 09365a7d8e
6 изменённых файлов: 64 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,14 @@
2007-11-16 Michael Hutchinson <mhutchinson@novell.com>
* sample/SourceViewTest.cs: List search paths in help message.
* gtksourceview/SourceLanguageManager.custom: Fixed some custom
marshalling thanks to ki9a on #monodevelop.
* gtksourceview/SourceStyleSchemeManager.custom:
* gtksourceview/Gtk.metadata:
* gtksourceview/Makefile.am: Add more custom marshalling.
2007-11-15 Geoff Norton <gnorton@novell.com>
* gtksourceview2-sharp.pc.in: Depend against gtk-sharp-2.0 not gnome-sharp-2.0

Просмотреть файл

@ -14,5 +14,8 @@
<attr path="/api/namespace/object[@cname='GtkSourceLanguageManager']/method[@cname='gtk_source_language_manager_get_search_path']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkSourceLanguageManager']/method[@cname='gtk_source_language_manager_set_search_path']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkSourceLanguageManager']/property[@cname='search-path']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkSourceStyleSchemeManager']/method[@cname='gtk_source_style_scheme_manager_get_search_path']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkSourceStyleSchemeManager']/method[@cname='gtk_source_style_scheme_manager_set_search_path']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkSourceStyleSchemeManager']/property[@cname='search-path']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkSourceStyleSchemeManager']/method[@name='GetSchemeIds']" name="hidden">1</attr>
</metadata>

Просмотреть файл

@ -30,8 +30,10 @@ GtkSourceView.cs
build_sources = $(addprefix $(srcdir)/, $(sources)) AssemblyInfo.cs
customs = \
SourceBuffer.custom \
SourceLanguage.custom
SourceBuffer.custom \
SourceLanguage.custom \
SourceLanguageManager.custom \
SourceStyleSchemeManager.custom
build_customs = $(addprefix $(srcdir)/, $(customs))

Просмотреть файл

@ -1,6 +1,6 @@
[DllImport("gtksourceview-2.0")]
static extern IntPtr[] gtk_source_language_manager_get_search_path(IntPtr raw);
static extern IntPtr gtk_source_language_manager_get_search_path(IntPtr raw);
[DllImport("gtksourceview-2.0")]
static extern void gtk_source_language_manager_set_search_path(IntPtr raw, IntPtr[] dirs);
@ -8,8 +8,8 @@
[GLib.Property ("search-path")]
public string[] SearchPath {
get {
IntPtr[] raw_ret = gtk_source_language_manager_get_search_path(Handle);
return GLib.Marshaller.Utf8PtrToString (raw_ret);
IntPtr raw_ret = gtk_source_language_manager_get_search_path(Handle);
return PointerToStringArray (raw_ret);
}
set {
IntPtr[] ptrs = StringArrayToNullTermPointer (value);
@ -19,8 +19,8 @@
}
}
//copied form GLib.Marshaller trunk
static IntPtr[] StringArrayToNullTermPointer (string[] strs)
//copied from GLib.Marshaller trunk
internal static IntPtr[] StringArrayToNullTermPointer (string[] strs)
{
if (strs == null)
return new IntPtr [0];
@ -30,3 +30,15 @@
result [strs.Length] = IntPtr.Zero;
return result;
}
internal static string[] PointerToStringArray (IntPtr res)
{
ArrayList ret = new ArrayList();
IntPtr item;
do {
item = Marshal.ReadIntPtr (res, ret.Count * IntPtr.Size);
if (item != IntPtr.Zero)
ret.Add (GLib.Marshaller.Utf8PtrToString (item));
} while (item != IntPtr.Zero);
return (string[])ret.ToArray(typeof(string));
}

Просмотреть файл

@ -0,0 +1,20 @@
[DllImport("gtksourceview-2.0")]
static extern IntPtr gtk_source_style_scheme_manager_get_search_path(IntPtr raw);
[DllImport("gtksourceview-2.0")]
static extern void gtk_source_style_scheme_manager_set_search_path(IntPtr raw, IntPtr[] dirs);
[GLib.Property ("search-path")]
public string[] SearchPath {
get {
IntPtr raw_ret = gtk_source_style_scheme_manager_get_search_path(Handle);
return SourceLanguageManager.PointerToStringArray (raw_ret);
}
set {
IntPtr[] ptrs = SourceLanguageManager.StringArrayToNullTermPointer (value);
gtk_source_style_scheme_manager_set_search_path(Handle, ptrs);
foreach (IntPtr ptr in ptrs)
GLib.Marshaller.Free (ptr);
}
}

Просмотреть файл

@ -47,7 +47,15 @@ class SourceViewTest
Console.WriteLine ("\nAvailable styles:");
foreach (string style in SourceStyleSchemeManager.Default.SchemeIds)
Console.WriteLine ("\t{0}", style);
Console.WriteLine ("\nLanguage search paths:");
foreach (string searchPath in SourceLanguageManager.Default.SearchPath)
Console.WriteLine ("\t{0}", searchPath);
Console.WriteLine ("\nStyle scheme search paths:");
foreach (string searchPath in SourceStyleSchemeManager.Default.SearchPath)
Console.WriteLine ("\t{0}", searchPath);
Console.WriteLine ();
Environment.Exit (0);
}