Merge lp:~tintou/pantheon-photos/saved-search-hardcoded into lp:~pantheon-photos/pantheon-photos/trunk
- saved-search-hardcoded
- Merge into trunk
Proposed by
Corentin Noël
Status: | Merged |
---|---|
Approved by: | Danielle Foré |
Approved revision: | 2526 |
Merged at revision: | 2533 |
Proposed branch: | lp:~tintou/pantheon-photos/saved-search-hardcoded |
Merge into: | lp:~pantheon-photos/pantheon-photos/trunk |
Diff against target: |
629 lines (+94/-323) 7 files modified
src/Dialogs.vala (+1/-1) src/Resources.vala (+2/-2) src/library/LibraryWindow.vala (+1/-1) src/searches/Branch.vala (+6/-6) src/searches/SavedSearchDialog.vala (+83/-114) src/sidebar/Tree.vala (+1/-1) ui/shotwell.glade (+0/-198) |
To merge this branch: | bzr merge lp:~tintou/pantheon-photos/saved-search-hardcoded |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Danielle Foré | Approve | ||
Victor Martinez (community) | Approve | ||
Review via email: mp+221114@code.launchpad.net |
Commit message
* Port SavedSearch dialog from xml to vala
* Change "Saved Search" to "Smart Album"
* Use Granite DatePicker
Description of the change
Ported SavedSearch Dialog to hardcoded.
To post a comment you must log in.
- 2524. By Corentin Noël
-
Fixed code style.
- 2525. By Corentin Noël
-
Renamed "Saved Search" to "Smart Album".
Revision history for this message
Danielle Foré (danrabbit) wrote : | # |
The context menu for the source list still says "New Saved Search..."
review:
Needs Fixing
- 2526. By Corentin Noël
-
Fixed Context Menu label.
Revision history for this message
Danielle Foré (danrabbit) wrote : | # |
Looks good to me :)
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/Dialogs.vala' | |||
2 | --- src/Dialogs.vala 2014-06-11 05:26:59 +0000 | |||
3 | +++ src/Dialogs.vala 2014-06-23 18:22:30 +0000 | |||
4 | @@ -22,7 +22,7 @@ | |||
5 | 22 | } | 22 | } |
6 | 23 | 23 | ||
7 | 24 | public bool confirm_delete_saved_search(SavedSearch search) { | 24 | public bool confirm_delete_saved_search(SavedSearch search) { |
9 | 25 | string msg = _("This will remove the saved search \"%s\". Continue?") | 25 | string msg = _("This will remove the smart album \"%s\". Continue?") |
10 | 26 | .printf(search.get_name()); | 26 | .printf(search.get_name()); |
11 | 27 | 27 | ||
12 | 28 | return AppWindow.negate_affirm_question(msg, _("_Cancel"), _("_Delete"), | 28 | return AppWindow.negate_affirm_question(msg, _("_Cancel"), _("_Delete"), |
13 | 29 | 29 | ||
14 | === modified file 'src/Resources.vala' | |||
15 | --- src/Resources.vala 2014-06-22 15:06:34 +0000 | |||
16 | +++ src/Resources.vala 2014-06-23 18:22:30 +0000 | |||
17 | @@ -362,9 +362,9 @@ | |||
18 | 362 | return _("Unable to rename search to \"%s\" because the search already exists.").printf(name); | 362 | return _("Unable to rename search to \"%s\" because the search already exists.").printf(name); |
19 | 363 | } | 363 | } |
20 | 364 | 364 | ||
22 | 365 | public const string DEFAULT_SAVED_SEARCH_NAME = _("Saved Search"); | 365 | public const string DEFAULT_SAVED_SEARCH_NAME = _("Smart Album"); |
23 | 366 | 366 | ||
25 | 367 | public const string DELETE_SAVED_SEARCH_DIALOG_TITLE = _("Delete Search"); | 367 | public const string DELETE_SAVED_SEARCH_DIALOG_TITLE = _("Delete Album"); |
26 | 368 | 368 | ||
27 | 369 | public const string DELETE_SEARCH_MENU = _("_Delete"); | 369 | public const string DELETE_SEARCH_MENU = _("_Delete"); |
28 | 370 | public const string EDIT_SEARCH_MENU = _("_Edit..."); | 370 | public const string EDIT_SEARCH_MENU = _("_Edit..."); |
29 | 371 | 371 | ||
30 | === modified file 'src/library/LibraryWindow.vala' | |||
31 | --- src/library/LibraryWindow.vala 2014-06-22 06:40:38 +0000 | |||
32 | +++ src/library/LibraryWindow.vala 2014-06-23 18:22:30 +0000 | |||
33 | @@ -339,7 +339,7 @@ | |||
34 | 339 | 339 | ||
35 | 340 | Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, "<Ctrl>S", null, | 340 | Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, "<Ctrl>S", null, |
36 | 341 | on_new_search }; | 341 | on_new_search }; |
38 | 342 | new_search.label = _("Ne_w Saved Search..."); | 342 | new_search.label = _("New Smart Album…"); |
39 | 343 | actions += new_search; | 343 | actions += new_search; |
40 | 344 | 344 | ||
41 | 345 | // top-level menus | 345 | // top-level menus |
42 | 346 | 346 | ||
43 | === modified file 'src/searches/Branch.vala' | |||
44 | --- src/searches/Branch.vala 2013-01-21 21:16:09 +0000 | |||
45 | +++ src/searches/Branch.vala 2014-06-23 18:22:30 +0000 | |||
46 | @@ -42,14 +42,14 @@ | |||
47 | 42 | } | 42 | } |
48 | 43 | 43 | ||
49 | 44 | private void on_saved_search_added(SavedSearch search) { | 44 | private void on_saved_search_added(SavedSearch search) { |
51 | 45 | debug("search added"); | 45 | debug("smart album added"); |
52 | 46 | Searches.SidebarEntry entry = new Searches.SidebarEntry(search); | 46 | Searches.SidebarEntry entry = new Searches.SidebarEntry(search); |
53 | 47 | entry_map.set(search, entry); | 47 | entry_map.set(search, entry); |
54 | 48 | graft(get_root(), entry); | 48 | graft(get_root(), entry); |
55 | 49 | } | 49 | } |
56 | 50 | 50 | ||
57 | 51 | private void on_saved_search_removed(SavedSearch search) { | 51 | private void on_saved_search_removed(SavedSearch search) { |
59 | 52 | debug("search removed"); | 52 | debug("smart album removed"); |
60 | 53 | Searches.SidebarEntry? entry = entry_map.get(search); | 53 | Searches.SidebarEntry? entry = entry_map.get(search); |
61 | 54 | assert(entry != null); | 54 | assert(entry != null); |
62 | 55 | 55 | ||
63 | @@ -65,7 +65,7 @@ | |||
64 | 65 | private Gtk.Menu? context_menu = null; | 65 | private Gtk.Menu? context_menu = null; |
65 | 66 | 66 | ||
66 | 67 | public Grouping() { | 67 | public Grouping() { |
68 | 68 | base (_("Saved Searches"), new ThemedIcon(Gtk.Stock.FIND)); | 68 | base (_("Smart Albums"), new ThemedIcon("playlist-automatic")); |
69 | 69 | setup_context_menu(); | 69 | setup_context_menu(); |
70 | 70 | } | 70 | } |
71 | 71 | 71 | ||
72 | @@ -74,7 +74,7 @@ | |||
73 | 74 | Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0]; | 74 | Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0]; |
74 | 75 | 75 | ||
75 | 76 | Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, null, null, on_new_search }; | 76 | Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, null, null, on_new_search }; |
77 | 77 | new_search.label = _("Ne_w Saved Search..."); | 77 | new_search.label = _("New Smart Album…"); |
78 | 78 | actions += new_search; | 78 | actions += new_search; |
79 | 79 | 79 | ||
80 | 80 | group.add_actions(actions, this); | 80 | group.add_actions(actions, this); |
81 | @@ -113,7 +113,7 @@ | |||
82 | 113 | } | 113 | } |
83 | 114 | 114 | ||
84 | 115 | internal static void init() { | 115 | internal static void init() { |
86 | 116 | single_search_icon = new ThemedIcon(Gtk.Stock.FIND); | 116 | single_search_icon = new ThemedIcon("playlist-automatic"); |
87 | 117 | } | 117 | } |
88 | 118 | 118 | ||
89 | 119 | internal static void terminate() { | 119 | internal static void terminate() { |
90 | @@ -147,4 +147,4 @@ | |||
91 | 147 | if (Dialogs.confirm_delete_saved_search(search)) | 147 | if (Dialogs.confirm_delete_saved_search(search)) |
92 | 148 | AppWindow.get_command_manager().execute(new DeleteSavedSearchCommand(search)); | 148 | AppWindow.get_command_manager().execute(new DeleteSavedSearchCommand(search)); |
93 | 149 | } | 149 | } |
95 | 150 | } | 150 | } |
96 | 151 | \ No newline at end of file | 151 | \ No newline at end of file |
97 | 152 | 152 | ||
98 | === modified file 'src/searches/SavedSearchDialog.vala' | |||
99 | --- src/searches/SavedSearchDialog.vala 2013-08-27 21:53:39 +0000 | |||
100 | +++ src/searches/SavedSearchDialog.vala 2014-06-23 18:22:30 +0000 | |||
101 | @@ -48,12 +48,11 @@ | |||
102 | 48 | set_type_combo_box(SearchCondition.SearchType.ANY_TEXT); // Sets default. | 48 | set_type_combo_box(SearchCondition.SearchType.ANY_TEXT); // Sets default. |
103 | 49 | type_combo.changed.connect(on_type_changed); | 49 | type_combo.changed.connect(on_type_changed); |
104 | 50 | 50 | ||
107 | 51 | remove_button = new Gtk.Button(); | 51 | remove_button = new Gtk.Button.from_icon_name("list-remove-symbolic", Gtk.IconSize.BUTTON); |
106 | 52 | remove_button.set_label(" – "); | ||
108 | 53 | remove_button.button_press_event.connect(on_removed); | 52 | remove_button.button_press_event.connect(on_removed); |
109 | 54 | 53 | ||
110 | 55 | align = new Gtk.Alignment(0,0,0,0); | 54 | align = new Gtk.Alignment(0,0,0,0); |
112 | 56 | 55 | ||
113 | 57 | box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 8); | 56 | box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 8); |
114 | 58 | box.pack_start(type_combo, false, false, 0); | 57 | box.pack_start(type_combo, false, false, 0); |
115 | 59 | box.pack_start(align, false, false, 0); | 58 | box.pack_start(align, false, false, 0); |
116 | @@ -481,10 +480,8 @@ | |||
117 | 481 | private const string DATE_FORMAT = "%x"; | 480 | private const string DATE_FORMAT = "%x"; |
118 | 482 | private Gtk.Box box; | 481 | private Gtk.Box box; |
119 | 483 | private Gtk.ComboBoxText context; | 482 | private Gtk.ComboBoxText context; |
124 | 484 | private Gtk.Button label_one; | 483 | private Granite.Widgets.DatePicker datepicker_one; |
125 | 485 | private Gtk.Button label_two; | 484 | private Granite.Widgets.DatePicker datepicker_two; |
122 | 486 | private Gtk.Calendar cal_one; | ||
123 | 487 | private Gtk.Calendar cal_two; | ||
126 | 488 | private Gtk.Label and; | 485 | private Gtk.Label and; |
127 | 489 | 486 | ||
128 | 490 | private SearchRowContainer parent; | 487 | private SearchRowContainer parent; |
129 | @@ -502,82 +499,53 @@ | |||
130 | 502 | context.set_active(0); | 499 | context.set_active(0); |
131 | 503 | context.changed.connect(on_changed); | 500 | context.changed.connect(on_changed); |
132 | 504 | 501 | ||
140 | 505 | cal_one = new Gtk.Calendar(); | 502 | datepicker_one = new Granite.Widgets.DatePicker(); |
141 | 506 | cal_two = new Gtk.Calendar(); | 503 | datepicker_two = new Granite.Widgets.DatePicker(); |
135 | 507 | |||
136 | 508 | label_one = new Gtk.Button(); | ||
137 | 509 | label_one.clicked.connect(on_one_clicked); | ||
138 | 510 | label_two = new Gtk.Button(); | ||
139 | 511 | label_two.clicked.connect(on_two_clicked); | ||
142 | 512 | 504 | ||
143 | 513 | and = new Gtk.Label(_("and")); | 505 | and = new Gtk.Label(_("and")); |
144 | 514 | 506 | ||
145 | 515 | box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 8); | 507 | box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 8); |
146 | 516 | box.pack_start(context, false, false, 0); | 508 | box.pack_start(context, false, false, 0); |
148 | 517 | box.pack_start(label_one, false, false, 0); | 509 | box.pack_start(datepicker_one, false, false, 0); |
149 | 518 | box.pack_start(and, false, false, 0); | 510 | box.pack_start(and, false, false, 0); |
151 | 519 | box.pack_start(label_two, false, false, 0); | 511 | box.pack_start(datepicker_two, false, false, 0); |
152 | 520 | 512 | ||
153 | 521 | box.show_all(); | 513 | box.show_all(); |
155 | 522 | update_date_labels(); | 514 | update_datepickers(); |
156 | 523 | } | 515 | } |
157 | 524 | 516 | ||
158 | 525 | ~SearchRowRating() { | 517 | ~SearchRowRating() { |
159 | 526 | context.changed.disconnect(on_changed); | 518 | context.changed.disconnect(on_changed); |
160 | 527 | } | 519 | } |
161 | 528 | 520 | ||
164 | 529 | private void update_date_labels() { | 521 | private void update_datepickers() { |
165 | 530 | SearchConditionDate.Context c = (SearchConditionDate.Context) context.get_active(); | 522 | SearchConditionDate.Context c = (SearchConditionDate.Context)context.get_active(); |
166 | 531 | 523 | ||
167 | 532 | // Only show "and" and 2nd date label for between mode. | 524 | // Only show "and" and 2nd date label for between mode. |
168 | 533 | if (c == SearchConditionDate.Context.BETWEEN) { | 525 | if (c == SearchConditionDate.Context.BETWEEN) { |
170 | 534 | label_one.show(); | 526 | datepicker_one.show(); |
171 | 535 | and.show(); | 527 | and.show(); |
173 | 536 | label_two.show(); | 528 | datepicker_two.show(); |
174 | 537 | } else if (c == SearchConditionDate.Context.IS_NOT_SET) { | 529 | } else if (c == SearchConditionDate.Context.IS_NOT_SET) { |
176 | 538 | label_one.hide(); | 530 | datepicker_one.hide(); |
177 | 539 | and.hide(); | 531 | and.hide(); |
179 | 540 | label_two.hide(); | 532 | datepicker_two.hide(); |
180 | 541 | } else { | 533 | } else { |
182 | 542 | label_one.show(); | 534 | datepicker_one.show(); |
183 | 543 | and.hide(); | 535 | and.hide(); |
185 | 544 | label_two.hide(); | 536 | datepicker_two.hide(); |
186 | 545 | } | 537 | } |
187 | 546 | |||
188 | 547 | // Set label text to date. | ||
189 | 548 | label_one.label = get_date_one().format(DATE_FORMAT); | ||
190 | 549 | label_two.label = get_date_two().format(DATE_FORMAT);; | ||
191 | 550 | } | 538 | } |
192 | 551 | 539 | ||
193 | 552 | public override Gtk.Widget get_widget() { | 540 | public override Gtk.Widget get_widget() { |
194 | 553 | return box; | 541 | return box; |
195 | 554 | } | 542 | } |
196 | 555 | 543 | ||
197 | 556 | private DateTime get_date_one() { | ||
198 | 557 | return new DateTime.local(cal_one.year, cal_one.month + 1, cal_one.day, 0, 0, 0.0); | ||
199 | 558 | } | ||
200 | 559 | |||
201 | 560 | private DateTime get_date_two() { | ||
202 | 561 | return new DateTime.local(cal_two.year, cal_two.month + 1, cal_two.day, 0, 0, 0.0); | ||
203 | 562 | } | ||
204 | 563 | |||
205 | 564 | private void set_date_one(DateTime date) { | ||
206 | 565 | cal_one.day = date.get_day_of_month(); | ||
207 | 566 | cal_one.month = date.get_month() - 1; | ||
208 | 567 | cal_one.year = date.get_year(); | ||
209 | 568 | } | ||
210 | 569 | |||
211 | 570 | private void set_date_two(DateTime date) { | ||
212 | 571 | cal_two.day = date.get_day_of_month(); | ||
213 | 572 | cal_two.month = date.get_month() - 1; | ||
214 | 573 | cal_two.year = date.get_year(); | ||
215 | 574 | } | ||
216 | 575 | |||
217 | 576 | public override SearchCondition get_search_condition() { | 544 | public override SearchCondition get_search_condition() { |
218 | 577 | SearchCondition.SearchType search_type = parent.get_search_type(); | 545 | SearchCondition.SearchType search_type = parent.get_search_type(); |
219 | 578 | SearchConditionDate.Context search_context = (SearchConditionDate.Context) context.get_active(); | 546 | SearchConditionDate.Context search_context = (SearchConditionDate.Context) context.get_active(); |
222 | 579 | SearchConditionDate c = new SearchConditionDate(search_type, search_context, get_date_one(), | 547 | SearchConditionDate c = new SearchConditionDate(search_type, search_context, datepicker_one.date, |
223 | 580 | get_date_two()); | 548 | datepicker_two.date); |
224 | 581 | return c; | 549 | return c; |
225 | 582 | } | 550 | } |
226 | 583 | 551 | ||
227 | @@ -585,9 +553,9 @@ | |||
228 | 585 | SearchConditionDate? cond = sc as SearchConditionDate; | 553 | SearchConditionDate? cond = sc as SearchConditionDate; |
229 | 586 | assert(cond != null); | 554 | assert(cond != null); |
230 | 587 | context.set_active(cond.context); | 555 | context.set_active(cond.context); |
234 | 588 | set_date_one(cond.date_one); | 556 | datepicker_one.date = cond.date_one; |
235 | 589 | set_date_two(cond.date_two); | 557 | datepicker_two.date = cond.date_two; |
236 | 590 | update_date_labels(); | 558 | update_datepickers(); |
237 | 591 | } | 559 | } |
238 | 592 | 560 | ||
239 | 593 | public override bool is_complete() { | 561 | public override bool is_complete() { |
240 | @@ -596,50 +564,14 @@ | |||
241 | 596 | 564 | ||
242 | 597 | private void on_changed() { | 565 | private void on_changed() { |
243 | 598 | parent.changed(parent); | 566 | parent.changed(parent); |
280 | 599 | update_date_labels(); | 567 | update_datepickers(); |
245 | 600 | } | ||
246 | 601 | |||
247 | 602 | private void popup_calendar(Gtk.Calendar cal) { | ||
248 | 603 | int orig_day = cal.day; | ||
249 | 604 | int orig_month = cal.month; | ||
250 | 605 | int orig_year = cal.year; | ||
251 | 606 | Gtk.Dialog d = new Gtk.Dialog.with_buttons(null, null, | ||
252 | 607 | Gtk.DialogFlags.MODAL, Gtk.Stock.CANCEL, Gtk.ResponseType.REJECT, | ||
253 | 608 | Gtk.Stock.OK, Gtk.ResponseType.ACCEPT); | ||
254 | 609 | d.set_modal(true); | ||
255 | 610 | d.set_resizable(false); | ||
256 | 611 | d.set_decorated(false); | ||
257 | 612 | ((Gtk.Box) d.get_content_area()).add(cal); | ||
258 | 613 | ulong id_1 = cal.day_selected.connect(()=>{update_date_labels();}); | ||
259 | 614 | ulong id_2 = cal.day_selected_double_click.connect(()=>{d.close();}); | ||
260 | 615 | d.show_all(); | ||
261 | 616 | int res = d.run(); | ||
262 | 617 | if (res != Gtk.ResponseType.ACCEPT) { | ||
263 | 618 | // User hit cancel, restore original date. | ||
264 | 619 | cal.day = orig_day; | ||
265 | 620 | cal.month = orig_month; | ||
266 | 621 | cal.year = orig_year; | ||
267 | 622 | } | ||
268 | 623 | cal.disconnect(id_1); | ||
269 | 624 | cal.disconnect(id_2); | ||
270 | 625 | d.destroy(); | ||
271 | 626 | update_date_labels(); | ||
272 | 627 | } | ||
273 | 628 | |||
274 | 629 | private void on_one_clicked() { | ||
275 | 630 | popup_calendar(cal_one); | ||
276 | 631 | } | ||
277 | 632 | |||
278 | 633 | private void on_two_clicked() { | ||
279 | 634 | popup_calendar(cal_two); | ||
281 | 635 | } | 568 | } |
282 | 636 | } | 569 | } |
283 | 637 | 570 | ||
284 | 638 | private Gtk.Builder builder; | ||
285 | 639 | private Gtk.Dialog dialog; | 571 | private Gtk.Dialog dialog; |
286 | 640 | private Gtk.Button add_criteria; | 572 | private Gtk.Button add_criteria; |
287 | 641 | private Gtk.ComboBoxText operator; | 573 | private Gtk.ComboBoxText operator; |
289 | 642 | private Gtk.Box row_box; | 574 | private Gtk.Grid row_box; |
290 | 643 | private Gtk.Entry search_title; | 575 | private Gtk.Entry search_title; |
291 | 644 | private Gee.ArrayList<SearchRowContainer> row_list = new Gee.ArrayList<SearchRowContainer>(); | 576 | private Gee.ArrayList<SearchRowContainer> row_list = new Gee.ArrayList<SearchRowContainer>(); |
292 | 645 | private bool edit_mode = false; | 577 | private bool edit_mode = false; |
293 | @@ -658,8 +590,8 @@ | |||
294 | 658 | row_list.get(0).allow_removal(false); | 590 | row_list.get(0).allow_removal(false); |
295 | 659 | 591 | ||
296 | 660 | // Add buttons for new search. | 592 | // Add buttons for new search. |
299 | 661 | dialog.add_action_widget(new Gtk.Button.from_stock(Gtk.Stock.CANCEL), Gtk.ResponseType.CANCEL); | 593 | dialog.add_action_widget(new Gtk.Button.with_label(_("Cancel")), Gtk.ResponseType.CANCEL); |
300 | 662 | Gtk.Button ok_button = new Gtk.Button.from_stock(Gtk.Stock.OK); | 594 | Gtk.Button ok_button = new Gtk.Button.with_label(_("Add")); |
301 | 663 | ok_button.can_default = true; | 595 | ok_button.can_default = true; |
302 | 664 | dialog.add_action_widget(ok_button, Gtk.ResponseType.OK); | 596 | dialog.add_action_widget(ok_button, Gtk.ResponseType.OK); |
303 | 665 | dialog.set_default_response(Gtk.ResponseType.OK); | 597 | dialog.set_default_response(Gtk.ResponseType.OK); |
304 | @@ -674,7 +606,7 @@ | |||
305 | 674 | setup_dialog(); | 606 | setup_dialog(); |
306 | 675 | 607 | ||
307 | 676 | // Add close button. | 608 | // Add close button. |
309 | 677 | Gtk.Button close_button = new Gtk.Button.from_stock(Gtk.Stock.CLOSE); | 609 | Gtk.Button close_button = new Gtk.Button.with_label(_("Save")); |
310 | 678 | close_button.can_default = true; | 610 | close_button.can_default = true; |
311 | 679 | dialog.add_action_widget(close_button, Gtk.ResponseType.OK); | 611 | dialog.add_action_widget(close_button, Gtk.ResponseType.OK); |
312 | 680 | dialog.set_default_response(Gtk.ResponseType.OK); | 612 | dialog.set_default_response(Gtk.ResponseType.OK); |
313 | @@ -697,32 +629,69 @@ | |||
314 | 697 | ~SavedSearchDialog() { | 629 | ~SavedSearchDialog() { |
315 | 698 | search_title.changed.disconnect(on_title_changed); | 630 | search_title.changed.disconnect(on_title_changed); |
316 | 699 | } | 631 | } |
318 | 700 | 632 | ||
319 | 701 | // Builds the dialog UI. Doesn't add buttons to the dialog or call dialog.show(). | 633 | // Builds the dialog UI. Doesn't add buttons to the dialog or call dialog.show(). |
320 | 702 | private void setup_dialog() { | 634 | private void setup_dialog() { |
326 | 703 | builder = AppWindow.create_builder(); | 635 | dialog = new Gtk.Dialog(); |
327 | 704 | 636 | dialog.title = _("Smart Album"); | |
328 | 705 | dialog = builder.get_object("Search criteria") as Gtk.Dialog; | 637 | dialog.modal = true; |
329 | 706 | dialog.set_parent_window(AppWindow.get_instance().get_parent_window()); | 638 | dialog.transient_for= AppWindow.get_instance(); |
325 | 707 | dialog.set_transient_for(AppWindow.get_instance()); | ||
330 | 708 | dialog.response.connect(on_response); | 639 | dialog.response.connect(on_response); |
337 | 709 | 640 | ||
338 | 710 | add_criteria = builder.get_object("Add search button") as Gtk.Button; | 641 | add_criteria = new Gtk.Button.from_icon_name("list-add-symbolic", Gtk.IconSize.BUTTON); |
339 | 711 | add_criteria.button_press_event.connect(on_add_criteria); | 642 | add_criteria.button_press_event.connect (on_add_criteria); |
340 | 712 | 643 | ||
341 | 713 | search_title = builder.get_object("Search title") as Gtk.Entry; | 644 | Gtk.Label search_label = new Gtk.Label("Name:"); |
342 | 714 | search_title.set_activates_default(true); | 645 | |
343 | 646 | search_title = new Gtk.Entry(); | ||
344 | 647 | search_title.activates_default = true; | ||
345 | 648 | search_title.hexpand = true; | ||
346 | 715 | search_title.changed.connect(on_title_changed); | 649 | search_title.changed.connect(on_title_changed); |
351 | 716 | 650 | ||
352 | 717 | row_box = builder.get_object("row_box") as Gtk.Box; | 651 | Gtk.Grid search_content_grid = new Gtk.Grid(); |
353 | 718 | 652 | search_content_grid.orientation = Gtk.Orientation.HORIZONTAL; | |
354 | 719 | operator = builder.get_object("Type of search criteria") as Gtk.ComboBoxText; | 653 | search_content_grid.column_spacing = 6; |
355 | 654 | search_content_grid.add(search_label); | ||
356 | 655 | search_content_grid.add(search_title); | ||
357 | 656 | |||
358 | 657 | Gtk.Label match_label = new Gtk.Label.with_mnemonic(_("_Match")); | ||
359 | 658 | Gtk.Label match2_label = new Gtk.Label.with_mnemonic(_("of the following:")); | ||
360 | 659 | match2_label.hexpand = true; | ||
361 | 660 | match2_label.xalign = 0; | ||
362 | 661 | |||
363 | 662 | row_box = new Gtk.Grid(); | ||
364 | 663 | row_box.orientation = Gtk.Orientation.VERTICAL; | ||
365 | 664 | row_box.row_spacing = 12; | ||
366 | 665 | |||
367 | 666 | operator = new Gtk.ComboBoxText(); | ||
368 | 720 | operator.append_text(_("any")); | 667 | operator.append_text(_("any")); |
369 | 721 | operator.append_text(_("all")); | 668 | operator.append_text(_("all")); |
370 | 722 | operator.append_text(_("none")); | 669 | operator.append_text(_("none")); |
372 | 723 | operator.set_active(0); | 670 | operator.active = 0; |
373 | 671 | |||
374 | 672 | Gtk.Grid match_grid = new Gtk.Grid(); | ||
375 | 673 | match_grid.orientation = Gtk.Orientation.HORIZONTAL; | ||
376 | 674 | match_grid.column_spacing = 6; | ||
377 | 675 | match_grid.add(match_label); | ||
378 | 676 | match_grid.add(operator); | ||
379 | 677 | match_grid.add(match2_label); | ||
380 | 678 | match_grid.add(add_criteria); | ||
381 | 679 | |||
382 | 680 | Gtk.Grid search_grid = new Gtk.Grid(); | ||
383 | 681 | search_grid.orientation = Gtk.Orientation.VERTICAL; | ||
384 | 682 | search_grid.margin = 12; | ||
385 | 683 | search_grid.row_spacing = 12; | ||
386 | 684 | |||
387 | 685 | search_grid.add(search_content_grid); | ||
388 | 686 | search_grid.add(new Gtk.Separator(Gtk.Orientation.HORIZONTAL)); | ||
389 | 687 | search_grid.add(match_grid); | ||
390 | 688 | search_grid.add(new Gtk.Separator(Gtk.Orientation.HORIZONTAL)); | ||
391 | 689 | search_grid.add(row_box); | ||
392 | 690 | |||
393 | 691 | Gtk.Box content = dialog.get_content_area() as Gtk.Box; | ||
394 | 692 | content.add(search_grid); | ||
395 | 724 | } | 693 | } |
397 | 725 | 694 | ||
398 | 726 | // Displays the dialog. | 695 | // Displays the dialog. |
399 | 727 | public void show() { | 696 | public void show() { |
400 | 728 | dialog.run(); | 697 | dialog.run(); |
401 | @@ -826,4 +795,4 @@ | |||
402 | 826 | 795 | ||
403 | 827 | dialog.set_response_sensitive(Gtk.ResponseType.OK, valid); | 796 | dialog.set_response_sensitive(Gtk.ResponseType.OK, valid); |
404 | 828 | } | 797 | } |
406 | 829 | } | 798 | } |
407 | 830 | \ No newline at end of file | 799 | \ No newline at end of file |
408 | 831 | 800 | ||
409 | === modified file 'src/sidebar/Tree.vala' | |||
410 | --- src/sidebar/Tree.vala 2014-06-08 20:11:20 +0000 | |||
411 | +++ src/sidebar/Tree.vala 2014-06-23 18:22:30 +0000 | |||
412 | @@ -196,7 +196,7 @@ | |||
413 | 196 | Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0]; | 196 | Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0]; |
414 | 197 | 197 | ||
415 | 198 | Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, null, null, on_new_search }; | 198 | Gtk.ActionEntry new_search = { "CommonNewSearch", null, TRANSLATABLE, null, null, on_new_search }; |
417 | 199 | new_search.label = _("Ne_w Saved Search..."); | 199 | new_search.label = _("New Smart Album…"); |
418 | 200 | actions += new_search; | 200 | actions += new_search; |
419 | 201 | 201 | ||
420 | 202 | Gtk.ActionEntry new_tag = { "CommonNewTag", null, TRANSLATABLE, null, null, on_new_tag }; | 202 | Gtk.ActionEntry new_tag = { "CommonNewTag", null, TRANSLATABLE, null, null, on_new_tag }; |
421 | 203 | 203 | ||
422 | === modified file 'ui/shotwell.glade' | |||
423 | --- ui/shotwell.glade 2014-05-20 03:38:19 +0000 | |||
424 | +++ ui/shotwell.glade 2014-06-23 18:22:30 +0000 | |||
425 | @@ -2,204 +2,6 @@ | |||
426 | 2 | <!-- Generated with glade 3.16.1 --> | 2 | <!-- Generated with glade 3.16.1 --> |
427 | 3 | <interface> | 3 | <interface> |
428 | 4 | <requires lib="gtk+" version="3.0"/> | 4 | <requires lib="gtk+" version="3.0"/> |
429 | 5 | <object class="GtkDialog" id="Search criteria"> | ||
430 | 6 | <property name="can_focus">False</property> | ||
431 | 7 | <property name="border_width">5</property> | ||
432 | 8 | <property name="title" translatable="yes">Search</property> | ||
433 | 9 | <property name="resizable">False</property> | ||
434 | 10 | <property name="modal">True</property> | ||
435 | 11 | <property name="destroy_with_parent">True</property> | ||
436 | 12 | <property name="type_hint">dialog</property> | ||
437 | 13 | <property name="skip_taskbar_hint">True</property> | ||
438 | 14 | <child internal-child="vbox"> | ||
439 | 15 | <object class="GtkBox" id="dialog-vbox6"> | ||
440 | 16 | <property name="visible">True</property> | ||
441 | 17 | <property name="can_focus">False</property> | ||
442 | 18 | <property name="orientation">vertical</property> | ||
443 | 19 | <property name="spacing">2</property> | ||
444 | 20 | <child internal-child="action_area"> | ||
445 | 21 | <object class="GtkButtonBox" id="search dialog buttons"> | ||
446 | 22 | <property name="visible">True</property> | ||
447 | 23 | <property name="can_focus">False</property> | ||
448 | 24 | <property name="layout_style">end</property> | ||
449 | 25 | <child> | ||
450 | 26 | <placeholder/> | ||
451 | 27 | </child> | ||
452 | 28 | </object> | ||
453 | 29 | <packing> | ||
454 | 30 | <property name="expand">False</property> | ||
455 | 31 | <property name="fill">True</property> | ||
456 | 32 | <property name="pack_type">end</property> | ||
457 | 33 | <property name="position">0</property> | ||
458 | 34 | </packing> | ||
459 | 35 | </child> | ||
460 | 36 | <child> | ||
461 | 37 | <object class="GtkAlignment" id="title_aln"> | ||
462 | 38 | <property name="visible">True</property> | ||
463 | 39 | <property name="can_focus">False</property> | ||
464 | 40 | <child> | ||
465 | 41 | <object class="GtkBox" id="hbox3"> | ||
466 | 42 | <property name="visible">True</property> | ||
467 | 43 | <property name="can_focus">False</property> | ||
468 | 44 | <child> | ||
469 | 45 | <object class="GtkLabel" id="Name of search:"> | ||
470 | 46 | <property name="visible">True</property> | ||
471 | 47 | <property name="can_focus">False</property> | ||
472 | 48 | <property name="label" translatable="yes">_Name of search:</property> | ||
473 | 49 | <property name="use_underline">True</property> | ||
474 | 50 | <property name="mnemonic_widget">Search title</property> | ||
475 | 51 | </object> | ||
476 | 52 | <packing> | ||
477 | 53 | <property name="expand">False</property> | ||
478 | 54 | <property name="fill">True</property> | ||
479 | 55 | <property name="padding">8</property> | ||
480 | 56 | <property name="position">0</property> | ||
481 | 57 | </packing> | ||
482 | 58 | </child> | ||
483 | 59 | <child> | ||
484 | 60 | <object class="GtkEntry" id="Search title"> | ||
485 | 61 | <property name="visible">True</property> | ||
486 | 62 | <property name="can_focus">True</property> | ||
487 | 63 | <property name="invisible_char">•</property> | ||
488 | 64 | <property name="width_chars">20</property> | ||
489 | 65 | <property name="primary_icon_activatable">False</property> | ||
490 | 66 | <property name="secondary_icon_activatable">False</property> | ||
491 | 67 | </object> | ||
492 | 68 | <packing> | ||
493 | 69 | <property name="expand">True</property> | ||
494 | 70 | <property name="fill">True</property> | ||
495 | 71 | <property name="padding">8</property> | ||
496 | 72 | <property name="position">1</property> | ||
497 | 73 | </packing> | ||
498 | 74 | </child> | ||
499 | 75 | </object> | ||
500 | 76 | </child> | ||
501 | 77 | </object> | ||
502 | 78 | <packing> | ||
503 | 79 | <property name="expand">True</property> | ||
504 | 80 | <property name="fill">True</property> | ||
505 | 81 | <property name="position">1</property> | ||
506 | 82 | </packing> | ||
507 | 83 | </child> | ||
508 | 84 | <child> | ||
509 | 85 | <object class="GtkHSeparator" id="hseparator1"> | ||
510 | 86 | <property name="visible">True</property> | ||
511 | 87 | <property name="can_focus">False</property> | ||
512 | 88 | </object> | ||
513 | 89 | <packing> | ||
514 | 90 | <property name="expand">False</property> | ||
515 | 91 | <property name="fill">True</property> | ||
516 | 92 | <property name="padding">8</property> | ||
517 | 93 | <property name="position">2</property> | ||
518 | 94 | </packing> | ||
519 | 95 | </child> | ||
520 | 96 | <child> | ||
521 | 97 | <object class="GtkAlignment" id="alignment9"> | ||
522 | 98 | <property name="visible">True</property> | ||
523 | 99 | <property name="can_focus">False</property> | ||
524 | 100 | <child> | ||
525 | 101 | <object class="GtkBox" id="hbox2"> | ||
526 | 102 | <property name="visible">True</property> | ||
527 | 103 | <property name="can_focus">False</property> | ||
528 | 104 | <property name="spacing">10</property> | ||
529 | 105 | <child> | ||
530 | 106 | <object class="GtkLabel" id="Match"> | ||
531 | 107 | <property name="visible">True</property> | ||
532 | 108 | <property name="can_focus">False</property> | ||
533 | 109 | <property name="label" translatable="yes">_Match</property> | ||
534 | 110 | <property name="use_underline">True</property> | ||
535 | 111 | <property name="justify">right</property> | ||
536 | 112 | <property name="mnemonic_widget">Type of search criteria</property> | ||
537 | 113 | </object> | ||
538 | 114 | <packing> | ||
539 | 115 | <property name="expand">False</property> | ||
540 | 116 | <property name="fill">True</property> | ||
541 | 117 | <property name="padding">8</property> | ||
542 | 118 | <property name="position">0</property> | ||
543 | 119 | </packing> | ||
544 | 120 | </child> | ||
545 | 121 | <child> | ||
546 | 122 | <object class="GtkComboBoxText" id="Type of search criteria"> | ||
547 | 123 | <property name="visible">True</property> | ||
548 | 124 | <property name="can_focus">False</property> | ||
549 | 125 | </object> | ||
550 | 126 | <packing> | ||
551 | 127 | <property name="expand">False</property> | ||
552 | 128 | <property name="fill">False</property> | ||
553 | 129 | <property name="padding">1</property> | ||
554 | 130 | <property name="position">1</property> | ||
555 | 131 | </packing> | ||
556 | 132 | </child> | ||
557 | 133 | <child> | ||
558 | 134 | <object class="GtkLabel" id="of the following:"> | ||
559 | 135 | <property name="visible">True</property> | ||
560 | 136 | <property name="can_focus">False</property> | ||
561 | 137 | <property name="ypad">3</property> | ||
562 | 138 | <property name="label" translatable="yes">of the following:</property> | ||
563 | 139 | </object> | ||
564 | 140 | <packing> | ||
565 | 141 | <property name="expand">False</property> | ||
566 | 142 | <property name="fill">True</property> | ||
567 | 143 | <property name="padding">8</property> | ||
568 | 144 | <property name="position">2</property> | ||
569 | 145 | </packing> | ||
570 | 146 | </child> | ||
571 | 147 | <child> | ||
572 | 148 | <placeholder/> | ||
573 | 149 | </child> | ||
574 | 150 | <child> | ||
575 | 151 | <object class="GtkButton" id="Add search button"> | ||
576 | 152 | <property name="label"> + </property> | ||
577 | 153 | <property name="visible">True</property> | ||
578 | 154 | <property name="can_focus">True</property> | ||
579 | 155 | <property name="receives_default">True</property> | ||
580 | 156 | </object> | ||
581 | 157 | <packing> | ||
582 | 158 | <property name="expand">False</property> | ||
583 | 159 | <property name="fill">False</property> | ||
584 | 160 | <property name="pack_type">end</property> | ||
585 | 161 | <property name="position">4</property> | ||
586 | 162 | </packing> | ||
587 | 163 | </child> | ||
588 | 164 | </object> | ||
589 | 165 | </child> | ||
590 | 166 | </object> | ||
591 | 167 | <packing> | ||
592 | 168 | <property name="expand">True</property> | ||
593 | 169 | <property name="fill">True</property> | ||
594 | 170 | <property name="position">3</property> | ||
595 | 171 | </packing> | ||
596 | 172 | </child> | ||
597 | 173 | <child> | ||
598 | 174 | <object class="GtkHSeparator" id="hseparator2"> | ||
599 | 175 | <property name="visible">True</property> | ||
600 | 176 | <property name="can_focus">False</property> | ||
601 | 177 | </object> | ||
602 | 178 | <packing> | ||
603 | 179 | <property name="expand">False</property> | ||
604 | 180 | <property name="fill">True</property> | ||
605 | 181 | <property name="padding">8</property> | ||
606 | 182 | <property name="position">4</property> | ||
607 | 183 | </packing> | ||
608 | 184 | </child> | ||
609 | 185 | <child> | ||
610 | 186 | <object class="GtkBox" id="row_box"> | ||
611 | 187 | <property name="visible">True</property> | ||
612 | 188 | <property name="can_focus">False</property> | ||
613 | 189 | <property name="orientation">vertical</property> | ||
614 | 190 | <child> | ||
615 | 191 | <placeholder/> | ||
616 | 192 | </child> | ||
617 | 193 | </object> | ||
618 | 194 | <packing> | ||
619 | 195 | <property name="expand">True</property> | ||
620 | 196 | <property name="fill">True</property> | ||
621 | 197 | <property name="position">5</property> | ||
622 | 198 | </packing> | ||
623 | 199 | </child> | ||
624 | 200 | </object> | ||
625 | 201 | </child> | ||
626 | 202 | </object> | ||
627 | 203 | <object class="GtkAdjustment" id="bg_color_adjustment"> | 5 | <object class="GtkAdjustment" id="bg_color_adjustment"> |
628 | 204 | <property name="upper">65535</property> | 6 | <property name="upper">65535</property> |
629 | 205 | <property name="step_increment">1000</property> | 7 | <property name="step_increment">1000</property> |
Looks good to me. 'Saved Search' sounds a bit strange to me. It makes sense for developers because that's what it does, but 'Media Filter' would probably make more sense for the end user.