From 90d41af3d0107ecd33ad5d3f01e6793454d800bb Mon Sep 17 00:00:00 2001 From: ZenWalker Date: Sun, 31 Jul 2016 02:20:14 +0200 Subject: Port from libunique to GApplication Fixes #29 --- configure.ac | 3 --- maximus/main.c | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index a7e771d..73dc289 100644 --- a/configure.ac +++ b/configure.ac @@ -51,11 +51,9 @@ AC_MSG_RESULT([$with_gtk]) case "$with_gtk" in 2.0) GTK_API_VERSION=2.0 LIBWNCK_API_VERSION=1.0 - LIBUNIQUE_API_VERSION=1.0 ;; 3.0) GTK_API_VERSION=3.0 LIBWNCK_API_VERSION=3.0 - LIBUNIQUE_API_VERSION=3.0 ;; esac @@ -66,7 +64,6 @@ PKG_CHECK_MODULES(MAXIMUS_DEPS, libwnck-$LIBWNCK_API_VERSION xtst libfakekey - unique-$LIBUNIQUE_API_VERSION ) AC_SUBST(MAXIMUS_DEPS_CFLAGS) AC_SUBST(MAXIMUS_DEPS_LIBS) diff --git a/maximus/main.c b/maximus/main.c index 159c7bf..644ceca 100644 --- a/maximus/main.c +++ b/maximus/main.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "maximus-app.h" @@ -60,17 +60,25 @@ GOptionEntry entries[] = gint main (gint argc, gchar *argv[]) { - UniqueApp *unique; + GApplication *application; MaximusApp UNUSED_VARIABLE *app; GOptionContext *context; + GError *error = NULL; g_set_application_name ("Maximus"); gtk_init (&argc, &argv); - unique = unique_app_new ("com.canonical.Maximus", NULL); + application = g_application_new ("com.canonical.Maximus", G_APPLICATION_FLAGS_NONE); + + if (!g_application_register (application, NULL, &error)) + { + g_warning ("%s", error->message); + g_error_free (error); + return 1; + } - if (unique_app_is_running (unique)) + if (g_application_get_is_remote(application)) { return 0; } -- cgit v1.2.1