// 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 }; Menu.Add(status_menu_item); Menu.Add(new SeparatorMenuItem()); ImageMenuItem folder_item = new SparkleMenuItem("SparkleShare") { Image = new Image(SparkleUIHelpers.GetIcon("folder-sparkleshare", 16)) }; folder_item.Activated += delegate { SparkleShare.Controller.OpenSparkleShareFolder(); }; Menu.Add(folder_item); 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) { Gdk.Pixbuf folder_icon = IconTheme.Default.LoadIcon("folder", 16, IconLookupFlags.GenericFallback); ImageMenuItem subfolder_item = new SparkleMenuItem(Path.GetFileName(path)) { Image = new Image(folder_icon) }; // if (repo.HasUnsyncedChanges) // folder_action.IconName = "dialog-error"; subfolder_item.Activated += OpenEventLogDelegate(path); Menu.Add(subfolder_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(_("Add Remote Folder…")); if (SparkleShare.Controller.FirstRun) { sync_item.Sensitive = false; } sync_item.Activated += delegate { Application.Invoke(delegate { if (SparkleUI.Intro == null) { SparkleUI.Intro = new SparkleIntro(); SparkleUI.Intro.ShowServerForm(true); } if (!SparkleUI.Intro.Visible) { SparkleUI.Intro.ShowServerForm(true); } SparkleUI.Intro.ShowAll(); SparkleUI.Intro.Present(); }); }; Menu.Add(sync_item); Menu.Add(new SeparatorMenuItem()); MenuItem notify_item; if (SparkleShare.Controller.NotificationsEnabled) { notify_item = new MenuItem(_("Turn Notifications Off")); } else { notify_item = new MenuItem(_("Turn Notifications On")); } notify_item.Activated += delegate { SparkleShare.Controller.ToggleNotifications(); CreateMenu(); }; 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 SparkleShare")); 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(); }
// 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 }; Menu.Add (status_menu_item); Menu.Add (new SeparatorMenuItem ()); ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare"){ Image = new Image (SparkleUIHelpers.GetIcon ("folder-sparkleshare", 16)) }; folder_item.Activated += delegate { SparkleShare.Controller.OpenSparkleShareFolder (); }; Menu.Add (folder_item); 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) { Gdk.Pixbuf folder_icon = IconTheme.Default.LoadIcon ("folder", 16, IconLookupFlags.GenericFallback); ImageMenuItem subfolder_item = new SparkleMenuItem (Path.GetFileName (path)) { Image = new Image (folder_icon) }; // if (repo.HasUnsyncedChanges) // folder_action.IconName = "dialog-error"; subfolder_item.Activated += OpenEventLogDelegate (path); Menu.Add (subfolder_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 (_("Add Remote Folder…")); if (SparkleShare.Controller.FirstRun) sync_item.Sensitive = false; sync_item.Activated += delegate { Application.Invoke (delegate { if (SparkleUI.Intro == null) { SparkleUI.Intro = new SparkleIntro (); SparkleUI.Intro.ShowServerForm (true); } if (!SparkleUI.Intro.Visible) SparkleUI.Intro.ShowServerForm (true); SparkleUI.Intro.ShowAll (); SparkleUI.Intro.Present (); }); }; Menu.Add (sync_item); Menu.Add (new SeparatorMenuItem ()); MenuItem notify_item; if (SparkleShare.Controller.NotificationsEnabled) notify_item = new MenuItem (_("Turn Notifications Off")); else notify_item = new MenuItem (_("Turn Notifications On")); notify_item.Activated += delegate { SparkleShare.Controller.ToggleNotifications (); CreateMenu (); }; 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 SparkleShare")); 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 (); }
// 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 (); }