Commit 573c0464c5254de46fce7d7b6771d5006d556b25
- Diff rendering mode:
- inline
- side by side
|   | |||
| 1 | 1 | <Addin namespace="FSpot" | |
| 2 | 2 | id="VersionSidebar" | |
| 3 | version="0.6.3" | ||
| 3 | version="0.6.4" | ||
| 4 | 4 | name="VersionSidebar" | |
| 5 | 5 | description="Shows versions in the sidebar" | |
| 6 | 6 | author="Paul Wellner Bou" |
VersionSidebar/VersionSidebar.cs
(20 / 1)
|   | |||
| 12 | 12 | using System.Text; | |
| 13 | 13 | using System.Collections.Generic; | |
| 14 | 14 | using Gtk; | |
| 15 | using Gdk; | ||
| 15 | 16 | ||
| 16 | 17 | using Mono.Unix; | |
| 17 | 18 | ||
| … | … | ||
| 72 | 72 | } | |
| 73 | 73 | ||
| 74 | 74 | internal void HandleSelectionChanged (IBrowsableCollection collection) { | |
| 75 | |||
| 76 | FSpot.Utils.Log.Debug ("HandleSelectionChanged..."); | ||
| 77 | |||
| 75 | 78 | if (collection != null && collection.Count == 1) | |
| 76 | 79 | SelectedItem = collection [0]; | |
| 77 | 80 | else | |
| … | … | ||
| 83 | 83 | ||
| 84 | 84 | void ShowPhotoVersions () | |
| 85 | 85 | { | |
| 86 | FSpot.Utils.Log.Debug ("Show photo versions..."); | ||
| 87 | |||
| 86 | 88 | try { | |
| 87 | 89 | ClearPhotoVersionViews (); | |
| 88 | 90 | if (SelectedItem == null) | |
| 89 | 91 | return; | |
| 90 | 92 | ||
| 93 | FSpot.Utils.Log.Debug ("Getting versions of selected item..."); | ||
| 94 | |||
| 91 | 95 | FSpot.Photo photo = (FSpot.Photo) SelectedItem; | |
| 92 | 96 | uint [] version_ids = photo.VersionIds; | |
| 93 | 97 | IBrowsableItem [] items = new IBrowsableItem [version_ids.Length]; | |
| … | … | ||
| 110 | 110 | versions.Add (items); | |
| 111 | 111 | ||
| 112 | 112 | view = new IconView (versions); | |
| 113 | |||
| 114 | // see bug #600032 | ||
| 115 | view.AddEvents ( (int) EventMask.KeyPressMask | ||
| 116 | | (int) EventMask.KeyReleaseMask | ||
| 117 | | (int) EventMask.PointerMotionMask | ||
| 118 | | (int) EventMask.ButtonPressMask | ||
| 119 | | (int) EventMask.ButtonReleaseMask); | ||
| 120 | |||
| 113 | 121 | if (selected_version_id >= 0) | |
| 114 | 122 | view.Selection.Add (selected_version_id); | |
| 115 | 123 | view.Selection.Changed += OnVersionClicked; | |
| … | … | ||
| 134 | 134 | ||
| 135 | 135 | void OnVersionClicked (IBrowsableCollection collection) | |
| 136 | 136 | { | |
| 137 | if (collection.Count != 1 || SelectedItem == null) | ||
| 137 | FSpot.Utils.Log.Debug ("OnVersionClicked..."); | ||
| 138 | |||
| 139 | if (collection.Count != 1 || SelectedItem == null) { | ||
| 138 | 140 | return; | |
| 141 | } | ||
| 139 | 142 | ||
| 140 | 143 | PhotoVersion selected_item = (PhotoVersion) collection.Items[0]; | |
| 141 | 144 |

