[Mono-list] GTK# Patch for TreeStore, ListStore, and TextIter
Daniel Morgan
danmorg@sc.rr.com
Wed, 20 Nov 2002 22:12:53 -0500
SetColumnTypes should be an array like the GTK+ 2.0 API says:
gtk_list_store_set_column_types ()
void gtk_list_store_set_column_types (GtkListStore *list_store,
gint n_columns,
GType *types);
This function is meant primarily for GObjects that inherit from
GtkListStore, and should only be used when constructing a new GtkListStore.
It will not function after a row has been added, or a method on the
GtkTreeModel interface is called.
list_store : A GtkListStore
n_columns : Number of columns for the list store
types : An array length n of GTypes
It does not mention var_args.
This is what I am trying to create with the Gtk.Metadata for
ListStore.SetColumnTypes:
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern void gtk_list_store_set_column_types (IntPtr raw,
int n_columns, int[] types);
public void SetColumnTypes(int[] types) {
gtk_list_store_set_column_types (Handle, n_columns, types);
}
This works for me in the DataGrid in SQL# For GTK#.
The var_args you are talking about are params in C#.
Moreover, I think it is correct for SetColumnTypes to use an array.
Mike Kestner said he would test this for me, all I had to do was supply a
patch for him.
-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
Behalf Of Kristian Rietveld
Sent: Wednesday, November 20, 2002 7:13 PM
To: Daniel Morgan
Cc: Mike Kestner; Mono-List
Subject: Re: [Mono-list] GTK# Patch for TreeStore, ListStore, and
TextIter
On Wed, 2002-11-20 at 20:56, Daniel Morgan wrote:
> Hey Mike,
>
> I have a patch for gtk-sharp/sources/Gtk.metadata.
>
> The patch has 3 fixes:
>
> 1. for TreeStore method SetColumnTypes, make the int types parameter an
> array.
> 2. for ListStore method SetColumnTypes, make the int types parameter an
> array.
> 3. for TextIter method ForwardSearch, make the TextIter parameters
> match_start and
> match_end to be out.
>
> For 3., I'm sure there are other "search" methods that need fixing, but I
> want to see how this fix works first.
>
> Are these okay?
>
> Thanks,
> Daniel
> ----
Hello,
Miguel asked me to review your patch. My comments are below
> Index: Gtk.metadata
> ===================================================================
> RCS file: /cvs/public/gtk-sharp/sources/Gtk.metadata,v
> retrieving revision 1.26
> diff -u -r1.26 Gtk.metadata
> --- Gtk.metadata 10 Nov 2002 10:03:51 -0000 1.26
> +++ Gtk.metadata 20 Nov 2002 19:35:53 -0000
> @@ -30,6 +30,25 @@
> </attribute>
> </data>
> </rule>
> +
> +<rule>
> + <class name="GtkTextIter">
> + <method>ForwardSearch</method>
> + </class>
> + <data>
> + <attribute target="param">
> + <filter level="name">match_start</filter>
> + <name>pass_as</name>
> + <value>out</value>
> + </attribute>
> + <attribute target="param">
> + <filter level="name">match_end</filter>
> + <name>pass_as</name>
> + <value>out</value>
> + </attribute>
> + </data>
> +</rule>
> +
This fix looks fine, I think you immediately can also commit a likewise
fix for BackwardSearch. (and yes, there certainly are more textiter
methods which need fixing ...)
> <rule>
> <class name="GtkEditable">
> <method>InsertText</method>
> @@ -59,6 +78,30 @@
> </attribute>
> </data>
> </rule>
> +<rule>
> + <class name="GtkListStore">
> + <method>SetColumnTypes</method>
> + </class>
> + <data>
> + <attribute target="param">
> + <filter level="name">types</filter>
> + <name>array</name>
> + <value>true</value>
> + </data>
> +</rule>
> +
> +<rule>
> + <class name="GtktTreeStore">
^
> + <method>SetColumnTypes</method>
> + </class>
> + <data>
> + <attribute target="param">
> + <filter level="name">types</filter>
> + <name>array</name>
> + <value>true</value>
> + </data>
> +</rule>
> +
I'm not sure about these. I'm feeling that they are wrong. I guess they
need the bit of var_arg magic like the {List,Tree}Store constructors
have.
A good way to test your changes to the metadata file is to regenerate
the autogenned sources and look how the generated functions look like.
regards,
Kris
(I'm feeling that I'm not being clear. If so, please tell me and I will
try to rewrite this message :)
> <rule>
> <class name="GtkTreeModelSort">
> <method>ConvertChildIterToIter</method>
_______________________________________________
Mono-list maillist - Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list