Icons folder, label icons in sidebar, new archive button, sidebar assertion fix, inbox selection fix. Fixes #4700 Closes #4659

This commit is contained in:
Eric Gregory 2012-02-01 18:51:07 -08:00
parent f0ea6b3ceb
commit ce031eee3b
7 changed files with 26 additions and 10 deletions

BIN
icons/archive-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
icons/multiple-tags.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
icons/one-tag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -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<Geary.FolderPath, Sidebar.Entry> entries = new Gee.HashMap<Geary.FolderPath,
internal Gee.HashMap<Geary.FolderPath, Sidebar.Entry> entries = new Gee.HashMap<Geary.FolderPath,
Sidebar.Entry>();
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) {

View file

@ -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());
}
}

View file

@ -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;

View file

@ -78,7 +78,7 @@
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Delete</property>
<property name="use_underline">True</property>
<property name="icon_name">archive</property>
<property name="icon_name">archive-icon</property>
</object>
<packing>
<property name="expand">False</property>