2004-11-04 Todd Berman <tberman@off.net>

* doc/en/GLib/ListBase.xml: Add documentation for ListBase.Empty
        * glib/ListBase.cs: Add ListBase.Empty, frees the children and the
        list.
        * glib/Markup.cs: Fix Alex's tomboy crash, sending -1 instead of
        Length.
        * gtk/FileChooserDialog.custom:
        * gtk/FileChooserWidget.custom: properly free the list.

svn path=/trunk/gtk-sharp/; revision=35650
This commit is contained in:
Todd Berman 2004-11-04 19:29:01 +00:00
parent 131f2ed0d9
commit cac3c4a368
6 changed files with 43 additions and 2 deletions

View file

@ -1,3 +1,13 @@
2004-11-04 Todd Berman <tberman@off.net>
* doc/en/GLib/ListBase.xml: Add documentation for ListBase.Empty
* glib/ListBase.cs: Add ListBase.Empty, frees the children and the
list.
* glib/Markup.cs: Fix Alex's tomboy crash, sending -1 instead of
Length.
* gtk/FileChooserDialog.custom:
* gtk/FileChooserWidget.custom: properly free the list.
2004-11-03 Todd Berman <tberman@off.net>
* gtk/FileChooserDialog.custom:

View file

@ -259,5 +259,17 @@
<remarks />
</Docs>
</Member>
<Member MemberName="Empty">
<MemberSignature Language="C#" Value="public void Empty ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Empties the list.</summary>
<remarks>Empties, and frees the list, as well as all of its children</remarks>
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -153,6 +153,23 @@ namespace GLib {
return ret;
}
[DllImport ("libglib-2.0-0.dll")]
static extern void g_free (IntPtr item);
[DllImport ("libglib-2.0-0.dll")]
static extern void g_object_unref (IntPtr item);
public void Empty ()
{
for (uint i = 0; i < Count; i++)
{
if (element_type == typeof (GLib.Object))
g_object_unref (NthData (i));
else
g_free (NthData (i));
}
Dispose ();
}
private class ListEnumerator : IEnumerator
{

View file

@ -37,7 +37,7 @@ namespace GLib {
if (s == null)
return "";
return Marshaller.PtrToStringGFree (g_markup_escape_text (s, s.Length));
return Marshaller.PtrToStringGFree (g_markup_escape_text (s, -1));
}
}
}

View file

@ -63,6 +63,7 @@
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];
list.Empty ();
return result;
}
}

View file

@ -31,6 +31,7 @@ public string[] Filenames {
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];
list.Empty ();
return result;
}
}