private void UpdateProjectList() { store.Clear(); foreach (Project p in this.projects) { GLib.Value Name = new GLib.Value(p.Projectname); Gdk.Pixbuf buf; if (p.ProjectStatus.BuildStatus == BuildStatus.Success) { Console.WriteLine("OK"); buf = new Gdk.Pixbuf(null, "green-24.png"); } else if (p.ProjectStatus.BuildStatus == BuildStatus.Failure) { Console.WriteLine("Failed"); buf = new Gdk.Pixbuf(null, "red-24.png"); } else { Console.WriteLine("Unknown"); buf = new Gdk.Pixbuf(null, "gray-24.png"); } store.Append(out iter); store.SetValue(iter, 0, Name); store.SetValue(iter, 1, buf); store.SetValue(iter, 2, this.projects.IndexOf(p)); } MonoTray.SaveProjects(this.projects); this.projectsTreeview.ShowAll(); }
public DamageControlTrayIcon() { Gtk.Application.Init(); this.icon = new TrayIcon("DamageControl Monitor"); InitializeSettings(); Gtk.EventBox eb = new Gtk.EventBox(); eb.ButtonPressEvent += new Gtk.ButtonPressEventHandler(IconClicked); pixbuf = new Gdk.Pixbuf(null, "gray-24.png"); image = new Gtk.Image(pixbuf); eb.Add(image); this.menu = new Gtk.Menu(); this.projects = MonoTray.LoadSettings(); foreach (Project p in this.projects) { p.StartPolling(); } Gtk.AccelGroup ac_quit = new Gtk.AccelGroup(); Gtk.ImageMenuItem it_quit = new Gtk.ImageMenuItem(Gtk.Stock.Quit, ac_quit); it_quit.Activated += new EventHandler(QuitSelected); Gtk.AccelGroup ac_settings = new Gtk.AccelGroup(); Gtk.ImageMenuItem it_settings = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, ac_settings); it_settings.Activated += new EventHandler(SettingsSelected); menu.Append(it_settings); menu.Append(it_quit); this.icon.Add(eb); this.icon.ShowAll(); UpdateProxy(); UpdateProjectList(); Gtk.Application.Run(); }
private void QuitSelected(object source, EventArgs args) { MonoTray.SaveProjects(this.projects); Gtk.Application.Quit(); Environment.Exit(0); }