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
This commit is contained in:
Nicholas Marriott
2013-02-10 17:32:58 +00:00
parent 418ba99078
commit 4d382ae8e6
7 changed files with 156 additions and 217 deletions

26
tmux.h
View File

@ -879,18 +879,24 @@ struct window_mode {
/* Structures for choose mode. */
struct window_choose_data {
struct client *client;
struct session *session; /* Session of current client. */
struct session *tree_session; /* Session of items in tree. */
struct format_tree *ft;
struct winlink *wl;
char *ft_template;
char *command;
struct client *start_client;
struct session *start_session;
u_int idx;
int type;
#define TREE_OTHER 0x0
#define TREE_WINDOW 0x1
#define TREE_SESSION 0x2
struct session *tree_session; /* session of items in tree */
struct winlink *wl;
int pane_id;
char *ft_template;
struct format_tree *ft;
char *command;
};
struct window_choose_mode_item {
@ -2194,8 +2200,10 @@ void window_choose_add(struct window_pane *,
void window_choose_ready(struct window_pane *,
u_int, void (*)(struct window_choose_data *),
void (*)(struct window_choose_data *));
struct window_choose_data *window_choose_data_create(struct cmd_ctx *);
void window_choose_ctx(struct window_choose_data *);
struct window_choose_data *window_choose_data_create (int,
struct client *, struct session *);
void window_choose_data_free(struct window_choose_data *);
void window_choose_data_run(struct window_choose_data *);
struct window_choose_data *window_choose_add_window(struct window_pane *,
struct cmd_ctx *, struct session *, struct winlink *,
const char *, char *, u_int);