summaryrefslogtreecommitdiff
path: root/openbox/actions/exit.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-02-16 16:26:18 -0500
committerDana Jansens <danakj@orodu.net>2010-02-16 16:32:38 -0500
commitd179d6428ae585a3b8a13479bfe4586e41de2ff9 (patch)
tree322cb58fea023dc635432cef8f06307008c8f4c8 /openbox/actions/exit.c
parentd45af3cb45f35ba639efac15675ed10b3515a7f0 (diff)
more using g_slice_new() instead of g_new()
Diffstat (limited to 'openbox/actions/exit.c')
-rw-r--r--openbox/actions/exit.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/openbox/actions/exit.c b/openbox/actions/exit.c
index f2b0cafb..2d9fc633 100644
--- a/openbox/actions/exit.c
+++ b/openbox/actions/exit.c
@@ -9,12 +9,13 @@ typedef struct {
} Options;
static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_exit_startup(void)
{
- actions_register("Exit", setup_func, NULL, run_func);
- actions_register("SessionLogout", setup_func, NULL, run_func);
+ actions_register("Exit", setup_func, free_func, run_func);
+ actions_register("SessionLogout", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
@@ -22,7 +23,7 @@ static gpointer setup_func(xmlNodePtr node)
xmlNodePtr n;
Options *o;
- o = g_new0(Options, 1);
+ o = g_slice_new0(Options);
o->prompt = TRUE;
if ((n = obt_xml_find_node(node, "prompt")))
@@ -31,6 +32,11 @@ static gpointer setup_func(xmlNodePtr node)
return o;
}
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
+}
+
static void do_exit(void)
{
if (session_connected())
@@ -51,6 +57,7 @@ static void prompt_cleanup(ObPrompt *p, gpointer data)
prompt_unref(p);
}
+
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{