diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-07-09 12:10:38 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-07-09 12:10:38 +0200 |
commit | 709e2d6f5652ec90c194a4ec2b530bebc6f952cb (patch) | |
tree | 496b2f3899e1d5728ee9ae76095cc5056c317447 /src/sidebar/Tree.vala | |
parent | f1353e9ffd34db5f755c7da0b3f9c10638fbfd38 (diff) | |
parent | 5c8be07095cc04a6d8a95204b0504fd7ab030154 (diff) |
Merge branch 'release/0.28.3-1'0.28.3-1
Diffstat (limited to 'src/sidebar/Tree.vala')
-rw-r--r-- | src/sidebar/Tree.vala | 29 |
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); } |