feat(modulo): implement already_running flag on welcome gui

This commit is contained in:
Federico Terzi 2021-07-23 22:14:44 +02:00
parent 2d559b7fb0
commit 56502fd0e5
5 changed files with 12 additions and 0 deletions

View File

@ -126,6 +126,8 @@ typedef struct WelcomeMetadata {
const char *window_icon_path; const char *window_icon_path;
const char *tray_image_path; const char *tray_image_path;
const int already_running;
// METHODS // METHODS
int (*dont_show_again_changed)(int); int (*dont_show_again_changed)(int);
} WelcomeMetadata; } WelcomeMetadata;

View File

@ -143,6 +143,8 @@ pub struct WelcomeMetadata {
pub window_icon_path: *const c_char, pub window_icon_path: *const c_char,
pub tray_image_path: *const c_char, pub tray_image_path: *const c_char,
pub already_running: c_int,
pub dont_show_again_changed: extern fn(c_int), pub dont_show_again_changed: extern fn(c_int),
} }

View File

@ -52,6 +52,7 @@ pub fn show(options: WelcomeOptions) {
let welcome_metadata = WelcomeMetadata { let welcome_metadata = WelcomeMetadata {
window_icon_path: c_window_icon_path_ptr, window_icon_path: c_window_icon_path_ptr,
tray_image_path: c_tray_image_path_ptr, tray_image_path: c_tray_image_path_ptr,
already_running: if options.is_already_running { 1 } else { 0 },
dont_show_again_changed, dont_show_again_changed,
}; };

View File

@ -64,6 +64,12 @@ DerivedWelcomeFrame::DerivedWelcomeFrame(wxWindow *parent)
{ {
this->tray_info_label->Hide(); this->tray_info_label->Hide();
} }
this->dont_show_checkbox->Hide();
if (welcome_metadata->already_running) {
this->title_label->SetLabel("Espanso is already running!");
}
} }
void DerivedWelcomeFrame::on_dont_show_change( wxCommandEvent& event ) { void DerivedWelcomeFrame::on_dont_show_change( wxCommandEvent& event ) {

View File

@ -22,6 +22,7 @@ pub use crate::sys::welcome::show;
pub struct WelcomeOptions { pub struct WelcomeOptions {
pub window_icon_path: Option<String>, pub window_icon_path: Option<String>,
pub tray_image_path: Option<String>, pub tray_image_path: Option<String>,
pub is_already_running: bool,
pub handlers: WelcomeHandlers, pub handlers: WelcomeHandlers,
} }