From 8854d3dfa7ac0631bc03424c8a6ea435d052315a Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 30 Oct 2012 00:06:36 +0100 Subject: [PATCH] Crude way to ignore dynamic arguments when launching desktop applications --- src/applets/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/applets/main.c b/src/applets/main.c index ed6c462..824c430 100644 --- a/src/applets/main.c +++ b/src/applets/main.c @@ -209,14 +209,21 @@ static GtkWidget * _main_applications(Main * main) static void _applications_on_activate(gpointer data) { - char const * program = data; + char * program = data; + char * p; if(program == NULL) return; + if((program = strdup(program)) == NULL) + return; /* XXX report error */ + /* XXX crude way to ignore %f, %F, %u and %U */ + if((p = strchr(program, '%')) != NULL) + *p = '\0'; #ifdef DEBUG fprintf(stderr, "DEBUG: %s() \"%s\"", __func__, program); #endif g_spawn_command_line_async(program, NULL); + free(program); } static void _applications_categories(GtkWidget * menu, GtkWidget ** menus) @@ -425,7 +432,7 @@ static gboolean _on_idle(gpointer data) config_reset(config); if(config_load(config, name) != 0) { - error_print("Panel"); /* XXX use the error helper */ + main->helper->error(NULL, NULL, 0); /* XXX */ continue; } q = config_get(config, section, "Name");