Changes
3 changed files (+42/-3)
-
-
@@ -101,6 +101,16 @@ <class name="error" /></style> </object> </child> <child type="overlay"> <object class="AdwBanner" id="closed_banner"> <property name="valign">start</property> <property name="title">Connection Closed</property> <property name="button-label">Reconnect</property> <style> <class name="error" /> </style> </object> </child> </object> </property> <child type="bottom">
-
-
-
@@ -177,8 +177,12 @@return conn; } // TODO: Handle connection close and reconnect public class Connection : Object { /** * Server closed a connection, or network error terminated a connection. */ public signal void closed(); private size_t request_id = 1; public Soup.WebsocketConnection conn { get; construct; }
-
@@ -187,6 +191,12 @@ public string token { get; construct; }public Connection(Soup.WebsocketConnection conn, Server server, string token) { Object(conn: conn, server: server, token: token); } construct { conn.closed.connect(() => { this.closed(); }); } public static async Connection connect_async(
-
-
-
@@ -41,6 +41,9 @@ [GtkChild]private unowned Adw.Banner error_banner; [GtkChild] private unowned Adw.Banner closed_banner; [GtkChild] private unowned Browse browse; [GtkChild]
-
@@ -49,7 +52,6 @@private Settings settings = new Settings(); private Plac.Server? server = null; private Plac.Connection? conn = null; private Plac.ZonesModel? zones = null; private string server_id;
-
@@ -86,6 +88,12 @@ connect_async.end(res);}); }); closed_banner.button_clicked.connect(() => { connect_async.begin((_obj, res) => { connect_async.end(res); }); }); var explore_row = new BrowseHierarchyRow(BROWSE, "Explore"); browse_hierarchy.append(explore_row); browse_hierarchy.select_row(explore_row);
-
@@ -125,6 +133,8 @@ });} private async void connect_async() { closed_banner.revealed = false; Plac.WebSocketConnectable dest; if (server != null) { dest = server;
-
@@ -208,7 +218,16 @@ var conn = yield Plac.Connection.connect_async(dest.address, dest.http_port, server_id, req ); this.conn = conn; browse.sensitive = true; playback_toolbar.sensitive = true; conn.closed.connect(() => { GLib.log("Plac", LEVEL_INFO, "Connection closed."); browse.sensitive = false; playback_toolbar.sensitive = false; closed_banner.revealed = true; }); this.server = conn.server; this.title = "Plac - %s".printf(server.name);
-