diff --git a/icons/archive-icon.png b/icons/archive-icon.png new file mode 100644 index 00000000..3fb70032 Binary files /dev/null and b/icons/archive-icon.png differ diff --git a/icons/multiple-tags.png b/icons/multiple-tags.png new file mode 100644 index 00000000..5c09cf2e Binary files /dev/null and b/icons/multiple-tags.png differ diff --git a/icons/one-tag.png b/icons/one-tag.png new file mode 100644 index 00000000..fb456c7d Binary files /dev/null and b/icons/one-tag.png differ diff --git a/src/client/ui/folder-list.vala b/src/client/ui/folder-list.vala index 447bda6d..1f5ecd5b 100644 --- a/src/client/ui/folder-list.vala +++ b/src/client/ui/folder-list.vala @@ -78,7 +78,7 @@ public class FolderList : Sidebar.Tree { } public Icon? get_sidebar_icon() { - return new ThemedIcon("folder"); + return IconFactory.instance.label_icon; } public string to_string() { @@ -90,14 +90,14 @@ public class FolderList : Sidebar.Tree { private Sidebar.Grouping user_folder_group; private Sidebar.Branch user_folder_branch; - private Gee.HashMap entries = new Gee.HashMap entries = new Gee.HashMap(); public FolderList() { base(new Gtk.TargetEntry[0], Gdk.DragAction.ASK, drop_handler); entry_selected.connect(on_entry_selected); - user_folder_group = new Sidebar.Grouping("", new ThemedIcon("folder")); + user_folder_group = new Sidebar.Grouping("", IconFactory.instance.label_folder_icon); user_folder_branch = new Sidebar.Branch(user_folder_group, Sidebar.Branch.Options.STARTUP_OPEN_GROUPING, user_folder_comparator); graft(user_folder_branch, int.MAX); @@ -139,7 +139,9 @@ public class FolderList : Sidebar.Tree { } public void add_special_folder(Geary.SpecialFolder special, Geary.Folder folder) { - graft(new SpecialFolderBranch(special, folder), (int) special.folder_type); + SpecialFolderBranch branch = new SpecialFolderBranch(special, folder); + graft(branch, (int) special.folder_type); + entries.set(folder.get_path(), branch.get_root()); } public void select_path(Geary.FolderPath path) { diff --git a/src/client/ui/icon-factory.vala b/src/client/ui/icon-factory.vala index f343c10a..bd178e7d 100644 --- a/src/client/ui/icon-factory.vala +++ b/src/client/ui/icon-factory.vala @@ -21,6 +21,11 @@ public class IconFactory { public const int UNREAD_ICON_SIZE = 12; public Gdk.Pixbuf? unread { get; private set; } + public ThemedIcon label_icon { get; private set; default = new ThemedIcon("one-tag"); } + public ThemedIcon label_folder_icon { get; private set; default = new ThemedIcon("multiple-tags"); } + + private Gtk.IconTheme icon_theme { get; private set; } + private static Gdk.Pixbuf? load(string icon_name, int size, Gtk.IconLookupFlags flags = 0) { try { return Gtk.IconTheme.get_default().load_icon(icon_name, size, flags); @@ -31,10 +36,14 @@ public class IconFactory { return null; } - // Creats the icon factory. + // Creates the icon factory. private IconFactory() { // Load icons here. unread = load("mail-unread", UNREAD_ICON_SIZE); + + icon_theme= Gtk.IconTheme.get_default(); + icon_theme.append_search_path(GearyApplication.instance.get_resource_directory(). + get_child("icons").get_path()); } } diff --git a/src/client/ui/sidebar/sidebar-tree.vala b/src/client/ui/sidebar/sidebar-tree.vala index 8248bf1c..3cf848f2 100644 --- a/src/client/ui/sidebar/sidebar-tree.vala +++ b/src/client/ui/sidebar/sidebar-tree.vala @@ -264,8 +264,8 @@ public class Sidebar.Tree : Gtk.TreeView { selected_wrapper = wrapper; - if (editing_disabled == 0 && wrapper != null) - text_renderer.editable = wrapper.entry is Sidebar.RenameableEntry; + if (editing_disabled == 0 && wrapper != null && wrapper.entry is Sidebar.RenameableEntry) + text_renderer.editable = ((Sidebar.RenameableEntry) wrapper.entry).is_user_renameable(); if (wrapper != null && !mask_entry_selected_signal) { Sidebar.SelectableEntry? selectable = wrapper.entry as Sidebar.SelectableEntry; @@ -286,7 +286,9 @@ public class Sidebar.Tree : Gtk.TreeView { Gtk.TreePath? path = get_selected_path(); if (path != null && editing_disabled > 0 && --editing_disabled == 0) { EntryWrapper? wrapper = get_wrapper_at_path(path); - text_renderer.editable = (wrapper != null && (wrapper.entry is Sidebar.RenameableEntry)); + if (wrapper != null && (wrapper.entry is Sidebar.RenameableEntry)) + text_renderer.editable = ((Sidebar.RenameableEntry) wrapper.entry). + is_user_renameable(); } } @@ -841,7 +843,7 @@ public class Sidebar.Tree : Gtk.TreeView { } } else if (event.button == 1 && event.type == Gdk.EventType.BUTTON_PRESS) { // Is this a click on an already-highlighted tree item? - if ((old_path_ref != null) && (old_path_ref.get_path() != null) + if (path != null && (old_path_ref != null) && (old_path_ref.get_path() != null) && (old_path_ref.get_path().compare(path) == 0)) { // yes, don't allow single-click editing, but // pass the event on for dragging. @@ -1038,6 +1040,9 @@ public class Sidebar.Tree : Gtk.TreeView { if (renameable == null) return false; + if (wrapper.entry is Sidebar.Grouping) + return false; + get_selection().select_path(path); return true; diff --git a/ui/toolbar.glade b/ui/toolbar.glade index 9dd7f428..ff571cec 100644 --- a/ui/toolbar.glade +++ b/ui/toolbar.glade @@ -78,7 +78,7 @@ False Delete True - archive + archive-icon False