blam r648 - in trunk: . src
- From: cmartin svn gnome org
- To: svn-commits-list gnome org
- Subject: blam r648 - in trunk: . src
- Date: Tue, 16 Sep 2008 20:56:05 +0000 (UTC)
Author: cmartin
Date: Tue Sep 16 20:56:05 2008
New Revision: 648
URL: http://svn.gnome.org/viewvc/blam?rev=648&view=rev
Log:
Make adding channels to groups a bit more correct.
Store each iter in the object itself so that we don't need to look for
it when adding or removing.
Modified:
trunk/ChangeLog
trunk/src/Channel.cs
trunk/src/ChannelGroup.cs
trunk/src/ChannelList.cs
trunk/src/Dialogs.cs
Modified: trunk/src/Channel.cs
==============================================================================
--- trunk/src/Channel.cs (original)
+++ trunk/src/Channel.cs Tue Sep 16 20:56:05 2008
@@ -20,6 +20,7 @@
string Name {get; set; }
string Url {get; set; }
ArrayList Items {get; set; }
+ Gtk.TreeIter Iter {get; set; }
bool MarkAsRead();
Item GetItem(string id);
}
@@ -39,6 +40,8 @@
[XmlAttribute] public string http_username = "";
[XmlAttribute] public string http_password = "";
+ private Gtk.TreeIter mIter;
+
public string Name {
get {
return Int_Name;
@@ -88,14 +91,25 @@
}
}
- public Channel ()
+ public Gtk.TreeIter Iter {
+ get {
+ return mIter;
+ }
+ set {
+ mIter = value;
+ }
+ }
+
+ public Channel ()
{
mItems = new ArrayList ();
+ mIter = new Gtk.TreeIter();
}
public Channel (string name, string url)
{
mItems = new ArrayList ();
+ mIter = new Gtk.TreeIter();
Name = name;
Url = url;
}
Modified: trunk/src/ChannelGroup.cs
==============================================================================
--- trunk/src/ChannelGroup.cs (original)
+++ trunk/src/ChannelGroup.cs Tue Sep 16 20:56:05 2008
@@ -17,6 +17,7 @@
[XmlAttribute("Url")] public string Int_Url = null;
[XmlElement("Channel", typeof(Channel))] public ArrayList Channels;
private ArrayList dummy;
+ private Gtk.TreeIter mIter;
public ArrayList Items {
get { /* FIXME: Cache this value. */
@@ -78,6 +79,15 @@
}
}
+ public Gtk.TreeIter Iter {
+ get {
+ return mIter;
+ }
+ set {
+ mIter = value;
+ }
+ }
+
public ChannelGroup() : base()
{
if(Channels == null)
Modified: trunk/src/ChannelList.cs
==============================================================================
--- trunk/src/ChannelList.cs (original)
+++ trunk/src/ChannelList.cs Tue Sep 16 20:56:05 2008
@@ -111,16 +111,20 @@
public void Add (IChannel channel)
{
- (this.Model as TreeStore).AppendValues(channel);
+ TreeIter iter = (this.Model as TreeStore).AppendValues(channel);
+ channel.Iter = iter;
}
public void AddGroup(IChannel channel)
{
TreeIter iter = (this.Model as TreeStore).AppendValues(channel);
ChannelGroup group = channel as ChannelGroup;
+ group.Iter = iter;
- foreach(IChannel chan in group.Channels)
- (this.Model as TreeStore).AppendValues(iter, chan);
+ foreach(IChannel chan in group.Channels){
+ iter = (this.Model as TreeStore).AppendValues(group.Iter, chan);
+ chan.Iter = iter;
+ }
}
public IChannel GetSelected ()
@@ -352,7 +356,7 @@
return false;
}
- public TreeIter FindChannel(IChannel channel)
+ private TreeIter FindChannel(IChannel channel)
{
findChannel = channel;
foundIter = TreeIter.Zero;
@@ -438,13 +442,16 @@
foreach(ChannelGroup group in Application.TheApp.CCollection.Groups){
if(group.Name == groupname){
group.Channels.Add(chan);
- iter = Application.TheApp.ChannelList.FindChannel(group as IChannel);
- (model as TreeStore).AppendValues(iter, chan);
+ iter = group.Iter;
+ (model as TreeStore).AppendValues(iter, chan as IChannel);
+ /* Needed? */
model.EmitRowChanged(model.GetPath(iter), iter);
}
}
- Application.TheApp.CCollection.Remove(chan as IChannel);
+ iter = chan.Iter;
+ (model as TreeStore).Remove(ref iter);
+ //Application.TheApp.CCollection.Remove(chan as IChannel);
}
public void EmitMarkAsReadCb (object obj, EventArgs args)
Modified: trunk/src/Dialogs.cs
==============================================================================
--- trunk/src/Dialogs.cs (original)
+++ trunk/src/Dialogs.cs Tue Sep 16 20:56:05 2008
@@ -64,7 +64,8 @@
ChannelGroup group = new ChannelGroup();
group.Name = groupName.Text;
mApp.CCollection.Groups.Add(group);
- (mApp.ChannelList.Model as TreeStore).AppendValues(group);
+ Gtk.TreeIter iter = (mApp.ChannelList.Model as TreeStore).AppendValues(group);
+ group.Iter = iter;
addGroupDialog.Hide();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]