|
Lines 24-29
Link Here
|
| 24 |
#include <config.h> |
24 |
#include <config.h> |
| 25 |
#endif |
25 |
#endif |
| 26 |
|
26 |
|
|
|
27 |
#include <errno.h> |
| 28 |
#include <sys/file.h> |
| 29 |
|
| 27 |
#include "parcellite.h" |
30 |
#include "parcellite.h" |
| 28 |
|
31 |
|
| 29 |
|
32 |
|
|
Lines 388-394
Link Here
|
| 388 |
{ |
391 |
{ |
| 389 |
if(NULL != appindicator_process && !have_appindicator ){ |
392 |
if(NULL != appindicator_process && !have_appindicator ){ |
| 390 |
g_printf("Looking for '%s'\n",appindicator_process); |
393 |
g_printf("Looking for '%s'\n",appindicator_process); |
| 391 |
if(proc_find(appindicator_process,PROC_MODE_STRSTR,NULL) >0){ |
394 |
if(proc_find(appindicator_process,NULL) >0){ |
| 392 |
have_appindicator=1; |
395 |
have_appindicator=1; |
| 393 |
if(NULL == indicator && show_icon) |
396 |
if(NULL == indicator && show_icon) |
| 394 |
create_app_indicator(); |
397 |
create_app_indicator(); |
|
Lines 1899-1905
Link Here
|
| 1899 |
{ |
1902 |
{ |
| 1900 |
struct cmdline_opts *opts; |
1903 |
struct cmdline_opts *opts; |
| 1901 |
int mode; |
1904 |
int mode; |
| 1902 |
|
1905 |
gboolean is_first_instance = FALSE; |
|
|
1906 |
|
| 1907 |
/* PID file creation */ |
| 1908 |
check_dirs(); |
| 1909 |
if (!flock(open(g_build_filename(g_get_user_data_dir(), PID_FILE, NULL), O_CREAT | O_RDWR, 0640), LOCK_EX | LOCK_NB)) |
| 1910 |
is_first_instance = TRUE; |
| 1911 |
else |
| 1912 |
{ |
| 1913 |
if (errno != EWOULDBLOCK) |
| 1914 |
{ |
| 1915 |
perror("unable to check running instances"); |
| 1916 |
return 1; |
| 1917 |
} |
| 1918 |
} |
| 1919 |
|
| 1903 |
bindtextdomain(GETTEXT_PACKAGE, PARCELLITELOCALEDIR); |
1920 |
bindtextdomain(GETTEXT_PACKAGE, PARCELLITELOCALEDIR); |
| 1904 |
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); |
1921 |
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); |
| 1905 |
textdomain(GETTEXT_PACKAGE); |
1922 |
textdomain(GETTEXT_PACKAGE); |
|
Lines 1911-1917
Link Here
|
| 1911 |
opts=parse_options(argc, argv); |
1928 |
opts=parse_options(argc, argv); |
| 1912 |
if(NULL == opts) |
1929 |
if(NULL == opts) |
| 1913 |
return 1; |
1930 |
return 1; |
| 1914 |
if(proc_find(PARCELLITE_PROG_NAME,PROC_MODE_EXACT,NULL)<2) /**1 for me, and 1 for a running instance */ |
1931 |
if(is_first_instance) |
| 1915 |
mode=PROG_MODE_DAEMON; /**first instance */ |
1932 |
mode=PROG_MODE_DAEMON; /**first instance */ |
| 1916 |
else |
1933 |
else |
| 1917 |
mode=PROG_MODE_CLIENT; /**already running, just access fifos & exit. */ |
1934 |
mode=PROG_MODE_CLIENT; /**already running, just access fifos & exit. */ |
|
Lines 1943-1948
Link Here
|
| 1943 |
|
1960 |
|
| 1944 |
} else if(opts->clipboard){ |
1961 |
} else if(opts->clipboard){ |
| 1945 |
fifo=init_fifo(FIFO_MODE_CLI|mode); |
1962 |
fifo=init_fifo(FIFO_MODE_CLI|mode); |
|
|
1963 |
if(fifo->dbg) g_printf("Hit CLI opt!\n"); |
| 1946 |
|
1964 |
|
| 1947 |
if(PROG_MODE_CLIENT & mode){ |
1965 |
if(PROG_MODE_CLIENT & mode){ |
| 1948 |
if(NULL != opts->leftovers){ |
1966 |
if(NULL != opts->leftovers){ |