diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-07-02 11:41:06 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-07-02 11:41:06 +0000 |
commit | 4147c185c8d547e041c1d0c81c283ef0c7942cc8 (patch) | |
tree | ebb76bbff7bf4e6a628f125bd02d470d76643215 /desktop | |
parent | f9566b64050c76c9fc78a0b691cf8c83643c847b (diff) | |
download | netsurf-4147c185c8d547e041c1d0c81c283ef0c7942cc8.tar.gz |
When launching multiple URLs from a treeview, allow to open one window with multiple
tabs instead of one window per URL. Make compatible frontends do this by default.
svn path=/trunk/netsurf/; revision=12552
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/history_global_core.c | 6 | ||||
-rw-r--r-- | desktop/history_global_core.h | 2 | ||||
-rw-r--r-- | desktop/hotlist.c | 6 | ||||
-rw-r--r-- | desktop/hotlist.h | 2 | ||||
-rw-r--r-- | desktop/tree.c | 20 | ||||
-rw-r--r-- | desktop/tree.h | 4 | ||||
-rw-r--r-- | desktop/tree_url_node.c | 9 |
7 files changed, 35 insertions, 14 deletions
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c index 8c8834834..f06d79d8b 100644 --- a/desktop/history_global_core.c +++ b/desktop/history_global_core.c @@ -452,8 +452,10 @@ void history_global_collapse_addresses(void) /** * Open the selected entries in seperate browser windows. + * + * \param tabs open multiple entries in tabs in the new window */ -void history_global_launch_selected(void) +void history_global_launch_selected(bool tabs) { - tree_launch_selected(global_history_tree); + tree_launch_selected(global_history_tree, tabs); } diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h index 1bb343dd6..7b8e6823a 100644 --- a/desktop/history_global_core.h +++ b/desktop/history_global_core.h @@ -39,6 +39,6 @@ void history_global_expand_addresses(void); void history_global_collapse_all(void); void history_global_collapse_directories(void); void history_global_collapse_addresses(void); -void history_global_launch_selected(void); +void history_global_launch_selected(bool tabs); #endif diff --git a/desktop/hotlist.c b/desktop/hotlist.c index a740458cb..acfef10cd 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -454,8 +454,10 @@ void hotlist_add_page_xy(const char *url, int x, int y) /** * Open the selected entries in separate browser windows. + * + * \param tabs open multiple entries in tabs in the new window */ -void hotlist_launch_selected(void) +void hotlist_launch_selected(bool tabs) { - tree_launch_selected(hotlist_tree); + tree_launch_selected(hotlist_tree, tabs); } diff --git a/desktop/hotlist.h b/desktop/hotlist.h index efce84696..b17d98baa 100644 --- a/desktop/hotlist.h +++ b/desktop/hotlist.h @@ -57,6 +57,6 @@ void hotlist_add_folder(void); void hotlist_add_entry(void); void hotlist_add_page(const char *url); void hotlist_add_page_xy(const char *url, int x, int y); -void hotlist_launch_selected(void); +void hotlist_launch_selected(bool tabs); #endif diff --git a/desktop/tree.c b/desktop/tree.c index c33f29df8..f8105bb19 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -2152,20 +2152,29 @@ struct node *tree_get_link_details(struct tree *tree, int x, int y, * * \param tree the tree for which all nodes will be launched * \param node the node which will be checked together with its children + * \param tabs launch node in a new tab instead of a new window */ -static void tree_launch_selected_internal(struct tree *tree, struct node *node) +static void tree_launch_selected_internal(struct tree *tree, struct node *node, + bool tabs) { struct node_msg_data msg_data; + msg_data.data.bw = NULL; + for (; node != NULL; node = node->next) { if (node->selected && node->user_callback != NULL) { msg_data.msg = NODE_LAUNCH; - msg_data.flag = TREE_ELEMENT_TITLE; + if (tabs == true) { + msg_data.flag = TREE_ELEMENT_LAUNCH_IN_TABS; + } else { + msg_data.flag = TREE_ELEMENT_TITLE; + } + msg_data.node = node; node->user_callback(node->callback_data, &msg_data); } if (node->child != NULL) - tree_launch_selected_internal(tree, node->child); + tree_launch_selected_internal(tree, node->child, tabs); } } @@ -2174,11 +2183,12 @@ static void tree_launch_selected_internal(struct tree *tree, struct node *node) * Launches all the selected nodes of the tree * * \param tree the tree for which all nodes will be launched + * \param tabs launch nodes in new tabs instead of new windows */ -void tree_launch_selected(struct tree *tree) +void tree_launch_selected(struct tree *tree, bool tabs) { if (tree->root->child != NULL) - tree_launch_selected_internal(tree, tree->root->child); + tree_launch_selected_internal(tree, tree->root->child, tabs); } diff --git a/desktop/tree.h b/desktop/tree.h index e3dc8c98a..0ff8948bc 100644 --- a/desktop/tree.h +++ b/desktop/tree.h @@ -54,6 +54,7 @@ enum tree_flags { * to indicate teh type of data a node element contains. */ #define TREE_ELEMENT_TITLE 0x00 +#define TREE_ELEMENT_LAUNCH_IN_TABS 0x05 /* Launch in tabs instead of windows */ struct tree; struct node; @@ -102,6 +103,7 @@ struct node_msg_data { union { char *text; /**< textural data. */ void *bitmap; /**< bitmap data. */ + struct browser_window *bw; /**< clone browser_window. */ } data; /**< The message data. */ }; @@ -186,7 +188,7 @@ void tree_delete_selected_nodes(struct tree *tree, struct node *node); struct node *tree_get_selected_node(struct node *node); struct node *tree_get_link_details(struct tree *tree, int x, int y, bool *before); -void tree_launch_selected(struct tree *tree); +void tree_launch_selected(struct tree *tree, bool tabs); bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x, int y); diff --git a/desktop/tree_url_node.c b/desktop/tree_url_node.c index 50b3f338e..b524f9b8c 100644 --- a/desktop/tree_url_node.c +++ b/desktop/tree_url_node.c @@ -383,8 +383,13 @@ node_callback_resp tree_url_node_callback(void *user_data, TREE_ELEMENT_URL, NULL); if (element != NULL) { text = tree_node_element_get_text(element); - browser_window_create(text, NULL, 0, - true, false); + if (msg_data->flag == TREE_ELEMENT_LAUNCH_IN_TABS) { + msg_data->data.bw = browser_window_create(text, + msg_data->data.bw, 0, true, true); + } else { + browser_window_create(text, NULL, 0, + true, false); + } return NODE_CALLBACK_HANDLED; } break; |