diff options
author | Manuel Bachmann <manuel.bachmann@open.eurogiciel.org> | 2014-05-23 18:10:53 +0200 |
---|---|---|
committer | Manuel Bachmann <manuel.bachmann@open.eurogiciel.org> | 2014-05-23 18:10:53 +0200 |
commit | 3068a7010a31a4fe8503c3f509329c5646b2f907 (patch) | |
tree | e1589f7e0d93ba0817ea8e8e0fcf57b7cfac7afc | |
parent | 0b2b70a7c529faa0c37854deb279688102fbb224 (diff) | |
download | weston-common-3068a7010a31a4fe8503c3f509329c5646b2f907.tar.gz weston-common-3068a7010a31a4fe8503c3f509329c5646b2f907.tar.bz2 weston-common-3068a7010a31a4fe8503c3f509329c5646b2f907.zip |
tz-launcher: support signal to reload launchers at runtimesubmit/tizen_common/20140612.155602sandbox/mbachmann/tizen_weston150
When sent a SIGUSR1 signal ("$ kill -10 $PID"), tz-launcher will
now re-read the content of the files/folders which have been passed
to it, and display the corresponding new launchers.
Change-Id: I80417c491f364c97e063f45f205fdacbf07bdb2c
Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
-rw-r--r-- | tz-launcher/tz-launcher-wl.c | 10 | ||||
-rw-r--r-- | tz-launcher/tz-launcher.c | 47 |
2 files changed, 44 insertions, 13 deletions
diff --git a/tz-launcher/tz-launcher-wl.c b/tz-launcher/tz-launcher-wl.c index c990423..5c32ae5 100644 --- a/tz-launcher/tz-launcher-wl.c +++ b/tz-launcher/tz-launcher-wl.c @@ -32,6 +32,7 @@ struct launcher { gboolean terminal; }; +struct display *display; struct main_window *main_window; @@ -452,9 +453,16 @@ main_window_destroy () } void +tz_launcher_wl_reload (int desktopfiles, gchar ***desktoptable) +{ + main_window_destroy (); + main_window_create (display, desktopfiles, desktoptable); +} + +void tz_launcher_wl_run (int desktopfiles, gchar ***desktoptable) { - struct display *display = NULL; + display = NULL; int retries = 0; while (!display) { diff --git a/tz-launcher/tz-launcher.c b/tz-launcher/tz-launcher.c index f57618b..7a50fc2 100644 --- a/tz-launcher/tz-launcher.c +++ b/tz-launcher/tz-launcher.c @@ -8,6 +8,9 @@ int desktopfiles; gchar **desktoptable[MAX_DESKTOPFILES]; +int global_argc; +char **global_argv; + gboolean file_is_parsable (GFile *file) @@ -200,21 +203,12 @@ tz_launcher_parse_config_file (GFile *file) } -int -main (int argc, char *argv[]) +void +parse_args (int argc, char **argv) { - if (argc < 2) { - g_print ("Usage : tz-launcher <file1>.desktop <file2>.desktop <directory>...\n" - " or\n" - " tz-launcher -c <list-of-.desktop-files>.conf\n"); - return 0; - } - - desktopfiles = 0; - g_type_init (); - int i; + desktopfiles = 0; GFile *desktopfile; for (i = 1; i < argc ; i++) { @@ -257,7 +251,36 @@ main (int argc, char *argv[]) if (desktopfiles == MAX_DESKTOPFILES) break; } +} + +static void +sigreload_handler (int s) +{ + parse_args (global_argc, global_argv); + + if (desktopfiles > 0) + tz_launcher_wl_reload (desktopfiles, desktoptable); +} + +int +main (int argc, char **argv) +{ + if (argc < 2) { + g_print ("Usage : tz-launcher <file1>.desktop <file2>.desktop <directory>...\n" + " or\n" + " tz-launcher -c <list-of-.desktop-files>.conf\n"); + return 0; + } + + g_type_init (); + + + signal (SIGUSR1, sigreload_handler); + global_argc = argc; + global_argv = argv; + + parse_args (argc, argv); if (desktopfiles > 0) tz_launcher_wl_run (desktopfiles, desktoptable); |