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:34:32 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-05-01 14:34:32 +0200
commit49120f48474fc8fdc2448c75d961bc238213cfac (patch)
tree05bcdb95d65a807cf0f1ffffd066c09074b5cf56 /src/sidebar/Tree.vala
parent2492891f112caac6076ce49721d9d5d78a152c3a (diff)
New upstream version 0.28.2upstream/0.28.2
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);
}