From f59edc0733058590c14ad37956e43c4095abbcb5 Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Fri, 11 Aug 2017 19:29:51 +0200 Subject: [PATCH] removed spinner by application icon --- src/Widgets/WebApp.vala | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Widgets/WebApp.vala b/src/Widgets/WebApp.vala index 4d797b4..c761269 100644 --- a/src/Widgets/WebApp.vala +++ b/src/Widgets/WebApp.vala @@ -71,16 +71,9 @@ namespace Webpin { app_view = new WebKit.WebView.with_context (WebKit.WebContext.get_default ()); app_view.load_uri (app_url); - //loading view - var spinner = new Gtk.Spinner(); - spinner.active = true; - spinner.halign = Gtk.Align.CENTER; - spinner.valign = Gtk.Align.CENTER; - spinner.set_size_request (32, 32); container = new Gtk.Box(Gtk.Orientation.VERTICAL, 0); container.halign = Gtk.Align.FILL; container.valign = Gtk.Align.FILL; - container.pack_start(spinner, true, true, 0); app_notification = new Granite.Widgets.Toast (""); @@ -112,6 +105,20 @@ namespace Webpin { } } + var icon_file = File.new_for_path (file.icon); + + Gtk.Image icon; + if (icon_file.query_exists ()) { + try { + icon = new Gtk.Image.from_pixbuf (new Gdk.Pixbuf.from_file_at_scale (file.icon, 48, 48, true)); + } catch (Error e) { + warning (e.message); + icon = new Gtk.Image.from_icon_name ("artemanufrij.webpin", Gtk.IconSize.DIALOG); + } + } else { + icon = new Gtk.Image.from_icon_name (file.icon, Gtk.IconSize.DIALOG); + } + container.pack_start(icon, true, true, 0); Gdk.RGBA background = {}; if (!background.parse (ui_color)){