示例#1
0
		public void Add (ToggleActionEntry[] entries)
		{
			foreach (ToggleActionEntry entry in entries) {
				ToggleAction action = new ToggleAction (entry.name, entry.label, entry.tooltip, entry.stock_id);
				action.Active = entry.active;
				if (entry.activated != null)
					action.Activated += entry.activated;
				if (entry.accelerator == null)
					Add (action);
				else
					Add (action, entry.accelerator);
			}
		}
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public MenuManager()
        {
            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("FileMenu", null, "_File", null, null, null),
                new ActionEntry("ViewMenu", null, "_View", null, null, null),
                new ActionEntry("GoMenu", null, "_Go", null, null, null),
                new ActionEntry("ToolMenu", null, "_Tool", null, null, null),
                new ActionEntry("NetworkMenu", null, "_Network", null, null, null),
                new ActionEntry("HelpMenu", null, "_Help", null, null, null),

                // File Menu
                new ActionEntry("ProxySettings", "Proxy", "Proxy Settings", null,
                                "Setup Proxy", new EventHandler(ActionActivated)),
                new ActionEntry("Logout", "Logout", "Logout", null,
                                "Logout", new EventHandler(ActionActivated)),
                new ActionEntry("Quit", Gtk.Stock.Quit, "Quit", "<control>Q",
                                "Quit Shared Folder", new EventHandler(ActionActivated)),
                // View Menu
                new ActionEntry("Refresh", Gtk.Stock.Refresh, "Refresh", null,
                                null, new EventHandler(ActionActivated)),

                // Go Menu
                new ActionEntry("GoUp", Gtk.Stock.GoUp, "UP", null,
                                "Open The Parent Folder", new EventHandler(ActionActivated)),
                new ActionEntry("GoHome", Gtk.Stock.Home, "Home", null,
                                "Open The Root Directory", new EventHandler(ActionActivated)),
                new ActionEntry("GoMyFolder", "StockMyFolder", "MyFolder", null,
                                "My Shared Folder", new EventHandler(ActionActivated)),
                new ActionEntry("GoNetwork", "StockNetwork", "Network", null,
                                "View Network", new EventHandler(ActionActivated)),
                // Network
                new ActionEntry("SetPort", Gtk.Stock.Preferences, "Set P2P Port", null,
                                "Set P2P Port", new EventHandler(ActionActivated)),
                new ActionEntry("AddPeer", Gtk.Stock.Network, "Add Peer", null,
                                "Add New Peer", new EventHandler(ActionActivated)),
                new ActionEntry("RmPeer", Gtk.Stock.Delete, "Remove Peer", null,
                                "Remove Peer", new EventHandler(ActionActivated)),
                new ActionEntry("DownloadManager", "Download", "Download Manager", null,
                                "Download Manager", new EventHandler(ActionActivated)),
                // Help Menu
                new ActionEntry("About", Gtk.Stock.About, "About", null,
                                "About Shared Folder", new EventHandler(ActionActivated)),
            };

            // Toggle items
            ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
                // View
                new ToggleActionEntry("ViewToolBar", null, "ToolBar", null,
                                        null, new EventHandler(ActionActivated), true),
                new ToggleActionEntry("ViewUserPanel", null, "User Panel", null,
                                        null, new EventHandler(ActionActivated), true),
                // Network
                new ToggleActionEntry("NetOnline", null, "Online", null,
                                        null, new EventHandler(ActionActivated), false)
            };

            actionGroup = new ActionGroup("group");
            actionGroup.Add(entries);
            actionGroup.Add(toggleEntries);
            InsertActionGroup(actionGroup, 0);
            AddUiFromString(uiInfo);
        }
        private bool SetupInterfaceActions()
        {
            action_service = ServiceManager.Get<InterfaceActionService> ();

            if (action_service.FindActionGroup ("ClutterFlowView") == null) {
                clutterflow_actions = new ActionGroup ("ClutterFlowView");

                ToggleActionEntry [] tae = new ToggleActionEntry [] { new ToggleActionEntry ("ClutterFlowVisibleAction", null,
                    AddinManager.CurrentLocalizer.GetString ("Show ClutterFlow Browser"), null,
                    AddinManager.CurrentLocalizer.GetString ("Show or hide the ClutterFlow browser"),
                    null, ClutterFlowSchemas.ShowClutterFlow.Get ()) };
                clutterflow_actions.Add (tae);

                action_service.AddActionGroup (clutterflow_actions);
                ui_manager_id = action_service.UIManager.AddUiFromString (menu_xml);
            }

            source_manager.ActiveSourceChanged += HandleActiveSourceChanged;

            BrowserAction.Activated += OnToggleBrowser;
            CfBrowsAction.Activated += OnToggleClutterFlow;

            return true;
        }
		void AddActions ()
		{
			ActionEntry[] actions = new ActionEntry[]
				{
					new ActionEntry ("FileMenu", null, "_File", null, null, null),
					new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
					new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
					new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
					new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
					new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
					new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
					new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
					new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
					new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
					new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
					new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
				};

			ToggleActionEntry[] toggleActions = new ToggleActionEntry[]
				{
					new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
				};

			RadioActionEntry[] colorActions = new RadioActionEntry[]
				{
					new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
					new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
					new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
				};

			RadioActionEntry[] shapeActions = new RadioActionEntry[]
				{
					new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
					new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
					new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
				};

			ActionGroup group = new ActionGroup ("AppWindowActions");
			group.Add (actions);
			group.Add (toggleActions);
			group.Add (colorActions, (int)Color.Red, new ChangedHandler (RadioActionActivated));
			group.Add (shapeActions, (int)Shape.Square, new ChangedHandler (RadioActionActivated));

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (group, 0);
			uim.AddWidget += new AddWidgetHandler (AddWidget);
			uim.AddUiFromString (uiInfo);

			AddAccelGroup (uim.AccelGroup);
		}
