Upstream patch to remove libunique dependency, and use glib >= 2.28.0
to handle unique apps both for GTK+ 2 and 3.
https://sourceforge.net/p/lxde/patches/539/


From a7d3b40a79a7a16c1f5d50d2bd466570258dae29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Sun, 22 Jan 2017 01:09:59 +0100
Subject: [PATCH] Use GApplication for unique app handling

Remove libunique dependency, and use glib >= 2.28.0 to handle unique apps both for GTK+ 2 and 3.
---
 Makefile.am           |  6 ------
 configure.ac          |  7 +------
 lxclipboard/main.vala | 16 +---------------
 lxpolkit/main.vala    | 16 +---------------
 4 files changed, 3 insertions(+), 42 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c2e1fe8..e3a3b97 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,9 +90,6 @@ if USE_GTK3
 lxclipboard_lxclipboard_VALAFLAGS += --define USE_GTK3
 else
 lxclipboard_lxclipboard_VALAFLAGS += --define USE_GTK2
-lxclipboard_lxclipboard_VALAFLAGS += --pkg unique-1.0
-lxclipboard_lxclipboard_CPPFLAGS += $(UNIQUE_CFLAGS)
-lxclipboard_lxclipboard_LDADD += $(UNIQUE_LIBS)
 endif
 
 lxpolkit_lxpolkit_vala_SOURCES = \
@@ -137,9 +134,6 @@ if USE_GTK3
 lxpolkit_lxpolkit_VALAFLAGS += --define USE_GTK3
 else
 lxpolkit_lxpolkit_VALAFLAGS += --define USE_GTK2
-lxpolkit_lxpolkit_VALAFLAGS += --pkg unique-1.0
-lxpolkit_lxpolkit_CPPFLAGS += $(UNIQUE_CFLAGS)
-lxpolkit_lxpolkit_LDADD += $(UNIQUE_LIBS)
 endif
 
 lxsession_db_lxsession_db_SOURCES = \
diff --git a/configure.ac b/configure.ac
index 06ddbb3..9126f4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ PKG_CHECK_MODULES(X11, [x11])
 AC_SUBST(X11_CFLAGS)
 AC_SUBST(X11_LIBS)
 
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0])
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.28.0])
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
@@ -79,11 +79,6 @@ else
     CFLAGS="$CFLAGS -D USE_GTK2"
     gtk_modules="gtk+-2.0 >= 2.6.0"
     VALA_GTK_LIBS="gtk+-2.0"
-
-    PKG_CHECK_MODULES(UNIQUE, [unique-1.0])
-    AC_SUBST(UNIQUE_CFLAGS)
-    AC_SUBST(UNIQUE_LIBS)
-
   fi
   PKG_CHECK_MODULES(GTK, [$gtk_modules])
   AC_SUBST(GTK_CFLAGS)
diff --git a/lxclipboard/main.vala b/lxclipboard/main.vala
index bee4044..3d4a8d7 100644
--- a/lxclipboard/main.vala
+++ b/lxclipboard/main.vala
@@ -17,9 +17,6 @@
  *      MA 02110-1301, USA.
  */
 using Gtk;
-#if USE_GTK2
-using Unique;
-#endif
 
 namespace Lxsession
 {
@@ -28,17 +25,7 @@ namespace Lxsession
         public static int main(string[] args)
         {
             Gtk.init (ref args);
-#if USE_GTK2
-            Unique.App app = new Unique.App("org.lxde.lxclipboard", null);
-
-            if(app.is_running)
-            {
-                message("lxclipboard is already running. Existing");
-                return 0;
-            }
-#endif
-# if USE_GTK3
-            Gtk.Application app = new Gtk.Application (
+            GLib.Application app = new GLib.Application (
                 "org.lxde.lxclipboard",
                 GLib.ApplicationFlags.FLAGS_NONE);
             app.register ();
@@ -48,7 +35,6 @@ namespace Lxsession
                 message("lxclipboard is already running. Existing");
                 return 0;
             }
-#endif
 
             clipboard_start ();
 
diff --git a/lxpolkit/main.vala b/lxpolkit/main.vala
index c0d6ae2..50c3cb7 100644
--- a/lxpolkit/main.vala
+++ b/lxpolkit/main.vala
@@ -17,9 +17,6 @@
  *      MA 02110-1301, USA.
  */
 using Gtk;
-#if USE_GTK2
-using Unique;
-#endif
 
 const string GETTEXT_PACKAGE = "lxsession";
 
@@ -33,17 +30,7 @@ namespace Lxsession
             Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, "utf-8");
 
             Gtk.init (ref args);
-#if USE_GTK2
-            Unique.App app = new Unique.App("org.lxde.lxpolkit", null);
-
-            if(app.is_running)
-            {
-                message(_("lxpolkit is already running. Existing"));
-                return 0;
-            }
-#endif
-# if USE_GTK3
-            Gtk.Application app = new Gtk.Application (
+            GLib.Application app = new GLib.Application (
                 "org.lxde.lxpolkit",
                 GLib.ApplicationFlags.FLAGS_NONE);
             app.register ();
@@ -53,7 +40,6 @@ namespace Lxsession
                 message(_("lxpolkit is already running. Existing"));
                 return 0;
             }
-#endif
 
             policykit_agent_init();
 
-- 
2.11.0

