public TrayIcon(string name, ChannelCollection collection) { mIcon = new Gtk.StatusIcon(); mIcon.IconName = "blam"; mIcon.Tooltip = name; mIcon.Activate += ButtonPressedCb; mIcon.PopupMenu += PopupCb; Collection = collection; Collection.PropertyChanged += HandlePropertyChanged; Collection.CollectionChanged += HandleCollectionChanged; }
public static ChannelCollection LoadFromFile (string file) { ChannelCollection collection; try { Console.WriteLine("trying to load from file"); collection = RealLoadFromFile (file); } catch (Exception e) { Console.WriteLine("failed: {0}", e); try { collection = RealLoadFromFile (Defines.APP_DATADIR + "/collection.xml"); } catch { collection = new ChannelCollection (); collection.mChannels = new ArrayList (); collection.Groups = new ArrayList (); } } collection.FileName = file; foreach(ChannelGroup chan in collection.Groups){ chan.PropertyChanged += collection.ChannelChanged; chan.Setup(); } foreach(Channel chan in collection.mChannels){ chan.PropertyChanged += collection.ChannelChanged; chan.Setup(); } return collection; }
public Application (string[] args) { SetupDBus(); Gtk.Application.Init (); Context = new GLib.GLibSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(Context); Proxy.InitProxy (); Catalog.Init ("blam", Defines.GNOME_LOCALE_DIR); if (!File.Exists(BaseDir)) { Directory.CreateDirectory(Defines.APP_HOMEDIR); } ItemStore.Load(); mCollection = ChannelCollection.LoadFromFile (Defines.APP_HOMEDIR + "/collection.xml"); mCollection.ChannelRefreshStarted += ChannelRefreshStartedCb; mCollection.ChannelRefreshFinished += ChannelRefreshFinishedCb; mThemeManager = new ThemeManager (); PrepareGUI(); if(Conf.Get(Preference.AUTO_REFRESH, false) == true){ StartStopAutoRefresh(); ShowNextUpdateTime(); } else { if(Conf.Get(Preference.REFRESH_AT_START, false) == true){ mCollection.RefreshAll(); } } Conf.AddNotify (Conf.GetFullKey(Preference.AUTO_REFRESH), new NotifyEventHandler (ConfNotifyHandler)); }
private static void WriteBody(XmlTextWriter xtw, ChannelCollection collection) { xtw.WriteStartElement ("body"); foreach (Channel channel in collection.Channels) { xtw.WriteStartElement ("outline"); xtw.WriteAttributeString ("text", channel.Name); xtw.WriteAttributeString ("xmlUrl", channel.Url); xtw.WriteEndElement (); } xtw.WriteEndElement (); }
public static void Write(ChannelCollection collection, string fileName) { XmlTextWriter xtw = new XmlTextWriter (fileName, null); xtw.Formatting = Formatting.Indented; xtw.Indentation = 2; xtw.WriteStartDocument (); xtw.WriteStartElement ("opml"); xtw.WriteAttributeString ("version", "1.0"); WriteHeader (xtw); WriteBody (xtw, collection); xtw.WriteEndElement (); xtw.Flush (); xtw.Close (); }