]> Dogcows Code - chaz/openbox/blobdiff - openbox/actions/exit.c
add a cleanup callback to the prompt interface. when the prompt's callback returns...
[chaz/openbox] / openbox / actions / exit.c
index 19b78e9cb438c9bc6965e2611d24b91d9492f33c..67545cd265cc168b31f9817e660565d3de73172b 100644 (file)
@@ -21,6 +21,7 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
     Options *o;
 
     o = g_new0(Options, 1);
+    o->prompt = TRUE;
 
     if ((n = parse_find_node("prompt", node)))
         o->prompt = parse_bool(doc, n);
@@ -28,10 +29,15 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
     return o;
 }
 
-static void prompt_cb(ObPrompt *p, gint result, gpointer data)
+static gboolean prompt_cb(ObPrompt *p, gint result, gpointer data)
 {
     if (result)
         ob_exit(0);
+    return TRUE; /* call the cleanup func */
+}
+
+static void prompt_cleanup(ObPrompt *p, gpointer data)
+{
     prompt_unref(p);
 }
 
@@ -48,7 +54,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
         };
 
         p = prompt_new(_("Are you sure you want to exit Openbox?"),
-                       answers, 2, 0, 0, prompt_cb, NULL);
+                       answers, 2, 0, 0, prompt_cb, prompt_cleanup, NULL);
         prompt_show(p, NULL, FALSE);
     }
     else
This page took 0.020951 seconds and 4 git commands to generate.