Пример #1
0
        public virtual void StartMainLoop()
        {
            Gtk.UIManager uiManager = Tomboy.ActionManager.UI;

            ActionGroup mainMenuActionGroup = new ActionGroup("Mac");

            mainMenuActionGroup.Add(new ActionEntry [] {
                new ActionEntry("WindowMenuAction",
                                null,
                                // Translators: This is the name of "Window" menu in the Mac menubar
                                Catalog.GetString("_Window"),
                                null,
                                null,
                                null)
            });

            uiManager.AddUiFromString(osxMenuXml);
            uiManager.InsertActionGroup(mainMenuActionGroup, 1);

            Gtk.MenuShell mainMenu = uiManager.GetWidget("/MainWindowMenubar") as Gtk.MenuShell;
            mainMenu.Show();
            IgeMacMenu.MenuBar = mainMenu;
            WindowMenuManager.UpdateWindowMenu();

            Gtk.MenuItem about_item = uiManager.GetWidget("/MainWindowMenubar/HelpMenu/ShowAbout") as Gtk.MenuItem;
            Gtk.MenuItem prefs_item = uiManager.GetWidget("/MainWindowMenubar/EditMenu/ShowPreferences") as Gtk.MenuItem;
            Gtk.MenuItem quit_item  = uiManager.GetWidget("/MainWindowMenubar/FileMenu/QuitTomboy") as Gtk.MenuItem;

            (about_item.Child as Gtk.Label).Text = Catalog.GetString("About Tomboy");
            (prefs_item.Child as Gtk.Label).Text = Catalog.GetString("Preferences...");

            IgeMacMenuGroup about_group = IgeMacMenu.AddAppMenuGroup();
            IgeMacMenuGroup prefs_group = IgeMacMenu.AddAppMenuGroup();

            about_group.AddMenuItem(about_item, null);
            prefs_group.AddMenuItem(prefs_item, null);

            IgeMacMenu.QuitMenuItem = quit_item;

            IgeMacDock dock = new IgeMacDock();

            dock.Clicked += delegate(object sender, EventArgs args) {
                if (Tomboy.Tray.TomboyTrayMenu.Visible)
                {
                    Tomboy.Tray.TomboyTrayMenu.Hide();
                }
                else
                {
                    Tomboy.Tray.Tray.ShowMenu(false);
                }
            };
            dock.QuitActivate += delegate(object sender, EventArgs args) { Exit(0); };

            Tomboy.ActionManager ["CloseWindowAction"].Visible = false;

            Gtk.Application.Run();
        }
Пример #2
0
        public override void InitializeIdle()
        {
            ActionGroup mainMenuActionGroup = new ActionGroup("Main");

            mainMenuActionGroup.Add(new ActionEntry [] {
                new ActionEntry("FileMenuAction",
                                null,
                                Catalog.GetString("_File"),
                                null,
                                null,
                                null),
                new ActionEntry("WindowMenuAction",
                                null,
                                Catalog.GetString("_Window"),
                                null,
                                null,
                                null)
            });

            UIManager uiManager = Application.Instance.UIManager;

            uiManager.AddUiFromString(osxMenuXml);
            uiManager.InsertActionGroup(mainMenuActionGroup, 1);

            // This totally doesn't work...is my lib too old?
            IgeMacDock dock = new IgeMacDock();

            dock.Clicked      += delegate(object sender, EventArgs args) { TaskWindow.ShowWindow(); };
            dock.QuitActivate += delegate(object sender, EventArgs args) { Application.Instance.Quit(); };

            MenuShell mainMenu = uiManager.GetWidget("/MainMenu") as MenuShell;

            mainMenu.Show();
            IgeMacMenu.MenuBar = mainMenu;


            MenuItem about_item = uiManager.GetWidget("/TrayIconMenu/AboutAction") as MenuItem;
            MenuItem prefs_item = uiManager.GetWidget("/TrayIconMenu/PreferencesAction") as MenuItem;
            MenuItem quit_item  = uiManager.GetWidget("/TrayIconMenu/QuitAction") as MenuItem;


            IgeMacMenuGroup about_group = IgeMacMenu.AddAppMenuGroup();
            IgeMacMenuGroup prefs_group = IgeMacMenu.AddAppMenuGroup();

            about_group.AddMenuItem(about_item, null);
            prefs_group.AddMenuItem(prefs_item, null);

            IgeMacMenu.QuitMenuItem = quit_item;

            // Hide StatusIcon
            Application.Instance.Tray.Visible = false;
        }
