Changes
7 changed files (+247/-4)
-
-
@@ -21,6 +21,7 @@ SPDX-License-Identifier: Apache-2.0<file preprocess="xml-stripblanks">metainfo.xml</file> <file preprocess="xml-stripblanks">ui/browse.ui</file> <file preprocess="xml-stripblanks">ui/browse-item-navigation.ui</file> <file preprocess="xml-stripblanks">ui/direct-connect-dialog.ui</file> <file preprocess="xml-stripblanks">ui/main-window.ui</file> <file preprocess="xml-stripblanks">ui/playback-toolbar.ui</file> <file preprocess="xml-stripblanks">ui/server-list.ui</file>
-
-
-
@@ -0,0 +1,101 @@<?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2026 Shota FUJI Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: Apache-2.0 --> <interface> <template class="PlacGtkAdwaitaDirectConnectDialog" parent="AdwDialog"> <property name="content-width">500</property> <property name="title">Manual Connect</property> <child> <object class="AdwToolbarView"> <child type="top"> <object class="AdwHeaderBar" /> </child> <property name="content"> <object class="GtkBox"> <property name="orientation">vertical</property> <property name="spacing">16</property> <property name="margin-top">4</property> <property name="margin-bottom">16</property> <property name="margin-start">12</property> <property name="margin-end">12</property> <child> <object class="GtkLabel"> <property name="wrap">true</property> <property name="halign">start</property> <property name="natural-wrap-mode">none</property> <property name="xalign">0</property> <property name="label">Connect to Roon server at specific address. Use this if automatic discovery does not work.</property> </object> </child> <child> <object class="GtkBox"> <property name="orientation">vertical</property> <property name="spacing">4</property> <child> <object class="GtkLabel" id="ip_addr_label"> <property name="halign">start</property> <property name="xalign">0</property> <property name="label">IP address</property> </object> </child> <child> <object class="GtkEntry" id="ip_addr"> <property name="placeholder-text">192.168.1.5</property> <accessibility> <relation name="labelled-by">ip_addr_label</relation> </accessibility> </object> </child> </object> </child> <child> <object class="GtkBox"> <property name="orientation">vertical</property> <property name="spacing">4</property> <child> <object class="GtkLabel" id="port_label"> <property name="halign">start</property> <property name="xalign">0</property> <property name="label">Server port</property> </object> </child> <child> <object class="GtkEntry" id="port"> <property name="placeholder-text">9330</property> <property name="text">9330</property> <accessibility> <relation name="labelled-by">port_label</relation> </accessibility> </object> </child> </object> </child> <child> <object class="GtkButton" id="connect_button"> <property name="label">Connect</property> <style> <class name="suggested-action" /> </style> </object> </child> </object> </property> </object> </child> </template> </interface>
-
-
-
@@ -31,6 +31,12 @@ SPDX-License-Identifier: Apache-2.0<property name="action-name">win.scan_servers</property> </object> </child> <child type="start"> <object class="GtkButton" id="direct_connect_button"> <property name="label">Manual Connect</property> <property name="action-name">win.direct_connect</property> </object> </child> <child type="end"> <object class="GtkMenuButton"> <property name="direction">none</property>
-
-
-
@@ -200,7 +200,7 @@ namespace Plac {} public static async Connection connect_async( GLib.InetSocketAddress address, uint16 http_port, string server_id, GLib.InetSocketAddress address, uint16 http_port, string? server_id, Roon.Registry.Register.Request req, GLib.Cancellable? cancellable = null ) throws ConnectError {
-
@@ -219,10 +219,14 @@ namespace Plac {throw new ConnectError.SERVER_NOT_FOUND(error.message); } if (info.core_id != server_id) { if (server_id != null && info.core_id != server_id) { throw new ConnectError.SERVER_MISMATCH("Server at the location has different server ID."); } if (info.core_id == null) { throw new ConnectError.SERVER_NOT_FOUND("WebSocket server found, but received empty server ID."); } GLib.log("Plac", LEVEL_DEBUG, "Confirmed the Roon server is running. Registering extension."); Response register_resp;
-
@@ -253,7 +257,7 @@ namespace Plac {return new Connection( conn, new Server(address, server_id, info.display_version, info.display_name, http_port), new Server(address, info.core_id, info.display_version, info.display_name, http_port), result.token ); }
-
-
-
@@ -0,0 +1,106 @@// Copyright 2026 Shota FUJI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 namespace PlacGtkAdwaita { [GtkTemplate(ui = "/jp/pocka/plac/gtk-adwaita/ui/direct-connect-dialog.ui")] class DirectConnectDialog : Adw.Dialog { public signal void submit(GLib.InetSocketAddress sock_addr); [GtkChild] private unowned Gtk.Entry ip_addr; [GtkChild] private unowned Gtk.Entry port; [GtkChild] private unowned Gtk.Button connect_button; public DirectConnectDialog() { Object(); } construct { connect_button.clicked.connect(() => { var sock_addr = get_sock_addr(); if (sock_addr != null) { submit(sock_addr); } }); } /** * Returns `null` if any field has invalid (un-parsable) input text. */ private GLib.InetSocketAddress? get_sock_addr() { GLib.InetAddress? a = null; uint16? p = null; a = parse_ip_addr(); p = parse_port(); if (a == null) { ip_addr.tooltip_text = "Must be valid IPv4 or IPv6 address, without port number"; ip_addr.add_css_class("error"); ip_addr.update_state(Gtk.AccessibleState.INVALID, Gtk.AccessibleInvalidState.TRUE, -1); } else { ip_addr.tooltip_text = ""; ip_addr.remove_css_class("error"); ip_addr.reset_state(Gtk.AccessibleState.INVALID); } if (p == null) { port.tooltip_text = "Must be valid port number"; port.add_css_class("error"); port.update_state(Gtk.AccessibleState.INVALID, Gtk.AccessibleInvalidState.TRUE, -1); } else { port.tooltip_text = ""; port.remove_css_class("error"); port.reset_state(Gtk.AccessibleState.INVALID); } if (a == null || p == null) { return null; } return new GLib.InetSocketAddress(a, p); } /** * Returns `null` if the input text is not valid IP address. */ private GLib.InetAddress? parse_ip_addr() { var value = ip_addr.text.strip(); return new GLib.InetAddress.from_string(value); } /** * Returns `null` if the input text is not valid port number. */ private uint16? parse_port() { try { var value = port.text.strip(); uint64 n = 0; uint64.from_string(value, out n, 10, uint16.MIN, uint16.MAX); // "uint64.from_string" checks value range. return (uint16)n; } catch { return null; } } } }
-
-
-
@@ -78,7 +78,7 @@ namespace PlacGtkAdwaita {private Plac.Server? server = null; private Plac.ZonesModel? zones = null; private string server_id; private string? server_id; public MainWindow(Gtk.Application app, Plac.Server server) { (typeof (Artwork)).ensure();
-
@@ -99,6 +99,16 @@ namespace PlacGtkAdwaita {this.server_id = server_id; } public MainWindow.from_sock_addr(Gtk.Application app, GLib.InetSocketAddress sock_addr) { (typeof (Artwork)).ensure(); (typeof (ServerConnecting)).ensure(); (typeof (PlaybackToolbar)).ensure(); Object(application: app); settings.connected_server_addr = sock_addr.address.to_string(); settings.connected_server_port = (uint16)sock_addr.port; } construct { var provider = new Gtk.CssProvider(); provider.load_from_resource("/jp/pocka/plac/gtk-adwaita/css/main-window.css");
-
-
-
@@ -76,6 +76,21 @@ namespace PlacGtkAdwaita {} public void start() { var direct_connect_action = new SimpleAction("direct_connect", null); direct_connect_action.activate.connect(() => { var dialog = new DirectConnectDialog(); dialog.present(this); dialog.submit.connect((sock_addr) => { scanner.stop(); var window = new MainWindow.from_sock_addr(application, sock_addr); window.start(); dialog.close(); this.close(); }); }); this.add_action(direct_connect_action); var scan_action = new SimpleAction("scan_servers", null); scan_action.activate.connect(this.scan); this.add_action(scan_action);
-