main: fix double D-Bus name ownership for control center interface

parent 26f89959
...@@ -42,6 +42,8 @@ namespace XimperShellNotificationCenter { ...@@ -42,6 +42,8 @@ namespace XimperShellNotificationCenter {
public signal void config_reload (ConfigModel ?old_config, ConfigModel new_config); public signal void config_reload (ConfigModel ?old_config, ConfigModel new_config);
private BusNameOwnerFlags bus_name_flags = BusNameOwnerFlags.NONE;
public NotificationCenter (bool replace) { public NotificationCenter (bool replace) {
Object ( Object (
application_id : "ru.ximperlinux.shell.NotificationCenter", application_id : "ru.ximperlinux.shell.NotificationCenter",
...@@ -50,6 +52,10 @@ namespace XimperShellNotificationCenter { ...@@ -50,6 +52,10 @@ namespace XimperShellNotificationCenter {
| (replace ? ApplicationFlags.REPLACE : 0) | (replace ? ApplicationFlags.REPLACE : 0)
); );
if (replace) {
bus_name_flags = BusNameOwnerFlags.REPLACE;
}
try { try {
register (); register ();
if (get_is_remote ()) { if (get_is_remote ()) {
...@@ -107,7 +113,7 @@ namespace XimperShellNotificationCenter { ...@@ -107,7 +113,7 @@ namespace XimperShellNotificationCenter {
// Notification Daemon // Notification Daemon
Bus.own_name_on_connection (conn, Bus.own_name_on_connection (conn,
"org.freedesktop.Notifications", "org.freedesktop.Notifications",
BusNameOwnerFlags.NONE, bus_name_flags,
() => { () => {
try { try {
conn.register_object ("/org/freedesktop/Notifications", noti_daemon); conn.register_object ("/org/freedesktop/Notifications", noti_daemon);
...@@ -126,21 +132,14 @@ namespace XimperShellNotificationCenter { ...@@ -126,21 +132,14 @@ namespace XimperShellNotificationCenter {
yield; yield;
// Ximper Shell Notification Center Daemon // Ximper Shell Notification Center Daemon
Bus.own_name_on_connection (conn, // Name is already owned by GApplication via register()
"ru.ximperlinux.shell.NotificationCenter", try {
BusNameOwnerFlags.NONE, conn.register_object (
() => { "/ru/ximperlinux/shell/NotificationCenter",
try { ximper_shell_notification_center_daemon);
conn.register_object ("/ru/ximperlinux/shell/NotificationCenter", ximper_shell_notification_center_daemon); } catch (Error e) {
init.callback (); error ("Could not register CC service: \"%s\"", e.message);
} catch (Error e) { }
error ("Could not register CC service: \"%s\"", e.message);
}
},
() => {
error ("Could not acquire Ximper Shell Notification Center name!");
});
yield;
xdg_activation = new XdgActivationHelper (); xdg_activation = new XdgActivationHelper ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment