public override Gtk.MenuItem GetMenuItem ()
		{
			if (item == null)
				item = new Gtk.SeparatorMenuItem ();

			return item;
		}
Example #2
0
        public static void MakeMenuSeparator(Gtk.Menu menu)
        {
            var i = new Gtk.SeparatorMenuItem();

            menu.Append(i);
            i.Show();
        }
Example #3
0
        public override Gtk.MenuItem GetMenuItem()
        {
            if (item == null)
            {
                item = new Gtk.SeparatorMenuItem();
            }

            return(item);
        }
Example #4
0
 public override void Hook_Initialise(Forms.Main main)
 {
     _m = main;
     item = new Gtk.MenuItem("#pidgeon");
     item.Activated += new EventHandler(pidgeonToolStripMenuItem_Click);
     separator = new Gtk.SeparatorMenuItem();
     main.HelpMenu.Append(separator);
     main.HelpMenu.Append(item);
     separator.Show();
     item.Show();
     Core.DebugLog("Registered #pidgeon in menu");
 }
Example #5
0
 public override void Hook_BeforeTextMenu(Extension.ScrollbackArgs Args)
 {
     text = Args.scrollback.SelectedText;
     Gtk.SeparatorMenuItem xx = new Gtk.SeparatorMenuItem();
     xx.Show();
     Args.menu.Add(xx);
     Gtk.MenuItem wiki = new Gtk.MenuItem("Search using wiki");
     wiki.Activated += new EventHandler(SearchWiki);
     wiki.Show();
     Args.menu.Add(wiki);
     Gtk.MenuItem goog = new Gtk.MenuItem("Search using google");
     goog.Show();
     goog.Activated += new EventHandler(SearchGoogle);
     Args.menu.Add(goog);
 }
Example #6
0
        private bool AddRecursivelyAux(Gtk.MenuShell shell, List <MenuLayout> menus, BasicWidgetType type, ref Gtk.Widget widget, int level)
        {
            if (menus.Count <= 0)
            {
                return(false);
            }

            foreach (MenuLayout menu in menus)
            {
                Gtk.MenuItem menuitem = null;
                if (menu is MenuSeparator)
                {
                    menuitem = new Gtk.SeparatorMenuItem();
                    if (type == BasicWidgetType.ChildMenuSeparator)
                    {
                        widget = menuitem;
                    }
                }
                else
                {
                    menuitem = new Gtk.MenuItem(menu.Label);

                    Gtk.Menu menushell = new Gtk.Menu();
                    if (AddRecursivelyAux(menushell, menu.SubMenus, type, ref widget, level + 1))
                    {
                        menuitem.Submenu = menushell;
                        if ((widget == null) && (level == 0))
                        {
                            widget = menuitem;
                        }
                    }
                    else
                    {
                        if (widget == null && type == BasicWidgetType.ChildMenu)
                        {
                            widget = menuitem;
                        }
                    }
                }

                shell.Append(menuitem);
                menuitem.Show();
            }
            shell.ShowAll();
            return(true);
        }
Example #7
0
        void UpdateMenu()
        {
            //
            // Clear out the old list
            //
            foreach (Gtk.MenuItem oldItem in menu.Children)
            {
                menu.Remove(oldItem);
            }

            //
            // Build a new menu
            //

            // Add the "New Notebook..."
            Gtk.ImageMenuItem newNotebookMenuItem =
                new Gtk.ImageMenuItem(Catalog.GetString("_New notebook..."));
            newNotebookMenuItem.Image      = new Gtk.Image(NewNotebookIcon);
            newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
            newNotebookMenuItem.Show();
            menu.Append(newNotebookMenuItem);

            // Add the "(no notebook)" item at the top of the list
            NotebookMenuItem noNotebookMenuItem = new NotebookMenuItem(Note, null);

            noNotebookMenuItem.ShowAll();
            menu.Append(noNotebookMenuItem);

            // Add in all the real notebooks
            List <NotebookMenuItem> notebookMenuItems = GetNotebookMenuItems();

            if (notebookMenuItems.Count > 0)
            {
                Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem();
                separator.ShowAll();
                menu.Append(separator);

                foreach (NotebookMenuItem item in GetNotebookMenuItems())
                {
                    item.ShowAll();
                    menu.Append(item);
                }
            }
        }
Example #8
0
        protected override void OnPressed()
        {
            base.OnPressed();
            Gtk.Menu menu = new Gtk.Menu();
            foreach (ComboItemSet iset in items)
            {
                if (iset.Count == 0)
                {
                    continue;
                }

                if (menu.Children.Length > 0)
                {
                    Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem();
                    sep.Show();
                    menu.Insert(sep, -1);
                }

                Gtk.RadioMenuItem grp = new Gtk.RadioMenuItem("");
                foreach (ComboItem ci in iset)
                {
                    Gtk.RadioMenuItem mi = new Gtk.RadioMenuItem(grp, ci.Label.Replace("_", "__"));
                    if (ci.Item == iset.CurrentItem || ci.Item.Equals(iset.CurrentItem))
                    {
                        mi.Active = true;
                    }

                    ComboItemSet isetLocal = iset;
                    ComboItem    ciLocal   = ci;
                    mi.Activated += delegate
                    {
                        SelectItem(isetLocal, ciLocal);
                    };
                    mi.ShowAll();
                    menu.Insert(mi, -1);
                }
            }
            menu.Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime);
        }
        private void AddMenuItems(Gtk.Menu menu)
        {
            RemoveMenuItems(menu);

            NotebookNewNoteMenuItem item;

            Gtk.TreeModel model = NotebookManager.Notebooks;
            Gtk.TreeIter  iter;

            // Add in the "New Notebook..." menu item
            Gtk.ImageMenuItem newNotebookMenuItem =
                new Gtk.ImageMenuItem(Catalog.GetString("New Note_book..."));
            newNotebookMenuItem.Image      = new Gtk.Image(NewNotebookIcon);
            newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
            newNotebookMenuItem.ShowAll();
            menu.Append(newNotebookMenuItem);

            if (model.IterNChildren() > 0)
            {
                Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem();
                separator.ShowAll();
                menu.Append(separator);

                if (model.GetIterFirst(out iter) == true)
                {
                    do
                    {
                        Notebook notebook = model.GetValue(iter, 0) as Notebook;
                        item = new NotebookNewNoteMenuItem(notebook);
                        item.ShowAll();
                        menu.Append(item);
                    } while (model.IterNext(ref iter) == true);
                }
            }
#if MAC
            menu.ShowAll();
#endif
        }
