summaryrefslogtreecommitdiff
path: root/src/sidebar/Tree.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:43:08 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:43:08 +0200
commit2b3f22361da0c1d8e6ce70d71352821758186db7 (patch)
tree5d10633b47369b3aa52a05bf889ede0dbe5ee108 /src/sidebar/Tree.vala
parent211da5fc3048ca2b6ccee2166b0aaaade55cb84f (diff)
parentdc6c76eb04dfe3d4262a1806808f0bc0bf523238 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/sidebar/Tree.vala')
-rw-r--r--src/sidebar/Tree.vala29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/sidebar/Tree.vala b/src/sidebar/Tree.vala
index a3fc8bf..c707c63 100644
--- a/src/sidebar/Tree.vala
+++ b/src/sidebar/Tree.vala
@@ -56,7 +56,7 @@ public class Sidebar.Tree : Gtk.TreeView {
typeof (string), // NAME
typeof (string?), // TOOLTIP
typeof (EntryWrapper), // WRAPPER
- typeof (string?) // ICON
+ typeof (Icon?) // ICON
);
private Gtk.Builder builder = new Gtk.Builder ();
@@ -93,14 +93,13 @@ public class Sidebar.Tree : Gtk.TreeView {
public Tree(Gtk.TargetEntry[] target_entries, Gdk.DragAction actions,
ExternalDropHandler drop_handler) {
set_model(store);
- get_style_context().add_class("sidebar");
Gtk.TreeViewColumn text_column = new Gtk.TreeViewColumn();
text_column.set_expand(true);
Gtk.CellRendererPixbuf icon_renderer = new Gtk.CellRendererPixbuf();
icon_renderer.follow_state = true;
- text_column.pack_start(icon_renderer, false);
- text_column.add_attribute(icon_renderer, "icon_name", Columns.ICON);
+ text_column.pack_start (icon_renderer, false);
+ text_column.add_attribute(icon_renderer, "gicon", Columns.ICON);
text_column.set_cell_data_func(icon_renderer, icon_renderer_function);
text_renderer = new Gtk.CellRendererText();
text_renderer.ellipsize = Pango.EllipsizeMode.END;
@@ -736,10 +735,17 @@ public class Sidebar.Tree : Gtk.TreeView {
store.set(wrapper.get_iter(), Columns.TOOLTIP, guarded_markup_escape_text(tooltip));
}
- private void on_sidebar_icon_changed(Sidebar.Entry entry, string? icon) {
+ private void on_sidebar_icon_changed(Sidebar.Entry entry, string? icon_name) {
EntryWrapper? wrapper = get_wrapper(entry);
assert(wrapper != null);
-
+ Icon? icon = null;
+
+ try {
+ if (icon_name != null) {
+ icon = Icon.new_for_string (icon_name);
+ }
+ } catch (Error e) { }
+
store.set(wrapper.get_iter(), Columns.ICON, icon);
}
@@ -768,9 +774,18 @@ public class Sidebar.Tree : Gtk.TreeView {
private void load_entry_icons(Gtk.TreeIter iter) {
EntryWrapper? wrapper = get_wrapper_at_iter(iter);
+ Icon? icon = null;
if (wrapper == null)
return;
- string? icon = wrapper.entry.get_sidebar_icon();
+
+ try {
+ string? name = wrapper.entry.get_sidebar_icon();
+ if (name != null) {
+ icon = Icon.new_for_string (name);
+ }
+ } catch (Error e) { }
+
+
store.set(iter, Columns.ICON, icon);
}