Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gui,win): fix silence and layer icon checks #1072

Merged
merged 3 commits into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 46 additions & 10 deletions src/gui/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,19 @@ fn get_icon_p_impl(
.unwrap_or_else(|| OsStr::new(""))
.to_string_lossy()
.to_string();
let is_icn_ext_valid = if !IMG_EXT.iter().any(|&i| i == icn_ext) && f_ext[i].is_some() {
warn!(
"user icon extension \"{}\" might be invalid (or just not an extension)!",
icn_ext
);
false
let is_icn_ext_valid = if f_ext[i].is_some() {
if IMG_EXT.iter().any(|&i| i == icn_ext) {
trace!("icn_ext={:?}", icn_ext);
true
} else {
warn!(
"user icon extension \"{}\" might be invalid (or just not an extension)!",
icn_ext
);
false
}
} else {
trace!("icn_ext={:?}", icn_ext);
true
false
};
'p: for p_par in parents {
trace!("{}p_par={:?}", " ", p_par);
Expand Down Expand Up @@ -879,6 +883,12 @@ impl SystemTray {
} else {
msg_title += &("🔄 \"".to_owned() + cfg_name + "\" NOT loaded");
flags |= f_tray::ERROR_ICON | f_tray::LARGE_ICON;
{
let app_data = self.app_data.borrow();
if app_data.gui_opts.notify_cfg_reload_silent {
flags |= f_tray::SILENT;
}
}
self.tray.show(
&msg_content,
Some(&msg_title),
Expand All @@ -895,6 +905,12 @@ impl SystemTray {
} else {
msg_title += &("🔄 \"".to_owned() + cfg_name + "\" NOT reloaded");
flags |= f_tray::ERROR_ICON | f_tray::LARGE_ICON;
{
let app_data = self.app_data.borrow();
if app_data.gui_opts.notify_cfg_reload_silent {
flags |= f_tray::SILENT;
}
}
self.tray.show(
&msg_content,
Some(&msg_title),
Expand Down Expand Up @@ -943,6 +959,12 @@ impl SystemTray {
flags |= f_tray::ERROR_ICON;
};
flags |= f_tray::LARGE_ICON; // todo: fails without this, must have SM_CXICON x SM_CYICON?
{
let app_data = self.app_data.borrow();
if app_data.gui_opts.notify_cfg_reload_silent {
flags |= f_tray::SILENT;
}
}
self.tray.show(
&msg_content,
Some(&msg_title),
Expand Down Expand Up @@ -1125,8 +1147,22 @@ impl SystemTray {
*icon_act_key = Some(cfg_layer_pkey);
self.show_tooltip(None);
}
} else if let Some(layer_icon) = layer_icon {
// 1b cfg+layer path hasn't been checked, but layer has an icon configured, so check it
} else if layer_icon.is_some() || app_data.gui_opts.icon_match_layer_name {
let layer_icon = match layer_icon {
Some(layer_icon_inner) => {
trace!("configured layer icon = {}", layer_icon_inner);
layer_icon_inner
}
None => {
trace!(
"no configured layer icon, checking its name = {}",
layer_name
);
layer_name
}
};
// 1b cfg+layer path hasn't been checked, but layer has an icon configured...
// or configured to check its name, so check it
if let Some(ico_p) = get_icon_p(
layer_icon,
layer_name,
Expand Down
Loading