Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=f5a6b13ae80602d08edbdb8848c270b4a822429d

commit f5a6b13ae80602d08edbdb8848c270b4a822429d
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Tue Jan 11 00:11:17 2011 +0100

*use libunique for start only one instance of frugalware-tweak-pacman-update

diff --git a/frugal-tweak-vala/Makefile b/frugal-tweak-vala/Makefile
index c92361f..7e137db 100644
--- a/frugal-tweak-vala/Makefile
+++ b/frugal-tweak-vala/Makefile
@@ -43,7 +43,7 @@ frugalwaretweak:

pacmanupdate:
$(VALAC) --Xcc="-Wl,--export-dynamic"  --save-temps --define=$(DEBUGFLAG) --pkg 
gio-2.0 --pkg gtk+-2.0 --pkg gmodule-2.0  --pkg pacman \
-       --pkg posix  --pkg libxml-2.0 --thread  \
+       --pkg posix  --pkg libxml-2.0 --thread  --pkg unique-1.0 \
$(PACMANUPDATESOURCES) -o frugalware-tweak-pacman-update

minipacman:
diff --git a/frugal-tweak-vala/src/Pacman-update.vala 
b/frugal-tweak-vala/src/Pacman-update.vala
index 9a19068..b8b0905 100644
--- a/frugal-tweak-vala/src/Pacman-update.vala
+++ b/frugal-tweak-vala/src/Pacman-update.vala
@@ -18,10 +18,27 @@
*/

using Gtk;
+using Unique;
using Tree;

int main (string[] args) {
+       Unique.App app;
Gtk.init (ref args);
+       app = new Unique.App("org.pacmanupdate.unique", null);
+
+       if(app.is_running) { //not starting if already running
+               Unique.Command command;
+               Unique.Response response;
+               Unique.MessageData message;
+               message = new MessageData ();
+               command = (Unique.Command) Unique.Command.ACTIVATE;
+               response = app.send_message (command, message);
+
+               if(response == Unique.Response.OK)
+                       return 0;
+               else
+                       return 1;
+       }
var builder = new Builder ();
builder.add_from_file ("/usr/share/frugalware-tweak/UI/MainUI.ui");
EventGtk event = new EventGtk();
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to