From 3124838c75912a7e8b27ce1c746aa5d806157c0a Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Sun, 26 Nov 2017 14:34:18 +0100 Subject: [PATCH] color background --- src/Widgets/Browser.vala | 11 +++++++++++ src/Windows/WebApp.vala | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Widgets/Browser.vala b/src/Widgets/Browser.vala index 06ea8d7..7b6aefb 100644 --- a/src/Widgets/Browser.vala +++ b/src/Widgets/Browser.vala @@ -67,6 +67,17 @@ namespace Webpin.Widgets { container = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); + if (desktop_file.color != null) { + var css_provider = Gtk.CssProvider.get_default (); + try { + css_provider.load_from_data (""" .box { background: """ + desktop_file.color.to_string () + """; } """); + } catch (Error err) { + warning (err.message); + } + container.get_style_context ().add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + container.get_style_context ().add_class ("box"); + } + app_notification = new Granite.Widgets.Toast (""); var overlay = new Gtk.Overlay (); diff --git a/src/Windows/WebApp.vala b/src/Windows/WebApp.vala index 4db5791..056015d 100644 --- a/src/Windows/WebApp.vala +++ b/src/Windows/WebApp.vala @@ -54,7 +54,7 @@ namespace Webpin.Windows { var copy_url = new Gtk.Button.from_icon_name ("insert-link-symbolic", Gtk.IconSize.MENU); copy_url.tooltip_text = _("Copy URL into clipboard"); copy_url.clicked.connect (() => { - Gtk.Clipboard.get_default (Gdk.Display.get_default ()).set_text (browser.app_view.uri, -1); + Gtk.Clipboard.get_default (Gdk.Display.get_default ()).set_text (browser.web_view.uri, -1); }); headerbar.pack_end (copy_url); @@ -161,7 +161,7 @@ namespace Webpin.Windows { } if (zoom != null) { - browser.app_view.zoom_level = double.parse (zoom); + browser.web_view.zoom_level = double.parse (zoom); } } @@ -186,43 +186,43 @@ namespace Webpin.Windows { case Gdk.Key.KP_Add: case Gdk.Key.plus: if (Gdk.ModifierType.CONTROL_MASK in event.state) { - browser.app_view.zoom_level += 0.1; - desktop_file.edit_property ("X-Webpin-WindowZoom", browser.app_view.zoom_level.to_string ()); + browser.web_view.zoom_level += 0.1; + desktop_file.edit_property ("X-Webpin-WindowZoom", browser.web_view.zoom_level.to_string ()); return true; } break; case Gdk.Key.KP_Subtract: case Gdk.Key.minus: if (Gdk.ModifierType.CONTROL_MASK in event.state) { - browser.app_view.zoom_level -= 0.1; - desktop_file.edit_property ("X-Webpin-WindowZoom", browser.app_view.zoom_level.to_string ()); + browser.web_view.zoom_level -= 0.1; + desktop_file.edit_property ("X-Webpin-WindowZoom", browser.web_view.zoom_level.to_string ()); return true; } break; case Gdk.Key.KP_0: case Gdk.Key.@0: if (Gdk.ModifierType.CONTROL_MASK in event.state) { - browser.app_view.zoom_level = 1; - desktop_file.edit_property ("X-Webpin-WindowZoom", browser.app_view.zoom_level.to_string ()); + browser.web_view.zoom_level = 1; + desktop_file.edit_property ("X-Webpin-WindowZoom", browser.web_view.zoom_level.to_string ()); return true; } break; case Gdk.Key.F5: if (Gdk.ModifierType.CONTROL_MASK in event.state) { - browser.app_view.reload (); + browser.web_view.reload (); } else { - browser.app_view.reload_bypass_cache (); + browser.web_view.reload_bypass_cache (); } return true; case Gdk.Key.Left: if (Gdk.ModifierType.MOD1_MASK in event.state) { - browser.app_view.go_back (); + browser.web_view.go_back (); return true; } break; case Gdk.Key.Right: if (Gdk.ModifierType.MOD1_MASK in event.state) { - browser.app_view.go_forward (); + browser.web_view.go_forward (); return true; } break;