[gnome-video-arcade] Migrate from UniqueApp to GtkApplication.



commit 9d6756fce298a44cbb987c4d3142ddb009f06042
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Apr 3 10:08:17 2011 -0400

    Migrate from UniqueApp to GtkApplication.
    
    Drop our dependency on unique-3.0.

 configure.ac               |    5 -----
 docs/reference/Makefile.am |    2 --
 maint/Makefile.am          |    6 ++----
 src/Makefile.am            |    7 +++----
 src/gva-common.h           |    1 -
 src/main.c                 |   25 +++++++++++++++++--------
 6 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5504857..146c1c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,11 +43,6 @@ PKG_CHECK_MODULES(SQLITE, $SQLITE_MODULES)
 AC_SUBST(SQLITE_CFLAGS)
 AC_SUBST(SQLITE_LIBS)
 
-UNIQUE_MODULES="unique-3.0 >= 2.91"
-PKG_CHECK_MODULES(UNIQUE, $UNIQUE_MODULES)
-AC_SUBST(UNIQUE_CFLAGS)
-AC_SUBST(UNIQUE_LIBS)
-
 # Needed for the monospace font name.
 GDS_MODULES="gsettings-desktop-schemas"
 PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, $GDS_MODULES)
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 140a4e2..dc77475 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -80,7 +80,6 @@ INCLUDES=							\
 	$(GIT_CFLAGS)						\
 	$(GSTREAMER_CFLAGS)					\
 	$(SQLITE_CFLAGS)					\
-	$(UNIQUE_CFLAGS)					\
 	$(WNCK_CFLAGS)
 
 if HAVE_DBUS
@@ -122,7 +121,6 @@ GTKDOC_LIBS=							\
 	$(GIT_LIBS)						\
 	$(GSTREAMER_LIBS)					\
 	$(SQLITE_LIBS)						\
-	$(UNIQUE_LIBS)						\
 	$(WNCK_LIBS)
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
diff --git a/maint/Makefile.am b/maint/Makefile.am
index 061d35f..8ada941 100644
--- a/maint/Makefile.am
+++ b/maint/Makefile.am
@@ -12,8 +12,7 @@ gladegva_LTLIBRARIES = libgladegva.la
 gladegvadir = `$(PKG_CONFIG) --variable=moduledir gladeui-1.0`
 
 libgladegva_la_CFLAGS = \
-	@GLIB_CFLAGS@ @GTK_CFLAGS@ \
-	@GSTREAMER_CFLAGS@ @UNIQUE_CFLAGS@
+	@GLIB_CFLAGS@ @GTK_CFLAGS@ @GSTREAMER_CFLAGS@
 
 libgladegva_la_SOURCES = \
 	$(top_srcdir)/src/gva-column-manager.c \
@@ -24,8 +23,7 @@ libgladegva_la_LDFLAGS = \
 	-module -avoid-version
 
 libgladegva_la_LIBADD = \
-	@GLIB_LIBS@ @GTK_LIBS@ \
-	@GSTREAMER_LIBS@ @UNIQUE_LIBS@
+	@GLIB_LIBS@ @GTK_LIBS@ @GSTREAMER_LIBS@
 
 EXTRA_DIST = \
 	$(gladecatalog_DATA) \
diff --git a/src/Makefile.am b/src/Makefile.am
index c9f73e9..4c803b7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,9 +4,8 @@ bin_PROGRAMS = gnome-video-arcade
 
 AM_CFLAGS = \
 	-Wall \
-	@DBUS_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@ \
-	@GIT_CFLAGS@ @GSTREAMER_CFLAGS@ @SQLITE_CFLAGS@ \
-	@UNIQUE_CFLAGS@ @WNCK_CFLAGS@
+	@DBUS_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@ @GIT_CFLAGS@ \
+	@GSTREAMER_CFLAGS@ @SQLITE_CFLAGS@ @WNCK_CFLAGS@
 
 AM_CPPFLAGS = \
 	-DG_LOG_DOMAIN=\"Gva\" \
@@ -87,7 +86,7 @@ EXTRA_gnome_video_arcade_SOURCES = \
 gnome_video_arcade_LDADD = \
 	@DBUS_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ \
 	@GIT_LIBS@ @GSTREAMER_LIBS@ @MAME_BACKEND@ \
-	@SQLITE_LIBS@ @UNIQUE_LIBS@ @WNCK_LIBS@
+	@SQLITE_LIBS@ @WNCK_LIBS@
 
 gnome_video_arcade_DEPENDENCIES = \
 	@MAME_BACKEND@
diff --git a/src/gva-common.h b/src/gva-common.h
index 7b996c1..bcc97ce 100644
--- a/src/gva-common.h
+++ b/src/gva-common.h
@@ -39,7 +39,6 @@
 #endif
 
 #include <sqlite3.h>
-#include <unique/unique.h>
 
 #define GVA_SETTING_ALL_COLUMNS                 "all-columns"
 #define GVA_SETTING_AUTO_PLAY                   "auto-play"
diff --git a/src/main.c b/src/main.c
index 4c8ca29..66376a7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -43,6 +43,8 @@
 #include "gva-dbus.h"
 #endif
 
+#define APPLICATION_ID "org.gnome.VideoArcade"
+
 #define SQL_COUNT_ROMS \
         "SELECT count(*) FROM game WHERE " \
         "romset NOTNULL AND romset != 'not found' " \
@@ -281,7 +283,8 @@ setup_file_monitors (void)
 gint
 main (gint argc, gchar **argv)
 {
-        UniqueApp *app;
+        GtkApplication *application;
+        GApplicationFlags flags;
         gchar *path;
         GError *error = NULL;
 
@@ -344,9 +347,16 @@ main (gint argc, gchar **argv)
                 exit (EXIT_SUCCESS);
         }
 
+        /* Register the application with the session bus. */
+        flags = G_APPLICATION_FLAGS_NONE;
+        application = gtk_application_new (APPLICATION_ID, flags);
+        g_application_register (G_APPLICATION (application), NULL, &error);
+
+        if (error != NULL)
+                g_error ("%s", error->message);
+
         /* If another instance is running, exit now. */
-        app = unique_app_new ("org.gnome.VideoArcade", NULL);
-        if (unique_app_is_running (app))
+        if (g_application_get_is_remote (G_APPLICATION (application)))
         {
                 gint exit_status;
 
@@ -359,12 +369,11 @@ main (gint argc, gchar **argv)
                 }
                 else
                 {
-                        /* XXX Not handling response, but no real need to. */
-                        unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
+                        g_application_activate (G_APPLICATION (application));
                         exit_status = EXIT_SUCCESS;
                 }
 
-                g_object_unref (app);
+                g_object_unref (application);
 
                 exit (exit_status);
         }
@@ -373,7 +382,7 @@ main (gint argc, gchar **argv)
                 GtkWindow *window;
 
                 window = GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW);
-                unique_app_watch_window (app, window);
+                gtk_application_add_window (application, window);
         }
 
         gtk_window_set_default_icon_name (PACKAGE);
@@ -406,7 +415,7 @@ main (gint argc, gchar **argv)
 
         gtk_main ();
 
-        g_object_unref (app);
+        g_object_unref (application);
 
         return EXIT_SUCCESS;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]