Merge lp:~victored/pantheon-photos/lp-1275115 into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Victor Martinez
Status: Merged
Approved by: Corentin Noël
Approved revision: 2526
Merged at revision: 2527
Proposed branch: lp:~victored/pantheon-photos/lp-1275115
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 661 lines (+202/-155)
9 files modified
src/library/Branch.vala (+101/-7)
src/library/FlaggedSidebarEntry.vala (+18/-25)
src/library/ImportQueueSidebarEntry.vala (+25/-43)
src/library/LastImportSidebarEntry.vala (+8/-19)
src/library/LibraryWindow.vala (+10/-23)
src/library/OfflineSidebarEntry.vala (+17/-24)
src/library/TrashSidebarEntry.vala (+0/-6)
src/library/mk/library.mk (+5/-5)
src/sidebar/Tree.vala (+18/-3)
To merge this branch: bzr merge lp:~victored/pantheon-photos/lp-1275115
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Review via email: mp+222462@code.launchpad.net

Commit message

- Group 'Photos', 'Flagged', 'Last Import', 'Import Queue', 'Offline', and 'Trash' sidebar entries under a new category called 'Library'.
- Move 'Trash' sidebar entry below 'Last Import'.
- Use bold text with no icons for Category headers. Fixes lp:1275115.

Description of the change

- Move 'Trash' sidebar entry below 'Last Import'.
- Use bold text with no icons for Category headers. Fixes lp:1275115.

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

Victor can we rename "Library" to "Photos" and then put a header "Library" that includes Photos, Last Import, and Trash?

Revision history for this message
Victor Martinez (victored) wrote :

I'll look into it.

2525. By Victor Martinez

Group 'Photos', 'Flagged', 'Last Import', 'Import Queue', 'Offline', and 'Trash' sidebar entries under a new category called 'Library'.

Revision history for this message
Victor Martinez (victored) wrote :

Daniel, I've implemented the 'library' category you've requested.

2526. By Victor Martinez

Rename source files under src/library to reflect the names of the classes they contain, as they no longer contain sidebar branches.

Revision history for this message
Corentin Noël (tintou) wrote :

