コード例 #1
0
ファイル: SearchEntry.cs プロジェクト: SyaskiMasyaski/banshee
        public SearchEntry()
        {
            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    Menu.Append(item);
                }
            }

            SearchSensitive = true;
            Show();
        }
コード例 #2
0
        private void BuildHeader()
        {
            source_actions_align = new Gtk.Alignment(0f, .5f, 1f, 0f)
            {
                RightPadding = 0,
                LeftPadding  = 0,
                NoShowAll    = true
            };

            if (Hyena.PlatformDetection.IsMeeGo)
            {
                source_actions_align.RightPadding = 5;
                source_actions_align.TopPadding   = 5;
            }

            footer = new VBox();

            source_actions_box = new EventBox()
            {
                Visible = true
            };

            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    search_entry.Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    search_entry.Menu.Append(item);
                }
            }

            source_actions_box.ShowAll();
            source_actions_align.Add(source_actions_box);
            source_actions_align.Hide();
            search_entry.Show();


            context_pane = new Banshee.ContextPane.ContextPane();
            context_pane.ExpandHandler = b => {
                SetChildPacking(content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking(context_pane, b, b, 0, PackType.End);
            };

            // Top to bottom, their order is reverse of this:
            PackEnd(footer, false, false, 0);
            PackEnd(context_pane, false, false, 0);
            PackEnd(source_actions_align, false, false, 0);
            PackEnd(new ConnectedMessageBar(), false, true, 0);
        }
コード例 #3
0
 protected override void OnActivated()
 {
     base.OnActivated();
     Gtk.Action act = MainClass.MainWindow.EditorNotebook.EditorAction.GetAction("sourceeditor_nextbookmark");
     if (act != null)
     {
         act.Activate();
     }
 }
コード例 #4
0
        protected override void OnActivated()
        {
            base.OnActivated();

            //Console.WriteLine("Action ToggleBookmarkAction activated");
            Gtk.Action act = MainClass.MainWindow.EditorNotebook.EditorAction.GetAction("sourceeditor_prevbookmark");
            //Console.WriteLine("-----------");
            if (act != null)
            {
                //Console.WriteLine(act.Name);
                act.Activate();
                //Console.WriteLine("-----------");
            }
        }
コード例 #5
0
        public static ThumbnailToolbarButton CreateThumbnailToolbarButton(this Gtk.Action action,
                                                                          Func <Gtk.Action, System.Drawing.Icon> icon_callback)
        {
            var button = new ThumbnailToolbarButton(id++)
            {
                DismissOnClick = false,
                Tooltip        = action.Label.Replace("_", ""),
                Enabled        = action.Sensitive,
                Hidden         = !action.Visible,
                Icon           = icon_callback != null?icon_callback(action) : null
            };

            button.Clicked += (o, e) => action.Activate();

            action.AddNotification("icon-name", (o, args) => button.Icon    = icon_callback != null ? icon_callback(action) : null);
            action.AddNotification("stock-id", (o, args) => button.Icon     = icon_callback != null ? icon_callback(action) : null);
            action.AddNotification("tooltip", (o, args) => button.Tooltip   = action.Label.Replace("_", ""));
            action.AddNotification("sensitive", (o, args) => button.Enabled = action.Sensitive);
            action.AddNotification("visible", (o, args) => button.Hidden    = !action.Visible);

            return(button);
        }
コード例 #6
0
        /// <summary>
        /// Called when the <see cref="ActionManager"/> gets a key press and it passes
        /// it on to the current keybindings.
        /// </summary>
        /// <param name="e">The <see cref="Gtk.KeyPressEventArgs"/> instance
        /// containing the event data.</param>
        public void KeyPressed(KeyPressEventArgs e)
        {
            // Decompose the key into its components.
            ModifierType modifier;
            Key          key;

            GdkUtility.DecomposeKeys(e.Event, out key, out modifier);

            // Get the normalized string accelerator which we use for lookups.
            bool   isPartialAccelerator;
            string accelerator = GdkUtility.ToAcceleratorString(
                key, modifier, out isPartialAccelerator);

            if (isPartialAccelerator)
            {
                // If we are partial, just ignore it.
                return;
            }

            // Build a path with the current accelerator and the new one.
            var acceleratorPath = new HierarchicalPath(accelerator, currentAccelerator);

            // See if we have an accelerator for this path.
            if (!keybindings.Contains(acceleratorPath))
            {
                // Reset the current accelerator key.
                currentAccelerator = HierarchicalPath.AbsoluteRoot;

                // We couldn't find it so return false.
                e.RetVal = false;
                return;
            }

            // Grab the accelerator for this key. If we don't have an item, then
            // this is going to be a continued chain.
            string actionName = keybindings.Get(acceleratorPath);

            if (actionName == null)
            {
                // We are only the first part of an action chain.
                currentAccelerator = acceleratorPath;
                e.RetVal           = true;

                // TODO Fire an event to say incomplete accelerator.
                return;
            }

            // We have found a terminal action, so get the action involved.
            Action action = ActionManager.GetAction(actionName);

            if (action != null)
            {
                action.Activate();
                e.RetVal = true;
            }

            // Add it to the errors.
            ActionManager.Messages.Add(
                new SeverityMessage(
                    Severity.Error,
                    string.Format(
                        "Could not find action {0} to apply keybinding {1}.",
                        actionName,
                        acceleratorPath)));

            // We couldn't find the action so we did nothing.
            e.RetVal = false;
        }
コード例 #7
0
        private void BuildHeader()
        {
            header = new HBox();
            footer = new VBox();

            EventBox title_box = new EventBox();

            title_label           = new Label();
            title_label.Xalign    = 0.0f;
            title_label.Ellipsize = Pango.EllipsizeMode.End;

            title_box.Add(title_label);

            // Show the source context menu when the title is right clicked
            title_box.PopupMenu += delegate {
                ServiceManager.Get <InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate();
            };

            title_box.ButtonPressEvent += delegate(object o, ButtonPressEventArgs press) {
                if (press.Event.Button == 3)
                {
                    ServiceManager.Get <InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate();
                }
            };

            header_box = new EventBox();

            BuildSearchEntry();

            search_label = new Label(Catalog.GetString("_Search:"));
            search_label.MnemonicWidget = search_entry.InnerEntry;

            header.PackStart(title_box, true, true, 0);
            header.PackStart(header_box, false, false, 0);
            header.PackStart(search_label, false, false, 5);
            header.PackStart(search_entry, false, false, 0);

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    search_entry.Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    search_entry.Menu.Append(item);
                }
            }

            header.ShowAll();
            search_entry.Show();

            PackStart(header, false, false, 0);
            PackEnd(footer, false, false, 0);

            context_pane = new Banshee.ContextPane.ContextPane();
            context_pane.ExpandHandler = b => {
                SetChildPacking(content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking(context_pane, b, b, 0, PackType.End);
            };
            PackEnd(context_pane, false, false, 0);

            PackEnd(new ConnectedMessageBar(), false, true, 0);
        }