From 16fe2e5d0525422ba6ca5db9e92a93d17caae302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 27 Sep 2015 15:05:13 +0200 Subject: Imported Upstream version 0.6.6 --- src/gui/themeList.vala | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/gui/themeList.vala') diff --git a/src/gui/themeList.vala b/src/gui/themeList.vala index 517c6d5..46ae876 100644 --- a/src/gui/themeList.vala +++ b/src/gui/themeList.vala @@ -51,9 +51,6 @@ class ThemeList : Gtk.TreeView { public ThemeList() { GLib.Object(); - var data = new Gtk.ListStore(2, typeof(Gdk.Pixbuf), - typeof(string)); - this.set_model(data); this.set_headers_visible(true); this.set_grid_lines(Gtk.TreeViewGridLines.NONE); this.set_fixed_height_mode(true); @@ -79,7 +76,7 @@ class ThemeList : Gtk.TreeView { Gtk.TreeIter active; if (this.get_selection().get_selected(null, out active)) { Timeout.add(10, () => { - int index = int.parse(data.get_path(active).to_string()); + int index = int.parse(this.model.get_path(active).to_string()); Config.global.theme = Config.global.themes[index]; this.on_select_new(); @@ -91,6 +88,15 @@ class ThemeList : Gtk.TreeView { } }); + reload(); + } + + public void reload() { + + var data = new Gtk.ListStore(2, typeof(Gdk.Pixbuf), + typeof(string)); + this.set_model(data); + // load all themes into the list var themes = Config.global.themes; foreach(var theme in themes) { @@ -99,10 +105,10 @@ class ThemeList : Gtk.TreeView { data.set(current, DataPos.ICON, theme.preview_icon.to_pixbuf()); data.set(current, DataPos.NAME, GLib.Markup.escape_text(theme.name)+"\n" + "" + GLib.Markup.escape_text(theme.description) - + " - "+GLib.Markup.escape_text(_("By")+" "+theme.author) - + ""); - if(theme == Config.global.theme) + + ""); + if(theme == Config.global.theme) { get_selection().select_iter(current); + } } } } -- cgit v1.2.3