Example #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();
        }
Example #2
0
 public override void Shutdown()
 {
     WindowMenuManager.UnwatchNote(Note);
     if (Note.HasWindow)
     {
         Note.Window.Hidden -= OnHidden;
         Note.Window.Shown  -= OnShown;
     }
 }
Example #3
0
 private void OnShown(object sender, EventArgs args)
 {
     WindowMenuManager.WatchNote(Note);
 }
Example #4
0
 private void OnHidden(object sender, EventArgs args)
 {
     WindowMenuManager.UnwatchNote(Note);
 }
Example #5
0
 public override void OnNoteOpened()
 {
     WindowMenuManager.WatchNote(Note);
     Note.Window.Hidden += OnHidden;
     Note.Window.Shown  += OnShown;
 }