* [PATCH] gnu: Add libunique.
@ 2016-02-19 19:14 Fabian Harfert
0 siblings, 0 replies; 15+ messages in thread
From: Fabian Harfert @ 2016-02-19 19:14 UTC (permalink / raw)
To: guix-devel
* gnu/packages/glib.scm (libunique): New variable.
* gnu/packages/patches/libunique-gdbus.patch: New file.
* gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch: New file.
---
gnu/packages/glib.scm | 32 ++
gnu/packages/patches/libunique-gdbus.patch | 529 +++++++++++++++++++++
.../patches/libunique-remove-G_CONST_RETURN.patch | 117 +++++
3 files changed, 678 insertions(+)
create mode 100644 gnu/packages/patches/libunique-gdbus.patch
create mode 100644 gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index f8e1541..259a744 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Fabian Harfert <fhmgufs@web.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +28,7 @@
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
+ #:use-module (guix build-system glib-or-gtk)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages bison)
@@ -611,3 +613,33 @@ many applications simultaneously.
This package provides the library for GLib applications.")
(license license:lgpl2.1+)))
+
+(define-public libunique
+ (package
+ (name "libunique")
+ (version "1.1.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnome/sources/libunique/"
+ (version-major+minor version) "/"
+ name "-" version ".tar.bz2"))
+ (sha256
+ (base32
+ "1fsgvmncd9caw552lyfg8swmsd6bh4ijjsph69bwacwfxwf09j75"))
+ (patches
+ (list (search-patch "libunique-gdbus.patch")
+ (search-patch "libunique-remove-G_CONST_RETURN.patch")))))
+ (build-system glib-or-gtk-build-system)
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("gobject-introspection" ,gobject-introspection)
+ ("glib:bin" ,glib "bin")))
+ (propagated-inputs
+ `(("gtk+" ,gtk+-2)))
+ (home-page "https://wiki.gnome.org/Attic/LibUnique")
+ (synopsis "Library for writing single instance application")
+ (description
+ "Libunique is library providing a mechanism to allow only one running
+instance of an application.")
+ (license license:lgpl2.1+)))
diff --git a/gnu/packages/patches/libunique-gdbus.patch b/gnu/packages/patches/libunique-gdbus.patch
new file mode 100644
index 0000000..880c0c0
--- /dev/null
+++ b/gnu/packages/patches/libunique-gdbus.patch
@@ -0,0 +1,529 @@
+From 01066039529c0181f231325476bb4823c16a2aea Mon Sep 17 00:00:00 2001
+From: Christian Persch <chpe@gnome.org>
+Date: Sat, 15 May 2010 17:47:45 +0000
+Subject: Add GDBus backend
+
+Add backend using GDBus, the new D-BUS binding in GIO 2.25.
+
+Bug #618723.
+---
+diff --git a/configure.ac b/configure.ac
+index bc3163a..b6a4221 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -116,6 +116,19 @@ AS_IF([test "x$have_dbus" = "xyes"],
+
+ AM_CONDITIONAL([HAVE_DBUS], [test "x$have_dbus" = "xyes"])
+
++dnl GDBus backend
++dnl This is the default backend if GIO is recent enough
++m4_define([gdbus_gio_required],[2.25.7])
++PKG_CHECK_MODULES([GDBUS],[gio-2.0 >= gdbus_gio_required],[have_gdbus=yes],[have_gdbus=no])
++
++AS_IF([test "x$have_gdbus" = "xyes"],
++ [
++ AC_DEFINE([HAVE_GDBUS],[1],[Define if GDBus backend is enabled])
++ ]
++ )
++
++AM_CONDITIONAL([HAVE_GDBUS],[test "$have_gdbus" = "yes"])
++
+ dnl Bacon backend
+ dnl This is the fallback backend, so we *need* these headers and functions
+ dnl even if we end up using D-Bus
+@@ -146,7 +159,13 @@ AM_CONDITIONAL([HAVE_BACON], [test "x$have_bacon" = "xyes"])
+
+ dnl Choose the default backend
+ AC_MSG_CHECKING([for default IPC mechanism])
+-AS_IF([test "x$have_dbus" = "xyes"],
++AS_IF([test "x$have_gdbus" = "xyes"],
++ [
++ UNIQUE_DEFAULT_BACKEND=gdbus
++ AC_MSG_RESULT([GDBus])
++ ],
++
++ [test "x$have_dbus" = "xyes"],
+ [
+ UNIQUE_DEFAULT_BACKEND=dbus
+ AC_MSG_RESULT([D-Bus])
+@@ -243,6 +262,7 @@ AC_CONFIG_FILES([
+ unique/uniqueversion.h
+ unique/bacon/Makefile
+ unique/dbus/Makefile
++ unique/gdbus/Makefile
+ tests/Makefile
+ po/Makefile.in
+ ])
+@@ -261,6 +281,7 @@ Configuration:
+ Backends:
+ Unix Domain Socket: $have_bacon
+ D-BUS: $have_dbus
++ GDBus: $have_gdbus
+
+ Default backend: $UNIQUE_DEFAULT_BACKEND
+ "
+diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
+index 3172588..2c1dbf4 100644
+--- a/doc/reference/Makefile.am
++++ b/doc/reference/Makefile.am
+@@ -50,7 +50,8 @@ IGNORE_HFILES = \
+ uniquemarshal.h \
+ stamp-uniquemarshal.h \
+ bacon \
+- dbus
++ dbus \
++ gdbus
+
+ EXTRA_HFILES =
+
+diff --git a/unique/Makefile.am b/unique/Makefile.am
+index 6475a87..8f0b7ba 100644
+--- a/unique/Makefile.am
++++ b/unique/Makefile.am
+@@ -12,7 +12,11 @@ if HAVE_DBUS
+ SUBDIRS += dbus
+ endif
+
+-DIST_SUBDIRS = bacon dbus
++if HAVE_GDBUS
++SUBDIRS += gdbus
++endif
++
++DIST_SUBDIRS = bacon dbus gdbus
+
+ INCLUDES = -I$(top_srcdir)
+
+@@ -72,6 +76,10 @@ if HAVE_DBUS
+ unique_backend_libs += $(top_builddir)/unique/dbus/libunique-dbus.la
+ endif
+
++if HAVE_GDBUS
++unique_backend_libs += $(top_builddir)/unique/gdbus/libunique-gdbus.la
++endif
++
+ uniquedir = $(includedir)/unique-1.0/unique
+ unique_HEADERS = \
+ $(unique_sources_h) \
+diff --git a/unique/gdbus/.gitignore b/unique/gdbus/.gitignore
+new file mode 100644
+index 0000000..c7e22c3
+--- /dev/null
++++ b/unique/gdbus/.gitignore
+@@ -0,0 +1,2 @@
++libunique_gdbus_la-uniquebackend-gdbus.lo
++libunique-gdbus.la
+diff --git a/unique/gdbus/Makefile.am b/unique/gdbus/Makefile.am
+new file mode 100644
+index 0000000..e10637d
+--- /dev/null
++++ b/unique/gdbus/Makefile.am
+@@ -0,0 +1,24 @@
++include $(top_srcdir)/build/autotools/Makefile.am.silent
++
++noinst_LTLIBRARIES = libunique-gdbus.la
++
++libunique_gdbus_la_SOURCES = \
++ uniquebackend-gdbus.h \
++ uniquebackend-gdbus.c
++
++libunique_gdbus_la_PPCFLAGS = \
++ -DG_LOG_DOMAIN=\"Unique-GDBus\" \
++ -DG_DISABLE_SINGLE_INCLUDES \
++ -I$(top_srcdir) \
++ $(AM_CPPFLAGS)
++
++libunique_gdbus_la_CFLAGS = \
++ $(UNIQUE_CFLAGS) \
++ $(UNIQUE_DEBUG_CFLAGS) \
++ $(MAINTAINER_CFLAGS) \
++ $(GDBUS_CFLAGS) \
++ $(AM_CFLAGS)
++
++libunique_gdbus_la_LIBADD = \
++ $(UNIQUE_LIBS) \
++ $(GDBUS_LIBS)
+diff --git a/unique/gdbus/uniquebackend-gdbus.c b/unique/gdbus/uniquebackend-gdbus.c
+new file mode 100644
+index 0000000..14d54a9
+--- /dev/null
++++ b/unique/gdbus/uniquebackend-gdbus.c
+@@ -0,0 +1,303 @@
++/* Unique - Single Instance application library
++ * uniquebackend-gdbus.c: GDBus implementation of UniqueBackend
++ *
++ * Copyright (C) 2007 Emmanuele Bassi <ebassi@o-hand.com>
++ * Copyright © 2010 Christian Persch
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#include <gio/gio.h>
++#include <gdk/gdk.h>
++
++#include "../uniqueinternals.h"
++#include "uniquebackend-gdbus.h"
++
++struct _UniqueBackendGDBus
++{
++ UniqueBackend parent_instance;
++
++ GDBusConnection *connection;
++ guint registration_id;
++ guint owner_id;
++ gboolean owns_name;
++ GMainLoop *loop;
++};
++
++struct _UniqueBackendGDBusClass
++{
++ UniqueBackendClass parent_class;
++ GDBusNodeInfo *introspection_data;
++};
++
++G_DEFINE_TYPE (UniqueBackendGDBus, unique_backend_gdbus, UNIQUE_TYPE_BACKEND);
++
++static const char introspection_xml[] =
++ "<node name='/'>"
++ "<interface name='org.gtk.UniqueApp'>"
++ "<method name='SendMessage'>"
++ "<arg name='command' type='s' direction='in'/>"
++ "<arg name='message' type='(suuus)' direction='in'/>"
++ "<arg name='time' type='u' direction='in'/>"
++ "<arg name='response' type='s' direction='out'/>"
++ "</method>"
++ "</interface>"
++ "</node>";
++
++static void
++method_call_cb (GDBusConnection *connection,
++ const gchar *sender,
++ const gchar *object_path,
++ const gchar *interface_name,
++ const gchar *method_name,
++ GVariant *parameters,
++ GDBusMethodInvocation *invocation,
++ gpointer user_data)
++{
++ if (g_strcmp0 (interface_name, "org.gtk.UniqueApp") != 0 ||
++ g_strcmp0 (object_path, "/Factory") != 0)
++ return;
++
++ if (g_strcmp0 (method_name, "SendMessage") == 0)
++ {
++ UniqueBackend *backend = UNIQUE_BACKEND (user_data);
++ const gchar *command_str, *data, *startup_id;
++ guint len, screen_num, workspace, time_;
++ UniqueMessageData message_data;
++ gint command;
++ UniqueResponse response;
++ GdkDisplay *display;
++
++ g_variant_get (parameters,
++ "(&s(&suuu&s)u)",
++ &command_str,
++ &data, &len, &screen_num, &workspace, &startup_id,
++ &time_);
++
++ command = unique_command_from_string (backend->parent, command_str);
++ if (command == 0)
++ {
++ g_dbus_method_invocation_return_error (invocation,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_INVALID_ARGS,
++ "Invalid command `%s' received",
++ command_str);
++ return;
++ }
++
++ display = gdk_display_get_default ();
++
++ message_data.data = len > 0 ? (guchar *) data : NULL;
++ message_data.length = (gint) len;
++ message_data.workspace = workspace;
++ message_data.startup_id = (char *) startup_id;
++ if (screen_num >= 0 && screen_num < gdk_display_get_n_screens (display))
++ message_data.screen = gdk_display_get_screen (display, screen_num);
++ else
++ message_data.screen = gdk_screen_get_default ();
++
++ response = unique_app_emit_message_received (backend->parent, command, &message_data, time_);
++
++ g_dbus_method_invocation_return_value (invocation,
++ g_variant_new ("(s)", unique_response_to_string (response)));
++ return;
++ }
++}
++
++static void
++name_acquired_cb (GDBusConnection *connection,
++ const gchar *name,
++ gpointer user_data)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (user_data);
++
++ backend_gdbus->owns_name = TRUE;
++ if (backend_gdbus->loop && g_main_loop_is_running (backend_gdbus->loop))
++ g_main_loop_quit (backend_gdbus->loop);
++}
++
++static void
++name_lost_cb (GDBusConnection *connection,
++ const gchar *name,
++ gpointer user_data)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (user_data);
++
++ backend_gdbus->owns_name = FALSE;
++ if (backend_gdbus->loop && g_main_loop_is_running (backend_gdbus->loop))
++ g_main_loop_quit (backend_gdbus->loop);
++}
++
++static const GDBusInterfaceVTable interface_vtable = {
++ method_call_cb,
++ NULL,
++ NULL
++};
++
++static gboolean
++unique_backend_gdbus_request_name (UniqueBackend *backend)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (backend);
++ UniqueBackendGDBusClass *klass = UNIQUE_BACKEND_GDBUS_GET_CLASS (backend);
++ GError *error;
++
++ error = NULL;
++ backend_gdbus->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
++ if (!backend_gdbus->connection)
++ {
++ g_warning ("Unable to open a connection to the session bus: %s",
++ error->message);
++ g_error_free (error);
++
++ return FALSE;
++ }
++
++ backend_gdbus->registration_id =
++ g_dbus_connection_register_object (backend_gdbus->connection,
++ "/Factory",
++ klass->introspection_data->interfaces[0],
++ &interface_vtable,
++ backend, NULL,
++ &error);
++ if (backend_gdbus->registration_id == 0)
++ {
++ g_warning ("Unable to register object with the session bus: %s",
++ error->message);
++ g_error_free (error);
++
++ return FALSE;
++ }
++
++ backend_gdbus->owns_name = FALSE;
++
++ backend_gdbus->owner_id =
++ g_bus_own_name_on_connection (backend_gdbus->connection,
++ unique_backend_get_name (backend),
++ G_BUS_NAME_OWNER_FLAGS_NONE,
++ name_acquired_cb,
++ name_lost_cb,
++ backend, NULL);
++
++ backend_gdbus->loop = g_main_loop_new (NULL, FALSE);
++ g_main_loop_run (backend_gdbus->loop);
++ g_main_loop_unref (backend_gdbus->loop);
++ backend_gdbus->loop = NULL;
++
++ return backend_gdbus->owns_name;
++}
++
++static UniqueResponse
++unique_backend_gdbus_send_message (UniqueBackend *backend,
++ gint command,
++ UniqueMessageData *message_data,
++ guint time_)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (backend);
++ GVariantBuilder builder;
++ GVariant *result;
++ const gchar *command_str, *resp;
++ UniqueResponse response;
++ GError *error;
++
++ command_str = unique_command_to_string (backend->parent, command);
++
++ g_variant_builder_init (&builder, G_VARIANT_TYPE ("(s(suuus)u)"));
++ g_variant_builder_add (&builder, "s", command_str ? command_str : "");
++ g_variant_builder_open (&builder, G_VARIANT_TYPE ("(suuus)"));
++ g_variant_builder_add (&builder, "s", message_data->data ? (char *) message_data->data : "");
++ g_variant_builder_add (&builder, "u", (guint) message_data->length);
++ g_variant_builder_add (&builder, "u", (guint) gdk_screen_get_number (message_data->screen));
++ g_variant_builder_add (&builder, "u", (guint) message_data->workspace);
++ g_variant_builder_add (&builder, "s", message_data->startup_id ? message_data->startup_id : "");
++ g_variant_builder_close (&builder);
++ g_variant_builder_add (&builder, "u", time_);
++
++ error = NULL;
++ result = g_dbus_connection_call_sync (backend_gdbus->connection,
++ unique_backend_get_name (backend),
++ "/Factory",
++ "org.gtk.UniqueApp",
++ "SendMessage",
++ g_variant_builder_end (&builder),
++ G_VARIANT_TYPE ("(s)"),
++ G_DBUS_CALL_FLAGS_NO_AUTO_START,
++ -1,
++ NULL,
++ &error);
++ if (error)
++ {
++ g_warning ("Error while sending message: %s", error->message);
++ g_error_free (error);
++
++ return UNIQUE_RESPONSE_INVALID;
++ }
++
++ g_variant_get (result, "(&s)", &resp);
++ response = unique_response_from_string (resp);
++ g_variant_unref (result);
++
++ return response;
++}
++
++static void
++unique_backend_gdbus_dispose (GObject *gobject)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (gobject);
++
++ if (backend_gdbus->owner_id != 0)
++ {
++ g_bus_unown_name (backend_gdbus->owner_id);
++ backend_gdbus->owner_id = 0;
++ }
++ if (backend_gdbus->registration_id != 0)
++ {
++ g_assert (backend_gdbus->connection != NULL);
++ g_dbus_connection_unregister_object (backend_gdbus->connection,
++ backend_gdbus->registration_id);
++ backend_gdbus->registration_id = 0;
++ }
++ if (backend_gdbus->connection)
++ {
++ g_object_unref (backend_gdbus->connection);
++ backend_gdbus->connection = NULL;
++ }
++
++ G_OBJECT_CLASS (unique_backend_gdbus_parent_class)->dispose (gobject);
++}
++
++static void
++unique_backend_gdbus_class_init (UniqueBackendGDBusClass *klass)
++{
++ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
++ UniqueBackendClass *backend_class = UNIQUE_BACKEND_CLASS (klass);
++
++ gobject_class->dispose = unique_backend_gdbus_dispose;
++
++ backend_class->request_name = unique_backend_gdbus_request_name;
++ backend_class->send_message = unique_backend_gdbus_send_message;
++
++ klass->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
++ g_assert (klass->introspection_data != NULL);
++}
++
++static void
++unique_backend_gdbus_init (UniqueBackendGDBus *backend)
++{
++}
+diff --git a/unique/gdbus/uniquebackend-gdbus.h b/unique/gdbus/uniquebackend-gdbus.h
+new file mode 100644
+index 0000000..41eb6e5
+--- /dev/null
++++ b/unique/gdbus/uniquebackend-gdbus.h
+@@ -0,0 +1,43 @@
++/* Unique - Single Instance application library
++ * uniquebackend-gdbus.c: GDBus implementation of UniqueBackend
++ *
++ * Copyright (C) 2007 Emmanuele Bassi <ebassi@o-hand.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++#ifndef __UNIQUE_BACKEND_GDBUS_H__
++#define __UNIQUE_BACKEND_GDBUS_H__
++
++#include <unique/uniquebackend.h>
++
++G_BEGIN_DECLS
++
++#define UNIQUE_TYPE_BACKEND_GDBUS (unique_backend_gdbus_get_type ())
++#define UNIQUE_BACKEND_GDBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNIQUE_TYPE_BACKEND_GDBUS, UniqueBackendGDBus))
++#define UNIQUE_IS_BACKEND_GDBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNIQUE_TYPE_BACKEND_GDBUS))
++#define UNIQUE_BACKEND_GDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNIQUE_TYPE_BACKEND_GDBUS, UniqueBackendGDBusClass))
++#define UNIQUE_IS_BACKEND_GDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNIQUE_TYPE_BACKEND_GDBUS))
++#define UNIQUE_BACKEND_GDBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNIQUE_TYPE_BACKEND_GDBUS, UniqueBackendGDBusClass))
++
++typedef struct _UniqueBackendGDBus UniqueBackendGDBus;
++typedef struct _UniqueBackendGDBusClass UniqueBackendGDBusClass;
++
++GType unique_backend_gdbus_get_type (void) G_GNUC_CONST;
++
++G_END_DECLS
++
++#endif /* __UNIQUE_BACKEND_GDBUS_H__ */
+diff --git a/unique/uniquebackend.c b/unique/uniquebackend.c
+index 18a0c45..a76e42e 100644
+--- a/unique/uniquebackend.c
++++ b/unique/uniquebackend.c
+@@ -298,6 +298,9 @@ unique_backend_send_message (UniqueBackend *backend,
+ #ifdef HAVE_DBUS
+ #include "dbus/uniquebackend-dbus.h"
+ #endif
++#ifdef HAVE_GDBUS
++#include "gdbus/uniquebackend-gdbus.h"
++#endif
+
+ /**
+ * unique_backend_create:
+@@ -329,6 +332,10 @@ unique_backend_create (void)
+ if (strcmp (backend_name, "dbus") == 0)
+ backend_gtype = unique_backend_dbus_get_type ();
+ #endif /* HAVE_DBUS */
++#ifdef HAVE_GDBUS
++ if (strcmp (backend_name, "gdbus") == 0)
++ backend_gtype = unique_backend_gdbus_get_type ();
++#endif /* HAVE_GDBUS */
+ #if !defined(HAVE_BACON) && !defined(HAVE_DBUS)
+ #error Need either bacon or dbus
+ #endif
+--
+cgit v0.8.3.1
diff --git a/gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch b/gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch
new file mode 100644
index 0000000..7c70ba0
--- /dev/null
+++ b/gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch
@@ -0,0 +1,117 @@
+diff -Nur libunique-1.1.6.orig/unique/uniqueapp.c libunique-1.1.6/unique/uniqueapp.c
+--- libunique-1.1.6.orig/unique/uniqueapp.c 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniqueapp.c 2011-12-01 07:39:59.132319788 +0000
+@@ -781,7 +781,7 @@
+ }
+
+
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_command_to_string (UniqueApp *app,
+ gint command)
+ {
+@@ -863,7 +863,7 @@
+ return retval;
+ }
+
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_response_to_string (UniqueResponse response)
+ {
+ GEnumClass *enum_class;
+diff -Nur libunique-1.1.6.orig/unique/uniquebackend.c libunique-1.1.6/unique/uniquebackend.c
+--- libunique-1.1.6.orig/unique/uniquebackend.c 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquebackend.c 2011-12-01 07:39:24.418677950 +0000
+@@ -111,7 +111,7 @@
+ *
+ * Return value: FIXME
+ */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_backend_get_name (UniqueBackend *backend)
+ {
+ g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), NULL);
+@@ -154,7 +154,7 @@
+ *
+ * Return value: FIXME
+ */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_backend_get_startup_id (UniqueBackend *backend)
+ {
+ g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), NULL);
+diff -Nur libunique-1.1.6.orig/unique/uniquebackend.h libunique-1.1.6/unique/uniquebackend.h
+--- libunique-1.1.6.orig/unique/uniquebackend.h 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquebackend.h 2011-12-01 07:42:13.833467492 +0000
+@@ -94,10 +94,10 @@
+
+ UniqueBackend * unique_backend_create (void);
+
+-G_CONST_RETURN gchar *unique_backend_get_name (UniqueBackend *backend);
++const gchar *unique_backend_get_name (UniqueBackend *backend);
+ void unique_backend_set_name (UniqueBackend *backend,
+ const gchar *name);
+-G_CONST_RETURN gchar *unique_backend_get_startup_id (UniqueBackend *backend);
++const gchar *unique_backend_get_startup_id (UniqueBackend *backend);
+ void unique_backend_set_startup_id (UniqueBackend *backend,
+ const gchar *startup_id);
+ GdkScreen * unique_backend_get_screen (UniqueBackend *backend);
+diff -Nur libunique-1.1.6.orig/unique/uniqueinternals.h libunique-1.1.6/unique/uniqueinternals.h
+--- libunique-1.1.6.orig/unique/uniqueinternals.h 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniqueinternals.h 2011-12-01 07:41:17.142977914 +0000
+@@ -44,11 +44,11 @@
+ * and then back into an id
+ */
+ UniqueResponse unique_response_from_string (const gchar *response);
+-G_CONST_RETURN gchar *unique_response_to_string (UniqueResponse response);
++const gchar *unique_response_to_string (UniqueResponse response);
+
+ gint unique_command_from_string (UniqueApp *app,
+ const gchar *command);
+-G_CONST_RETURN gchar *unique_command_to_string (UniqueApp *app,
++const gchar *unique_command_to_string (UniqueApp *app,
+ gint command);
+
+ G_END_DECLS
+diff -Nur libunique-1.1.6.orig/unique/uniquemessage.c libunique-1.1.6/unique/uniquemessage.c
+--- libunique-1.1.6.orig/unique/uniquemessage.c 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquemessage.c 2011-12-01 07:41:45.743225713 +0000
+@@ -185,7 +185,7 @@
+ *
+ * Since: 1.0.2
+ */
+-G_CONST_RETURN guchar *
++const guchar *
+ unique_message_data_get (UniqueMessageData *message_data,
+ gsize *length)
+ {
+@@ -525,7 +525,7 @@
+ * owned by the #UniqueMessageData structure and should not be
+ * modified or freed
+ */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_message_data_get_startup_id (UniqueMessageData *message_data)
+ {
+ g_return_val_if_fail (message_data != NULL, NULL);
+diff -Nur libunique-1.1.6.orig/unique/uniquemessage.h libunique-1.1.6/unique/uniquemessage.h
+--- libunique-1.1.6.orig/unique/uniquemessage.h 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquemessage.h 2011-12-01 07:40:47.576064565 +0000
+@@ -48,7 +48,7 @@
+ void unique_message_data_set (UniqueMessageData *message_data,
+ const guchar *data,
+ gsize length);
+-G_CONST_RETURN guchar *unique_message_data_get (UniqueMessageData *message_data,
++const guchar *unique_message_data_get (UniqueMessageData *message_data,
+ gsize *length);
+
+ gboolean unique_message_data_set_text (UniqueMessageData *message_data,
+@@ -63,7 +63,7 @@
+ gchar * unique_message_data_get_filename (UniqueMessageData *message_data);
+
+ GdkScreen * unique_message_data_get_screen (UniqueMessageData *message_data);
+-G_CONST_RETURN gchar * unique_message_data_get_startup_id (UniqueMessageData *message_data);
++const gchar * unique_message_data_get_startup_id (UniqueMessageData *message_data);
+ guint unique_message_data_get_workspace (UniqueMessageData *message_data);
+
+ G_END_DECLS
--
1.9.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH] gnu: Add libunique.
@ 2016-02-19 20:10 Fabian Harfert
2016-02-20 6:18 ` Leo Famulari
0 siblings, 1 reply; 15+ messages in thread
From: Fabian Harfert @ 2016-02-19 20:10 UTC (permalink / raw)
To: guix-devel
* gnu/packages/patches/libunique-gdbus.patch: New file.
* gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch: New file.
* gnu/packages/glib.scm (libunique): New variable.
---
gnu/packages/glib.scm | 32 ++
gnu/packages/patches/libunique-gdbus.patch | 529 +++++++++++++++++++++
.../patches/libunique-remove-G_CONST_RETURN.patch | 117 +++++
3 files changed, 678 insertions(+)
create mode 100644 gnu/packages/patches/libunique-gdbus.patch
create mode 100644 gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index f8e1541..259a744 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Fabian Harfert <fhmgufs@web.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +28,7 @@
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
+ #:use-module (guix build-system glib-or-gtk)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages bison)
@@ -611,3 +613,33 @@ many applications simultaneously.
This package provides the library for GLib applications.")
(license license:lgpl2.1+)))
+
+(define-public libunique
+ (package
+ (name "libunique")
+ (version "1.1.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnome/sources/libunique/"
+ (version-major+minor version) "/"
+ name "-" version ".tar.bz2"))
+ (sha256
+ (base32
+ "1fsgvmncd9caw552lyfg8swmsd6bh4ijjsph69bwacwfxwf09j75"))
+ (patches
+ (list (search-patch "libunique-gdbus.patch")
+ (search-patch "libunique-remove-G_CONST_RETURN.patch")))))
+ (build-system glib-or-gtk-build-system)
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("gobject-introspection" ,gobject-introspection)
+ ("glib:bin" ,glib "bin")))
+ (propagated-inputs
+ `(("gtk+" ,gtk+-2)))
+ (home-page "https://wiki.gnome.org/Attic/LibUnique")
+ (synopsis "Library for writing single instance application")
+ (description
+ "Libunique is library providing a mechanism to allow only one running
+instance of an application.")
+ (license license:lgpl2.1+)))
diff --git a/gnu/packages/patches/libunique-gdbus.patch b/gnu/packages/patches/libunique-gdbus.patch
new file mode 100644
index 0000000..880c0c0
--- /dev/null
+++ b/gnu/packages/patches/libunique-gdbus.patch
@@ -0,0 +1,529 @@
+From 01066039529c0181f231325476bb4823c16a2aea Mon Sep 17 00:00:00 2001
+From: Christian Persch <chpe@gnome.org>
+Date: Sat, 15 May 2010 17:47:45 +0000
+Subject: Add GDBus backend
+
+Add backend using GDBus, the new D-BUS binding in GIO 2.25.
+
+Bug #618723.
+---
+diff --git a/configure.ac b/configure.ac
+index bc3163a..b6a4221 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -116,6 +116,19 @@ AS_IF([test "x$have_dbus" = "xyes"],
+
+ AM_CONDITIONAL([HAVE_DBUS], [test "x$have_dbus" = "xyes"])
+
++dnl GDBus backend
++dnl This is the default backend if GIO is recent enough
++m4_define([gdbus_gio_required],[2.25.7])
++PKG_CHECK_MODULES([GDBUS],[gio-2.0 >= gdbus_gio_required],[have_gdbus=yes],[have_gdbus=no])
++
++AS_IF([test "x$have_gdbus" = "xyes"],
++ [
++ AC_DEFINE([HAVE_GDBUS],[1],[Define if GDBus backend is enabled])
++ ]
++ )
++
++AM_CONDITIONAL([HAVE_GDBUS],[test "$have_gdbus" = "yes"])
++
+ dnl Bacon backend
+ dnl This is the fallback backend, so we *need* these headers and functions
+ dnl even if we end up using D-Bus
+@@ -146,7 +159,13 @@ AM_CONDITIONAL([HAVE_BACON], [test "x$have_bacon" = "xyes"])
+
+ dnl Choose the default backend
+ AC_MSG_CHECKING([for default IPC mechanism])
+-AS_IF([test "x$have_dbus" = "xyes"],
++AS_IF([test "x$have_gdbus" = "xyes"],
++ [
++ UNIQUE_DEFAULT_BACKEND=gdbus
++ AC_MSG_RESULT([GDBus])
++ ],
++
++ [test "x$have_dbus" = "xyes"],
+ [
+ UNIQUE_DEFAULT_BACKEND=dbus
+ AC_MSG_RESULT([D-Bus])
+@@ -243,6 +262,7 @@ AC_CONFIG_FILES([
+ unique/uniqueversion.h
+ unique/bacon/Makefile
+ unique/dbus/Makefile
++ unique/gdbus/Makefile
+ tests/Makefile
+ po/Makefile.in
+ ])
+@@ -261,6 +281,7 @@ Configuration:
+ Backends:
+ Unix Domain Socket: $have_bacon
+ D-BUS: $have_dbus
++ GDBus: $have_gdbus
+
+ Default backend: $UNIQUE_DEFAULT_BACKEND
+ "
+diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
+index 3172588..2c1dbf4 100644
+--- a/doc/reference/Makefile.am
++++ b/doc/reference/Makefile.am
+@@ -50,7 +50,8 @@ IGNORE_HFILES = \
+ uniquemarshal.h \
+ stamp-uniquemarshal.h \
+ bacon \
+- dbus
++ dbus \
++ gdbus
+
+ EXTRA_HFILES =
+
+diff --git a/unique/Makefile.am b/unique/Makefile.am
+index 6475a87..8f0b7ba 100644
+--- a/unique/Makefile.am
++++ b/unique/Makefile.am
+@@ -12,7 +12,11 @@ if HAVE_DBUS
+ SUBDIRS += dbus
+ endif
+
+-DIST_SUBDIRS = bacon dbus
++if HAVE_GDBUS
++SUBDIRS += gdbus
++endif
++
++DIST_SUBDIRS = bacon dbus gdbus
+
+ INCLUDES = -I$(top_srcdir)
+
+@@ -72,6 +76,10 @@ if HAVE_DBUS
+ unique_backend_libs += $(top_builddir)/unique/dbus/libunique-dbus.la
+ endif
+
++if HAVE_GDBUS
++unique_backend_libs += $(top_builddir)/unique/gdbus/libunique-gdbus.la
++endif
++
+ uniquedir = $(includedir)/unique-1.0/unique
+ unique_HEADERS = \
+ $(unique_sources_h) \
+diff --git a/unique/gdbus/.gitignore b/unique/gdbus/.gitignore
+new file mode 100644
+index 0000000..c7e22c3
+--- /dev/null
++++ b/unique/gdbus/.gitignore
+@@ -0,0 +1,2 @@
++libunique_gdbus_la-uniquebackend-gdbus.lo
++libunique-gdbus.la
+diff --git a/unique/gdbus/Makefile.am b/unique/gdbus/Makefile.am
+new file mode 100644
+index 0000000..e10637d
+--- /dev/null
++++ b/unique/gdbus/Makefile.am
+@@ -0,0 +1,24 @@
++include $(top_srcdir)/build/autotools/Makefile.am.silent
++
++noinst_LTLIBRARIES = libunique-gdbus.la
++
++libunique_gdbus_la_SOURCES = \
++ uniquebackend-gdbus.h \
++ uniquebackend-gdbus.c
++
++libunique_gdbus_la_PPCFLAGS = \
++ -DG_LOG_DOMAIN=\"Unique-GDBus\" \
++ -DG_DISABLE_SINGLE_INCLUDES \
++ -I$(top_srcdir) \
++ $(AM_CPPFLAGS)
++
++libunique_gdbus_la_CFLAGS = \
++ $(UNIQUE_CFLAGS) \
++ $(UNIQUE_DEBUG_CFLAGS) \
++ $(MAINTAINER_CFLAGS) \
++ $(GDBUS_CFLAGS) \
++ $(AM_CFLAGS)
++
++libunique_gdbus_la_LIBADD = \
++ $(UNIQUE_LIBS) \
++ $(GDBUS_LIBS)
+diff --git a/unique/gdbus/uniquebackend-gdbus.c b/unique/gdbus/uniquebackend-gdbus.c
+new file mode 100644
+index 0000000..14d54a9
+--- /dev/null
++++ b/unique/gdbus/uniquebackend-gdbus.c
+@@ -0,0 +1,303 @@
++/* Unique - Single Instance application library
++ * uniquebackend-gdbus.c: GDBus implementation of UniqueBackend
++ *
++ * Copyright (C) 2007 Emmanuele Bassi <ebassi@o-hand.com>
++ * Copyright © 2010 Christian Persch
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#include <gio/gio.h>
++#include <gdk/gdk.h>
++
++#include "../uniqueinternals.h"
++#include "uniquebackend-gdbus.h"
++
++struct _UniqueBackendGDBus
++{
++ UniqueBackend parent_instance;
++
++ GDBusConnection *connection;
++ guint registration_id;
++ guint owner_id;
++ gboolean owns_name;
++ GMainLoop *loop;
++};
++
++struct _UniqueBackendGDBusClass
++{
++ UniqueBackendClass parent_class;
++ GDBusNodeInfo *introspection_data;
++};
++
++G_DEFINE_TYPE (UniqueBackendGDBus, unique_backend_gdbus, UNIQUE_TYPE_BACKEND);
++
++static const char introspection_xml[] =
++ "<node name='/'>"
++ "<interface name='org.gtk.UniqueApp'>"
++ "<method name='SendMessage'>"
++ "<arg name='command' type='s' direction='in'/>"
++ "<arg name='message' type='(suuus)' direction='in'/>"
++ "<arg name='time' type='u' direction='in'/>"
++ "<arg name='response' type='s' direction='out'/>"
++ "</method>"
++ "</interface>"
++ "</node>";
++
++static void
++method_call_cb (GDBusConnection *connection,
++ const gchar *sender,
++ const gchar *object_path,
++ const gchar *interface_name,
++ const gchar *method_name,
++ GVariant *parameters,
++ GDBusMethodInvocation *invocation,
++ gpointer user_data)
++{
++ if (g_strcmp0 (interface_name, "org.gtk.UniqueApp") != 0 ||
++ g_strcmp0 (object_path, "/Factory") != 0)
++ return;
++
++ if (g_strcmp0 (method_name, "SendMessage") == 0)
++ {
++ UniqueBackend *backend = UNIQUE_BACKEND (user_data);
++ const gchar *command_str, *data, *startup_id;
++ guint len, screen_num, workspace, time_;
++ UniqueMessageData message_data;
++ gint command;
++ UniqueResponse response;
++ GdkDisplay *display;
++
++ g_variant_get (parameters,
++ "(&s(&suuu&s)u)",
++ &command_str,
++ &data, &len, &screen_num, &workspace, &startup_id,
++ &time_);
++
++ command = unique_command_from_string (backend->parent, command_str);
++ if (command == 0)
++ {
++ g_dbus_method_invocation_return_error (invocation,
++ G_DBUS_ERROR,
++ G_DBUS_ERROR_INVALID_ARGS,
++ "Invalid command `%s' received",
++ command_str);
++ return;
++ }
++
++ display = gdk_display_get_default ();
++
++ message_data.data = len > 0 ? (guchar *) data : NULL;
++ message_data.length = (gint) len;
++ message_data.workspace = workspace;
++ message_data.startup_id = (char *) startup_id;
++ if (screen_num >= 0 && screen_num < gdk_display_get_n_screens (display))
++ message_data.screen = gdk_display_get_screen (display, screen_num);
++ else
++ message_data.screen = gdk_screen_get_default ();
++
++ response = unique_app_emit_message_received (backend->parent, command, &message_data, time_);
++
++ g_dbus_method_invocation_return_value (invocation,
++ g_variant_new ("(s)", unique_response_to_string (response)));
++ return;
++ }
++}
++
++static void
++name_acquired_cb (GDBusConnection *connection,
++ const gchar *name,
++ gpointer user_data)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (user_data);
++
++ backend_gdbus->owns_name = TRUE;
++ if (backend_gdbus->loop && g_main_loop_is_running (backend_gdbus->loop))
++ g_main_loop_quit (backend_gdbus->loop);
++}
++
++static void
++name_lost_cb (GDBusConnection *connection,
++ const gchar *name,
++ gpointer user_data)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (user_data);
++
++ backend_gdbus->owns_name = FALSE;
++ if (backend_gdbus->loop && g_main_loop_is_running (backend_gdbus->loop))
++ g_main_loop_quit (backend_gdbus->loop);
++}
++
++static const GDBusInterfaceVTable interface_vtable = {
++ method_call_cb,
++ NULL,
++ NULL
++};
++
++static gboolean
++unique_backend_gdbus_request_name (UniqueBackend *backend)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (backend);
++ UniqueBackendGDBusClass *klass = UNIQUE_BACKEND_GDBUS_GET_CLASS (backend);
++ GError *error;
++
++ error = NULL;
++ backend_gdbus->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
++ if (!backend_gdbus->connection)
++ {
++ g_warning ("Unable to open a connection to the session bus: %s",
++ error->message);
++ g_error_free (error);
++
++ return FALSE;
++ }
++
++ backend_gdbus->registration_id =
++ g_dbus_connection_register_object (backend_gdbus->connection,
++ "/Factory",
++ klass->introspection_data->interfaces[0],
++ &interface_vtable,
++ backend, NULL,
++ &error);
++ if (backend_gdbus->registration_id == 0)
++ {
++ g_warning ("Unable to register object with the session bus: %s",
++ error->message);
++ g_error_free (error);
++
++ return FALSE;
++ }
++
++ backend_gdbus->owns_name = FALSE;
++
++ backend_gdbus->owner_id =
++ g_bus_own_name_on_connection (backend_gdbus->connection,
++ unique_backend_get_name (backend),
++ G_BUS_NAME_OWNER_FLAGS_NONE,
++ name_acquired_cb,
++ name_lost_cb,
++ backend, NULL);
++
++ backend_gdbus->loop = g_main_loop_new (NULL, FALSE);
++ g_main_loop_run (backend_gdbus->loop);
++ g_main_loop_unref (backend_gdbus->loop);
++ backend_gdbus->loop = NULL;
++
++ return backend_gdbus->owns_name;
++}
++
++static UniqueResponse
++unique_backend_gdbus_send_message (UniqueBackend *backend,
++ gint command,
++ UniqueMessageData *message_data,
++ guint time_)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (backend);
++ GVariantBuilder builder;
++ GVariant *result;
++ const gchar *command_str, *resp;
++ UniqueResponse response;
++ GError *error;
++
++ command_str = unique_command_to_string (backend->parent, command);
++
++ g_variant_builder_init (&builder, G_VARIANT_TYPE ("(s(suuus)u)"));
++ g_variant_builder_add (&builder, "s", command_str ? command_str : "");
++ g_variant_builder_open (&builder, G_VARIANT_TYPE ("(suuus)"));
++ g_variant_builder_add (&builder, "s", message_data->data ? (char *) message_data->data : "");
++ g_variant_builder_add (&builder, "u", (guint) message_data->length);
++ g_variant_builder_add (&builder, "u", (guint) gdk_screen_get_number (message_data->screen));
++ g_variant_builder_add (&builder, "u", (guint) message_data->workspace);
++ g_variant_builder_add (&builder, "s", message_data->startup_id ? message_data->startup_id : "");
++ g_variant_builder_close (&builder);
++ g_variant_builder_add (&builder, "u", time_);
++
++ error = NULL;
++ result = g_dbus_connection_call_sync (backend_gdbus->connection,
++ unique_backend_get_name (backend),
++ "/Factory",
++ "org.gtk.UniqueApp",
++ "SendMessage",
++ g_variant_builder_end (&builder),
++ G_VARIANT_TYPE ("(s)"),
++ G_DBUS_CALL_FLAGS_NO_AUTO_START,
++ -1,
++ NULL,
++ &error);
++ if (error)
++ {
++ g_warning ("Error while sending message: %s", error->message);
++ g_error_free (error);
++
++ return UNIQUE_RESPONSE_INVALID;
++ }
++
++ g_variant_get (result, "(&s)", &resp);
++ response = unique_response_from_string (resp);
++ g_variant_unref (result);
++
++ return response;
++}
++
++static void
++unique_backend_gdbus_dispose (GObject *gobject)
++{
++ UniqueBackendGDBus *backend_gdbus = UNIQUE_BACKEND_GDBUS (gobject);
++
++ if (backend_gdbus->owner_id != 0)
++ {
++ g_bus_unown_name (backend_gdbus->owner_id);
++ backend_gdbus->owner_id = 0;
++ }
++ if (backend_gdbus->registration_id != 0)
++ {
++ g_assert (backend_gdbus->connection != NULL);
++ g_dbus_connection_unregister_object (backend_gdbus->connection,
++ backend_gdbus->registration_id);
++ backend_gdbus->registration_id = 0;
++ }
++ if (backend_gdbus->connection)
++ {
++ g_object_unref (backend_gdbus->connection);
++ backend_gdbus->connection = NULL;
++ }
++
++ G_OBJECT_CLASS (unique_backend_gdbus_parent_class)->dispose (gobject);
++}
++
++static void
++unique_backend_gdbus_class_init (UniqueBackendGDBusClass *klass)
++{
++ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
++ UniqueBackendClass *backend_class = UNIQUE_BACKEND_CLASS (klass);
++
++ gobject_class->dispose = unique_backend_gdbus_dispose;
++
++ backend_class->request_name = unique_backend_gdbus_request_name;
++ backend_class->send_message = unique_backend_gdbus_send_message;
++
++ klass->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
++ g_assert (klass->introspection_data != NULL);
++}
++
++static void
++unique_backend_gdbus_init (UniqueBackendGDBus *backend)
++{
++}
+diff --git a/unique/gdbus/uniquebackend-gdbus.h b/unique/gdbus/uniquebackend-gdbus.h
+new file mode 100644
+index 0000000..41eb6e5
+--- /dev/null
++++ b/unique/gdbus/uniquebackend-gdbus.h
+@@ -0,0 +1,43 @@
++/* Unique - Single Instance application library
++ * uniquebackend-gdbus.c: GDBus implementation of UniqueBackend
++ *
++ * Copyright (C) 2007 Emmanuele Bassi <ebassi@o-hand.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301 USA
++ */
++
++#ifndef __UNIQUE_BACKEND_GDBUS_H__
++#define __UNIQUE_BACKEND_GDBUS_H__
++
++#include <unique/uniquebackend.h>
++
++G_BEGIN_DECLS
++
++#define UNIQUE_TYPE_BACKEND_GDBUS (unique_backend_gdbus_get_type ())
++#define UNIQUE_BACKEND_GDBUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNIQUE_TYPE_BACKEND_GDBUS, UniqueBackendGDBus))
++#define UNIQUE_IS_BACKEND_GDBUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNIQUE_TYPE_BACKEND_GDBUS))
++#define UNIQUE_BACKEND_GDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNIQUE_TYPE_BACKEND_GDBUS, UniqueBackendGDBusClass))
++#define UNIQUE_IS_BACKEND_GDBUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNIQUE_TYPE_BACKEND_GDBUS))
++#define UNIQUE_BACKEND_GDBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNIQUE_TYPE_BACKEND_GDBUS, UniqueBackendGDBusClass))
++
++typedef struct _UniqueBackendGDBus UniqueBackendGDBus;
++typedef struct _UniqueBackendGDBusClass UniqueBackendGDBusClass;
++
++GType unique_backend_gdbus_get_type (void) G_GNUC_CONST;
++
++G_END_DECLS
++
++#endif /* __UNIQUE_BACKEND_GDBUS_H__ */
+diff --git a/unique/uniquebackend.c b/unique/uniquebackend.c
+index 18a0c45..a76e42e 100644
+--- a/unique/uniquebackend.c
++++ b/unique/uniquebackend.c
+@@ -298,6 +298,9 @@ unique_backend_send_message (UniqueBackend *backend,
+ #ifdef HAVE_DBUS
+ #include "dbus/uniquebackend-dbus.h"
+ #endif
++#ifdef HAVE_GDBUS
++#include "gdbus/uniquebackend-gdbus.h"
++#endif
+
+ /**
+ * unique_backend_create:
+@@ -329,6 +332,10 @@ unique_backend_create (void)
+ if (strcmp (backend_name, "dbus") == 0)
+ backend_gtype = unique_backend_dbus_get_type ();
+ #endif /* HAVE_DBUS */
++#ifdef HAVE_GDBUS
++ if (strcmp (backend_name, "gdbus") == 0)
++ backend_gtype = unique_backend_gdbus_get_type ();
++#endif /* HAVE_GDBUS */
+ #if !defined(HAVE_BACON) && !defined(HAVE_DBUS)
+ #error Need either bacon or dbus
+ #endif
+--
+cgit v0.8.3.1
diff --git a/gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch b/gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch
new file mode 100644
index 0000000..7c70ba0
--- /dev/null
+++ b/gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch
@@ -0,0 +1,117 @@
+diff -Nur libunique-1.1.6.orig/unique/uniqueapp.c libunique-1.1.6/unique/uniqueapp.c
+--- libunique-1.1.6.orig/unique/uniqueapp.c 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniqueapp.c 2011-12-01 07:39:59.132319788 +0000
+@@ -781,7 +781,7 @@
+ }
+
+
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_command_to_string (UniqueApp *app,
+ gint command)
+ {
+@@ -863,7 +863,7 @@
+ return retval;
+ }
+
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_response_to_string (UniqueResponse response)
+ {
+ GEnumClass *enum_class;
+diff -Nur libunique-1.1.6.orig/unique/uniquebackend.c libunique-1.1.6/unique/uniquebackend.c
+--- libunique-1.1.6.orig/unique/uniquebackend.c 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquebackend.c 2011-12-01 07:39:24.418677950 +0000
+@@ -111,7 +111,7 @@
+ *
+ * Return value: FIXME
+ */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_backend_get_name (UniqueBackend *backend)
+ {
+ g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), NULL);
+@@ -154,7 +154,7 @@
+ *
+ * Return value: FIXME
+ */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_backend_get_startup_id (UniqueBackend *backend)
+ {
+ g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), NULL);
+diff -Nur libunique-1.1.6.orig/unique/uniquebackend.h libunique-1.1.6/unique/uniquebackend.h
+--- libunique-1.1.6.orig/unique/uniquebackend.h 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquebackend.h 2011-12-01 07:42:13.833467492 +0000
+@@ -94,10 +94,10 @@
+
+ UniqueBackend * unique_backend_create (void);
+
+-G_CONST_RETURN gchar *unique_backend_get_name (UniqueBackend *backend);
++const gchar *unique_backend_get_name (UniqueBackend *backend);
+ void unique_backend_set_name (UniqueBackend *backend,
+ const gchar *name);
+-G_CONST_RETURN gchar *unique_backend_get_startup_id (UniqueBackend *backend);
++const gchar *unique_backend_get_startup_id (UniqueBackend *backend);
+ void unique_backend_set_startup_id (UniqueBackend *backend,
+ const gchar *startup_id);
+ GdkScreen * unique_backend_get_screen (UniqueBackend *backend);
+diff -Nur libunique-1.1.6.orig/unique/uniqueinternals.h libunique-1.1.6/unique/uniqueinternals.h
+--- libunique-1.1.6.orig/unique/uniqueinternals.h 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniqueinternals.h 2011-12-01 07:41:17.142977914 +0000
+@@ -44,11 +44,11 @@
+ * and then back into an id
+ */
+ UniqueResponse unique_response_from_string (const gchar *response);
+-G_CONST_RETURN gchar *unique_response_to_string (UniqueResponse response);
++const gchar *unique_response_to_string (UniqueResponse response);
+
+ gint unique_command_from_string (UniqueApp *app,
+ const gchar *command);
+-G_CONST_RETURN gchar *unique_command_to_string (UniqueApp *app,
++const gchar *unique_command_to_string (UniqueApp *app,
+ gint command);
+
+ G_END_DECLS
+diff -Nur libunique-1.1.6.orig/unique/uniquemessage.c libunique-1.1.6/unique/uniquemessage.c
+--- libunique-1.1.6.orig/unique/uniquemessage.c 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquemessage.c 2011-12-01 07:41:45.743225713 +0000
+@@ -185,7 +185,7 @@
+ *
+ * Since: 1.0.2
+ */
+-G_CONST_RETURN guchar *
++const guchar *
+ unique_message_data_get (UniqueMessageData *message_data,
+ gsize *length)
+ {
+@@ -525,7 +525,7 @@
+ * owned by the #UniqueMessageData structure and should not be
+ * modified or freed
+ */
+-G_CONST_RETURN gchar *
++const gchar *
+ unique_message_data_get_startup_id (UniqueMessageData *message_data)
+ {
+ g_return_val_if_fail (message_data != NULL, NULL);
+diff -Nur libunique-1.1.6.orig/unique/uniquemessage.h libunique-1.1.6/unique/uniquemessage.h
+--- libunique-1.1.6.orig/unique/uniquemessage.h 2011-12-01 07:38:17.748122298 +0000
++++ libunique-1.1.6/unique/uniquemessage.h 2011-12-01 07:40:47.576064565 +0000
+@@ -48,7 +48,7 @@
+ void unique_message_data_set (UniqueMessageData *message_data,
+ const guchar *data,
+ gsize length);
+-G_CONST_RETURN guchar *unique_message_data_get (UniqueMessageData *message_data,
++const guchar *unique_message_data_get (UniqueMessageData *message_data,
+ gsize *length);
+
+ gboolean unique_message_data_set_text (UniqueMessageData *message_data,
+@@ -63,7 +63,7 @@
+ gchar * unique_message_data_get_filename (UniqueMessageData *message_data);
+
+ GdkScreen * unique_message_data_get_screen (UniqueMessageData *message_data);
+-G_CONST_RETURN gchar * unique_message_data_get_startup_id (UniqueMessageData *message_data);
++const gchar * unique_message_data_get_startup_id (UniqueMessageData *message_data);
+ guint unique_message_data_get_workspace (UniqueMessageData *message_data);
+
+ G_END_DECLS
--
1.9.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-02-19 20:10 [PATCH] gnu: Add libunique Fabian Harfert
@ 2016-02-20 6:18 ` Leo Famulari
2016-08-01 14:46 ` ng0
2016-08-03 14:47 ` ng0
0 siblings, 2 replies; 15+ messages in thread
From: Leo Famulari @ 2016-02-20 6:18 UTC (permalink / raw)
To: Fabian Harfert; +Cc: guix-devel
On Fri, Feb 19, 2016 at 09:10:44PM +0100, Fabian Harfert wrote:
Thanks for the patch!
> * gnu/packages/patches/libunique-gdbus.patch: New file.
> * gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch: New file.
Can you give the context of these patches?
I see there are newer versions available:
https://git.gnome.org/browse/unique/log/
Perhaps a more recent release would not require the patches?
In any case, remember you have to register the patches in gnu_system.am
(dist_patch_DATA). There's a recent example in 4e58a402.
> * gnu/packages/glib.scm (libunique): New variable.
[...]
> + (synopsis "Library for writing single instance application")
How about "Library for writing single instance applications"?
> + (description
> + "Libunique is library providing a mechanism to allow only one running
> +instance of an application.")
I think we should steal Debian's description:
"Libunique is a library for writing single instance application. If you
launch a single instance application twice, the second instance will
either just quit or will send a message to the running instance.
Libunique makes it easy to write this kind of applications, by providing a
base class, taking care of all the IPC machinery needed to send messages
to a running instance, and also handling the startup notification side."
https://packages.debian.org/stretch/libunique-3.0-0
[...]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-02-20 6:18 ` Leo Famulari
@ 2016-08-01 14:46 ` ng0
2016-08-03 14:47 ` ng0
1 sibling, 0 replies; 15+ messages in thread
From: ng0 @ 2016-08-01 14:46 UTC (permalink / raw)
To: Leo Famulari, Fabian Harfert; +Cc: guix-devel
Hello Fabian Harfert,
I see your contribution did not receive any further reaction.
Did it just disappear in the work-in-progress branches/folders you have,
or do you have no further intentions to work on it for whatever reasons
it may be (time, resources, …)?
I'd like to move this contribution of yours over the "finishing line",
tell me if you like to pick up work on it or prefer someone else to
finish it.
Thanks,
ng0
Leo Famulari <leo@famulari.name> writes:
> On Fri, Feb 19, 2016 at 09:10:44PM +0100, Fabian Harfert wrote:
>
> Thanks for the patch!
>
>> * gnu/packages/patches/libunique-gdbus.patch: New file.
>> * gnu/packages/patches/libunique-remove-G_CONST_RETURN.patch: New file.
>
> Can you give the context of these patches?
>
> I see there are newer versions available:
> https://git.gnome.org/browse/unique/log/
>
> Perhaps a more recent release would not require the patches?
>
> In any case, remember you have to register the patches in gnu_system.am
> (dist_patch_DATA). There's a recent example in 4e58a402.
>
>> * gnu/packages/glib.scm (libunique): New variable.
>
> [...]
>
>> + (synopsis "Library for writing single instance application")
>
> How about "Library for writing single instance applications"?
>
>> + (description
>> + "Libunique is library providing a mechanism to allow only one running
>> +instance of an application.")
>
> I think we should steal Debian's description:
>
> "Libunique is a library for writing single instance application. If you
> launch a single instance application twice, the second instance will
> either just quit or will send a message to the running instance.
>
> Libunique makes it easy to write this kind of applications, by providing a
> base class, taking care of all the IPC machinery needed to send messages
> to a running instance, and also handling the startup notification side."
> https://packages.debian.org/stretch/libunique-3.0-0
>
> [...]
>
--
♥Ⓐ ng0
Current Keys: https://we.make.ritual.n0.is/ng0.txt
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-02-20 6:18 ` Leo Famulari
2016-08-01 14:46 ` ng0
@ 2016-08-03 14:47 ` ng0
2016-08-03 15:57 ` ng0
1 sibling, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-03 14:47 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 246 bytes --]
I gave this a try, loosely based on the patch for the older version I
created a patch for the the more current version of libunique.
Maybe someone has input on the errors or what to add/change, I am
working on other things in parallel.
Thanks.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-libunique.patch --]
[-- Type: text/x-patch, Size: 2329 bytes --]
From 162c92ef3ddbd635462157c8900dc4edbe43e817 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@we.make.ritual.n0.is>
Date: Wed, 3 Aug 2016 08:18:14 +0000
Subject: [PATCH] gnu: Add libunique.
* gnu/packages/gnome.scm (libunique): New variable.
---
gnu/packages/gnome.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 2038f8f..9df26ee 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5420,3 +5420,40 @@ GLib/GObject code.")
"Libgnomekbd is a keyboard configuration library for the GNOME desktop
environment, which can notably display keyboard layouts.")
(license license:lgpl2.0+)))
+
+(define-public libunique
+ (package
+ (name "libunique")
+ (version "3.0.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnome/sources/" name "/"
+ (version-major+minor version) "/"
+ name "-" version ".tar.xz"))
+ (sha256
+ (base32
+ "0f70lkw66v9cj72q0iw1s2546r6bwwcd8idcm3621fg2fgh2rw58"))))
+ ;;(build-system gnu-build-system)
+ (build-system glib-or-gtk-build-system)
+ (arguments
+ `(#:configure-flags '("--disable-static"
+ "--disable-dbus" ; use gdbus
+ "--enable-introspection")))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("gobject-introspection" ,gobject-introspection)
+ ("glib:bin" ,glib "bin")
+ ("gtk-doc" ,gtk-doc)))
+ (propagated-inputs
+ ;; Referred to in .h files and .pc.
+ `(("gtk+" ,gtk+)))
+ (home-page "https://wiki.gnome.org/Attic/LibUnique")
+ (synopsis "Library for writing single instance application")
+ (description
+ "Libunique is a library for writing single instance application. If you
+launch a single instance application twice, the second instance will
+either just quit or will send a message to the running instance.
+Libunique makes it easy to write this kind of applications, by providing a
+base class, taking care of all the IPC machinery needed to send messages
+to a running instance, and also handling the startup notification side.")
+ (license license:lgpl2.1+)))
--
2.9.2
[-- Attachment #3: Type: text/plain, Size: 168 bytes --]
Error output follows in next message.
--
♥Ⓐ ng0
Current Keys: https://we.make.ritual.n0.is/ng0.txt
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-03 14:47 ` ng0
@ 2016-08-03 15:57 ` ng0
2016-08-05 18:44 ` ng0
0 siblings, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-03 15:57 UTC (permalink / raw)
To: guix-devel
ng0 <ng0@we.make.ritual.n0.is> writes:
> I gave this a try, loosely based on the patch for the older version I
> created a patch for the the more current version of libunique.
> Maybe someone has input on the errors or what to add/change, I am
> working on other things in parallel.
Where "the errors" obviously are building gtk-doc fails at the moment.
> Thanks.
>
> From 162c92ef3ddbd635462157c8900dc4edbe43e817 Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@we.make.ritual.n0.is>
> Date: Wed, 3 Aug 2016 08:18:14 +0000
> Subject: [PATCH] gnu: Add libunique.
>
> * gnu/packages/gnome.scm (libunique): New variable.
> ---
> gnu/packages/gnome.scm | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 2038f8f..9df26ee 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -5420,3 +5420,40 @@ GLib/GObject code.")
> "Libgnomekbd is a keyboard configuration library for the GNOME desktop
> environment, which can notably display keyboard layouts.")
> (license license:lgpl2.0+)))
> +
> +(define-public libunique
> + (package
> + (name "libunique")
> + (version "3.0.2")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "mirror://gnome/sources/" name "/"
> + (version-major+minor version) "/"
> + name "-" version ".tar.xz"))
> + (sha256
> + (base32
> + "0f70lkw66v9cj72q0iw1s2546r6bwwcd8idcm3621fg2fgh2rw58"))))
> + ;;(build-system gnu-build-system)
> + (build-system glib-or-gtk-build-system)
> + (arguments
> + `(#:configure-flags '("--disable-static"
> + "--disable-dbus" ; use gdbus
> + "--enable-introspection")))
> + (native-inputs
> + `(("pkg-config" ,pkg-config)
> + ("gobject-introspection" ,gobject-introspection)
> + ("glib:bin" ,glib "bin")
> + ("gtk-doc" ,gtk-doc)))
> + (propagated-inputs
> + ;; Referred to in .h files and .pc.
> + `(("gtk+" ,gtk+)))
> + (home-page "https://wiki.gnome.org/Attic/LibUnique")
> + (synopsis "Library for writing single instance application")
> + (description
> + "Libunique is a library for writing single instance application. If you
> +launch a single instance application twice, the second instance will
> +either just quit or will send a message to the running instance.
> +Libunique makes it easy to write this kind of applications, by providing a
> +base class, taking care of all the IPC machinery needed to send messages
> +to a running instance, and also handling the startup notification side.")
> + (license license:lgpl2.1+)))
> --
> 2.9.2
>
>
> Error output follows in next message.
^
Actually, no.
--
♥Ⓐ ng0
Current Keys: https://we.make.ritual.n0.is/ng0.txt
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-03 15:57 ` ng0
@ 2016-08-05 18:44 ` ng0
2016-08-15 18:03 ` Leo Famulari
0 siblings, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-05 18:44 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1.1: Type: text/plain, Size: 41 bytes --]
Fixed. Can someone review and apply it?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-libunique.patch --]
[-- Type: text/x-patch, Size: 2387 bytes --]
From 7079fabc8eee8913df79346cd5747837a3262825 Mon Sep 17 00:00:00 2001
From: ng0 <ng0@we.make.ritual.n0.is>
Date: Wed, 3 Aug 2016 08:18:14 +0000
Subject: [PATCH] gnu: Add libunique.
* gnu/packages/gnome.scm (libunique): New variable.
---
gnu/packages/gnome.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 2038f8f..9df26ee 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5420,3 +5420,40 @@ GLib/GObject code.")
"Libgnomekbd is a keyboard configuration library for the GNOME desktop
environment, which can notably display keyboard layouts.")
(license license:lgpl2.0+)))
+
+(define-public libunique
+ (package
+ (name "libunique")
+ (version "3.0.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnome/sources/" name "/"
+ (version-major+minor version) "/"
+ name "-" version ".tar.xz"))
+ (sha256
+ (base32
+ "0f70lkw66v9cj72q0iw1s2546r6bwwcd8idcm3621fg2fgh2rw58"))))
+ ;;(build-system gnu-build-system)
+ (build-system glib-or-gtk-build-system)
+ (arguments
+ `(#:configure-flags '("--disable-static"
+ "--disable-dbus" ; use gdbus
+ "--enable-introspection")))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("gobject-introspection" ,gobject-introspection)
+ ("glib:bin" ,glib "bin")
+ ("gtk-doc" ,gtk-doc)))
+ (propagated-inputs
+ ;; Referred to in .h files and .pc.
+ `(("gtk+" ,gtk+)))
+ (home-page "https://wiki.gnome.org/Attic/LibUnique")
+ (synopsis "Library for writing single instance application")
+ (description
+ "Libunique is a library for writing single instance application. If you
+launch a single instance application twice, the second instance will
+either just quit or will send a message to the running instance.
+Libunique makes it easy to write this kind of applications, by providing a
+base class, taking care of all the IPC machinery needed to send messages
+to a running instance, and also handling the startup notification side.")
+ (license license:lgpl2.1+)))
--
2.9.2
[-- Attachment #1.3: Type: text/plain, Size: 134 bytes --]
--
♥Ⓐ ng0
Current Keys: https://we.make.ritual.n0.is/ng0.txt
For non-prism friendly talk find me on http://www.psyced.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-05 18:44 ` ng0
@ 2016-08-15 18:03 ` Leo Famulari
2016-08-15 23:33 ` ng0
0 siblings, 1 reply; 15+ messages in thread
From: Leo Famulari @ 2016-08-15 18:03 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
On Fri, Aug 05, 2016 at 06:44:47PM +0000, ng0 wrote:
> Subject: [PATCH] gnu: Add libunique.
>
> * gnu/packages/gnome.scm (libunique): New variable.
This package appears abandoned by its developers:
WARNING
Unique is now in maintenance mode, and its usage is strongly discouraged.
Applications should use the GtkApplication class provided by GTK+ 3.0.
If you are using Unique, read the GtkApplication porting guide provided by GTK+.
source: https://wiki.gnome.org/Attic/LibUnique
Is this package required by something else that we are working on? What
is the use case?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-15 18:03 ` Leo Famulari
@ 2016-08-15 23:33 ` ng0
2016-08-16 19:45 ` Leo Famulari
0 siblings, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-15 23:33 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
Leo Famulari <leo@famulari.name> writes:
> [ Unknown signature status ]
> On Fri, Aug 05, 2016 at 06:44:47PM +0000, ng0 wrote:
>> Subject: [PATCH] gnu: Add libunique.
>>
>> * gnu/packages/gnome.scm (libunique): New variable.
>
> This package appears abandoned by its developers:
I am aware of that, as I pointed out earlier in the thread.
> WARNING
> Unique is now in maintenance mode, and its usage is strongly discouraged.
> Applications should use the GtkApplication class provided by GTK+ 3.0.
> If you are using Unique, read the GtkApplication porting guide provided by GTK+.
>
> source: https://wiki.gnome.org/Attic/LibUnique
>
> Is this package required by something else that we are working on? What
> is the use case?
(gnunet-gtk):
(arguments
`(#:configure-flags
(list "--without-libunique"
"--with-qrencode"
(string-append "--with-gnunet="
(assoc-ref %build-inputs "gnunet")))))
Maybe also racket, at least libunique-1.0 appears in its definition, I
have no desire to understand its meaning in there now.
I'd like to have libunique available for gnunet-gtk, but I also have planned
to address some further questions to other gnunet developers about
dependencies I found in the last year packaging it, so it might or might
not be necessary.
--
♥Ⓐ ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-15 23:33 ` ng0
@ 2016-08-16 19:45 ` Leo Famulari
2016-08-17 9:52 ` ng0
0 siblings, 1 reply; 15+ messages in thread
From: Leo Famulari @ 2016-08-16 19:45 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
On Mon, Aug 15, 2016 at 11:33:26PM +0000, ng0 wrote:
> Leo Famulari <leo@famulari.name> writes:
> > Is this package required by something else that we are working on? What
> > is the use case?
>
> (gnunet-gtk):
>
> (arguments
> `(#:configure-flags
> (list "--without-libunique"
Okay, then I think we should add the package with a comment that says
it's unmaintained. What do you think of the attached patch?
[-- Attachment #2: 0001-gnu-Add-libunique.patch --]
[-- Type: text/x-diff, Size: 2587 bytes --]
From fa8fbd899756cf948da23e9a29d92a5f48d4eb1c Mon Sep 17 00:00:00 2001
From: ng0 <ng0@we.make.ritual.n0.is>
Date: Wed, 3 Aug 2016 08:18:14 +0000
Subject: [PATCH] gnu: Add libunique.
* gnu/packages/gnome.scm (libunique): New variable.
Signed-off-by: Leo Famulari <leo@famulari.name>
---
gnu/packages/gnome.scm | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4a0be01..b094c30 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5420,3 +5420,43 @@ GLib/GObject code.")
"Libgnomekbd is a keyboard configuration library for the GNOME desktop
environment, which can notably display keyboard layouts.")
(license license:lgpl2.0+)))
+
+;;; This package is no longer maintained:
+;;; https://wiki.gnome.org/Attic/LibUnique
+;;; "Unique is now in maintenance mode, and its usage is strongly discouraged.
+;;; Applications should use the GtkApplication class provided by GTK+ 3.0."
+(define-public libunique
+ (package
+ (name "libunique")
+ (version "3.0.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnome/sources/" name "/"
+ (version-major+minor version) "/"
+ name "-" version ".tar.xz"))
+ (sha256
+ (base32
+ "0f70lkw66v9cj72q0iw1s2546r6bwwcd8idcm3621fg2fgh2rw58"))))
+ (build-system glib-or-gtk-build-system)
+ (arguments
+ `(#:configure-flags '("--disable-static"
+ "--disable-dbus" ; use gdbus
+ "--enable-introspection")))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("gobject-introspection" ,gobject-introspection)
+ ("glib:bin" ,glib "bin")
+ ("gtk-doc" ,gtk-doc)))
+ (propagated-inputs
+ ;; Referred to in .h files and .pc.
+ `(("gtk+" ,gtk+)))
+ (home-page "https://wiki.gnome.org/Attic/LibUnique")
+ (synopsis "Library for writing single instance applications")
+ (description
+ "Libunique is a library for writing single instance applications. If you
+launch a single instance application twice, the second instance will either just
+quit or will send a message to the running instance. Libunique makes it easy to
+write this kind of application, by providing a base class, taking care of all
+the IPC machinery needed to send messages to a running instance, and also
+handling the startup notification side.")
+ (license license:lgpl2.1+)))
--
2.9.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-16 19:45 ` Leo Famulari
@ 2016-08-17 9:52 ` ng0
2016-08-19 22:51 ` Leo Famulari
0 siblings, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-17 9:52 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
Leo Famulari <leo@famulari.name> writes:
> On Mon, Aug 15, 2016 at 11:33:26PM +0000, ng0 wrote:
>> Leo Famulari <leo@famulari.name> writes:
>> > Is this package required by something else that we are working on? What
>> > is the use case?
>>
>> (gnunet-gtk):
>>
>> (arguments
>> `(#:configure-flags
>> (list "--without-libunique"
>
> Okay, then I think we should add the package with a comment that says
> it's unmaintained. What do you think of the attached patch?
Looks good to me. This way if some old application should require
libunique, we have it. I'll also ask about libunique at gnunet-devel
list with some other applications I need to question. As far as I
understand Christian, they want to avoid external dependencies where
possible. A ifcase for gnunet-gtk is in the HEAD of gnunet-gtk.
Thanks
> From fa8fbd899756cf948da23e9a29d92a5f48d4eb1c Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@we.make.ritual.n0.is>
> Date: Wed, 3 Aug 2016 08:18:14 +0000
> Subject: [PATCH] gnu: Add libunique.
>
> * gnu/packages/gnome.scm (libunique): New variable.
>
> Signed-off-by: Leo Famulari <leo@famulari.name>
> ---
> gnu/packages/gnome.scm | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 4a0be01..b094c30 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -5420,3 +5420,43 @@ GLib/GObject code.")
> "Libgnomekbd is a keyboard configuration library for the GNOME desktop
> environment, which can notably display keyboard layouts.")
> (license license:lgpl2.0+)))
> +
> +;;; This package is no longer maintained:
> +;;; https://wiki.gnome.org/Attic/LibUnique
> +;;; "Unique is now in maintenance mode, and its usage is strongly discouraged.
> +;;; Applications should use the GtkApplication class provided by GTK+ 3.0."
> +(define-public libunique
> + (package
> + (name "libunique")
> + (version "3.0.2")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "mirror://gnome/sources/" name "/"
> + (version-major+minor version) "/"
> + name "-" version ".tar.xz"))
> + (sha256
> + (base32
> + "0f70lkw66v9cj72q0iw1s2546r6bwwcd8idcm3621fg2fgh2rw58"))))
> + (build-system glib-or-gtk-build-system)
> + (arguments
> + `(#:configure-flags '("--disable-static"
> + "--disable-dbus" ; use gdbus
> + "--enable-introspection")))
> + (native-inputs
> + `(("pkg-config" ,pkg-config)
> + ("gobject-introspection" ,gobject-introspection)
> + ("glib:bin" ,glib "bin")
> + ("gtk-doc" ,gtk-doc)))
> + (propagated-inputs
> + ;; Referred to in .h files and .pc.
> + `(("gtk+" ,gtk+)))
> + (home-page "https://wiki.gnome.org/Attic/LibUnique")
> + (synopsis "Library for writing single instance applications")
> + (description
> + "Libunique is a library for writing single instance applications. If you
> +launch a single instance application twice, the second instance will either just
> +quit or will send a message to the running instance. Libunique makes it easy to
> +write this kind of application, by providing a base class, taking care of all
> +the IPC machinery needed to send messages to a running instance, and also
> +handling the startup notification side.")
> + (license license:lgpl2.1+)))
> --
> 2.9.3
>
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-17 9:52 ` ng0
@ 2016-08-19 22:51 ` Leo Famulari
2016-08-20 9:36 ` ng0
0 siblings, 1 reply; 15+ messages in thread
From: Leo Famulari @ 2016-08-19 22:51 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
On Wed, Aug 17, 2016 at 09:52:40AM +0000, ng0 wrote:
> Leo Famulari <leo@famulari.name> writes:
> > Okay, then I think we should add the package with a comment that says
> > it's unmaintained. What do you think of the attached patch?
>
> Looks good to me. This way if some old application should require
> libunique, we have it. I'll also ask about libunique at gnunet-devel
> list with some other applications I need to question. As far as I
> understand Christian, they want to avoid external dependencies where
> possible. A ifcase for gnunet-gtk is in the HEAD of gnunet-gtk.
What does your last sentence mean?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-19 22:51 ` Leo Famulari
@ 2016-08-20 9:36 ` ng0
2016-08-22 14:16 ` ng0
0 siblings, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-20 9:36 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
Leo Famulari <leo@famulari.name> writes:
> On Wed, Aug 17, 2016 at 09:52:40AM +0000, ng0 wrote:
>> Leo Famulari <leo@famulari.name> writes:
>> > Okay, then I think we should add the package with a comment that says
>> > it's unmaintained. What do you think of the attached patch?
>>
>> Looks good to me. This way if some old application should require
>> libunique, we have it. I'll also ask about libunique at gnunet-devel
>> list with some other applications I need to question. As far as I
>> understand Christian, they want to avoid external dependencies where
>> possible. A ifcase for gnunet-gtk is in the HEAD of gnunet-gtk.
>
> What does your last sentence mean?
I should be more precise and provide context to statements. I am
sorry. I meant this:
https://gnunet.org/svn/gnunet-gtk/src/fs/gnunet-fs-gtk.c
/**
* @file src/fs/gnunet-fs-gtk.c
* @brief Main function of gnunet-fs-gtk
* @author Christian Grothoff
*/
#include "gnunet-fs-gtk.h"
#include "gnunet-fs-gtk_common.h"
#include "gnunet-fs-gtk_event-handler.h"
#include "gnunet-fs-gtk_open-uri.h"
#if HAVE_LIBUNIQUE
#include <unique/unique.h>
#endif
and similar inclusions.
By the way, I've asked about specific dependencies here
(https://gnunet.org/bugs/view.php?id=4618 ), including libunique.
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-20 9:36 ` ng0
@ 2016-08-22 14:16 ` ng0
2016-08-22 19:47 ` Leo Famulari
0 siblings, 1 reply; 15+ messages in thread
From: ng0 @ 2016-08-22 14:16 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
So we need libunique definitely:
libunique is used so that if you start gnunet-gtk applications twice,
you still only get one window. This makes sense in combination with
'gnunet-uri', which may launch a possibly already running GUI to process
a particular URI. In this case, libunique is used to detect that the GUI
is already up, and pass the URI to the running process.
There _may_ be a more modern alternative in Gtk3 these days, but for now
we need libunique for this functionality.
see: https://gnunet.org/bugs/view.php?id=4618#c11050
Is this patch good for merging?
--
ng0
For non-prism friendly talk find me on http://www.psyced.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] gnu: Add libunique.
2016-08-22 14:16 ` ng0
@ 2016-08-22 19:47 ` Leo Famulari
0 siblings, 0 replies; 15+ messages in thread
From: Leo Famulari @ 2016-08-22 19:47 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
On Mon, Aug 22, 2016 at 02:16:49PM +0000, ng0 wrote:
> So we need libunique definitely:
>
> libunique is used so that if you start gnunet-gtk applications twice,
> you still only get one window. This makes sense in combination with
> 'gnunet-uri', which may launch a possibly already running GUI to process
> a particular URI. In this case, libunique is used to detect that the GUI
> is already up, and pass the URI to the running process.
>
> There _may_ be a more modern alternative in Gtk3 these days, but for now
> we need libunique for this functionality.
>
> see: https://gnunet.org/bugs/view.php?id=4618#c11050
>
> Is this patch good for merging?
Okay, pushed as 85327d0d4. Thank you for your work on this!
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-08-22 19:47 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19 20:10 [PATCH] gnu: Add libunique Fabian Harfert
2016-02-20 6:18 ` Leo Famulari
2016-08-01 14:46 ` ng0
2016-08-03 14:47 ` ng0
2016-08-03 15:57 ` ng0
2016-08-05 18:44 ` ng0
2016-08-15 18:03 ` Leo Famulari
2016-08-15 23:33 ` ng0
2016-08-16 19:45 ` Leo Famulari
2016-08-17 9:52 ` ng0
2016-08-19 22:51 ` Leo Famulari
2016-08-20 9:36 ` ng0
2016-08-22 14:16 ` ng0
2016-08-22 19:47 ` Leo Famulari
-- strict thread matches above, loose matches on Subject: below --
2016-02-19 19:14 Fabian Harfert
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).