slide up splash screen

This commit is contained in:
Artem Anufrij 2017-08-11 20:44:00 +02:00
parent 37ef2d3e6a
commit 4cd5c8a6b3

View file

@ -35,7 +35,7 @@ namespace Webpin {
private GLib.DesktopAppInfo info; private GLib.DesktopAppInfo info;
private DesktopFile file; private DesktopFile file;
private WebKit.CookieManager cookie_manager; private WebKit.CookieManager cookie_manager;
private Gtk.Box container; //the spinner container private Gtk.Box container;
Granite.Widgets.Toast app_notification; Granite.Widgets.Toast app_notification;
public signal void external_request (WebKit.NavigationAction action); public signal void external_request (WebKit.NavigationAction action);
@ -80,10 +80,12 @@ namespace Webpin {
//overlay trick to make snapshot work even with the spinner //overlay trick to make snapshot work even with the spinner
var overlay = new Gtk.Overlay (); var overlay = new Gtk.Overlay ();
overlay.add (app_view); overlay.add (app_view);
overlay.add_overlay (container);
overlay.add_overlay (app_notification); overlay.add_overlay (app_notification);
add (overlay); add_named (container, "splash");
add_named (overlay, "app");
transition_type = Gtk.StackTransitionType.SLIDE_UP;
app_view.create.connect ((action) => { app_view.create.connect ((action) => {
print("external request"); print("external request");
@ -160,35 +162,35 @@ namespace Webpin {
} catch (Error e) { } catch (Error e) {
warning (e.message); warning (e.message);
} }
// data ist in BGRA apparently (according to testing). Docs said ARGB, but that
// appears not to be the case
unowned uint8[] data = snap.get_data ();
uint8 r = data[2]; if (snap != null) {
uint8 g = data[1]; // data ist in BGRA apparently (according to testing). Docs said ARGB, but that
uint8 b = data[0]; // appears not to be the case
unowned uint8[] data = snap.get_data ();
for (var i = 4; i < snap.get_width () * 3 * 4; i += 4) { uint8 r = data[2];
r = (r + data[i + 2]) / 2; uint8 g = data[1];
g = (g + data[i + 1]) / 2; uint8 b = data[0];
b = (b + data[i + 0]) / 2;
}
var color = "#%02x%02x%02x".printf (r, g, b); for (var i = 4; i < snap.get_width () * 3 * 4; i += 4) {
r = (r + data[i + 2]) / 2;
g = (g + data[i + 1]) / 2;
b = (b + data[i + 0]) / 2;
}
if (color != ui_color) { var color = "#%02x%02x%02x".printf (r, g, b);
ui_color = color;
Gdk.RGBA background = {}; if (color != ui_color) {
background.parse (ui_color); ui_color = color;
container.override_background_color (Gtk.StateFlags.NORMAL, background); Gdk.RGBA background = {};
theme_color_changed(ui_color); background.parse (ui_color);
if (file != null) container.override_background_color (Gtk.StateFlags.NORMAL, background);
file.edit_propertie ("WebpinThemeColor", ui_color); theme_color_changed(ui_color);
if (file != null)
file.edit_propertie ("WebpinThemeColor", ui_color);
}
} }
if(container.visible) { visible_child_name = "app";
container.visible = false;
}
request_finished (); request_finished ();
} }
} }