1 #include "openbox/actions.h"
2 #include "openbox/prompt.h"
3 #include "openbox/session.h"
7 void action_logout_startup(void) {}
15 static gpointer setup_func(xmlNodePtr node);
16 static gboolean logout_func(ObActionsData *data, gpointer options);
18 void action_session_startup(void)
20 actions_register("SessionLogout", setup_func, NULL, logout_func,
24 static gpointer setup_func(xmlNodePtr node)
29 o = g_new0(Options, 1);
32 if ((n = obt_parse_find_node(node, "prompt")))
33 o->prompt = obt_parse_node_bool(n);
38 static void prompt_cb(ObPrompt *p, gint result, gpointer data)
42 session_request_logout(o->silent);
47 /* Always return FALSE because its not interactive */
48 static gboolean logout_func(ObActionsData *data, gpointer options)
55 ObPromptAnswer answers[] = {
60 o2 = g_memdup(o, sizeof(Options));
61 p = prompt_new(_("Are you sure you want to log out?"),
62 answers, 2, 0, 0, prompt_cb, o2);
63 prompt_show(p, NULL, FALSE);
66 prompt_cb(NULL, 1, NULL);