Example #10
0
        void OnPopulatePopup(object sender, Gtk.PopulatePopupArgs args)
        {
            Gtk.TextIter click_iter = Buffer.GetIterAtMark(click_mark);
            NoteTag      url_tag    = Note.TagTable.UrlTag;

            if (click_iter.HasTag(url_tag) || click_iter.EndsTag(url_tag))
            {
                Gtk.MenuItem item;

                item = new Gtk.SeparatorMenuItem();
                item.Show();
                args.Menu.Prepend(item);

                item            = new Gtk.MenuItem(Catalog.GetString("_Copy Link Address"));
                item.Activated += CopyLinkActivate;
                item.Show();
                args.Menu.Prepend(item);

                item            = new Gtk.MenuItem(Catalog.GetString("_Open Link"));
                item.Activated += OpenLinkActivate;
                item.Show();
                args.Menu.Prepend(item);
            }
        }
Example #11
0
        void OnPopulatePopup(object sender, Gtk.PopulatePopupArgs args)
        {
            Gtk.TextIter click_iter = Buffer.GetIterAtMark(click_mark);
            TaskTag      task_tag   = (TaskTag)
                                      Buffer.GetDynamicTag("task", click_iter);

            if (task_tag == null)
            {
                return;
            }

            Gtk.MenuItem item;

            item = new Gtk.SeparatorMenuItem();
            item.Show();
            args.Menu.Prepend(item);

            item            = new Gtk.MenuItem(Catalog.GetString("Open To Do List"));
            item.Activated += OnOpenTaskListWindow;
            item.Show();
            args.Menu.Prepend(item);

            item            = new TaskMenuItem(task_tag.Uri, Catalog.GetString("To Do Options"));
            item.Activated += OnOpenTaskOptions;
            item.ShowAll();
            args.Menu.Prepend(item);

            item = new TaskMenuItem(
                task_tag.Uri,
                task_tag.CompletionDate == DateTime.MinValue ?
                Catalog.GetString("Mark Complete") :
                Catalog.GetString("Mark Undone"));
            item.Activated += OnToggleCompletionStatus;
            item.ShowAll();
            args.Menu.Prepend(item);
        }
Example #12
0
        public void AddRecentlyChangedNotes()
        {
            int min_size = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT);
            int max_size = (int)Preferences.Get(Preferences.MENU_MAX_NOTE_COUNT);

            if (max_size < min_size)
            {
                max_size = min_size;
            }
            int          list_size       = 0;
            bool         menuOpensUpward = tray.MenuOpensUpward();
            NoteMenuItem item;

            // Remove the old dynamic items
            RemoveRecentlyChangedNotes();

            // Assume menu opens downward, move common items to top of menu
            Gtk.MenuItem newNoteItem = Tomboy.ActionManager.GetWidget(
                "/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote") as Gtk.MenuItem;
            Gtk.MenuItem searchNotesItem = Tomboy.ActionManager.GetWidget(
                "/TrayIconMenu/ShowSearchAllNotes") as Gtk.MenuItem;
            tray_menu.ReorderChild(newNoteItem, 0);
            int insertion_point = 1;             // If menu opens downward

            // Find all child widgets under the TrayNewNotePlaceholder
            // element.  Make sure those added by add-ins are
            // properly accounted for and reordered.
            List <Gtk.Widget>  newNotePlaceholderWidgets = new List <Gtk.Widget> ();
            IList <Gtk.Widget> allChildWidgets           =
                Tomboy.ActionManager.GetPlaceholderChildren("/TrayIconMenu/TrayNewNotePlaceholder");

            foreach (Gtk.Widget child in allChildWidgets)
            {
                if (child is Gtk.MenuItem &&
                    child != newNoteItem)
                {
                    newNotePlaceholderWidgets.Add(child);
                    tray_menu.ReorderChild(child, insertion_point);
                    insertion_point++;
                }
            }

            tray_menu.ReorderChild(searchNotesItem, insertion_point);
            insertion_point++;

            DateTime days_ago = DateTime.Today.AddDays(-3);

            // Prevent template notes from appearing in the menu
            Tag template_tag = TagManager.GetOrCreateSystemTag(TagManager.TemplateNoteSystemTag);

            // List the most recently changed notes, any currently
            // opened notes, and any pinned notes...
            foreach (Note note in manager.Notes)
            {
                if (note.IsSpecial)
                {
                    continue;
                }

                // Skip template notes
                if (note.ContainsTag(template_tag))
                {
                    continue;
                }

                bool show = false;

                // Test for note.IsPinned first so that all of the pinned notes
                // are guaranteed to be included regardless of the size of the
                // list.
                if (note.IsPinned)
                {
                    show = true;
                }
                else if ((note.IsOpened && note.Window.IsMapped) ||
                         note.ChangeDate > days_ago ||
                         list_size < min_size)
                {
                    if (list_size <= max_size)
                    {
                        show = true;
                    }
                }

                if (show)
                {
                    item = new NoteMenuItem(note, true);
                    // Add this widget to the menu (+insertion_point to add after new+search+...)
                    tray_menu.Insert(item, list_size + insertion_point);
                    // Keep track of this item so we can remove it later
                    recent_notes.Add(item);

                    list_size++;
                }
            }

            Note start = manager.FindByUri(NoteManager.StartNoteUri);

            if (start != null)
            {
                item = new NoteMenuItem(start, false);
                if (menuOpensUpward)
                {
                    tray_menu.Insert(item, list_size + insertion_point);
                }
                else
                {
                    tray_menu.Insert(item, insertion_point);
                }
                recent_notes.Add(item);

                list_size++;

                bool enable_keybindings = (bool)
                                          Preferences.Get(Preferences.ENABLE_KEYBINDINGS);
                if (enable_keybindings)
                {
                    GConfKeybindingToAccel.AddAccelerator(
                        item,
                        Preferences.KEYBINDING_OPEN_START_HERE);
                }
            }


            // FIXME: Rearrange this stuff to have less wasteful reordering
            if (menuOpensUpward)
            {
                // Relocate common items to bottom of menu
                insertion_point -= 1;
                tray_menu.ReorderChild(searchNotesItem, list_size + insertion_point);
                foreach (Gtk.Widget widget in newNotePlaceholderWidgets)
                {
                    tray_menu.ReorderChild(widget, list_size + insertion_point);
                }
                tray_menu.ReorderChild(newNoteItem, list_size + insertion_point);
                insertion_point = list_size;
            }

            Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem();
            tray_menu.Insert(separator, insertion_point);
            recent_notes.Add(separator);
        }
