Commit bfe20906 authored by Guido Gunther's avatar Guido Gunther

Don't replace running DBus services by default

This works around GNOME shell aborting when phosh replaces
some of it's DBUS services

Closes: #59
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent 255faf9f
Pipeline #7987 passed with stages
in 6 minutes and 46 seconds
......@@ -394,8 +394,9 @@ phosh_idle_manager_constructed (GObject *object)
self->dbus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION,
"org.gnome.Mutter.IdleMonitor",
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT
| G_BUS_NAME_OWNER_FLAGS_REPLACE,
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
(phosh_shell_get_dbus_replace () ?
G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
on_bus_acquired,
on_name_acquired,
on_name_lost,
......
......@@ -38,13 +38,15 @@ int main(int argc, char *argv[])
GMainContext *context = NULL;
g_autoptr(GOptionContext) opt_context = NULL;
GError *err = NULL;
gboolean unlocked = FALSE, version = FALSE;
gboolean unlocked = FALSE, version = FALSE, replace = FALSE;
g_autoptr(PhoshWayland) wl = NULL;
g_autoptr(PhoshShell) shell = NULL;
const GOptionEntry options [] = {
{"unlocked", 'U', 0, G_OPTION_ARG_NONE, &unlocked,
"Don't start with screen locked", NULL},
{"replace", 'R', 0, G_OPTION_ARG_NONE, &replace,
"Replace running shell services", NULL},
{"version", 0, 0, G_OPTION_ARG_NONE, &version,
"Show version information", NULL},
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
......@@ -75,6 +77,10 @@ int main(int argc, char *argv[])
wl = phosh_wayland_get_default ();
shell = phosh_shell_get_default ();
g_info ("Will %sreplace DBus names", replace ? "" : "not ");
phosh_shell_set_dbus_replace (replace);
if (!unlocked)
phosh_shell_lock (shell);
......
......@@ -754,7 +754,8 @@ phosh_monitor_manager_constructed (GObject *object)
self->dbus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION,
"org.gnome.Mutter.DisplayConfig",
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
G_BUS_NAME_OWNER_FLAGS_REPLACE,
(phosh_shell_get_dbus_replace () ?
G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
on_bus_acquired,
on_name_acquired,
on_name_lost,
......
......@@ -80,6 +80,8 @@ typedef struct _PhoshShell
G_DEFINE_TYPE_WITH_PRIVATE (PhoshShell, phosh_shell, G_TYPE_OBJECT)
static gboolean dbus_replace = TRUE;
static struct popup**
get_popup_from_xdg_popup (PhoshShell *self, struct xdg_popup *xdg_popup)
......@@ -746,6 +748,18 @@ phosh_shell_get_usable_area (PhoshShell *self, gint *x, gint *y, gint *width, gi
*height = h;
}
void phosh_shell_set_dbus_replace (gboolean replace)
{
dbus_replace = replace;
}
gboolean
phosh_shell_get_dbus_replace (void)
{
return dbus_replace;
}
PhoshShell *
phosh_shell_get_default (void)
......@@ -759,3 +773,4 @@ phosh_shell_get_default (void)
}
return instance;
}
......@@ -33,4 +33,7 @@ void phosh_shell_set_primary_monitor (PhoshShell *self, PhoshMon
PhoshMonitor *phosh_shell_get_primary_monitor (PhoshShell *self);
PhoshMonitorManager *phosh_shell_get_monitor_manager (PhoshShell *self);
PhoshWifiManager *phosh_shell_get_wifi_manager (PhoshShell *self);
void phosh_shell_set_dbus_replace (gboolean replace);
gboolean phosh_shell_get_dbus_replace (void);
#endif /* PHOSH_H */
......@@ -91,7 +91,8 @@ phosh_system_prompter_register (void)
owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
"org.gnome.keyring.SystemPrompter",
G_BUS_NAME_OWNER_FLAGS_REPLACE,
(phosh_shell_get_dbus_replace () ?
G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
on_bus_acquired,
on_name_acquired,
on_name_lost,
......
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