Esempio n. 1
0
        void ButtonPress(object sender, Gtk.ButtonPressEventArgs args)
        {
            Gtk.Widget parent = (Gtk.Widget)sender;

            switch (args.Event.Button)
            {
            case 1:
                manager.GtkInvoke(() => {
                    TomboyTrayUtils.UpdateTomboyTrayMenu(tray, parent);
                    GuiUtils.PopupMenu(tray.TomboyTrayMenu, args.Event);
                });
                args.RetVal = true;
                break;

            case 2:
                if ((bool)Preferences.Get(Preferences.ENABLE_ICON_PASTE))
                {
                    // Give some visual feedback
                    Gtk.Drag.Highlight(this);
                    manager.GtkInvoke(() => {
                        args.RetVal = PastePrimaryClipboard();
                    });
                    Gtk.Drag.Unhighlight(this);
                }
                break;
            }
        }
Esempio n. 2
0
        public TomboyPanelAppletEventBox(NoteManager manager)
            : base()
        {
            this.manager = manager;
            tray         = new TomboyTray(manager, this);

            // Load a 16x16-sized icon to ensure we don't end up with a
            // 1x1 pixel.
            panel_size = 16;
            // Load Icon to display in the panel.
            // First we try the "tomboy-panel" icon. This icon can be replaced
            // by the user's icon theme. If the theme does not have this icon
            // then we fall back to the Tomboy Menu icon named "tomboy".
            var icon = GuiUtils.GetIcon("tomboy-panel", panel_size) ??
                       GuiUtils.GetIcon("tomboy", panel_size);

            this.image = new Gtk.Image(icon);

            this.CanFocus          = true;
            this.ButtonPressEvent += ButtonPress;
            this.Add(image);
            this.ShowAll();

            string tip_text = TomboyTrayUtils.GetToolTipText();

            tips = new Gtk.Tooltips();
            tips.SetTip(this, tip_text, null);
            tips.Enable();
            tips.Sink();

            SetupDragAndDrop();
        }
Esempio n. 3
0
        public TomboyTrayIcon(NoteManager manager)
        {
            tray      = new TomboyTray(manager, this);
            keybinder = new TomboyPrefsKeybinder(manager, this);
            int panel_size = 22;

            // Load Icon to display in the notification area.
            // First we try the "tomboy-panel" icon. This icon can be replaced
            // by the user's icon theme. If the theme does not have this icon
            // then we fall back to the Tomboy Menu icon named "tomboy".
            Pixbuf = GuiUtils.GetIcon("tomboy-panel", panel_size) ??
                     GuiUtils.GetIcon("tomboy", panel_size);

            Tooltip = TomboyTrayUtils.GetToolTipText();

            Visible = (bool)Preferences.Get(Preferences.ENABLE_TRAY_ICON);
            Preferences.SettingChanged += (o, args) => {
                if (args.Key == Preferences.ENABLE_TRAY_ICON)
                {
                    Visible = (bool)args.Value;
                }
            };

            Tomboy.ExitingEvent += OnExit;
#if MAC
            Visible = false;
#endif
        }
Esempio n. 4
0
        public void ShowMenu(bool select_first_item)
        {
            manager.GtkInvoke(() => {
                TomboyTrayUtils.UpdateTomboyTrayMenu(tray, this);
                if (select_first_item)
                {
                    tray.TomboyTrayMenu.SelectFirst(false);
                }

                GuiUtils.PopupMenu(tray.TomboyTrayMenu, null);
            });
        }
Esempio n. 5
0
        public void ShowMenu(bool select_first_item)
        {
            if (context_menu != null)
            {
                context_menu.Hide();
            }

            tray.NoteManager.GtkInvoke(() => {
                TomboyTrayUtils.UpdateTomboyTrayMenu(tray, null);
                if (select_first_item)
                {
                    tray.TomboyTrayMenu.SelectFirst(false);
                }

                GuiUtils.PopupMenu(tray.TomboyTrayMenu, null,
                                   new Gtk.MenuPositionFunc(GetTrayMenuPosition));
            });
        }