From b7e4cc507e900e2b2a365be7f7cc556df2fe3a48 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 2 May 2005 20:10:03 +0000 Subject: [PATCH] * generator/Parameters.cs (IsHidden): method to check if a parameter should be hidden in the managed sig (eg, because it's user_data, or it's the length of the preceding array/string, etc). (VisibleCount): the number of parameters that will actually be exposed in the managed signature. (IsAccessor): test VisibleCount, not Count (AccessorReturnType, AccessorName): deal with the fact that the accessor parameter might not be the first one. * generator/CallbackGen.cs: * generator/Signature.cs: use Parameters.IsHidden. * generator/Method.cs (Initialize): set is_set based on VisibleCount, not Count. (Validate): call base.Validate() before Initialize() so that VisibleCount will be correct in Initialize. * generator/MethodBody.cs (GetCallString, CallArrayLength, Initialize): update to deal with accessors with multiple args. * gtk/Clipboard.custom (SetText): implement as an Obsolete variant of the Text property * gtk/IconTheme.custom (SearchPath, SetSearchPath): obsolete SetSearchPath, implement a setter on SearchPath instead. * gtk/ListStore.custom (SetColumnTypes): * gtk/TreeStore.custom (SetColumnTypes): implement as an Obsolete variant of the ColumnTypes property. * glade/XML.custom (CustomHandler): implement as a property (SetCustomHandler): Mark this obsolete * glade/Global.custom (SetCustomHandler): deprecate in favor of XML.CustomHandler. * gnomedb/Editor.custom (SetText): implement as an Obsolete variant of the Text property svn path=/trunk/gtk-sharp/; revision=43898 --- ChangeLog | 41 +++++++++++++++++++++ doc/en/Glade/XML.xml | 35 +++++++++++------- doc/en/GnomeDb/Editor.xml | 14 +++++++- doc/en/Gtk/Clipboard.xml | 20 ++++++++--- doc/en/Gtk/IconTheme.xml | 56 +++++++++++++++++------------ doc/en/Gtk/ListStore.xml | 30 +++++++++++----- doc/en/Gtk/TreeStore.xml | 64 +++++++++++++++++++-------------- generator/CallbackGen.cs | 9 ++--- generator/Method.cs | 4 +-- generator/MethodBody.cs | 24 +++++++------ generator/Parameters.cs | 64 ++++++++++++++++++++++++++++++--- generator/Signature.cs | 21 ++--------- glade/Glade.metadata | 1 + glade/Global.custom | 21 +++++++++++ glade/Makefile.am | 1 + glade/XML.custom | 11 ++++-- gnomedb/Editor.custom | 21 +++++++++++ gnomedb/Makefile.am | 3 +- gtk/Clipboard.custom | 5 +++ gtk/Gtk.metadata | 1 + gtk/IconTheme.custom | 17 +++++++++ gtk/ListStore.custom | 10 ++++-- gtk/TreeStore.custom | 10 ++++-- sample/GtkDemo/DemoClipboard.cs | 2 +- 24 files changed, 360 insertions(+), 125 deletions(-) create mode 100644 glade/Global.custom create mode 100644 gnomedb/Editor.custom diff --git a/ChangeLog b/ChangeLog index 106584e6f..ccf6e7a8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +2005-05-02 Dan Winship + + * generator/Parameters.cs (IsHidden): method to check if a + parameter should be hidden in the managed sig (eg, because it's + user_data, or it's the length of the preceding array/string, etc). + (VisibleCount): the number of parameters that will actually be + exposed in the managed signature. + (IsAccessor): test VisibleCount, not Count + (AccessorReturnType, AccessorName): deal with the fact that the + accessor parameter might not be the first one. + + * generator/CallbackGen.cs: + * generator/Signature.cs: use Parameters.IsHidden. + + * generator/Method.cs (Initialize): set is_set based on + VisibleCount, not Count. + (Validate): call base.Validate() before Initialize() so that + VisibleCount will be correct in Initialize. + + * generator/MethodBody.cs (GetCallString, CallArrayLength, + Initialize): update to deal with accessors with multiple args. + + * gtk/Clipboard.custom (SetText): implement as an Obsolete variant + of the Text property + + * gtk/IconTheme.custom (SearchPath, SetSearchPath): obsolete + SetSearchPath, implement a setter on SearchPath instead. + + * gtk/ListStore.custom (SetColumnTypes): + * gtk/TreeStore.custom (SetColumnTypes): implement as an Obsolete + variant of the ColumnTypes property. + + * glade/XML.custom (CustomHandler): implement as a property + (SetCustomHandler): Mark this obsolete + + * glade/Global.custom (SetCustomHandler): deprecate in favor of + XML.CustomHandler. + + * gnomedb/Editor.custom (SetText): implement as an Obsolete + variant of the Text property + 2005-05-02 Dan Winship Apply the parts of the generator reorganization from #69514 that diff --git a/doc/en/Glade/XML.xml b/doc/en/Glade/XML.xml index 0eacbf34e..a711dbf00 100644 --- a/doc/en/Glade/XML.xml +++ b/doc/en/Glade/XML.xml @@ -115,6 +115,26 @@ public class GladeApp + + + Property + + Glade.XMLCustomWidgetHandler + + + Allows you to override the default behaviour when a Custom widget is found in an interface. + a + + + Setting this property allows you to override the default + behaviour when a Custom widget is found in an + interface. This could be used by a language binding to + call some other function, or to limit what functions can + be called to create custom widgets + + + + Method @@ -125,20 +145,9 @@ public class GladeApp - - This function allows you to override the default behaviour - when a Custom widget is found in an interface. - + Deprecated: Replaced by the property. the custom widget handler - - - Calling this function allows you to override the default - behaviour when a Custom widget is found in an - interface. This could be used by a language binding to - call some other function, or to limit what functions can - be called to create custom widgets - - + Deprecated: Replaced by the property. diff --git a/doc/en/GnomeDb/Editor.xml b/doc/en/GnomeDb/Editor.xml index 398b43b1d..fb7f40e18 100644 --- a/doc/en/GnomeDb/Editor.xml +++ b/doc/en/GnomeDb/Editor.xml @@ -84,7 +84,7 @@ To be added - + Method @@ -218,5 +218,17 @@ Chain to this constructor if you have manually registered a native value for your subclass. + + + Property + + System.String + + + To be added + a + To be added + + \ No newline at end of file diff --git a/doc/en/Gtk/Clipboard.xml b/doc/en/Gtk/Clipboard.xml index b3f22e19e..288e3e3d7 100644 --- a/doc/en/Gtk/Clipboard.xml +++ b/doc/en/Gtk/Clipboard.xml @@ -13,7 +13,7 @@ An object that stores clipboard data. The object represents a clipboard of data shared between different processes or between different widgets in the same process. Each clipboard is identified by a name encoded as a . (Conversion to and from strings can be done with and .) The default clipboard corresponds to the "CLIPBOARD" atom; another commonly used clipboard is the "PRIMARY" clipboard, which, in X, traditionally contains the currently selected text. - To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (via methods like ), or you can supply a callback to be called at a later time when the data is needed (via or .) Providing a callback also avoids having to make copies of the data when it is not needed. + To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (eg, via the property), or you can supply a callback to be called at a later time when the data is needed (via or .) Providing a callback also avoids having to make copies of the data when it is not needed. and are quite similar; the choice between the two depends mostly on which is more convenient in a particular situation. The former is most useful when you want to have a blob of data with callbacks to convert it into the various data types that you advertise. When the clear_func you provided is called, you simply free the data blob. The latter is more useful when the contents of clipboard reflect the internal state of a (As an example, for the PRIMARY clipboard, when an entry widget provides the contents for the clipboar the contents are simply the text within the selected region.) If the contents change, the entry widget can call to update the timestamp for clipboard ownership, without having to worry about clear_func being called. Requesting the data from the clipboard is essentially asynchronous. If the contents of the clipboard are provided within the same process, then a direct function call will be made to retrieve the data, but if they are provided by another process, then the data needs to be retrieved from the other process, which may take some time. To avoid blocking the user interface, the call to request the selection, takes a callback that will be called when the contents are received (or when the request fails.) If you do not want to deal with providing a separate callback, you can also use . What this does is run the GLib main loop recursively waiting for the contents. This can simplify the code flow, but you still have to be aware that other callbacks in your program can be called while this recursive mainloop is running. @@ -131,7 +131,19 @@ If the clipboard contents callbacks were set with , and the or has not been subsequently called, it will return the owner set by . - + + + Property + + System.String + + + Sets the contents of the clipboard to the given UTF-8 string. + a + Gtk# will make a copy of the text and take responsibility for responding for requests for the text, and for converting the text into the requested format. + + + Method @@ -141,9 +153,9 @@ - Sets the contents of the clipboard to the given UTF-8 string. + Deprecated method to set the contents of the clipboard. an object of type - Gtk# will make a copy of the text and take responsibility for responding for requests for the text, and for converting the text into the requested format. + Replaced by the property. diff --git a/doc/en/Gtk/IconTheme.xml b/doc/en/Gtk/IconTheme.xml index 62500754e..984dbff43 100644 --- a/doc/en/Gtk/IconTheme.xml +++ b/doc/en/Gtk/IconTheme.xml @@ -186,6 +186,38 @@ In general, if you use you shoul See . + + + Property + + System.String[] + + + + The current search path + a , array of directories that are searched for icon themes + + + When looking for an icon theme, Gtk will search for a + subdirectory of one or more of the directories in this + path with the same name as the icon theme. (Themes from + multiple of the path elements are combined to allow + themes to be extended by adding icons in the user's home + directory.) + + + In addition if an icon found is not found either in the + current icon theme or the default icon theme, and an + image file with the right name is found directly in one + of the elements of path, then that image will be used + for the icon name. (This is a legacy feature, and new + icons should be put into the default icon theme, which + is called DEFAULT_THEME_NAME, rather than directly on + the icon path.) + + + + Method @@ -196,16 +228,9 @@ In general, if you use you shoul - Sets the current search path. + Deprecated method to set the current search path. a , array of directories that are searched for icon themes - - -Sets the search path for the icon theme object. When looking for an icon theme, Gtk will search for a subdirectory of one or more of the directories in path with the same name as the icon theme. (Themes from multiple of the path elements are combined to allow themes to be extended by adding icons in the user's home directory.) - - -In addition if an icon found is not found either in the current icon theme or the default icon theme, and an image file with the right name is found directly in one of the elements of path, then that image will be used for the icon name. (This is a legacy feature, and new icons should be put into the default icon theme, which is called DEFAULT_THEME_NAME, rather than directly on the icon path.) - - + Replaced by the property. @@ -366,19 +391,6 @@ In addition if an icon found is not found either in the current icon theme or th - - - Property - - System.String[] - - - - The current search path - a , array of directories that are searched for icon themes - - - Event diff --git a/doc/en/Gtk/ListStore.xml b/doc/en/Gtk/ListStore.xml index 3613f6d5b..865805a8b 100644 --- a/doc/en/Gtk/ListStore.xml +++ b/doc/en/Gtk/ListStore.xml @@ -1078,7 +1078,26 @@ The above example creates a new three columns list store. The types of the colum Returns the native value for . - + + + Property + + GLib.GType[] + + + The types in each column of a ListStore. + a + + This property is meant primarily for classes that + inherit from , and should + only be used when constructing a new . It will not function after a + row has been added or after a method on the interface has been called. + + + + Method @@ -1088,14 +1107,9 @@ The above example creates a new three columns list store. The types of the colum - Sets what types go in each column of a ListStore. + Deprecated method to set what types go in each column of a ListStore. a - This function is meant primarily for #GObjects that inherit - from and should only be used when - constructing a new . It will not - function after a row has been added or after a method on the - interface has been called. - + See diff --git a/doc/en/Gtk/TreeStore.xml b/doc/en/Gtk/TreeStore.xml index 5bc7f5e3f..431c36d75 100644 --- a/doc/en/Gtk/TreeStore.xml +++ b/doc/en/Gtk/TreeStore.xml @@ -1221,7 +1221,38 @@ store = new TreeStore (typeof (int), typeof (string)); Returns the native value for . - + + + Property + + GLib.GType[] + + + To be added + a + To be added + + + + + Property + + GLib.GType[] + + + The types in each column of a TreeStore. + a + + This property is meant primarily for classes that + inherit from , and should + only be used when constructing a new . It will not function after a + row has been added or after a method on the interface has been called. + + + + Method @@ -1231,30 +1262,9 @@ store = new TreeStore (typeof (int), typeof (string)); - Sets what types go in each column of a ListStore. + Deprecated method to set what types go in each column of a TreeStore. a - This function is meant primarily for #GObjects that inherit - from and should only be used when - constructing a new . It will not - function after a row has been added or after a method on the - interface has been called. - - - - - - Method - - GLib.GType - - - - - - Gets the type of data stored in column number . - a , the column to check - a - + See @@ -1378,7 +1388,7 @@ store = new TreeStore (typeof (int), typeof (string)); Protected Constructor. a - a + a Chain to this constructor if you have manually registered a native value for your subclass. @@ -1408,7 +1418,7 @@ store = new TreeStore (typeof (int), typeof (string)); - Reorders the ListStore. + Reorders the TreeStore. a . (FIXME: Does this binding work?) @@ -1777,4 +1787,4 @@ store = new TreeStore (typeof (int), typeof (string)); - + \ No newline at end of file diff --git a/generator/CallbackGen.cs b/generator/CallbackGen.cs index 0daaa77be..9a2492af3 100644 --- a/generator/CallbackGen.cs +++ b/generator/CallbackGen.cs @@ -84,16 +84,11 @@ namespace GtkSharp.Generation { { Parameter p = parms [i]; - if (i > 0 && p.IsLength && parms[i-1].IsString) - continue; - - if ((i == parms.Count - 1) && p.IsUserData) - continue; - if (p.CType == "GError**") { sw.WriteLine ("\t\t\t" + p.Name + " = IntPtr.Zero;"); continue; - } + } else if (parms.IsHidden (p)) + continue; IGeneratable gen = p.Generatable; diff --git a/generator/Method.cs b/generator/Method.cs index 6a1d84e24..1953d12dd 100644 --- a/generator/Method.cs +++ b/generator/Method.cs @@ -121,7 +121,7 @@ namespace GtkSharp.Generation { Parameters parms = Parameters; is_get = ((((parms.IsAccessor && retval.IsVoid) || (parms.Count == 0 && !retval.IsVoid)) || (parms.Count == 0 && !retval.IsVoid)) && Name.Length > 3 && (Name.StartsWith ("Get") || Name.StartsWith ("Is") || Name.StartsWith ("Has"))); - is_set = ((parms.IsAccessor || (parms.Count == 1 && retval.IsVoid)) && (Name.Length > 3 && Name.Substring(0, 3) == "Set")); + is_set = ((parms.IsAccessor || (parms.VisibleCount == 1 && retval.IsVoid)) && (Name.Length > 3 && Name.Substring(0, 3) == "Set")); call = "(" + (IsStatic ? "" : container_type.CallByName () + (parms.Count > 0 ? ", " : "")) + Body.GetCallString (is_set) + ")"; @@ -131,7 +131,7 @@ namespace GtkSharp.Generation { public override bool Validate () { - if (!Initialize () || !base.Validate ()) + if (!base.Validate () || !Initialize ()) return false; if (!retval.Validate ()) { diff --git a/generator/MethodBody.cs b/generator/MethodBody.cs index ae5687c45..c30a5a8f7 100644 --- a/generator/MethodBody.cs +++ b/generator/MethodBody.cs @@ -42,10 +42,10 @@ namespace GtkSharp.Generation { return type != "int" ? "(" + type + ") " : ""; } - private string CallArrayLength (Parameter array, Parameter length) + private string CallArrayLength (string array_name, Parameter length) { - string result = array.Name + " != null ? "; - result += CastFromInt (length.CSType) + array.Name + ".Length"; + string result = array_name + " != null ? "; + result += CastFromInt (length.CSType) + array_name + ".Length"; result += ": 0"; return length.Generatable.CallByName (result); } @@ -59,24 +59,28 @@ namespace GtkSharp.Generation { for (int i = 0; i < parameters.Count; i++) { Parameter p = parameters [i]; IGeneratable igen = p.Generatable; + string name = (i == 0 && is_set) ? "value" : p.Name; if (p.IsCount) { if (i > 0 && parameters [i - 1].IsArray) { - result[i] = CallArrayLength (parameters[i - 1], p); + string array_name = (i == 1 && is_set) ? "value" : parameters [i - 1].Name; + result[i] = CallArrayLength (array_name, p); continue; } else if (i < parameters.Count - 1 && parameters [i + 1].IsArray) { - result[i] = CallArrayLength (parameters[i + 1], p); + string array_name = (i == 0 && is_set) ? "value" : parameters [i + 1].Name; + result[i] = CallArrayLength (array_name, p); continue; } } else if (i > 0 && parameters [i - 1].IsString && p.IsLength) { - result[i] = igen.CallByName (CastFromInt (p.CSType) + parameters [i - 1].Name + ".Length"); + string string_name = (i == 1 && is_set) ? "value" : parameters [i - 1].Name; + result[i] = igen.CallByName (CastFromInt (p.CSType) + string_name + ".Length"); continue; } else if (p.IsArray && p.MarshalType != p.CSType) { result[i] = "native_" + p.Name; continue; } - string call_parm = p.CallByName (is_set && i == 0 ? "value" : p.Name); + string call_parm = p.CallByName (name); if (p.CType == "GError**") { result [i] += "out "; @@ -122,8 +126,8 @@ namespace GtkSharp.Generation { sw.WriteLine(indent + "\t\t\t" + gen.MarshalType + " " + name + "_as_native;"); else if (p.IsArray && p.MarshalType != p.CSType) { sw.WriteLine(indent + "\t\t\tint cnt_" + p.Name + " = {0} == null ? 0 : {0}.Length;", name); - sw.WriteLine(indent + "\t\t\t{0}[] native_" + p.Name + " = new {0} [cnt_{1}];", p.MarshalType.TrimEnd('[', ']'), name); - sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < cnt_{0}; i++)", name); + sw.WriteLine(indent + "\t\t\t{0}[] native_" + p.Name + " = new {0} [cnt_{1}];", p.MarshalType.TrimEnd('[', ']'), p.Name); + sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < cnt_{0}; i++)", p.Name); if (gen is IManualMarshaler) sw.WriteLine(indent + "\t\t\t\tnative_{0} [i] = {1};", p.Name, (gen as IManualMarshaler).AllocNative (name + "[i]")); else @@ -140,7 +144,7 @@ namespace GtkSharp.Generation { default: if (p.Scope == String.Empty) Console.WriteLine ("Defaulting " + gen.Name + " param to 'call' scope in method " + gen_info.CurrentMember); - sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper = new {0} ({2});", wrapper, name, p.Name); + sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper = new {0} ({1});", wrapper, name); break; } diff --git a/generator/Parameters.cs b/generator/Parameters.cs index 26661bdb8..d9a93bccb 100644 --- a/generator/Parameters.cs +++ b/generator/Parameters.cs @@ -235,12 +235,51 @@ namespace GtkSharp.Generation { } } + public int VisibleCount { + get { + int visible = 0; + foreach (Parameter p in this) { + if (!IsHidden (p)) + visible++; + } + return visible; + } + } + public Parameter this [int idx] { get { return param_list [idx] as Parameter; } } + public bool IsHidden (Parameter p) + { + int idx = param_list.IndexOf (p); + + if (idx > 0 && p.IsLength && this [idx - 1].IsString) + return true; + + if (p.IsCount && ((idx > 0 && this [idx - 1].IsArray) || + (idx < Count - 1 && this [idx + 1].IsArray))) + return true; + + if (p.CType == "GError**") + return true; + + if (HasCB || HideData) { + if (p.IsUserData && (idx == Count - 1)) + return true; + } + + return false; + } + + bool has_cb; + public bool HasCB { + get { return has_cb; } + set { has_cb = value; } + } + bool hide_data; public bool HideData { get { return hide_data; } @@ -285,6 +324,9 @@ namespace GtkSharp.Generation { Clear (); return false; } + + if (p.Generatable is CallbackGen) + has_cb = true; } return true; @@ -292,14 +334,25 @@ namespace GtkSharp.Generation { public bool IsAccessor { get { - return Count == 1 && this [0].PassAs == "out"; + return VisibleCount == 1 && AccessorParam.PassAs == "out"; + } + } + + public Parameter AccessorParam { + get { + foreach (Parameter p in this) { + if (!IsHidden (p)) + return p; + } + return null; } } public string AccessorReturnType { get { - if (Count > 0) - return this [0].CSType; + Parameter p = AccessorParam; + if (p != null) + return p.CSType; else return null; } @@ -307,8 +360,9 @@ namespace GtkSharp.Generation { public string AccessorName { get { - if (Count > 0) - return this [0].Name; + Parameter p = AccessorParam; + if (p != null) + return p.Name; else return null; } diff --git a/generator/Signature.cs b/generator/Signature.cs index 05c28baec..1b0123424 100644 --- a/generator/Signature.cs +++ b/generator/Signature.cs @@ -31,24 +31,9 @@ namespace GtkSharp.Generation { public Signature (Parameters parms) { - bool has_cb = parms.HideData; - for (int i = 0; i < parms.Count; i++) { - Parameter p = parms [i]; - - if (i > 0 && p.IsLength && parms [i - 1].IsString) - continue; - - if (p.IsCount && ((i > 0 && parms [i - 1].IsArray) || (i < parms.Count - 1 && parms [i + 1].IsArray))) - continue; - - has_cb = has_cb || p.Generatable is CallbackGen; - if (p.IsUserData && has_cb && (i == parms.Count - 1)) - continue; - - if (p.CType == "GError**") - continue; - - this.parms.Add (p); + foreach (Parameter p in parms) { + if (!parms.IsHidden (p)) + this.parms.Add (p); } } diff --git a/glade/Glade.metadata b/glade/Glade.metadata index 4fb752d83..ec99f7877 100644 --- a/glade/Glade.metadata +++ b/glade/Glade.metadata @@ -3,4 +3,5 @@ const-gchar* 1 const-gchar* + 1 diff --git a/glade/Global.custom b/glade/Global.custom new file mode 100644 index 000000000..209612ee6 --- /dev/null +++ b/glade/Global.custom @@ -0,0 +1,21 @@ +// Copyright (c) 2005 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +[Obsolete ("Replaced by Glade.XML.CustomHandler static property.")] +public static void SetCustomHandler (Glade.XMLCustomWidgetHandler handler) +{ + XML.CustomHandler = handler; +} diff --git a/glade/Makefile.am b/glade/Makefile.am index ee0fced84..d833f7570 100644 --- a/glade/Makefile.am +++ b/glade/Makefile.am @@ -18,6 +18,7 @@ sources = \ WidgetAttribute.cs customs = \ + Global.custom \ XML.custom add_dist = makefile.win32 glade-sharp-2.0.pc.in diff --git a/glade/XML.custom b/glade/XML.custom index 85767eda7..74f33fdaf 100644 --- a/glade/XML.custom +++ b/glade/XML.custom @@ -30,10 +30,17 @@ [DllImport("libglade-2.0-0.dll")] static extern void glade_set_custom_handler (GladeSharp.XMLCustomWidgetHandlerNative handler, IntPtr user_data); + public static Glade.XMLCustomWidgetHandler CustomHandler { + set { + GladeSharp.XMLCustomWidgetHandlerWrapper value_wrapper = new GladeSharp.XMLCustomWidgetHandlerWrapper (value); + glade_set_custom_handler(value_wrapper.NativeDelegate, IntPtr.Zero); + } + } + + [Obsolete ("Replaced by CustomHandler property.")] static public void SetCustomHandler (Glade.XMLCustomWidgetHandler handler) { - callback_wrapper = new GladeSharp.XMLCustomWidgetHandlerWrapper (handler); - glade_set_custom_handler (callback_wrapper.NativeDelegate, IntPtr.Zero); + CustomHandler = handler; } [DllImport("gladesharpglue-2")] diff --git a/gnomedb/Editor.custom b/gnomedb/Editor.custom new file mode 100644 index 000000000..967666995 --- /dev/null +++ b/gnomedb/Editor.custom @@ -0,0 +1,21 @@ +// Copyright (c) 2005 Novell, Inc. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +[Obsolete ("Replaced by Test property.")] +public void SetText (string text) +{ + Text = text; +} diff --git a/gnomedb/Makefile.am b/gnomedb/Makefile.am index be12ed954..55d3e904e 100644 --- a/gnomedb/Makefile.am +++ b/gnomedb/Makefile.am @@ -14,7 +14,8 @@ references = ../glib/glib-sharp.dll ../pango/pango-sharp.dll ../atk/atk-sharp.dl sources = \ Application.cs -customs = +customs = \ + Editor.custom add_dist = gnomedb-sharp-2.0.pc.in diff --git a/gtk/Clipboard.custom b/gtk/Clipboard.custom index 35e21b1e0..ebf2a2496 100644 --- a/gtk/Clipboard.custom +++ b/gtk/Clipboard.custom @@ -61,3 +61,8 @@ return ret; } + [Obsolete ("Replaced by Text property.")] + public void SetText (string text) + { + Text = text; + } diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index c990850a5..362780906 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -220,6 +220,7 @@ 1 1 1 + 1 ActivateItem AllSelected 1 diff --git a/gtk/IconTheme.custom b/gtk/IconTheme.custom index 8eb46a5cd..5b9e32ae5 100644 --- a/gtk/IconTheme.custom +++ b/gtk/IconTheme.custom @@ -43,6 +43,9 @@ [DllImport("libgtk-win32-2.0-0.dll")] static extern void gtk_icon_theme_get_search_path(IntPtr raw, out IntPtr path, out int n_elements); + [DllImport("libgtk-win32-2.0-0.dll")] + static extern void gtk_icon_theme_set_search_path(IntPtr raw, IntPtr[] path, int n_elements); + [DllImport("libglib-2.0-0.dll")] static extern void g_strfreev (IntPtr mem); @@ -66,5 +69,19 @@ return retval; } + set { + int cnt_path = value == null ? 0 : value.Length; + IntPtr[] native_path = new IntPtr [cnt_path]; + for (int i = 0; i < cnt_path; i++) + native_path [i] = GLib.Marshaller.StringToPtrGStrdup (value[i]); + gtk_icon_theme_set_search_path (Handle, native_path, native_path.Length); + for (int i = 0; i < native_path.Length; i++) + GLib.Marshaller.Free (native_path[i]); + } } + [Obsolete ("Replaced by SearchPath property.")] + public void SetSearchPath (string[] path) + { + SearchPath = path; + } diff --git a/gtk/ListStore.custom b/gtk/ListStore.custom index 5fd14bdab..045aa8461 100644 --- a/gtk/ListStore.custom +++ b/gtk/ListStore.custom @@ -122,7 +122,7 @@ public ListStore (params GLib.GType[] types) : base (IntPtr.Zero) { CreateNativeObject (new string [0], new GLib.Value [0]); - SetColumnTypes (types); + ColumnTypes = types; } public ListStore (params Type[] types) : base (IntPtr.Zero) @@ -138,7 +138,13 @@ } CreateNativeObject (new string [0], new GLib.Value [0]); - SetColumnTypes (gtypes); + ColumnTypes = gtypes; + } + + [Obsolete ("Replaced by ColumnTypes property.")] + public void SetColumnTypes (GLib.GType[] types) + { + ColumnTypes = types; } public object GetValue(Gtk.TreeIter iter, int column) diff --git a/gtk/TreeStore.custom b/gtk/TreeStore.custom index 9bb67517f..3195f563c 100644 --- a/gtk/TreeStore.custom +++ b/gtk/TreeStore.custom @@ -298,7 +298,7 @@ public TreeStore (params GLib.GType[] types) : base (IntPtr.Zero) { CreateNativeObject (new string [0], new GLib.Value [0]); - SetColumnTypes (types); + ColumnTypes = types; } public TreeStore (params Type[] types) : base (IntPtr.Zero) @@ -314,7 +314,13 @@ } CreateNativeObject (new string [0], new GLib.Value [0]); - SetColumnTypes (gtypes); + ColumnTypes = gtypes; + } + + [Obsolete ("Replaced by ColumnTypes property.")] + public void SetColumnTypes (GLib.GType[] types) + { + ColumnTypes = types; } public object GetValue (Gtk.TreeIter iter, int column) { diff --git a/sample/GtkDemo/DemoClipboard.cs b/sample/GtkDemo/DemoClipboard.cs index 2936a70e2..a20d36eec 100644 --- a/sample/GtkDemo/DemoClipboard.cs +++ b/sample/GtkDemo/DemoClipboard.cs @@ -59,7 +59,7 @@ namespace GtkDemo void CopyClicked (object obj, EventArgs args) { Clipboard clipboard = copyEntry.GetClipboard (Gdk.Selection.Clipboard); - clipboard.SetText (copyEntry.Text); + clipboard.Text = copyEntry.Text; } void PasteClicked (object obj, EventArgs args)