Пример #3
0
        private void ConfigureOsxMainMenu()
        {
            IgeMacMenu.MenuBar = (MenuShell)interface_action_service.UIManager.GetWidget("/MainMenu");

            var ui = interface_action_service.UIManager;

            IgeMacMenu.QuitMenuItem = ui.GetWidget("/MainMenu/MediaMenu/Quit") as MenuItem;

            var group = IgeMacMenu.AddAppMenuGroup();

            group.AddMenuItem(ui.GetWidget("/MainMenu/HelpMenu/About") as MenuItem, null);
            group.AddMenuItem(ui.GetWidget("/MainMenu/EditMenu/Preferences") as MenuItem, null);
        }
 public override void RefreshMenu()
 {
     IgeMacMenu.Sync();
     if (menuItemSettings == null)
     {
         return;
     }
     menuItemSettings.Text = menuItemSettings.Translate();
     // GTK-OSX cannot translate top menus even with its Cocoa implementation, have to do it manually
     for (int i = 0; i < PresentationDomain.MainForm.MainMenu.Count; i++)
     {
         NSApplication.SharedApplication.MainMenu.ItemAt(i + 1).Submenu.Title = PresentationDomain.MainForm.MainMenu [i].Text;
     }
 }
Пример #5
0
        private void AdjustMainMenu()
        {
            UIManager ui = interface_action_service.UIManager;

            MenuItem about_item = ui.GetWidget("/MainMenu/HelpMenu/About") as MenuItem;
            MenuItem prefs_item = ui.GetWidget("/MainMenu/EditMenu/Preferences") as MenuItem;
            MenuItem quit_item  = ui.GetWidget("/MainMenu/MediaMenu/Quit") as MenuItem;

            IgeMacMenuGroup about_group = IgeMacMenu.AddAppMenuGroup();
            IgeMacMenuGroup prefs_group = IgeMacMenu.AddAppMenuGroup();

            IgeMacMenu.QuitMenuItem = quit_item;

            about_group.AddMenuItem(about_item, null);
            prefs_group.AddMenuItem(prefs_item, null);
        }
Пример #6
0
        void BuildMenu()
        {
#if MONOMAC
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                IgeMacMenu.GlobalKeyHandlerEnabled = true;

                //Tell the IGE library to use your GTK menu as the Mac main menu
                IgeMacMenu.MenuBar = this.menubar1;

                //tell IGE which menu item should be used for the app menu's quit item
                //IgeMacMenu.QuitMenuItem = yourQuitMenuItem;

                //add a new group to the app menu, and add some items to it
                var appGroup = IgeMacMenu.AddAppMenuGroup();
                appGroup.AddMenuItem(new MenuItem(), "About Pipeline...");

                //hide the menu bar so it no longer displays within the window
                menubar1.Hide();
                vbox2.Remove(menubar1);
            }
#endif
        }
