Use app icon for windows and about

This commit is contained in:
Avery
2023-11-18 17:31:20 -05:00
parent 0f891e5842
commit 2020e56c81
10 changed files with 51 additions and 7 deletions

10
data/icons/meson.build Normal file
View File

@@ -0,0 +1,10 @@
install_data(
'@0@.svg'.format(app_id),
install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps'
)
install_data(
'@0@-symbolic.svg'.format(base_id),
install_dir: iconsdir / 'hicolor' / 'symbolic' / 'apps',
rename: '@0@-symbolic.svg'.format(app_id)
)

1
data/meson.build Normal file
View File

@@ -0,0 +1 @@
subdir('icons')

2
delfin/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Gets generated by Meson
src/meson_config.rs

View File

@@ -1,3 +1,18 @@
config = configure_file(
input: 'src/meson_config.rs.in',
output: 'meson_config.rs',
configuration: {
'APP_ID': app_id,
},
)
run_command(
'cp',
meson.project_build_root() / 'delfin' / 'meson_config.rs',
meson.project_source_root() / 'delfin' / 'src' / 'meson_config.rs',
check: true
)
cargo_options = []
rust_target = 'debug'

View File

@@ -14,6 +14,7 @@ use crate::{
library::{Library, LibraryOutput},
locales::tera_tr,
media_details::MediaDetails,
meson_config::APP_ID,
servers::server_list::{ServerList, ServerListOutput},
tr,
utils::{main_window::MAIN_APP_WINDOW_NAME, shift_state::shift_state_controller},
@@ -107,6 +108,7 @@ impl Component for App {
root: &Self::Root,
sender: relm4::ComponentSender<Self>,
) -> relm4::ComponentParts<Self> {
gtk::Window::set_default_icon_name(APP_ID);
adw::StyleManager::default().set_color_scheme(CONFIG.read().general.theme().into());
// Use development styles when running debug build

View File

@@ -1,7 +1,7 @@
use gtk::prelude::*;
use relm4::{prelude::*, ComponentParts, SimpleComponent};
use crate::tr;
use crate::{meson_config::APP_ID, tr};
pub(crate) struct About;
@@ -18,6 +18,7 @@ impl SimpleComponent for About {
set_visible: true,
set_application_name: tr!("app-name"),
set_application_icon: APP_ID,
set_developer_name: "Avery ❤️",
set_version: "0.0",
set_license_type: gtk::License::Agpl30,

View File

@@ -7,6 +7,7 @@ pub mod jellyfin_api;
pub mod library;
pub mod locales;
pub mod media_details;
pub mod meson_config;
pub mod preferences;
pub mod servers;
pub mod utils;

View File

@@ -1,4 +1,7 @@
use delfin::app::{App, APP_BROKER};
use delfin::{
app::{App, APP_BROKER},
meson_config::APP_ID,
};
use relm4::RelmApp;
fn main() {
@@ -9,11 +12,7 @@ fn main() {
video_player_gst::init_gst();
}
let app = if cfg!(debug_assertions) {
RelmApp::new("cafe.avery.Delfin.Devel")
} else {
RelmApp::new("cafe.avery.Delfin")
};
let app = RelmApp::new(APP_ID);
relm4_icons::initialize_icons();
load_css();

View File

@@ -0,0 +1,2 @@
// Generated by Meson from meson_config.rs.in - do not modify
pub const APP_ID: &str = "@APP_ID@";

View File

@@ -6,6 +6,8 @@ project(
subproject_dir: 'video_player_mpv',
)
gnome = import('gnome')
base_id = 'cafe.avery.Delfin'
cargo = find_program('cargo', required: true)
@@ -28,5 +30,14 @@ if get_option('flatpak')
)
endif
prefix = get_option('prefix')
datadir = prefix / get_option('datadir')
iconsdir = datadir / 'icons'
subproject('sys')
subdir('delfin')
subdir('data')
gnome.post_install(
gtk_update_icon_cache: true,
)