X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Factions%2Faddremovedesktop.c;h=ff6767e29423a14eab5ec46ea102f8e6ee422cd0;hb=HEAD;hp=1e7f0b57ac4b18a9e00d4e0f7d0aa40a0136b0c3;hpb=a93b00a5e93281c7c2c31112f0b6b827d605a19d;p=chaz%2Fopenbox diff --git a/openbox/actions/addremovedesktop.c b/openbox/actions/addremovedesktop.c index 1e7f0b57..ff6767e2 100644 --- a/openbox/actions/addremovedesktop.c +++ b/openbox/actions/addremovedesktop.c @@ -10,6 +10,7 @@ typedef struct { static gpointer setup_func(xmlNodePtr node); static gpointer setup_add_func(xmlNodePtr node); static gpointer setup_remove_func(xmlNodePtr node); +static void free_func(gpointer o); static gboolean run_func(ObActionsData *data, gpointer options); /* 3.4-compatibility */ static gpointer setup_addcurrent_func(xmlNodePtr node); @@ -19,20 +20,18 @@ static gpointer setup_removelast_func(xmlNodePtr node); void action_addremovedesktop_startup(void) { - actions_register("AddDesktop", setup_add_func, g_free, run_func, - NULL, NULL); - actions_register("RemoveDesktop", setup_remove_func, g_free, run_func, - NULL, NULL); + actions_register("AddDesktop", setup_add_func, free_func, run_func); + actions_register("RemoveDesktop", setup_remove_func, free_func, run_func); /* 3.4-compatibility */ - actions_register("AddDesktopLast", setup_addlast_func, g_free, run_func, - NULL, NULL); - actions_register("RemoveDesktopLast", setup_removelast_func, g_free, run_func, - NULL, NULL); - actions_register("AddDesktopCurrent", setup_addcurrent_func, g_free, run_func, - NULL, NULL); - actions_register("RemoveDesktopCurrent", setup_removecurrent_func, g_free, run_func, - NULL, NULL); + actions_register("AddDesktopLast", setup_addlast_func, + free_func, run_func); + actions_register("RemoveDesktopLast", setup_removelast_func, + free_func, run_func); + actions_register("AddDesktopCurrent", setup_addcurrent_func, + free_func, run_func); + actions_register("RemoveDesktopCurrent", setup_removecurrent_func, + free_func, run_func); } static gpointer setup_func(xmlNodePtr node) @@ -40,10 +39,10 @@ static gpointer setup_func(xmlNodePtr node) xmlNodePtr n; Options *o; - o = g_new0(Options, 1); + o = g_slice_new0(Options); - if ((n = obt_parse_find_node(node, "where"))) { - gchar *s = obt_parse_node_string(n); + if ((n = obt_xml_find_node(node, "where"))) { + gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "last")) o->current = FALSE; else if (!g_ascii_strcasecmp(s, "current")) @@ -68,6 +67,11 @@ static gpointer setup_remove_func(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) {