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) { Core.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 { Core.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(); }