Merge lp:~philip.scott/pantheon-photos/no-ratings into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Felipe Escoto
Status: Merged
Approved by: Danielle Foré
Approved revision: 3013
Merged at revision: 3011
Proposed branch: lp:~philip.scott/pantheon-photos/no-ratings
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 3655 lines (+121/-2400)
36 files modified
data/ui/collection.ui (+1/-3)
data/ui/media.ui (+1/-3)
data/ui/photo.ui (+1/-3)
data/ui/photo_context.ui (+1/-3)
schemas/org.pantheon.photos.gschema.xml (+0/-12)
src/CMakeLists.txt (+0/-1)
src/CollectionPage.vala (+2/-4)
src/Commands.vala (+0/-102)
src/Event.vala (+1/-4)
src/MediaDataRepresentation.vala (+0/-5)
src/MediaPage.vala (+2/-229)
src/MetadataWriter.vala (+1/-8)
src/Page.vala (+0/-22)
src/Photo.vala (+5/-146)
src/PhotoPage.vala (+13/-151)
src/Resources.vala (+0/-364)
src/SearchFilter.vala (+2/-170)
src/Thumbnail.vala (+1/-31)
src/VideoSupport.vala (+0/-38)
src/config/ConfigurationInterfaces.vala (+0/-24)
src/config/GSettingsEngine.vala (+0/-2)
src/core/ViewCollection.vala (+1/-1)
src/db/PhotoTable.vala (+55/-67)
src/db/SavedSearchDBTable.vala (+12/-81)
src/db/VideoTable.vala (+12/-20)
src/library/FlaggedPage.vala (+1/-2)
src/library/OfflinePage.vala (+1/-1)
src/library/PhotosPage.vala (+2/-3)
src/library/RawsPage.vala (+1/-2)
src/library/TrashPage.vala (+1/-1)
src/library/VideosPage.vala (+2/-3)
src/photos/PhotoMetadata.vala (+0/-42)
src/searches/SavedSearchDialog.vala (+0/-73)
src/searches/SearchBoolean.vala (+1/-83)
src/sidebar/Rating.vala (+0/-666)
src/sidebar/metadata/LibraryProperties.vala (+1/-30)
To merge this branch: bzr merge lp:~philip.scott/pantheon-photos/no-ratings
Reviewer Review Type Date Requested Status
Danielle Foré testing Approve
Review via email: mp+306154@code.launchpad.net

Commit message

Remove rating system

Description of the change

Get rid of the starts... everywhere!

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

