mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 03:02:49 +00:00
SNI: Only reload a given senderName once
Fix for: https://github.com/scorpion-26/gBar/issues/26
This commit is contained in:
parent
39cf17c30f
commit
884d3f1324
1 changed files with 12 additions and 0 deletions
12
src/SNI.cpp
12
src/SNI.cpp
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace SNI
|
namespace SNI
|
||||||
{
|
{
|
||||||
|
@ -42,6 +43,7 @@ namespace SNI
|
||||||
std::vector<Item> items;
|
std::vector<Item> items;
|
||||||
|
|
||||||
std::unordered_map<std::string, Item> clientsToQuery;
|
std::unordered_map<std::string, Item> clientsToQuery;
|
||||||
|
std::unordered_set<std::string> reloadedNames;
|
||||||
|
|
||||||
// Gtk stuff, TODO: Allow more than one instance
|
// Gtk stuff, TODO: Allow more than one instance
|
||||||
// Simply removing the gtk_drawing_areas doesn't trigger proper redrawing
|
// Simply removing the gtk_drawing_areas doesn't trigger proper redrawing
|
||||||
|
@ -281,6 +283,13 @@ namespace SNI
|
||||||
|
|
||||||
static void ItemPropertyChanged(GDBusConnection*, const char* senderName, const char* object, const char*, const char*, GVariant*, void* name)
|
static void ItemPropertyChanged(GDBusConnection*, const char* senderName, const char* object, const char*, const char*, GVariant*, void* name)
|
||||||
{
|
{
|
||||||
|
if (reloadedNames.insert(senderName).second == false)
|
||||||
|
{
|
||||||
|
// senderName has already requested a change, ignore
|
||||||
|
LOG("SNI: " << senderName << " already signaled property change");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string nameStr = (const char*)name;
|
std::string nameStr = (const char*)name;
|
||||||
LOG("SNI: Reloading " << (const char*)name << " " << object << " (Sender: " << senderName << ")");
|
LOG("SNI: Reloading " << (const char*)name << " " << object << " (Sender: " << senderName << ")");
|
||||||
// We don't care about *what* changed, just remove and reload
|
// We don't care about *what* changed, just remove and reload
|
||||||
|
@ -347,6 +356,9 @@ namespace SNI
|
||||||
LOG("SNI: Clearing old children");
|
LOG("SNI: Clearing old children");
|
||||||
parentBox->RemoveChild(iconBox);
|
parentBox->RemoveChild(iconBox);
|
||||||
|
|
||||||
|
// Allow further updates from the icon
|
||||||
|
reloadedNames.clear();
|
||||||
|
|
||||||
auto container = Widget::Create<Box>();
|
auto container = Widget::Create<Box>();
|
||||||
container->SetSpacing({4, false});
|
container->SetSpacing({4, false});
|
||||||
container->SetOrientation(Utils::GetOrientation());
|
container->SetOrientation(Utils::GetOrientation());
|
||||||
|
|
Loading…
Reference in a new issue