[brasero] Make brasero running as a single instance application.



commit c406a64d1fd494302813fec8532c19c5ace389de
Author: Luis Medinas <lmedinas gnome org>
Date:   Wed Apr 22 17:25:18 2009 +0100

    Make brasero running as a single instance application.
    Using libunique.
---
 configure.in      |    8 ++++++++
 src/brasero-app.c |   17 +++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index cb25aea..65a6198 100644
--- a/configure.in
+++ b/configure.in
@@ -115,6 +115,7 @@ GCONF_REQUIRED=2.0.0
 GSTREAMER_REQUIRED=0.10.15
 GSTREAMER_BASE_REQUIRED=0.10.0
 LIBXML2_REQUIRED=2.6.0
+LIBUNIQUE_REQUIRED=1.0.0
 HAL_REQUIRED=0.5
 DBUS_REQUIRED=0.7.2
 
@@ -146,6 +147,13 @@ PKG_CHECK_MODULES(BRASERO_LIBXML, 	\
 AC_SUBST(BRASERO_LIBXML_CFLAGS)
 AC_SUBST(BRASERO_LIBXML_LIBS)
 
+dnl ** used by brasero
+PKG_CHECK_MODULES(BRASERO_LIBUNIQUE, 	\
+	unique-1.0 >= $LIBUNIQUE_REQUIRED)
+
+AC_SUBST(BRASERO_LIBUNIQUE_CFLAGS)
+AC_SUBST(BRASERO_LIBUNIQUE_LIBS)
+
 dnl ** used by brasero and all modules
 PKG_CHECK_MODULES(BRASERO_GLIB, 		\
 	gobject-2.0 >= $GLIB_REQUIRED		\
diff --git a/src/brasero-app.c b/src/brasero-app.c
index 5042244..74b7c87 100644
--- a/src/brasero-app.c
+++ b/src/brasero-app.c
@@ -32,6 +32,8 @@
 #include <libxml/parser.h>
 #include <libxml/xmlstring.h>
 
+#include <unique/unique.h>
+
 #include "brasero-misc.h"
 
 #include "brasero-app.h"
@@ -1443,11 +1445,26 @@ void
 brasero_app_run_mainwin (BraseroApp *app)
 {
 	BraseroAppPrivate *priv;
+	UniqueApp *uapp;
 
 	priv = BRASERO_APP_PRIVATE (app);
 
 	priv->mainwin_running = 1;
 	gtk_widget_show (GTK_WIDGET (priv->mainwin));
+
+	uapp = unique_app_new ("org.gnome.Brasero", NULL);
+
+	if (unique_app_is_running (uapp))
+	{
+		UniqueResponse response;
+
+		response = unique_app_send_message (uapp, UNIQUE_ACTIVATE, NULL);
+    		g_object_unref (uapp);
+		uapp = NULL;
+       
+		return response == UNIQUE_RESPONSE_OK;
+	}
+
 	gtk_main ();
 }
 



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