It simply looks better with this, thanks victor!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/library/Branch.vala'
2--- src/library/Branch.vala 2013-01-21 21:16:09 +0000
3+++ src/library/Branch.vala 2014-06-09 02:32:27 +0000
4@@ -4,24 +4,98 @@
5 * (version 2.1 or later). See the COPYING file in this distribution.
6 */
7
8-public class Library.Branch : Sidebar.RootOnlyBranch {
9+public class Library.Branch : Sidebar.Branch {
10+ private const string POSITION_DATA = "x-photos-entry-position";
11+
12+ public Library.PhotosEntry photos_entry { get; private set; }
13+ public Library.FlaggedSidebarEntry flagged_entry { get; private set; }
14+ public Library.LastImportSidebarEntry last_imported_entry { get; private set; }
15+ public Library.ImportQueueSidebarEntry import_queue_entry { get; private set; }
16+ public Library.OfflineSidebarEntry offline_entry { get; private set; }
17+ public Library.TrashSidebarEntry trash_entry { get; private set; }
18+
19+ // This lists the order of the library items in the sidebar. To re-order, simply move
20+ // the item in this list to a new position. These numbers should *not* persist anywhere
21+ // outside the app.
22+ private enum EntryPosition {
23+ PHOTOS,
24+ FLAGGED,
25+ LAST_IMPORTED,
26+ IMPORT_QUEUE,
27+ OFFLINE,
28+ TRASH
29+ }
30+
31 public Branch() {
32- base (new Library.SidebarEntry());
33+ base (new Sidebar.Grouping(_("Library"), null),
34+ Sidebar.Branch.Options.STARTUP_OPEN_GROUPING, comparator);
35+
36+ photos_entry = new Library.PhotosEntry();
37+ trash_entry = new Library.TrashSidebarEntry();
38+ last_imported_entry = new Library.LastImportSidebarEntry();
39+ flagged_entry = new Library.FlaggedSidebarEntry();
40+ offline_entry = new Library.OfflineSidebarEntry();
41+ import_queue_entry = new Library.ImportQueueSidebarEntry();
42+
43+ insert(photos_entry, EntryPosition.PHOTOS);
44+ insert(trash_entry, EntryPosition.TRASH);
45+
46+ flagged_entry.visibility_changed.connect(on_flagged_visibility_changed);
47+ on_flagged_visibility_changed();
48+
49+ last_imported_entry.visibility_changed.connect(on_last_imported_visibility_changed);
50+ on_last_imported_visibility_changed();
51+
52+ import_queue_entry.visibility_changed.connect(on_import_queue_visibility_changed);
53+ on_import_queue_visibility_changed();
54+
55+ offline_entry.visibility_changed.connect(on_offline_visibility_changed);
56+ on_offline_visibility_changed();
57 }
58
59- public Library.MainPage get_main_page() {
60- return (Library.MainPage) ((Library.SidebarEntry) get_root()).get_page();
61+ private void insert(Sidebar.Entry entry, int position) {
62+ entry.set_data<int>(POSITION_DATA, position);
63+ graft(get_root(), entry);
64+ }
65+
66+ private void on_flagged_visibility_changed() {
67+ update_entry_visibility(flagged_entry, EntryPosition.FLAGGED);
68+ }
69+
70+ private void on_last_imported_visibility_changed() {
71+ update_entry_visibility(last_imported_entry, EntryPosition.LAST_IMPORTED);
72+ }
73+
74+ private void on_import_queue_visibility_changed() {
75+ update_entry_visibility(import_queue_entry, EntryPosition.IMPORT_QUEUE);
76+ }
77+
78+ private void on_offline_visibility_changed() {
79+ update_entry_visibility(offline_entry, EntryPosition.OFFLINE);
80+ }
81+
82+ private void update_entry_visibility(Library.HideablePageEntry entry, int position) {
83+ if (entry.visible) {
84+ if (!has_entry(entry))
85+ insert(entry, position);
86+ } else if (has_entry(entry)) {
87+ prune(entry);
88+ }
89+ }
90+
91+ private static int comparator(Sidebar.Entry a, Sidebar.Entry b) {
92+ return a.get_data<int>(POSITION_DATA) - b.get_data<int>(POSITION_DATA);
93 }
94 }
95
96-public class Library.SidebarEntry : Sidebar.SimplePageEntry {
97+public class Library.PhotosEntry : Sidebar.SimplePageEntry {
98 private Icon icon = new ThemedIcon(Resources.ICON_PHOTOS);
99
100- public SidebarEntry() {
101+ public PhotosEntry() {
102 }
103
104 public override string get_sidebar_name() {
105- return Library.MainPage.NAME;
106+ return _("Photos");
107 }
108
109 public override Icon? get_sidebar_icon() {
110@@ -33,6 +107,26 @@
111 }
112 }
113
114+public abstract class Library.HideablePageEntry : Sidebar.SimplePageEntry {
115+ // container branch should listen to this signal
116+ public signal void visibility_changed(bool visible);
117+
118+ private bool show_entry = false;
119+ public bool visible {
120+ get { return show_entry; }
121+ set {
122+ if (value == show_entry)
123+ return;
124+
125+ show_entry = value;
126+ visibility_changed(value);
127+ }
128+ }
129+
130+ public HideablePageEntry() {
131+ }
132+}
133+
134 public class Library.MainPage : CollectionPage {
135 public const string NAME = _("Library");
136
137
138=== renamed file 'src/library/FlaggedBranch.vala' => 'src/library/FlaggedSidebarEntry.vala'
139--- src/library/FlaggedBranch.vala 2013-01-21 21:16:09 +0000
140+++ src/library/FlaggedSidebarEntry.vala 2014-06-09 02:32:27 +0000
141@@ -4,38 +4,19 @@
142 * (version 2.1 or later). See the COPYING file in this distribution.
143 */
144
145-public class Library.FlaggedBranch : Sidebar.RootOnlyBranch {
146- public FlaggedBranch() {
147- base (new Library.FlaggedSidebarEntry());
148-
149+public class Library.FlaggedSidebarEntry : Library.HideablePageEntry, Sidebar.InternalDropTargetEntry {
150+ public FlaggedSidebarEntry() {
151 foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
152 media_sources.flagged_contents_altered.connect(on_flagged_contents_altered);
153
154- set_show_branch(get_total_flagged() != 0);
155+ visible = (get_total_flagged() != 0);
156 }
157
158- ~FlaggedBranch() {
159+ ~FlaggedSidebarEntry() {
160 foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
161 media_sources.flagged_contents_altered.disconnect(on_flagged_contents_altered);
162- }
163-
164- private void on_flagged_contents_altered() {
165- set_show_branch(get_total_flagged() != 0);
166- }
167-
168- private int get_total_flagged() {
169- int total = 0;
170- foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
171- total += media_sources.get_flagged().size;
172-
173- return total;
174- }
175-}
176-
177-public class Library.FlaggedSidebarEntry : Sidebar.SimplePageEntry, Sidebar.InternalDropTargetEntry {
178- public FlaggedSidebarEntry() {
179- }
180-
181+ }
182+
183 public override string get_sidebar_name() {
184 return FlaggedPage.NAME;
185 }
186@@ -57,5 +38,17 @@
187 public bool internal_drop_received_arbitrary(Gtk.SelectionData data) {
188 return false;
189 }
190+
191+ private void on_flagged_contents_altered() {
192+ visible = (get_total_flagged() != 0);
193+ }
194+
195+ private int get_total_flagged() {
196+ int total = 0;
197+ foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
198+ total += media_sources.get_flagged().size;
199+
200+ return total;
201+ }
202 }
203
204
205=== renamed file 'src/library/ImportQueueBranch.vala' => 'src/library/ImportQueueSidebarEntry.vala'
206--- src/library/ImportQueueBranch.vala 2013-01-21 21:16:09 +0000
207+++ src/library/ImportQueueSidebarEntry.vala 2014-06-09 02:32:27 +0000
208@@ -4,35 +4,34 @@
209 * (version 2.1 or later). See the COPYING file in this distribution.
210 */
211
212-public class Library.ImportQueueBranch : Sidebar.RootOnlyBranch {
213- private Library.ImportQueueSidebarEntry entry;
214-
215- public ImportQueueBranch() {
216- // can't pass to base() an object that was allocated in declaration; see
217- // https://bugzilla.gnome.org/show_bug.cgi?id=646286
218- base (new Library.ImportQueueSidebarEntry());
219-
220- entry = (Library.ImportQueueSidebarEntry) get_root();
221-
222+public class Library.ImportQueueSidebarEntry : Library.HideablePageEntry {
223+ public ImportQueueSidebarEntry() {
224 // only attach signals to the page when it's created
225- entry.page_created.connect(on_page_created);
226- entry.destroying_page.connect(on_destroying_page);
227+ page_created.connect(on_page_created);
228+ destroying_page.connect(on_destroying_page);
229
230 // don't use entry.get_page() or get_queue_page() because (a) we don't want to
231 // create the page during initialization, and (b) we know there's no import activity
232 // at this moment
233- set_show_branch(false);
234- }
235-
236- ~ImportQueueBranch() {
237- entry.page_created.disconnect(on_page_created);
238- entry.destroying_page.disconnect(on_destroying_page);
239- }
240-
241- public ImportQueuePage get_queue_page() {
242- return (ImportQueuePage) entry.get_page();
243- }
244-
245+ visible = false;
246+ }
247+
248+ public override string get_sidebar_name() {
249+ return ImportQueuePage.NAME;
250+ }
251+
252+ public override Icon? get_sidebar_icon() {
253+ return new ThemedIcon(Resources.ICON_IMPORTING);
254+ }
255+
256+ protected override Page create_page() {
257+ return new ImportQueuePage();
258+ }
259+
260+ private ImportQueuePage get_queue_page() {
261+ return get_page() as ImportQueuePage;
262+ }
263+
264 private void on_page_created() {
265 get_queue_page().batch_added.connect(on_batch_added_or_removed);
266 get_queue_page().batch_removed.connect(on_batch_added_or_removed);
267@@ -44,31 +43,14 @@
268 }
269
270 private void on_batch_added_or_removed() {
271- set_show_branch(get_queue_page().get_batch_count() > 0);
272+ visible = (get_queue_page().get_batch_count() > 0);
273 }
274
275 public void enqueue_and_schedule(BatchImport batch_import, bool allow_user_cancel) {
276 // want to display the branch before passing to the page because this might result in the
277 // page being created, and want it all hooked up in the tree prior to creating the page
278- set_show_branch(true);
279+ visible = true;
280 get_queue_page().enqueue_and_schedule(batch_import, allow_user_cancel);
281 }
282 }
283
284-public class Library.ImportQueueSidebarEntry : Sidebar.SimplePageEntry {
285- public ImportQueueSidebarEntry() {
286- }
287-
288- public override string get_sidebar_name() {
289- return ImportQueuePage.NAME;
290- }
291-
292- public override Icon? get_sidebar_icon() {
293- return new ThemedIcon(Resources.ICON_IMPORTING);
294- }
295-
296- protected override Page create_page() {
297- return new ImportQueuePage();
298- }
299-}
300-
301
302=== renamed file 'src/library/LastImportBranch.vala' => 'src/library/LastImportSidebarEntry.vala'
303--- src/library/LastImportBranch.vala 2013-01-21 21:16:09 +0000
304+++ src/library/LastImportSidebarEntry.vala 2014-06-09 02:32:27 +0000
305@@ -4,34 +4,19 @@
306 * (version 2.1 or later). See the COPYING file in this distribution.
307 */
308
309-public class Library.LastImportBranch : Sidebar.RootOnlyBranch {
310- public LastImportBranch() {
311- base (new Library.LastImportSidebarEntry());
312-
313+public class Library.LastImportSidebarEntry : Library.HideablePageEntry {
314+ public LastImportSidebarEntry() {
315 foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
316 media_sources.import_roll_altered.connect(on_import_rolls_altered);
317
318- set_show_branch(MediaCollectionRegistry.get_instance().get_last_import_id() != null);
319+ visible = (MediaCollectionRegistry.get_instance().get_last_import_id() != null);
320 }
321
322- ~LastImportBranch() {
323+ ~LastImportSidebarEntry() {
324 foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
325 media_sources.import_roll_altered.disconnect(on_import_rolls_altered);
326 }
327
328- public Library.LastImportSidebarEntry get_main_entry() {
329- return (Library.LastImportSidebarEntry) get_root();
330- }
331-
332- private void on_import_rolls_altered() {
333- set_show_branch(MediaCollectionRegistry.get_instance().get_last_import_id() != null);
334- }
335-}
336-
337-public class Library.LastImportSidebarEntry : Sidebar.SimplePageEntry {
338- public LastImportSidebarEntry() {
339- }
340-
341 public override string get_sidebar_name() {
342 return LastImportPage.NAME;
343 }
344@@ -43,5 +28,9 @@
345 protected override Page create_page() {
346 return new LastImportPage();
347 }
348+
349+ private void on_import_rolls_altered() {
350+ visible = (MediaCollectionRegistry.get_instance().get_last_import_id() != null);
351+ }
352 }
353
354
355=== modified file 'src/library/LibraryWindow.vala'
356--- src/library/LibraryWindow.vala 2014-05-22 07:11:31 +0000
357+++ src/library/LibraryWindow.vala 2014-06-09 02:32:27 +0000
358@@ -42,16 +42,11 @@
359 // outside the app.
360 private enum SidebarRootPosition {
361 LIBRARY,
362- FLAGGED,
363- LAST_IMPORTED,
364 CAMERAS,
365- IMPORT_QUEUE,
366 SAVED_SEARCH,
367 EVENTS,
368 FOLDERS,
369 TAGS,
370- TRASH,
371- OFFLINE
372 }
373
374 public enum TargetType {
375@@ -114,12 +109,7 @@
376 private Library.Branch library_branch = new Library.Branch();
377 private Tags.Branch tags_branch = new Tags.Branch();
378 private Folders.Branch folders_branch = new Folders.Branch();
379- private Library.TrashBranch trash_branch = new Library.TrashBranch();
380 private Events.Branch events_branch = new Events.Branch();
381- private Library.OfflineBranch offline_branch = new Library.OfflineBranch();
382- private Library.FlaggedBranch flagged_branch = new Library.FlaggedBranch();
383- private Library.LastImportBranch last_import_branch = new Library.LastImportBranch();
384- private Library.ImportQueueBranch import_queue_branch = new Library.ImportQueueBranch();
385 private Camera.Branch camera_branch = new Camera.Branch();
386 private Searches.Branch saved_search_branch = new Searches.Branch();
387 private bool page_switching_enabled = true;
388@@ -172,12 +162,7 @@
389 sidebar_tree.graft(library_branch, SidebarRootPosition.LIBRARY);
390 sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS);
391 sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS);
392- sidebar_tree.graft(trash_branch, SidebarRootPosition.TRASH);
393 sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS);
394- sidebar_tree.graft(offline_branch, SidebarRootPosition.OFFLINE);
395- sidebar_tree.graft(flagged_branch, SidebarRootPosition.FLAGGED);
396- sidebar_tree.graft(last_import_branch, SidebarRootPosition.LAST_IMPORTED);
397- sidebar_tree.graft(import_queue_branch, SidebarRootPosition.IMPORT_QUEUE);
398 sidebar_tree.graft(camera_branch, SidebarRootPosition.CAMERAS);
399 sidebar_tree.graft(saved_search_branch, SidebarRootPosition.SAVED_SEARCH);
400
401@@ -207,7 +192,7 @@
402 menubar.no_show_all = true;
403
404 // create the main layout & start at the Library page
405- create_layout(library_branch.get_main_page());
406+ create_layout(library_branch.photos_entry.get_page());
407
408 // settings that should persist between sessions
409 load_configuration();
410@@ -879,7 +864,7 @@
411 }
412
413 public void enqueue_batch_import(BatchImport batch_import, bool allow_user_cancel) {
414- import_queue_branch.enqueue_and_schedule(batch_import, allow_user_cancel);
415+ library_branch.import_queue_entry.enqueue_and_schedule(batch_import, allow_user_cancel);
416 }
417
418 private void import_reporter(ImportManifest manifest) {
419@@ -1025,7 +1010,7 @@
420 }
421
422 public void switch_to_library_page() {
423- switch_to_page(library_branch.get_main_page());
424+ switch_to_page(library_branch.photos_entry.get_page());
425 }
426
427 public void switch_to_event(Event event) {
428@@ -1062,7 +1047,7 @@
429 }
430
431 public void switch_to_import_queue_page() {
432- switch_to_page(import_queue_branch.get_queue_page());
433+ switch_to_page(library_branch.import_queue_entry.get_page());
434 }
435
436 private void on_camera_added(DiscoveredCamera camera) {
437@@ -1449,7 +1434,7 @@
438 private void on_destroying_page(Sidebar.PageRepresentative entry, Page page) {
439 // if page is the current page, switch to fallback before destroying
440 if (page == get_current_page())
441- switch_to_page(library_branch.get_main_page());
442+ switch_to_page(library_branch.photos_entry.get_page());
443
444 remove_from_notebook(page);
445
446@@ -1467,9 +1452,11 @@
447 // if the currently selected item is removed, want to jump to fallback page (which
448 // depends on the item that was selected)
449
450+ Library.LastImportSidebarEntry last_import_entry = library_branch.last_imported_entry;
451+
452 // Importing... -> Last Import (if available)
453- if (selectable is Library.ImportQueueSidebarEntry && last_import_branch.get_show_branch()) {
454- switch_to_page(last_import_branch.get_main_entry().get_page());
455+ if (selectable is Library.ImportQueueSidebarEntry && last_import_entry.visible) {
456+ switch_to_page(last_import_entry.get_page());
457
458 return;
459 }
460@@ -1489,7 +1476,7 @@
461 }
462
463 // basic all-around default: jump to the Library page
464- switch_to_page(library_branch.get_main_page());
465+ switch_to_page(library_branch.photos_entry.get_page());
466 }
467
468 private void subscribe_for_basic_information(Page page) {
469
470=== renamed file 'src/library/OfflineBranch.vala' => 'src/library/OfflineSidebarEntry.vala'
471--- src/library/OfflineBranch.vala 2013-01-21 21:16:09 +0000
472+++ src/library/OfflineSidebarEntry.vala 2014-06-09 02:32:27 +0000
473@@ -4,38 +4,19 @@
474 * (version 2.1 or later). See the COPYING file in this distribution.
475 */
476
477-public class Library.OfflineBranch : Sidebar.RootOnlyBranch {
478- public OfflineBranch() {
479- base (new Library.OfflineSidebarEntry());
480-
481+public class Library.OfflineSidebarEntry : Library.HideablePageEntry {
482+ public OfflineSidebarEntry() {
483 foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
484 media_sources.offline_contents_altered.connect(on_offline_contents_altered);
485
486- set_show_branch(get_total_offline() != 0);
487+ visible = (get_total_offline() != 0);
488 }
489-
490- ~OfflineBranch() {
491+
492+ ~OfflineSidebarEntry() {
493 foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
494 media_sources.trashcan_contents_altered.disconnect(on_offline_contents_altered);
495 }
496
497- private void on_offline_contents_altered() {
498- set_show_branch(get_total_offline() != 0);
499- }
500-
501- private int get_total_offline() {
502- int total = 0;
503- foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
504- total += media_sources.get_offline_bin_contents().size;
505-
506- return total;
507- }
508-}
509-
510-public class Library.OfflineSidebarEntry : Sidebar.SimplePageEntry {
511- public OfflineSidebarEntry() {
512- }
513-
514 public override string get_sidebar_name() {
515 return OfflinePage.NAME;
516 }
517@@ -47,5 +28,17 @@
518 protected override Page create_page() {
519 return new OfflinePage();
520 }
521+
522+ private void on_offline_contents_altered() {
523+ visible = (get_total_offline() != 0);
524+ }
525+
526+ private int get_total_offline() {
527+ int total = 0;
528+ foreach (MediaSourceCollection media_sources in MediaCollectionRegistry.get_instance().get_all())
529+ total += media_sources.get_offline_bin_contents().size;
530+
531+ return total;
532+ }
533 }
534
535
536=== renamed file 'src/library/TrashBranch.vala' => 'src/library/TrashSidebarEntry.vala'
537--- src/library/TrashBranch.vala 2013-01-21 21:16:09 +0000
538+++ src/library/TrashSidebarEntry.vala 2014-06-09 02:32:27 +0000
539@@ -4,12 +4,6 @@
540 * (version 2.1 or later). See the COPYING file in this distribution.
541 */
542
543-public class Library.TrashBranch : Sidebar.RootOnlyBranch {
544- public TrashBranch() {
545- base (new Library.TrashSidebarEntry());
546- }
547-}
548-
549 public class Library.TrashSidebarEntry : Sidebar.SimplePageEntry, Sidebar.InternalDropTargetEntry {
550 private static Icon? full_icon = null;
551 private static Icon? empty_icon = null;
552
553=== modified file 'src/library/mk/library.mk'
554--- src/library/mk/library.mk 2013-01-12 00:20:39 +0000
555+++ src/library/mk/library.mk 2014-06-09 02:32:27 +0000
556@@ -13,11 +13,11 @@
557 UNIT_FILES := \
558 LibraryWindow.vala \
559 Branch.vala \
560- TrashBranch.vala \
561- OfflineBranch.vala \
562- FlaggedBranch.vala \
563- LastImportBranch.vala \
564- ImportQueueBranch.vala \
565+ TrashSidebarEntry.vala \
566+ OfflineSidebarEntry.vala \
567+ FlaggedSidebarEntry.vala \
568+ LastImportSidebarEntry.vala \
569+ ImportQueueSidebarEntry.vala \
570 FlaggedPage.vala \
571 ImportQueuePage.vala \
572 LastImportPage.vala \
573
574=== modified file 'src/sidebar/Tree.vala'
575--- src/sidebar/Tree.vala 2014-03-17 03:03:44 +0000
576+++ src/sidebar/Tree.vala 2014-06-09 02:32:27 +0000
577@@ -52,6 +52,7 @@
578 PIXBUF,
579 CLOSED_PIXBUF,
580 OPEN_PIXBUF,
581+ PIXBUF_VISIBLE,
582 N_COLUMNS
583 }
584
585@@ -61,7 +62,8 @@
586 typeof (EntryWrapper), // WRAPPER
587 typeof (Gdk.Pixbuf?), // PIXBUF
588 typeof (Gdk.Pixbuf?), // CLOSED_PIXBUF
589- typeof (Gdk.Pixbuf?) // OPEN_PIXBUF
590+ typeof (Gdk.Pixbuf?), // OPEN_PIXBUF
591+ typeof (bool) // PIXBUF_VISIBLE
592 );
593
594 private Gtk.UIManager ui = new Gtk.UIManager();
595@@ -106,6 +108,7 @@
596 text_column.add_attribute(icon_renderer, "pixbuf", Columns.PIXBUF);
597 text_column.add_attribute(icon_renderer, "pixbuf_expander_closed", Columns.CLOSED_PIXBUF);
598 text_column.add_attribute(icon_renderer, "pixbuf_expander_open", Columns.OPEN_PIXBUF);
599+ text_column.add_attribute(icon_renderer, "visible", Columns.PIXBUF_VISIBLE);
600 text_renderer = new Gtk.CellRendererText();
601 text_renderer.editing_canceled.connect(on_editing_canceled);
602 text_renderer.editing_started.connect(on_editing_started);
603@@ -447,7 +450,6 @@
604 assert(!entry_map.has_key(entry));
605 entry_map.set(entry, wrapper);
606
607- store.set(assoc_iter, Columns.NAME, guarded_markup_escape_text(entry.get_sidebar_name()));
608 store.set(assoc_iter, Columns.TOOLTIP, guarded_markup_escape_text(entry.get_sidebar_tooltip()));
609 store.set(assoc_iter, Columns.WRAPPER, wrapper);
610 load_entry_icons(assoc_iter);
611@@ -468,9 +470,19 @@
612 Sidebar.ExpandableEntry? expandable = entry as Sidebar.ExpandableEntry;
613 if (expandable != null)
614 expandable.sidebar_open_closed_icons_changed.connect(on_sidebar_open_closed_icons_changed);
615+
616+ string sidebar_name = guarded_markup_escape_text(entry.get_sidebar_name());
617+ if (is_category_header(wrapper))
618+ store.set(assoc_iter, Columns.NAME, "<b>%s</b>".printf(sidebar_name));
619+ else
620+ store.set(assoc_iter, Columns.NAME, sidebar_name);
621
622 entry.grafted(this);
623 }
624+
625+ private static bool is_category_header(EntryWrapper wrapper) {
626+ return (wrapper.entry is Sidebar.ExpandableEntry) && (wrapper.get_path().get_depth() == 1);
627+ }
628
629 private EntryWrapper reparent_wrapper(Gtk.TreeIter new_iter, EntryWrapper current_wrapper) {
630 Sidebar.Entry entry = current_wrapper.entry;
631@@ -710,6 +722,7 @@
632 assert(wrapper != null);
633
634 store.set(wrapper.get_iter(), Columns.PIXBUF, fetch_icon_pixbuf(icon));
635+ store.set(wrapper.get_iter(), Columns.PIXBUF_VISIBLE, !is_category_header(wrapper));
636 }
637
638 private void on_sidebar_page_created(Sidebar.PageRepresentative entry, Page page) {
639@@ -727,6 +740,7 @@
640
641 store.set(wrapper.get_iter(), Columns.OPEN_PIXBUF, fetch_icon_pixbuf(open));
642 store.set(wrapper.get_iter(), Columns.CLOSED_PIXBUF, fetch_icon_pixbuf(closed));
643+ store.set(wrapper.get_iter(), Columns.PIXBUF_VISIBLE, !is_category_header(wrapper));
644 }
645
646 private void on_sidebar_name_changed(Sidebar.RenameableEntry entry, string name) {
647@@ -787,6 +801,7 @@
648 store.set(iter, Columns.PIXBUF, fetch_icon_pixbuf(icon));
649 store.set(iter, Columns.OPEN_PIXBUF, fetch_icon_pixbuf(open));
650 store.set(iter, Columns.CLOSED_PIXBUF, fetch_icon_pixbuf(closed));
651+ store.set(wrapper.get_iter(), Columns.PIXBUF_VISIBLE, !is_category_header(wrapper));
652 }
653
654 private void load_branch_icons(Gtk.TreeIter iter) {
655@@ -1175,4 +1190,4 @@
656 AppWindow.get_command_manager().execute(creation_command);
657 LibraryWindow.get_app().rename_tag_in_sidebar(creation_command.get_created_tag());
658 }
659-}
660\ No newline at end of file
661+}

Subscribers

People subscribed via source and target branches