mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-24 04:02:09 +00:00
Don't create SNI item, when no icon is found
KeePassXC would call ItemPropertyChanged on exit and simultaneously vanish its dbus presence. This causes all dbus property queries to fail.
This commit is contained in:
parent
a868f3e8e5
commit
fbf25048ff
1 changed files with 10 additions and 0 deletions
10
src/SNI.cpp
10
src/SNI.cpp
|
@ -226,6 +226,12 @@ namespace SNI
|
||||||
if (item.pixbuf == nullptr)
|
if (item.pixbuf == nullptr)
|
||||||
{
|
{
|
||||||
GVariant* iconPixmap = getProperty("IconPixmap");
|
GVariant* iconPixmap = getProperty("IconPixmap");
|
||||||
|
if (iconPixmap == nullptr)
|
||||||
|
{
|
||||||
|
// All icon locations have failed, bail.
|
||||||
|
LOG("SNI: Cannot create item due to missing icon!");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
// Only get first item
|
// Only get first item
|
||||||
GVariant* arr = nullptr;
|
GVariant* arr = nullptr;
|
||||||
g_variant_get(iconPixmap, "(v)", &arr);
|
g_variant_get(iconPixmap, "(v)", &arr);
|
||||||
|
@ -375,6 +381,10 @@ namespace SNI
|
||||||
{
|
{
|
||||||
LOG("SNI: Creating Item " << client.name << " " << client.object);
|
LOG("SNI: Creating Item " << client.name << " " << client.object);
|
||||||
Item item = CreateItem(std::move(client.name), std::move(client.object));
|
Item item = CreateItem(std::move(client.name), std::move(client.object));
|
||||||
|
if (item.pixbuf == nullptr)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Add handler for removing
|
// Add handler for removing
|
||||||
item.watcherID = g_bus_watch_name_on_connection(dbusConnection, item.name.c_str(), G_BUS_NAME_WATCHER_FLAGS_NONE, nullptr,
|
item.watcherID = g_bus_watch_name_on_connection(dbusConnection, item.name.c_str(), G_BUS_NAME_WATCHER_FLAGS_NONE, nullptr,
|
||||||
DBusNameVanished, nullptr, nullptr);
|
DBusNameVanished, nullptr, nullptr);
|
||||||
|
|
Loading…
Reference in a new issue