show spinner in the headerbar when page is loading
This commit is contained in:
parent
2ac4804bf7
commit
5eb6de86b1
2 changed files with 25 additions and 2 deletions
|
@ -36,6 +36,8 @@ namespace Webpin {
|
||||||
//widgets
|
//widgets
|
||||||
private WebApp web_app;
|
private WebApp web_app;
|
||||||
|
|
||||||
|
Gtk.Spinner spinner;
|
||||||
|
|
||||||
public WebWindow (string webapp_name, string webapp_uri) {
|
public WebWindow (string webapp_name, string webapp_uri) {
|
||||||
|
|
||||||
set_wmclass(webapp_uri, webapp_uri);
|
set_wmclass(webapp_uri, webapp_uri);
|
||||||
|
@ -44,6 +46,11 @@ namespace Webpin {
|
||||||
var headerbar = new Gtk.HeaderBar ();
|
var headerbar = new Gtk.HeaderBar ();
|
||||||
headerbar.title = webapp_name;
|
headerbar.title = webapp_name;
|
||||||
headerbar.show_close_button = true;
|
headerbar.show_close_button = true;
|
||||||
|
|
||||||
|
spinner = new Gtk.Spinner ();
|
||||||
|
spinner.set_size_request (16, 16);
|
||||||
|
headerbar.pack_end (spinner);
|
||||||
|
|
||||||
//style
|
//style
|
||||||
if (web_app.ui_color != "none") {
|
if (web_app.ui_color != "none") {
|
||||||
try {
|
try {
|
||||||
|
@ -97,6 +104,14 @@ namespace Webpin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
web_app.request_begin.connect (() => {
|
||||||
|
spinner.active = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
web_app.request_finished.connect (() => {
|
||||||
|
spinner.active = false;
|
||||||
|
});
|
||||||
|
|
||||||
add(web_app);
|
add(web_app);
|
||||||
show_all();
|
show_all();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ namespace Webpin {
|
||||||
|
|
||||||
public signal void external_request (WebKit.NavigationAction action);
|
public signal void external_request (WebKit.NavigationAction action);
|
||||||
public signal void theme_color_changed(string color);
|
public signal void theme_color_changed(string color);
|
||||||
|
public signal void request_begin ();
|
||||||
|
public signal void request_finished ();
|
||||||
|
|
||||||
|
|
||||||
public WebApp (string webapp_name, string app_url) {
|
public WebApp (string webapp_name, string app_url) {
|
||||||
|
|
||||||
|
@ -73,7 +76,7 @@ namespace Webpin {
|
||||||
spinner.active = true;
|
spinner.active = true;
|
||||||
spinner.halign = Gtk.Align.CENTER;
|
spinner.halign = Gtk.Align.CENTER;
|
||||||
spinner.valign = Gtk.Align.CENTER;
|
spinner.valign = Gtk.Align.CENTER;
|
||||||
spinner.set_size_request (24, 24);
|
spinner.set_size_request (32, 32);
|
||||||
container = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
|
container = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
|
||||||
container.halign = Gtk.Align.FILL;
|
container.halign = Gtk.Align.FILL;
|
||||||
container.valign = Gtk.Align.FILL;
|
container.valign = Gtk.Align.FILL;
|
||||||
|
@ -118,6 +121,7 @@ namespace Webpin {
|
||||||
|
|
||||||
//update theme color if changed
|
//update theme color if changed
|
||||||
app_view.load_changed.connect ( (load_event) => {
|
app_view.load_changed.connect ( (load_event) => {
|
||||||
|
request_begin ();
|
||||||
if (load_event == WebKit.LoadEvent.FINISHED) {
|
if (load_event == WebKit.LoadEvent.FINISHED) {
|
||||||
debug ("determine color");
|
debug ("determine color");
|
||||||
determine_theme_color.begin();
|
determine_theme_color.begin();
|
||||||
|
@ -174,7 +178,11 @@ namespace Webpin {
|
||||||
if (file != null)
|
if (file != null)
|
||||||
file.edit_propertie ("WebpinThemeColor", ui_color);
|
file.edit_propertie ("WebpinThemeColor", ui_color);
|
||||||
}
|
}
|
||||||
container.set_visible(false);
|
if(container.visible) {
|
||||||
|
container.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
request_finished ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue