[Xfce4-commits] [xfce/xfce4-panel] 05/24: Acquire org.xfce.Panel on startup using gdbus API
noreply at xfce.org
noreply at xfce.org
Tue Jul 4 00:03:36 CEST 2017
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit 81af574435bd3d04d395a19e8db3e059111481d2
Author: Ali Abdallah <ali at xfce.org>
Date: Thu Jun 22 13:48:07 2017 +0200
Acquire org.xfce.Panel on startup using gdbus API
---
panel/main.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/panel/main.c b/panel/main.c
index cce7793..f3f77ed 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2017 Ali Abdallah <ali at xfce.org>
* Copyright (C) 2008-2010 Nick Schermer <nick at xfce.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -37,7 +38,7 @@
#endif
#include <glib.h>
-#include <dbus/dbus-glib.h>
+#include <gio/gio.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libwnck/libwnck.h>
@@ -196,6 +197,14 @@ panel_debug_notify_proxy (void)
}
}
+static void
+panel_dbus_name_lost (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data) {
+
+ g_critical (_("Name %s lost on the message dbus, exiting."), name);
+ gtk_main_quit ();
+}
gint
@@ -311,6 +320,14 @@ main (gint argc, gchar **argv)
launch_panel:
+ g_bus_own_name (G_BUS_TYPE_SESSION,
+ PANEL_DBUS_NAME,
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ NULL,
+ NULL,
+ panel_dbus_name_lost,
+ NULL, NULL);
+
/* start dbus service */
dbus_service = panel_dbus_service_get ();
if (!panel_dbus_service_is_exported (dbus_service))
@@ -393,7 +410,7 @@ dbus_return:
error_msg = _("Failed to send D-Bus message");
/* show understandable message for this common error */
- if (error->code == DBUS_GERROR_NAME_HAS_NO_OWNER)
+ if (error->code == G_DBUS_ERROR_NAME_HAS_NO_OWNER)
{
/* normally start the panel */
if (opt_preferences >= 0 || opt_restart)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list