1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 05:25:52 +00:00

fix: cert-err58 warning in declaration of TrayIconName, AppIconName, AppName (#6861)

This commit is contained in:
Charles Kerr 2024-06-01 04:50:51 -05:00 committed by GitHub
parent a18fca5950
commit 2b75869c80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,12 +55,12 @@ namespace
{ {
#if !defined(TR_SYS_TRAY_IMPL_NONE) #if !defined(TR_SYS_TRAY_IMPL_NONE)
auto const TrayIconName = Glib::ustring("transmission-tray-icon"s); char const* const TrayIconName = "transmission-tray-icon";
auto const AppIconName = Glib::ustring("transmission"s); char const* const AppIconName = "transmission";
#endif #endif
#if defined(TR_SYS_TRAY_IMPL_APPINDICATOR) #if defined(TR_SYS_TRAY_IMPL_APPINDICATOR)
auto const AppName = Glib::ustring("transmission-gtk"s); char const* const AppName = "transmission-gtk";
#endif #endif
} // namespace } // namespace
@ -138,23 +138,11 @@ namespace
Glib::ustring getIconName() Glib::ustring getIconName()
{ {
Glib::ustring icon_name;
// if the tray's icon is a 48x48 file, use it. // if the tray's icon is a 48x48 file, use it.
// otherwise, use the fallback builtin icon. // otherwise, use the fallback builtin icon.
if (auto theme = Gtk::IconTheme::get_default(); !theme->has_icon(TrayIconName))
{
icon_name = AppIconName;
}
else
{
auto const icon_info = theme->lookup_icon(TrayIconName, 48, Gtk::ICON_LOOKUP_USE_BUILTIN);
bool const icon_is_builtin = icon_info.get_filename().empty();
icon_name = icon_is_builtin ? AppIconName : TrayIconName; auto const icon = Gtk::IconTheme::get_default()->lookup_icon(TrayIconName, 48, Gtk::ICON_LOOKUP_USE_BUILTIN);
} return icon && !icon.get_filename().empty() ? TrayIconName : AppIconName;
return icon_name;
} }
#endif #endif
@ -199,7 +187,7 @@ SystemTrayIcon::Impl::Impl([[maybe_unused]] Gtk::Window& main_window, Glib::RefP
#endif #endif
#if defined(TR_SYS_TRAY_IMPL_APPINDICATOR) #if defined(TR_SYS_TRAY_IMPL_APPINDICATOR)
indicator_ = app_indicator_new(AppName.c_str(), icon_name.c_str(), APP_INDICATOR_CATEGORY_SYSTEM_SERVICES); indicator_ = app_indicator_new(AppName, icon_name.c_str(), APP_INDICATOR_CATEGORY_SYSTEM_SERVICES);
app_indicator_set_status(indicator_, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_status(indicator_, APP_INDICATOR_STATUS_ACTIVE);
app_indicator_set_menu(indicator_, Glib::unwrap(menu_)); app_indicator_set_menu(indicator_, Glib::unwrap(menu_));
app_indicator_set_title(indicator_, Glib::get_application_name().c_str()); app_indicator_set_title(indicator_, Glib::get_application_name().c_str());