コード例 #1
0
        private void Init(string[] args)
        {
            Logger.Debug("Banter::Application::Init - called");
            initialized = false;
            Gtk.Application.Init();
            Catalog.Init("banter", Defines.GnomeLocaleDir);
            program =
                new Gnome.Program(
                    "banter",
                    Defines.Version,
                    Gnome.Modules.UI,
                    args);

            // Initialize the singleton classes to be used in the app
            PersonManager.Instance.Init();
            ChatWindowManager.Instance.Init();
            NotificationManager.Instance.Init();

            // Create and start up the Person Sync
            personSync = new PersonSync();
            personSync.Start();

            actionManager = new ActionManager();
            actionManager.LoadInterface();
            SetUpGlobalActions();

            // Initialize the Theme Manager
            // ThemeManager.Init ();

            application = this;

            groupWindows = new Dictionary <GroupWindow, GroupWindow> ();

            GLib.Idle.Add(InitializeIdle);
        }
コード例 #2
0
ファイル: Window.cs プロジェクト: MrJoe/lat
        public MainWindow(Gnome.Program mainProgram)
        {
            program = mainProgram;

            ui = new Glade.XML(null, "lat.glade", "mainWindow", null);
            ui.Autoconnect(this);

            // set window icon
            Global.latIcon = Gdk.Pixbuf.LoadFromResource("lat.png");
            Gdk.Pixbuf dirIcon = Gdk.Pixbuf.LoadFromResource("x-directory-remote-server.png");
            mainWindow.Icon = dirIcon;

            // Restore window positions
            LoadPreference(Preferences.MAIN_WINDOW_WIDTH);
            LoadPreference(Preferences.MAIN_WINDOW_X);
            LoadPreference(Preferences.MAIN_WINDOW_MAXIMIZED);
            LoadPreference(Preferences.MAIN_WINDOW_HPANED);

            // Watch for any changes
            Preferences.SettingChanged += OnPreferencesChanged;

            // Setup views
            viewsTreeView = new ViewsTreeView();
            viewsTreeView.ViewSelected += new ViewSelectedHandler(OnViewSelected);
            viewScrolledWindow.AddWithViewport(viewsTreeView);
            viewScrolledWindow.Show();

            // Setup browser
            ldapTreeView             = new LdapTreeView(mainWindow);
            ldapTreeView.dnSelected += new dnSelectedHandler(OnLdapDNSelected);
            browserScrolledWindow.AddWithViewport(ldapTreeView);
            browserScrolledWindow.Show();

            LoadPreference(Preferences.BROWSER_SELECTION);

            // Setup schema browser
            schemaTreeview = new SchemaTreeView(mainWindow);
            schemaTreeview.schemaSelected += new schemaSelectedHandler(OnSchemaDNSelected);
            schemaScrolledWindow.AddWithViewport(schemaTreeview);
            schemaScrolledWindow.Show();

            // Setup search
            searchTreeView = new SearchResultsTreeView();
            searchTreeView.SearchResultSelected += new SearchResultSelectedHandler(OnSearchSelected);
            searchTreeView.Export += OnSearchExport;

            resultsScrolledWindow.AddWithViewport(searchTreeView);
            resultsScrolledWindow.Show();

            // setup schema
            objRequiredStore          = new ListStore(typeof(string));
            objRequiredTreeview.Model = objRequiredStore;

            objOptionalStore          = new ListStore(typeof(string));
            objOptionalTreeview.Model = objOptionalStore;

            objRequiredTreeview.AppendColumn("Required Attributes", new CellRendererText(), "text", 0);
            objOptionalTreeview.AppendColumn("Optional Attributes", new CellRendererText(), "text", 0);

            infoVpaned1.Position = 150;

            ToggleButtons(false);
            ToggleInfoNotebook(false);

            templateToolButton.Hide();

            // setup menu
            newAccelGroup = new AccelGroup();
            mainWindow.AddAccelGroup(newAccelGroup);

            // status bar
            UpdateStatusBar();

#if ENABLE_NETWORKMANAGER
            Global.Network = NetworkDetect.Instance;
            Global.Network.StateChanged += OnNetworkStateChanged;
#endif

#if ENABLE_AVAHI
            // FIXME: causes delay/crashes on exit for some reason
            finder          = new ServiceFinder();
            finder.Found   += new FoundServiceEventHandler(OnServerFound);
            finder.Removed += new RemovedServiceEventHandler(OnServerRemoved);
            finder.Start();
#endif

            viewNotebook.SwitchPage += new SwitchPageHandler(OnNotebookViewChanged);

            if (Global.Connections.ConnectionNames.Length == 0)
            {
                new ConnectDialog();

                viewsTreeView.Refresh();
                ldapTreeView.Refresh();
                schemaTreeview.Refresh();
            }
        }
