Changes
9 changed files (+235/-5)
-
-
@@ -19,11 +19,16 @@ --><gresources> <gresource prefix="/jp/pocka/plac/gtk-adwaita"> <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> <file preprocess="xml-stripblanks">ui/generic-error-dialog.ui</file> <file preprocess="xml-stripblanks">ui/server-connecting.ui</file> <file preprocess="xml-stripblanks">ui/server-list-unexpected-error-dialog.ui</file> <file preprocess="xml-stripblanks">ui/server-list-network-error-dialog.ui</file> <file preprocess="xml-stripblanks">icons/scalable/actions/item-missing-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/actions/library-music-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/actions/pause-large-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/actions/play-large-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/actions/sound-symbolic.svg</file> </gresource> </gresources>
-
-
-
@@ -0,0 +1,6 @@<?xml version="1.0" encoding="UTF-8"?> <!-- SPDX-FileCopyrightText: Gnome Developers SPDX-License-Identifier: CC0-1.0 --> <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 5 0 c -1.09375 0 -2 0.910156 -2 2 v 9 c 0 1.089844 0.90625 2 2 2 h 9 c 1.089844 0 2 -0.910156 2 -2 v -9 c 0 -1.089844 -0.910156 -2 -2 -2 z m 8 2 v 2 h -2 v 5 c 0 1.105469 -0.898438 2 -2 2 c -1.105469 0 -2 -0.894531 -2 -2 s 0.894531 -2 2 -2 c 0.347656 0 0.695312 0.09375 1 0.269531 v -5.269531 z m 0 0"/><path d="m 2 3 c -1.09375 0 -2 0.910156 -2 2 v 9 c 0 1.089844 0.90625 2 2 2 h 9 c 1.089844 0 2 -0.910156 2 -2 h -11 z m 0 0"/></g></svg>
-
-
-
@@ -0,0 +1,6 @@<?xml version="1.0" encoding="UTF-8"?> <!-- SPDX-FileCopyrightText: Gnome Developers SPDX-License-Identifier: CC0-1.0 --> <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 13 1 h -3 c -0.554688 0 -1 0.449219 -1 1 v 12 c 0 0.550781 0.445312 1 1 1 h 3 c 0.550781 0 1 -0.449219 1 -1 v -12 c 0 -0.550781 -0.449219 -1 -1 -1 z m 0 0"/><path d="m 6 1 h -3 c -0.554688 0 -1 0.449219 -1 1 v 12 c 0 0.550781 0.445312 1 1 1 h 3 c 0.550781 0 1 -0.449219 1 -1 v -12 c 0 -0.550781 -0.449219 -1 -1 -1 z m 0 0"/></g></svg>
-
-
-
@@ -0,0 +1,6 @@<?xml version="1.0" encoding="UTF-8"?> <!-- SPDX-FileCopyrightText: Gnome Developers SPDX-License-Identifier: CC0-1.0 --> <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 2 13.492188 v -11 c 0 -1.5 1.265625 -1.492188 1.265625 -1.492188 h 0.132813 c 0.242187 0 0.484374 0.054688 0.699218 0.175781 l 9.796875 5.597657 c 0.433594 0.238281 0.65625 0.730468 0.65625 1.222656 c 0 0.492187 -0.222656 0.984375 -0.65625 1.226562 l -9.796875 5.597656 c -0.214844 0.121094 -0.457031 0.175782 -0.699218 0.171876 h -0.132813 s -1.265625 0 -1.265625 -1.5 z m 0 0" fill="#222222"/></svg>
-
-
-
@@ -0,0 +1,6 @@<?xml version="1.0" encoding="UTF-8"?> <!-- SPDX-FileCopyrightText: Gnome Developers SPDX-License-Identifier: CC0-1.0 --> <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#303030"><path d="m 2.996094 8 c 0 0.550781 -0.449219 1 -1 1 c -0.550782 0 -1 -0.449219 -1 -1 s 0.449218 -1 1 -1 c 0.550781 0 1 0.449219 1 1 z m 0 0"/><path d="m 4.996094 5 c 0.550781 0 1 0.449219 1 1 v 4 c 0 0.550781 -0.449219 1 -1 1 c -0.550782 0 -1 -0.449219 -1 -1 v -4 c 0 -0.550781 0.449218 -1 1 -1 z m 0 0"/><path d="m 7.996094 1 c 0.550781 0 1 0.480469 1 1.070312 v 11.859376 c 0 0.589843 -0.449219 1.070312 -1 1.070312 c -0.550782 0 -1 -0.480469 -1 -1.070312 v -11.859376 c 0 -0.589843 0.449218 -1.070312 1 -1.070312 z m 0 0"/><path d="m 10.90625 3 h 0.179688 c 0.503906 0 0.910156 0.476562 0.910156 1.066406 v 7.867188 c 0 0.589844 -0.40625 1.066406 -0.910156 1.066406 h -0.179688 c -0.503906 0 -0.910156 -0.476562 -0.910156 -1.066406 v -7.867188 c 0 -0.589844 0.40625 -1.066406 0.910156 -1.066406 z m 0 0"/><path d="m 13.996094 7 c 0.550781 0 1 0.449219 1 1 s -0.449219 1 -1 1 c -0.550782 0 -1 -0.449219 -1 -1 s 0.449218 -1 1 -1 z m 0 0"/></g></svg>
-
-
-
@@ -24,10 +24,24 @@ <property name="title">Plac</property><style> <class name="devel" /> </style> <child> <object class="AdwBreakpoint"> <condition>max-width: 640sp</condition> <setter object="switcher_bar" property="reveal">true</setter> <setter object="header_bar" property="title-widget" /> </object> </child> <property name="content"> <object class="AdwToolbarView"> <child type="top"> <object class="AdwHeaderBar" /> <object class="AdwHeaderBar" id="header_bar"> <property name="title-widget"> <object class="AdwViewSwitcher"> <property name="stack">stack</property> <property name="policy">wide</property> </object> </property> </object> </child> <property name="content"> <object class="GtkStack" id="root_stack">
-
@@ -35,8 +49,29 @@ <child><object class="GtkStackPage"> <property name="name">main</property> <property name="child"> <object class="GtkLabel" id="test_label"> <property name="label">Empty</property> <object class="AdwViewStack" id="stack"> <child> <object class="AdwViewStackPage"> <property name="name">playback</property> <property name="title">Playback</property> <property name="icon-name">sound-symbolic</property> <property name="child"> <object class="PlacGtkAdwaitaPlaybackToolbar" id="playback_toolbar" /> </property> </object> </child> <child> <object class="AdwViewStackPage"> <property name="name">library</property> <property name="title">Library</property> <property name="icon-name">library-music-symbolic</property> <property name="child"> <object class="GtkLabel" id="test_label"> <property name="label">Empty</property> </object> </property> </object> </child> </object> </property> </object>
-
@@ -45,13 +80,17 @@ <child><object class="GtkStackPage"> <property name="name">loading</property> <property name="child"> <object class="PlacGtkAdwaitaServerConnecting"> </object> <object class="PlacGtkAdwaitaServerConnecting" /> </property> </object> </child> </object> </property> <child type="bottom"> <object class="AdwViewSwitcherBar" id="switcher_bar"> <property name="stack">stack</property> </object> </child> </object> </property> </template>
-
-
-
@@ -0,0 +1,54 @@<?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2025 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="PlacGtkAdwaitaPlaybackToolbar" parent="GtkBox"> <property name="orientation">horizontal</property> <property name="halign">center</property> <property name="valign">end</property> <style> <class name="toolbar" /> </style> <child> <object class="GtkButton" id="play"> <property name="label">Play</property> <property name="icon-name">play-large-symbolic</property> <property name="action-name">play_current_zone</property> </object> </child> <child> <object class="GtkButton" id="pause"> <property name="label">Pause</property> <property name="icon-name">pause-large-symbolic</property> <property name="action-name">pause_current_zone</property> </object> </child> <child> <object class="GtkMenuButton"> <property name="label">Zone</property> <property name="popover"> <object class="GtkPopover"> <child> <object class="GtkListBox" id="zone_list" /> </child> </object> </property> </object> </child> </template> </interface>
-
-
-
@@ -0,0 +1,102 @@// Copyright 2025 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/playback-toolbar.ui")] class PlaybackToolbar : Gtk.Box { [GtkChild] private unowned Gtk.Button play; [GtkChild] private unowned Gtk.Button pause; [GtkChild] private unowned Gtk.ListBox zone_list; private unowned PlacCore.App core; public PlaybackToolbar() { Object(); } public void start(PlacCore.App core) { this.core = core; core.on_server_change(() => { subscribe_zone_change(); }); subscribe_zone_change(); core.lock(); render(); core.unlock(); } private void subscribe_zone_change() { if (core.server != null) { core.server.on_zone_list_loading_change(() => { GLib.Idle.add(() => { core.lock(); render(); core.unlock(); return false; }); }); core.server.load_zones(); } } public void render() { zone_list.remove_all(); if (core.server == null) { return; } unowned PlacCore.Zone? zone = null; foreach (unowned PlacCore.Zone z in core.server.zones) { if (zone == null) { zone = z; } var row = new Gtk.ListBoxRow(); var label = new Gtk.Label(z.name); row.child = label; zone_list.append(row); } if (zone == null) { return; } switch (zone.playback_state) { case STOPPED: case PAUSED: play.visible = true; pause.visible = false; break; case PLAYING: play.visible = false; pause.visible = true; break; } } } }
-
-
-
@@ -23,16 +23,22 @@[GtkChild] private unowned Gtk.Stack root_stack; [GtkChild] private unowned PlaybackToolbar playback_toolbar; private unowned PlacCore.App core; public MainWindow(Gtk.Application app, PlacCore.App core) { (typeof (ServerConnecting)).ensure(); (typeof (PlaybackToolbar)).ensure(); Object(application: app); this.core = core; } public void start() { this.playback_toolbar.start(core); core.on_connection_change(() => { GLib.Idle.add(() => { core.lock();
-