Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
	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;
	}
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
Arquivo: Opml.cs Projeto: GNOME/blam
        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 ();
        }
Exemplo n.º 5
0
Arquivo: Opml.cs Projeto: GNOME/blam
        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 ();
        }