コード例 #3
0
ファイル: Frontend.cs プロジェクト: RoninBG/smuxi
        public static void Init(string[] args)
        {
            System.Threading.Thread.CurrentThread.Name = "Main";

            Assembly asm = Assembly.GetAssembly(typeof(Frontend));
            AssemblyName asm_name = asm.GetName(false);
            AssemblyProductAttribute pr = (AssemblyProductAttribute)asm.
                GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
            _Version = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();
            _VersionString = pr.Product + " - " + _UIName + " frontend " + _Version;

            #if LOG4NET
            _Logger.Info(_VersionString + " starting");
            #endif

            #if GTK_SHARP_2_8 || GTK_SHARP_2_10
            if (!GLib.Thread.Supported) {
                GLib.Thread.Init();
            }
            _UIThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;
            #else
            // with GTK# 2.8 we can do this better, see above
            // GTK# 2.7.1 for MS .NET doesn't support that though.
            if (Type.GetType("Mono.Runtime") == null) {
                // when we don't run on Mono, we need to initialize glib ourself
                GLib.Thread.Init();
            }
            #endif

            string appDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string localeDir = Path.Combine(appDir, "locale");
            if (!Directory.Exists(localeDir)) {
                localeDir = Path.Combine(Defines.InstallPrefix, "share");
                localeDir = Path.Combine(localeDir, "locale");
            }

            LibraryCatalog.Init("smuxi-frontend-gnome", localeDir);
            #if LOG4NET
            _Logger.Debug("Using locale data from: " + localeDir);
            #endif

            #if UI_GNOME
            _Program = new GNOME.Program(Name, Version.ToString(), GNOME.Modules.UI, args);
            #elif UI_GTK
            Gtk.Application.Init(Name, args);
            #endif
            #if GTK_SHARP_2_10
            GLib.ExceptionManager.UnhandledException += _OnUnhandledException;
            #endif
            //_SplashScreenWindow = new SplashScreenWindow();

            _FrontendConfig = new FrontendConfig(UIName);
            // loading and setting defaults
            _FrontendConfig.Load();
            _FrontendConfig.Save();

            Gtk.Window.DefaultIcon = new Gdk.Pixbuf(null, "icon.svg");

            _MainWindow = new MainWindow();

            #if GTK_SHARP_2_10
            _StatusIcon = new Gtk.StatusIcon();
            _StatusIcon.Visible = false;
            _StatusIcon.Pixbuf = new Gdk.Pixbuf(null, "icon.svg");
            _StatusIcon.Activate += delegate {
                try {
                    if (_StatusIcon.Blinking) {
                        _MainWindow.Present();
                        return;
                    }
                    _MainWindow.Visible = !_MainWindow.Visible;
                } catch (Exception ex) {
                    ShowException(ex);
                }
            };
            _StatusIcon.PopupMenu += OnStatusIconPopupMenu;
            _StatusIcon.Tooltip = "Smuxi";
            #endif

            if (String.IsNullOrEmpty((string) FrontendConfig["Engines/Default"])) {
                InitLocalEngine();
                ConnectEngineToGUI();
            } else {
                // there is a default engine set, means we want a remote engine
                //_SplashScreenWindow.Destroy();
                _SplashScreenWindow = null;
                ShowEngineManagerDialog();
            }

            if (_SplashScreenWindow != null) {
                _SplashScreenWindow.Destroy();
            }

            #if UI_GNOME
            _Program.Run();
            #if LOG4NET
            _Logger.Warn("_Program.Run() returned!");
            #endif
            #elif UI_GTK
            Gtk.Application.Run();
            #if LOG4NET
            _Logger.Warn("Gtk.Application.Run() returned!");
            #endif
            #endif
        }
コード例 #4
0
 public GnomeApplication(string app_name, string version, string [] args)
 {
     program = new Program(app_name, version, Gnome.Modules.UI, args);
 }
コード例 #5
0
ファイル: GnomeApplication.cs プロジェクト: tcausby/giver
		public GnomeApplication (string app_name, string version, string [] args)
		{
			program = new Program (app_name, version, Gnome.Modules.UI, args);
		}