Use GDbus instead of dbus-glib. master
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Mon, 6 Apr 2020 22:59:24 +0000 (01:59 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Mon, 6 Apr 2020 22:59:24 +0000 (01:59 +0300)
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955917

configure.ac
debian/control
debian/rules
src/lxappearance.c

index 05365a8..a72f6b4 100644 (file)
@@ -69,7 +69,7 @@ AC_SUBST(GTK_LIBS)
 
 AC_ARG_ENABLE(dbus,
        [AS_HELP_STRING([--enable-dbus],
 
 AC_ARG_ENABLE(dbus,
        [AS_HELP_STRING([--enable-dbus],
-               [Use Dbus support (usefull for lxsession > 0.4.9) @<:@default=no@:>@])],
+               [Use Dbus-glib support (deprecated now) @<:@default=no@:>@])],
        [enable_dbus="${enableval}"],
        [enable_dbus=no]
 )
        [enable_dbus="${enableval}"],
        [enable_dbus=no]
 )
@@ -176,7 +176,7 @@ echo
 echo lxappearance....................... : Version $VERSION
 echo
 echo Enable debug....................: "$enable_debug"
 echo lxappearance....................... : Version $VERSION
 echo
 echo Enable debug....................: "$enable_debug"
-echo Enable Dbus support.............: "$enable_dbus"
+echo Enable Dbus-glib support........: "$enable_dbus"
 echo Prefix..........................: $prefix
 echo
 echo The binary will be installed in $prefix/bin
 echo Prefix..........................: $prefix
 echo
 echo The binary will be installed in $prefix/bin
index b06daa4..cc2b1f4 100644 (file)
@@ -6,7 +6,7 @@ Uploaders:
  Andrew Lee (李健秋) <ajqlee@debian.org>, Daniel Baumann <daniel@debian.org>
 Build-Depends:
  debhelper (>= 9), autotools-dev, intltool, docbook-xml, docbook-xsl,
  Andrew Lee (李健秋) <ajqlee@debian.org>, Daniel Baumann <daniel@debian.org>
 Build-Depends:
  debhelper (>= 9), autotools-dev, intltool, docbook-xml, docbook-xsl,
- libglib2.0-dev, libgtk2.0-dev, libx11-dev, libdbus-1-dev, xsltproc, dh-autoreconf
+ libglib2.0-dev, libgtk2.0-dev, libx11-dev, xsltproc, dh-autoreconf
 Standards-Version: 3.9.3
 Homepage: http://www.lxde.org/
 Vcs-Browser: http://git.lxde.org/gitweb/?p=debian/lxappearance.git
 Standards-Version: 3.9.3
 Homepage: http://www.lxde.org/
 Vcs-Browser: http://git.lxde.org/gitweb/?p=debian/lxappearance.git
index bf1af9d..8d3c4e0 100755 (executable)
@@ -5,7 +5,7 @@
 
 override_dh_auto_configure:
        ./autogen.sh
 
 override_dh_auto_configure:
        ./autogen.sh
-       dh_auto_configure -- --enable-man --enable-dbus
+       dh_auto_configure -- --enable-man
 
 override_dh_install:
        dh_install --fail-missing
 
 override_dh_install:
        dh_install --fail-missing
index a4d191a..f31e794 100644 (file)
@@ -58,7 +58,38 @@ static const char* lxsession_name = NULL;
 
 static gboolean check_lxde_dbus()
 {
 
 static gboolean check_lxde_dbus()
 {
-#if ENABLE_DBUS
+#if GLIB_CHECK_VERSION(2, 26, 0)
+    GError *error = NULL;
+    GDBusConnection * connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
+
+    if (connection == NULL)
+    {
+        g_warning(G_STRLOC ": Failed to connect to the session message bus: %s",
+                  error->message);
+        g_error_free(error);
+        return FALSE;
+    }
+
+    GVariant *reply = g_dbus_connection_call_sync(connection, "org.freedesktop.DBus",
+                                                  "/org/freedesktop/DBus",
+                                                  "org.freedesktop.DBus",
+                                                  "GetNameOwner",
+                                                  g_variant_new ("(s)",
+                                                                 "org.lxde.SessionManager"),
+                                                  NULL,
+                                                  G_DBUS_CALL_FLAGS_NO_AUTO_START,
+                                                  -1, NULL, NULL);
+
+    if (reply != NULL)
+    {
+        g_variant_unref(reply);
+        return TRUE;
+    }
+    else
+    {
+        return FALSE;
+    }
+#elif ENABLE_DBUS
     DBusError error;
     dbus_error_init(&error);
     DBusConnection * connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
     DBusError error;
     dbus_error_init(&error);
     DBusConnection * connection = dbus_bus_get(DBUS_BUS_SESSION, &error);