2007-03-14 [colin] 2.8.1cvs9
authorColin Leroy <colin@colino.net>
Wed, 14 Mar 2007 17:16:49 +0000 (17:16 +0000)
committerColin Leroy <colin@colino.net>
Wed, 14 Mar 2007 17:16:49 +0000 (17:16 +0000)
* src/main.c
If claws-mail is running on another
display, warn instead of popping it up
on the other display

ChangeLog
PATCHSETS
configure.ac
src/main.c

index ef3bd7989a70e852475cdb0f3d4781ccc94ab811..c75d894646a818e32b0e229b6d2efa8fc1918b66 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-03-14 [colin]     2.8.1cvs9
+
+       * src/main.c
+               If claws-mail is running on another
+               display, warn instead of popping it up
+               on the other display
+
 2007-03-12 [colin]     2.8.1cvs8
 
        * src/wizard.c
index aa18829a59b1202a1f4f8e363638a995010bb6f7..52d837801ea42ecd74a19caab9921db9e03edfc4 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.207.2.150 -r 1.207.2.151 src/folderview.c;  cvs diff -u -r 1.204.2.122 -r 1.204.2.123 src/prefs_common.c;  cvs diff -u -r 1.103.2.76 -r 1.103.2.77 src/prefs_common.h;  cvs diff -u -r 1.1.2.38 -r 1.1.2.39 src/prefs_summaries.c;  ) > 2.8.1cvs6.patchset
 ( cvs diff -u -r 1.395.2.285 -r 1.395.2.286 src/summaryview.c;  ) > 2.8.1cvs7.patchset
 ( cvs diff -u -r 1.1.2.50 -r 1.1.2.51 src/wizard.c;  ) > 2.8.1cvs8.patchset
+( cvs diff -u -r 1.115.2.141 -r 1.115.2.142 src/main.c;  ) > 2.8.1cvs9.patchset
index 0664b2bff5807ccc67ae2f95d915d8cc6518ccce..6246388ad48bf75d9a6a5e4272fa1fc07c84e376 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=8
+EXTRA_VERSION=9
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 4036651ce3fbac1b7d1cb39556c5ccf80af40611..dae04eab5edd4bbbe342009db718c0625687820c 100644 (file)
@@ -123,7 +123,7 @@ static SnDisplay *sn_display = NULL;
 
 static gint lock_socket = -1;
 static gint lock_socket_tag = 0;
-
+static gchar *x_display = NULL;
 typedef enum 
 {
        ONLINE_MODE_DONT_CHANGE,
@@ -1400,6 +1400,10 @@ static gint prohibit_duplicate_launch(void)
 
        path = claws_get_socket_name();
        uxsock = fd_connect_unix(path);
+       
+       if (x_display == NULL)
+               x_display = g_strdup(g_getenv("DISPLAY"));
+
        if (uxsock < 0) {
                g_unlink(path);
                return fd_open_unix(path);
@@ -1485,8 +1489,19 @@ static gint prohibit_duplicate_launch(void)
                gchar *str = g_strdup_printf("select %s\n", cmd.target);
                fd_write_all(uxsock, str, strlen(str));
                g_free(str);
-       } else
-               fd_write_all(uxsock, "popup\n", 6);
+       } else {
+               gchar buf[BUFSIZ];
+               fd_write_all(uxsock, "get_display\n", 12);
+               fd_gets(uxsock, buf, sizeof(buf));
+               if (strcmp2(buf, x_display)) {
+                       printf("Claws Mail is already running on display %s.\n",
+                               buf);
+               } else {
+                       fd_close(uxsock);
+                       uxsock = fd_connect_unix(path);
+                       fd_write_all(uxsock, "popup\n", 6);
+               }
+       }
 
        fd_close(uxsock);
        return -1;
@@ -1551,6 +1566,8 @@ static void lock_socket_input_cb(gpointer data,
 
        if (!strncmp(buf, "popup", 5)) {
                main_window_popup(mainwin);
+       } else if (!strncmp(buf, "get_display", 11)) {
+               fd_write_all(sock, x_display, strlen(x_display));
        } else if (!strncmp(buf, "receive_all", 11)) {
                inc_all_account_mail(mainwin, FALSE,
                                     prefs_common.newmail_notify_manu);