public ItemList(ItemView itemView, ChannelList channelList) { this.itemView = itemView; channelList.ChannelSelectedEvent += channel => CurrentChannel = channel; CellRendererPixbuf cell2 = new CellRendererPixbuf(); iconColumn = new TreeViewColumn(); iconColumn.PackStart(cell2, true); iconColumn.Sizing = TreeViewColumnSizing.GrowOnly; iconColumn.Expand = false; iconColumn.SetCellDataFunc(cell2, new TreeCellDataFunc(IconCellDataFunc)); AppendColumn(iconColumn); titleColumn = new TreeViewColumn(); CellRendererText cell = new CellRendererText(); titleColumn.PackStart(cell, true); titleColumn.SetCellDataFunc(cell, new TreeCellDataFunc(NameCellDataFunc)); AppendColumn(titleColumn); this.Selection.Changed += new EventHandler(SelectionChanged); this.Model = new ListStore (typeof(Imendio.Blam.Item)); this.HeadersVisible = false; (Model as ListStore).DefaultSortFunc = CompareFunc; SetSortOrder(Conf.Get(Preference.REVERSE_ENTRIES, false)); Conf.AddNotify (Conf.GetFullKey(Preference.REVERSE_ENTRIES), new NotifyEventHandler (ConfNotifyHandler)); }
private void PrepareGUI() { Glade.XML gladeXML = Glade.XML.FromAssembly("blam.glade", "mainWindow", null); gladeXML.Autoconnect(this); channelList = new ChannelList(mCollection); ((Container)channelListSw).Child = channelList; channelList.ChannelSelectedEvent += ChannelSelected; channelList.EditChannelEvent += EditChannelActivated; channelList.MarkChannelAsReadEvent += MarkChannelAsReadActivated; channelList.RemoveChannelEvent += RemoveChannelActivated; channelList.RefreshChannelEvent += RefreshChannelActivated; itemList = new ItemList(itemView, channelList); ((Container)itemListSw).Child = itemList; itemView = new ItemView(itemList); Frame f = new Frame (); f.Shadow = ShadowType.In; f.Add (itemView); itemPaned.Add2 (f); f.Show (); itemView.OnUrl += OnUrl; // a bit silly to do it every time, but works itemList.PropertyChanged += (sender, e) => printMenuItem.Sensitive = true; trayIcon = new TrayIcon (Catalog.GetString ("Blam News Reader"), mCollection); trayIcon.ButtonPressEvent += TrayIconButtonPressCb; trayIcon.RefreshAllEvent += RefreshAllActivated; trayIcon.PreferencesEvent += PreferencesActivated; trayIcon.AboutEvent += AboutActivated; trayIcon.QuitEvent += QuitActivated; channelsLabelText = channelsLabel.Text; UpdateTotalNumberOfUnread (); printMenuItem.Sensitive = false; SensitizeChannelMenuItems(false); // Setup drag-n-drop Gtk.Drag.DestSet(mainWindow, DestDefaults.All, DragEntries, DragAction.Copy | DragAction.Move); mainWindow.DragDataReceived += DragDataReceivedCb; RestoreWindowState(); mainWindow.IconName = "blam"; mainWindow.ShowAll (); bool ShowItemList = Conf.Get(Preference.SHOW_ITEM_LIST, true); if(ShowItemList){ itemPaned.Child1.Visible = true; } else { itemPaned.Child1.Visible = false; } channelDialog = new ChannelDialog (this); addGroupDialog = new AddGroupDialog (this); preferencesDialog = new PreferencesDialog (this.Window); opmlDialog = new OpmlDialog (this.Window); opmlDialog.ChannelAdded += channel => mCollection.Add(channel, true); opmlDialog.ImportFinished += OpmlImportFinished; }