[blam] ChannelList: don't bother with Glib.Idle for filling data
- From: Carlos MartÃn Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] ChannelList: don't bother with Glib.Idle for filling data
- Date: Mon, 6 Aug 2012 03:18:37 +0000 (UTC)
commit 56fef95f98733de8f339dd6b0e092a86b20dba51
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date: Mon Aug 6 01:12:03 2012 +0200
ChannelList: don't bother with Glib.Idle for filling data
It's not an expensive operation and we can do it on the spot. While in
the area, remove an unused variable.
src/ChannelList.cs | 31 +++++--------------------------
1 files changed, 5 insertions(+), 26 deletions(-)
---
diff --git a/src/ChannelList.cs b/src/ChannelList.cs
index 3bd846f..31c9493 100644
--- a/src/ChannelList.cs
+++ b/src/ChannelList.cs
@@ -32,11 +32,6 @@ namespace Imendio.Blam {
private TreeViewColumn nameColumn;
- private IEnumerator channelEnumerator;
- private IEnumerator groupEnumerator;
-
- private IChannel LastChannel = null;
-
public static TargetEntry[] DragEntries = new TargetEntry[] {
new TargetEntry("channel", TargetFlags.Widget, (uint)TargetType.Channel)
};
@@ -86,15 +81,16 @@ namespace Imendio.Blam {
this.popupMenu.RemoveSelected += RemoveChannelCb;
this.popupMenu.RefreshSelected += RefreshChannelCb;
- channelEnumerator = channels.GetEnumerator();
- groupEnumerator = groups.GetEnumerator();
-
EnableModelDragSource(ModifierType.Button1Mask, DragEntries, DragAction.Copy);
DragDataGet += DragDataGetHandler;
EnableModelDragDest(DragEntries, DragAction.Copy);
DragDataReceived += DragDataReceivedHandler;
- GLib.Idle.Add(new GLib.IdleHandler(IdleAdd));
+ foreach (IChannel channel in channels)
+ Add (channel);
+
+ foreach (IChannel group in groups)
+ AddGroup(group);
}
private void ForceResort()
@@ -185,21 +181,6 @@ namespace Imendio.Blam {
}
}
- private bool IdleAdd()
- {
- while (channelEnumerator.MoveNext ()) {
- IChannel channel = channelEnumerator.Current as IChannel;
- Add(channel);
- }
-
- while(groupEnumerator.MoveNext()){
- IChannel group = groupEnumerator.Current as IChannel;
- AddGroup(group);
- }
-
- return false;
- }
-
public void Add (IChannel channel)
{
channel.Iter = (this.Model as TreeStore).AppendValues(channel);
@@ -433,8 +414,6 @@ namespace Imendio.Blam {
}
}*/
- LastChannel = channel;
-
if (ChannelSelectedEvent != null) {
ChannelSelectedEvent(channel);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]