示例#5
0
		public UIManager (SearchWindow search)
		{
			this.search = search;
			this.actions = new ActionGroup ("Actions");

			ActionEntry quit_action_entry;

			if (search.IconEnabled) {
				quit_action_entry = new ActionEntry ("Quit", Gtk.Stock.Close,
								     null, "<control>Q",
						 		     Catalog.GetString ("Close Desktop Search"),
						 		     Quit);
			} else {
				quit_action_entry = new ActionEntry ("Quit", Gtk.Stock.Quit,
								     null, "<control>Q",
						 		     Catalog.GetString ("Exit Desktop Search"),
						 		     Quit);

			}

			Gtk.ActionEntry[] entries = new ActionEntry[] {
				new ActionEntry ("Search", null,
						 Catalog.GetString ("_Search"),
						 null, null, null),
				new ActionEntry ("Domain", null,
						 Catalog.GetString ("Search _Domains"),
						 null, null, null),
				new ActionEntry ("Actions", null,
						 Catalog.GetString ("_Actions"),
						 null, null, null),
				new ActionEntry ("View", null,
						 Catalog.GetString ("_View"),
						 null, null, null),
				new ActionEntry ("Service", null,
						 Catalog.GetString ("Service _Options"),
						 null, null, null),
				new ActionEntry ("Help", null,
						 Catalog.GetString ("_Help"),
						 null, null, null),
				quit_action_entry,
				new ActionEntry ("Preferences", Gtk.Stock.Preferences,
						 null, null,
						 Catalog.GetString ("Exit Desktop Search"),
						 Preferences),
				new ActionEntry ("StartService", Gtk.Stock.Execute,
						 Catalog.GetString ("Start service"),
						 null, null, StartService),
				new ActionEntry ("StopService", Gtk.Stock.Stop,
						 Catalog.GetString ("Stop service"),
						 null, null, StopService),
				new ActionEntry ("IndexInfo", Gtk.Stock.Index,
						 Catalog.GetString ("Index information"),
						 null, null, IndexInfo),
				new ActionEntry ("Contents", Gtk.Stock.Help,
						 Catalog.GetString ("_Contents"),
						 "F1",
						 Catalog.GetString ("Help - Table of Contents"),
						 Help),
				new ActionEntry ("About", Gnome.Stock.About,
						 null, null,
						 Catalog.GetString ("About Desktop Search"),
						 About),
				new ActionEntry ("QuickTips", null,
						 Catalog.GetString ("Quick Tips"),
						 null, null, QuickTips),
				new ActionEntry ("FocusSearchEntry", null, "",
						 "<control>K", null,
						 OnFocusSearchEntry),
				new ActionEntry ("FocusSearchEntry2", null, "",
						 "<control>L", null,
						 OnFocusSearchEntry),
				new ActionEntry ("HideWindow", null, "",
						 "Escape", null,
						 OnHideWindow),
				new ActionEntry ("HideWindow2", null, "",
						 "<control>W", null,
						 OnHideWindow)
			};
			actions.Add (entries);

			sort_entries = new RadioActionEntry[] {
				new RadioActionEntry ("SortModified", null,
						      Catalog.GetString ("Sort by Date _Modified"), null,
						      Catalog.GetString ("Sort the most-recently-modified matches first"),
						      (int)SortType.Modified),
				new RadioActionEntry ("SortName", null,
						      Catalog.GetString ("Sort by _Name"), null,
						      Catalog.GetString ("Sort matches by name"),
						      (int)SortType.Name),
				new RadioActionEntry ("SortRelevance", null,
						      Catalog.GetString ("Sort by _Relevance"), null,
						      Catalog.GetString ("Sort the best matches first"),
						      (int)SortType.Relevance),
			};
			actions.Add (sort_entries, (int)SortType.Modified, OnSortChanged);

			domain_entries = new ToggleActionEntry [] {
				new ToggleActionEntry ("Local", null,
						       Catalog.GetString ("_Local"),
						       null,
						       Catalog.GetString ("Search in personal data in this computer"), /* personal files, emails */
						       OnDomainChanged,
						       true),
				new ToggleActionEntry ("System", null,
						       Catalog.GetString ("_System"),
						       null,
						       Catalog.GetString ("Search in system data on this computer"), /* system manpages, applications */
						       OnDomainChanged,
						       true),
				new ToggleActionEntry ("Global", null,
						       Catalog.GetString ("_Global"),
						       null,
						       Catalog.GetString ("Search in internet services"), /* gmail and other web services */
						       OnDomainChanged,
						       false),
				new ToggleActionEntry ("Neighborhood", null,
						       Catalog.GetString ("_Neighborhood"),
						       null,
						       Catalog.GetString ("Search on computers near me"), /* remote beagle services */
						       OnDomainChanged,
						       false)
			};
			actions.Add (domain_entries);

			view_entries = new ToggleActionEntry[] {
				new ToggleActionEntry ("ShowDetails", null,
						       Catalog.GetString ("Show Details"), null, null,
						       OnToggleDetails, true)
			};
			actions.Add (view_entries);

			InsertActionGroup (actions, 0);
			search.AddAccelGroup (AccelGroup);
			AddUiFromString (ui_def);
		}
        // ============================================
        // PRIVATE Methods
        // ============================================
        private void InitializeMenu()
        {
            ToggleActionEntry[] entries = new ToggleActionEntry[] {
                new ToggleActionEntry("ImagePreview", null, "Image Preview", null,
                                      null, new EventHandler(OnImagePreview), true)
            };

            string ui = "<ui>" +
                        "  <menubar name='MenuBar'>" +
                        "    <menu action='ToolMenu'>" +
                        "      <menuitem action='ImagePreview' />" +
                        "    </menu>" +
                        "  </menubar>" +
                        "</ui>";

            nyFolder.Window.Menu.AddMenus(ui, entries);
        }
