void CreateDocks () { foreach (string name in DockNames) { DockPreferences dockPrefs = new DockPreferences (name); Dock dock = new Dock (dockPrefs); docks.Add (dock); } }
public Dock CreateDock () { int mon; for (mon = 0; mon < Screen.Default.NMonitors; mon++) { if (PositionsAvailableForDock (mon).Any ()) break; if (mon == Screen.Default.NMonitors - 1) return null; } string name = "Dock" + 1; for (int i = 2; DockNames.Contains (name); i++) name = "Dock" + i; DockNames = DockNames.Concat (new[] { name }); DockPreferences dockPrefs = new DockPreferences (name, mon); dockPrefs.Position = PositionsAvailableForDock (mon).First (); Dock dock = new Dock (dockPrefs); docks.Add (dock); return dock; }
public bool DeleteDock (Dock dock) { if (!docks.Contains (dock) || docks.Count == 1) return false; docks.Remove (dock); if (dock.Preferences.DefaultProvider.IsWindowManager) docks.First ().Preferences.DefaultProvider.SetWindowManager (); dock.Preferences.FreeProviders (); dock.Preferences.ResetPreferences (); dock.Dispose (); DockNames = DockNames.Where (s => s != dock.Preferences.GetName ()); return true; }
protected virtual void OnDeleteDockButtonClicked (object sender, System.EventArgs e) { if (!(Docky.Controller.Docks.Count () > 1)) return; if (ActiveDock != null) { Gtk.MessageDialog md = new Gtk.MessageDialog (null, 0, Gtk.MessageType.Warning, Gtk.ButtonsType.None, "<b><big>" + Catalog.GetString ("Delete the currently selected dock?") + "</big></b>"); md.Icon = DockServices.Drawing.LoadIcon ("docky", 22); md.SecondaryText = Catalog.GetString ("If you choose to delete the dock, all settings\n" + "for the deleted dock will be permanently lost."); md.Modal = true; md.KeepAbove = true; md.Stick (); md.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); md.AddButton (Catalog.GetString ("_Delete Dock"), Gtk.ResponseType.Ok); md.DefaultResponse = Gtk.ResponseType.Ok; if ((ResponseType)md.Run () == Gtk.ResponseType.Ok) { ActiveDock.ConfigurationClick -= HandleDockConfigurationClick; ActiveDock.LeaveConfigurationMode (); Docky.Controller.DeleteDock (ActiveDock); if (Docky.Controller.Docks.Count () == 1) ActiveDock = Docky.Controller.Docks.First (); else ActiveDock = null; } md.Destroy (); } }
protected virtual void OnNewDockButtonClicked (object sender, System.EventArgs e) { Dock newDock = Docky.Controller.CreateDock (); if (newDock != null) { newDock.ConfigurationClick += HandleDockConfigurationClick; newDock.EnterConfigurationMode (); ActiveDock = newDock; } }
void HandleDockConfigurationClick (object sender, EventArgs e) { ActiveDock = sender as Dock; }
protected virtual void OnThemeComboChanged (object sender, System.EventArgs e) { DockServices.Theme.DockTheme = theme_combo.ActiveText; if (Docky.Controller.NumDocks == 1) ActiveDock = null; }
protected override void OnShown () { CurtainWindow.Instance.CurtainDown (); foreach (Dock dock in Docky.Controller.Docks) { dock.EnterConfigurationMode (); dock.ConfigurationClick += HandleDockConfigurationClick; } if (Docky.Controller.Docks.Count () == 1) ActiveDock = Docky.Controller.Docks.First (); config_notebook.CurrentPage = (int) Pages.Docks; KeepAbove = true; Stick (); base.OnShown (); }
protected virtual void OnCloseButtonClicked (object sender, System.EventArgs e) { Hide (); ActiveDock = null; }
protected override bool OnDeleteEvent (Event evnt) { Hide (); ActiveDock = null; return true; }
private ConfigurationWindow () : base(Gtk.WindowType.Toplevel) { this.Build (); SkipTaskbarHint = true; int i = 0; foreach (string theme in DockServices.Theme.DockThemes.Distinct ()) { theme_combo.AppendText (theme); if (DockServices.Theme.DockTheme == theme) theme_combo.Active = i; i++; } if (Docky.Controller.Docks.Count () == 1) ActiveDock = Docky.Controller.Docks.First (); start_with_computer_checkbutton.Sensitive = DesktopFile.Exists; if (start_with_computer_checkbutton.Sensitive) start_with_computer_checkbutton.Active = AutoStart; // setup docklets { docklettiles = new List<DockletTile> (); DockletSearch = new SearchEntry (); DockletSearch.EmptyMessage = Catalog.GetString ("Search Docklets..."); DockletSearch.InnerEntry.Changed += delegate { RefreshDocklets (); }; DockletSearch.Ready = true; DockletSearch.Show (); hbox1.PackStart (DockletSearch, true, true, 2); DockletsTileview = new TileView (); DockletsTileview.IconSize = 48; docklet_scroll.AddWithViewport (DockletsTileview); // } // setup helpers if (!UserArgs.DisableDockManager) { helpertiles = new List<HelperTile> (); HelperSearch = new SearchEntry (); HelperSearch.EmptyMessage = Catalog.GetString ("Search Helpers..."); HelperSearch.InnerEntry.Changed += delegate { RefreshHelpers (); }; HelperSearch.Ready = true; HelperSearch.Show (); hbox5.PackStart (HelperSearch, true, true, 2); HelpersTileview = new TileView (); HelpersTileview.IconSize = 48; helper_scroll.AddWithViewport (HelpersTileview); DockServices.Helpers.HelperInstalled += delegate { RefreshHelpers (); }; DockServices.Helpers.HelperUninstalled += delegate { RefreshHelpers (); }; } SetupConfigAlignment(); ShowAll (); }
public override void Dispose () { ActiveDock = null; if (HelpersTileview != null) HelpersTileview.Clear (); if (DockletsTileview != null) DockletsTileview.Clear (); helpertiles.ForEach (to => to.Dispose ()); helpertiles.Clear (); docklettiles.ForEach (to => to.Dispose ()); docklettiles.Clear (); base.Dispose (); }