src/photos/PhotoMetadata.vala:1138.5-1138.39: warning: field `PhotoMetadata.RATING_TAGS' never used
    private static string[] RATING_TAGS = {
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Revision history for this message
Danielle Foré (danrabbit) wrote :

It looks like something got messed up and a bunch of menuitems are missing

review: Needs Fixing
3011. By Felipe Escoto

Kill more ratings

Revision history for this message
Danielle Foré (danrabbit) wrote :

As far as I can tell this is working as expected. I don't see any extra issues that are abnormal from trunk. I think someone else should also confirm though just to be safe

review: Approve (testing)
Revision history for this message
Danielle Foré (danrabbit) wrote :

Okay nevermind looks like it now has trouble creating a new database :p

review: Needs Fixing
3012. By Felipe Escoto

Narrow crash on db creation

3013. By Felipe Escoto

Fixed crash on creating a new DB

Revision history for this message
Danielle Foré (danrabbit) wrote :

Sorry it took me so long to follow up here. I can confirm that with this branch you can now create a new database just fine :)

review: Approve (testing)
Revision history for this message
Danielle Foré (danrabbit) wrote :

I have confirmation from a third party that they also haven't experienced issues. Gonna merge this beast so we can move forward

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/ui/collection.ui'
2--- data/ui/collection.ui 2015-09-05 09:05:13 +0000
3+++ data/ui/collection.ui 2016-09-20 02:43:10 +0000
4@@ -10,8 +10,6 @@
5 <placeholder name="ContextFacesPlaceholder" />
6 <separator />
7 <menuitem name="ContextFlag" action="Flag" />
8- <menuitem name="RateRejected" action="RateRejected" />
9- <placeholder name="RatingWidgetPlaceholder" />
10 <menu name="RawDeveloper" action="RawDeveloper">
11 <menuitem name="RawDeveloperShotwell" action="RawDeveloperShotwell" />
12 <menuitem name="RawDeveloperCamera" action="RawDeveloperCamera" />
13@@ -43,4 +41,4 @@
14 <toolitem name="ToolPublish" action="Publish" />
15 <separator />
16 </toolbar>
17-</ui>
18\ No newline at end of file
19+</ui>
20
21=== modified file 'data/ui/media.ui'
22--- data/ui/media.ui 2014-09-02 19:42:49 +0000
23+++ data/ui/media.ui 2016-09-20 02:43:10 +0000
24@@ -6,12 +6,10 @@
25 <menuitem name="ViewTitle" action="ViewTitle" />
26 <menuitem name="ViewComment" action="ViewComment" />
27 <menuitem name="ViewTags" action="ViewTags" />
28- <menuitem name="ViewRatings" action="ViewRatings" />
29 <separator />
30 <menu name="SortPhotos" action="SortPhotos">
31 <menuitem name="SortByTitle" action="SortByTitle" />
32 <menuitem name="SortByExposureDate" action="SortByExposureDate" />
33- <menuitem name="SortByRating" action="SortByRating" />
34 <separator />
35 <menuitem name="SortAscending" action="SortAscending" />
36 <menuitem name="SortDescending" action="SortDescending" />
37@@ -26,4 +24,4 @@
38 <menuitem name="SelectAll" action="CommonSelectAll" />
39 </popup>
40
41-</ui>
42\ No newline at end of file
43+</ui>
44
45=== modified file 'data/ui/photo.ui'
46--- data/ui/photo.ui 2014-09-02 19:42:49 +0000
47+++ data/ui/photo.ui 2016-09-20 02:43:10 +0000
48@@ -10,8 +10,6 @@
49 <menuitem name="DisplaySidebar" action="CommonDisplaySidebar" />
50 <menuitem name="DisplayMetadataSidebar" action="CommonDisplayMetadataSidebar" />
51 <separator />
52- <menuitem name="ViewRatings" action="ViewRatings" />
53- <separator />
54 <menu name="SortEvents" action="CommonSortEvents">
55 <menuitem name="SortEventsAscending" action="CommonSortEventsAscending" />
56 <menuitem name="SortEventsDescending" action="CommonSortEventsDescending" />
57@@ -26,4 +24,4 @@
58 <menuitem name="Slideshow" action="Slideshow" />
59 </popup>
60
61-</ui>
62\ No newline at end of file
63+</ui>
64
65=== modified file 'data/ui/photo_context.ui'
66--- data/ui/photo_context.ui 2015-09-05 09:05:13 +0000
67+++ data/ui/photo_context.ui 2016-09-20 02:43:10 +0000
68@@ -8,8 +8,6 @@
69 <menuitem name="ContextPasteColorAdjustments" action="PasteColorAdjustments" />
70 <separator />
71 <menuitem name="ContextFlag" action="Flag" />
72- <menuitem name="RateRejected" action="RateRejected" />
73- <placeholder name="RatingWidgetPlaceholder" />
74 <menu name="RawDeveloper" action="RawDeveloper">
75 <menuitem name="RawDeveloperShotwell" action="RawDeveloperShotwell" />
76 <menuitem name="RawDeveloperCamera" action="RawDeveloperCamera" />
77@@ -30,4 +28,4 @@
78 <menuitem name="ContextMoveToTrash" action="MoveToTrash" />
79 </popup>
80
81-</ui>
82\ No newline at end of file
83+</ui>
84
85=== modified file 'schemas/org.pantheon.photos.gschema.xml'
86--- schemas/org.pantheon.photos.gschema.xml 2016-07-30 17:03:44 +0000
87+++ schemas/org.pantheon.photos.gschema.xml 2016-09-20 02:43:10 +0000
88@@ -71,18 +71,6 @@
89 <description>True if photo tags are to be listed beneath thumbnails in collection views, false otherwise.</description>
90 </key>
91
92- <key name="display-photo-ratings" type="b">
93- <default>true</default>
94- <summary>display photo ratings</summary>
95- <description>True if a photo's rating should be displayed as overlaid trinket, false otherwise.</description>
96- </key>
97-
98- <key name="photo-rating-filter" type="i">
99- <default>0</default>
100- <summary>rating filter level</summary>
101- <description>Determines how to filter photos based on their ratings. 1: Rejected or better, 2: Unrated or better, 3: One or better, 4: Two or better, 5: Three or better, 6: Four or better, 7: Five or better.</description>
102- </key>
103-
104 <key name="events-sort-ascending" type="b">
105 <default>false</default>
106 <summary>sort events ascending</summary>
107
108=== modified file 'src/CMakeLists.txt'
109--- src/CMakeLists.txt 2016-01-14 22:06:23 +0000
110+++ src/CMakeLists.txt 2016-09-20 02:43:10 +0000
111@@ -170,7 +170,6 @@
112 sidebar/Branch.vala
113 sidebar/common.vala
114 sidebar/Entry.vala
115- sidebar/Rating.vala
116 sidebar/Sidebar.vala
117 sidebar/Tree.vala
118
119
120=== modified file 'src/CollectionPage.vala'
121--- src/CollectionPage.vala 2014-09-29 15:08:44 +0000
122+++ src/CollectionPage.vala 2016-09-20 02:43:10 +0000
123@@ -22,7 +22,7 @@
124 protected class CollectionSearchViewFilter : DefaultSearchViewFilter {
125 public override uint get_criteria () {
126 return SearchFilterCriteria.TEXT | SearchFilterCriteria.FLAG |
127- SearchFilterCriteria.MEDIA | SearchFilterCriteria.RATING;
128+ SearchFilterCriteria.MEDIA;
129 }
130 }
131
132@@ -234,8 +234,6 @@
133 }
134
135 populate_contractor_menu (menu, "/CollectionContextMenu/ContractorPlaceholder");
136- populate_rating_widget_menu_item (menu, "/CollectionContextMenu/RatingWidgetPlaceholder");
137- update_rating_sensitivities ();
138 menu.show_all ();
139 return menu;
140 }
141@@ -841,4 +839,4 @@
142 public override SearchViewFilter get_search_view_filter () {
143 return search_filter;
144 }
145-}
146\ No newline at end of file
147+}
148
149=== modified file 'src/Commands.vala'
150--- src/Commands.vala 2014-09-27 09:58:03 +0000
151+++ src/Commands.vala 2016-09-20 02:43:10 +0000
152@@ -1169,108 +1169,6 @@
153 }
154 }
155
156-public class SetRatingSingleCommand : SingleDataSourceCommand {
157- private Rating last_rating;
158- private Rating new_rating;
159- private bool set_direct;
160- private bool incrementing;
161-
162- public SetRatingSingleCommand (DataSource source, Rating rating) {
163- base (source, Resources.rating_label (rating), "");
164- set_direct = true;
165- new_rating = rating;
166-
167- last_rating = ((LibraryPhoto)source).get_rating ();
168- }
169-
170- public SetRatingSingleCommand.inc_dec (DataSource source, bool is_incrementing) {
171- base (source, is_incrementing ? Resources.INCREASE_RATING_LABEL :
172- Resources.DECREASE_RATING_LABEL, "");
173- set_direct = false;
174- incrementing = is_incrementing;
175-
176- last_rating = ((MediaSource) source).get_rating ();
177- }
178-
179- public override void execute () {
180- if (set_direct)
181- ((MediaSource) source).set_rating (new_rating);
182- else {
183- if (incrementing)
184- ((MediaSource) source).increase_rating ();
185- else
186- ((MediaSource) source).decrease_rating ();
187- }
188- }
189-
190- public override void undo () {
191- ((MediaSource) source).set_rating (last_rating);
192- }
193-}
194-
195-public class SetRatingCommand : MultipleDataSourceCommand {
196- private Gee.HashMap<DataSource, Rating> last_rating_map;
197- private Rating new_rating;
198- private bool set_direct;
199- private bool incrementing;
200- private int action_count = 0;
201-
202- public SetRatingCommand (Gee.Iterable<DataView> iter, Rating rating) {
203- base (iter, Resources.rating_progress (rating), _ ("Restoring previous rating"),
204- Resources.rating_label (rating), "");
205- set_direct = true;
206- new_rating = rating;
207-
208- save_source_states (iter);
209- }
210-
211- public SetRatingCommand.inc_dec (Gee.Iterable<DataView> iter, bool is_incrementing) {
212- base (iter,
213- is_incrementing ? _ ("Increasing ratings") : _ ("Decreasing ratings"),
214- is_incrementing ? _ ("Decreasing ratings") : _ ("Increasing ratings"),
215- is_incrementing ? Resources.INCREASE_RATING_LABEL : Resources.DECREASE_RATING_LABEL,
216- "");
217- set_direct = false;
218- incrementing = is_incrementing;
219-
220- save_source_states (iter);
221- }
222-
223- private void save_source_states (Gee.Iterable<DataView> iter) {
224- last_rating_map = new Gee.HashMap<DataSource, Rating> ();
225-
226- foreach (DataView view in iter) {
227- DataSource source = view.get_source ();
228- last_rating_map[source] = ((MediaSource) source).get_rating ();
229- }
230- }
231-
232- public override void execute () {
233- action_count = 0;
234- base.execute ();
235- }
236-
237- public override void undo () {
238- action_count = 0;
239- base.undo ();
240- }
241-
242- public override void execute_on_source (DataSource source) {
243- if (set_direct)
244- ((MediaSource) source).set_rating (new_rating);
245- else {
246- if (incrementing)
247- ((MediaSource) source).increase_rating ();
248- else
249- ((MediaSource) source).decrease_rating ();
250- }
251- }
252-
253- public override void undo_on_source (DataSource source) {
254- ((MediaSource) source).set_rating (last_rating_map[source]);
255- }
256-}
257-
258 public class SetRawDeveloperCommand : MultipleDataSourceCommand {
259 private Gee.HashMap<Photo, RawDeveloper> last_developer_map;
260 private Gee.HashMap<Photo, PhotoTransformationState> last_transformation_map;
261
262=== modified file 'src/Event.vala'
263--- src/Event.vala 2014-08-08 21:13:09 +0000
264+++ src/Event.vala 2016-09-20 02:43:10 +0000
265@@ -453,16 +453,13 @@
266
267 break;
268 }
269-
270- if (alteration.has_detail ("metadata", "rating"))
271- should_remake_thumb = true;
272 }
273
274 assert (get_primary_source () is MediaSource);
275
276 if (should_remake_thumb) {
277 // check whether we actually need to remake this thumbnail...
278- if ((get_primary_source () == null) || (get_primary_source ().get_rating () == Rating.REJECTED)) {
279+ if ((get_primary_source () == null)) {
280 // yes, rejected - drop it and get a new one...
281 set_primary_source ((MediaSource) view.get_first_unrejected ().get_source ());
282 }
283
284=== modified file 'src/MediaDataRepresentation.vala'
285--- src/MediaDataRepresentation.vala 2014-08-08 21:13:09 +0000
286+++ src/MediaDataRepresentation.vala 2016-09-20 02:43:10 +0000
287@@ -172,11 +172,6 @@
288 PrepareInputTextOptions.DEFAULT & ~PrepareInputTextOptions.STRIP_CRLF & ~PrepareInputTextOptions.EMPTY_IS_NULL, -1);
289 }
290
291- public abstract Rating get_rating ();
292- public abstract void set_rating (Rating rating);
293- public abstract void increase_rating ();
294- public abstract void decrease_rating ();
295-
296 public abstract Dimensions get_dimensions (Photo.Exception disallowed_steps = Photo.Exception.NONE);
297
298 // A preview pixbuf is one that can be quickly generated and scaled as a preview. For media
299
300=== modified file 'src/MediaPage.vala'
301--- src/MediaPage.vala 2015-09-21 05:25:15 +0000
302+++ src/MediaPage.vala 2016-09-20 02:43:10 +0000
303@@ -107,8 +107,7 @@
304 MIN = 1,
305 TITLE = 1,
306 EXPOSURE_DATE = 2,
307- RATING = 3,
308- MAX = 3
309+ MAX = 2
310 }
311
312 protected class ZoomSliderAssembly : Gtk.ToolItem {
313@@ -242,8 +241,7 @@
314 get_view ().set_property (Thumbnail.PROP_SHOW_TAGS,
315 Config.Facade.get_instance ().get_display_photo_tags ());
316 get_view ().set_property (Thumbnail.PROP_SIZE, get_thumb_size ());
317- get_view ().set_property (Thumbnail.PROP_SHOW_RATINGS,
318- Config.Facade.get_instance ().get_display_photo_ratings ());
319+
320 get_view ().thaw_notifications ();
321
322 // enable drag-and-drop export of media
323@@ -311,28 +309,6 @@
324 flag.label = Resources.FLAG_MENU;
325 actions += flag;
326
327- Gtk.ActionEntry set_rating = { "Rate", null, TRANSLATABLE, null, null, null };
328- set_rating.label = Resources.RATING_MENU;
329- actions += set_rating;
330-
331- Gtk.ActionEntry increase_rating = { "IncreaseRating", null, TRANSLATABLE,
332- "greater", TRANSLATABLE, on_increase_rating
333- };
334- increase_rating.label = Resources.INCREASE_RATING_MENU;
335- actions += increase_rating;
336-
337- Gtk.ActionEntry decrease_rating = { "DecreaseRating", null, TRANSLATABLE,
338- "less", TRANSLATABLE, on_decrease_rating
339- };
340- decrease_rating.label = Resources.DECREASE_RATING_MENU;
341- actions += decrease_rating;
342-
343- Gtk.ActionEntry rate_rejected = { "RateRejected", null, TRANSLATABLE,
344- "9", TRANSLATABLE, on_rate_rejected
345- };
346- rate_rejected.label = Resources.rating_menu (Rating.REJECTED);
347- actions += rate_rejected;
348-
349 Gtk.ActionEntry sort_photos = { "SortPhotos", null, TRANSLATABLE, null, null, null };
350 sort_photos.label = _ ("Sort _Photos");
351 actions += sort_photos;
352@@ -379,13 +355,6 @@
353 comments.tooltip = _ ("Display the comment of each photo");
354 toggle_actions += comments;
355
356- Gtk.ToggleActionEntry ratings = { "ViewRatings", null, TRANSLATABLE, "<Ctrl><Shift>N",
357- TRANSLATABLE, on_display_ratings, Config.Facade.get_instance ().get_display_photo_ratings ()
358- };
359- ratings.label = Resources.VIEW_RATINGS_MENU;
360- ratings.tooltip = Resources.VIEW_RATINGS_TOOLTIP;
361- toggle_actions += ratings;
362-
363 Gtk.ToggleActionEntry tags = { "ViewTags", null, TRANSLATABLE, "<Ctrl><Shift>G",
364 TRANSLATABLE, on_display_tags, Config.Facade.get_instance ().get_display_photo_tags ()
365 };
366@@ -418,13 +387,6 @@
367 by_date.tooltip = _ ("Sort photos by exposure date");
368 sort_crit_actions += by_date;
369
370- Gtk.RadioActionEntry by_rating = { "SortByRating", null, TRANSLATABLE, null,
371- TRANSLATABLE, SortBy.RATING
372- };
373- by_rating.label = _ ("By _Rating");
374- by_rating.tooltip = _ ("Sort photos by rating");
375- sort_crit_actions += by_rating;
376-
377 action_group.add_radio_actions (sort_crit_actions, sort_by, on_sort_changed);
378
379 // Sort order.
380@@ -458,7 +420,6 @@
381 set_action_sensitive ("MoveToTrash", selected_count > 0);
382
383 set_action_sensitive ("Rate", selected_count > 0);
384- update_rating_sensitivities ();
385
386 update_development_menu_item_sensitivity ();
387
388@@ -477,19 +438,6 @@
389 }
390 }
391
392- protected void update_rating_sensitivities () {
393- if (rating_menu_item != null) {
394- rating_menu_item.sensitive = can_rate_selected ();
395- rating_menu_item.rating_value = Resources.int_to_rating (get_selected_rating ());
396- }
397- set_action_sensitive ("IncreaseRating", can_increase_selected_rating ());
398- set_action_sensitive ("DecreaseRating", can_decrease_selected_rating ());
399- }
400-
401- protected override void on_rating_widget_activate () {
402- on_set_rating (Resources.int_to_rating(rating_menu_item.rating_value));
403- }
404-
405 private void update_development_menu_item_sensitivity () {
406 if (get_view ().get_selected ().size == 0) {
407 set_action_sensitive ("RawDeveloper", false);
408@@ -559,52 +507,6 @@
409 return tracker;
410 }
411
412- public void set_display_ratings (bool display) {
413- get_view ().freeze_notifications ();
414- get_view ().set_property (Thumbnail.PROP_SHOW_RATINGS, display);
415- get_view ().thaw_notifications ();
416-
417- Gtk.ToggleAction? action = get_action ("ViewRatings") as Gtk.ToggleAction;
418- if (action != null)
419- action.set_active (display);
420- }
421-
422- private bool can_rate_selected () {
423- return get_view ().get_selected ().size > 0;
424- }
425-
426- private Rating get_selected_rating () {
427- bool init = false;
428- Rating last_rating = Rating.UNRATED;
429- foreach (DataView view in get_view ().get_selected ()) {
430- var rating = ((Thumbnail) view).get_media_source ().get_rating ();
431- if (!init)
432- init = true;
433- else if (last_rating != rating)
434- return Rating.UNRATED;
435- last_rating = rating;
436- }
437- return last_rating;
438- }
439-
440- private bool can_increase_selected_rating () {
441- foreach (DataView view in get_view ().get_selected ()) {
442- if (((Thumbnail) view).get_media_source ().get_rating ().can_increase ())
443- return true;
444- }
445-
446- return false;
447- }
448-
449- private bool can_decrease_selected_rating () {
450- foreach (DataView view in get_view ().get_selected ()) {
451- if (((Thumbnail) view).get_media_source ().get_rating ().can_decrease ())
452- return true;
453- }
454-
455- return false;
456- }
457-
458 public ZoomSliderAssembly create_zoom_slider_assembly () {
459 return new ZoomSliderAssembly ();
460 }
461@@ -658,82 +560,6 @@
462 activate_action ("DecreaseSize");
463 break;
464
465- case "period":
466- activate_action ("IncreaseRating");
467- break;
468-
469- case "comma":
470- activate_action ("DecreaseRating");
471- break;
472-
473- case "1":
474- on_set_rating (Rating.ONE);
475- break;
476-
477- case "2":
478- on_set_rating (Rating.TWO);
479- break;
480-
481- case "3":
482- on_set_rating (Rating.THREE);
483- break;
484-
485- case "4":
486- on_set_rating (Rating.FOUR);
487- break;
488-
489- case "5":
490- on_set_rating (Rating.FIVE);
491- break;
492-
493- case "0":
494- on_set_rating (Rating.UNRATED);
495- break;
496-
497- case "9":
498- activate_action ("RateRejected");
499- break;
500-
501- case "exclam":
502- if (get_ctrl_pressed ())
503- get_search_view_filter ().set_rating_filter (RatingFilter.ONE_OR_HIGHER);
504- break;
505-
506- case "at":
507- if (get_ctrl_pressed ())
508- get_search_view_filter ().set_rating_filter (RatingFilter.TWO_OR_HIGHER);
509- break;
510-
511- case "numbersign":
512- if (get_ctrl_pressed ())
513- get_search_view_filter ().set_rating_filter (RatingFilter.THREE_OR_HIGHER);
514- break;
515-
516- case "dollar":
517- if (get_ctrl_pressed ())
518- get_search_view_filter ().set_rating_filter (RatingFilter.FOUR_OR_HIGHER);
519- break;
520-
521- case "percent":
522- if (get_ctrl_pressed ())
523- get_search_view_filter ().set_rating_filter (RatingFilter.FIVE_OR_HIGHER);
524- break;
525-
526- case "parenright":
527- if (get_ctrl_pressed ())
528- get_search_view_filter ().set_rating_filter (RatingFilter.UNRATED_OR_HIGHER);
529- break;
530-
531- case "parenleft":
532- if (get_ctrl_pressed ())
533- get_search_view_filter ().set_rating_filter (RatingFilter.REJECTED_OR_HIGHER);
534- break;
535-
536- case "asterisk":
537- if (get_ctrl_pressed ())
538- get_search_view_filter ().set_rating_filter (RatingFilter.REJECTED_ONLY);
539- break;
540-
541 case "slash":
542 activate_action ("Flag");
543 break;
544@@ -753,7 +579,6 @@
545 get_view ().freeze_notifications ();
546 set_display_titles (Config.Facade.get_instance ().get_display_photo_titles ());
547 set_display_comments (Config.Facade.get_instance ().get_display_photo_comments ());
548- set_display_ratings (Config.Facade.get_instance ().get_display_photo_ratings ());
549 set_display_tags (Config.Facade.get_instance ().get_display_photo_tags ());
550 get_view ().thaw_notifications ();
551
552@@ -850,40 +675,6 @@
553 get_command_manager ().execute (new FlagUnflagCommand (sources, flag));
554 }
555
556- protected virtual void on_increase_rating () {
557- if (get_view ().get_selected_count () == 0)
558- return;
559-
560- SetRatingCommand command = new SetRatingCommand.inc_dec (get_view ().get_selected (), true);
561- get_command_manager ().execute (command);
562-
563- update_rating_sensitivities ();
564- }
565-
566- protected virtual void on_decrease_rating () {
567- if (get_view ().get_selected_count () == 0)
568- return;
569-
570- SetRatingCommand command = new SetRatingCommand.inc_dec (get_view ().get_selected (), false);
571- get_command_manager ().execute (command);
572-
573- update_rating_sensitivities ();
574- }
575-
576- protected virtual void on_set_rating (Rating rating) {
577- if (get_view ().get_selected_count () == 0)
578- return;
579-
580- SetRatingCommand command = new SetRatingCommand (get_view ().get_selected (), rating);
581- get_command_manager ().execute (command);
582-
583- update_rating_sensitivities ();
584- }
585-
586- protected virtual void on_rate_rejected () {
587- on_set_rating (Rating.REJECTED);
588- }
589-
590 private void on_remove_from_library () {
591 remove_photos_from_library ((Gee.Collection<LibraryPhoto>) get_view ().get_selected_sources ());
592 }
593@@ -921,14 +712,6 @@
594 Config.Facade.get_instance ().set_display_photo_comments (display);
595 }
596
597- protected virtual void on_display_ratings (Gtk.Action action) {
598- bool display = ((Gtk.ToggleAction) action).get_active ();
599-
600- set_display_ratings (display);
601-
602- Config.Facade.get_instance ().set_display_photo_ratings (display);
603- }
604-
605 protected virtual void on_display_tags (Gtk.Action action) {
606 bool display = ((Gtk.ToggleAction) action).get_active ();
607
608@@ -1053,13 +836,6 @@
609 predicate = Thumbnail.exposure_time_comparator_predicate;
610 break;
611
612- case SortBy.RATING:
613- if (ascending)
614- comparator = Thumbnail.rating_ascending_comparator;
615- else comparator = Thumbnail.rating_descending_comparator;
616- predicate = Thumbnail.rating_comparator_predicate;
617- break;
618-
619 default:
620 debug ("Unknown sort criteria: %s", get_menu_sort_by ().to_string ());
621 comparator = Thumbnail.title_descending_comparator;
622@@ -1078,9 +854,6 @@
623 case SortBy.EXPOSURE_DATE:
624 return "/MediaViewMenu/SortPhotos/SortByExposureDate";
625
626- case SortBy.RATING:
627- return "/MediaViewMenu/SortPhotos/SortByRating";
628-
629 default:
630 debug ("Unknown sort criteria: %d", sort_by);
631 return "/MediaViewMenu/SortPhotos/SortByTitle";
632
633=== modified file 'src/MetadataWriter.vala'
634--- src/MetadataWriter.vala 2014-08-08 21:13:09 +0000
635+++ src/MetadataWriter.vala 2016-09-20 02:43:10 +0000
636@@ -15,7 +15,7 @@
637 public const uint COMMIT_DELAY_MSEC = 3000;
638 public const uint COMMIT_SPACING_MSEC = 50;
639
640- private const string[] INTERESTED_PHOTO_METADATA_DETAILS = { "name", "comment", "rating", "exposure-time" };
641+ private const string[] INTERESTED_PHOTO_METADATA_DETAILS = { "name", "comment", "exposure-time" };
642
643 private class CommitJob : BackgroundJob {
644 public LibraryPhoto photo;
645@@ -94,13 +94,6 @@
646 changed = true;
647 }
648
649- // rating
650- Rating current_rating = photo.get_rating ();
651- if (current_rating != metadata.get_rating ()) {
652- metadata.set_rating (current_rating);
653- changed = true;
654- }
655-
656 // exposure date/time
657 time_t current_exposure_time = photo.get_exposure_time ();
658 time_t metadata_exposure_time = 0;
659
660=== modified file 'src/Page.vala'
661--- src/Page.vala 2016-02-10 07:45:46 +0000
662+++ src/Page.vala 2016-09-20 02:43:10 +0000
663@@ -53,7 +53,6 @@
664 protected Gtk.Toolbar toolbar;
665 protected bool in_view = false;
666 protected Gtk.ToolButton show_sidebar_button;
667- protected PhotoRatingMenuItem rating_menu_item;
668
669 private string page_name;
670 private ViewCollection view = null;
671@@ -143,27 +142,6 @@
672 menu.show_all ();
673 }
674
675- protected void populate_rating_widget_menu_item (Gtk.Menu menu, string placeholder_ui) {
676- if (rating_menu_item != null) rating_menu_item.destroy ();
677- rating_menu_item = new PhotoRatingMenuItem ();
678- //find where is rating_placeholder in the menu
679- Gtk.Widget holder = ui.get_widget (placeholder_ui);
680- int pos = 0;
681- foreach (Gtk.Widget w in menu.get_children ()) {
682- if (w == holder)
683- break;
684- pos++;
685- }
686-
687- menu.append (rating_menu_item);
688- menu.reorder_child (rating_menu_item, pos);
689- rating_menu_item.activate.connect (on_rating_widget_activate);
690- menu.show_all ();
691- }
692-
693- protected virtual void on_rating_widget_activate () {
694- }
695-
696 // This is called by the page
697 // controller when it has removed this page ... pages should override
698 // this (or the signal) to clean up
699
700=== modified file 'src/Photo.vala'
701--- src/Photo.vala 2014-08-25 01:41:46 +0000
702+++ src/Photo.vala 2016-09-20 02:43:10 +0000
703@@ -77,83 +77,6 @@
704 }
705 }
706
707-public enum Rating {
708- REJECTED = -1,
709- UNRATED = 0,
710- ONE = 1,
711- TWO = 2,
712- THREE = 3,
713- FOUR = 4,
714- FIVE = 5;
715-
716- public bool can_increase () {
717- return this < FIVE;
718- }
719-
720- public bool can_decrease () {
721- return this > REJECTED;
722- }
723-
724- public bool is_valid () {
725- return this >= REJECTED && this <= FIVE;
726- }
727-
728- public Rating increase () {
729- return can_increase () ? this + 1 : this;
730- }
731-
732- public Rating decrease () {
733- return can_decrease () ? this - 1 : this;
734- }
735-
736- public int serialize () {
737- switch (this) {
738- case REJECTED:
739- return -1;
740- case UNRATED:
741- return 0;
742- case ONE:
743- return 1;
744- case TWO:
745- return 2;
746- case THREE:
747- return 3;
748- case FOUR:
749- return 4;
750- case FIVE:
751- return 5;
752- default:
753- return 0;
754- }
755- }
756-
757- public static Rating unserialize (int value) {
758- if (value > FIVE)
759- return FIVE;
760- else if (value < REJECTED)
761- return REJECTED;
762-
763- switch (value) {
764- case -1:
765- return REJECTED;
766- case 0:
767- return UNRATED;
768- case 1:
769- return ONE;
770- case 2:
771- return TWO;
772- case 3:
773- return THREE;
774- case 4:
775- return FOUR;
776- case 5:
777- return FIVE;
778- default:
779- return UNRATED;
780- }
781- }
782-}
783-
784 // Photo is an abstract class that allows for applying transformations on-the-fly to a
785 // particular photo without modifying the backing image file. The interface allows for
786 // transformations to be stored persistently elsewhere or in memory until they're committed en
787@@ -1172,7 +1095,6 @@
788 time_t exposure_time = 0;
789 string title = "";
790 string comment = "";
791- Rating rating = Rating.UNRATED;
792
793 #if TRACE_MD5
794 debug ("importing MD5 %s: exif=%s preview=%s full=%s", file.get_path (), detected.exif_md5,
795@@ -1188,7 +1110,6 @@
796 title = detected.metadata.get_title ();
797 comment = detected.metadata.get_comment ();
798 params.keywords = detected.metadata.get_keywords ();
799- rating = detected.metadata.get_rating ();
800 }
801
802 // verify basic mechanics of photo: RGB 8-bit encoding
803@@ -1222,7 +1143,6 @@
804 params.row.master.file_format = detected.file_format;
805 params.row.title = title;
806 params.row.comment = comment;
807- params.row.rating = rating;
808
809 if (params.thumbnails != null) {
810 PhotoFileReader reader = params.row.master.file_format.create_reader (
811@@ -1262,7 +1182,6 @@
812 params.row.master.file_format = PhotoFileFormat.JFIF;
813 params.row.title = null;
814 params.row.comment = null;
815- params.row.rating = Rating.UNRATED;
816
817 PhotoFileInterrogator interrogator = new PhotoFileInterrogator (params.file, params.sniffer_options);
818 try {
819@@ -1424,9 +1343,6 @@
820
821 if (updated_row.comment != detected.metadata.get_comment ())
822 list += "metadata:comment";
823-
824- if (updated_row.rating != detected.metadata.get_rating ())
825- list += "metadata:rating";
826 }
827
828 updated_row.master = backing;
829@@ -1444,7 +1360,7 @@
830
831 updated_row.title = detected.metadata.get_title ();
832 updated_row.comment = detected.metadata.get_comment ();
833- updated_row.rating = detected.metadata.get_rating ();
834+ updated_row.comment = detected.metadata.get_comment ();
835 }
836
837 reimport_state = new ReimportMasterStateImpl (updated_row, metadata, list);
838@@ -1553,11 +1469,10 @@
839 if (reimport_state.metadata != null) {
840 set_title (reimport_state.metadata.get_title ());
841 set_comment (reimport_state.metadata.get_comment ());
842- set_rating (reimport_state.metadata.get_rating ());
843 apply_user_metadata_for_reimport (reimport_state.metadata);
844 }
845
846- string list = "metadata:name,image:orientation,metadata:rating,metadata:exposure-time";
847+ string list = "metadata:name,image:orientation,metadata:exposure-time";
848 if (!reimport_state.metadata_only)
849 list += "image:editable,image:baseline";
850
851@@ -1620,7 +1535,7 @@
852 }
853 }
854
855- string list = "metadata:name,image:orientation,metadata:rating,metadata:exposure-time";
856+ string list = "metadata:name,image:orientation,metadata:exposure-time";
857 if (!reimport_state.metadata_only)
858 list += "image:editable,image:baseline";
859
860@@ -2154,39 +2069,6 @@
861 notify_altered (new Alteration ("metadata", "enhanced"));
862 }
863
864- public override Rating get_rating () {
865- lock (row) {
866- return row.rating;
867- }
868- }
869-
870- public override void set_rating (Rating rating) {
871- bool committed = false;
872-
873- lock (row) {
874- if (rating != row.rating && rating.is_valid ()) {
875- committed = PhotoTable.get_instance ().set_rating (get_photo_id (), rating);
876- if (committed)
877- row.rating = rating;
878- }
879- }
880-
881- if (committed)
882- notify_altered (new Alteration ("metadata", "rating"));
883- }
884-
885- public override void increase_rating () {
886- lock (row) {
887- set_rating (row.rating.increase ());
888- }
889- }
890-
891- public override void decrease_rating () {
892- lock (row) {
893- set_rating (row.rating.decrease ());
894- }
895- }
896-
897 protected override void commit_backlinks (SourceCollection? sources, string? backlinks) {
898 // For now, only one link state may be stored in the database ... if this turns into a
899 // problem, will use SourceCollection to determine where to store it.
900@@ -4975,9 +4857,6 @@
901 // if marked in a state where they're held in an orphanage, rehydrate their backlinks
902 if ((row.flags & (FLAG_TRASH | FLAG_OFFLINE)) != 0)
903 rehydrate_backlinks (global, row.backlinks);
904-
905- if ((row.flags & (FLAG_HIDDEN | FLAG_FAVORITE)) != 0)
906- upgrade_rating_flags (row.flags);
907 }
908
909 private LibraryPhoto.from_import_params (PhotoImportParams import_params) {
910@@ -4989,9 +4868,6 @@
911 // if marked in a state where they're held in an orphanage, rehydrate their backlinks
912 if ((import_params.row.flags & (FLAG_TRASH | FLAG_OFFLINE)) != 0)
913 rehydrate_backlinks (global, import_params.row.backlinks);
914-
915- if ((import_params.row.flags & (FLAG_HIDDEN | FLAG_FAVORITE)) != 0)
916- upgrade_rating_flags (import_params.row.flags);
917 }
918
919 public static void init (ProgressMonitor? monitor = null) {
920@@ -5208,18 +5084,6 @@
921 spin_event_loop ();
922 }
923
924- private void upgrade_rating_flags (uint64 flags) {
925- if ((flags & FLAG_HIDDEN) != 0) {
926- set_rating (Rating.REJECTED);
927- remove_flags (FLAG_HIDDEN);
928- }
929-
930- if ((flags & FLAG_FAVORITE) != 0) {
931- set_rating (Rating.FIVE);
932- remove_flags (FLAG_FAVORITE);
933- }
934- }
935-
936 // Blotto even!
937 public override bool is_trashed () {
938 return is_flag_set (FLAG_TRASH);
939@@ -5310,10 +5174,7 @@
940
941 PhotoMetadata? metadata = get_metadata ();
942 if (metadata == null)
943- return tags != null || tags.size > 0 || get_rating () != Rating.UNRATED;
944-
945- if (get_rating () != metadata.get_rating ())
946- return true;
947+ return tags != null || tags.size > 0;
948
949 Gee.Set<string>? keywords = metadata.get_keywords ();
950 int tags_count = (tags != null) ? tags.size : 0;
951@@ -5342,8 +5203,6 @@
952 metadata.set_keywords (string_tags);
953 } else
954 metadata.set_keywords (null);
955-
956- metadata.set_rating (get_rating ());
957 }
958
959 protected override void apply_user_metadata_for_reimport (PhotoMetadata metadata) {
960@@ -5490,4 +5349,4 @@
961 }
962 }
963 }
964-}
965\ No newline at end of file
966+}
967
968=== modified file 'src/PhotoPage.vala'
969--- src/PhotoPage.vala 2016-02-10 07:45:46 +0000
970+++ src/PhotoPage.vala 2016-09-20 02:43:10 +0000
971@@ -385,7 +385,7 @@
972 public override void repaint () {
973 host_page.repaint ();
974 }
975-
976+
977 public override unowned Gtk.StyleContext get_style_context () {
978 return host_page.canvas.get_style_context ();
979 }
980@@ -839,7 +839,7 @@
981 enhance_button.clicked.disconnect (on_enhance);
982 enhance_button.active = get_photo ().is_enhanced ();
983 enhance_button.clicked.connect (on_enhance);
984- } else
985+ } else
986 set_action_sensitive ("Enhance", false);
987 }
988
989@@ -908,7 +908,7 @@
990 // check if the photo altered while away
991 if (has_photo () && pixbuf_dirty)
992 replace_photo (get_photo ());
993-
994+
995 var app = AppWindow.get_instance () as LibraryWindow;
996 update_sidebar_action (!app.is_metadata_sidebar_visible ());
997 }
998@@ -2119,7 +2119,7 @@
999
1000 private void on_tool_cancelled () {
1001 deactivate_tool ();
1002-
1003+
1004 update_enhance_action ();
1005 restore_zoom_state ();
1006 repaint ();
1007@@ -2161,7 +2161,7 @@
1008 private void on_adjust_toggled () {
1009 on_tool_button_toggled (adjust_button, EditingTools.AdjustTool.factory);
1010
1011- // with adjust tool open turn enhance into normal non toggle button
1012+ // with adjust tool open turn enhance into normal non toggle button
1013 if (adjust_button.active){
1014 enhance_button.clicked.disconnect (on_enhance);
1015 enhance_button.active = false;
1016@@ -2189,7 +2189,7 @@
1017 EditingTools.AdjustTool adjust_tool = current_tool as EditingTools.AdjustTool;
1018 if (adjust_tool != null) {
1019 adjust_tool.enhance ();
1020- // with adjust tool open turn enhance into normal non toggle button
1021+ // with adjust tool open turn enhance into normal non toggle button
1022 enhance_button.clicked.disconnect (on_enhance);
1023 enhance_button.active = false;
1024 enhance_button.clicked.connect (on_enhance);
1025@@ -2203,7 +2203,7 @@
1026 get_command_manager ().undo ();
1027 else {
1028 UnEnhanceSingleCommand command = new UnEnhanceSingleCommand (get_photo ());
1029- get_command_manager ().execute (command);
1030+ get_command_manager ().execute (command);
1031 }
1032 get_photo ().set_enhanced (false);
1033 } else {
1034@@ -2213,9 +2213,9 @@
1035 get_command_manager ().undo ();
1036 else {
1037 EnhanceSingleCommand command = new EnhanceSingleCommand (get_photo ());
1038- get_command_manager ().execute (command);
1039- }
1040- get_photo ().set_enhanced (true);
1041+ get_command_manager ().execute (command);
1042+ }
1043+ get_photo ().set_enhanced (true);
1044 }
1045
1046 update_enhance_action ();
1047@@ -2627,28 +2627,6 @@
1048 flag.label = Resources.FLAG_MENU;
1049 actions += flag;
1050
1051- Gtk.ActionEntry set_rating = { "Rate", null, TRANSLATABLE, null, null, null };
1052- set_rating.label = Resources.RATING_MENU;
1053- actions += set_rating;
1054-
1055- Gtk.ActionEntry increase_rating = { "IncreaseRating", null, TRANSLATABLE,
1056- "greater", TRANSLATABLE, on_increase_rating
1057- };
1058- increase_rating.label = Resources.INCREASE_RATING_MENU;
1059- actions += increase_rating;
1060-
1061- Gtk.ActionEntry decrease_rating = { "DecreaseRating", null, TRANSLATABLE,
1062- "less", TRANSLATABLE, on_decrease_rating
1063- };
1064- decrease_rating.label = Resources.DECREASE_RATING_MENU;
1065- actions += decrease_rating;
1066-
1067- Gtk.ActionEntry rate_rejected = { "RateRejected", null, TRANSLATABLE,
1068- "9", TRANSLATABLE, on_rate_rejected
1069- };
1070- rate_rejected.label = Resources.rating_menu (Rating.REJECTED);
1071- actions += rate_rejected;
1072-
1073 Gtk.ActionEntry increase_size = { "IncreaseSize", Gtk.Stock.ZOOM_IN, TRANSLATABLE,
1074 "<Ctrl>plus", TRANSLATABLE, on_increase_size
1075 };
1076@@ -2713,13 +2691,6 @@
1077 protected override Gtk.ToggleActionEntry[] init_collect_toggle_action_entries () {
1078 Gtk.ToggleActionEntry[] toggle_actions = base.init_collect_toggle_action_entries ();
1079
1080- Gtk.ToggleActionEntry ratings = { "ViewRatings", null, TRANSLATABLE, "<Ctrl><Shift>N",
1081- TRANSLATABLE, on_display_ratings, Config.Facade.get_instance ().get_display_photo_ratings ()
1082- };
1083- ratings.label = Resources.VIEW_RATINGS_MENU;
1084- ratings.tooltip = Resources.VIEW_RATINGS_TOOLTIP;
1085- toggle_actions += ratings;
1086-
1087 return toggle_actions;
1088 }
1089
1090@@ -2758,21 +2729,6 @@
1091 base.register_radio_actions (action_group);
1092 }
1093
1094- private void on_display_ratings (Gtk.Action action) {
1095- bool display = ((Gtk.ToggleAction) action).get_active ();
1096-
1097- set_display_ratings (display);
1098-
1099- Config.Facade.get_instance ().set_display_photo_ratings (display);
1100- repaint ();
1101- }
1102-
1103- private void set_display_ratings (bool display) {
1104- Gtk.ToggleAction? action = get_action ("ViewRatings") as Gtk.ToggleAction;
1105- if (action != null)
1106- action.set_active (display);
1107- }
1108-
1109 protected override void update_actions (int selected_count, int count) {
1110 bool multiple = get_view ().get_count () > 1;
1111 bool rotate_possible = has_photo () ? is_rotate_available (get_photo ()) : false;
1112@@ -2785,7 +2741,6 @@
1113 (get_photo ().has_transformations () || get_photo ().has_editable ()) : false);
1114
1115 if (has_photo () && !get_photo_missing ()) {
1116- update_rating_menu_item_sensitivity ();
1117 update_development_menu_item_sensitivity ();
1118 }
1119
1120@@ -2855,7 +2810,7 @@
1121 } else {
1122 set_action_sensitive ("Flag", false);
1123 }
1124- }
1125+ }
1126
1127 // Displays a photo from a specific CollectionPage. When the user exits this view,
1128 // they will be sent back to the return_page. The optional view paramters is for using
1129@@ -2889,16 +2844,10 @@
1130 base.switched_to ();
1131
1132 update_zoom_menu_item_sensitivity ();
1133- update_rating_menu_item_sensitivity ();
1134-
1135- set_display_ratings (Config.Facade.get_instance ().get_display_photo_ratings ());
1136 }
1137
1138 protected override Gdk.Pixbuf? get_bottom_left_trinket (int scale) {
1139- if (!has_photo () || !Config.Facade.get_instance ().get_display_photo_ratings ())
1140- return null;
1141-
1142- return Resources.get_rating_trinket (((LibraryPhoto) get_photo ()).get_rating (), scale);
1143+ return null;
1144 }
1145
1146 protected override Gdk.Pixbuf? get_top_right_trinket (int scale) {
1147@@ -2976,7 +2925,6 @@
1148 set_action_sensitive ("OpenWithRaw", sensitivity);
1149 set_action_sensitive ("Revert", sensitivity);
1150
1151- set_action_sensitive ("Rate", sensitivity);
1152 set_action_sensitive ("Flag", sensitivity);
1153
1154 base.update_ui (missing);
1155@@ -3012,43 +2960,6 @@
1156 activate_action ("MoveToTrash");
1157 break;
1158
1159- case "period":
1160- case "greater":
1161- activate_action ("IncreaseRating");
1162- break;
1163-
1164- case "comma":
1165- case "less":
1166- activate_action ("DecreaseRating");
1167- break;
1168-
1169- case "1":
1170- on_set_rating (Rating.ONE);
1171- break;
1172-
1173- case "2":
1174- on_set_rating (Rating.TWO);
1175- break;
1176-
1177- case "3":
1178- on_set_rating (Rating.THREE);
1179- break;
1180-
1181- case "4":
1182- on_set_rating (Rating.FOUR);
1183- break;
1184-
1185- case "5":
1186- on_set_rating (Rating.FIVE);
1187- break;
1188-
1189- case "0":
1190- on_set_rating (Rating.UNRATED);
1191- break;
1192-
1193- case "9":
1194- activate_action ("RateRejected");
1195- break;
1196
1197 case "bracketright":
1198 activate_action ("RotateClockwise");
1199@@ -3108,8 +3019,7 @@
1200 }
1201
1202 populate_contractor_menu (menu, "/PhotoContextMenu/ContractorPlaceholder");
1203- populate_rating_widget_menu_item (menu, "/PhotoContextMenu/RatingWidgetPlaceholder");
1204- update_rating_menu_item_sensitivity ();
1205+
1206 menu.show_all ();
1207 return menu;
1208 }
1209@@ -3322,54 +3232,6 @@
1210 update_zoom_menu_item_sensitivity ();
1211 }
1212
1213- private void on_increase_rating () {
1214- if (!has_photo () || get_photo_missing ())
1215- return;
1216-
1217- SetRatingSingleCommand command = new SetRatingSingleCommand.inc_dec (get_photo (), true);
1218- get_command_manager ().execute (command);
1219-
1220- update_rating_menu_item_sensitivity ();
1221- }
1222-
1223- private void on_decrease_rating () {
1224- if (!has_photo () || get_photo_missing ())
1225- return;
1226-
1227- SetRatingSingleCommand command = new SetRatingSingleCommand.inc_dec (get_photo (), false);
1228- get_command_manager ().execute (command);
1229-
1230- update_rating_menu_item_sensitivity ();
1231- }
1232-
1233- protected virtual void on_rate_rejected () {
1234- on_set_rating (Rating.REJECTED);
1235- }
1236-
1237- private void on_set_rating (Rating rating) {
1238- if (!has_photo () || get_photo_missing ())
1239- return;
1240-
1241- SetRatingSingleCommand command = new SetRatingSingleCommand (get_photo (), rating);
1242- get_command_manager ().execute (command);
1243-
1244- update_rating_menu_item_sensitivity ();
1245- }
1246-
1247- protected override void on_rating_widget_activate () {
1248- on_set_rating (Resources.int_to_rating(rating_menu_item.rating_value));
1249- }
1250-
1251- private void update_rating_menu_item_sensitivity () {
1252- set_action_sensitive ("RateRejected", get_photo ().get_rating () != Rating.REJECTED);
1253- if (rating_menu_item != null) {
1254- rating_menu_item.sensitive = (get_photo () != null);
1255- rating_menu_item.rating_value = get_photo ().get_rating ();
1256- }
1257- set_action_sensitive ("IncreaseRating", get_photo ().get_rating ().can_increase ());
1258- set_action_sensitive ("DecreaseRating", get_photo ().get_rating ().can_decrease ());
1259- }
1260-
1261 private void update_development_menu_item_sensitivity () {
1262 PhotoFileFormat format = get_photo ().get_master_file_format () ;
1263 set_action_sensitive ("RawDeveloper", format == PhotoFileFormat.RAW);
1264
1265=== modified file 'src/Resources.vala'
1266--- src/Resources.vala 2016-06-27 10:37:18 +0000
1267+++ src/Resources.vala 2016-09-20 02:43:10 +0000
1268@@ -185,45 +185,10 @@
1269 public const string MERGE_LABEL = _("Merge");
1270 public const string MERGE_TOOLTIP = _("Combine events into a single event");
1271
1272-public const string RATING_MENU = _("_Set Rating");
1273-public const string RATING_LABEL = _("Set Rating");
1274-public const string RATING_TOOLTIP = _("Change the rating of your photo");
1275-
1276-public const string INCREASE_RATING_MENU = _("_Increase");
1277-public const string INCREASE_RATING_LABEL = _("Increase Rating");
1278-
1279-public const string DECREASE_RATING_MENU = _("_Decrease");
1280-public const string DECREASE_RATING_LABEL = _("Decrease Rating");
1281-
1282-public const string RATE_UNRATED_MENU = _("_Unrated");
1283-public const string RATE_UNRATED_COMBO_BOX = _("Unrated");
1284-public const string RATE_UNRATED_LABEL = _("Rate Unrated");
1285-public const string RATE_UNRATED_PROGRESS = _("Setting as unrated");
1286-public const string RATE_UNRATED_TOOLTIP = _("Remove any ratings");
1287-
1288-public const string RATE_REJECTED_MENU = _("_Rejected");
1289-public const string RATE_REJECTED_COMBO_BOX = _("Rejected");
1290-public const string RATE_REJECTED_LABEL = _("Rate Rejected");
1291-public const string RATE_REJECTED_PROGRESS = _("Setting as rejected");
1292-public const string RATE_REJECTED_TOOLTIP = _("Set rating to rejected");
1293-
1294-public const string RATE_UNRATED_DISPLAY_LABEL = _("Rejected");
1295-
1296-public const string DISPLAY_REJECTED_ONLY_MENU = _("Rejected Only");
1297-public const string DISPLAY_REJECTED_ONLY_LABEL = _("Rejected Only");
1298-public const string DISPLAY_REJECTED_ONLY_TOOLTIP = _("Show only rejected photos");
1299-
1300-public const string DISPLAY_REJECTED_OR_HIGHER_MENU = _("All + Rejected");
1301-public const string DISPLAY_REJECTED_OR_HIGHER_LABEL = _("Show all photos, including rejected");
1302-public const string DISPLAY_REJECTED_OR_HIGHER_TOOLTIP = _("Show all photos, including rejected");
1303-
1304 public const string DISPLAY_UNRATED_OR_HIGHER_MENU = _("All Photos");
1305 public const string DISPLAY_UNRATED_OR_HIGHER_LABEL = _("Show all photos");
1306 public const string DISPLAY_UNRATED_OR_HIGHER_TOOLTIP = _("Show all photos");
1307
1308-public const string VIEW_RATINGS_MENU = _("_Ratings");
1309-public const string VIEW_RATINGS_TOOLTIP = _("Display each photo's rating");
1310-
1311 public const string FILTER_PHOTOS_MENU = _("_Filter Photos");
1312 public const string FILTER_PHOTOS_LABEL = _("Filter Photos");
1313 public const string FILTER_PHOTOS_TOOLTIP = _("Limit the number of photos displayed based on a filter");
1314@@ -378,231 +343,6 @@
1315 return _("Delete Search \"%s\"").printf (name);
1316 }
1317
1318-private unowned string rating_menu (Rating rating) {
1319- switch (rating) {
1320- case Rating.REJECTED:
1321- return RATE_REJECTED_MENU;
1322- case Rating.UNRATED:
1323- return RATE_UNRATED_MENU;
1324- case Rating.ONE:
1325- return RATE_ONE_MENU;
1326- case Rating.TWO:
1327- return RATE_TWO_MENU;
1328- case Rating.THREE:
1329- return RATE_THREE_MENU;
1330- case Rating.FOUR:
1331- return RATE_FOUR_MENU;
1332- case Rating.FIVE:
1333- return RATE_FIVE_MENU;
1334- default:
1335- return RATE_UNRATED_MENU;
1336- }
1337-}
1338-
1339-private unowned string rating_label (Rating rating) {
1340- switch (rating) {
1341- case Rating.REJECTED:
1342- return RATE_REJECTED_LABEL;
1343- case Rating.UNRATED:
1344- return RATE_UNRATED_LABEL;
1345- case Rating.ONE:
1346- return RATE_ONE_LABEL;
1347- case Rating.TWO:
1348- return RATE_TWO_LABEL;
1349- case Rating.THREE:
1350- return RATE_THREE_LABEL;
1351- case Rating.FOUR:
1352- return RATE_FOUR_LABEL;
1353- case Rating.FIVE:
1354- return RATE_FIVE_LABEL;
1355- default:
1356- return RATE_UNRATED_LABEL;
1357- }
1358-}
1359-
1360-public int rating_int (Rating rating) {
1361- switch (rating) {
1362- case Rating.REJECTED:
1363- return -1;
1364- case Rating.UNRATED:
1365- return 0;
1366- case Rating.ONE:
1367- return 1;
1368- case Rating.TWO:
1369- return 2;
1370- case Rating.THREE:
1371- return 3;
1372- case Rating.FOUR:
1373- return 4;
1374- case Rating.FIVE:
1375- return 5;
1376- default:
1377- return 0;
1378- }
1379-}
1380-
1381-public Rating int_to_rating (int rating) {
1382- switch (rating) {
1383- case -1:
1384- return Rating.REJECTED;
1385- case 0:
1386- return Rating.UNRATED;
1387- case 1:
1388- return Rating.ONE;
1389- case 2:
1390- return Rating.TWO;
1391- case 3:
1392- return Rating.THREE;
1393- case 4:
1394- return Rating.FOUR;
1395- case 5:
1396- return Rating.FIVE;
1397- default:
1398- return 0;
1399- }
1400-}
1401-
1402-private unowned string rating_combo_box (Rating rating) {
1403- switch (rating) {
1404- case Rating.REJECTED:
1405- return RATE_REJECTED_COMBO_BOX;
1406- case Rating.UNRATED:
1407- return RATE_UNRATED_COMBO_BOX;
1408- case Rating.ONE:
1409- return RATE_ONE_MENU;
1410- case Rating.TWO:
1411- return RATE_TWO_MENU;
1412- case Rating.THREE:
1413- return RATE_THREE_MENU;
1414- case Rating.FOUR:
1415- return RATE_FOUR_MENU;
1416- case Rating.FIVE:
1417- return RATE_FIVE_MENU;
1418- default:
1419- return RATE_UNRATED_MENU;
1420- }
1421-}
1422-
1423-private string get_rating_filter_tooltip (RatingFilter filter) {
1424- switch (filter) {
1425- case RatingFilter.REJECTED_OR_HIGHER:
1426- return Resources.DISPLAY_REJECTED_OR_HIGHER_TOOLTIP;
1427-
1428- case RatingFilter.ONE_OR_HIGHER:
1429- return Resources.DISPLAY_ONE_OR_HIGHER_TOOLTIP;
1430-
1431- case RatingFilter.TWO_OR_HIGHER:
1432- return Resources.DISPLAY_TWO_OR_HIGHER_TOOLTIP;
1433-
1434- case RatingFilter.THREE_OR_HIGHER:
1435- return Resources.DISPLAY_THREE_OR_HIGHER_TOOLTIP;
1436-
1437- case RatingFilter.FOUR_OR_HIGHER:
1438- return Resources.DISPLAY_FOUR_OR_HIGHER_TOOLTIP;
1439-
1440- case RatingFilter.FIVE_ONLY:
1441- case RatingFilter.FIVE_OR_HIGHER:
1442- return Resources.DISPLAY_FIVE_OR_HIGHER_TOOLTIP;
1443-
1444- case RatingFilter.REJECTED_ONLY:
1445- return Resources.DISPLAY_REJECTED_ONLY_TOOLTIP;
1446-
1447- case RatingFilter.UNRATED_OR_HIGHER:
1448- default:
1449- return Resources.DISPLAY_UNRATED_OR_HIGHER_TOOLTIP;
1450- }
1451-}
1452-
1453-private string rating_progress (Rating rating) {
1454- switch (rating) {
1455- case Rating.REJECTED:
1456- return RATE_REJECTED_PROGRESS;
1457- case Rating.UNRATED:
1458- return RATE_UNRATED_PROGRESS;
1459- case Rating.ONE:
1460- return RATE_ONE_PROGRESS;
1461- case Rating.TWO:
1462- return RATE_TWO_PROGRESS;
1463- case Rating.THREE:
1464- return RATE_THREE_PROGRESS;
1465- case Rating.FOUR:
1466- return RATE_FOUR_PROGRESS;
1467- case Rating.FIVE:
1468- return RATE_FIVE_PROGRESS;
1469- default:
1470- return RATE_UNRATED_PROGRESS;
1471- }
1472-}
1473-
1474-private const int[] rating_thresholds = { 0, 1, 25, 50, 75, 99 };
1475-
1476-private string get_stars (Rating rating) {
1477- switch (rating) {
1478- case Rating.ONE:
1479- return "\xE2\x98\x85";
1480- case Rating.TWO:
1481- return "\xE2\x98\x85\xE2\x98\x85";
1482- case Rating.THREE:
1483- return "\xE2\x98\x85\xE2\x98\x85\xE2\x98\x85";
1484- case Rating.FOUR:
1485- return "\xE2\x98\x85\xE2\x98\x85\xE2\x98\x85\xE2\x98\x85";
1486- case Rating.FIVE:
1487- return "\xE2\x98\x85\xE2\x98\x85\xE2\x98\x85\xE2\x98\x85\xE2\x98\x85";
1488- default:
1489- return "";
1490- }
1491-}
1492-
1493-private struct RatingTrinket {
1494- public int stars;
1495- public int scale;
1496- public Gdk.Pixbuf icon;
1497-}
1498-
1499-private static Gee.ArrayList < RatingTrinket?> rating_trinket_cache;
1500-
1501-private Gdk.Pixbuf? get_rating_trinket (Rating rating, int scale) {
1502-
1503- int stars = rating.serialize ();
1504-
1505- if (stars <= 0 || stars > 5)
1506- return null;
1507-
1508- foreach (RatingTrinket trinket in rating_trinket_cache)
1509- if (trinket.stars == stars && trinket.scale == scale)
1510- return trinket.icon;
1511-
1512- int width = scale * stars;
1513- int height = scale;
1514-
1515- Granite.Drawing.BufferSurface surface = new Granite.Drawing.BufferSurface (width, height);
1516- Cairo.Context cr = surface.context;
1517-
1518- cr.set_source_rgba (0, 0, 0, 0.8);
1519- cr.rectangle (0, 0, width, height);
1520- cr.paint ();
1521-
1522- Gtk.IconTheme icon_theme = get_icon_theme_engine ();
1523- Gdk.Pixbuf star;
1524-
1525- try {
1526- star = icon_theme.load_icon ("starred-symbolic", scale, Gtk.IconLookupFlags.FORCE_SIZE);
1527- } catch (Error e) {
1528- return null;
1529- }
1530-
1531- for (int i = 0; i < rating.serialize (); i++) {
1532- Gdk.cairo_set_source_pixbuf (cr, star, i * scale, 0);
1533- cr.paint ();
1534- }
1535-
1536- RatingTrinket trinket = {stars, scale, surface.load_to_pixbuf ()};
1537- rating_trinket_cache.add (trinket);
1538-
1539- return trinket.icon;
1540-
1541-}
1542-
1543 private static Gdk.Pixbuf? flag_trinket_cache;
1544 private const int flag_padding = 2;
1545
1546@@ -633,106 +373,6 @@
1547 return flag_trinket_cache;
1548 }
1549
1550-private void generate_rating_strings () {
1551- string menu_base = "%s";
1552- string label_base = _("Rate %s");
1553- string tooltip_base = _("Set rating to %s");
1554- string progress_base = _("Setting rating to %s");
1555- string display_rating_menu_base = "%s";
1556- string display_rating_label_base = _("Display %s");
1557- string display_rating_tooltip_base = _("Only show photos with a rating of %s");
1558- string display_rating_or_higher_menu_base = _("%s or Better");
1559- string display_rating_or_higher_label_base = _("Display %s or Better");
1560- string display_rating_or_higher_tooltip_base = _("Only show photos with a rating of %s or better");
1561-
1562- RATE_ONE_MENU = menu_base.printf (get_stars (Rating.ONE));
1563- RATE_TWO_MENU = menu_base.printf (get_stars (Rating.TWO));
1564- RATE_THREE_MENU = menu_base.printf (get_stars (Rating.THREE));
1565- RATE_FOUR_MENU = menu_base.printf (get_stars (Rating.FOUR));
1566- RATE_FIVE_MENU = menu_base.printf (get_stars (Rating.FIVE));
1567-
1568- RATE_ONE_LABEL = label_base.printf (get_stars (Rating.ONE));
1569- RATE_TWO_LABEL = label_base.printf (get_stars (Rating.TWO));
1570- RATE_THREE_LABEL = label_base.printf (get_stars (Rating.THREE));
1571- RATE_FOUR_LABEL = label_base.printf (get_stars (Rating.FOUR));
1572- RATE_FIVE_LABEL = label_base.printf (get_stars (Rating.FIVE));
1573-
1574- RATE_ONE_TOOLTIP = tooltip_base.printf (get_stars (Rating.ONE));
1575- RATE_TWO_TOOLTIP = tooltip_base.printf (get_stars (Rating.TWO));
1576- RATE_THREE_TOOLTIP = tooltip_base.printf (get_stars (Rating.THREE));
1577- RATE_FOUR_TOOLTIP = tooltip_base.printf (get_stars (Rating.FOUR));
1578- RATE_FIVE_TOOLTIP = tooltip_base.printf (get_stars (Rating.FIVE));
1579-
1580- RATE_ONE_PROGRESS = progress_base.printf (get_stars (Rating.ONE));
1581- RATE_TWO_PROGRESS = progress_base.printf (get_stars (Rating.TWO));
1582- RATE_THREE_PROGRESS = progress_base.printf (get_stars (Rating.THREE));
1583- RATE_FOUR_PROGRESS = progress_base.printf (get_stars (Rating.FOUR));
1584- RATE_FIVE_PROGRESS = progress_base.printf (get_stars (Rating.FIVE));
1585-
1586- DISPLAY_ONE_OR_HIGHER_MENU = display_rating_or_higher_menu_base.printf (get_stars (Rating.ONE));
1587- DISPLAY_TWO_OR_HIGHER_MENU = display_rating_or_higher_menu_base.printf (get_stars (Rating.TWO));
1588- DISPLAY_THREE_OR_HIGHER_MENU = display_rating_or_higher_menu_base.printf (get_stars (Rating.THREE));
1589- DISPLAY_FOUR_OR_HIGHER_MENU = display_rating_or_higher_menu_base.printf (get_stars (Rating.FOUR));
1590- DISPLAY_FIVE_OR_HIGHER_MENU = display_rating_menu_base.printf (get_stars (Rating.FIVE));
1591-
1592- DISPLAY_ONE_OR_HIGHER_LABEL = display_rating_or_higher_label_base.printf (get_stars (Rating.ONE));
1593- DISPLAY_TWO_OR_HIGHER_LABEL = display_rating_or_higher_label_base.printf (get_stars (Rating.TWO));
1594- DISPLAY_THREE_OR_HIGHER_LABEL = display_rating_or_higher_label_base.printf (get_stars (Rating.THREE));
1595- DISPLAY_FOUR_OR_HIGHER_LABEL = display_rating_or_higher_label_base.printf (get_stars (Rating.FOUR));
1596- DISPLAY_FIVE_OR_HIGHER_LABEL = display_rating_label_base.printf (get_stars (Rating.FIVE));
1597-
1598- DISPLAY_ONE_OR_HIGHER_TOOLTIP = display_rating_or_higher_tooltip_base.printf (get_stars (Rating.ONE));
1599- DISPLAY_TWO_OR_HIGHER_TOOLTIP = display_rating_or_higher_tooltip_base.printf (get_stars (Rating.TWO));
1600- DISPLAY_THREE_OR_HIGHER_TOOLTIP = display_rating_or_higher_tooltip_base.printf (get_stars (Rating.THREE));
1601- DISPLAY_FOUR_OR_HIGHER_TOOLTIP = display_rating_or_higher_tooltip_base.printf (get_stars (Rating.FOUR));
1602- DISPLAY_FIVE_OR_HIGHER_TOOLTIP = display_rating_tooltip_base.printf (get_stars (Rating.FIVE));
1603-}
1604-
1605-private string RATE_ONE_MENU;
1606-private string RATE_ONE_LABEL;
1607-private string RATE_ONE_TOOLTIP;
1608-private string RATE_ONE_PROGRESS;
1609-
1610-private string RATE_TWO_MENU;
1611-private string RATE_TWO_LABEL;
1612-private string RATE_TWO_TOOLTIP;
1613-private string RATE_TWO_PROGRESS;
1614-
1615-private string RATE_THREE_MENU;
1616-private string RATE_THREE_LABEL;
1617-private string RATE_THREE_TOOLTIP;
1618-private string RATE_THREE_PROGRESS;
1619-
1620-private string RATE_FOUR_MENU;
1621-private string RATE_FOUR_LABEL;
1622-private string RATE_FOUR_TOOLTIP;
1623-private string RATE_FOUR_PROGRESS;
1624-
1625-private string RATE_FIVE_MENU;
1626-private string RATE_FIVE_LABEL;
1627-private string RATE_FIVE_TOOLTIP;
1628-private string RATE_FIVE_PROGRESS;
1629-
1630-private string DISPLAY_ONE_OR_HIGHER_MENU;
1631-private string DISPLAY_ONE_OR_HIGHER_LABEL;
1632-private string DISPLAY_ONE_OR_HIGHER_TOOLTIP;
1633-
1634-private string DISPLAY_TWO_OR_HIGHER_MENU;
1635-private string DISPLAY_TWO_OR_HIGHER_LABEL;
1636-private string DISPLAY_TWO_OR_HIGHER_TOOLTIP;
1637-
1638-private string DISPLAY_THREE_OR_HIGHER_MENU;
1639-private string DISPLAY_THREE_OR_HIGHER_LABEL;
1640-private string DISPLAY_THREE_OR_HIGHER_TOOLTIP;
1641-
1642-private string DISPLAY_FOUR_OR_HIGHER_MENU;
1643-private string DISPLAY_FOUR_OR_HIGHER_LABEL;
1644-private string DISPLAY_FOUR_OR_HIGHER_TOOLTIP;
1645-
1646-private string DISPLAY_FIVE_OR_HIGHER_MENU;
1647-private string DISPLAY_FIVE_OR_HIGHER_LABEL;
1648-private string DISPLAY_FIVE_OR_HIGHER_TOOLTIP;
1649-
1650 public const string DELETE_PHOTOS_MENU = _("_Delete Selection");
1651 public const string DELETE_FROM_TRASH_TOOLTIP = _("Remove the selected photos from the trash");
1652 public const string DELETE_FROM_LIBRARY_TOOLTIP = _("Remove the selected photos from the library");
1653@@ -765,10 +405,6 @@
1654 private string START_MULTIMONTH_DATE_FORMAT_STRING = null;
1655
1656 public void init () {
1657-
1658- generate_rating_strings ();
1659-
1660- rating_trinket_cache = new Gee.ArrayList < RatingTrinket?> ();
1661 }
1662
1663 public void terminate () {
1664
1665=== modified file 'src/SearchFilter.vala'
1666--- src/SearchFilter.vala 2015-12-06 23:39:13 +0000
1667+++ src/SearchFilter.vala 2016-09-20 02:43:10 +0000
1668@@ -12,36 +12,11 @@
1669 TEXT,
1670 FLAG,
1671 MEDIA,
1672- RATING,
1673 ALL = 0xFFFFFFFF
1674 }
1675
1676-public enum RatingFilter {
1677- NO_FILTER = 0,
1678- REJECTED_OR_HIGHER = 1,
1679- UNRATED_OR_HIGHER = 2,
1680- ONE_OR_HIGHER = 3,
1681- TWO_OR_HIGHER = 4,
1682- THREE_OR_HIGHER = 5,
1683- FOUR_OR_HIGHER = 6,
1684- FIVE_OR_HIGHER = 7,
1685- REJECTED_ONLY = 8,
1686- UNRATED_ONLY = 9,
1687- ONE_ONLY = 10,
1688- TWO_ONLY = 11,
1689- THREE_ONLY = 12,
1690- FOUR_ONLY = 13,
1691- FIVE_ONLY = 14
1692-}
1693-
1694 // Handles filtering via rating and text.
1695 public abstract class SearchViewFilter : ViewFilter {
1696- // If this is true, allow the current rating or higher.
1697- private bool rating_allow_higher = true;
1698-
1699- // Rating to filter by.
1700- private Rating rating = Rating.UNRATED;
1701- private RatingFilter rating_filter = RatingFilter.UNRATED_OR_HIGHER;
1702
1703 // Show flagged only if set to true.
1704 public bool flagged {
1705@@ -76,76 +51,7 @@
1706 // view filter is installed will NOT update the GUI.
1707 public abstract uint get_criteria ();
1708
1709- public void set_rating_filter (RatingFilter rf) {
1710- rating_filter = rf;
1711- switch (rating_filter) {
1712- case RatingFilter.REJECTED_ONLY:
1713- rating = Rating.REJECTED;
1714- rating_allow_higher = false;
1715- break;
1716-
1717- case RatingFilter.REJECTED_OR_HIGHER:
1718- rating = Rating.REJECTED;
1719- rating_allow_higher = true;
1720- break;
1721-
1722- case RatingFilter.ONE_OR_HIGHER:
1723- rating = Rating.ONE;
1724- rating_allow_higher = true;
1725- break;
1726-
1727- case RatingFilter.ONE_ONLY:
1728- rating = Rating.ONE;
1729- rating_allow_higher = false;
1730- break;
1731-
1732- case RatingFilter.TWO_OR_HIGHER:
1733- rating = Rating.TWO;
1734- rating_allow_higher = true;
1735- break;
1736-
1737- case RatingFilter.TWO_ONLY:
1738- rating = Rating.TWO;
1739- rating_allow_higher = false;
1740- break;
1741-
1742- case RatingFilter.THREE_OR_HIGHER:
1743- rating = Rating.THREE;
1744- rating_allow_higher = true;
1745- break;
1746-
1747- case RatingFilter.THREE_ONLY:
1748- rating = Rating.THREE;
1749- rating_allow_higher = false;
1750- break;
1751-
1752- case RatingFilter.FOUR_OR_HIGHER:
1753- rating = Rating.FOUR;
1754- rating_allow_higher = true;
1755- break;
1756-
1757- case RatingFilter.FOUR_ONLY:
1758- rating = Rating.FOUR;
1759- rating_allow_higher = false;
1760- break;
1761-
1762- case RatingFilter.FIVE_OR_HIGHER:
1763- rating = Rating.FIVE;
1764- rating_allow_higher = true;
1765- break;
1766-
1767- case RatingFilter.FIVE_ONLY:
1768- rating = Rating.FIVE;
1769- rating_allow_higher = false;
1770- break;
1771-
1772- case RatingFilter.UNRATED_OR_HIGHER:
1773- default:
1774- rating = Rating.UNRATED;
1775- rating_allow_higher = true;
1776- break;
1777- }
1778- }
1779+
1780
1781 public bool has_search_filter () {
1782 return !is_string_empty (search_filter);
1783@@ -169,14 +75,6 @@
1784 search_filter_words = null;
1785 }
1786
1787- public bool get_rating_allow_higher () {
1788- return rating_allow_higher;
1789- }
1790-
1791- public Rating get_rating () {
1792- return rating;
1793- }
1794-
1795 public bool filter_by_media_type () {
1796 return ((show_media_video || show_media_photos || show_media_raw) &&
1797 ! (show_media_video && show_media_photos && show_media_raw));
1798@@ -190,14 +88,6 @@
1799 MediaSource source = ((Thumbnail) view).get_media_source ();
1800 uint criteria = get_criteria ();
1801
1802- // Ratings filter
1803- if ((SearchFilterCriteria.RATING & criteria) != 0) {
1804- if (get_rating_allow_higher () && source.get_rating () < get_rating ())
1805- return false;
1806- else if (!get_rating_allow_higher () && source.get_rating () != get_rating ())
1807- return false;
1808- }
1809-
1810 // Flag state.
1811 if ((SearchFilterCriteria.FLAG & criteria) != 0) {
1812 if (flagged && source is Flaggable && ! ((Flaggable) source).is_flagged ())
1813@@ -272,7 +162,7 @@
1814 }
1815
1816 public override uint get_criteria () {
1817- return SearchFilterCriteria.RATING;
1818+ return SearchFilterCriteria.NONE;
1819 }
1820 }
1821
1822@@ -341,9 +231,7 @@
1823 private Gtk.MenuItem close_item = new Gtk.MenuItem.with_label (_("Close"));
1824
1825 private SearchFilterCriteria criteria = SearchFilterCriteria.ALL;
1826- private RatingFilter filter = RatingFilter.UNRATED_OR_HIGHER;
1827 private Gtk.SearchEntry search_entry;
1828- private Gtk.ComboBoxText rating_button;
1829 private SearchViewFilter? search_filter = null;
1830 private Gtk.Toolbar toolbar;
1831
1832@@ -360,24 +248,6 @@
1833 close_item.activate.connect ( () => close ());
1834 close_menu.append (close_item);
1835
1836- // Rating button
1837- rating_button = new Gtk.ComboBoxText ();
1838- rating_button.append_text (Resources.DISPLAY_REJECTED_ONLY_MENU);
1839- rating_button.append_text (Resources.DISPLAY_REJECTED_OR_HIGHER_MENU);
1840- rating_button.append_text (Resources.DISPLAY_UNRATED_OR_HIGHER_MENU);
1841- rating_button.append_text (Resources.DISPLAY_ONE_OR_HIGHER_MENU);
1842- rating_button.append_text (Resources.DISPLAY_TWO_OR_HIGHER_MENU);
1843- rating_button.append_text (Resources.DISPLAY_THREE_OR_HIGHER_MENU);
1844- rating_button.append_text (Resources.DISPLAY_FOUR_OR_HIGHER_MENU);
1845- rating_button.append_text (Resources.DISPLAY_FIVE_OR_HIGHER_MENU);
1846- rating_button.tooltip_text = Resources.get_rating_filter_tooltip (filter);
1847- rating_button.active = 2;
1848- rating_button.changed.connect ( () => on_rating_changed ());
1849-
1850- Gtk.ToolItem rating_item = new Gtk.ToolItem ();
1851- rating_item.add (rating_button);
1852- toolbar.insert (rating_item, -1);
1853-
1854 // Separator to right-align the text box
1855 Gtk.SeparatorToolItem separator_align = new Gtk.SeparatorToolItem ();
1856 separator_align.set_expand (true);
1857@@ -427,45 +297,12 @@
1858 update ();
1859 }
1860
1861- private void on_rating_changed () {
1862- switch (rating_button.active) {
1863- case 0:
1864- filter = RatingFilter.REJECTED_ONLY;
1865- break;
1866- case 1:
1867- filter = RatingFilter.REJECTED_OR_HIGHER;
1868- break;
1869- case 2:
1870- filter = RatingFilter.UNRATED_OR_HIGHER;
1871- break;
1872- case 3:
1873- filter = RatingFilter.ONE_OR_HIGHER;
1874- break;
1875- case 4:
1876- filter = RatingFilter.TWO_OR_HIGHER;
1877- break;
1878- case 5:
1879- filter = RatingFilter.THREE_OR_HIGHER;
1880- break;
1881- case 6:
1882- filter = RatingFilter.FOUR_OR_HIGHER;
1883- break;
1884- case 7:
1885- filter = RatingFilter.FIVE_OR_HIGHER;
1886- break;
1887- }
1888- update ();
1889- }
1890-
1891 public void set_view_filter (SearchViewFilter search_filter) {
1892 if (search_filter == this.search_filter)
1893 return;
1894
1895 this.search_filter = search_filter;
1896
1897- // Enable/disable toolbar features depending on what the filter offers.
1898- rating_button.sensitive = (SearchFilterCriteria.RATING & search_filter.get_criteria ()) != 0;
1899-
1900 update ();
1901 }
1902
1903@@ -484,15 +321,10 @@
1904
1905 search_filter.set_search_filter (search_entry.text);
1906
1907- search_filter.set_rating_filter (filter);
1908- rating_button.tooltip_text = Resources.get_rating_filter_tooltip (filter);
1909-
1910 // Ticket #3290, part III - check the current criteria
1911 // and show or hide widgets as needed.
1912 search_entry.visible = ((criteria & SearchFilterCriteria.TEXT) != 0);
1913
1914- rating_button.visible = ((criteria & SearchFilterCriteria.RATING) != 0);
1915-
1916 // Send update to view collection.
1917 search_filter.refresh ();
1918 }
1919
1920=== modified file 'src/Thumbnail.vala'
1921--- src/Thumbnail.vala 2014-08-23 09:56:14 +0000
1922+++ src/Thumbnail.vala 2016-09-20 02:43:10 +0000
1923@@ -10,8 +10,6 @@
1924 public const string PROP_SHOW_TAGS = CheckerboardItem.PROP_SHOW_SUBTITLES;
1925 // SIZE (int, scale)
1926 public const string PROP_SIZE = "thumbnail-size";
1927- // SHOW_RATINGS (bool)
1928- public const string PROP_SHOW_RATINGS = "show-ratings";
1929
1930 public static int MIN_SCALE {
1931 get {
1932@@ -209,22 +207,6 @@
1933 return (result != 0) ? result : photo_id_descending_comparator (a, b);
1934 }
1935
1936- public static int64 rating_ascending_comparator (void *a, void *b) {
1937- int64 result = ((Thumbnail *) a)->media.get_rating () - ((Thumbnail *) b)->media.get_rating ();
1938-
1939- return (result != 0) ? result : photo_id_ascending_comparator (a, b);
1940- }
1941-
1942- public static int64 rating_descending_comparator (void *a, void *b) {
1943- int64 result = rating_ascending_comparator (b, a);
1944-
1945- return (result != 0) ? result : photo_id_descending_comparator (a, b);
1946- }
1947-
1948- public static bool rating_comparator_predicate (DataObject object, Alteration alteration) {
1949- return alteration.has_detail ("metadata", "rating");
1950- }
1951-
1952 protected override void thumbnail_altered () {
1953 original_dim = media.get_dimensions ();
1954 dim = original_dim.get_scaled (scale, true);
1955@@ -242,10 +224,6 @@
1956 case PROP_SIZE:
1957 resize ((int) val);
1958 break;
1959-
1960- case PROP_SHOW_RATINGS:
1961- notify_view_altered ();
1962- break;
1963 }
1964
1965 base.notify_collection_property_set (name, old, val);
1966@@ -389,12 +367,4 @@
1967 return (flaggable != null && flaggable.is_flagged ())
1968 ? Resources.get_flag_trinket () : null;
1969 }
1970-
1971- protected override Gdk.Pixbuf? get_bottom_left_trinket (int scale) {
1972- Rating rating = media.get_rating ();
1973- bool show_ratings = (bool) get_collection_property (PROP_SHOW_RATINGS, false);
1974-
1975- return (rating != Rating.UNRATED && show_ratings)
1976- ? Resources.get_rating_trinket (rating, scale) : null;
1977- }
1978-}
1979\ No newline at end of file
1980+}
1981
1982=== modified file 'src/VideoSupport.vala'
1983--- src/VideoSupport.vala 2014-08-08 21:13:09 +0000
1984+++ src/VideoSupport.vala 2016-09-20 02:43:10 +0000
1985@@ -667,44 +667,6 @@
1986 return true;
1987 }
1988
1989-
1990- public override Rating get_rating () {
1991- lock (backing_row) {
1992- return backing_row.rating;
1993- }
1994- }
1995-
1996- public override void set_rating (Rating rating) {
1997- lock (backing_row) {
1998- if ((!rating.is_valid ()) || (rating == backing_row.rating))
1999- return;
2000-
2001- try {
2002- VideoTable.get_instance ().set_rating (get_video_id (), rating);
2003- } catch (DatabaseError e) {
2004- AppWindow.database_error (e);
2005- return;
2006- }
2007- // if we didn't short-circuit return in the catch clause above, then the change was
2008- // successfully committed to the database, so update it in the in-memory row cache
2009- backing_row.rating = rating;
2010- }
2011-
2012- notify_altered (new Alteration ("metadata", "rating"));
2013- }
2014-
2015- public override void increase_rating () {
2016- lock (backing_row) {
2017- set_rating (backing_row.rating.increase ());
2018- }
2019- }
2020-
2021- public override void decrease_rating () {
2022- lock (backing_row) {
2023- set_rating (backing_row.rating.decrease ());
2024- }
2025- }
2026-
2027 public override bool is_trashed () {
2028 return is_flag_set (FLAG_TRASH);
2029 }
2030
2031=== modified file 'src/config/ConfigurationInterfaces.vala'
2032--- src/config/ConfigurationInterfaces.vala 2014-08-14 05:21:24 +0000
2033+++ src/config/ConfigurationInterfaces.vala 2016-09-20 02:43:10 +0000
2034@@ -132,9 +132,6 @@
2035 case DISPLAY_SEARCH_BAR:
2036 return "DISPLAY_SEARCH_BAR";
2037
2038- case DISPLAY_PHOTO_RATINGS:
2039- return "DISPLAY_PHOTO_RATINGS";
2040-
2041 case DISPLAY_PHOTO_TAGS:
2042 return "DISPLAY_PHOTO_TAGS";
2043
2044@@ -644,27 +641,6 @@
2045 }
2046
2047 //
2048- // display photo ratings
2049- //
2050- public virtual bool get_display_photo_ratings () {
2051- try {
2052- return get_engine ().get_bool_property (ConfigurableProperty.DISPLAY_PHOTO_RATINGS);
2053- } catch (ConfigurationError err) {
2054- on_configuration_error (err);
2055-
2056- return true;
2057- }
2058- }
2059-
2060- public virtual void set_display_photo_ratings (bool display) {
2061- try {
2062- get_engine ().set_bool_property (ConfigurableProperty.DISPLAY_PHOTO_RATINGS, display);
2063- } catch (ConfigurationError err) {
2064- on_configuration_error (err);
2065- }
2066- }
2067-
2068- //
2069 // display photo tags
2070 //
2071 public virtual bool get_display_photo_tags () {
2072
2073=== modified file 'src/config/GSettingsEngine.vala'
2074--- src/config/GSettingsEngine.vala 2016-01-14 12:35:35 +0000
2075+++ src/config/GSettingsEngine.vala 2016-09-20 02:43:10 +0000
2076@@ -48,7 +48,6 @@
2077 schema_names[ConfigurableProperty.DISPLAY_SIDEBAR] = UI_PREFS_SCHEMA_NAME;
2078 schema_names[ConfigurableProperty.DISPLAY_METADATA_SIDEBAR] = UI_PREFS_SCHEMA_NAME;
2079 schema_names[ConfigurableProperty.DISPLAY_SEARCH_BAR] = UI_PREFS_SCHEMA_NAME;
2080- schema_names[ConfigurableProperty.DISPLAY_PHOTO_RATINGS] = UI_PREFS_SCHEMA_NAME;
2081 schema_names[ConfigurableProperty.DISPLAY_PHOTO_TAGS] = UI_PREFS_SCHEMA_NAME;
2082 schema_names[ConfigurableProperty.DISPLAY_PHOTO_TITLES] = UI_PREFS_SCHEMA_NAME;
2083 schema_names[ConfigurableProperty.DISPLAY_PHOTO_COMMENTS] = UI_PREFS_SCHEMA_NAME;
2084@@ -111,7 +110,6 @@
2085 key_names[ConfigurableProperty.DISPLAY_SIDEBAR] = "display-sidebar";
2086 key_names[ConfigurableProperty.DISPLAY_METADATA_SIDEBAR] = "display-metadata-sidebar";
2087 key_names[ConfigurableProperty.DISPLAY_SEARCH_BAR] = "display-search-bar";
2088- key_names[ConfigurableProperty.DISPLAY_PHOTO_RATINGS] = "display-photo-ratings";
2089 key_names[ConfigurableProperty.DISPLAY_PHOTO_TAGS] = "display-photo-tags";
2090 key_names[ConfigurableProperty.DISPLAY_PHOTO_TITLES] = "display-photo-titles";
2091 key_names[ConfigurableProperty.DISPLAY_PHOTO_COMMENTS] = "display-photo-comments";
2092
2093=== modified file 'src/core/ViewCollection.vala'
2094--- src/core/ViewCollection.vala 2014-08-08 21:13:09 +0000
2095+++ src/core/ViewCollection.vala 2016-09-20 02:43:10 +0000
2096@@ -727,7 +727,7 @@
2097 while ((dv != null) && (index_of (dv) < (num_views - 1))) {
2098 MediaSource tmp = dv.get_source () as MediaSource;
2099
2100- if ((tmp != null) && (tmp.get_rating () != Rating.REJECTED)) {
2101+ if ((tmp != null)) {
2102 // ...found a good one; return it.
2103 return dv;
2104 } else {
2105
2106=== modified file 'src/db/PhotoTable.vala'
2107--- src/db/PhotoTable.vala 2014-08-27 12:50:03 +0000
2108+++ src/db/PhotoTable.vala 2016-09-20 02:43:10 +0000
2109@@ -82,7 +82,6 @@
2110 public string exif_md5;
2111 public time_t time_created;
2112 public uint64 flags;
2113- public Rating rating;
2114 public string title;
2115 public string comment;
2116 public string? backlinks;
2117@@ -131,7 +130,6 @@
2118 + "exif_md5 TEXT, "
2119 + "time_created INTEGER, "
2120 + "flags INTEGER DEFAULT 0, "
2121- + "rating INTEGER DEFAULT 0, "
2122 + "file_format INTEGER DEFAULT 0, "
2123 + "title TEXT, "
2124 + "backlinks TEXT, "
2125@@ -179,8 +177,8 @@
2126 int res = db.prepare_v2 (
2127 "INSERT INTO PhotoTable (filename, width, height, filesize, timestamp, exposure_time, "
2128 + "orientation, original_orientation, import_id, event_id, md5, thumbnail_md5, "
2129- + "exif_md5, time_created, file_format, title, rating, editable_id, developer, comment) "
2130- + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
2131+ + "exif_md5, time_created, file_format, title, editable_id, developer, comment) "
2132+ + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
2133 -1, out stmt);
2134 assert (res == Sqlite.OK);
2135
2136@@ -218,13 +216,11 @@
2137 assert (res == Sqlite.OK);
2138 res = stmt.bind_text (16, photo_row.title);
2139 assert (res == Sqlite.OK);
2140- res = stmt.bind_int64 (17, photo_row.rating.serialize ());
2141- assert (res == Sqlite.OK);
2142- res = stmt.bind_int64 (18, BackingPhotoID.INVALID);
2143- assert (res == Sqlite.OK);
2144- res = stmt.bind_text (19, photo_row.developer.to_string ());
2145- assert (res == Sqlite.OK);
2146- res = stmt.bind_text (20, photo_row.comment);
2147+ res = stmt.bind_int64 (17, BackingPhotoID.INVALID);
2148+ assert (res == Sqlite.OK);
2149+ res = stmt.bind_text (18, photo_row.developer.to_string ());
2150+ assert (res == Sqlite.OK);
2151+ res = stmt.bind_text (19, photo_row.comment);
2152 assert (res == Sqlite.OK);
2153
2154 res = stmt.step ();
2155@@ -358,7 +354,7 @@
2156 int res = db.prepare_v2 (
2157 "SELECT filename, width, height, filesize, timestamp, exposure_time, orientation, "
2158 + "original_orientation, import_id, event_id, transformations, md5, thumbnail_md5, "
2159- + "exif_md5, time_created, flags, rating, file_format, title, backlinks, "
2160+ + "exif_md5, time_created, flags, file_format, title, backlinks, "
2161 + "time_reimported, editable_id, metadata_dirty, developer, develop_shotwell_id, "
2162 + "develop_camera_id, develop_embedded_id, comment, enhanced, original_transforms "
2163 + "FROM PhotoTable WHERE id=?",
2164@@ -388,21 +384,20 @@
2165 row.exif_md5 = stmt.column_text (13);
2166 row.time_created = (time_t) stmt.column_int64 (14);
2167 row.flags = stmt.column_int64 (15);
2168- row.rating = Rating.unserialize (stmt.column_int (16));
2169- row.master.file_format = PhotoFileFormat.unserialize (stmt.column_int (17));
2170- row.title = stmt.column_text (18);
2171- row.backlinks = stmt.column_text (19);
2172- row.time_reimported = (time_t) stmt.column_int64 (20);
2173- row.editable_id = BackingPhotoID (stmt.column_int64 (21));
2174- row.metadata_dirty = stmt.column_int (22) != 0;
2175- row.developer = stmt.column_text (23) != null ? RawDeveloper.from_string (stmt.column_text (23)) :
2176+ row.master.file_format = PhotoFileFormat.unserialize (stmt.column_int (16));
2177+ row.title = stmt.column_text (17);
2178+ row.backlinks = stmt.column_text (18);
2179+ row.time_reimported = (time_t) stmt.column_int64 (19);
2180+ row.editable_id = BackingPhotoID (stmt.column_int64 (20));
2181+ row.metadata_dirty = stmt.column_int (21) != 0;
2182+ row.developer = stmt.column_text (22) != null ? RawDeveloper.from_string (stmt.column_text (22)) :
2183 RawDeveloper.CAMERA;
2184- row.development_ids[RawDeveloper.SHOTWELL] = BackingPhotoID (stmt.column_int64 (24));
2185- row.development_ids[RawDeveloper.CAMERA] = BackingPhotoID (stmt.column_int64 (25));
2186- row.development_ids[RawDeveloper.EMBEDDED] = BackingPhotoID (stmt.column_int64 (26));
2187- row.comment = stmt.column_text (27);
2188- row.enhanced = stmt.column_int (28) != 0;
2189- row.original_transforms = marshall_all_transformations (stmt.column_text (29));
2190+ row.development_ids[RawDeveloper.SHOTWELL] = BackingPhotoID (stmt.column_int64 (23));
2191+ row.development_ids[RawDeveloper.CAMERA] = BackingPhotoID (stmt.column_int64 (24));
2192+ row.development_ids[RawDeveloper.EMBEDDED] = BackingPhotoID (stmt.column_int64 (25));
2193+ row.comment = stmt.column_text (26);
2194+ row.enhanced = stmt.column_int (27) != 0;
2195+ row.original_transforms = marshall_all_transformations (stmt.column_text (28));
2196
2197 return row;
2198 }
2199@@ -412,7 +407,7 @@
2200 int res = db.prepare_v2 (
2201 "SELECT id, filename, width, height, filesize, timestamp, exposure_time, orientation, "
2202 + "original_orientation, import_id, event_id, transformations, md5, thumbnail_md5, "
2203- + "exif_md5, time_created, flags, rating, file_format, title, backlinks, time_reimported, "
2204+ + "exif_md5, time_created, flags, file_format, title, backlinks, time_reimported, "
2205 + "editable_id, metadata_dirty, developer, develop_shotwell_id, develop_camera_id, "
2206 + "develop_embedded_id, comment, enhanced, original_transforms FROM PhotoTable",
2207 -1, out stmt);
2208@@ -438,21 +433,20 @@
2209 row.exif_md5 = stmt.column_text (14);
2210 row.time_created = (time_t) stmt.column_int64 (15);
2211 row.flags = stmt.column_int64 (16);
2212- row.rating = Rating.unserialize (stmt.column_int (17));
2213- row.master.file_format = PhotoFileFormat.unserialize (stmt.column_int (18));
2214- row.title = stmt.column_text (19);
2215- row.backlinks = stmt.column_text (20);
2216- row.time_reimported = (time_t) stmt.column_int64 (21);
2217- row.editable_id = BackingPhotoID (stmt.column_int64 (22));
2218- row.metadata_dirty = stmt.column_int (23) != 0;
2219- row.developer = stmt.column_text (24) != null ? RawDeveloper.from_string (stmt.column_text (24)) :
2220+ row.master.file_format = PhotoFileFormat.unserialize (stmt.column_int (17));
2221+ row.title = stmt.column_text (18);
2222+ row.backlinks = stmt.column_text (19);
2223+ row.time_reimported = (time_t) stmt.column_int64 (20);
2224+ row.editable_id = BackingPhotoID (stmt.column_int64 (21));
2225+ row.metadata_dirty = stmt.column_int (22) != 0;
2226+ row.developer = stmt.column_text (23) != null ? RawDeveloper.from_string (stmt.column_text (23)) :
2227 RawDeveloper.CAMERA;
2228- row.development_ids[RawDeveloper.SHOTWELL] = BackingPhotoID (stmt.column_int64 (25));
2229- row.development_ids[RawDeveloper.CAMERA] = BackingPhotoID (stmt.column_int64 (26));
2230- row.development_ids[RawDeveloper.EMBEDDED] = BackingPhotoID (stmt.column_int64 (27));
2231- row.comment = stmt.column_text (28);
2232- row.enhanced = stmt.column_int (29) != 0;
2233- row.original_transforms = marshall_all_transformations (stmt.column_text (30));
2234+ row.development_ids[RawDeveloper.SHOTWELL] = BackingPhotoID (stmt.column_int64 (24));
2235+ row.development_ids[RawDeveloper.CAMERA] = BackingPhotoID (stmt.column_int64 (25));
2236+ row.development_ids[RawDeveloper.EMBEDDED] = BackingPhotoID (stmt.column_int64 (26));
2237+ row.comment = stmt.column_text (27);
2238+ row.enhanced = stmt.column_int (28) != 0;
2239+ row.original_transforms = marshall_all_transformations (stmt.column_text (29));
2240 validate_orientation (row);
2241
2242 all.add (row);
2243@@ -472,10 +466,10 @@
2244 Sqlite.Statement stmt;
2245 int res = db.prepare_v2 ("INSERT INTO PhotoTable (filename, width, height, filesize, "
2246 + "timestamp, exposure_time, orientation, original_orientation, import_id, event_id, "
2247- + "transformations, md5, thumbnail_md5, exif_md5, time_created, flags, rating, "
2248+ + "transformations, md5, thumbnail_md5, exif_md5, time_created, flags, "
2249 + "file_format, title, editable_id, developer, develop_shotwell_id, develop_camera_id, "
2250 + "develop_embedded_id, comment, enhanced, original_transforms) "
2251- + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
2252+ + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
2253 -1, out stmt);
2254 assert (res == Sqlite.OK);
2255
2256@@ -511,28 +505,26 @@
2257 assert (res == Sqlite.OK);
2258 res = stmt.bind_int64 (16, (int64) original.flags);
2259 assert (res == Sqlite.OK);
2260- res = stmt.bind_int64 (17, original.rating.serialize ());
2261- assert (res == Sqlite.OK);
2262- res = stmt.bind_int (18, original.master.file_format.serialize ());
2263- assert (res == Sqlite.OK);
2264- res = stmt.bind_text (19, original.title);
2265- assert (res == Sqlite.OK);
2266- res = stmt.bind_int64 (20, editable_id.id);
2267+ res = stmt.bind_int (17, original.master.file_format.serialize ());
2268+ assert (res == Sqlite.OK);
2269+ res = stmt.bind_text (18, original.title);
2270+ assert (res == Sqlite.OK);
2271+ res = stmt.bind_int64 (19, editable_id.id);
2272 assert (res == Sqlite.OK);
2273
2274- res = stmt.bind_text (21, original.developer.to_string ());
2275- assert (res == Sqlite.OK);
2276- res = stmt.bind_int64 (22, develop_shotwell.id);
2277- assert (res == Sqlite.OK);
2278- res = stmt.bind_int64 (23, develop_camera_id.id);
2279- assert (res == Sqlite.OK);
2280- res = stmt.bind_int64 (24, develop_embedded_id.id);
2281- assert (res == Sqlite.OK);
2282- res = stmt.bind_text (25, original.comment);
2283- assert (res == Sqlite.OK);
2284- res = stmt.bind_int (26, original.enhanced ? 1 : 0);
2285- assert (res == Sqlite.OK);
2286- res = stmt.bind_text (27, unmarshall_all_transformations (original.original_transforms));
2287+ res = stmt.bind_text (20, original.developer.to_string ());
2288+ assert (res == Sqlite.OK);
2289+ res = stmt.bind_int64 (21, develop_shotwell.id);
2290+ assert (res == Sqlite.OK);
2291+ res = stmt.bind_int64 (22, develop_camera_id.id);
2292+ assert (res == Sqlite.OK);
2293+ res = stmt.bind_int64 (23, develop_embedded_id.id);
2294+ assert (res == Sqlite.OK);
2295+ res = stmt.bind_text (24, original.comment);
2296+ assert (res == Sqlite.OK);
2297+ res = stmt.bind_int (25, original.enhanced ? 1 : 0);
2298+ assert (res == Sqlite.OK);
2299+ res = stmt.bind_text (26, unmarshall_all_transformations (original.original_transforms));
2300 assert (res == Sqlite.OK);
2301
2302 res = stmt.step ();
2303@@ -622,10 +614,6 @@
2304 return update_int64_by_id (photo_id.id, "flags", (int64) flags);
2305 }
2306
2307- public bool set_rating (PhotoID photo_id, Rating rating) {
2308- return update_int_by_id (photo_id.id, "rating", rating.serialize ());
2309- }
2310-
2311 public int get_event_photo_count (EventID event_id) {
2312 Sqlite.Statement stmt;
2313 int res = db.prepare_v2 ("SELECT id FROM PhotoTable WHERE event_id = ?", -1, out stmt);
2314
2315=== modified file 'src/db/SavedSearchDBTable.vala'
2316--- src/db/SavedSearchDBTable.vala 2014-08-08 21:13:09 +0000
2317+++ src/db/SavedSearchDBTable.vala 2016-09-20 02:43:10 +0000
2318@@ -114,22 +114,6 @@
2319 if (res != Sqlite.DONE)
2320 fatal ("create SavedSearchDBTable_Modified", res);
2321
2322- // Create rating search table.
2323- res = db.prepare_v2 ("CREATE TABLE IF NOT EXISTS "
2324- + "SavedSearchDBTable_Rating "
2325- + "("
2326- + "id INTEGER PRIMARY KEY, "
2327- + "search_id INTEGER NOT NULL, "
2328- + "search_type TEXT NOT NULL, "
2329- + "rating INTEGER NOT_NULL, "
2330- + "context TEXT NOT NULL"
2331- + ")", -1, out stmt);
2332- assert (res == Sqlite.OK);
2333-
2334- res = stmt.step ();
2335- if (res != Sqlite.DONE)
2336- fatal ("create SavedSearchDBTable_Rating", res);
2337-
2338 // Create date search table.
2339 res = db.prepare_v2 ("CREATE TABLE IF NOT EXISTS "
2340 + "SavedSearchDBTable_Date "
2341@@ -145,7 +129,17 @@
2342
2343 res = stmt.step ();
2344 if (res != Sqlite.DONE)
2345- fatal ("create SavedSearchDBTable_Rating", res);
2346+ fatal ("create SavedSearchDBTable_Date", res);
2347+
2348+ res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS "
2349+ + "SavedSearchDBTable_Date_Index "
2350+ + "ON SavedSearchDBTable_Date(search_id)", -1, out stmt);
2351+
2352+ assert (res == Sqlite.OK);
2353+ res = stmt.step ();
2354+
2355+ if (res != Sqlite.DONE)
2356+ fatal ("create SavedSearchDBTable_Date_Index", res);
2357
2358 // Create indexes.
2359 res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS "
2360@@ -177,24 +171,9 @@
2361 + "ON SavedSearchDBTable_Modified(search_id)", -1, out stmt);
2362 assert (res == Sqlite.OK);
2363 res = stmt.step ();
2364+
2365 if (res != Sqlite.DONE)
2366 fatal ("create SavedSearchDBTable_Modified_Index", res);
2367-
2368- res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS "
2369- + "SavedSearchDBTable_Rating_Index "
2370- + "ON SavedSearchDBTable_Rating(search_id)", -1, out stmt);
2371- assert (res == Sqlite.OK);
2372- res = stmt.step ();
2373- if (res != Sqlite.DONE)
2374- fatal ("create SavedSearchDBTable_Rating_Index", res);
2375-
2376- res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS "
2377- + "SavedSearchDBTable_Date_Index "
2378- + "ON SavedSearchDBTable_Date(search_id)", -1, out stmt);
2379- assert (res == Sqlite.OK);
2380- res = stmt.step ();
2381- if (res != Sqlite.DONE)
2382- fatal ("create SavedSearchDBTable_Date_Index", res);
2383 }
2384
2385 public static SavedSearchDBTable get_instance () {
2386@@ -323,29 +302,6 @@
2387 res = stmt.step ();
2388 if (res != Sqlite.DONE)
2389 throw_error ("SavedSearchDBTable_Modified.add", res);
2390- } else if (condition is SearchConditionRating) {
2391- SearchConditionRating rating = condition as SearchConditionRating;
2392- Sqlite.Statement stmt;
2393- int res = db.prepare_v2 ("INSERT INTO SavedSearchDBTable_Rating (search_id, search_type, rating, "
2394- + "context) VALUES (?, ?, ?, ?)", -1,
2395- out stmt);
2396- assert (res == Sqlite.OK);
2397-
2398- res = stmt.bind_int64 (1, id.id);
2399- assert (res == Sqlite.OK);
2400-
2401- res = stmt.bind_text (2, rating.search_type.to_string ());
2402- assert (res == Sqlite.OK);
2403-
2404- res = stmt.bind_int (3, rating.rating.serialize ());
2405- assert (res == Sqlite.OK);
2406-
2407- res = stmt.bind_text (4, rating.context.to_string ());
2408- assert (res == Sqlite.OK);
2409-
2410- res = stmt.step ();
2411- if (res != Sqlite.DONE)
2412- throw_error ("SavedSearchDBTable_Rating.add", res);
2413 } else if (condition is SearchConditionDate) {
2414 SearchConditionDate date = condition as SearchConditionDate;
2415 Sqlite.Statement stmt;
2416@@ -383,7 +339,6 @@
2417 remove_conditions_for_table ("SavedSearchDBTable_MediaType", search_id);
2418 remove_conditions_for_table ("SavedSearchDBTable_Flagged", search_id);
2419 remove_conditions_for_table ("SavedSearchDBTable_Modified", search_id);
2420- remove_conditions_for_table ("SavedSearchDBTable_Rating", search_id);
2421 remove_conditions_for_table ("SavedSearchDBTable_Date", search_id);
2422 }
2423
2424@@ -503,30 +458,6 @@
2425 list.add (condition);
2426 }
2427
2428- // Get all rating conditions.
2429- res = db.prepare_v2 ("SELECT search_type, rating, context FROM SavedSearchDBTable_Rating "
2430- + "WHERE search_id=?",
2431- -1, out stmt);
2432- assert (res == Sqlite.OK);
2433-
2434- res = stmt.bind_int64 (1, search_id.id);
2435- assert (res == Sqlite.OK);
2436-
2437- for (;;) {
2438- res = stmt.step ();
2439- if (res == Sqlite.DONE)
2440- break;
2441- else if (res != Sqlite.ROW)
2442- throw_error ("SavedSearchDBTable_Rating.get_all_rows", res);
2443-
2444- SearchConditionRating condition = new SearchConditionRating (
2445- SearchCondition.SearchType.from_string (stmt.column_text (0)),
2446- Rating.unserialize (stmt.column_int (1)),
2447- SearchConditionRating.Context.from_string (stmt.column_text (2)));
2448-
2449- list.add (condition);
2450- }
2451-
2452 // Get all date conditions.
2453 res = db.prepare_v2 ("SELECT search_type, context, date_one, date_two FROM SavedSearchDBTable_Date "
2454 + "WHERE search_id=?",
2455
2456=== modified file 'src/db/VideoTable.vala'
2457--- src/db/VideoTable.vala 2014-08-08 21:13:09 +0000
2458+++ src/db/VideoTable.vala 2016-09-20 02:43:10 +0000
2459@@ -48,7 +48,6 @@
2460 public EventID event_id;
2461 public string md5;
2462 public time_t time_created;
2463- public Rating rating;
2464 public string title;
2465 public string? backlinks;
2466 public time_t time_reimported;
2467@@ -75,7 +74,6 @@
2468 + "event_id INTEGER, "
2469 + "md5 TEXT, "
2470 + "time_created INTEGER, "
2471- + "rating INTEGER DEFAULT 0, "
2472 + "title TEXT, "
2473 + "backlinks TEXT, "
2474 + "time_reimported INTEGER, "
2475@@ -189,7 +187,7 @@
2476 Sqlite.Statement stmt;
2477 int res = db.prepare_v2 (
2478 "SELECT filename, width, height, clip_duration, is_interpretable, filesize, timestamp, "
2479- + "exposure_time, import_id, event_id, md5, time_created, rating, title, backlinks, "
2480+ + "exposure_time, import_id, event_id, md5, time_created, title, backlinks, "
2481 + "time_reimported, flags, comment FROM VideoTable WHERE id=?",
2482 -1, out stmt);
2483 assert (res == Sqlite.OK);
2484@@ -214,12 +212,11 @@
2485 row.event_id.id = stmt.column_int64 (9);
2486 row.md5 = stmt.column_text (10);
2487 row.time_created = (time_t) stmt.column_int64 (11);
2488- row.rating = Rating.unserialize (stmt.column_int (12));
2489- row.title = stmt.column_text (13);
2490- row.backlinks = stmt.column_text (14);
2491- row.time_reimported = (time_t) stmt.column_int64 (15);
2492- row.flags = stmt.column_int64 (16);
2493- row.comment = stmt.column_text (17);
2494+ row.title = stmt.column_text (12);
2495+ row.backlinks = stmt.column_text (13);
2496+ row.time_reimported = (time_t) stmt.column_int64 (14);
2497+ row.flags = stmt.column_int64 (15);
2498+ row.comment = stmt.column_text (16);
2499
2500 return row;
2501 }
2502@@ -228,7 +225,7 @@
2503 Sqlite.Statement stmt;
2504 int res = db.prepare_v2 (
2505 "SELECT id, filename, width, height, clip_duration, is_interpretable, filesize, "
2506- + "timestamp, exposure_time, import_id, event_id, md5, time_created, rating, title, "
2507+ + "timestamp, exposure_time, import_id, event_id, md5, time_created, title, "
2508 + "backlinks, time_reimported, flags, comment FROM VideoTable",
2509 -1, out stmt);
2510 assert (res == Sqlite.OK);
2511@@ -250,12 +247,11 @@
2512 row.event_id.id = stmt.column_int64 (10);
2513 row.md5 = stmt.column_text (11);
2514 row.time_created = (time_t) stmt.column_int64 (12);
2515- row.rating = Rating.unserialize (stmt.column_int (13));
2516- row.title = stmt.column_text (14);
2517- row.backlinks = stmt.column_text (15);
2518- row.time_reimported = (time_t) stmt.column_int64 (16);
2519- row.flags = stmt.column_int64 (17);
2520- row.comment = stmt.column_text (18);
2521+ row.title = stmt.column_text (13);
2522+ row.backlinks = stmt.column_text (14);
2523+ row.time_reimported = (time_t) stmt.column_int64 (15);
2524+ row.flags = stmt.column_int64 (16);
2525+ row.comment = stmt.column_text (17);
2526
2527 all.add (row);
2528 }
2529@@ -279,10 +275,6 @@
2530 update_int64_by_id_2 (video_id.id, "exposure_time", (int64) time);
2531 }
2532
2533- public void set_rating (VideoID video_id, Rating rating) throws DatabaseError {
2534- update_int64_by_id_2 (video_id.id, "rating", rating.serialize ());
2535- }
2536-
2537 public void set_flags (VideoID video_id, uint64 flags) throws DatabaseError {
2538 update_int64_by_id_2 (video_id.id, "flags", (int64) flags);
2539 }
2540
2541=== modified file 'src/library/FlaggedPage.vala'
2542--- src/library/FlaggedPage.vala 2014-08-08 21:13:09 +0000
2543+++ src/library/FlaggedPage.vala 2016-09-20 02:43:10 +0000
2544@@ -21,8 +21,7 @@
2545
2546 private class FlaggedSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
2547 public override uint get_criteria () {
2548- return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
2549- SearchFilterCriteria.RATING;
2550+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA;
2551 }
2552 }
2553
2554
2555=== modified file 'src/library/OfflinePage.vala'
2556--- src/library/OfflinePage.vala 2014-08-08 21:13:09 +0000
2557+++ src/library/OfflinePage.vala 2016-09-20 02:43:10 +0000
2558@@ -18,7 +18,7 @@
2559 private class OfflineSearchViewFilter : DefaultSearchViewFilter {
2560 public override uint get_criteria () {
2561 return SearchFilterCriteria.TEXT | SearchFilterCriteria.FLAG |
2562- SearchFilterCriteria.MEDIA | SearchFilterCriteria.RATING;
2563+ SearchFilterCriteria.MEDIA;
2564 }
2565 }
2566
2567
2568=== modified file 'src/library/PhotosPage.vala'
2569--- src/library/PhotosPage.vala 2014-09-29 15:08:44 +0000
2570+++ src/library/PhotosPage.vala 2016-09-20 02:43:10 +0000
2571@@ -53,8 +53,7 @@
2572
2573 private class PhotosSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
2574 public override uint get_criteria () {
2575- return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
2576- SearchFilterCriteria.RATING;
2577+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA;
2578 }
2579 }
2580
2581@@ -71,4 +70,4 @@
2582 public override SearchViewFilter get_search_view_filter () {
2583 return search_filter;
2584 }
2585-}
2586\ No newline at end of file
2587+}
2588
2589=== modified file 'src/library/RawsPage.vala'
2590--- src/library/RawsPage.vala 2015-12-08 16:25:38 +0000
2591+++ src/library/RawsPage.vala 2016-09-20 02:43:10 +0000
2592@@ -53,8 +53,7 @@
2593
2594 private class RawsSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
2595 public override uint get_criteria () {
2596- return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
2597- SearchFilterCriteria.RATING;
2598+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA;
2599 }
2600 }
2601
2602
2603=== modified file 'src/library/TrashPage.vala'
2604--- src/library/TrashPage.vala 2014-09-29 15:32:19 +0000
2605+++ src/library/TrashPage.vala 2016-09-20 02:43:10 +0000
2606@@ -18,7 +18,7 @@
2607 private class TrashSearchViewFilter : DefaultSearchViewFilter {
2608 public override uint get_criteria () {
2609 return SearchFilterCriteria.TEXT | SearchFilterCriteria.FLAG |
2610- SearchFilterCriteria.MEDIA | SearchFilterCriteria.RATING;
2611+ SearchFilterCriteria.MEDIA;
2612 }
2613 }
2614
2615
2616=== modified file 'src/library/VideosPage.vala'
2617--- src/library/VideosPage.vala 2014-09-23 03:13:45 +0000
2618+++ src/library/VideosPage.vala 2016-09-20 02:43:10 +0000
2619@@ -64,8 +64,7 @@
2620
2621 private class VideosSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
2622 public override uint get_criteria () {
2623- return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
2624- SearchFilterCriteria.RATING;
2625+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA;
2626 }
2627 }
2628
2629@@ -82,4 +81,4 @@
2630 public override SearchViewFilter get_search_view_filter () {
2631 return search_filter;
2632 }
2633-}
2634\ No newline at end of file
2635+}
2636
2637=== modified file 'src/photos/PhotoMetadata.vala'
2638--- src/photos/PhotoMetadata.vala 2016-01-14 12:35:35 +0000
2639+++ src/photos/PhotoMetadata.vala 2016-09-20 02:43:10 +0000
2640@@ -1134,46 +1134,4 @@
2641 public string? get_exposure_bias () {
2642 return get_string_interpreted ("Exif.Photo.ExposureBiasValue");
2643 }
2644-
2645- private static string[] RATING_TAGS = {
2646- "Xmp.xmp.Rating",
2647- "Iptc.Application2.Urgency",
2648- "Xmp.photoshop.Urgency",
2649- "Exif.Image.Rating"
2650- };
2651-
2652- public Rating get_rating () {
2653- string? rating_string = get_first_string (RATING_TAGS);
2654- if (rating_string != null)
2655- return Rating.unserialize (int.parse (rating_string));
2656-
2657- rating_string = get_string ("Exif.Image.RatingPercent");
2658- if (rating_string == null) {
2659- return Rating.UNRATED;
2660- }
2661-
2662- int int_percent_rating = int.parse (rating_string);
2663- for (int i = 5; i >= 0; --i) {
2664- if (int_percent_rating >= Resources.rating_thresholds[i])
2665- return Rating.unserialize (i);
2666- }
2667- return Rating.unserialize (-1);
2668- }
2669-
2670- // Among photo managers, Xmp.xmp.Rating tends to be the standard way to represent ratings.
2671- // Other photo managers, notably F-Spot, take hints from Urgency fields about what the rating
2672- // of an imported photo should be, and we have decided to do as well. Xmp.xmp.Rating is the only
2673- // field we've seen photo manages export ratings to, while Urgency fields seem to have a fundamentally
2674- // different meaning. See http://trac.yorba.org/wiki/PhotoTags#Rating for more information.
2675- public void set_rating (Rating rating) {
2676- int int_rating = rating.serialize ();
2677- set_string ("Xmp.xmp.Rating", int_rating.to_string ());
2678- set_string ("Exif.Image.Rating", int_rating.to_string ());
2679-
2680- if ( 0 <= int_rating )
2681- set_string ("Exif.Image.RatingPercent", Resources.rating_thresholds[int_rating].to_string ());
2682- else // in this case we _know_ int_rating is -1
2683- set_string ("Exif.Image.RatingPercent", int_rating.to_string ());
2684- }
2685 }
2686-
2687
2688=== modified file 'src/searches/SavedSearchDialog.vala'
2689--- src/searches/SavedSearchDialog.vala 2015-08-10 07:31:23 +0000
2690+++ src/searches/SavedSearchDialog.vala 2016-09-20 02:43:10 +0000
2691@@ -96,10 +96,6 @@
2692 my_row = new SearchRowModified (this);
2693 break;
2694
2695- case SearchCondition.SearchType.RATING:
2696- my_row = new SearchRowRating (this);
2697- break;
2698-
2699 case SearchCondition.SearchType.DATE:
2700 my_row = new SearchRowDate (this);
2701 break;
2702@@ -407,75 +403,6 @@
2703 }
2704 }
2705
2706- private class SearchRowRating : SearchRow {
2707- private Gtk.Box box;
2708- private Gtk.ComboBoxText rating;
2709- private Gtk.ComboBoxText context;
2710-
2711- private SearchRowContainer parent;
2712-
2713- public SearchRowRating (SearchRowContainer parent) {
2714- this.parent = parent;
2715-
2716- // Ordering must correspond with Rating
2717- rating = new Gtk.ComboBoxText ();
2718- rating.append_text (Resources.rating_combo_box (Rating.REJECTED));
2719- rating.append_text (Resources.rating_combo_box (Rating.UNRATED));
2720- rating.append_text (Resources.rating_combo_box (Rating.ONE));
2721- rating.append_text (Resources.rating_combo_box (Rating.TWO));
2722- rating.append_text (Resources.rating_combo_box (Rating.THREE));
2723- rating.append_text (Resources.rating_combo_box (Rating.FOUR));
2724- rating.append_text (Resources.rating_combo_box (Rating.FIVE));
2725- rating.set_active (0);
2726- rating.changed.connect (on_changed);
2727-
2728- context = new Gtk.ComboBoxText ();
2729- context.append_text (_ ("and higher"));
2730- context.append_text (_ ("only"));
2731- context.append_text (_ ("and lower"));
2732- context.set_active (0);
2733- context.changed.connect (on_changed);
2734-
2735- box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 8);
2736- box.pack_start (new Gtk.Label (_ ("is")), false, false, 0);
2737- box.pack_start (rating, false, false, 0);
2738- box.pack_start (context, false, false, 0);
2739- box.show_all ();
2740- }
2741-
2742- ~SearchRowRating () {
2743- rating.changed.disconnect (on_changed);
2744- context.changed.disconnect (on_changed);
2745- }
2746-
2747- public override Gtk.Widget get_widget () {
2748- return box;
2749- }
2750-
2751- public override SearchCondition get_search_condition () {
2752- SearchCondition.SearchType search_type = parent.get_search_type ();
2753- Rating search_rating = (Rating) rating.get_active () + Rating.REJECTED;
2754- SearchConditionRating.Context search_context = (SearchConditionRating.Context) context.get_active ();
2755- SearchConditionRating c = new SearchConditionRating (search_type, search_rating, search_context);
2756- return c;
2757- }
2758-
2759- public override void populate (SearchCondition sc) {
2760- SearchConditionRating? r = sc as SearchConditionRating;
2761- assert (r != null);
2762- context.set_active (r.context);
2763- rating.set_active (r.rating - Rating.REJECTED);
2764- }
2765-
2766- public override bool is_complete () {
2767- return true;
2768- }
2769-
2770- private void on_changed () {
2771- parent.changed (parent);
2772- }
2773- }
2774-
2775 private class SearchRowDate : SearchRow {
2776 private const string DATE_FORMAT = "%x";
2777 private Gtk.Box box;
2778
2779=== modified file 'src/searches/SearchBoolean.vala'
2780--- src/searches/SearchBoolean.vala 2014-08-08 21:13:09 +0000
2781+++ src/searches/SearchBoolean.vala 2016-09-20 02:43:10 +0000
2782@@ -55,7 +55,6 @@
2783 MEDIA_TYPE,
2784 FLAG_STATE,
2785 MODIFIED_STATE,
2786- RATING,
2787 COMMENT,
2788 DATE;
2789 // Note: when adding new types, be sure to update all functions below.
2790@@ -63,7 +62,7 @@
2791 public static SearchType[] as_array () {
2792 return {
2793 ANY_TEXT, TITLE, TAG, COMMENT, EVENT_NAME, FILE_NAME,
2794- MEDIA_TYPE, FLAG_STATE, MODIFIED_STATE, RATING, DATE
2795+ MEDIA_TYPE, FLAG_STATE, MODIFIED_STATE, DATE
2796 };
2797 }
2798
2799@@ -104,9 +103,6 @@
2800 case SearchType.MODIFIED_STATE:
2801 return "MODIFIED_STATE";
2802
2803- case SearchType.RATING:
2804- return "RATING";
2805-
2806 case SearchType.DATE:
2807 return "DATE";
2808
2809@@ -143,9 +139,6 @@
2810 else if (str == "MODIFIED_STATE")
2811 return SearchType.MODIFIED_STATE;
2812
2813- else if (str == "RATING")
2814- return SearchType.RATING;
2815-
2816 else if (str == "DATE")
2817 return SearchType.DATE;
2818
2819@@ -182,9 +175,6 @@
2820 case SearchType.MODIFIED_STATE:
2821 return _ ("Photo state");
2822
2823- case SearchType.RATING:
2824- return _ ("Rating");
2825-
2826 case SearchType.DATE:
2827 return _ ("Date");
2828
2829@@ -630,78 +620,6 @@
2830 }
2831 }
2832
2833-
2834-// Condition for rating matching.
2835-public class SearchConditionRating : SearchCondition {
2836- public enum Context {
2837- AND_HIGHER = 0,
2838- ONLY,
2839- AND_LOWER;
2840-
2841- public string to_string () {
2842- switch (this) {
2843- case Context.AND_HIGHER:
2844- return "AND_HIGHER";
2845-
2846- case Context.ONLY:
2847- return "ONLY";
2848-
2849- case Context.AND_LOWER:
2850- return "AND_LOWER";
2851-
2852- default:
2853- error ("unrecognized rating search context enumeration value");
2854- }
2855- }
2856-
2857- public static Context from_string (string str) {
2858- if (str == "AND_HIGHER")
2859- return Context.AND_HIGHER;
2860-
2861- else if (str == "ONLY")
2862- return Context.ONLY;
2863-
2864- else if (str == "AND_LOWER")
2865- return Context.AND_LOWER;
2866-
2867- else
2868- error ("unrecognized rating search context name: %s", str);
2869- }
2870- }
2871-
2872- // Rating to check against.
2873- public Rating rating {
2874- get;
2875- private set;
2876- }
2877-
2878- // How to match.
2879- public Context context {
2880- get;
2881- private set;
2882- }
2883-
2884- public SearchConditionRating (SearchCondition.SearchType search_type, Rating rating, Context context) {
2885- this.search_type = search_type;
2886- this.rating = rating;
2887- this.context = context;
2888- }
2889-
2890- // Determines whether the source is included.
2891- public override bool predicate (MediaSource source) {
2892- Rating source_rating = source.get_rating ();
2893- if (context == Context.AND_HIGHER)
2894- return source_rating >= rating;
2895- else if (context == Context.ONLY)
2896- return source_rating == rating;
2897- else if (context == Context.AND_LOWER)
2898- return source_rating <= rating;
2899- else
2900- error ("unknown rating search context");
2901- }
2902-}
2903-
2904-
2905 // Condition for date range.
2906 public class SearchConditionDate : SearchCondition {
2907 public enum Context {
2908
2909=== removed file 'src/sidebar/Rating.vala'
2910--- src/sidebar/Rating.vala 2016-04-25 21:24:16 +0000
2911+++ src/sidebar/Rating.vala 1970-01-01 00:00:00 +0000
2912@@ -1,666 +0,0 @@
2913-/***
2914- Copyright (C) 2012 Lucas Baudin <xapantu@gmail.com>
2915- Copyright (C) 2012-2014 Victor Martinez <victoreduardm@gmail.com>
2916-
2917- This program or library is free software; you can redistribute it
2918- and/or modify it under the terms of the GNU Lesser General Public
2919- License as published by the Free Software Foundation; either
2920- version 3 of the License, or (at your option) any later version.
2921-
2922- This library is distributed in the hope that it will be useful,
2923- but WITHOUT ANY WARRANTY; without even the implied warranty of
2924- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2925- Lesser General Public License for more details.
2926-
2927- You should have received a copy of the GNU Lesser General
2928- Public License along with this library; if not, write to the
2929- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2930- Boston, MA 02110-1301 USA.
2931-***/
2932-
2933-/**
2934- * A star rating widget.
2935- *
2936- *
2937- */
2938-public class PhotoRatingWidget : Gtk.EventBox {
2939- /**
2940- * Emitted when a new rating is selected.
2941- *
2942- * @param new_rating The new rating.
2943- *
2944- */
2945- public signal void rating_changed (int new_rating);
2946-
2947- /**
2948- * Whether to use symbolic star icons.
2949- *
2950- *
2951- */
2952- public bool symbolic {
2953- get {
2954- return renderer.symbolic;
2955- } set {
2956- renderer.symbolic = value;
2957- }
2958- }
2959-
2960- /**
2961- * Pixel size of star icons.
2962- *
2963- *
2964- */
2965- public int icon_size {
2966- get {
2967- return renderer.icon_size;
2968- } set {
2969- renderer.icon_size = value;
2970- }
2971- }
2972-
2973- /**
2974- * Total number of stars. It also represents the maximum rating possible.
2975- * That is, possible ratings are between 0 and //n_stars//.
2976- *
2977- * Allowed values: >= 0. Default: 5.
2978- *
2979- */
2980- public int n_stars {
2981- get {
2982- return renderer.n_stars;
2983- } set {
2984- renderer.n_stars = value;
2985- }
2986- }
2987-
2988- /**
2989- * Spacing inserted between star icons.
2990- *
2991- *
2992- */
2993- public int star_spacing {
2994- get {
2995- return renderer.star_spacing;
2996- } set {
2997- renderer.star_spacing = value;
2998- }
2999- }
3000-
3001-
3002- private int _rating = 0;
3003-
3004- /**
3005- * Current selected rating.
3006- *
3007- *
3008- */
3009- public int rating {
3010- get {
3011- return _rating;
3012- } set {
3013- _rating = value.clamp (0, n_stars);
3014- update_rating (_rating);
3015- }
3016- }
3017-
3018- internal double rating_offset {
3019- get {
3020- return renderer.rating_offset;
3021- } set {
3022- renderer.rating_offset = value;
3023- }
3024- }
3025-
3026- internal int item_width {
3027- get {
3028- return renderer.item_width;
3029- }
3030- }
3031-
3032- /**
3033- * Whether the widget will be centered with respect to its allocation.
3034- *
3035- *
3036- */
3037- public bool centered {
3038- get;
3039- set;
3040- default = false;
3041- }
3042-
3043- private PhotoRatingRenderer renderer;
3044- private int hover_rating = 0;
3045-
3046- /**
3047- * Creates a new Rating widget.
3048- *
3049- * @param centered Whether the widget should be centered with respect to its allocation.
3050- * @param size Pixel size of star icons.
3051- * @param symbolic Whether to use symbolic icons.
3052- *
3053- */
3054- public PhotoRatingWidget (bool centered, int size, bool symbolic = false) {
3055- this.centered = centered;
3056- this.renderer = new PhotoRatingRenderer (size, symbolic, get_style_context ());
3057- visible_window = false;
3058-
3059- add_events (Gdk.EventMask.BUTTON_PRESS_MASK
3060- | Gdk.EventMask.BUTTON_RELEASE_MASK
3061- | Gdk.EventMask.POINTER_MOTION_MASK
3062- | Gdk.EventMask.LEAVE_NOTIFY_MASK);
3063-
3064- state_flags_changed.connect_after (() => {
3065- renderer.render ();
3066- });
3067-
3068- renderer.render.connect_after (() => {
3069- compute_size ();
3070- queue_draw ();
3071- });
3072- }
3073-
3074- private void compute_size () {
3075- this.set_size_request (renderer.width, renderer.height);
3076- }
3077-
3078- public override bool motion_notify_event (Gdk.EventMotion event) {
3079- int x_offset = 0;
3080-
3081- if (centered) {
3082- Gtk.Allocation al;
3083- get_allocation (out al);
3084- x_offset = (al.width - width_request) / 2;
3085- }
3086-
3087- hover_rating = renderer.get_new_rating (event.x - x_offset);
3088- update_rating (hover_rating);
3089- return true;
3090- }
3091-
3092- public override bool button_press_event (Gdk.EventButton event) {
3093- rating = hover_rating;
3094- rating_changed (rating);
3095- return true;
3096- }
3097-
3098- public override bool leave_notify_event (Gdk.EventCrossing ev) {
3099- update_rating (rating);
3100- return true;
3101- }
3102-
3103- internal void update_rating (int fake_rating) {
3104- renderer.rating = fake_rating;
3105- queue_draw ();
3106- }
3107-
3108- public override bool draw (Cairo.Context context) {
3109- Gtk.Allocation al;
3110- get_allocation (out al);
3111- // try {
3112- Gdk.cairo_set_source_pixbuf (context,
3113- renderer.canvas,
3114- centered ? (al.width - width_request) / 2 : 0,
3115- centered ? (al.height - height_request) / 2 : 0);
3116- // } catch {
3117-
3118- // }
3119- context.paint ();
3120- return false;
3121- }
3122-}
3123-
3124-/**
3125- * A menu item that contains a rating widget.
3126- *
3127- *
3128- */
3129-public class PhotoRatingMenuItem : Gtk.MenuItem {
3130- /**
3131- * Current displayed rating. Note that you should read this value
3132- * after the {@link Gtk.MenuItem.activate} signal is emitted.
3133- *
3134- *
3135- */
3136- public int rating_value {
3137- get {
3138- return rating.rating;
3139- } set {
3140- rating.rating = value;
3141- }
3142- }
3143-
3144- private PhotoRatingWidget rating;
3145-
3146- /**
3147- * Creates a new rating menu item.
3148- *
3149- *
3150- */
3151- public PhotoRatingMenuItem (int icon_size = 16) {
3152- rating = new PhotoRatingWidget (false, icon_size, false);
3153- add (rating);
3154-
3155- // Workaround. Move the offset one star to the left for menuitems.
3156- rating.rating_offset = - (double) rating.item_width - (double) rating.star_spacing;
3157-
3158- this.state_flags_changed.connect (() => {
3159- // Suppress SELECTED and PRELIGHT states, since these are usually obtrusive
3160- var selected_flags = Gtk.StateFlags.SELECTED | Gtk.StateFlags.PRELIGHT;
3161- if ((get_state_flags () & selected_flags) != 0)
3162- unset_state_flags (selected_flags);
3163- });
3164- }
3165-
3166- public override bool motion_notify_event (Gdk.EventMotion ev) {
3167- rating.motion_notify_event (ev);
3168- rating.queue_draw ();
3169- return true;
3170- }
3171-
3172- public override bool button_press_event (Gdk.EventButton ev) {
3173- rating.button_press_event (ev);
3174- activate ();
3175- return true;
3176- }
3177-
3178- public override bool leave_notify_event (Gdk.EventCrossing ev) {
3179- rating.update_rating (rating_value);
3180- return true;
3181- }
3182-}
3183-
3184-
3185-public class PhotoRatingRenderer : Object {
3186- /**
3187- * Whether to delay the rendering of the rating until the next call
3188- * to render() after a property change. This is recommended in cases
3189- * where there's an extensive amount of drawing and the renderer's
3190- * properties are constantly changing; for example, when used by
3191- * a Gtk.CellRenderer in a Gtk.TreeView; in such case, it's desirable
3192- * to have the renderer re-draw its pixbuf only on the next call to
3193- * Gtk.CellRenderer.render.
3194- *
3195- * Default value: false.
3196- *
3197- */
3198- public bool delayed_render_mode {
3199- get;
3200- set;
3201- default = false;
3202- }
3203-
3204- /**
3205- * The pixbuf containing the stars. Should not be modified.
3206- *
3207- * To listen for changes on this property, connect to the render() signal.
3208- * If you need to modify this pixbuf, create a copy first.
3209- *
3210- *
3211- */
3212- public Gdk.Pixbuf canvas {
3213- get;
3214- private set;
3215- }
3216-
3217- /**
3218- * Rating value to render.
3219- *
3220- * Default value: 0.
3221- *
3222- */
3223- public uint rating {
3224- get;
3225- set;
3226- default = 0;
3227- }
3228-
3229- /**
3230- * Maximum possible rating. This represents the total number of stars
3231- * that will be rendered.
3232- *
3233- * Default value: 5.
3234- *
3235- */
3236- public int n_stars {
3237- get;
3238- set;
3239- default = 5;
3240- }
3241-
3242- /**
3243- * The number of pixels inserted between star icons.
3244- *
3245- * Default value: 3.
3246- *
3247- */
3248- public int star_spacing {
3249- get;
3250- set;
3251- default = 3;
3252- }
3253-
3254- /**
3255- * Total width of rating pixbuf (in pixels).
3256- *
3257- *
3258- */
3259- public int width {
3260- get;
3261- private set;
3262- default = 0;
3263- }
3264-
3265- /**
3266- * Total height of rating pixbuf (in pixels).
3267- *
3268- *
3269- */
3270- public int height {
3271- get;
3272- private set;
3273- default = 0;
3274- }
3275-
3276- /**
3277- * The width of each rating star (in pixels).
3278- *
3279- *
3280- */
3281- public int item_width {
3282- get;
3283- private set;
3284- default = 0;
3285- }
3286-
3287- /**
3288- * The height of each rating star (in pixels).
3289- *
3290- *
3291- */
3292- public int item_height {
3293- get;
3294- private set;
3295- default = 0;
3296- }
3297-
3298- /**
3299- * Pixel size of rating icons.
3300- *
3301- *
3302- */
3303- public int icon_size {
3304- get;
3305- set;
3306- default = 16;
3307- }
3308-
3309- /**
3310- * Whether to use symbolic star icons.
3311- *
3312- *
3313- */
3314- public bool symbolic {
3315- get;
3316- set;
3317- default = false;
3318- }
3319-
3320- /**
3321- * Whether to append a //plus// icon at the end of the star rating.
3322- *
3323- * Default value: false.
3324- *
3325- */
3326- public bool add_plus_sign {
3327- get;
3328- set;
3329- default = false;
3330- }
3331-
3332- /**
3333- * Background color.
3334- *
3335- * Default value: transparent.
3336- *
3337- */
3338- public Gdk.RGBA background_color {
3339- get {
3340- return bg_color;
3341- } set {
3342- bg_color = value;
3343-
3344- // Convert RGBA from 0-1.0 value range to 0-255 (8-bit representation) by
3345- // simply multiplying values. Then we move the bits to their correct positions,
3346- // since we'll use a 32 bit integer to represent four 8-bit portions.
3347- // Please note the loss of precision.
3348- uint r = ((uint) (value.red * 255)) << 24;
3349- uint g = ((uint) (value.green * 255)) << 16;
3350- uint b = ((uint) (value.blue * 255)) << 8;
3351- uint a = ((uint) (value.alpha * 255));
3352-
3353- // bit positions do not overlap, so this is safe.
3354- pixel_color_rgba = r | g | b | a;
3355- }
3356- }
3357-
3358- /**
3359- * Style context to use as reference for drawing.
3360- *
3361- *
3362- */
3363- public Gtk.StyleContext? style_context {
3364- get {
3365- return current_context;
3366- } set {
3367- if (value != current_context) {
3368- if (current_context != null)
3369- current_context.changed.disconnect (on_style_changed);
3370-
3371- current_context = value;
3372-
3373- if (current_context != null)
3374- current_context.changed.connect (on_style_changed);
3375-
3376- on_style_changed ();
3377- }
3378- }
3379- }
3380-
3381- internal double rating_offset {
3382- get;
3383- set;
3384- default = 0;
3385- }
3386-
3387- // Icon cache. It stores the pixbufs rendered for every state until the
3388- // style information changes.
3389- private Gee.HashMap<int, Gdk.Pixbuf> starred_pixbufs;
3390- private Gee.HashMap<int, Gdk.Pixbuf> not_starred_pixbufs;
3391- private Gee.HashMap<int, Gdk.Pixbuf> plus_sign_pixbufs;
3392- private Gdk.RGBA bg_color;
3393- private uint pixel_color_rgba;
3394- private Gtk.StyleContext? current_context;
3395- // Whether a property has changed or not. Used to avoid unnecessary work in render()
3396- private bool property_changed = true;
3397-
3398- /**
3399- * Creates a rating renderer.
3400- *
3401- * @param icon_size pixel size of star icons
3402- * @param symbolic Whether to use symbolic icons
3403- * @param context style context to use as reference for rendering, or //null//.
3404- *
3405- */
3406- public PhotoRatingRenderer (int icon_size, bool symbolic, Gtk.StyleContext? context) {
3407- starred_pixbufs = new Gee.HashMap<int, Gdk.Pixbuf> ();
3408- not_starred_pixbufs = new Gee.HashMap<int, Gdk.Pixbuf> ();
3409- plus_sign_pixbufs = new Gee.HashMap<int, Gdk.Pixbuf> ();
3410-
3411- this.symbolic = symbolic;
3412- this.icon_size = icon_size;
3413- this.style_context = context;
3414- this.background_color = { 0, 0, 0, 0 };
3415-
3416- // Initial rendering. This is important; it will connect a handler
3417- // to the notify() signal, and will also init some properties, such
3418- // as item_width, item_height, width, height, etc.
3419- assert (property_changed);
3420- render ();
3421- assert (!property_changed);
3422- }
3423-
3424- public virtual signal void render () {
3425- if (!property_changed)
3426- return;
3427-
3428- disable_property_notify ();
3429-
3430- Gtk.StateFlags state = Gtk.StateFlags.NORMAL;
3431-
3432- // Only consider actual state if the stars should be symbolic.
3433- // Otherwise we consider the single state (NORMAL) set above.
3434- if (symbolic && style_context != null)
3435- state = style_context.get_state ();
3436-
3437- var starred_pix = starred_pixbufs.get (state);
3438- var not_starred_pix = not_starred_pixbufs.get (state);
3439- var plus_sign_pix = plus_sign_pixbufs.get (state);
3440-
3441- // if no cached star pixbufs were found, render them.
3442- var factory = Granite.Services.IconFactory.get_default ();
3443-
3444- if (starred_pix == null) {
3445- string starred = symbolic ? "starred-symbolic" : "starred";
3446- starred_pix = factory.load_symbolic_icon (style_context, starred, icon_size);
3447- starred_pixbufs.set (state, starred_pix);
3448- }
3449-
3450- if (not_starred_pix == null) {
3451- string not_starred = symbolic ? "non-starred-symbolic" : "non-starred";
3452- not_starred_pix = factory.load_symbolic_icon (style_context, not_starred, icon_size);
3453- not_starred_pixbufs.set (state, not_starred_pix);
3454- }
3455-
3456- if (add_plus_sign && plus_sign_pix == null)
3457- plus_sign_pix = factory.load_symbolic_icon (style_context, "list-add-symbolic", icon_size);
3458-
3459- if (starred_pix != null && not_starred_pix != null) {
3460- // Compute size
3461- item_width = int.max (starred_pix.width, not_starred_pix.width);
3462- item_height = int.max (starred_pix.height, not_starred_pix.height);
3463-
3464- int new_width = (item_width + star_spacing) * n_stars - star_spacing;
3465- int new_height = item_height;
3466-
3467- if (add_plus_sign) {
3468- new_width += star_spacing + plus_sign_pix.width;
3469- new_height = int.max (new_height, plus_sign_pix.height);
3470- }
3471-
3472- // Generate canvas pixbuf
3473- if (canvas == null || new_width != width || new_height != height) {
3474- width = new_width;
3475- height = new_height;
3476- canvas = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, width, height);
3477- }
3478-
3479- if (canvas != null) {
3480- var star_canvas = canvas.copy ();
3481- star_canvas.fill ((uint) 0xffffff00);
3482-
3483- // Render
3484- for (int i = 0; i <= n_stars; i++) {
3485- Gdk.Pixbuf to_copy = null;
3486-
3487- if (i == n_stars) {
3488- if (!add_plus_sign)
3489- break;
3490- to_copy = plus_sign_pix;
3491- } else if (i < rating) {
3492- to_copy = starred_pix;
3493- } else {
3494- to_copy = not_starred_pix;
3495- }
3496-
3497- assert (to_copy != null);
3498-
3499- int dest_x = i * (item_width + (i > 0 ? star_spacing : 0)), dest_y = 0;
3500- to_copy.copy_area (0, 0, item_width, item_height, star_canvas, dest_x, dest_y);
3501- }
3502-
3503- canvas.fill (pixel_color_rgba);
3504- star_canvas.composite (canvas, 0, 0, canvas.width, canvas.height,
3505- 0, 0, 1, 1, Gdk.InterpType.BILINEAR, 255);
3506- } else {
3507- warning ("NULL rating canvas");
3508- }
3509- }
3510-
3511- // No more work to do until the next property change
3512- property_changed = false;
3513-
3514- enable_property_notify ();
3515- }
3516-
3517- private inline void disable_property_notify () {
3518- notify.disconnect (on_property_changed);
3519- }
3520-
3521- private inline void enable_property_notify () {
3522- notify.connect (on_property_changed);
3523- }
3524-
3525- /*
3526- * Returns a new rating value between 0 and n_stars, based on the cursor position
3527- * relative to the left side of the widget (x = 0).
3528- *
3529- * LEGEND:
3530- * X : A STAR
3531- * - : SPACE
3532- *
3533- * | x_offset | | spacing | | spacing | | spacing | | spacing ... | remaining space...
3534- * <-------------> X --------- X --------- X --------- X --------- ... X ------------->
3535- * ... 0 stars | 1 star | 2 stars | 3 stars | 4 stars ...| n_stars stars...
3536- *
3537- * The first row in the graphic above represents the values involved:
3538- * - x_offset : the value added in front of the first star.
3539- * - spacing : space inserted between stars (star_spacing).
3540- * - n_stars : total number of stars. It also represents the maximum rating.
3541- *
3542- * As you can see, you can modify the placement of the invisible value separators ("|")
3543- * by changing the value of x_offset. For instance, if you wanted the next star to be activated
3544- * when the cursor is at least halfway towards it, just modify x_offset. It should be similar
3545- * for other cases as well. 'rating_offset' uses exactly that mechanism to apply its value.
3546- */
3547- internal int get_new_rating (double x) {
3548- int x_offset = 0;
3549-
3550- x_offset -= (int) rating_offset;
3551-
3552- int cursor_x_pos = (int) x;
3553- int new_rating = 0;
3554-
3555- for (int i = 0; i < n_stars; i++) {
3556- if (cursor_x_pos > x_offset + i * (item_width + star_spacing))
3557- new_rating ++;
3558- }
3559-
3560- return new_rating;
3561- }
3562-
3563- private void on_style_changed () {
3564- // Invalidate old cached pixbufs
3565- starred_pixbufs.clear ();
3566- not_starred_pixbufs.clear ();
3567- plus_sign_pixbufs.clear ();
3568- }
3569-
3570- private void on_property_changed () {
3571- property_changed = true;
3572-
3573- if (!delayed_render_mode)
3574- render ();
3575- }
3576-}
3577-
3578-
3579
3580=== modified file 'src/sidebar/metadata/LibraryProperties.vala'
3581--- src/sidebar/metadata/LibraryProperties.vala 2014-10-08 22:41:03 +0000
3582+++ src/sidebar/metadata/LibraryProperties.vala 2016-09-20 02:43:10 +0000
3583@@ -5,7 +5,6 @@
3584 */
3585
3586 private class LibraryProperties : Properties {
3587- private Rating rating = Rating.UNRATED;
3588 private MediaSource? media_source;
3589 private string comment;
3590 private Gtk.Entry title_entry;
3591@@ -32,7 +31,6 @@
3592
3593 protected override void clear_properties () {
3594 base.clear_properties ();
3595- rating = Rating.UNRATED;
3596 comment = "";
3597 title = "";
3598 tags = "";
3599@@ -58,7 +56,6 @@
3600 tags = get_initial_tag_text (media_source);
3601 title = media_source.get_name ();
3602 comment = media_source.get_comment ();
3603- rating = media_source.get_rating ();
3604 if (flaggable != null)
3605 is_flagged = flaggable.is_flagged ();
3606 is_media = true;
3607@@ -82,10 +79,6 @@
3608 comment_entry.get_style_context ().add_class (Gtk.STYLE_CLASS_ENTRY);
3609 add_entry_line (_("Comment"), comment_entry);
3610
3611- var rating_widget = new PhotoRatingWidget (true, 15);
3612- rating_widget.rating = Resources.rating_int (rating);
3613- rating_widget.rating_changed.connect (rating_widget_changed);
3614-
3615 var spacerrate = new Gtk.Grid ();
3616 spacerrate.set_size_request (50, -1);
3617 spacerrate.hexpand = true;
3618@@ -98,19 +91,7 @@
3619 toolbtn_flag.clicked.connect (flag_btn_clicked);
3620 update_flag_action ();
3621
3622- var rate_grid = new Gtk.Grid ();
3623- rate_grid.hexpand = true;
3624- rate_grid.set_size_request (125, 15);
3625-
3626- rate_grid.attach (rating_widget, 0, 0, 1, 1);
3627- rate_grid.attach (spacerrate, 1, 0, 1, 1);
3628- rate_grid.attach (toolbtn_flag , 2, 0, 1, 1);
3629- attach (rate_grid, 0, (int) line_count, 1, 1);
3630- line_count++;
3631-
3632- var spacer = new Gtk.Grid ();
3633- spacer.set_size_request (100, 15);
3634- attach (spacer, 0, (int) line_count, 1, 1);
3635+ attach (toolbtn_flag, 0, (int) line_count, 1, 1);
3636 line_count++;
3637
3638 tags_entry = new Gtk.Entry ();
3639@@ -122,16 +103,6 @@
3640 }
3641 }
3642
3643- private void rating_widget_changed (int rating) {
3644- save_changes_to_source ();
3645- if (media_source != null) {
3646- SetRatingSingleCommand command = new SetRatingSingleCommand (
3647- media_source, Resources.int_to_rating (rating));
3648-
3649- AppWindow.get_command_manager ().execute (command);
3650- }
3651- }
3652-
3653 private void flag_btn_clicked () {
3654 save_changes_to_source ();
3655 Flaggable? flaggable = media_source as Flaggable;

Subscribers

People subscribed via source and target branches

to all changes: