using System; using Gtk; using lliurex.controlcenter; using System.Collections.Generic; public partial class MainWindow: Gtk.Window { private static MainWindow instance; public List appboxes; public MainWindow (): base (Gtk.WindowType.Toplevel) { Build (); MainWindow.instance=this; } public static MainWindow getInstance() { return instance; } public void SetSensible(bool state) { hboxL1.Sensitive = state; } protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } public void fillTree(String category) {/* System.Console.WriteLine(" -Filling category-"); store.Clear(); foreach(ConfigApplication c in Core.getCore().applications) { if (c.category==category) { System.Console.WriteLine(" filling: " + c.name ); store.AppendValues(null,c.icon,c.name); } } */ appboxes=new List(); foreach(Gtk.Widget w in vboxPanelList.Children) { w.Destroy(); } foreach(ConfigApplication c in Core.getCore().applications) { if(c.category==category) { ApplicationBox abox = new ApplicationBox(c); // creates buttons based on confapplications. Should initializate // them properly if status is edited before this // list is needed to refresh the status of every single zopplet vboxPanelList.PackStart(abox); vboxPanelList.SetChildPacking(abox,false,false,5,PackType.Start); appboxes.Add(abox); } } //vboxPanelList.PackStart(custombox); //vboxPanelList.SetChildPacking(custombox,false,false,5,PackType.Start); } protected virtual void OnBtnHardwareClicked (object sender, System.EventArgs e) { fillTree("Hardware"); label4.Text=Mono.Unix.Catalog.GetString("Hardware"); image4.Pixbuf=imgHardware.Pixbuf; } protected virtual void OnBtnNetworkClicked (object sender, System.EventArgs e) { fillTree("Network"); label4.Text=Mono.Unix.Catalog.GetString("Network"); image4.Pixbuf=imgNetwork.Pixbuf;; } protected virtual void OnBtnSystemClicked (object sender, System.EventArgs e) { fillTree("System"); label4.Text=Mono.Unix.Catalog.GetString("System"); image4.Pixbuf=imgSystem.Pixbuf; } protected virtual void OnBtnPreferencesClicked (object sender, System.EventArgs e) { fillTree("Preferences"); label4.Text=Mono.Unix.Catalog.GetString("Preferences"); image4.Pixbuf=imgPreferences.Pixbuf; } protected virtual void OnBtnOthersClicked (object sender, System.EventArgs e) { fillTree("Others"); label4.Text=Mono.Unix.Catalog.GetString("Others"); image4.Pixbuf=imgOthers.Pixbuf; } //Publish an info message public void Info(String message) { imgStatus.Pixbuf = Core.getCore().pixinfo; lblStatus.Text=message; } //Publish and Error message public void Error(String message) { imgStatus.Pixbuf = Core.getCore().pixerror; lblStatus.Text=message; } protected virtual void OnBtnRefreshClicked (object sender, System.EventArgs e) { //it doesn't have a menu, so we just need to call this function Core.getCore().sm.refresh(); } }