diff options
Diffstat (limited to 'src/config/profiles.c')
-rw-r--r-- | src/config/profiles.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/config/profiles.c b/src/config/profiles.c index a94cb47..9fbba95 100644 --- a/src/config/profiles.c +++ b/src/config/profiles.c @@ -254,3 +254,35 @@ mq_profiles_save(MqProfiles *profiles) return g_key_file_save_to_file(profiles->key_file, profiles->file_name, NULL); } + +gboolean +mq_profile_launch(gchar *profile) +{ + static gchar *program_path = NULL; + gchar *argv[4]; + gboolean success; + GPid child_pid; + + if (!program_path) { +#if defined(RUN_IN_PLACE) && RUN_IN_PLACE + program_path = g_build_filename(ABS_TOP_BUILDDIR, PROGRAM_NAME, + NULL); +#else + program_path = g_build_filename(BINDIR, PROGRAM_NAME, NULL); +#endif + } + + argv[0] = g_strdup(program_path); + argv[1] = g_strdup("-P"); + argv[2] = profile; + argv[3] = NULL; + + success = g_spawn_async(NULL, argv, NULL, G_SPAWN_DEFAULT, NULL, NULL, + &child_pid, NULL); + g_spawn_close_pid(child_pid); + + g_free(argv[0]); + g_free(argv[1]); + + return success; +} |