Example #13
0
 private void ConstructSeparatorMenuItemFile1()
 {
     Debug.WriteLine("ConstructSeparatorMenuItemFile1");
     separatorMenuItemFile1 = new Gtk.SeparatorMenuItem
     {
         Visible = true,
     };
 }
        void Update(CommandInfo cmdInfo)
        {
            if (isArray && !isArrayItem)
            {
                this.Visible = false;
                CommandMenu menu = (CommandMenu) Parent;

                if (itemArray != null) {
                    foreach (Gtk.MenuItem item in itemArray)
                        menu.Remove (item);
                }

                itemArray = new ArrayList ();
                int i = Array.IndexOf (menu.Children, this);

                if (cmdInfo.ArrayInfo != null) {
                    foreach (CommandInfo info in cmdInfo.ArrayInfo) {
                        Gtk.MenuItem item;
                        if (info.IsArraySeparator) {
                            item = new Gtk.SeparatorMenuItem ();
                            item.Show ();
                        } else {
                            item = CommandEntry.CreateMenuItem (commandManager, commandId, false);
                            ICommandMenuItem mi = (ICommandMenuItem) item;
                            mi.SetUpdateInfo (info);
                        }
                        menu.Insert (item, ++i);
                        itemArray.Add (item);
                    }
                }
            }
            else {
                Gtk.AccelLabel child = (Gtk.AccelLabel)Child;
                if (child == null) return;
                child.Show ();
                child.Xalign = 0;
                if (cmdInfo.UseMarkup) {
                    child.Markup = cmdInfo.Text;
                    child.UseMarkup = true;
                } else {
                    child.Text = cmdInfo.Text;
                    child.UseMarkup = false;
                }
                child.UseUnderline = true;
                child.AccelWidget = this;
                this.Sensitive = cmdInfo.Enabled;
                this.Visible = cmdInfo.Visible;

                if (cmdInfo.AccelKey != null && cmdInfo.AccelKey != "")
                    this.AccelPath = commandManager.GetAccelPath (cmdInfo.AccelKey);

                if (cmdInfo.Icon != null && cmdInfo.Icon != "" && cmdInfo.Icon != lastIcon) {
                    Image = new Gtk.Image (cmdInfo.Icon, Gtk.IconSize.Menu);
                    lastIcon = cmdInfo.Icon;
                }
            }
        }
        public CueSheetsSource() : base(AddinManager.CurrentLocalizer.GetString("CueSheets"),
                                        AddinManager.CurrentLocalizer.GetString("CueSheets"),
                                                    //"cuesheets",
                                        sort_order) //,
            //"hod-cuesheets-2013-01-06")
        {
            Hyena.Log.Information("CueSheetsSouce init");

            DbConnection = ServiceManager.DbConnection;
            TM_Provider  = DatabaseTrackInfo.Provider;

            _track_info_db = new CS_TrackInfoDb(DbConnection);

            _sheet  = new CueSheet();
            _sheets = new CueSheetCollection();

            _view = new CueSheetsView(this);

            Properties.Set <ISourceContents> ("Nereid.SourceContents", _view);
            Properties.SetString("Icon.Name", "cueplay");
            Hyena.Log.Information("CueSheets source has been instantiated.");

            Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search albums and tracks"));

            try {
                Properties.SetString("GtkActionPath", "/CueSheetsPopup");
                _actions = new CS_Actions(this);
                Hyena.Log.Information(_actions.ToString());
            } catch (System.Exception ex) {
                Hyena.Log.Information(ex.ToString());
            }

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

            try {
                _track_search          = new Gtk.CheckButton("Search Tracks");
                _track_search.Clicked += delegate(object sender, EventArgs args) {
                    this.DoFilter();
                };
                Gtk.Toolbar header_toolbar = (Gtk.Toolbar)action_service.UIManager.GetWidget("/HeaderToolbar");
                int         i, N, k;
                for (i = 0, k = -1, N = header_toolbar.NItems; i < N; i++)
                {
                    Gtk.Widget w = header_toolbar.GetNthItem(i).Child;
                    if (w != null)
                    {
                        if (w.GetType() == typeof(Banshee.Gui.Widgets.ConnectedVolumeButton))
                        {
                            k = i;
                        }
                    }
                }
                if (k >= 0)
                {
                    Hyena.Log.Information("Toolitem itm");
                    Gtk.ToolItem itm = new Gtk.ToolItem();
                    Hyena.Log.Information("Add cbk");
                    itm.Add(_track_search);
                    Hyena.Log.Information("Insert cbk");
                    header_toolbar.Insert(itm, k);
                    itm.Show();
                }
            } catch (System.Exception ex) {
                Hyena.Log.Error(ex.ToString());
            }
            Gtk.Menu viewMenu = (action_service.UIManager.GetWidget("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu;
            _menuItem            = new Gtk.MenuItem(Catalog.GetString("_Change Album View"));
            _menuItem.Activated += delegate {
                _view.ToggleGrid();
            };
            viewMenu.Insert(_menuItem, 2);
            _sep = new Gtk.SeparatorMenuItem();
            viewMenu.Insert(_sep, 3);
        }
Example #16
0
	public static void MakeMenuSeparator (Gtk.Menu menu)
	{
		Gtk.SeparatorMenuItem i = new Gtk.SeparatorMenuItem ();
		menu.Append (i);
		i.Show ();
	}
		private void AddMenuItems (Gtk.Menu menu)
		{
			RemoveMenuItems (menu);			

			NotebookNewNoteMenuItem item;

			Gtk.TreeModel model = NotebookManager.Notebooks;
			Gtk.TreeIter iter;
			
			// Add in the "New Notebook..." menu item
			Gtk.ImageMenuItem newNotebookMenuItem =
				new Gtk.ImageMenuItem (Catalog.GetString ("New Note_book..."));
			newNotebookMenuItem.Image = new Gtk.Image (NewNotebookIcon);
			newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
			newNotebookMenuItem.ShowAll ();
			menu.Append (newNotebookMenuItem);
			
			if (model.IterNChildren () > 0) {
				Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem ();
				separator.ShowAll ();
				menu.Append (separator);
				
				if (model.GetIterFirst (out iter) == true) {
					do {
						Notebook notebook = model.GetValue (iter, 0) as Notebook;
						item = new NotebookNewNoteMenuItem (notebook);
						item.ShowAll ();
						menu.Append (item);
					} while (model.IterNext (ref iter) == true);
				}
			}
#if MAC
			menu.ShowAll ();
#endif
		}
		void UpdateMenu ()
		{
			//
			// Clear out the old list
			//
			foreach (Gtk.MenuItem oldItem in menu.Children) {
				menu.Remove (oldItem);
			}

			//
			// Build a new menu
			//
			
			// Add the "New Notebook..."
			Gtk.ImageMenuItem newNotebookMenuItem =
				new Gtk.ImageMenuItem (Catalog.GetString ("_New notebook..."));
			newNotebookMenuItem.Image = new Gtk.Image (NewNotebookIcon);
			newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
			newNotebookMenuItem.Show ();
			menu.Append (newNotebookMenuItem);
			
			// Add the "(no notebook)" item at the top of the list
			NotebookMenuItem noNotebookMenuItem = new NotebookMenuItem (Note, null);
			noNotebookMenuItem.ShowAll ();
			menu.Append (noNotebookMenuItem);
			
			// Add in all the real notebooks
			List<NotebookMenuItem> notebookMenuItems = GetNotebookMenuItems ();
			if (notebookMenuItems.Count > 0) {
				Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem ();
				separator.ShowAll ();
				menu.Append (separator);
				
				foreach (NotebookMenuItem item in GetNotebookMenuItems ()) {
					item.ShowAll ();
					menu.Append (item);
				}
			}
		}
Example #19
0
		public void AddRecentlyChangedNotes ()
		{
			int min_size = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT);
			int max_size = (int) Preferences.Get (Preferences.MENU_MAX_NOTE_COUNT);
			if (max_size < min_size)
				max_size = min_size;
			int list_size = 0;
			bool menuOpensUpward = tray.MenuOpensUpward ();
			NoteMenuItem item;

			// Remove the old dynamic items
			RemoveRecentlyChangedNotes ();

			// Assume menu opens downward, move common items to top of menu
			Gtk.MenuItem newNoteItem = Tomboy.ActionManager.GetWidget (
			                                   "/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote") as Gtk.MenuItem;
			Gtk.MenuItem searchNotesItem = Tomboy.ActionManager.GetWidget (
			                                       "/TrayIconMenu/ShowSearchAllNotes") as Gtk.MenuItem;
			tray_menu.ReorderChild (newNoteItem, 0);
			int insertion_point = 1; // If menu opens downward
			
			// Find all child widgets under the TrayNewNotePlaceholder
			// element.  Make sure those added by add-ins are
			// properly accounted for and reordered.
			List<Gtk.Widget> newNotePlaceholderWidgets = new List<Gtk.Widget> ();
			IList<Gtk.Widget> allChildWidgets =
				Tomboy.ActionManager.GetPlaceholderChildren ("/TrayIconMenu/TrayNewNotePlaceholder");
			foreach (Gtk.Widget child in allChildWidgets) {
				if (child is Gtk.MenuItem &&
				    child != newNoteItem) {
					newNotePlaceholderWidgets.Add (child);
					tray_menu.ReorderChild (child, insertion_point);
					insertion_point++;
				}
			}
			
			tray_menu.ReorderChild (searchNotesItem, insertion_point);
			insertion_point++;

			DateTime days_ago = DateTime.Today.AddDays (-3);
			
			// Prevent template notes from appearing in the menu
			Tag template_tag = TagManager.GetOrCreateSystemTag (TagManager.TemplateNoteSystemTag);

			// List the most recently changed notes, any currently
			// opened notes, and any pinned notes...
			foreach (Note note in manager.Notes) {
				if (note.IsSpecial)
					continue;
				
				// Skip template notes
				if (note.ContainsTag (template_tag))
					continue;

				bool show = false;

				// Test for note.IsPinned first so that all of the pinned notes
				// are guaranteed to be included regardless of the size of the
				// list.
				if (note.IsPinned) {
					show = true;
				} else if ((note.IsOpened && note.Window.IsMapped) ||
				                note.ChangeDate > days_ago ||
				                list_size < min_size) {
					if (list_size <= max_size)
						show = true;
				}

				if (show) {
					item = new NoteMenuItem (note, true);
					// Add this widget to the menu (+insertion_point to add after new+search+...)
					tray_menu.Insert (item, list_size + insertion_point);
					// Keep track of this item so we can remove it later
					recent_notes.Add (item);

					list_size++;
				}
			}

			Note start = manager.FindByUri (NoteManager.StartNoteUri);
			if (start != null) {
				item = new NoteMenuItem (start, false);
				if (menuOpensUpward)
					tray_menu.Insert (item, list_size + insertion_point);
				else
					tray_menu.Insert (item, insertion_point);
				recent_notes.Add (item);

				list_size++;
				
				bool enable_keybindings = (bool)
					                  Preferences.Get (Preferences.ENABLE_KEYBINDINGS);
				if (enable_keybindings)
					GConfKeybindingToAccel.AddAccelerator (
					        item,
					        Preferences.KEYBINDING_OPEN_START_HERE);
			}


			// FIXME: Rearrange this stuff to have less wasteful reordering
			if (menuOpensUpward) {
				// Relocate common items to bottom of menu
				insertion_point -= 1;
				tray_menu.ReorderChild (searchNotesItem, list_size + insertion_point);
				foreach (Gtk.Widget widget in newNotePlaceholderWidgets)
					tray_menu.ReorderChild (widget, list_size + insertion_point);
				tray_menu.ReorderChild (newNoteItem, list_size + insertion_point);
				insertion_point = list_size;
			}

			Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem ();
			tray_menu.Insert (separator, insertion_point);
			recent_notes.Add (separator);
		}
        //,
        //"hod-cuesheets-2013-01-06")
        public CueSheetsSource()
            : base(AddinManager.CurrentLocalizer.GetString ("CueSheets"),
                                          AddinManager.CurrentLocalizer.GetString ("CueSheets"),
		                                  //"cuesheets",
		                                  sort_order)
        {
            Hyena.Log.Information ("CueSheetsSouce init");

            DbConnection=ServiceManager.DbConnection;
            TM_Provider=DatabaseTrackInfo.Provider;

            _track_info_db=new CS_TrackInfoDb(DbConnection);

            _sheet=new CueSheet();
            _sheets=new CueSheetCollection();

            _view=new CueSheetsView(this);

            Properties.Set<ISourceContents> ("Nereid.SourceContents", _view);
            Properties.SetString ("Icon.Name", "cueplay");
            Hyena.Log.Information ("CueSheets source has been instantiated.");

            Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search albums and tracks"));

            try {
                Properties.SetString("GtkActionPath","/CueSheetsPopup");
                _actions = new CS_Actions (this);
                Hyena.Log.Information(_actions.ToString());
            } catch (System.Exception ex) {
                Hyena.Log.Information(ex.ToString ());
            }

            InterfaceActionService action_service = ServiceManager.Get<InterfaceActionService> ();
            try {
                _track_search=new Gtk.CheckButton("Search Tracks");
                _track_search.Clicked+=delegate(object sender,EventArgs args) {
                    this.DoFilter();
                };
                Gtk.Toolbar header_toolbar = (Gtk.Toolbar) action_service.UIManager.GetWidget ("/HeaderToolbar");
                int i,N,k;
                for(i=0,k=-1,N=header_toolbar.NItems;i<N;i++) {
                    Gtk.Widget w=header_toolbar.GetNthItem(i).Child;
                    if (w!=null) {
                        if (w.GetType()==typeof(Banshee.Gui.Widgets.ConnectedVolumeButton)) {
                            k=i;
                        }
                    }
                }
                if (k>=0) {
                    Hyena.Log.Information("Toolitem itm");
                    Gtk.ToolItem itm=new Gtk.ToolItem();
                    Hyena.Log.Information ("Add cbk");
                    itm.Add (_track_search);
                    Hyena.Log.Information ("Insert cbk");
                    header_toolbar.Insert (itm,k);
                    itm.Show ();
                }
            } catch (System.Exception ex) {
                Hyena.Log.Error (ex.ToString ());
            }
            Gtk.Menu viewMenu = (action_service.UIManager.GetWidget ("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu;
            _menuItem = new Gtk.MenuItem (Catalog.GetString ("_Change Album View"));
            _menuItem.Activated += delegate {
                _view.ToggleGrid();
            };
            viewMenu.Insert (_menuItem, 2);
            _sep=new Gtk.SeparatorMenuItem();
            viewMenu.Insert (_sep,3);
        }
Example #21
0
        private void ConvertAndAddMenuItem(System.Windows.Forms.ToolStripItem item,
                                           Gtk.MenuShell gtkMenuShell)
        {
            if (item is System.Windows.Forms.ToolStripMenuItem)
            {
                var winformMenuItem = item as System.Windows.Forms.ToolStripMenuItem;

                // windows forms use '&' for mneumonic, gtk uses '_'
                var gtkMenuItem = new Gtk.ImageMenuItem(winformMenuItem.Text.Replace("&", "_"));

                if (winformMenuItem.Image != null)
                {
                    MemoryStream memStream;
                    var          image = winformMenuItem.Image;
                    if (image.Width != 16 || image.Height != 16)
                    {
                        var newImage = ResizeImage(image, 16, 16);
                        memStream = new MemoryStream(newImage);
                    }
                    else
                    {
                        memStream = new MemoryStream();
                        image.Save(memStream, ImageFormat.Png);
                        memStream.Position = 0;
                    }
                    gtkMenuItem.Image = new Gtk.Image(memStream);
                }

                gtkMenuItem.TooltipText = winformMenuItem.ToolTipText;
                gtkMenuItem.Visible     = winformMenuItem.Visible;
                gtkMenuItem.Sensitive   = winformMenuItem.Enabled;

                gtkMenuItem.Activated += (sender, e) =>
                                         DBusBackgroundWorker.InvokeWinformsThread((Action)winformMenuItem.PerformClick);

                winformMenuItem.TextChanged +=
                    (sender, e) => DBusBackgroundWorker.InvokeGtkThread(() =>
                {
                    var label = gtkMenuItem.Child as Gtk.Label;
                    if (label != null)
                    {
                        label.Text = winformMenuItem.Text;
                    }
                }
                                                                        );
                winformMenuItem.EnabledChanged += (sender, e) =>
                                                  DBusBackgroundWorker.InvokeGtkThread
                                                      (() => gtkMenuItem.Sensitive = winformMenuItem.Enabled);
                winformMenuItem.VisibleChanged += (sender, e) =>
                                                  DBusBackgroundWorker.InvokeGtkThread
                                                      (() => gtkMenuItem.Visible = winformMenuItem.Visible);

                gtkMenuItem.Show();
                gtkMenuShell.Insert(gtkMenuItem,
                                    winformMenuItem.Owner.Items.IndexOf(winformMenuItem));

                if (winformMenuItem.HasDropDownItems)
                {
                    var subMenu = new Gtk.Menu();
                    foreach (System.Windows.Forms.ToolStripItem dropDownItem in
                             winformMenuItem.DropDownItems)
                    {
                        ConvertAndAddMenuItem(dropDownItem, subMenu);
                    }
                    gtkMenuItem.Submenu = subMenu;

                    winformMenuItem.DropDown.ItemAdded += (sender, e) =>
                                                          DBusBackgroundWorker.InvokeGtkThread
                                                              (() => ConvertAndAddMenuItem(e.Item, subMenu));
                }
            }
            else if (item is System.Windows.Forms.ToolStripSeparator)
            {
                var gtkSeparator = new Gtk.SeparatorMenuItem();
                gtkSeparator.Show();
                gtkMenuShell.Insert(gtkSeparator, item.Owner.Items.IndexOf(item));
            }
            else
            {
                Debug.Fail("Unexpected menu item");
            }
        }
Example #22
0
		void OnPopulatePopup (object sender, Gtk.PopulatePopupArgs args)
		{
			Gtk.TextIter click_iter = Buffer.GetIterAtMark (click_mark);
			TaskTag task_tag = (TaskTag)
			                   Buffer.GetDynamicTag ("task", click_iter);
			if (task_tag == null)
				return;

			Gtk.MenuItem item;

			item = new Gtk.SeparatorMenuItem ();
			item.Show ();
			args.Menu.Prepend (item);

			item = new Gtk.MenuItem (Catalog.GetString ("Open To Do List"));
			item.Activated += OnOpenTaskListWindow;
			item.Show ();
			args.Menu.Prepend (item);

			item = new TaskMenuItem (task_tag.Uri, Catalog.GetString ("To Do Options"));
			item.Activated += OnOpenTaskOptions;
			item.ShowAll ();
			args.Menu.Prepend (item);

			item = new TaskMenuItem (
			        task_tag.Uri,
			        task_tag.CompletionDate == DateTime.MinValue ?
			        Catalog.GetString ("Mark Complete") :
			        Catalog.GetString ("Mark Undone"));
			item.Activated += OnToggleCompletionStatus;
			item.ShowAll ();
			args.Menu.Prepend (item);
		}
Example #23
0
		void OnPopulatePopup (object sender, Gtk.PopulatePopupArgs args)
		{
			Gtk.TextIter click_iter = Buffer.GetIterAtMark (click_mark);
			NoteTag url_tag = Note.TagTable.UrlTag;
			if (click_iter.HasTag (url_tag) || click_iter.EndsTag (url_tag)) {
				Gtk.MenuItem item;

				item = new Gtk.SeparatorMenuItem ();
				item.Show ();
				args.Menu.Prepend (item);

				item = new Gtk.MenuItem (Catalog.GetString ("_Copy Link Address"));
				item.Activated += CopyLinkActivate;
				item.Show ();
				args.Menu.Prepend (item);

				item = new Gtk.MenuItem (Catalog.GetString ("_Open Link"));
				item.Activated += OpenLinkActivate;
				item.Show ();
				args.Menu.Prepend (item);
			}
		}
Example #24
0
		void Update (CommandInfo cmdInfo)
		{
			lastCmdInfo = cmdInfo;
			if (isArray && !isArrayItem) {
				this.Visible = false;
				Gtk.Menu menu = (Gtk.Menu) Parent;  
				
				if (itemArray != null) {
					foreach (Gtk.MenuItem item in itemArray)
						menu.Remove (item);
				}
				
				itemArray = new ArrayList ();
				int i = Array.IndexOf (menu.Children, this);
				
				if (cmdInfo.ArrayInfo != null) {
					foreach (CommandInfo info in cmdInfo.ArrayInfo) {
						Gtk.MenuItem item;
						if (info.IsArraySeparator) {
							item = new Gtk.SeparatorMenuItem ();
							item.Show ();
						} else {
							item = CommandEntry.CreateMenuItem (commandManager, commandId, false);
							ICommandMenuItem mi = (ICommandMenuItem) item; 
							mi.SetUpdateInfo (info, initialTarget);
						}
						menu.Insert (item, ++i);
						itemArray.Add (item);
					}
				}
			} else {
				Gtk.Widget child = Child;
				if (child == null)
					return;
				
				Gtk.Label accel_label = null;
				Gtk.Label label = null;
				
				if (!(child is Gtk.HBox)) {
					child = new Gtk.HBox (false, 0);
					accel_label = new Gtk.Label ("");
					accel_label.UseUnderline = false;
					accel_label.Xalign = 1.0f;
					accel_label.Show ();
					
					label = new Gtk.Label ("");
					label.UseUnderline = true;
					label.Xalign = 0.0f;
					label.Show ();
					
					((Gtk.Box) child).PackStart (label);
					((Gtk.Box) child).PackStart (accel_label);
					child.Show ();
					
					this.Remove (Child);
					this.Add (child);
				} else {
					accel_label = (Gtk.Label) ((Gtk.Box) child).Children[1];
					label = (Gtk.Label) ((Gtk.Box) child).Children[0];
				}
				
				if (cmdInfo.AccelKey != null)
					accel_label.Text = "    " + KeyBindingManager.BindingToDisplayLabel (cmdInfo.AccelKey, true);
				else
					accel_label.Text = String.Empty;
				
				if (cmdInfo.UseMarkup) {
					label.Markup = overrideLabel ?? cmdInfo.Text;
					label.UseMarkup = true;
				} else {
					label.Text = overrideLabel ?? cmdInfo.Text;
					label.UseMarkup = false;
				}
				
				label.UseUnderline = true;
				
				this.Sensitive = cmdInfo.Enabled;
				this.Visible = cmdInfo.Visible && (disabledVisible || cmdInfo.Enabled);
				
				if (!cmdInfo.Icon.IsNull && cmdInfo.Icon != lastIcon) {
					Image = new Gtk.Image (cmdInfo.Icon, Gtk.IconSize.Menu);
					lastIcon = cmdInfo.Icon;
				}
				
				if (cmdInfo is CommandInfoSet) {
					CommandInfoSet ciset = (CommandInfoSet) cmdInfo;
					Gtk.Menu smenu = new Gtk.Menu ();
					Submenu = smenu;
					foreach (CommandInfo info in ciset.CommandInfos) {
						Gtk.MenuItem item;
						if (info.IsArraySeparator) {
							item = new Gtk.SeparatorMenuItem ();
							item.Show ();
						} else {
							item = CommandEntry.CreateMenuItem (commandManager, commandId, false);
							ICommandMenuItem mi = (ICommandMenuItem) item; 
							mi.SetUpdateInfo (info, initialTarget);
						}
						smenu.Add (item);
					}
				}
			}			
		}
Example #25
0
        /// <summary>
        /// Creates a menu item for command.
        /// </summary>
        /// <param name="command">The command for which a menu item is to be created.</param>
        /// <param name="parentMenu">The menu to put the menu item into.</param>
        /// <param name="parentCommand">Parent command for the given command.</param>
        /// <param name="stockItem">If non-Zero, defines the stock item to use for the command.</param>
        /// <param name="menuItemType">A specific type of menu item to use.</param>
        /// <param name="stateData">If not <c>null</c>, state data for the menu item being created.</param>
        /// <returns>The menu item for the command.</returns>
        public static OSMenuItem CreateMenuItem(this VisualRelayCommand command, Gtk.MenuShell parentMenu, VisualRelayCommand parentCommand, Gtk.StockItem stockItem, System.Type menuItemType = null, object stateData = null)
        {
            var useDefaultMenuHandler = true;

            Gtk.MenuItem menuItemVisual;

            if (command.UniqueId == RootCommandGroup.MenuSeparatorCommand.UniqueId)
            {
                menuItemVisual        = new Gtk.SeparatorMenuItem();
                useDefaultMenuHandler = false;
            }
            else if (menuItemType == typeof(Gtk.CheckMenuItem))
            {
                var checkMenuItem = new Gtk.CheckMenuItem(command.MenuItemName);
                checkMenuItem.Active  = (bool)stateData;
                menuItemVisual        = checkMenuItem;
                useDefaultMenuHandler = false;
            }
            else if ((command.SmallIcon != null) || (stockItem.StockId != Gtk.StockItem.Zero.StockId))
            {
                if (stockItem.StockId == Gtk.StockItem.Zero.StockId)
                {
                    menuItemVisual = new Gtk.ImageMenuItem(command.MenuItemName)
                    {
                        Image = new Gtk.Image(command.SmallIcon)
                    };
                    if (Properties.Settings.Default.EnableMenuIcons)
                    {
                        // NOTE: This causes some internal errors if we try to draw stock items. So don't do it.
                        menuItemVisual.ExposeEvent += ImageMenuItemHackExposeEvent;
                    }
                }
                else
                {
                    menuItemVisual = new Gtk.ImageMenuItem(stockItem.StockId, null);
                }
            }
            else
            {
                menuItemVisual = new Gtk.MenuItem(command.MenuItemName);
            }

            menuItemVisual.Name = command.UniqueId;
            menuItemVisual.SetValue(CommandGroup.AttachedCommandPropertyName, command);
            var submenu = command.Visual.AsType <Gtk.Menu>();

            if ((submenu == null) && (parentMenu is Gtk.MenuBar) && command.Visual.IsEmpty)
            {
                submenu = new Gtk.Menu()
                {
                    Name = parentCommand.UniqueId
                };
                command.Visual = submenu;
            }
            menuItemVisual.Submenu = submenu;

            var insertLocation = FindInsertLocation(parentCommand, command, true);

            if ((insertLocation < 0) || (insertLocation >= parentMenu.Children.Length))
            {
                parentMenu.Append(menuItemVisual);
            }
            else
            {
                parentMenu.Insert(menuItemVisual, insertLocation);
            }

            if (useDefaultMenuHandler && (menuItemVisual.Submenu == null))
            {
                menuItemVisual.Activated += HandleCommand;
            }
            if (!string.IsNullOrEmpty(command.KeyboardShortcutKey))
            {
                command.AddAccelerator(menuItemVisual, command.GetAcceleratorKey());
            }
            menuItemVisual.ShowAll(); // because programmatically created, need to show
            ////DebugOutputIf(requiresParentCommand && (parentCommand.MenuItem.IsEmpty) && (parentCommand.Visual.IsEmpty), "Failed to create parent menu item for command: " + command.Name + "(" + command.UniqueId + ")");

            ////DebugOutputIf(requiresParentCommand && (parentCommand == null) && (parentCommand.Visual.IsEmpty), "No parent menu item for command: " + command.Name + "(" + command.UniqueId + ")");
            if (menuItemVisual != null)
            {
                var group = command.GetCommandGroup() as CommandGroup;
                if (group != null)
                {
                    var context = group.GetCommandContext(command, null);
                    menuItemVisual.SetValue(IFakeDependencyObjectHelpers.DataContextPropertyName, context);
                    group.AttachCanExecuteChangeHandler(command);
                }
            }
            return(menuItemVisual);
        }
Example #26
0
        void Update(CommandInfo cmdInfo)
        {
            if (lastCmdInfo != null)
            {
                lastCmdInfo.CancelAsyncUpdate();
                lastCmdInfo.Changed -= CommandInfoChanged;
            }
            lastCmdInfo          = cmdInfo;
            lastCmdInfo.Changed += CommandInfoChanged;

            if (isArray && !isArrayItem)
            {
                this.Visible = false;
                Gtk.Menu menu = (Gtk.Menu)Parent;

                if (itemArray != null)
                {
                    foreach (Gtk.MenuItem item in itemArray)
                    {
                        menu.Remove(item);
                    }
                }

                itemArray = new ArrayList();
                int i = Array.IndexOf(menu.Children, this);

                if (cmdInfo.ArrayInfo != null)
                {
                    foreach (CommandInfo info in cmdInfo.ArrayInfo)
                    {
                        Gtk.MenuItem item;
                        if (info.IsArraySeparator)
                        {
                            item = new Gtk.SeparatorMenuItem();
                            item.Show();
                        }
                        else
                        {
                            item = CommandEntry.CreateMenuItem(commandManager, commandId, false);
                            ICommandMenuItem mi = (ICommandMenuItem)item;
                            mi.SetUpdateInfo(info, initialTarget);
                        }
                        menu.Insert(item, ++i);
                        itemArray.Add(item);
                    }
                }
            }
            else
            {
                Gtk.Widget child = Child;
                if (child == null)
                {
                    return;
                }

                Gtk.Label accel_label = null;
                Gtk.Label label       = null;

                if (!(child is Gtk.HBox))
                {
                    child       = new Gtk.HBox(false, 0);
                    accel_label = new Gtk.Label("");
                    accel_label.UseUnderline = false;
                    accel_label.Xalign       = 1.0f;
                    accel_label.Show();

                    label = new Gtk.Label("");
                    label.UseUnderline = true;
                    label.Xalign       = 0.0f;
                    label.Show();

                    ((Gtk.Box)child).PackStart(label);
                    ((Gtk.Box)child).PackStart(accel_label);
                    child.Show();

                    this.Remove(Child);
                    this.Add(child);
                }
                else
                {
                    accel_label = (Gtk.Label)((Gtk.Box)child).Children[1];
                    label       = (Gtk.Label)((Gtk.Box)child).Children[0];
                }

                if (cmdInfo.AccelKey != null)
                {
                    accel_label.Text = "    " + KeyBindingManager.BindingToDisplayLabel(cmdInfo.AccelKey, true);
                }
                else
                {
                    accel_label.Text = String.Empty;
                }

                if (cmdInfo.UseMarkup)
                {
                    label.Markup    = overrideLabel ?? cmdInfo.Text;
                    label.UseMarkup = true;
                }
                else
                {
                    label.Text      = overrideLabel ?? cmdInfo.Text;
                    label.UseMarkup = false;
                }

                if (!string.IsNullOrEmpty(cmdInfo.Description) && label.TooltipText != cmdInfo.Description)
                {
                    label.TooltipText = cmdInfo.Description;
                }
                label.UseUnderline = true;

                this.Sensitive = cmdInfo.Enabled;
                this.Visible   = cmdInfo.Visible && (disabledVisible || cmdInfo.Enabled);

                if (!cmdInfo.Icon.IsNull && cmdInfo.Icon != lastIcon)
                {
                    Image    = new ImageView(cmdInfo.Icon, Gtk.IconSize.Menu);
                    lastIcon = cmdInfo.Icon;
                }

                if (cmdInfo is CommandInfoSet)
                {
                    CommandInfoSet ciset = (CommandInfoSet)cmdInfo;
                    Gtk.Menu       smenu = new Gtk.Menu();
                    Submenu = smenu;
                    foreach (CommandInfo info in ciset.CommandInfos)
                    {
                        Gtk.MenuItem item;
                        if (info.IsArraySeparator)
                        {
                            item = new Gtk.SeparatorMenuItem();
                            item.Show();
                        }
                        else
                        {
                            item = CommandEntry.CreateMenuItem(commandManager, commandId, false);
                            ICommandMenuItem mi = (ICommandMenuItem)item;
                            mi.SetUpdateInfo(info, initialTarget);
                        }
                        smenu.Add(item);
                    }
                }
            }
        }
Example #27
0
        private void CreateMenu(object o, Gtk.PopulatePopupArgs e)
        {
            CreatingMenu = true;
            Hooks._Scrollback.BeforeMenu(owner, this, e.Menu);
            Gtk.SeparatorMenuItem separator1 = new Gtk.SeparatorMenuItem();
            separator1.Show();
            e.Menu.Append(separator1);
            e.Menu.Append(new Gtk.SeparatorMenuItem());

            listAllChannelsToolStripMenuItem.Visible = (owner != null && owner._Network != null);

            // channels
            if (joinToolStripMenuItem.Visible)
            {
                Gtk.MenuItem join = new Gtk.MenuItem(joinToolStripMenuItem.Text);
                join.Show();
                join.Activated += new EventHandler(joinToolStripMenuItem_Click);
                e.Menu.Append(join);
                Gtk.SeparatorMenuItem separator6 = new Gtk.SeparatorMenuItem();
                separator6.Show();
                e.Menu.Append(separator6);
            }

            if (openLinkInBrowserToolStripMenuItem.Visible)
            {
                Gtk.MenuItem copylink = new Gtk.MenuItem(copyLinkToClipboardToolStripMenuItem.Text);
                copylink.Show();
                copylink.Activated += new EventHandler(copyLinkToClipboardToolStripMenuItem_Click);
                e.Menu.Append(copylink);
            }

            if (openLinkInBrowserToolStripMenuItem.Visible)
            {
                Gtk.MenuItem open = new Gtk.MenuItem(openLinkInBrowserToolStripMenuItem.Text);
                open.Show();
                open.Activated += new EventHandler(openLinkInBrowserToolStripMenuItem_Click);
                e.Menu.Append(open);
                Gtk.SeparatorMenuItem separator8 = new Gtk.SeparatorMenuItem();
                separator8.Show();
                e.Menu.Append(separator8);
            }

            // whois items
            if (whoisToolStripMenuItem.Visible)
            {
                Gtk.MenuItem whois = new Gtk.MenuItem(whoisToolStripMenuItem.Text);
                whois.Show();
                whois.Activated += new EventHandler(whoisToolStripMenuItem_Click);
                e.Menu.Append(whois);

                Gtk.MenuItem whowas = new Gtk.MenuItem(whowasToolStripMenuItem.Text);
                whowas.Show();
                whowas.Activated += new EventHandler(whowasToolStripMenuItem_Click);
                e.Menu.Append(whowas);

                if (kickToolStripMenuItem.Visible)
                {
                    Gtk.MenuItem ku = new Gtk.MenuItem(kickToolStripMenuItem.Text);
                    ku.Show();
                    ku.Activated += new EventHandler(kickToolStripMenuItem_Click);
                    e.Menu.Append(ku);
                }

                Gtk.SeparatorMenuItem separator3 = new Gtk.SeparatorMenuItem();
                separator3.Show();
                e.Menu.Append(separator3);
            }

            if (mode1b2ToolStripMenuItem.Visible)
            {
                Gtk.MenuItem mode1 = new Gtk.MenuItem(mode1b2ToolStripMenuItem.Text);
                mode1.Show();
                mode1.Activated += new EventHandler(mode1b2ToolStripMenuItem_Click);
                e.Menu.Append(mode1);

                Gtk.MenuItem mode2 = new Gtk.MenuItem(mode1e2ToolStripMenuItem.Text);
                mode2.Show();
                mode2.Activated += new EventHandler(mode1e2ToolStripMenuItem_Click);
                e.Menu.Append(mode2);

                Gtk.MenuItem mode3 = new Gtk.MenuItem(mode1I2ToolStripMenuItem.Text);
                mode3.Show();
                mode3.Activated += new EventHandler(mode1I2ToolStripMenuItem_Click);
                e.Menu.Append(mode3);

                Gtk.MenuItem mode4 = new Gtk.MenuItem(mode1q2ToolStripMenuItem.Text);
                mode4.Show();
                mode4.Activated += new EventHandler(mode1q2ToolStripMenuItem_Click);
                e.Menu.Append(mode4);

                Gtk.SeparatorMenuItem separator4 = new Gtk.SeparatorMenuItem();
                separator4.Show();
                e.Menu.Append(separator4);
            }

            Gtk.MenuItem clean = new Gtk.MenuItem("Clean");
            clean.Show();
            e.Menu.Append(clean);
            clean.Activated += new EventHandler(mrhToolStripMenuItem_Click);
            Gtk.CheckMenuItem scroll = new Gtk.CheckMenuItem(scrollToolStripMenuItem.Text);
            if (scrollToolStripMenuItem.Checked)
            {
                scroll.Active = true;
            }
            scroll.Show();
            scroll.Activated += new EventHandler(scrollToolStripMenuItem_Click);
            e.Menu.Append(scroll);
            Gtk.MenuItem refresh = new Gtk.MenuItem("Refresh");
            refresh.Show();
            refresh.Activated += new EventHandler(refreshToolStripMenuItem_Click);
            e.Menu.Append(refresh);
            Gtk.CheckMenuItem taly = new Gtk.CheckMenuItem(toggleAdvancedLayoutToolStripMenuItem.Text);
            taly.Activated += new EventHandler(toggleAdvancedLayoutToolStripMenuItem_Click);
            if (toggleAdvancedLayoutToolStripMenuItem.Checked)
            {
                taly.Active = true;
            }
            taly.Show();
            e.Menu.Append(taly);
            Gtk.CheckMenuItem tsly = new Gtk.CheckMenuItem("Toggle simple layout");
            tsly.Activated += new EventHandler(toggleSimpleLayoutToolStripMenuItem_Click);
            if (toggleSimpleLayoutToolStripMenuItem.Checked)
            {
                tsly.Active = true;
            }
            tsly.Show();
            e.Menu.Append(tsly);
            Gtk.SeparatorMenuItem separator2 = new Gtk.SeparatorMenuItem();
            separator2.Show();
            e.Menu.Append(separator2);
            if (channelToolStripMenuItem.Visible)
            {
                Gtk.MenuItem channel = new Gtk.MenuItem("Channel");
                channel.Show();
                e.Menu.Append(channel);
                channel.Activated += new EventHandler(channelToolStripMenuItem_Click);
            }
            if (listAllChannelsToolStripMenuItem.Visible)
            {
                Gtk.MenuItem list = new Gtk.MenuItem(listAllChannelsToolStripMenuItem.Text);
                list.Show();
                list.Activated += new EventHandler(listAllChannelsToolStripMenuItem_Click);
                e.Menu.Append(list);
            }
            if (retrieveTopicToolStripMenuItem.Visible)
            {
                Gtk.MenuItem retrieve = new Gtk.MenuItem("Retrieve topic");
                retrieve.Show();
                retrieve.Activated += new EventHandler(retrieveTopicToolStripMenuItem_Click);
                e.Menu.Append(retrieve);
            }

            Hooks._Scrollback.AfterMenu(owner, this, e.Menu);

            Gtk.MenuItem copy = new Gtk.MenuItem(copyTextToClipBoardToolStripMenuItem.Text);
            copy.Activated += new EventHandler(copyTextToClipBoardToolStripMenuItem_Click);
            copy.Show();
            e.Menu.Append(copy);
            Gtk.MenuItem copy_x = new Gtk.MenuItem(copyEntireWindowToClipBoardToolStripMenuItem.Text);
            copy_x.Activated += new EventHandler(copyEntireWindowToClipBoardToolStripMenuItem_Click);
            copy_x.Show();
            e.Menu.Append(copy_x);
            CreatingMenu = false;
        }