place ui code in own directory

This commit is contained in:
Erica Z 2024-10-13 09:41:01 +00:00
parent 94107f9e60
commit 4256778e95
9 changed files with 21 additions and 21 deletions

View file

@ -21,7 +21,7 @@ public class Application : Adw.Application {
public override void activate () { public override void activate () {
base.activate (); base.activate ();
// if this.active_window not null, this isnt the primary instance // if this.active_window not null, this isnt the primary instance
var win = this.active_window ?? new Window (this); var win = this.active_window ?? new Ui.Window (this);
win.present (); win.present ();
} }

View file

@ -3,8 +3,8 @@
<gresource prefix="/eu/callcc/audrey"> <gresource prefix="/eu/callcc/audrey">
<file>audrey.css</file> <file>audrey.css</file>
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file> <file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
<file preprocess="xml-stripblanks">play_queue.ui</file> <file preprocess="xml-stripblanks">ui/play_queue.ui</file>
<file preprocess="xml-stripblanks">setup.ui</file> <file preprocess="xml-stripblanks">ui/setup.ui</file>
<file preprocess="xml-stripblanks">window.ui</file> <file preprocess="xml-stripblanks">ui/window.ui</file>
</gresource> </gresource>
</gresources> </gresources>

View file

@ -3,10 +3,10 @@ audrey_sources = [
'application.vala', 'application.vala',
'main.vala', 'main.vala',
'mpris.vala', 'mpris.vala',
'play_queue.vala',
'playbin.vala', 'playbin.vala',
'setup.vala', 'ui/play_queue.vala',
'window.vala', 'ui/setup.vala',
'ui/window.vala',
] ]
audrey_deps = [ audrey_deps = [
@ -22,9 +22,9 @@ audrey_deps = [
blueprints = custom_target('blueprints', blueprints = custom_target('blueprints',
input: files( input: files(
'play_queue.blp', 'ui/play_queue.blp',
'setup.blp', 'ui/setup.blp',
'window.blp', 'ui/window.blp',
), ),
output: [ output: [
'play_queue.ui', 'play_queue.ui',

View file

@ -1,7 +1,7 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $PlayQueue: Adw.NavigationPage { template $UiPlayQueue: Adw.NavigationPage {
title: _("Play queue"); title: _("Play queue");
Adw.ToolbarView { Adw.ToolbarView {

View file

@ -1,5 +1,5 @@
[GtkTemplate (ui = "/eu/callcc/audrey/play_queue.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue.ui")]
public class PlayQueue : Adw.NavigationPage { public class Ui.PlayQueue : Adw.NavigationPage {
public ListStore songs { get; private set; } public ListStore songs { get; private set; }
public uint selected_index { get; set; } public uint selected_index { get; set; }

View file

@ -1,7 +1,7 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $Setup: Adw.PreferencesDialog { template $UiSetup: Adw.PreferencesDialog {
title: _("Setup"); title: _("Setup");
Adw.ToolbarView { Adw.ToolbarView {

View file

@ -1,8 +1,8 @@
[CCode (cname = "sqlite3_randomness")] [CCode (cname = "sqlite3_randomness")]
public extern void randomness (int N, void *P); public extern void randomness (int N, void *P);
[GtkTemplate (ui = "/eu/callcc/audrey/setup.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/ui/setup.ui")]
public class Setup : Adw.PreferencesDialog { public class Ui.Setup : Adw.PreferencesDialog {
public string status { get; private set; default = _("Not connected"); } public string status { get; private set; default = _("Not connected"); }
public bool authn_can_edit { get; private set; default = true; } public bool authn_can_edit { get; private set; default = true; }

View file

@ -1,7 +1,7 @@
using Gtk 4.0; using Gtk 4.0;
using Adw 1; using Adw 1;
template $Window: Adw.ApplicationWindow { template $UiWindow: Adw.ApplicationWindow {
title: _("audrey"); title: _("audrey");
default-width: 800; default-width: 800;
default-height: 600; default-height: 600;
@ -81,7 +81,7 @@ paintable: bind template.playing_cover_art;
name: "play_queue"; name: "play_queue";
title: _("Play queue"); title: _("Play queue");
child: $PlayQueue play_queue {}; child: $UiPlayQueue play_queue {};
} }
} }
} }

View file

@ -1,10 +1,10 @@
[GtkTemplate (ui = "/eu/callcc/audrey/window.ui")] [GtkTemplate (ui = "/eu/callcc/audrey/ui/window.ui")]
class Window : Adw.ApplicationWindow { class Ui.Window : Adw.ApplicationWindow {
[GtkChild] private unowned Gtk.ListBox sidebar; [GtkChild] private unowned Gtk.ListBox sidebar;
[GtkChild] private unowned Gtk.ListBoxRow sidebar_play_queue; [GtkChild] private unowned Gtk.ListBoxRow sidebar_play_queue;
[GtkChild] private unowned Gtk.Stack stack; [GtkChild] private unowned Gtk.Stack stack;
[GtkChild] public unowned PlayQueue play_queue; [GtkChild] public unowned Ui.PlayQueue play_queue;
[GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks; [GtkChild] public unowned Adw.ButtonRow shuffle_all_tracks;
private Setup setup; private Setup setup;