Пример #7
0
        public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (chatViewManager == null)
            {
                throw new ArgumentNullException("chatViewManager");
            }

            Parent          = parent;
            MainWindow      = parent as MainWindow;
            ChatViewManager = chatViewManager;

            Build();

            // Smuxi Menu
            f_QuitAction.IconName = Gtk.Stock.Quit;

            // Chat
            f_JoinChatAction.IconName      = Gtk.Stock.Open;
            f_FindGroupChatAction.IconName = Gtk.Stock.Find;
            f_OpenLogAction.IconName       = Gtk.Stock.Open;
            f_CloseChatAction.IconName     = Gtk.Stock.Close;

            // Engine
            f_AddRemoteEngineAction.IconName    = Gtk.Stock.Add;
            f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh;

            // Toolbar
            f_ConnectToolAction.IconName       = Gtk.Stock.Network;
            f_OpenLogToolAction.IconName       = Gtk.Stock.Open;
            f_FindGroupChatToolAction.IconName = Gtk.Stock.Find;

            // disable the open log buttons initially as they will only be
            // enabled for chats that have a log file in
            // MainWindow.OnNotebookSwitchPage()
            f_OpenLogAction.Sensitive     = false;
            f_OpenLogToolAction.Sensitive = false;

            f_MenuToolbar.ShowAll();
            f_MenuToolbar.NoShowAll = true;
            f_MenuToolbar.Visible   = (bool)Frontend.FrontendConfig["ShowToolBar"];

            f_MenuBar.ShowAll();
            f_MenuBar.NoShowAll = true;
            f_MenuBar.Visible   = (bool)Frontend.FrontendConfig["ShowMenuBar"];

            JoinWidget            = new JoinWidget();
            JoinWidget.NoShowAll  = true;
            JoinWidget.Activated += OnJoinWidgetActivated;

            var joinToolItem = new Gtk.ToolItem();

            joinToolItem.Add(JoinWidget);
            f_JoinToolbar.Add(joinToolItem);
            f_JoinToolbar.ShowAll();
            f_JoinToolbar.NoShowAll = true;
            f_JoinToolbar.Visible   = f_MenuToolbar.Visible;

            f_ShowMenubarAction.Active   = (bool)Frontend.FrontendConfig["ShowMenuBar"];
            f_ShowToolbarAction.Active   = (bool)Frontend.FrontendConfig["ShowToolBar"];
            f_ShowStatusbarAction.Active = (bool)Frontend.FrontendConfig["ShowStatusBar"];

            if (Frontend.IsMacOSX)
            {
                try {
                    IgeMacMenu.GlobalKeyHandlerEnabled = true;
                    IgeMacMenu.MenuBar         = f_MenuBar;
                    f_ShowMenubarAction.Active = false;
                    // no need for the menu bar as have the app menu
                    f_ShowMenubarAction.Visible = false;

                    var appGroup = IgeMacMenu.AddAppMenuGroup();
                    appGroup.AddMenuItem(
                        (Gtk.MenuItem)f_AboutAction.CreateMenuItem(),
                        _("About Smuxi")
                        );
                    var prefItem = (Gtk.MenuItem)f_PreferencesAction.CreateMenuItem();
                    // TODO: add cmd+, accelerator
                    appGroup.AddMenuItem(prefItem, _("Preferences"));
                    IgeMacMenu.QuitMenuItem = (Gtk.MenuItem)
                                              f_QuitAction.CreateMenuItem();

                    // Smuxi menu is already shown as app menu
                    f_SmuxiAction.Visible = false;
                    // About item is already shown in app menu
                    f_AboutAction.Visible = false;
                } catch (EntryPointNotFoundException ex) {
                    f_Logger.Error("Failed to initialize mac menu integration, disabling mac menu integration", ex);
                }
            }
        }
        public static void Main()
        {
            Application.Init();
            if (!modFunctions.RunningLock())
            {
                return;
            }
            GLib.ExceptionManager.UnhandledException += unhandledException;
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(1033);
            if (CurrentOS.IsMac)
            {
                try
                {
                    string sOldConfig = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), modFunctions.CompanyName);
                    if (Directory.Exists(sOldConfig))
                    {
                        modFunctions.MoveDirectory(sOldConfig, Path.Combine(modFunctions.LocalAppData, modFunctions.CompanyName));
                        AppSettings cSettings = new AppSettings();
                        cSettings.HistoryDir = modFunctions.AppData;
                        cSettings.Save();
                        Directory.Delete(sOldConfig, true);
                    }
                }
                catch (Exception)
                {
                }
            }
            try
            {
                string sUpdatePath = Path.Combine(modFunctions.AppData, "Setup");
                if (CurrentOS.IsMac)
                {
                    sUpdatePath += ".dmg";
                }
                else if (CurrentOS.IsLinux)
                {
                    sUpdatePath += ".bz2.sh";
                }
                if (File.Exists(sUpdatePath))
                {
                    File.Delete(sUpdatePath);
                }
            }
            catch (Exception)
            {
            }
            fMain = new frmMain();
            if (CurrentOS.IsMac)
            {
                try
                {
                    ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
                    {
                        Application.Quit();
                        e.Handled = true;
                    };
                    ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e)
                    {
                        fMain.ShowFromTray();
                        e.Handled = true;
                    };
                    ApplicationEvents.Prefs += delegate(object sender, ApplicationEventArgs e)
                    {
                        fMain.cmdConfig_Click(new object(), new EventArgs());
                        e.Handled = true;
                    };
                }
                catch (Exception)
                {
                }
                bool bMenu = false;
                try
                {
                    IgeMacMenuGroup appGroup = IgeMacMenu.AddAppMenuGroup();
                    if (appGroup != null)
                    {
                        MenuItem mnuAbout = new MenuItem();
                        mnuAbout.Activated += delegate(object sender, EventArgs e)
                        {
                            fMain.cmdAbout_Click(new object(), new EventArgs());
                        };
                        appGroup.AddMenuItem(mnuAbout, "About " + modFunctions.ProductName);
                        appGroup.AddMenuItem(new MenuItem(), "-");
                        MenuItem mnuHistory = new MenuItem();
                        mnuHistory.Activated += delegate(object sender, EventArgs e)
                        {
                            fMain.cmdHistory_Click(new object(), new EventArgs());
                        };
                        appGroup.AddMenuItem(mnuHistory, "Usage History");
                        MenuItem mnuConfig = new MenuItem();
                        mnuConfig.Activated += delegate(object sender, EventArgs e)
                        {
                            fMain.cmdConfig_Click(new object(), new EventArgs());
                        };
                        appGroup.AddMenuItem(mnuConfig, "Preferences...");
                    }
                    MenuBar  srtMenu      = new MenuBar();
                    Menu     helpMenu     = new Menu();
                    MenuItem helpMenuItem = new MenuItem("Help");

                    MenuItem mnuFAQ = new MenuItem("Frequently Asked Questions");
                    mnuFAQ.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://srt.realityripple.com/faq.php");
                    };
                    helpMenu.Append(mnuFAQ);
                    mnuFAQ.Show();

                    MenuItem mnuChanges = new MenuItem("What's New in " + modFunctions.ProductName + " v" + modFunctions.ProductVersion);
                    mnuChanges.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/changes.php");
                    };
                    helpMenu.Append(mnuChanges);
                    mnuChanges.Show();

                    MenuItem mnuHelpSpace1 = new MenuItem("-");
                    helpMenu.Append(mnuHelpSpace1);
                    mnuHelpSpace1.Show();

                    MenuItem mnuWebsite = new MenuItem("Visit the " + modFunctions.ProductName + " Home Page");
                    mnuWebsite.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/mac.php");
                    };
                    helpMenu.Append(mnuWebsite);
                    mnuWebsite.Show();

                    MenuItem mnuBug = new MenuItem("Report a Bug");
                    mnuBug.Activated += delegate(object sender, EventArgs e)
                    {
                        System.Diagnostics.Process.Start("http://bugs.realityripple.com/bug_report_page.php?project_id=2");
                    };
                    helpMenu.Append(mnuBug);
                    mnuBug.Show();

                    helpMenuItem.Submenu = helpMenu;
                    helpMenu.Show();
                    srtMenu.Append(helpMenuItem);
                    helpMenuItem.Show();

                    IgeMacMenu.MenuBar = srtMenu;
                    srtMenu.Show();
                    bMenu = true;
                }
                catch (Exception)
                {
                }
                if (bMenu == false)
                {
                    try
                    {
                        MenuBar  srtMenu      = new MenuBar();
                        Menu     helpMenu     = new Menu();
                        MenuItem helpMenuItem = new MenuItem("Help");

                        MenuItem mnuFAQ = new MenuItem("Frequently Asked Questions");
                        mnuFAQ.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://srt.realityripple.com/faq.php");
                        };
                        helpMenu.Append(mnuFAQ);
                        mnuFAQ.Show();

                        MenuItem mnuChanges = new MenuItem("What's New in " + modFunctions.ProductName + " v" + modFunctions.ProductVersion);
                        mnuChanges.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/changes.php");
                        };
                        helpMenu.Append(mnuChanges);
                        mnuChanges.Show();

                        SeparatorMenuItem mnuHelpSpace1 = new SeparatorMenuItem();
                        helpMenu.Append(mnuHelpSpace1);
                        mnuHelpSpace1.Show();

                        MenuItem mnuWebsite = new MenuItem("Visit the " + modFunctions.ProductName + " Home Page");
                        mnuWebsite.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://srt.realityripple.com/For-MONO/mac.php");
                        };
                        helpMenu.Append(mnuWebsite);
                        mnuWebsite.Show();

                        MenuItem mnuBug = new MenuItem("Report a Bug");
                        mnuBug.Activated += delegate(object sender, EventArgs e)
                        {
                            System.Diagnostics.Process.Start("http://bugs.realityripple.com/bug_report_page.php?project_id=2");
                        };
                        helpMenu.Append(mnuBug);
                        mnuBug.Show();

                        helpMenuItem.Submenu = helpMenu;
                        helpMenu.Show();
                        srtMenu.Append(helpMenuItem);
                        helpMenuItem.Show();

                        GtkOSXApplication.MenuBar = srtMenu;
                        srtMenu.Show();

                        GtkMacMenuGroup appGroup = GtkOSXApplication.AddAppMenuGroup();
                        if (appGroup != null)
                        {
                            MenuItem mnuAbout = new MenuItem("About " + modFunctions.ProductName);
                            mnuAbout.Activated += delegate(object sender, EventArgs e)
                            {
                                fMain.cmdAbout_Click(new object(), new EventArgs());
                            };
                            appGroup.AddMenuItem(mnuAbout);
                            mnuAbout.Show();
                            SeparatorMenuItem mnuAppSpace1 = new SeparatorMenuItem();
                            appGroup.AddMenuItem(mnuAppSpace1);
                            mnuAppSpace1.Show();
                            MenuItem mnuHistory = new MenuItem("Usage History");
                            mnuHistory.Activated += delegate(object sender, EventArgs e)
                            {
                                fMain.cmdHistory_Click(new object(), new EventArgs());
                            };
                            appGroup.AddMenuItem(mnuHistory);
                            mnuHistory.Show();
                            MenuItem mnuConfig = new MenuItem("Preferences...");
                            mnuConfig.Activated += delegate(object sender, EventArgs e)
                            {
                                fMain.cmdConfig_Click(new object(), new EventArgs());
                            };
                            appGroup.AddMenuItem(mnuConfig);
                            mnuConfig.Show();
                            SeparatorMenuItem mnuAppSpace2 = new SeparatorMenuItem();
                            appGroup.AddMenuItem(mnuAppSpace2);
                            mnuAppSpace2.Show();
                        }
                        bMenu = true;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            fMain.Show();
            Application.Run();
        }