implemented the psensor uniquess, non-primary psensor
authorJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 24 Apr 2012 08:03:08 +0000 (08:03 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 24 Apr 2012 08:03:08 +0000 (08:03 +0000)
   instances show the window of the primary psensor instance and
   exits.

NEWS
po/Makefile.in
src/main.c

diff --git a/NEWS b/NEWS
index 00751ae..ad60b4b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@
 ** psensor: fixed many memory leaks in cfg.c (gconf2 keys).
 ** psensor: fixed memory leak (sensor name when specified by the
    configuration).
+** psensor: implemented the psensor uniquess, non-primary psensor
+   instances show the window of the primary psensor instance and
+   exits.
 
 * v0.6.2.17
 
index 136065a..59dadd7 100644 (file)
@@ -21,7 +21,7 @@ srcdir = .
 top_srcdir = ..
 
 
-prefix = /tmp/p
+prefix = /usr
 exec_prefix = ${prefix}
 datarootdir = ${prefix}/share
 datadir = ${datarootdir}
@@ -34,12 +34,12 @@ INSTALL_DATA = ${INSTALL} -m 644
 # We use $(mkdir_p).
 # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
 # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
-# ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh does not start with $(SHELL), so we add it.
+# ${SHELL} /mnt/nfs4/users/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh does not start with $(SHELL), so we add it.
 # In automake >= 1.10, /bin/mkdir -p is derived from ${MKDIR_P}, which is defined
 # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
 # versions, $(mkinstalldirs) and $(install_sh) are unused.
-mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh -d
-install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh
+mkinstalldirs = $(SHELL) ${SHELL} /mnt/nfs4/users/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh -d
+install_sh = $(SHELL) ${SHELL} /mnt/nfs4/users/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh
 MKDIR_P = /bin/mkdir -p
 mkdir_p = /bin/mkdir -p
 
index 89cf2b9..fd1d44b 100644 (file)
@@ -383,6 +383,12 @@ static void log_glib_info()
                  glib_micro_version);
 }
 
+static void activate(GApplication *application,
+                    gpointer data)
+{
+       ui_window_show((struct ui_psensor *)data);
+}
+
 int main(int argc, char **argv)
 {
        struct ui_psensor ui;
@@ -390,6 +396,7 @@ int main(int argc, char **argv)
        GThread *thread;
        int optc, cmdok, opti, use_libatasmart;
        char *url = NULL;
+       GApplication *app;
 
        program_name = argv[0];
 
@@ -438,6 +445,17 @@ int main(int argc, char **argv)
 
        log_init();
 
+       app = g_application_new("wpitchoune.psensor", 0);
+       g_application_register(app, NULL, NULL);
+
+       if (g_application_get_is_remote(app)) {
+               g_application_activate(app);
+               log_debug(_("Psensor instance already exists"));
+               exit(EXIT_SUCCESS);
+       }
+
+       g_signal_connect(app, "activate", G_CALLBACK(activate), &ui);
+
        log_glib_info();
 #if !(GLIB_CHECK_VERSION(2, 31, 0))
        /*