示例#7
0
		public DemoUIManager () : base ("UI Manager")
		{
			ActionEntry[] entries = new ActionEntry[] {
				new ActionEntry ("FileMenu", null, "_File", null, null, null),
				new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
				new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
				new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
				new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
				new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
				new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
				new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
				new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
				new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
			};

			ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
				new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
			};


			RadioActionEntry[] colorEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
				new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
				new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
			};

			RadioActionEntry[] shapeEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
				new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
				new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
			};

			ActionGroup actions = new ActionGroup ("group");
			actions.Add (entries);
			actions.Add (toggleEntries);
			actions.Add (colorEntries, (int)Color.Red, new ChangedHandler (RadioActionActivated));
			actions.Add (shapeEntries, (int)Shape.Oval, new ChangedHandler (RadioActionActivated));

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (actions, 0);
			AddAccelGroup (uim.AccelGroup);
			uim.AddUiFromString (uiInfo);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			box1.PackStart (uim.GetWidget ("/MenuBar"), false, false, 0);

			Label label = new Label ("Type\n<alt>\nto start");
			label.SetSizeRequest (200, 200);
			label.SetAlignment (0.5f, 0.5f);
			box1.PackStart (label, true, true, 0);

			HSeparator separator = new HSeparator ();
			box1.PackStart (separator, false, true, 0);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button ("close");
			button.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();

			ShowAll ();
		}
        private void InitializeBuddyListMenu()
        {
            ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
                new ToggleActionEntry("ShowOffLineBuddies", null,
                                      "Show Offline Buddies", null,
                                       null, new EventHandler(OnShowOfflineBuddies), false),
            };

            string ui = "<ui>" +
                        "  <menubar name='MenuBar'>" +
                        "    <menu action='NetworkMenu'>" +
                        "      <separator />" +
                        "      <menuitem action='ShowOffLineBuddies' />" +
                        "    </menu>" +
                        "  </menubar>" +
                        "</ui>";

            nyFolder.MainWindow.Menu.AddMenus(ui, toggleEntries);
        }
示例#9
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public UiMenuManager()
        {
            ActionEntry[] entries = new ActionEntry[] {
                new ActionEntry("GoMenu", null, "_Go", null, null, null),
                new ActionEntry("FileMenu", null, "_File", null, null, null),
                new ActionEntry("ViewMenu", null, "_View", null, null, null),
                new ActionEntry("HelpMenu", null, "_Help", null, null, null),
                new ActionEntry("ImageMenu", null, "_Image", null, null, null),

                // File
                new ActionEntry("OpenImage", "NyIVImage", "Open Image", null,
                                "Open Image", new EventHandler(ActionActivated)),

                new ActionEntry("OpenWebImage", "NyIVImage", "Open Web Image", null,
                                "Open Web Image", new EventHandler(ActionActivated)),

                new ActionEntry("ProxySettings", "NyIVProxy", "Proxy Settings", null,
                                "Proxy Settings", new EventHandler(ActionActivated)),

                new ActionEntry("Quit", Gtk.Stock.Quit, "Quit", null,
                                "Quit Application", new EventHandler(ActionActivated)),

                // Go
                new ActionEntry("GoBack", Gtk.Stock.GoBack, "Back", null,
                                "Go Back", new EventHandler(ActionActivated)),

                new ActionEntry("GoForward", Gtk.Stock.GoForward, "Forward", null,
                                "Go Forward", new EventHandler(ActionActivated)),

                // View
                new ActionEntry("Fullscreen", Gtk.Stock.Fullscreen, "Fullscreen", null,
                                "Fullscreen", new EventHandler(ActionActivated)),

                // Image
                new ActionEntry("ZoomIn", Gtk.Stock.ZoomIn, "In", null,
                                "Zoom In", new EventHandler(ActionActivated)),

                new ActionEntry("ZoomOut", Gtk.Stock.ZoomOut, "Out", null,
                                "Zoom Out", new EventHandler(ActionActivated)),

                new ActionEntry("Zoom100", Gtk.Stock.Zoom100, "Normal", null,
                                "Zoom Normal", new EventHandler(ActionActivated)),

                new ActionEntry("ZoomFit", Gtk.Stock.ZoomFit, "Fit", null,
                                "Zoom Fit", new EventHandler(ActionActivated)),

                // Help Menu
                new ActionEntry("About", Gtk.Stock.About, "About", null,
                                "About Shared Folder", new EventHandler(ActionActivated)),
            };

            // Toggle items
            ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
                // View
                new ToggleActionEntry("ViewNetwork", null, "Network", null,
                                        null, new EventHandler(ActionActivated), true),
                new ToggleActionEntry("ViewLogo", null, "NyFolder Logo", null,
                                        null, new EventHandler(ActionActivated), true),
                // Network
                new ToggleActionEntry("NetOnline", null, "Online", null,
                                        null, new EventHandler(ActionActivated), false)
            };

            actionGroup = new ActionGroup("group");
            actionGroup.Add(entries);
            actionGroup.Add(toggleEntries);
            InsertActionGroup(actionGroup, 0);
            AddUiFromString(uiInfo);
        }
 private ToggleActionEntry[] GetToggleActionEntries()
 {
     ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
         // View
         new ToggleActionEntry("ViewToolBar", null, "ToolBar", null,
                                 null, new EventHandler(ActionActivated), true),
         new ToggleActionEntry("ViewUserPanel", null, "User Panel", null,
                                 null, new EventHandler(ActionActivated), true),
         // Network
         new ToggleActionEntry("NetOnline", null, "Online", null,
                                 null, new EventHandler(ActionActivated), false)
     };
     return(toggleEntries);
 }