From 4d382ae8e6c71c5414dc41053223c05400d923f8 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 10 Feb 2013 17:32:58 +0000 Subject: Miscellaneous tidying of choose API, including: - rename client and session to start_client and start_session in window_choose_data struct. also add TREE_OTHER define and reorder the struct - rename window_choose_ctx to window_choose_data_run - don't pass a cmd_ctx into window_choose_create (will let it use a different client later). instead take type, session, client - add window_choose_data_free and use it to dispose of wcd rather than each cmd-*.c doing it individually - change so ref counting is done by wcd_add and wcd_free rather than callers. this means 1 ref for each item but what of it :-) - also add a ref to tree_session - not sure if this is needed? - all the callbacks except choose-client and find-window are the same so remove them and add window_choose_default_callback - reorder/rename some other bits and pieces for tidyness --- cmd-choose-list.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'cmd-choose-list.c') diff --git a/cmd-choose-list.c b/cmd-choose-list.c index 4c32e694..5f83447c 100644 --- a/cmd-choose-list.c +++ b/cmd-choose-list.c @@ -33,9 +33,6 @@ enum cmd_retval cmd_choose_list_exec(struct cmd *, struct cmd_ctx *); -void cmd_choose_list_callback(struct window_choose_data *); -void cmd_choose_list_free(struct window_choose_data *); - const struct cmd_entry cmd_choose_list_entry = { "choose-list", NULL, "l:t:", 0, 1, @@ -92,32 +89,9 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_ctx *ctx) return (CMD_RETURN_ERROR); } - window_choose_ready(wl->window->active, 0, cmd_choose_list_callback, - cmd_choose_list_free); + window_choose_ready(wl->window->active, 0, NULL, NULL); free(template); return (CMD_RETURN_NORMAL); } - -void -cmd_choose_list_callback(struct window_choose_data *cdata) -{ - if (cdata == NULL || (cdata->client->flags & CLIENT_DEAD)) - return; - - window_choose_ctx(cdata); -} - -void -cmd_choose_list_free(struct window_choose_data *cdata) -{ - cdata->session->references--; - cdata->client->references--; - - free(cdata->ft_template); - free(cdata->command); - format_free(cdata->ft); - free(cdata); - -} -- cgit