add a cleanup callback to the prompt interface. when the prompt's callback returns...
[dana/openbox.git] / openbox / actions / execute.c
index f87fe00..636dbeb 100644 (file)
@@ -98,11 +98,15 @@ static Options* dup_options(Options *in)
 
 static gboolean run_func(ObActionsData *data, gpointer options);
 
-static void prompt_cb(ObPrompt *p, gint result, gpointer options)
+static gboolean prompt_cb(ObPrompt *p, gint result, gpointer options)
 {
     if (result)
         run_func(NULL, options);
+    return TRUE; /* call the cleanup func */
+}
 
+static void prompt_cleanup(ObPrompt *p, gpointer options)
+{
     prompt_unref(p);
     free_func(options);
 }
@@ -126,7 +130,8 @@ static gboolean run_func(ObActionsData *data, gpointer options)
         };
 
         ocp = dup_options(options);
-        p = prompt_new(o->prompt, answers, 2, 0, 0, prompt_cb, ocp);
+        p = prompt_new(o->prompt, answers, 2, 0, 0,
+                       prompt_cb, prompt_cleanup, ocp);
         prompt_show(p, NULL, FALSE);
 
         return FALSE;