diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d188d55 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,19 @@ +on: + push: + branches: [master] + pull_request: +name: CI +jobs: + flatpak: + name: "Flatpak" + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:gnome-40 + options: --privileged + steps: + - uses: actions/checkout@v2 + - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 + with: + bundle: mutiny.flatpak + manifest-path: build-aux/chat.revolt.Mutiny.Devel.json + cache-key: flatpak-builder-${{ github.sha }} diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml deleted file mode 100644 index 7430d88..0000000 --- a/.github/workflows/rust.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Rust Build and Test - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - check: - name: Rust project - runs-on: ubuntu-latest - container: ubuntu:devel - steps: - - uses: actions/checkout@v2 - - - name: Install dependencies - env: - TZ: Europe/London - run: | - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - apt-get update - apt-get install -y curl build-essential pkg-config libgtk-4-dev libadwaita-1-dev - - - name: Install latest nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - components: rustfmt, clippy - - - name: Run cargo build - uses: actions-rs/cargo@v1 - with: - command: build - - - name: Run cargo test - uses: actions-rs/cargo@v1 - with: - command: test - - - uses: actions/upload-artifact@v3 - with: - name: mutiny - path: target/debug/mutiny diff --git a/data/resources/resources.gresource.xml b/data/resources/resources.gresource.xml index 09be358..ae44078 100644 --- a/data/resources/resources.gresource.xml +++ b/data/resources/resources.gresource.xml @@ -4,5 +4,6 @@ ui/shortcuts.ui ui/window.ui + ui/server_entry.ui diff --git a/data/resources/ui/server_entry.ui b/data/resources/ui/server_entry.ui new file mode 100644 index 0000000..02555c4 --- /dev/null +++ b/data/resources/ui/server_entry.ui @@ -0,0 +1,35 @@ + + + + \ No newline at end of file diff --git a/data/resources/ui/window.ui b/data/resources/ui/window.ui index bf9eba6..90adccc 100644 --- a/data/resources/ui/window.ui +++ b/data/resources/ui/window.ui @@ -37,6 +37,13 @@ horizontal 6 + + + among us + 24 + true + + Mutiny @@ -54,36 +61,14 @@ - + + 300 + never + true - + - - 24 - 24 - 12 - 12 - 12 - - - among us - 24 - true - - - - - True - Among Us - 0 - - - - - go-next-symbolic - - - + diff --git a/src/main.rs b/src/main.rs index ba84b35..8f8de29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ mod application; #[rustfmt::skip] mod config; mod window; +mod server_entry; use gettextrs::{gettext, LocaleCategory}; use gtk::{gio, glib}; diff --git a/src/server_entry.rs b/src/server_entry.rs new file mode 100644 index 0000000..36ce2cf --- /dev/null +++ b/src/server_entry.rs @@ -0,0 +1,59 @@ +use adw::subclass::prelude::*; +use gtk::prelude::*; +use gtk::subclass::prelude::*; +use gtk::glib; + +mod imp { + use super::*; + + use gtk::CompositeTemplate; + + #[derive(Debug, CompositeTemplate)] + #[template(resource="/chat/revolt/Mutiny/ui/server_entry.ui")] + pub struct ServerEntry { + + } + + impl Default for ServerEntry { + fn default() -> Self { + Self { } + } + } + + #[glib::object_subclass] + impl ObjectSubclass for ServerEntry { + const NAME: &'static str = "ServerEntry"; + type Type = super::ServerEntry; + type ParentType = gtk::ListBoxRow; + + fn class_init(klass: &mut Self::Class) { + + klass.bind_template(); + } + + fn instance_init(obj: &glib::subclass::InitializingObject) { + obj.init_template(); + } + } + + impl ObjectImpl for ServerEntry { + fn constructed(&self, obj: &Self::Type) { + self.parent_constructed(obj); + } + } + + impl WidgetImpl for ServerEntry {} + impl ListBoxRowImpl for ServerEntry {} +} + +glib::wrapper! { + pub struct ServerEntry(ObjectSubclass) + @extends gtk::Widget, gtk::ListBoxRow, + @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; +} + +impl ServerEntry { + pub fn new() -> Self { + glib::Object::new(&[]).expect("Failed to create ServerEntry") + } +} \ No newline at end of file diff --git a/src/window.rs b/src/window.rs index 1fce7d8..cc3fdee 100644 --- a/src/window.rs +++ b/src/window.rs @@ -7,6 +7,8 @@ use crate::application::MutinyApp; use crate::config::{APP_ID, PROFILE}; mod imp { + use crate::server_entry::ServerEntry; + use super::*; use gtk::CompositeTemplate; @@ -16,6 +18,8 @@ mod imp { pub struct MutinyAppWindow { // #[template_child] // pub headerbar: TemplateChild, + #[template_child] + pub server_list: TemplateChild, pub settings: gio::Settings, } @@ -23,6 +27,7 @@ mod imp { fn default() -> Self { Self { // headerbar: TemplateChild::default(), + server_list: TemplateChild::default(), settings: gio::Settings::new(APP_ID), } } @@ -35,6 +40,8 @@ mod imp { type ParentType = adw::ApplicationWindow; fn class_init(klass: &mut Self::Class) { + ServerEntry::ensure_type(); + Self::bind_template(klass); } @@ -55,6 +62,11 @@ mod imp { // Load latest window state obj.load_window_size(); + + for _ in 0..100 { + self.server_list.append(&ServerEntry::new()); + } + } }