public Shell() : base("Mono Heap Profiler") { entries = new ActionEntry[] { new ActionEntry ("FileMenu", null, "_File", null, null, null), new ActionEntry ("OpenAction", Stock.Open, null, "<control>O", "Open a profile...", new EventHandler (OnOpen)), new ActionEntry ("QuitAction", Stock.Quit, null, "<control>Q", "Quit the application", delegate { Application.Quit (); }), }; DefaultSize = new Gdk.Size (700, 700); DeleteEvent += delegate { Application.Quit (); }; main_box = new VBox (false, 0); Add (main_box); shell_commands = new ActionGroup ("TestActions"); shell_commands.Add (entries); uim = new UIManager (); uim.AddWidget += delegate (object obj, AddWidgetArgs args) { args.Widget.Show (); main_box.PackStart (args.Widget, false, true, 0); }; uim.ConnectProxy += OnProxyConnect; uim.InsertActionGroup (shell_commands, 0); uim.AddUiFromResource ("shell-ui.xml"); AddAccelGroup (uim.AccelGroup); sb = new Statusbar (); main_box.PackEnd (sb, false, true, 0); pager = new ShellPager (this); main_box.PackEnd (pager, true, true, 0); }
public void Load() { ui_manager = Runtime.UIManager; ui_manager.InsertActionGroup(debug_actions, 0); merge_id = ui_manager.AddUiFromResource("DebugPluginMenus.xml"); }
public LocationsBox (Locations locations, UIManager uiManager) : this(new Builder("locations_box.ui")) { Locations = locations; // create the actions Gtk.Action create = new Gtk.Action("createLocation","Create Location","",Stock.Add); create.Activated += OnCreateLocation; Gtk.Action delete = new Gtk.Action("deleteLocation","Delete Location","",Stock.Remove); delete.Activated += OnDeleteLocation; Gtk.Action gotoItem = new Gtk.Action("gotoLocationItem","Goto Item","",Stock.GoForward); gotoItem.Activated += OnGotoLocationItem; Gtk.Action action = new Gtk.Action("location","Location"); ActionGroup group = new ActionGroup("location"); group.Add(create); group.Add(delete); group.Add(gotoItem); group.Add(action); uiManager.InsertActionGroup(group,0); // create item column with id TreeViewColumn col = new TreeViewColumn (); locationsItemColumn = col; col.Title = "Item"; col.Expand = true; CellRenderer render; render = new CellRendererPixbuf (); col.PackStart (render, false); col.AddAttribute (render, "pixbuf", 1); render = new CellRendererText (); (render as CellRendererText).Editable = true; render.EditingStarted += OnStartLocationItemEdit; col.PackStart (render, true); col.AddAttribute (render, "text", 2); locationsView.AppendColumn(col); locationsView.AppendColumn ("ID", new Gtk.CellRendererText (), "text", 3); // create the labeled column col = new TreeViewColumn (); col.Title = "Labeled"; render = new CellRendererToggle (); (render as CellRendererToggle).Toggled += OnLabeledToggle; col.PackStart (render, false); col.AddAttribute (render, "active", 4); col.AddAttribute (render, "activatable", 5); locationsView.AppendColumn(col); // create the amount column col = new TreeViewColumn (); col.Title = "Amount"; render = new CellRendererSpin (); (render as CellRendererText).Editable = true; (render as CellRendererText).Edited += OnAmountEdited; Adjustment adj = new Adjustment(0, 0, 0, 0, 0, 0); //set all limits etc to 0 adj.Upper = 1000000000; // assign some special values, that aren't 0 adj.PageIncrement = 10; adj.StepIncrement = 1; (render as CellRendererSpin).Adjustment = adj; col.PackStart (render, false); col.AddAttribute (render, "text", 6); locationsView.AppendColumn (col); //set model etc locations.CollectionChanged += OnLocationCreation; TreeModelFilter filter = new LocationsFilter ( new LocationsModel( locations )); filter.Model.RowInserted += OnRowInserted; filter.VisibleFunc = new TreeModelFilterVisibleFunc (FilterLocations); locationsView.Model = filter; locationsView.Reorderable = true; // create the items chooser completion locationCompletion = new LocationItemChooser(); TreeModel compModel = new TreeModelAdapter( new ItemsModel(locations.Inventory.Items)); locationCompletion.Model = compModel; locationCompletion.MatchFunc = LocationItemCompletionMatch; locationCompletion.MinimumKeyLength = 0; // add the item info cell renderer to the completion render = new CellRendererText (); locationCompletion.PackStart (render, true); locationCompletion.AddAttribute (render, "text", 2); // create the popups uiManager.AddUiFromResource("locations_box_menues.xml"); locationPopup = (Menu) uiManager.GetWidget("/locationPopup"); }
/// <summary> /// Sets up the UI elements using the UI manager and connecting /// the events. /// </summary> private UIManager SetupUI() { // Set up our action entries ActionEntry[] entries = new ActionEntry[] { new ActionEntry("FileMenu", null, "_File", null, null, null), new ActionEntry("Reload", null, "Re_load", "<control>R", "Reload", new EventHandler(OnReload)), new ActionEntry("ZoomIn", null, "Zoom _In", "<control>I", "Zoom In", new EventHandler(OnZoomIn)), new ActionEntry("ZoomOut", null, "Zoom _Out", "<control>O", "Zoom Out", new EventHandler(OnZoomOut)), new ActionEntry("ZoomReset", null, "Zoom _Reset", "<control>0", "Zoom Reset", new EventHandler(OnZoomReset)), new ActionEntry("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler(OnDelete)), }; ActionGroup actions = new ActionGroup("group"); actions.Add(entries); // Create the UI to populate data uim = new UIManager(); uim.InsertActionGroup(actions, 0); AddAccelGroup(uim.AccelGroup); uim.AddUiFromResource("ui.xml"); // Return the results return uim; }
public void ShowWindow () { Application.Init (); gxml = new Glade.XML ("contactviewer.glade", "MainWindow"); gxml.Autoconnect (this); ActionEntry[] entries = new ActionEntry [] { new ActionEntry ("FileMenuAction", null, "_File", null, null, null), new ActionEntry ("OpenAction", Gtk.Stock.Open, "_Open", "<control>O", Catalog.GetString ("Open..."), new EventHandler (OnOpenDatabase)), new ActionEntry ("QuitAction", Gtk.Stock.Quit, "_Quit", "<control>Q", Catalog.GetString ("Quit"), new EventHandler (OnQuit)), new ActionEntry ("HelpMenuAction", null, "_Help", null, null, null), new ActionEntry ("AboutAction", Gnome.Stock.About, "_About", null, Catalog.GetString ("About"), new EventHandler (OnAbout)) }; ActionGroup grp = new ActionGroup ("MainGroup"); grp.Add (entries); ui_manager = new UIManager (); ui_manager.InsertActionGroup(grp, 0); ui_manager.AddUiFromResource ("menu.xml"); MenubarHolder.Add (ui_manager.GetWidget ("/MainMenu")); // Fix the TreeView that will contain all contacts contact_store = new ListStore (typeof (string), typeof (string)); ContactList.Model = contact_store; ContactList.RulesHint = true; ContactList.AppendColumn (Catalog.GetString ("Contacts"), new CellRendererText (), "text", 1); ContactList.ButtonReleaseEvent += OnContactSelected; // This ListStore will let the user choose what to see in the contact list contact_show_type_store = new ListStore (typeof (string), typeof (string)); contact_show_type_store.AppendValues ("DisplayName", Catalog.GetString ("Display name")); contact_show_type_store.AppendValues ("PrimaryEmail", Catalog.GetString ("Primary E-mail")); contact_show_type_store.AppendValues ("SecondEmail", Catalog.GetString ("Secondary E-mail")); contact_show_type_store.AppendValues ("NickName", Catalog.GetString ("Nickname")); CellRendererText cell = new CellRendererText (); ListIdentifier.PackStart (cell, false); ListIdentifier.AddAttribute (cell, "text", 1); ListIdentifier.Model = contact_show_type_store; ListIdentifier.Active = 0; ListIdentifier.Changed += OnContactListTypeChanged; MainWindow.Icon = Beagle.Images.GetPixbuf ("contact-icon.png"); MainWindow.DeleteEvent += OnDeleteEvent; LoadDatabase (); Application.Run (); }
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 (); }
public Window(Inventory inventory) : this(new Builder("window.ui")) { Inventory = inventory; // load the menues and toolbars uiManager = new UIManager(); // create the file actions Gtk.Action saveInventoryAction = new Gtk.Action("saveFile","Save","Save the active inventory",Stock.Save); saveInventoryAction.Activated += OnSaveInventory; Gtk.Action printLabelsAction = new Gtk.Action("printLabels","Print Labels","Print labels for items.",Stock.Print); printLabelsAction.Activated += OnPrintLabels; Gtk.Action quitAction = new Gtk.Action("quit","Quit","Quit the application",Stock.Quit); quitAction.Activated += OnQuit; Gtk.Action fileAction = new Gtk.Action("file","File"); ActionGroup fileActionGroup = new ActionGroup("file"); fileActionGroup.Add(saveInventoryAction); fileActionGroup.Add(printLabelsAction); fileActionGroup.Add(quitAction); fileActionGroup.Add(fileAction); uiManager.InsertActionGroup(fileActionGroup,0); // create items box itemsBox = new ItemsBox(inventory.Items, uiManager); itemsBox.DrawDescriptionEntry += OnDrawDescriptionEntry; itemsBox.ShowMe += OnShowItemsBox; itemsAlign.Add(itemsBox); // create locations box locationsBox = new LocationsBox(inventory.Locations, uiManager); locationsBox.DrawDescriptionEntry += OnDrawDescriptionEntry; locationsBox.ShowMe += OnShowLocationsBox; locationsBox.GotoItem += OnGotoLocationsItem; locationsAlign.Add(locationsBox); // create tags box tagsBox = new TagsBox(inventory.Tags, uiManager); tagsBox.ShowMe += OnShowTagsBox; tagsAlign.Add(tagsBox); // create tool and menubar uiManager.AddUiFromResource("window_menues.xml"); menuBar = (MenuBar) uiManager.GetWidget("/menuBar"); toolbar = (Toolbar) uiManager.GetWidget("/toolbar"); toolbar.IconSize = IconSize.LargeToolbar; toolbar.ToolbarStyle = ToolbarStyle.Both; mainBox.PackStart(menuBar,false,true,0); mainBox.PackStart(toolbar,false,true,0); // laod category icons itemsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).ItemsTabIcon; locationsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).LocationsTabIcon; tagsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).TagsTabIcon; this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon; this.Resize(((GtkSettings)Inventory.Settings).MainWindowWidth,((GtkSettings)Inventory.Settings).MainWindowHeight); }
public ItemEditBox (Items items, UIManager uiManager) : this(new Builder("item_edit_box.ui")) { Items = items; // create image the actions Gtk.Action addImageAction = new Gtk.Action("addImage","Add Image...","",Stock.Open); addImageAction.Activated += OnAddItemImage; Gtk.Action removeImageAction = new Gtk.Action("removeImage","Remove Image","",Stock.Remove); removeImageAction.Activated += OnRemoveItemImage; Gtk.Action imageAction = new Gtk.Action("itemImage","Image"); ActionGroup imageActionGroup = new ActionGroup("itemImage"); imageActionGroup.Add(addImageAction); imageActionGroup.Add(removeImageAction); imageActionGroup.Add(imageAction); uiManager.InsertActionGroup(imageActionGroup,0); // create the tag actions Gtk.Action addTagAction = new Gtk.Action("addTag","Add Tag","",Stock.Add); addTagAction.Activated += OnAddItemTag; Gtk.Action removeTagAction = new Gtk.Action("removeTag","Remove Tag","",Stock.Remove); removeTagAction.Activated += OnRemoveItemTag; Gtk.Action tagAction = new Gtk.Action("itemTag","Tag"); ActionGroup tagActionGroup = new ActionGroup("itemTag"); tagActionGroup.Add(addTagAction); tagActionGroup.Add(removeTagAction); tagActionGroup.Add(tagAction); uiManager.InsertActionGroup(tagActionGroup,0); // add columns to the item type combobox CellRenderer render = new CellRendererText (); itemEditType.PackStart(render, true); itemEditType.AddAttribute(render, "text", 0); // add columns and model to the depreciation combobox render = new CellRendererPixbuf (); itemEditDepreciationMethod.PackStart(render, false); itemEditDepreciationMethod.AddAttribute(render, "pixbuf", 0); render = new CellRendererText (); itemEditDepreciationMethod.PackStart(render, true); itemEditDepreciationMethod.AddAttribute(render, "text", 1); ListStore list = new ListStore(typeof(Gdk.Pixbuf),typeof(string),typeof(DepreciationMethod)); list.AppendValues(new Gdk.Pixbuf(null,"degressive.png"),"Degressive",DepreciationMethod.Degressive); list.AppendValues(new Gdk.Pixbuf(null,"linear.png"),"Linear",DepreciationMethod.Linear); list.AppendValues(new Gdk.Pixbuf(null,"progressive.png"),"Progressive",DepreciationMethod.Progressive); itemEditDepreciationMethod.Model = list; // add columns and model to the label combobox render = new CellRendererPixbuf (); itemEditLabelMethod.PackStart(render, false); itemEditLabelMethod.AddAttribute(render, "pixbuf", 0); render = new CellRendererText (); itemEditLabelMethod.PackStart(render, true); itemEditLabelMethod.AddAttribute(render, "text", 1); list = new ListStore(typeof(Gdk.Pixbuf),typeof(string),typeof(DepreciationMethod)); list.AppendValues(null,"Not Labelable",LabelMethod.None); list.AppendValues(null,"Printed Labels",LabelMethod.Print); list.AppendValues(null,"Painted Labels",LabelMethod.Paint); itemEditLabelMethod.Model = list; purchaseDatePicker = new PurchaseDatePicker(); purchaseDatePicker.DateChanged += OnPickerDateChanged; itemEditShowCalendarIcon.Pixbuf = new Gdk.Pixbuf(null,"calendar.png"); // create the images columns TreeViewColumn col = new TreeViewColumn (); col.Title = "images"; render = new CellRendererToggle (); (render as CellRendererToggle).Toggled += OnMainImageToggle; (render as CellRendererToggle).Radio = true; col.PackStart(render, false); col.AddAttribute(render, "active", 1); render = new CellRendererPixbuf (); col.PackStart (render, false); col.AddAttribute(render, "pixbuf", 2); render = new CellRendererText (); (render as CellRendererText).Editable = true; (render as CellRendererText).Edited += OnItemImageMemoEdited; render.EditingStarted += OnItemImageMemoEditingStarted; col.PackStart (render, true); col.AddAttribute(render, "text", 3); col.AddAttribute(render, "foreground-gdk",4); itemEditImages.AppendColumn(col); itemEditImages.HeadersVisible = false; TargetEntry target = new TargetEntry("text/plain",TargetFlags.OtherApp,0); TargetEntry[] targetArray = new TargetEntry[1]; targetArray[0] = target; itemEditImages.EnableModelDragDest(targetArray, Gdk.DragAction.Copy); itemEditImages.DragDataReceived += OnItemImageDragDataReceived; // create the tags cells render = new CellRendererText (); itemEditTagCell = render; (render as CellRendererText).Editable = true; (render as CellRendererText).Edited += OnItemTagNameEdited; render.EditingStarted += OnStartItemTagEdit; itemEditTags.PackStart (render, false); itemEditTags.AddAttribute(render, "text", 1); // create the tag completion itemTagCompletion = new ItemTagChooser(); itemTagCompletion.MatchFunc = ItemTabCompletionMatch; itemTagCompletion.MinimumKeyLength = 0; itemTagCompletion.PopupSetWidth = false; render = new CellRendererText (); itemTagCompletion.PackStart (render, true); itemTagCompletion.AddAttribute(render, "text", 1); // create the popup menues uiManager.AddUiFromResource("item_edit_box_menues.xml"); itemImagePopup = (Menu) uiManager.GetWidget("/itemImagePopup"); itemTagPopup = (Menu) uiManager.GetWidget("/itemTagPopup"); }
public MainWindow() : base("Virtual Machine Manager") { IconThemeUtils.SetWindowIcon (this); manager = new VirtualMachineManager (); controller = new MainController (); controller.MainWindow = this; controller.Manager = manager; Glade.XML xml = new Glade.XML ("vmx-manager.glade", "mainContent"); xml.Autoconnect (this); noMachinesWidget = new Viewport (); noMachinesWidget.ShadowType = ShadowType.None; MessagePane pane = new MessagePane (); pane.HeaderIcon = IconThemeUtils.LoadIcon (48, "face-surprise", Stock.DialogInfo); pane.HeaderMarkup = Catalog.GetString ("<b>There are currently no virtual machines.</b>"); pane.Append (Catalog.GetString ("You can add or create a new virtual machine using the buttons on the left"), false); pane.Show (); noMachinesWidget.Add (pane); vmview = new VMView (controller); controller.VMView = vmview; vmmodel = new VMModel (manager); vmview.Model = vmmodel; treeContent.Add (vmview); Add (mainContent); ActionEntry[] actionList = { new ActionEntry ("Start", Stock.Execute, Catalog.GetString ("Start Machine"), "<control>r", Catalog.GetString ("Start the virtual machine"), controller.OnStart), new ActionEntry ("Configure", Stock.Properties, Catalog.GetString ("Configure Machine"), "<control>p", Catalog.GetString ("Configure the connected devices"), controller.OnConfigure), new ActionEntry ("Remove", Stock.Remove, Catalog.GetString ("Remove Machine"), "<control>d", Catalog.GetString ("Remove the virtual machine"), controller.OnRemove), new ActionEntry ("CreateBlank", Stock.New, Catalog.GetString ("Create Blank Machine"), null, Catalog.GetString ("Create a new empty virtual machine"), controller.OnCreateBlank), new ActionEntry ("CreateFromIso", Stock.New, Catalog.GetString ("Create Machine From ISO"), null, Catalog.GetString ("Create a new machine which boots from a ISO"), controller.OnCreateFromIso), new ActionEntry ("AddMachine", Stock.Add, Catalog.GetString ("Add Existing Machine"), null, Catalog.GetString ("Add an existing virtual machine"), controller.OnAddExisting) }; actions = new ActionGroup ("VmxManager Actions"); actions.Add (actionList); ui = new UIManager (); ui.InsertActionGroup (actions, 0); ui.AddUiFromResource ("vmx-manager.xml"); havePlayer = Utility.CheckForPlayer (); if (!havePlayer) { HigMessageDialog dialog = new HigMessageDialog (this, DialogFlags.Modal, MessageType.Warning, ButtonsType.Close, Catalog.GetString ("VMware Player not found"), Catalog.GetString ("It will not be possible to run virtual machines.")); dialog.Run (); dialog.Destroy (); } SetActionsSensitive (); DefaultWidth = 600; DefaultHeight = 400; vmview.ButtonPressEvent += OnTreeButtonPress; startButton.Clicked += controller.OnStart; configureButton.Clicked += controller.OnConfigure; removeButton.Clicked += controller.OnRemove; createBlankButton.Clicked += controller.OnCreateBlank; createFromIsoButton.Clicked += controller.OnCreateFromIso; addExistingButton.Clicked += controller.OnAddExisting; vmview.Selection.Changed += delegate { SetActionsSensitive (); }; vmview.Model.RowInserted += delegate { SetActionsSensitive (); }; vmview.Model.RowDeleted += delegate { SetActionsSensitive (); }; foreach (VirtualMachine machine in manager.Machines) { machine.Started += OnMachineChanged; machine.Stopped += OnMachineChanged; } manager.Added += delegate (object o, VirtualMachineArgs args) { args.Machine.Started += OnMachineChanged; args.Machine.Stopped += OnMachineChanged; }; }
public void Initialize(UIManager uiManager) { m_mergeId = uiManager.AddUiFromResource ("Resources.main.ui"); }
/// <summary> /// Constructs the menu and related components. /// </summary> private Widget CreateMenu() { // Start by loading the UI from a resource UIManager ui = new UIManager(); ui.AddUiFromResource("Wordplay.menu.xml"); // Set up the actions ActionEntry[] entries = new[] { // "File" Menu new ActionEntry( "GameMenu", null, Translate("Menu/Game"), null, null, null), new ActionEntry( "NewGame", Stock.New, Translate("Menu/NewGame"), "<control>N", "New", OnNewGameAction), new ActionEntry( "ShuffleBoard", null, Translate("Menu/ShuffleBoard"), "<control>S", "Shuffle", OnShuffleBoardAction), new ActionEntry( "Preferences", null, Translate("Menu/Preferences"), "<control>P", "Preferences", OnPreferencesAction), new ActionEntry( "HighScores", null, Translate("Menu/HighScores"), "<control>H", "HighScores", OnHighScoresAction), new ActionEntry( "Quit", Stock.Quit, Translate("Menu/Quit"), "<control>Q", "Quit", OnQuitAction), }; // Install the actions ActionGroup actions = new ActionGroup("group"); actions.Add(entries); ui.InsertActionGroup(actions, 0); window.AddAccelGroup(ui.AccelGroup); // Construct the results return ui.GetWidget("/MenuBar"); }
public static void Main(string[] args) { /* Initialize our catalog */ // Catalog.Init (Defines.Name, Defines.LocaleDir); /* Process our args */ options = new GtkMeshworkOptions (); options.ProcessArgs (args); Common.SetProcessName("meshwork-gtk"); /* Initialize the GTK application */ Gtk.Application.Init(); if (!System.Diagnostics.Debugger.IsAttached) { /* If we crash, attempt to log the error */ GLib.ExceptionManager.UnhandledException += UnhandledGLibExceptionHandler; AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; } //XXX: Implement Gunique code here! splashWindow = new SplashWindow(); splashWindow.Show(); /* Load settings */ if (options.ConfigPath != null) { LoggingService.LogDebug("Using config dir: " + options.ConfigPath); Settings.OverrideConfigPath(options.ConfigPath); } tmpSettings = Settings.ReadSettings(); // First run, create initial settings. if (tmpSettings == null || !tmpSettings.HasKey) { tmpSettings = new Settings(); tmpSettings.NickName = Core.OS.UserName; tmpSettings.RealName = Core.OS.RealName; tmpSettings.IncompleteDownloadDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); tmpSettings.CompletedDownloadDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); tmpSettings.SetFirstRun(true); } /* Load Icons */ Gtk.Window.DefaultIconList = new Gdk.Pixbuf[] { new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.tray_icon.png") }; // Windows specific. Override stock icons to use embeded files. var sizes = new [] { 16, 22, 24, 34 }; var iconNames = new[] { "application-exit", "application-x-executable", "audio-x-generic", "computer", "dialog-error", "dialog-information", "dialog-password", "gtk-preferences", "dialog-question", "dialog-warning", "folder", "go-down", "go-home", "go-next", "go-previous", "go-up", "image-x-generic", "internet-group-chat", "list-add", "list-remove", "mail-attachment", "mail_generic", "mail-message-new", "mail-signed-verified", "network-transmit-receive", "stock_channel", "stock_internet", "system-search", "text-x-generic", "user-home", "video-x-generic", "view-refresh", "x-office-document" }; foreach (var size in sizes) { foreach (var iconName in iconNames) { if (Environment.OSVersion.Platform != PlatformID.Unix || !IconTheme.Default.HasIcon(iconName) || !IconTheme.Default.GetIconSizes(iconName).Contains(size)) { var pixbuf = Gui.LoadIconFromResource(iconName, size); if (pixbuf != null) Gtk.IconTheme.AddBuiltinIcon(iconName, size, pixbuf); else LoggingService.LogWarning("Missing embeded icon: {0} ({1}x{1})", iconName, size); } } } /* Set up UI actions */ builtin_actions = new BuiltinActionGroup (); ui_manager = new UIManager (); ui_manager.InsertActionGroup (builtin_actions, 0); ui_manager.AddUiFromResource ("FileFind.Meshwork.GtkClient.MainWindow.xml"); ui_manager.AddUiFromResource ("FileFind.Meshwork.GtkClient.TrayPopupMenu.xml"); ui_manager.AddUiFromResource ("FileFind.Meshwork.GtkClient.SearchPopupMenu.xml"); ui_manager.AddUiFromResource ("FileFind.Meshwork.GtkClient.MapPopupMenu.xml"); /* Create the Tray Icon */ trayIcon = new TrayIcon(); /* Start the event loop */ GLib.Idle.Add (new GLib.IdleHandler (FinishLoading)); Gtk.Application.Run (); }