From ef52ff2b3310f24fc29dc717e39cd48f64163f05 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 11 May 2005 22:43:04 +0000 Subject: [PATCH] 2005-05-11 Mike Kestner * gtk/Gtk.metadata : hide IconTheme.GetIconSizes. * gtk/IconTheme.custom : implement GetIconSizes because of its zero terminated array return value. 2.6 only. [Fixes #74844] svn path=/trunk/gtk-sharp/; revision=44414 --- ChangeLog | 6 ++++++ doc/en/Gtk/IconTheme.xml | 12 ++++++------ gtk/Gtk.metadata | 1 + gtk/IconTheme.custom | 23 +++++++++++++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 750348a78..41209439c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-05-11 Mike Kestner + + * gtk/Gtk.metadata : hide IconTheme.GetIconSizes. + * gtk/IconTheme.custom : implement GetIconSizes because of its zero + terminated array return value. 2.6 only. [Fixes #74844] + 2005-05-11 Mike Kestner * pango/Makefile.am : add file. diff --git a/doc/en/Gtk/IconTheme.xml b/doc/en/Gtk/IconTheme.xml index 984dbff43..db41cccce 100644 --- a/doc/en/Gtk/IconTheme.xml +++ b/doc/en/Gtk/IconTheme.xml @@ -404,20 +404,20 @@ In general, if you use you shoul - + Method - System.Int32 + System.Int32[] - To be added + Gets a list of the sizes for an Icon by name. a - a - To be added + a + An entry of -1 indicates a scalable version of the icon. - \ No newline at end of file + diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index 7f0c9b0ec..19f656a29 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -214,6 +214,7 @@ 1 1 1 + 1 1 1 1 diff --git a/gtk/IconTheme.custom b/gtk/IconTheme.custom index 5b9e32ae5..089f7bc7a 100644 --- a/gtk/IconTheme.custom +++ b/gtk/IconTheme.custom @@ -85,3 +85,26 @@ { SearchPath = path; } + +#if GTK_SHARP_2_6 + [DllImport("libgtk-win32-2.0-0.dll")] + static extern IntPtr gtk_icon_theme_get_icon_sizes (IntPtr raw, IntPtr icon_name); + + public int[] GetIconSizes (string icon_name) + { + IntPtr icon_name_as_native = GLib.Marshaller.StringToPtrGStrdup (icon_name); + IntPtr raw_ret = gtk_icon_theme_get_icon_sizes(Handle, icon_name_as_native); + ArrayList result = new ArrayList (); + int offset = 0; + int size = Marshal.ReadInt32 (raw_ret, offset); + while (size != 0) { + result.Add (size); + offset += 4; + size = Marshal.ReadInt32 (raw_ret, offset); + } + GLib.Marshaller.Free (icon_name_as_native); + GLib.Marshaller.Free (raw_ret); + return (int[]) result.ToArray (typeof (int)); + } +#endif +