statusNotifierWatcher: use the unique name for registering indicators
Otherwise an app could have different names registered, and we could end up
in two indicators for the same content.
Marco Trevisan (TreviƱo)
6 years ago
124 | 124 |
bus_name = invocation.get_sender();
|
125 | 125 |
obj_path = service;
|
126 | 126 |
} else { // we hope it is a bus name
|
|
127 |
bus_name = Util.getUniqueBusNameSync(invocation.get_connection(), service);
|
127 | 128 |
bus_name = service;
|
128 | 129 |
obj_path = DEFAULT_ITEM_OBJECT_PATH;
|
129 | 130 |
}
|
44 | 44 |
//Logger.debug("While refreshing property "+property_name+": "+e)
|
45 | 45 |
}
|
46 | 46 |
})
|
|
47 |
}
|
|
48 |
|
|
49 |
const getUniqueBusNameSync = function(bus, name) {
|
|
50 |
if (name[0] == ':')
|
|
51 |
return name;
|
|
52 |
|
|
53 |
if (!bus)
|
|
54 |
bus = Gio.DBus.session;
|
|
55 |
|
|
56 |
let variant_name = new GLib.Variant("(s)", [name]);
|
|
57 |
let [unique] = bus.call_sync("org.freedesktop.DBus", "/", "org.freedesktop.DBus",
|
|
58 |
"GetNameOwner", variant_name, null,
|
|
59 |
Gio.DBusCallFlags.NONE, -1, null).deep_unpack();
|
|
60 |
|
|
61 |
Logger.debug("Unique name of "+name+" is "+unique);
|
|
62 |
|
|
63 |
return unique;
|
47 | 64 |
}
|
48 | 65 |
|
49 | 66 |
const connectSmart3A = function(src, signal, handler) {
|