diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-05-01 14:35:32 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-05-01 14:35:32 +0200 |
commit | e230b6f78546827521107be23797048482c8b193 (patch) | |
tree | 948c1e77382c484819ea399bba4edcdc19cc6bf0 /src/sidebar/Tree.vala | |
parent | 211da5fc3048ca2b6ccee2166b0aaaade55cb84f (diff) | |
parent | 49120f48474fc8fdc2448c75d961bc238213cfac (diff) |
Update upstream source from tag 'upstream/0.28.2'
Update to upstream version '0.28.2'
with Debian dir 811236a8e9a1308bf427065dcb6270419ff4f965
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); } |