Add functions to get first selected hotlist/global_history node data.
This commit is contained in:
parent
653cf8fa1f
commit
951ad51cd4
|
@ -949,6 +949,27 @@ bool global_history_has_selection(void)
|
|||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in global_history.h */
|
||||
bool global_history_get_selection(nsurl **url, const char **title)
|
||||
{
|
||||
struct global_history_entry *e;
|
||||
void *v;
|
||||
|
||||
treeview_get_selection(gh_ctx.tree, &v);
|
||||
if (v == NULL) {
|
||||
*url = NULL;
|
||||
*title = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
e = (struct global_history_entry *)v;
|
||||
|
||||
*url = e->url;
|
||||
*title = e->data[GH_TITLE].value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in global_history.h */
|
||||
nserror global_history_expand(bool only_folders)
|
||||
{
|
||||
|
|
|
@ -109,6 +109,15 @@ void global_history_keypress(uint32_t key);
|
|||
*/
|
||||
bool global_history_has_selection(void);
|
||||
|
||||
/**
|
||||
* Get the first selected node
|
||||
*
|
||||
* \param url Updated to the selected entry's address, or NULL
|
||||
* \param title Updated to the selected entry's title, or NULL
|
||||
* \return true iff global history has a selection
|
||||
*/
|
||||
bool global_history_get_selection(nsurl **url, const char **title);
|
||||
|
||||
/**
|
||||
* Expand the treeview's nodes
|
||||
*
|
||||
|
|
|
@ -1482,6 +1482,27 @@ bool hotlist_has_selection(void)
|
|||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in hotlist.h */
|
||||
bool hotlist_get_selection(nsurl **url, const char **title)
|
||||
{
|
||||
struct hotlist_entry *e;
|
||||
void *v;
|
||||
|
||||
treeview_get_selection(hl_ctx.tree, &v);
|
||||
if (v == NULL) {
|
||||
*url = NULL;
|
||||
*title = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
e = (struct hotlist_entry *)v;
|
||||
|
||||
*url = e->url;
|
||||
*title = e->data[HL_TITLE].value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in hotlist.h */
|
||||
void hotlist_edit_selection(void)
|
||||
{
|
||||
|
|
|
@ -200,6 +200,15 @@ void hotlist_keypress(uint32_t key);
|
|||
*/
|
||||
bool hotlist_has_selection(void);
|
||||
|
||||
/**
|
||||
* Get the first selected node
|
||||
*
|
||||
* \param url Updated to the selected entry's address, or NULL
|
||||
* \param title Updated to the selected entry's title, or NULL
|
||||
* \return true iff hotlist has a selection
|
||||
*/
|
||||
bool hotlist_get_selection(nsurl **url, const char **title);
|
||||
|
||||
/**
|
||||
* Edit the first selected node
|
||||
*/
|
||||
|
|
|
@ -2075,6 +2075,15 @@ static treeview_node * treeview_get_first_selected(treeview *tree)
|
|||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in treeview.h */
|
||||
void treeview_get_selection(treeview *tree, void **node_data)
|
||||
{
|
||||
assert(tree != NULL);
|
||||
|
||||
*node_data = treeview_get_first_selected(tree);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear any selection in a treeview
|
||||
*
|
||||
|
|
|
@ -375,6 +375,14 @@ void treeview_mouse_action(treeview *tree,
|
|||
*/
|
||||
bool treeview_has_selection(treeview *tree);
|
||||
|
||||
/**
|
||||
* Get the first selected node
|
||||
*
|
||||
* \param tree Treeview object to get selected node in
|
||||
* \param node_data Client data for the selected treeview node, or NULL
|
||||
*/
|
||||
void treeview_get_selection(treeview *tree, void **node_data);
|
||||
|
||||
/**
|
||||
* Edit the first selected node
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue