/// <summary> /// Register a new adjustment with Pinta, causing it to be added to the Adjustments menu. /// </summary> /// <param name="adjustment">The adjustment to register</param> /// <returns>The action created for this adjustment</returns> public Gtk.Action RegisterAdjustment (BaseEffect adjustment) { // Add icon to IconFactory Gtk.IconFactory fact = new Gtk.IconFactory (); fact.Add (adjustment.Icon, new Gtk.IconSet (PintaCore.Resources.GetIcon (adjustment.Icon))); fact.AddDefault (); // Create a gtk action for each adjustment Gtk.Action act = new Gtk.Action (adjustment.GetType ().Name, adjustment.Name + (adjustment.IsConfigurable ? Catalog.GetString ("...") : ""), string.Empty, adjustment.Icon); act.Activated += delegate (object sender, EventArgs e) { PintaCore.LivePreview.Start (adjustment); }; PintaCore.Actions.Adjustments.Actions.Add (act); // Create a menu item for each adjustment MenuItem menu_item; // If no key is specified, don't use an accelerated menu item if (adjustment.AdjustmentMenuKey == (Gdk.Key)0) menu_item = (MenuItem)act.CreateMenuItem (); else menu_item = act.CreateAcceleratedMenuItem (adjustment.AdjustmentMenuKey, adjustment.AdjustmentMenuKeyModifiers); ((Menu)((ImageMenuItem)PintaCore.Chrome.MainMenu.Children[5]).Submenu).AppendMenuItemSorted (menu_item); adjustments.Add (adjustment, act); adjustment_menuitems.Add (adjustment, menu_item); return act; }
/// <summary> /// Register a new adjustment with Pinta, causing it to be added to the Adjustments menu. /// </summary> /// <param name="adjustment">The adjustment to register</param> /// <returns>The action created for this adjustment</returns> public Gtk.Action RegisterAdjustment(BaseEffect adjustment) { // Add icon to IconFactory Gtk.IconFactory fact = new Gtk.IconFactory(); fact.Add(adjustment.Icon, new Gtk.IconSet(PintaCore.Resources.GetIcon(adjustment.Icon))); fact.AddDefault(); // Create a gtk action for each adjustment Gtk.Action act = new Gtk.Action(adjustment.GetType().Name, adjustment.Name + (adjustment.IsConfigurable ? Catalog.GetString("...") : ""), string.Empty, adjustment.Icon); act.Activated += delegate(object sender, EventArgs e) { PintaCore.LivePreview.Start(adjustment); }; PintaCore.Actions.Adjustments.Actions.Add(act); // Create a menu item for each adjustment MenuItem menu_item; // If no key is specified, don't use an accelerated menu item if (adjustment.AdjustmentMenuKey == (Gdk.Key) 0) { menu_item = (MenuItem)act.CreateMenuItem(); } else { menu_item = act.CreateAcceleratedMenuItem(adjustment.AdjustmentMenuKey, adjustment.AdjustmentMenuKeyModifiers); } ((Menu)((ImageMenuItem)PintaCore.Chrome.MainMenu.Children[5]).Submenu).AppendMenuItemSorted(menu_item); adjustments.Add(adjustment, act); adjustment_menuitems.Add(adjustment, menu_item); return(act); }
public static Gtk.ImageMenuItem CreateAcceleratedMenuItem(this Gtk.Action action, Gdk.Key key, Gdk.ModifierType mods) { ImageMenuItem item = (ImageMenuItem)action.CreateMenuItem(); (item.Child as AccelLabel).AccelWidget = item; item.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(key, mods, AccelFlags.Visible)); return(item); }
public static Gtk.MenuItem CreateSubMenuItem(this Gtk.Action action) { MenuItem item = (MenuItem)action.CreateMenuItem(); Menu sub_menu = new Menu(); item.Submenu = sub_menu; return(item); }
public Menu BuildAddToMenu(System.EventHandler handler) { Menu bookmarkMenu = new Menu(); string[] bookmarks = m_App.CacheStore.GetBookmarkLists(); foreach(string bookmark in bookmarks) { Action action = new Action(bookmark, bookmark); action.Activated += handler; bookmarkMenu.Append(action.CreateMenuItem()); } return bookmarkMenu; }
public Menu BuildProfileTransferMenu() { Menu etMenu = new Menu(); foreach (GPSProfile loc in m_profiles.Values) { Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleTransferActionActivated; } etMenu.ShowAll(); return(etMenu); }
public Menu BuildProfileEditMenu() { Menu etMenu = new Menu(); int iCount = 0; foreach (GPSProfile loc in m_profiles.Values) { Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount++; } return(etMenu); }
public Menu BuildAddToMenu(System.EventHandler handler) { Menu bookmarkMenu = new Menu(); string[] bookmarks = m_App.CacheStore.GetBookmarkLists(); foreach (string bookmark in bookmarks) { //##AP Action action = new Action(bookmark, bookmark); Gtk.Action action = new Gtk.Action(bookmark, bookmark); action.Activated += handler; bookmarkMenu.Append(action.CreateMenuItem()); } return(bookmarkMenu); }
public Menu BuildEToolMenu() { Menu etMenu = new Menu(); int iCount = 0; foreach (ExternalTool tool in m_tools.Values) { Gtk.Action action = new Gtk.Action(tool.Name, tool.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount++; } return(etMenu); }
public Menu BuildProfileReceiveMenu() { Menu etMenu = new Menu(); foreach (GPSProfile loc in m_profiles.Values) { if (String.IsNullOrEmpty(loc.FieldNotesFile)) { continue; } Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleReceiveActionActivated; } return(etMenu); }
public void AddEffect(string category, Gtk.Action action) { if (!Menus.ContainsKey(category)) { Gtk.Action menu_action = new Gtk.Action(category, Mono.Unix.Catalog.GetString(category), null, null); Menu category_menu = (Menu)effects_menu.AppendMenuItemSorted((MenuItem)(menu_action.CreateSubMenuItem())).Submenu; Menus.Add(category, category_menu); } Actions.Add(action); var menu_item = (MenuItem)action.CreateMenuItem(); Menu m = Menus[category]; m.AppendMenuItemSorted(menu_item); menu_items.Add(action, menu_item); }
public Menu BuildLocationlMenu() { Menu etMenu = new Menu(); Gtk.Action home_action = new Gtk.Action("Home", Catalog.GetString("Home")); etMenu.Append(home_action.CreateMenuItem()); home_action.Activated += HandleHome_actionActivated; int iCount = 0; foreach (Location loc in m_locations.Values) { Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount++; } etMenu.Append(new MenuItem()); gpsdAction = new ToggleAction("UseGPSD", Catalog.GetString("GPSD Position"), null, null); //gpsdAction.Active = UIMonitor.getInstance().Configuration.UseGPSD; gpsdAction.Toggled += HandleGpsdActionToggled; etMenu.Append(gpsdAction.CreateMenuItem()); etMenu.ShowAll(); return(etMenu); }
public static Gtk.Action AppendAction(this Menu menu, string actionName, string actionLabel, string actionTooltip, string actionIcon) { Gtk.Action action = new Gtk.Action (actionName, actionLabel, actionTooltip, actionIcon); menu.AppendItem ((MenuItem)action.CreateMenuItem ()); return action; }
public Menu BuildProfileTransferMenu() { Menu etMenu = new Menu(); foreach (GPSProfile loc in m_profiles.Values) { Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleTransferActionActivated; } etMenu.ShowAll(); return etMenu; }
public Menu BuildProfileReceiveMenu() { Menu etMenu = new Menu(); foreach (GPSProfile loc in m_profiles.Values) { if (String.IsNullOrEmpty(loc.FieldNotesFile)) continue; Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleReceiveActionActivated; } return etMenu; }
public Menu BuildProfileEditMenu() { Menu etMenu = new Menu(); int iCount = 0; foreach (GPSProfile loc in m_profiles.Values) { Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount ++; } return etMenu; }
public Menu BuildEToolMenu() { Menu etMenu = new Menu(); int iCount = 0; foreach (ExternalTool tool in m_tools.Values) { Gtk.Action action = new Gtk.Action(tool.Name, tool.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount ++; } return etMenu; }
public UploadExtension() { menu_action = new Gtk.Action("uploadaddin", "Upload", "Lets you upload images to the internet", Stock.Network); menu_action.Activated += delegate(object sender, EventArgs e) { showUploadDialog(); }; menu_item = menu_action.CreateMenuItem(); }
private void CreatePopup(Gtk.ButtonPressEventArgs args) { Menu popup = new Menu (); MenuItem setCenterItem = new MenuItem (Catalog.GetString("_Set As Map Centre")); MenuItem showOnline = new MenuItem (Catalog.GetString("_View Cache Online")); MenuItem mark = new MenuItem(Catalog.GetString("_Mark")); Menu markSub = new Menu(); MenuItem markFound = new MenuItem(Catalog.GetString("Mark _Found")); MenuItem markFTF = new MenuItem(Catalog.GetString("Mark First To Find")); MenuItem markDNF = new MenuItem(Catalog.GetString("Mark Did Not Find")); MenuItem markUnfound = new MenuItem(Catalog.GetString("Mark _Unfound")); MenuItem markDisabled = new MenuItem(Catalog.GetString("Mark _Disabled")); MenuItem markArchived = new MenuItem(Catalog.GetString("Mark _Archived")); MenuItem markAvailable = new MenuItem(Catalog.GetString("Mark A_vailable")); MenuItem correctCoordinates = new MenuItem(Catalog.GetString("_Corrected Coordinates...")); MenuItem addWaypoint = new MenuItem(Catalog.GetString("Add Child _Waypoint...")); MenuItem deleteItem = new MenuItem (Catalog.GetString("Delete...")); MenuItem bookmark = new MenuItem(Catalog.GetString("_Add to Bookmark List")); MenuItem rmvCache = new MenuItem(Catalog.GetString("_Remove From Bookmark List")); MenuItem qlandkarte = new MenuItem(Catalog.GetString("View in _QLandkarte GT...")); MenuItem logCache = new MenuItem(Catalog.GetString("_Log Find")); MenuItem externalTools = new MenuItem(Catalog.GetString("_External Tools")); EToolList eTools = m_monitor.ExternalTools; Menu eToolMenu = new Menu(); foreach(ExternalTool tool in eTools.ToolArray) { if (tool.Command.Contains("%selected%")) { Gtk.Action eCmd = new Gtk.Action(tool.Name, tool.Name); eCmd.Activated += HandleECmdActivated; eToolMenu.Add(eCmd.CreateMenuItem()); } } externalTools.Submenu = eToolMenu; TreePath path; TreeIter itr; treeview1.GetPathAtPos((int) args.Event.X,(int) args.Event.Y, out path); treeview1.Model.GetIter(out itr, path); Geocache cache = (Geocache)treeview1.Model.GetValue (itr, 0); if (cache != null) { logCache.Sensitive = true; if (!cache.Available) { markAvailable.Sensitive = true; markDisabled.Sensitive = false; } else { markAvailable.Sensitive = false; markDisabled.Sensitive = true; } if (!cache.Archived) markArchived.Sensitive = true; else markArchived.Sensitive = false; if (cache.Symbol.Contains("Found")) { if (cache.FTF) { markFTF.Sensitive = false; markFound.Sensitive = true; } else { markFTF.Sensitive = true; markFound.Sensitive = false; } markUnfound.Sensitive = true; markDNF.Sensitive = true; } else { markFound.Sensitive = true; markFTF.Sensitive = true; if (cache.DNF) { markDNF.Sensitive = false; markUnfound.Sensitive = true; } else { markDNF.Sensitive = true; markUnfound.Sensitive = false; } } } else { logCache.Sensitive = false; } CacheStore store = Engine.getInstance().Store; List<string> bookmarklists = store.GetBookmarkLists(); if (bookmarklists.Count > 0) { Menu bookMarksSub = new Menu(); foreach (String str in bookmarklists) { MenuItem itm = new MenuItem(str); if (str == store.BookmarkList) itm.Sensitive = false; bookMarksSub.Append(itm); itm.Activated += HandleItmActivated; } bookmark.Submenu = bookMarksSub; } else { bookmark.Sensitive = false; } if (store.BookmarkList == null) rmvCache.Sensitive = false; rmvCache.Activated += HandleRmvCacheActivated; setCenterItem.Activated += HandleSetCenterItemActivated; showOnline.Activated += HandleShowOnlineActivated; deleteItem.Activated += HandleDeleteItemActivated; markFound.Activated += HandleMarkFoundActivated; markUnfound.Activated += HandleMarkUnfoundActivated; markDisabled.Activated += HandleMarkDisabledActivated; markArchived.Activated += HandleMarkArchivedActivated; markAvailable.Activated += HandleMarkAvailableActivated; correctCoordinates.Activated += HandleCorrectCoordinatesActivated; addWaypoint.Activated += HandleAddWayPointActivated; qlandkarte.Activated += HandleQlandkarteActivated; logCache.Activated += HandleLogCacheActivated; markDNF.Activated += HandleMarkDNFActivated; markFTF.Activated += HandleMarkFTFActivated; popup.Add (setCenterItem); popup.Add (showOnline); popup.Add (new MenuItem()); popup.Add (logCache); popup.Add (mark); markSub.Add(markFound); markSub.Add(markFTF); markSub.Add(markDNF); markSub.Add(markUnfound); markSub.Add (markDisabled); markSub.Add (markArchived); markSub.Add (markAvailable); mark.Submenu = markSub; popup.Add(addWaypoint); popup.Add(correctCoordinates); popup.Add(new MenuItem()); popup.Add(externalTools); popup.Add (new MenuItem()); popup.Add (bookmark); popup.Add (rmvCache); popup.Add (new MenuItem()); popup.Add (qlandkarte); popup.Add (deleteItem); popup.ShowAll (); popup.Popup (); }
void BuildMenuItem(QuickFilter filter, Menu qfMenu) { Gtk.Action action = new Gtk.Action(filter.Name, filter.Name); qfMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; }
private void InitActions() { // show about AboutAction.Activated += (sender, e) => new AboutWindow(this, About.Authors, About.Lines, About.Size).Show(); // show supported extensions SupportedFormatsAction.Activated += (sender, e) => new SupportedFormatsWindow(this).Show(); // create new pack MenuItem newMenuItem = this.UIManager.GetWidget(@"/mainMenuBar/FileAction/NewAction") as MenuItem; Menu newSubMenu = new Menu(); newMenuItem.Submenu = newSubMenu; Packer.SupportedExtensions.ToList().ForEach(ext => { Gtk.Action action = new Gtk.Action(String.Format("New{0}Action", ext), ext); action.Activated+= (sender, e) => { if (fileSystem != null) fileSystem.Close(); fileSystem = null; if (Packer.Create(ext, out fileSystem)) { fileSystem.New(); ChangePackActionSensitive(true); } }; MenuItem menuItem = action.CreateMenuItem() as MenuItem; menuItem.AddAccelerator( "activate", this.UIManager.AccelGroup, new AccelKey((Gdk.Key) Gdk.Key.Parse(typeof(Gdk.Key), ext[0].ToString().ToLower()), Gdk.ModifierType.ControlMask, AccelFlags.Visible)); newSubMenu.Append(menuItem); }); // open pack action OpenAction.Activated += (sender, e) => HandleOpenAction(); // save current pack SaveAction.Activated += (sender, e) => HandleSaveAction(); // close pack and exit CloseAction.Activated += (sender, e) => { if (fileSystem != null) fileSystem.Close(); fileSystem = null; ChangePackActionSensitive(false); currentFolder = TreeIter.Zero; folderStore.Clear(); packStore.Clear(); }; // exit app ExitAction.Activated += (sender, e) => Program.Stop(); // add files to current pack AddFilesAction.Activated += (sender, e) => HandleAddFilesAction(); // add folder to current pack AddFolderAction.Activated += (sender, e) => HandleAddFolderAction(); // remove items from current pack RemoveAction.Activated += (sender, e) => HandleRemoveAction(); // extract items from current pack ExtractAction.Activated += (sender, e) => HandleExtractAction(); // extract all items from current pack ExtractAllAction.Activated += (sender, e) => HandleExtractAllAction(); }
private void InitActions() { // show about AboutAction.Activated += (sender, e) => new AboutWindow(this, About.Authors, About.Lines, About.Size).Show(); // show supported extensions SupportedFormatsAction.Activated += (sender, e) => new SupportedFormatsWindow(this).Show(); // create new pack MenuItem newMenuItem = this.UIManager.GetWidget(@"/mainMenuBar/FileAction/NewAction") as MenuItem; Menu newSubMenu = new Menu(); newMenuItem.Submenu = newSubMenu; Packer.SupportedExtensions.ToList().ForEach(ext => { Gtk.Action action = new Gtk.Action(String.Format("New{0}Action", ext), ext); action.Activated += (sender, e) => { if (fileSystem != null) { fileSystem.Close(); } fileSystem = null; if (Packer.Create(ext, out fileSystem)) { fileSystem.New(); ChangePackActionSensitive(true); } }; MenuItem menuItem = action.CreateMenuItem() as MenuItem; menuItem.AddAccelerator( "activate", this.UIManager.AccelGroup, new AccelKey((Gdk.Key)Gdk.Key.Parse(typeof(Gdk.Key), ext[0].ToString().ToLower()), Gdk.ModifierType.ControlMask, AccelFlags.Visible)); newSubMenu.Append(menuItem); }); // open pack action OpenAction.Activated += (sender, e) => HandleOpenAction(); // save current pack SaveAction.Activated += (sender, e) => HandleSaveAction(); // close pack and exit CloseAction.Activated += (sender, e) => { if (fileSystem != null) { fileSystem.Close(); } fileSystem = null; ChangePackActionSensitive(false); currentFolder = TreeIter.Zero; folderStore.Clear(); packStore.Clear(); }; // exit app ExitAction.Activated += (sender, e) => Program.Stop(); // add files to current pack AddFilesAction.Activated += (sender, e) => HandleAddFilesAction(); // add folder to current pack AddFolderAction.Activated += (sender, e) => HandleAddFolderAction(); // remove items from current pack RemoveAction.Activated += (sender, e) => HandleRemoveAction(); // extract items from current pack ExtractAction.Activated += (sender, e) => HandleExtractAction(); // extract all items from current pack ExtractAllAction.Activated += (sender, e) => HandleExtractAllAction(); }
// Creates the menu that is popped up when the // user clicks the status icon public void CreateMenu() { Menu = new Menu (); // The menu item showing the status and size of the SparkleShare folder MenuItem status_menu_item = new MenuItem (StateText) { Sensitive = false }; // A menu item that provides a link to the SparkleShare folder Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") { IconName = "folder-sparkleshare", IsImportant = true }; folder_action.Activated += delegate { SparkleShare.Controller.OpenSparkleShareFolder (); }; Menu.Add (status_menu_item); Menu.Add (new SeparatorMenuItem ()); Menu.Add (folder_action.CreateMenuItem ()); if (SparkleShare.Controller.Folders.Count > 0) { // Creates a menu item for each repository with a link to their logs foreach (string path in SparkleShare.Controller.Folders) { folder_action = new Gtk.Action ("", Path.GetFileName (path)) { IconName = "folder", IsImportant = true }; // if (repo.HasUnsyncedChanges) // folder_action.IconName = "dialog-error"; folder_action.Activated += OpenEventLogDelegate (path); MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem (); Menu.Add (menu_item); } } else { MenuItem no_folders_item = new MenuItem (_("No Remote Folders Yet")) { Sensitive = false }; Menu.Add (no_folders_item); } // Opens the wizard to add a new remote folder MenuItem sync_item = new MenuItem (_("Sync Remote Folder…")); if (SparkleShare.Controller.FirstRun) sync_item.Sensitive = false; sync_item.Activated += delegate { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); intro.ShowServerForm (true); }); }; Menu.Add (sync_item); Menu.Add (new SeparatorMenuItem ()); // A checkbutton to toggle whether or not to show notifications CheckMenuItem notify_item = new CheckMenuItem (_("Show Notifications")); if (SparkleShare.Controller.NotificationsEnabled) notify_item.Active = true; notify_item.Toggled += delegate { SparkleShare.Controller.ToggleNotifications (); }; Menu.Add (notify_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that takes the user to http://www.sparkleshare.org/ MenuItem about_item = new MenuItem (_("About")); about_item.Activated += delegate { SparkleDialog dialog = new SparkleDialog (); dialog.ShowAll (); }; Menu.Add (about_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that quits the application MenuItem quit_item = new MenuItem (_("Quit")); quit_item.Activated += delegate { SparkleShare.Controller.Quit (); }; Menu.Add (quit_item); Menu.ShowAll (); }
public UploadExtension() { menu_action = new Gtk.Action ("uploadaddin", "Upload", "Lets you upload images to the internet", Stock.Network); menu_action.Activated += delegate (object sender, EventArgs e) {showUploadDialog (); }; menu_item = menu_action.CreateMenuItem (); }
public Menu BuildLocationlMenu() { Menu etMenu = new Menu(); Gtk.Action home_action = new Gtk.Action("Home", Catalog.GetString("Home")); etMenu.Append(home_action.CreateMenuItem()); home_action.Activated += HandleHome_actionActivated; int iCount = 0; foreach (Location loc in m_locations.Values) { Gtk.Action action = new Gtk.Action(loc.Name, loc.Name); etMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount ++; } etMenu.Append(new MenuItem()); gpsdAction = new ToggleAction("UseGPSD", Catalog.GetString("GPSD Position"),null, null); //gpsdAction.Active = UIMonitor.getInstance().Configuration.UseGPSD; gpsdAction.Toggled += HandleGpsdActionToggled; etMenu.Append(gpsdAction.CreateMenuItem()); etMenu.ShowAll(); return etMenu; }
public Menu BuildQuickFilterMenu() { Menu qfMenu = new Menu(); int iCount = 0; foreach (QuickFilter filter in m_filters.Values) { Gtk.Action action = new Gtk.Action(filter.Name, filter.Name); qfMenu.Append(action.CreateMenuItem()); action.Activated += HandleActionActivated; iCount ++; } return qfMenu; }
private void CreatePopup(Gtk.ButtonPressEventArgs args) { Menu popup = new Menu(); MenuItem setCenterItem = new MenuItem(Catalog.GetString("_Set As Map Centre")); MenuItem showOnline = new MenuItem(Catalog.GetString("_View Cache Online")); MenuItem mark = new MenuItem(Catalog.GetString("_Mark")); Menu markSub = new Menu(); MenuItem markFound = new MenuItem(Catalog.GetString("Mark _Found")); MenuItem markFTF = new MenuItem(Catalog.GetString("Mark First To Find")); MenuItem markDNF = new MenuItem(Catalog.GetString("Mark Did Not Find")); MenuItem markUnfound = new MenuItem(Catalog.GetString("Mark _Unfound")); MenuItem markDisabled = new MenuItem(Catalog.GetString("Mark _Disabled")); MenuItem markArchived = new MenuItem(Catalog.GetString("Mark _Archived")); MenuItem markAvailable = new MenuItem(Catalog.GetString("Mark A_vailable")); MenuItem correctCoordinates = new MenuItem(Catalog.GetString("_Corrected Coordinates...")); MenuItem addWaypoint = new MenuItem(Catalog.GetString("Add Child _Waypoint...")); MenuItem deleteItem = new MenuItem(Catalog.GetString("Delete...")); MenuItem bookmark = new MenuItem(Catalog.GetString("_Add to Bookmark List")); MenuItem rmvCache = new MenuItem(Catalog.GetString("_Remove From Bookmark List")); MenuItem qlandkarte = new MenuItem(Catalog.GetString("View in _QLandkarte GT...")); MenuItem logCache = new MenuItem(Catalog.GetString("_Log Find")); MenuItem externalTools = new MenuItem(Catalog.GetString("_External Tools")); MenuItem grabImages = new MenuItem(Catalog.GetString("_Grab Images")); EToolList eTools = m_app.Tools; Menu eToolMenu = new Menu(); foreach (ExternalTool tool in eTools.ToolArray) { if (tool.Command.Contains("%selected%") || tool.Command.Contains("%selectedname%")) { Gtk.Action eCmd = new Gtk.Action(tool.Name, tool.Name); eCmd.Activated += HandleECmdActivated; eToolMenu.Add(eCmd.CreateMenuItem()); } } externalTools.Submenu = eToolMenu; TreePath path; TreeIter itr; cacheListTree.GetPathAtPos((int)args.Event.X, (int)args.Event.Y, out path); cacheListTree.Model.GetIter(out itr, path); Geocache cache = (Geocache)cacheListTree.Model.GetValue(itr, 0); if (cache != null) { logCache.Sensitive = true; if (!cache.Available) { markAvailable.Sensitive = true; markDisabled.Sensitive = false; } else { markAvailable.Sensitive = false; markDisabled.Sensitive = true; } if (!cache.Archived) { markArchived.Sensitive = true; } else { markArchived.Sensitive = false; } if (cache.Symbol.Contains("Found")) { if (cache.FTF) { markFTF.Sensitive = false; markFound.Sensitive = true; } else { markFTF.Sensitive = true; markFound.Sensitive = false; } markUnfound.Sensitive = true; markDNF.Sensitive = true; } else { markFound.Sensitive = true; markFTF.Sensitive = true; if (cache.DNF) { markDNF.Sensitive = false; markUnfound.Sensitive = true; } else { markDNF.Sensitive = true; markUnfound.Sensitive = false; } } } else { logCache.Sensitive = false; } string[] bookmarklists = m_app.CacheStore.GetBookmarkLists(); if (bookmarklists.Length > 0) { Menu bookMarksSub = new Menu(); foreach (String str in bookmarklists) { MenuItem itm = new MenuItem(str); if (str == m_app.CacheStore.ActiveBookmarkList) { itm.Sensitive = false; } bookMarksSub.Append(itm); itm.Activated += HandleItmActivated; } bookmark.Submenu = bookMarksSub; } else { bookmark.Sensitive = false; } if (m_app.CacheStore.ActiveBookmarkList == null) { rmvCache.Sensitive = false; } rmvCache.Activated += HandleRmvCacheActivated; setCenterItem.Activated += HandleSetCenterItemActivated; showOnline.Activated += HandleShowOnlineActivated; deleteItem.Activated += HandleDeleteItemActivated; markFound.Activated += HandleMarkFoundActivated; markUnfound.Activated += HandleMarkUnfoundActivated; markDisabled.Activated += HandleMarkDisabledActivated; markArchived.Activated += HandleMarkArchivedActivated; markAvailable.Activated += HandleMarkAvailableActivated; correctCoordinates.Activated += HandleCorrectCoordinatesActivated; addWaypoint.Activated += HandleAddWayPointActivated; qlandkarte.Activated += HandleQlandkarteActivated; logCache.Activated += HandleLogCacheActivated; markDNF.Activated += HandleMarkDNFActivated; markFTF.Activated += HandleMarkFTFActivated; grabImages.Activated += HandleGrabImagesActivated; popup.Add(setCenterItem); popup.Add(showOnline); popup.Add(new MenuItem()); popup.Add(logCache); popup.Add(mark); markSub.Add(markFound); markSub.Add(markFTF); markSub.Add(markDNF); markSub.Add(markUnfound); markSub.Add(markDisabled); markSub.Add(markArchived); markSub.Add(markAvailable); mark.Submenu = markSub; popup.Add(addWaypoint); popup.Add(correctCoordinates); popup.Add(grabImages); popup.Add(new MenuItem()); popup.Add(externalTools); popup.Add(new MenuItem()); popup.Add(bookmark); popup.Add(rmvCache); popup.Add(new MenuItem()); popup.Add(qlandkarte); popup.Add(deleteItem); popup.ShowAll(); popup.Popup(); }
public static Gtk.Action AppendAction(this Menu menu, string actionName, string actionLabel, string actionTooltip, string actionIcon) { Gtk.Action action = new Gtk.Action(actionName, actionLabel, actionTooltip, actionIcon); menu.AppendItem((MenuItem)action.CreateMenuItem()); return(action); }
// Creates the menu that is popped up when the // user clicks the statusicon public void CreateMenu() { Menu = new Menu (); // The menu item showing the status and size of the SparkleShare folder StatusMenuItem = new MenuItem (StateText) { Sensitive = false }; Menu.Add (StatusMenuItem); Menu.Add (new SeparatorMenuItem ()); // A menu item that provides a link to the SparkleShare folder Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") { IconName = "folder-sparkleshare", IsImportant = true }; folder_action.Activated += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = SparklePaths.SparklePath; process.Start (); }; Menu.Add (folder_action.CreateMenuItem ()); if (SparkleUI.Repositories.Count > 0) { // Creates a menu item for each repository with a link to their logs foreach (SparkleRepo repo in SparkleUI.Repositories) { folder_action = new Gtk.Action ("", repo.Name) { IconName = "folder", IsImportant = true }; folder_action.Activated += OpenLogDelegate (repo.LocalPath); MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem (); if (repo.Description != null) menu_item.TooltipText = repo.Description; Menu.Add (menu_item); } } else { MenuItem no_folders_item = new MenuItem (_("No Shared Folders Yet")) { Sensitive = false }; Menu.Add (no_folders_item); } // Opens the wizard to add a new remote folder MenuItem add_item = new MenuItem (_("Sync Remote Folder…")); add_item.Activated += delegate { SparkleIntro intro = new SparkleIntro (); // Only show the server form in the wizard intro.ShowServerForm (true); }; Menu.Add (add_item); Menu.Add (new SeparatorMenuItem ()); // A checkbutton to toggle whether or not to show notifications CheckMenuItem notify_item = new CheckMenuItem (_("Show Notifications")); // Whether notifications are shown depends existence of this file string notify_setting_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "sparkleshare.notify"); if (File.Exists (notify_setting_file_path)) notify_item.Active = true; notify_item.Toggled += delegate { if (File.Exists (notify_setting_file_path)) File.Delete (notify_setting_file_path); else File.Create (notify_setting_file_path); }; Menu.Add (notify_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that takes the use to sparkleshare.org MenuItem about_item = new MenuItem (_("Visit Website")); about_item.Activated += delegate { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; process.StartInfo.Arguments = "http://www.sparkleshare.org/"; process.Start (); }; Menu.Add (about_item); Menu.Add (new SeparatorMenuItem ()); // A menu item that quits the application MenuItem quit_item = new MenuItem (_("Quit")); quit_item.Activated += Quit; Menu.Add (quit_item); }