feat: dynamic server list
* Changed runtime from `master` to `42` * Delete .vscode directory * added dynamic server list * Create main.yml * Update main.yml * Update main.yml * Delete rust.yamlmaster
parent
345b147125
commit
a7eced0792
|
@ -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 }}
|
|
@ -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
|
|
@ -4,5 +4,6 @@
|
|||
<!-- see https://gtk-rs.org/gtk4-rs/git/docs/gtk4/struct.Application.html#automatic-resources -->
|
||||
<file compressed="true" preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">ui/shortcuts.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">ui/server_entry.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="ServerEntry" parent="GtkListBoxRow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">0</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="AdwAvatar">
|
||||
<property name="halign">start</property>
|
||||
<property name="text">among us</property>
|
||||
<property name="size">24</property>
|
||||
<property name="show-initials">true</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">False</property>
|
||||
<property name="label" translatable="yes">Among Us</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="halign">end</property>
|
||||
<property name="icon_name">go-next-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
|
@ -37,6 +37,13 @@
|
|||
<object class="GtkBox" id="title_box">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="AdwAvatar">
|
||||
<property name="text">among us</property>
|
||||
<property name="size">24</property>
|
||||
<property name="show-initials">true</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwWindowTitle" id="sidebar_title_widget">
|
||||
<property name="title" translatable="yes">Mutiny</property>
|
||||
|
@ -54,36 +61,14 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="width-request">300</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vexpand">true</property>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<object class="GtkListBox" id="server_list">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">24</property>
|
||||
<property name="margin-end">24</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="AdwAvatar">
|
||||
<property name="text">among us</property>
|
||||
<property name="size">24</property>
|
||||
<property name="show-initials">true</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Among Us</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon_name">go-next-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="ServerEntry"></object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -2,6 +2,7 @@ mod application;
|
|||
#[rustfmt::skip]
|
||||
mod config;
|
||||
mod window;
|
||||
mod server_entry;
|
||||
|
||||
use gettextrs::{gettext, LocaleCategory};
|
||||
use gtk::{gio, glib};
|
||||
|
|
|
@ -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<Self>) {
|
||||
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<imp::ServerEntry>)
|
||||
@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")
|
||||
}
|
||||
}
|
|
@ -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<adw::HeaderBar>,
|
||||
#[template_child]
|
||||
pub server_list: TemplateChild<gtk::ListBox>,
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue