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 --- maximus/main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'maximus/main.c') 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