Merge lp:~meese/pantheon-photos/fix-1272573 into lp:~pantheon-photos/pantheon-photos/trunk
- fix-1272573
- Merge into trunk
Proposed by
meese
Status: | Merged |
---|---|
Approved by: | Cody Garver |
Approved revision: | 2601 |
Merged at revision: | 2604 |
Proposed branch: | lp:~meese/pantheon-photos/fix-1272573 |
Merge into: | lp:~pantheon-photos/pantheon-photos/trunk |
Diff against target: |
508 lines (+124/-223) 6 files modified
src/CollectionPage.vala (+3/-2) src/MediaPage.vala (+48/-98) src/Page.vala (+31/-6) src/PhotoPage.vala (+38/-93) ui/collection.ui (+2/-12) ui/photo_context.ui (+2/-12) |
To merge this branch: | bzr merge lp:~meese/pantheon-photos/fix-1272573 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danielle Foré | ux | Approve | |
Photos Devs | code | Pending | |
Review via email: mp+232492@code.launchpad.net |
Commit message
changes context menu rating stuff to a rating widget
Description of the change
changes context menu rating stuff to a rating widget
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/CollectionPage.vala' | |||
2 | --- src/CollectionPage.vala 2014-08-25 06:04:50 +0000 | |||
3 | +++ src/CollectionPage.vala 2014-08-28 00:04:23 +0000 | |||
4 | @@ -249,7 +249,9 @@ | |||
5 | 249 | } | 249 | } |
6 | 250 | 250 | ||
7 | 251 | populate_contractor_menu (menu, "/CollectionContextMenu/ContractorPlaceholder"); | 251 | populate_contractor_menu (menu, "/CollectionContextMenu/ContractorPlaceholder"); |
9 | 252 | 252 | populate_rating_widget_menu_item (menu, "/CollectionContextMenu/RatingWidgetPlaceholder"); | |
10 | 253 | update_rating_sensitivities (); | ||
11 | 254 | menu.show_all (); | ||
12 | 253 | return menu; | 255 | return menu; |
13 | 254 | } | 256 | } |
14 | 255 | 257 | ||
15 | @@ -496,7 +498,6 @@ | |||
16 | 496 | case "KP_End": | 498 | case "KP_End": |
17 | 497 | key_press_event (event); | 499 | key_press_event (event); |
18 | 498 | break; | 500 | break; |
19 | 499 | |||
20 | 500 | case "bracketright": | 501 | case "bracketright": |
21 | 501 | activate_action ("RotateClockwise"); | 502 | activate_action ("RotateClockwise"); |
22 | 502 | break; | 503 | break; |
23 | 503 | 504 | ||
24 | === modified file 'src/MediaPage.vala' | |||
25 | --- src/MediaPage.vala 2014-08-25 06:10:33 +0000 | |||
26 | +++ src/MediaPage.vala 2014-08-28 00:04:23 +0000 | |||
27 | @@ -333,42 +333,6 @@ | |||
28 | 333 | rate_rejected.label = Resources.rating_menu (Rating.REJECTED); | 333 | rate_rejected.label = Resources.rating_menu (Rating.REJECTED); |
29 | 334 | actions += rate_rejected; | 334 | actions += rate_rejected; |
30 | 335 | 335 | ||
31 | 336 | Gtk.ActionEntry rate_unrated = { "RateUnrated", null, TRANSLATABLE, | ||
32 | 337 | "0", TRANSLATABLE, on_rate_unrated | ||
33 | 338 | }; | ||
34 | 339 | rate_unrated.label = Resources.rating_menu (Rating.UNRATED); | ||
35 | 340 | actions += rate_unrated; | ||
36 | 341 | |||
37 | 342 | Gtk.ActionEntry rate_one = { "RateOne", null, TRANSLATABLE, | ||
38 | 343 | "1", TRANSLATABLE, on_rate_one | ||
39 | 344 | }; | ||
40 | 345 | rate_one.label = Resources.rating_menu (Rating.ONE); | ||
41 | 346 | actions += rate_one; | ||
42 | 347 | |||
43 | 348 | Gtk.ActionEntry rate_two = { "RateTwo", null, TRANSLATABLE, | ||
44 | 349 | "2", TRANSLATABLE, on_rate_two | ||
45 | 350 | }; | ||
46 | 351 | rate_two.label = Resources.rating_menu (Rating.TWO); | ||
47 | 352 | actions += rate_two; | ||
48 | 353 | |||
49 | 354 | Gtk.ActionEntry rate_three = { "RateThree", null, TRANSLATABLE, | ||
50 | 355 | "3", TRANSLATABLE, on_rate_three | ||
51 | 356 | }; | ||
52 | 357 | rate_three.label = Resources.rating_menu (Rating.THREE); | ||
53 | 358 | actions += rate_three; | ||
54 | 359 | |||
55 | 360 | Gtk.ActionEntry rate_four = { "RateFour", null, TRANSLATABLE, | ||
56 | 361 | "4", TRANSLATABLE, on_rate_four | ||
57 | 362 | }; | ||
58 | 363 | rate_four.label = Resources.rating_menu (Rating.FOUR); | ||
59 | 364 | actions += rate_four; | ||
60 | 365 | |||
61 | 366 | Gtk.ActionEntry rate_five = { "RateFive", null, TRANSLATABLE, | ||
62 | 367 | "5", TRANSLATABLE, on_rate_five | ||
63 | 368 | }; | ||
64 | 369 | rate_five.label = Resources.rating_menu (Rating.FIVE); | ||
65 | 370 | actions += rate_five; | ||
66 | 371 | |||
67 | 372 | Gtk.ActionEntry sort_photos = { "SortPhotos", null, TRANSLATABLE, null, null, null }; | 336 | Gtk.ActionEntry sort_photos = { "SortPhotos", null, TRANSLATABLE, null, null, null }; |
68 | 373 | sort_photos.label = _ ("Sort _Photos"); | 337 | sort_photos.label = _ ("Sort _Photos"); |
69 | 374 | actions += sort_photos; | 338 | actions += sort_photos; |
70 | @@ -523,18 +487,19 @@ | |||
71 | 523 | } | 487 | } |
72 | 524 | } | 488 | } |
73 | 525 | 489 | ||
82 | 526 | private void update_rating_sensitivities () { | 490 | protected void update_rating_sensitivities () { |
83 | 527 | set_action_sensitive ("RateRejected", can_rate_selected (Rating.REJECTED)); | 491 | if (rating_menu_item != null) { |
84 | 528 | set_action_sensitive ("RateUnrated", can_rate_selected (Rating.UNRATED)); | 492 | rating_menu_item.sensitive = can_rate_selected (); |
85 | 529 | set_action_sensitive ("RateOne", can_rate_selected (Rating.ONE)); | 493 | rating_menu_item.rating_value = Resources.int_to_rating (get_selected_rating ()); |
86 | 530 | set_action_sensitive ("RateTwo", can_rate_selected (Rating.TWO)); | 494 | } |
79 | 531 | set_action_sensitive ("RateThree", can_rate_selected (Rating.THREE)); | ||
80 | 532 | set_action_sensitive ("RateFour", can_rate_selected (Rating.FOUR)); | ||
81 | 533 | set_action_sensitive ("RateFive", can_rate_selected (Rating.FIVE)); | ||
87 | 534 | set_action_sensitive ("IncreaseRating", can_increase_selected_rating ()); | 495 | set_action_sensitive ("IncreaseRating", can_increase_selected_rating ()); |
88 | 535 | set_action_sensitive ("DecreaseRating", can_decrease_selected_rating ()); | 496 | set_action_sensitive ("DecreaseRating", can_decrease_selected_rating ()); |
89 | 536 | } | 497 | } |
90 | 537 | 498 | ||
91 | 499 | protected override void on_rating_widget_activate () { | ||
92 | 500 | on_set_rating (Resources.int_to_rating(rating_menu_item.rating_value)); | ||
93 | 501 | } | ||
94 | 502 | |||
95 | 538 | private void update_development_menu_item_sensitivity () { | 503 | private void update_development_menu_item_sensitivity () { |
96 | 539 | if (get_view ().get_selected ().size == 0) { | 504 | if (get_view ().get_selected ().size == 0) { |
97 | 540 | set_action_sensitive ("RawDeveloper", false); | 505 | set_action_sensitive ("RawDeveloper", false); |
98 | @@ -614,13 +579,22 @@ | |||
99 | 614 | action.set_active (display); | 579 | action.set_active (display); |
100 | 615 | } | 580 | } |
101 | 616 | 581 | ||
103 | 617 | private bool can_rate_selected (Rating rating) { | 582 | private bool can_rate_selected () { |
104 | 583 | return get_view ().get_selected ().size > 0; | ||
105 | 584 | } | ||
106 | 585 | |||
107 | 586 | private Rating get_selected_rating () { | ||
108 | 587 | bool init = false; | ||
109 | 588 | Rating last_rating = Rating.UNRATED; | ||
110 | 618 | foreach (DataView view in get_view ().get_selected ()) { | 589 | foreach (DataView view in get_view ().get_selected ()) { |
113 | 619 | if (((Thumbnail) view).get_media_source ().get_rating () != rating) | 590 | var rating = ((Thumbnail) view).get_media_source ().get_rating (); |
114 | 620 | return true; | 591 | if (!init) |
115 | 592 | init = true; | ||
116 | 593 | else if (last_rating != rating) | ||
117 | 594 | return Rating.UNRATED; | ||
118 | 595 | last_rating = rating; | ||
119 | 621 | } | 596 | } |
122 | 622 | 597 | return last_rating; | |
121 | 623 | return false; | ||
123 | 624 | } | 598 | } |
124 | 625 | 599 | ||
125 | 626 | private bool can_increase_selected_rating () { | 600 | private bool can_increase_selected_rating () { |
126 | @@ -702,31 +676,31 @@ | |||
127 | 702 | activate_action ("DecreaseRating"); | 676 | activate_action ("DecreaseRating"); |
128 | 703 | break; | 677 | break; |
129 | 704 | 678 | ||
155 | 705 | case "KP_1": | 679 | case "1": |
156 | 706 | activate_action ("RateOne"); | 680 | on_set_rating (Rating.ONE); |
157 | 707 | break; | 681 | break; |
158 | 708 | 682 | ||
159 | 709 | case "KP_2": | 683 | case "2": |
160 | 710 | activate_action ("RateTwo"); | 684 | on_set_rating (Rating.TWO); |
161 | 711 | break; | 685 | break; |
162 | 712 | 686 | ||
163 | 713 | case "KP_3": | 687 | case "3": |
164 | 714 | activate_action ("RateThree"); | 688 | on_set_rating (Rating.THREE); |
165 | 715 | break; | 689 | break; |
166 | 716 | 690 | ||
167 | 717 | case "KP_4": | 691 | case "4": |
168 | 718 | activate_action ("RateFour"); | 692 | on_set_rating (Rating.FOUR); |
169 | 719 | break; | 693 | break; |
170 | 720 | 694 | ||
171 | 721 | case "KP_5": | 695 | case "5": |
172 | 722 | activate_action ("RateFive"); | 696 | on_set_rating (Rating.FIVE); |
173 | 723 | break; | 697 | break; |
174 | 724 | 698 | ||
175 | 725 | case "KP_0": | 699 | case "0": |
176 | 726 | activate_action ("RateUnrated"); | 700 | on_set_rating (Rating.UNRATED); |
177 | 727 | break; | 701 | break; |
178 | 728 | 702 | ||
179 | 729 | case "KP_9": | 703 | case "9": |
180 | 730 | activate_action ("RateRejected"); | 704 | activate_action ("RateRejected"); |
181 | 731 | break; | 705 | break; |
182 | 732 | 706 | ||
183 | @@ -920,30 +894,6 @@ | |||
184 | 920 | on_set_rating (Rating.REJECTED); | 894 | on_set_rating (Rating.REJECTED); |
185 | 921 | } | 895 | } |
186 | 922 | 896 | ||
187 | 923 | protected virtual void on_rate_unrated () { | ||
188 | 924 | on_set_rating (Rating.UNRATED); | ||
189 | 925 | } | ||
190 | 926 | |||
191 | 927 | protected virtual void on_rate_one () { | ||
192 | 928 | on_set_rating (Rating.ONE); | ||
193 | 929 | } | ||
194 | 930 | |||
195 | 931 | protected virtual void on_rate_two () { | ||
196 | 932 | on_set_rating (Rating.TWO); | ||
197 | 933 | } | ||
198 | 934 | |||
199 | 935 | protected virtual void on_rate_three () { | ||
200 | 936 | on_set_rating (Rating.THREE); | ||
201 | 937 | } | ||
202 | 938 | |||
203 | 939 | protected virtual void on_rate_four () { | ||
204 | 940 | on_set_rating (Rating.FOUR); | ||
205 | 941 | } | ||
206 | 942 | |||
207 | 943 | protected virtual void on_rate_five () { | ||
208 | 944 | on_set_rating (Rating.FIVE); | ||
209 | 945 | } | ||
210 | 946 | |||
211 | 947 | private void on_remove_from_library () { | 897 | private void on_remove_from_library () { |
212 | 948 | remove_photos_from_library ((Gee.Collection<LibraryPhoto>) get_view ().get_selected_sources ()); | 898 | remove_photos_from_library ((Gee.Collection<LibraryPhoto>) get_view ().get_selected_sources ()); |
213 | 949 | } | 899 | } |
214 | 950 | 900 | ||
215 | === modified file 'src/Page.vala' | |||
216 | --- src/Page.vala 2014-08-27 03:08:01 +0000 | |||
217 | +++ src/Page.vala 2014-08-28 00:04:23 +0000 | |||
218 | @@ -53,6 +53,7 @@ | |||
219 | 53 | protected Gtk.Toolbar toolbar; | 53 | protected Gtk.Toolbar toolbar; |
220 | 54 | protected bool in_view = false; | 54 | protected bool in_view = false; |
221 | 55 | protected Gtk.ToolButton show_sidebar_button; | 55 | protected Gtk.ToolButton show_sidebar_button; |
222 | 56 | protected PhotoRatingMenuItem rating_menu_item; | ||
223 | 56 | 57 | ||
224 | 57 | private string page_name; | 58 | private string page_name; |
225 | 58 | private ViewCollection view = null; | 59 | private ViewCollection view = null; |
226 | @@ -119,11 +120,13 @@ | |||
227 | 119 | warning (e.message); | 120 | warning (e.message); |
228 | 120 | } | 121 | } |
229 | 121 | // Remove old contracts | 122 | // Remove old contracts |
231 | 122 | contractor_menu_items.foreach ((item) => { if (item != null) item.destroy (); }); | 123 | contractor_menu_items.foreach ((item) => { |
232 | 124 | if (item != null) item.destroy (); | ||
233 | 125 | }); | ||
234 | 123 | 126 | ||
235 | 124 | //find where is contractor_placeholder in the menu | 127 | //find where is contractor_placeholder in the menu |
238 | 125 | Gtk.Widget holder= ui.get_widget (placeholder_ui); | 128 | Gtk.Widget holder = ui.get_widget (placeholder_ui); |
239 | 126 | int pos=0; | 129 | int pos = 0; |
240 | 127 | foreach (Gtk.Widget w in menu.get_children ()) { | 130 | foreach (Gtk.Widget w in menu.get_children ()) { |
241 | 128 | if (w == holder) | 131 | if (w == holder) |
242 | 129 | break; | 132 | break; |
243 | @@ -141,8 +144,30 @@ | |||
244 | 141 | } | 144 | } |
245 | 142 | menu.show_all (); | 145 | menu.show_all (); |
246 | 143 | } | 146 | } |
249 | 144 | 147 | ||
250 | 145 | // This is called by the page controller when it has removed this page ... pages should override | 148 | protected void populate_rating_widget_menu_item (Gtk.Menu menu, string placeholder_ui) { |
251 | 149 | if (rating_menu_item != null) rating_menu_item.destroy (); | ||
252 | 150 | rating_menu_item = new PhotoRatingMenuItem (); | ||
253 | 151 | //find where is rating_placeholder in the menu | ||
254 | 152 | Gtk.Widget holder = ui.get_widget (placeholder_ui); | ||
255 | 153 | int pos = 0; | ||
256 | 154 | foreach (Gtk.Widget w in menu.get_children ()) { | ||
257 | 155 | if (w == holder) | ||
258 | 156 | break; | ||
259 | 157 | pos++; | ||
260 | 158 | } | ||
261 | 159 | |||
262 | 160 | menu.append (rating_menu_item); | ||
263 | 161 | menu.reorder_child (rating_menu_item, pos); | ||
264 | 162 | rating_menu_item.activate.connect (on_rating_widget_activate); | ||
265 | 163 | menu.show_all (); | ||
266 | 164 | } | ||
267 | 165 | |||
268 | 166 | protected virtual void on_rating_widget_activate () { | ||
269 | 167 | } | ||
270 | 168 | |||
271 | 169 | // This is called by the page | ||
272 | 170 | // controller when it has removed this page ... pages should override | ||
273 | 146 | // this (or the signal) to clean up | 171 | // this (or the signal) to clean up |
274 | 147 | public override void destroy () { | 172 | public override void destroy () { |
275 | 148 | if (is_destroyed) | 173 | if (is_destroyed) |
276 | @@ -370,7 +395,7 @@ | |||
277 | 370 | 395 | ||
278 | 371 | return null; | 396 | return null; |
279 | 372 | } | 397 | } |
281 | 373 | 398 | ||
282 | 374 | public void update_sidebar_action (bool show) { | 399 | public void update_sidebar_action (bool show) { |
283 | 375 | if (show_sidebar_button == null) | 400 | if (show_sidebar_button == null) |
284 | 376 | return; | 401 | return; |
285 | 377 | 402 | ||
286 | === modified file 'src/PhotoPage.vala' | |||
287 | --- src/PhotoPage.vala 2014-08-27 06:20:32 +0000 | |||
288 | +++ src/PhotoPage.vala 2014-08-28 00:04:23 +0000 | |||
289 | @@ -2595,42 +2595,6 @@ | |||
290 | 2595 | rate_rejected.label = Resources.rating_menu (Rating.REJECTED); | 2595 | rate_rejected.label = Resources.rating_menu (Rating.REJECTED); |
291 | 2596 | actions += rate_rejected; | 2596 | actions += rate_rejected; |
292 | 2597 | 2597 | ||
293 | 2598 | Gtk.ActionEntry rate_unrated = { "RateUnrated", null, TRANSLATABLE, | ||
294 | 2599 | "0", TRANSLATABLE, on_rate_unrated | ||
295 | 2600 | }; | ||
296 | 2601 | rate_unrated.label = Resources.rating_menu (Rating.UNRATED); | ||
297 | 2602 | actions += rate_unrated; | ||
298 | 2603 | |||
299 | 2604 | Gtk.ActionEntry rate_one = { "RateOne", null, TRANSLATABLE, | ||
300 | 2605 | "1", TRANSLATABLE, on_rate_one | ||
301 | 2606 | }; | ||
302 | 2607 | rate_one.label = Resources.rating_menu (Rating.ONE); | ||
303 | 2608 | actions += rate_one; | ||
304 | 2609 | |||
305 | 2610 | Gtk.ActionEntry rate_two = { "RateTwo", null, TRANSLATABLE, | ||
306 | 2611 | "2", TRANSLATABLE, on_rate_two | ||
307 | 2612 | }; | ||
308 | 2613 | rate_two.label = Resources.rating_menu (Rating.TWO); | ||
309 | 2614 | actions += rate_two; | ||
310 | 2615 | |||
311 | 2616 | Gtk.ActionEntry rate_three = { "RateThree", null, TRANSLATABLE, | ||
312 | 2617 | "3", TRANSLATABLE, on_rate_three | ||
313 | 2618 | }; | ||
314 | 2619 | rate_three.label = Resources.rating_menu (Rating.THREE); | ||
315 | 2620 | actions += rate_three; | ||
316 | 2621 | |||
317 | 2622 | Gtk.ActionEntry rate_four = { "RateFour", null, TRANSLATABLE, | ||
318 | 2623 | "4", TRANSLATABLE, on_rate_four | ||
319 | 2624 | }; | ||
320 | 2625 | rate_four.label = Resources.rating_menu (Rating.FOUR); | ||
321 | 2626 | actions += rate_four; | ||
322 | 2627 | |||
323 | 2628 | Gtk.ActionEntry rate_five = { "RateFive", null, TRANSLATABLE, | ||
324 | 2629 | "5", TRANSLATABLE, on_rate_five | ||
325 | 2630 | }; | ||
326 | 2631 | rate_five.label = Resources.rating_menu (Rating.FIVE); | ||
327 | 2632 | actions += rate_five; | ||
328 | 2633 | |||
329 | 2634 | Gtk.ActionEntry increase_size = { "IncreaseSize", Gtk.Stock.ZOOM_IN, TRANSLATABLE, | 2598 | Gtk.ActionEntry increase_size = { "IncreaseSize", Gtk.Stock.ZOOM_IN, TRANSLATABLE, |
330 | 2635 | "<Ctrl>plus", TRANSLATABLE, on_increase_size | 2599 | "<Ctrl>plus", TRANSLATABLE, on_increase_size |
331 | 2636 | }; | 2600 | }; |
332 | @@ -3004,31 +2968,31 @@ | |||
333 | 3004 | activate_action ("DecreaseRating"); | 2968 | activate_action ("DecreaseRating"); |
334 | 3005 | break; | 2969 | break; |
335 | 3006 | 2970 | ||
361 | 3007 | case "KP_1": | 2971 | case "1": |
362 | 3008 | activate_action ("RateOne"); | 2972 | on_set_rating (Rating.ONE); |
363 | 3009 | break; | 2973 | break; |
364 | 3010 | 2974 | ||
365 | 3011 | case "KP_2": | 2975 | case "2": |
366 | 3012 | activate_action ("RateTwo"); | 2976 | on_set_rating (Rating.TWO); |
367 | 3013 | break; | 2977 | break; |
368 | 3014 | 2978 | ||
369 | 3015 | case "KP_3": | 2979 | case "3": |
370 | 3016 | activate_action ("RateThree"); | 2980 | on_set_rating (Rating.THREE); |
371 | 3017 | break; | 2981 | break; |
372 | 3018 | 2982 | ||
373 | 3019 | case "KP_4": | 2983 | case "4": |
374 | 3020 | activate_action ("RateFour"); | 2984 | on_set_rating (Rating.FOUR); |
375 | 3021 | break; | 2985 | break; |
376 | 3022 | 2986 | ||
377 | 3023 | case "KP_5": | 2987 | case "5": |
378 | 3024 | activate_action ("RateFive"); | 2988 | on_set_rating (Rating.FIVE); |
379 | 3025 | break; | 2989 | break; |
380 | 3026 | 2990 | ||
381 | 3027 | case "KP_0": | 2991 | case "0": |
382 | 3028 | activate_action ("RateUnrated"); | 2992 | on_set_rating (Rating.UNRATED); |
383 | 3029 | break; | 2993 | break; |
384 | 3030 | 2994 | ||
385 | 3031 | case "KP_9": | 2995 | case "9": |
386 | 3032 | activate_action ("RateRejected"); | 2996 | activate_action ("RateRejected"); |
387 | 3033 | break; | 2997 | break; |
388 | 3034 | 2998 | ||
389 | @@ -3090,6 +3054,9 @@ | |||
390 | 3090 | } | 3054 | } |
391 | 3091 | 3055 | ||
392 | 3092 | populate_contractor_menu (menu, "/PhotoContextMenu/ContractorPlaceholder"); | 3056 | populate_contractor_menu (menu, "/PhotoContextMenu/ContractorPlaceholder"); |
393 | 3057 | populate_rating_widget_menu_item (menu, "/PhotoContextMenu/RatingWidgetPlaceholder"); | ||
394 | 3058 | update_rating_menu_item_sensitivity (); | ||
395 | 3059 | menu.show_all (); | ||
396 | 3093 | return menu; | 3060 | return menu; |
397 | 3094 | } | 3061 | } |
398 | 3095 | 3062 | ||
399 | @@ -3320,6 +3287,10 @@ | |||
400 | 3320 | 3287 | ||
401 | 3321 | update_rating_menu_item_sensitivity (); | 3288 | update_rating_menu_item_sensitivity (); |
402 | 3322 | } | 3289 | } |
403 | 3290 | |||
404 | 3291 | protected virtual void on_rate_rejected () { | ||
405 | 3292 | on_set_rating (Rating.REJECTED); | ||
406 | 3293 | } | ||
407 | 3323 | 3294 | ||
408 | 3324 | private void on_set_rating (Rating rating) { | 3295 | private void on_set_rating (Rating rating) { |
409 | 3325 | if (!has_photo () || get_photo_missing ()) | 3296 | if (!has_photo () || get_photo_missing ()) |
410 | @@ -3331,42 +3302,16 @@ | |||
411 | 3331 | update_rating_menu_item_sensitivity (); | 3302 | update_rating_menu_item_sensitivity (); |
412 | 3332 | } | 3303 | } |
413 | 3333 | 3304 | ||
440 | 3334 | private void on_rate_rejected () { | 3305 | protected override void on_rating_widget_activate () { |
441 | 3335 | on_set_rating (Rating.REJECTED); | 3306 | on_set_rating (Resources.int_to_rating(rating_menu_item.rating_value)); |
416 | 3336 | } | ||
417 | 3337 | |||
418 | 3338 | private void on_rate_unrated () { | ||
419 | 3339 | on_set_rating (Rating.UNRATED); | ||
420 | 3340 | } | ||
421 | 3341 | |||
422 | 3342 | private void on_rate_one () { | ||
423 | 3343 | on_set_rating (Rating.ONE); | ||
424 | 3344 | } | ||
425 | 3345 | |||
426 | 3346 | private void on_rate_two () { | ||
427 | 3347 | on_set_rating (Rating.TWO); | ||
428 | 3348 | } | ||
429 | 3349 | |||
430 | 3350 | private void on_rate_three () { | ||
431 | 3351 | on_set_rating (Rating.THREE); | ||
432 | 3352 | } | ||
433 | 3353 | |||
434 | 3354 | private void on_rate_four () { | ||
435 | 3355 | on_set_rating (Rating.FOUR); | ||
436 | 3356 | } | ||
437 | 3357 | |||
438 | 3358 | private void on_rate_five () { | ||
439 | 3359 | on_set_rating (Rating.FIVE); | ||
442 | 3360 | } | 3307 | } |
443 | 3361 | 3308 | ||
444 | 3362 | private void update_rating_menu_item_sensitivity () { | 3309 | private void update_rating_menu_item_sensitivity () { |
445 | 3363 | set_action_sensitive ("RateRejected", get_photo ().get_rating () != Rating.REJECTED); | 3310 | set_action_sensitive ("RateRejected", get_photo ().get_rating () != Rating.REJECTED); |
452 | 3364 | set_action_sensitive ("RateUnrated", get_photo ().get_rating () != Rating.UNRATED); | 3311 | if (rating_menu_item != null) { |
453 | 3365 | set_action_sensitive ("RateOne", get_photo ().get_rating () != Rating.ONE); | 3312 | rating_menu_item.sensitive = (get_photo () != null); |
454 | 3366 | set_action_sensitive ("RateTwo", get_photo ().get_rating () != Rating.TWO); | 3313 | rating_menu_item.rating_value = get_photo ().get_rating (); |
455 | 3367 | set_action_sensitive ("RateThree", get_photo ().get_rating () != Rating.THREE); | 3314 | } |
450 | 3368 | set_action_sensitive ("RateFour", get_photo ().get_rating () != Rating.FOUR); | ||
451 | 3369 | set_action_sensitive ("RateFive", get_photo ().get_rating () != Rating.FIVE); | ||
456 | 3370 | set_action_sensitive ("IncreaseRating", get_photo ().get_rating ().can_increase ()); | 3315 | set_action_sensitive ("IncreaseRating", get_photo ().get_rating ().can_increase ()); |
457 | 3371 | set_action_sensitive ("DecreaseRating", get_photo ().get_rating ().can_decrease ()); | 3316 | set_action_sensitive ("DecreaseRating", get_photo ().get_rating ().can_decrease ()); |
458 | 3372 | } | 3317 | } |
459 | 3373 | 3318 | ||
460 | === modified file 'ui/collection.ui' | |||
461 | --- ui/collection.ui 2014-08-25 06:04:50 +0000 | |||
462 | +++ ui/collection.ui 2014-08-28 00:04:23 +0000 | |||
463 | @@ -11,18 +11,8 @@ | |||
464 | 11 | <placeholder name="ContextFacesPlaceholder" /> | 11 | <placeholder name="ContextFacesPlaceholder" /> |
465 | 12 | <separator /> | 12 | <separator /> |
466 | 13 | <menuitem name="ContextFlag" action="Flag" /> | 13 | <menuitem name="ContextFlag" action="Flag" /> |
479 | 14 | <menu name="Rate" action="Rate"> | 14 | <menuitem name="RateRejected" action="RateRejected" /> |
480 | 15 | <menuitem name="RateFive" action="RateFive" /> | 15 | <placeholder name="RatingWidgetPlaceholder" /> |
469 | 16 | <menuitem name="RateFour" action="RateFour" /> | ||
470 | 17 | <menuitem name="RateThree" action="RateThree" /> | ||
471 | 18 | <menuitem name="RateTwo" action="RateTwo" /> | ||
472 | 19 | <menuitem name="RateOne" action="RateOne" /> | ||
473 | 20 | <menuitem name="RateUnrated" action="RateUnrated" /> | ||
474 | 21 | <menuitem name="RateRejected" action="RateRejected" /> | ||
475 | 22 | <separator /> | ||
476 | 23 | <menuitem name="IncreaseRating" action="IncreaseRating" /> | ||
477 | 24 | <menuitem name="DecreaseRating" action="DecreaseRating" /> | ||
478 | 25 | </menu> | ||
481 | 26 | <menu name="RawDeveloper" action="RawDeveloper"> | 16 | <menu name="RawDeveloper" action="RawDeveloper"> |
482 | 27 | <menuitem name="RawDeveloperShotwell" action="RawDeveloperShotwell" /> | 17 | <menuitem name="RawDeveloperShotwell" action="RawDeveloperShotwell" /> |
483 | 28 | <menuitem name="RawDeveloperCamera" action="RawDeveloperCamera" /> | 18 | <menuitem name="RawDeveloperCamera" action="RawDeveloperCamera" /> |
484 | 29 | 19 | ||
485 | === modified file 'ui/photo_context.ui' | |||
486 | --- ui/photo_context.ui 2014-08-25 06:04:50 +0000 | |||
487 | +++ ui/photo_context.ui 2014-08-28 00:04:23 +0000 | |||
488 | @@ -9,18 +9,8 @@ | |||
489 | 9 | <menuitem name="ContextPasteColorAdjustments" action="PasteColorAdjustments" /> | 9 | <menuitem name="ContextPasteColorAdjustments" action="PasteColorAdjustments" /> |
490 | 10 | <separator /> | 10 | <separator /> |
491 | 11 | <menuitem name="ContextFlag" action="Flag" /> | 11 | <menuitem name="ContextFlag" action="Flag" /> |
504 | 12 | <menu name="Rate" action="Rate"> | 12 | <menuitem name="RateRejected" action="RateRejected" /> |
505 | 13 | <menuitem name="RateFive" action="RateFive" /> | 13 | <placeholder name="RatingWidgetPlaceholder" /> |
494 | 14 | <menuitem name="RateFour" action="RateFour" /> | ||
495 | 15 | <menuitem name="RateThree" action="RateThree" /> | ||
496 | 16 | <menuitem name="RateTwo" action="RateTwo" /> | ||
497 | 17 | <menuitem name="RateOne" action="RateOne" /> | ||
498 | 18 | <menuitem name="RateUnrated" action="RateUnrated" /> | ||
499 | 19 | <menuitem name="RateRejected" action="RateRejected" /> | ||
500 | 20 | <separator /> | ||
501 | 21 | <menuitem name="IncreaseRating" action="IncreaseRating" /> | ||
502 | 22 | <menuitem name="DecreaseRating" action="DecreaseRating" /> | ||
503 | 23 | </menu> | ||
506 | 24 | <menu name="RawDeveloper" action="RawDeveloper"> | 14 | <menu name="RawDeveloper" action="RawDeveloper"> |
507 | 25 | <menuitem name="RawDeveloperShotwell" action="RawDeveloperShotwell" /> | 15 | <menuitem name="RawDeveloperShotwell" action="RawDeveloperShotwell" /> |
508 | 26 | <menuitem name="RawDeveloperCamera" action="RawDeveloperCamera" /> | 16 | <menuitem name="RawDeveloperCamera" action="RawDeveloperCamera" /> |
I can confirm that it does what it's supposed to do :)