public PhotoVersionMenu(IPhoto photo) { Version = photo.DefaultVersion; version_mapping = new Dictionary <MenuItem, IPhotoVersion> (); foreach (IPhotoVersion version in photo.Versions) { MenuItem menu_item = new MenuItem(version.Name); menu_item.Show(); menu_item.Sensitive = true; Gtk.Label child = ((Gtk.Label)menu_item.Child); if (version == photo.DefaultVersion) { child.UseMarkup = true; child.Markup = String.Format("<b>{0}</b>", version.Name); } version_mapping.Add(menu_item, version); Append(menu_item); } if (version_mapping.Count == 1) { MenuItem no_edits_menu_item = new MenuItem(Mono.Unix.Catalog.GetString("(No Edits)")); no_edits_menu_item.Show(); no_edits_menu_item.Sensitive = false; Append(no_edits_menu_item); } }
public PhotoVersionMenu(IPhoto photo) { Version = photo.DefaultVersion; versionMapping = new Dictionary <MenuItem, IPhotoVersion> (); foreach (var version in photo.Versions) { var menu_item = new MenuItem(version.Name); menu_item.Show(); menu_item.Sensitive = true; var child = ((Gtk.Label)menu_item.Child); if (version == photo.DefaultVersion) { child.UseMarkup = true; child.Markup = $"<b>{version.Name}</b>"; } versionMapping.Add(menu_item, version); Append(menu_item); } if (versionMapping.Count == 1) { var no_edits_menu_item = new MenuItem(Strings.ParenNoEditsParen); no_edits_menu_item.Show(); no_edits_menu_item.Sensitive = false; Append(no_edits_menu_item); } }
void HandleVersionChanged(InfoBox box, IPhotoVersion version) { if (item.Current is IPhotoVersionable versionable && item.Collection is PhotoQuery q) { versionable.SetDefaultVersion(version); q.Commit(item.Index); } }
void HandleMenuItemActivated(object sender, EventArgs args) { if (sender is MenuItem item && versionMapping.ContainsKey(item)) { Version = versionMapping[item]; VersionChanged(this); } }
public void SetDefaultVersion(IPhotoVersion version) { if (!(version is PhotoVersion photoVersion)) { throw new ArgumentException("Not a valid version for this photo"); } DefaultVersionId = photoVersion.VersionId; }
private void HandleVersionChanged(InfoBox box, IPhotoVersion version) { IPhotoVersionable versionable = item.Current as IPhotoVersionable; PhotoQuery q = item.Collection as PhotoQuery; if (versionable != null && q != null) { versionable.SetDefaultVersion (version); q.Commit (item.Index); } }
// XXX: never called private void HandleMenuItemActivated(object sender, EventArgs args) { MenuItem item = sender as MenuItem; if (item != null && version_mapping.ContainsKey(item)) { Version = version_mapping [item]; VersionChanged(this); } }
public void SetDefaultVersion(IPhotoVersion version) { PhotoVersion photo_version = version as PhotoVersion; if (photo_version == null) { throw new ArgumentException("Not a valid version for this photo"); } DefaultVersionId = photo_version.VersionId; }
private void HandleVersionChanged(InfoBox box, IPhotoVersion version) { IPhotoVersionable versionable = item.Current as IPhotoVersionable; PhotoQuery q = item.Collection as PhotoQuery; if (versionable != null && q != null) { versionable.SetDefaultVersion(version); q.Commit(item.Index); } }
public void SetDefaultVersion(IPhotoVersion version) { PhotoVersion photo_version = version as PhotoVersion; if (photo_version == null) throw new ArgumentException ("Not a valid version for this photo"); DefaultVersionId = photo_version.VersionId; }
// Version Id updates. void UpdateForVersionChange (IPhotoVersion version) { IPhotoVersionable versionable = CurrentPhoto; if (versionable != null) { versionable.SetDefaultVersion (version); query.Commit (ActiveIndex ()); } }
private void HandleMenuItemActivated(object sender, EventArgs args) { MenuItem item = sender as MenuItem; if (item != null && version_mapping.ContainsKey (item)) { Version = version_mapping [item]; VersionChanged (this); } }