[Gtk-sharp-list] [Patch] GetNodes() for NodeStore

Eric Butler eric@extremeboredom.net
Mon, 25 Apr 2005 23:22:15 -0700


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I couldn't find any simple way to get a list of all the nodes in a
NodeStore. This one line method does the trick... unless I totally
overlooked something (which happens quite often) could it please be added?

This is extremely useful because I can do something like:

public void on_mnuConnectionsClearDisconnected_activate(object o,
EventArgs e)
        {
                foreach (ConnectionListItem node in
connectionList.NodeStore.GetNodes()) {
                        if (node.Connection.ConnectionState ==
ConnectionState.Disconnected) {
                                network.Connections.Remove(node.Connection);
                                connectionListStore.RemoveNode(node);
                        }
                }
        }


Thanks a lot!

Regards,
Eric

- ---

(Mike I sent this to you directly but wasn't sure if it actually went
though because both my mailserver and client went half nuts at the same
time, so sorry if you did.)

- ---

$ svn diff
Index: gtk/NodeStore.cs
===================================================================
- --- gtk/NodeStore.cs    (revision 43497)
+++ gtk/NodeStore.cs    (working copy)
@@ -317,8 +317,13 @@
                        get {
                                return nodes as IList;
                        }
- -               }
+               }

+
+               public ITreeNode[] GetNodes() {
+                       return (nodes.ToArray(typeof(ITreeNode)) as
ITreeNode[]);
+               }
+
                [DllImport("gtksharpglue-2")]
                static extern void gtksharp_node_store_emit_row_changed
(IntPtr handle, IntPtr path, int node_idx);


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCbd4XsSPwEOmqwCIRApO8AJ9onmW70kqzcDgo3J27K6CVaY15dwCfW4dS
hqzldcuE8uW20wc14GEWX1o=
=/Jub
-----END PGP SIGNATURE-----