mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
feat: print warning if gui and daemon versions mismatch
This commit is contained in:
@@ -2,7 +2,7 @@ mod apply_revealer;
|
||||
mod header;
|
||||
mod root_stack;
|
||||
|
||||
use crate::APP_ID;
|
||||
use crate::{APP_ID, GUI_VERSION};
|
||||
use anyhow::{anyhow, Context};
|
||||
use apply_revealer::ApplyRevealer;
|
||||
use glib::clone;
|
||||
@@ -51,6 +51,12 @@ impl App {
|
||||
.get_system_info()
|
||||
.expect("Could not fetch system info");
|
||||
let system_info = system_info_buf.inner().expect("Invalid system info buffer");
|
||||
|
||||
if system_info.version != GUI_VERSION {
|
||||
let err = anyhow!("Version mismatch between GUI and daemon ({GUI_VERSION} vs {})! Make sure you have restarted the service if you have updated LACT.", system_info.version);
|
||||
show_error(&window, err);
|
||||
}
|
||||
|
||||
let root_stack = RootStack::new(system_info, daemon_client.embedded);
|
||||
|
||||
header.set_switcher_stack(&root_stack.container);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::GUI_VERSION;
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
use lact_client::schema::SystemInfo;
|
||||
@@ -52,13 +53,12 @@ pub fn software_page(system_info: SystemInfo, embedded: bool) -> Grid {
|
||||
1,
|
||||
);
|
||||
|
||||
let gui_version = env!("CARGO_PKG_VERSION");
|
||||
let gui_profile = if cfg!(debug_assertions) {
|
||||
"debug"
|
||||
} else {
|
||||
"release"
|
||||
};
|
||||
let gui_version = format!("{gui_version}-{gui_profile}");
|
||||
let gui_version = format!("{GUI_VERSION}-{gui_profile}");
|
||||
|
||||
let gui_version_label = Label::builder()
|
||||
.use_markup(true)
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::os::unix::net::UnixStream;
|
||||
use tracing::{error, info, metadata::LevelFilter};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
const GUI_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const APP_ID: &str = "io.github.lact-linux";
|
||||
|
||||
pub fn run(args: GuiArgs) -> anyhow::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user