private static void RunGUI() { Application.Init (); MainWindow win = new MainWindow (); win.ShowAll (); win.DeleteEvent += delegate { Application.Quit (); }; try { Application.Run (); } catch (Exception e) { Console.Error.WriteLine (e); Utility.ShowError (win, Catalog.GetString ("An unexpected error occurred, Virtual Machine Manager will now exit:"), e.Message); } }
public ConfigDialog(VirtualMachine machine, MainWindow parent) : base("Configure Virtual Machine", parent, DialogFlags.NoSeparator, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok) { this.mainWindow = parent; this.machine = machine; IconThemeUtils.SetWindowIcon (this); ActionEntry[] actionList = { new ActionEntry ("AddHardDisk", null, Catalog.GetString ("Hard Disk"), null, Catalog.GetString ("Add a hard disk"), OnAddHardDisk), new ActionEntry ("AddCdDrive", null, Catalog.GetString ("CD-ROM"), null, Catalog.GetString ("Add a CD-ROM drive"), OnAddCdDrive), new ActionEntry ("AddEthernet", null, Catalog.GetString ("Ethernet"), null, Catalog.GetString ("Add an ethernet device"), OnAddEthernet), new ActionEntry ("AddFloppy", null, Catalog.GetString ("Floppy"), null, Catalog.GetString ("Add a floppy drive"), OnAddFloppy), }; actions = new ActionGroup ("VmxManager Device Actions"); actions.Add (actionList); ui = new UIManager (); ui.InsertActionGroup (actions, 0); ui.AddUiFromResource ("vmx-manager-config.xml"); Glade.XML xml = new Glade.XML ("vmx-manager.glade", "configDialogContent"); xml.Autoconnect (this); guestOsCombo.Model = new OSModel (); CellRendererText renderer = new CellRendererText (); guestOsCombo.PackStart (renderer, false); guestOsCombo.AddAttribute (renderer, "text", 0); guestOsCombo.Changed += OnGuestOsChanged; devview = new DeviceView (); devview.RowActivated += delegate { OnConfigureDevice (this, new EventArgs ()); }; devview.Selection.Changed += OnDeviceSelectionChanged; devmodel = new DeviceModel (machine); devview.Model = devmodel; deviceContent.Add (devview); devview.Show (); addDeviceButton.Toggled += delegate { if (addDeviceButton.Active) { Menu popup = (Menu) ui.GetWidget ("/ui/AddDevicePopup"); popup.Unmapped += delegate { addDeviceButton.Active = false; }; popup.Popup (null, null, OnPopupPosition, 0, Gtk.Global.CurrentEventTime); } }; removeDeviceButton.Clicked += OnRemoveDevice; configureDeviceButton.Clicked += OnConfigureDevice; VBox.Add (configDialogContent); DefaultHeight = 400; int maxmem = Utility.GetHostMemorySize (); if (maxmem > 0) { memorySpin.SetRange (1.0, (double) (maxmem - 128)); } Load (); }