X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Factions%2Flayer.c;h=ed1eeedc0462c26ed22557edbeb39ef028b4c61e;hb=d179d6428ae585a3b8a13479bfe4586e41de2ff9;hp=1d522bbc87824e6b82ae5a9c6fccdbf5dc4292d8;hpb=50d662681160c309ea86268c0d05794b87b75593;p=chaz%2Fopenbox diff --git a/openbox/actions/layer.c b/openbox/actions/layer.c index 1d522bbc..ed1eeedc 100644 --- a/openbox/actions/layer.c +++ b/openbox/actions/layer.c @@ -9,6 +9,7 @@ typedef struct { static gpointer setup_func_top(xmlNodePtr node); static gpointer setup_func_bottom(xmlNodePtr node); static gpointer setup_func_send(xmlNodePtr node); +static void free_func(gpointer o); static gboolean run_func(ObActionsData *data, gpointer options); /* 3.4-compatibility */ static gpointer setup_sendtop_func(xmlNodePtr node); @@ -17,24 +18,24 @@ static gpointer setup_sendnormal_func(xmlNodePtr node); void action_layer_startup(void) { - actions_register("ToggleAlwaysOnTop", setup_func_top, g_free, - run_func, NULL, NULL); - actions_register("ToggleAlwaysOnBottom", setup_func_bottom, g_free, - run_func, NULL, NULL); - actions_register("SendToLayer", setup_func_send, g_free, - run_func, NULL, NULL); + actions_register("ToggleAlwaysOnTop", setup_func_top, free_func, + run_func); + actions_register("ToggleAlwaysOnBottom", setup_func_bottom, free_func, + run_func); + actions_register("SendToLayer", setup_func_send, free_func, + run_func); /* 3.4-compatibility */ - actions_register("SendToTopLayer", setup_sendtop_func, g_free, - run_func, NULL, NULL); - actions_register("SendToBottomLayer", setup_sendbottom_func, g_free, - run_func, NULL, NULL); - actions_register("SendToNormalLayer", setup_sendnormal_func, g_free, - run_func, NULL, NULL); + actions_register("SendToTopLayer", setup_sendtop_func, free_func, + run_func); + actions_register("SendToBottomLayer", setup_sendbottom_func, free_func, + run_func); + actions_register("SendToNormalLayer", setup_sendnormal_func, free_func, + run_func); } static gpointer setup_func_top(xmlNodePtr node) { - Options *o = g_new0(Options, 1); + Options *o = g_slice_new0(Options); o->layer = 1; o->toggle = TRUE; return o; @@ -42,7 +43,7 @@ static gpointer setup_func_top(xmlNodePtr node) static gpointer setup_func_bottom(xmlNodePtr node) { - Options *o = g_new0(Options, 1); + Options *o = g_slice_new0(Options); o->layer = -1; o->toggle = TRUE; return o; @@ -53,10 +54,10 @@ static gpointer setup_func_send(xmlNodePtr node) xmlNodePtr n; Options *o; - o = g_new0(Options, 1); + o = g_slice_new0(Options); - if ((n = obt_parse_find_node(node, "layer"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "layer"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "above") || !g_ascii_strcasecmp(s, "top")) o->layer = 1; @@ -72,6 +73,11 @@ static gpointer setup_func_send(xmlNodePtr node) return o; } +static void free_func(gpointer o) +{ + g_slice_free(Options, o); +} + /* Always return FALSE because its not interactive */ static gboolean run_func(ObActionsData *data, gpointer options) { @@ -102,7 +108,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) /* 3.4-compatibility */ static gpointer setup_sendtop_func(xmlNodePtr node) { - Options *o = g_new0(Options, 1); + Options *o = g_slice_new0(Options); o->layer = 1; o->toggle = FALSE; return o; @@ -110,7 +116,7 @@ static gpointer setup_sendtop_func(xmlNodePtr node) static gpointer setup_sendbottom_func(xmlNodePtr node) { - Options *o = g_new0(Options, 1); + Options *o = g_slice_new0(Options); o->layer = -1; o->toggle = FALSE; return o; @@ -118,7 +124,7 @@ static gpointer setup_sendbottom_func(xmlNodePtr node) static gpointer setup_sendnormal_func(xmlNodePtr node) { - Options *o = g_new0(Options, 1); + Options *o = g_slice_new0(Options); o->layer = 0; o->toggle = FALSE; return o;