bool sslcert_load_tree(struct tree *tree, const struct ssl_cert_info *certs, struct sslcert_session_data *data) { struct node *tree_root; struct node *node; unsigned long cert_loop; assert(data != NULL && certs != NULL && tree != NULL); tree_root = tree_get_root(tree); for (cert_loop = 0; cert_loop < data->num; cert_loop++) { node = sslcert_create_node(&(certs[cert_loop])); if (node != NULL) { /* There is no problem creating the node * add an entry for it in the root of the * treeview . */ tree_link_node(tree, tree_root, node, false); } } data->tree = tree; return tree; }
void ami_move_node(struct treeview_window *twin,int move) { struct Node *lbnode = NULL; struct node *treenode,*moveto; bool before; GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); if(!lbnode) return; GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, // for multiselects? LBNA_Selected,(BOOL *)&sel, TAG_DONE); selectednode2 = treenode; tree_set_node_selected(twin->tree,twin->tree->root,false); tree_set_node_selected(twin->tree,treenode,true); switch(move) { case AMI_MOVE_UP: moveto = treenode->previous; before = true; break; case AMI_MOVE_DOWN: moveto = treenode->next; before = false; break; case AMI_MOVE_OUT: moveto = treenode->parent->previous; before = false; break; } if(!moveto) return; tree_delink_node(treenode); //tree_move_selected_nodes(twin->tree,moveto,before); tree_link_node(moveto,treenode,before); ami_recreate_listbrowser(twin); selectednode2 = NULL; }
/** * Adds the currently viewed page to the hotlist at the given co-ordinates * \param url url of the page * \param x X cooridinate with respect to tree origin * \param y Y cooridinate with respect to tree origin */ void hotlist_add_page_xy(const char *url, int x, int y) { const struct url_data *data; struct node *link, *node; bool before; data = urldb_get_url_data(url); if (data == NULL) { urldb_add_url(url); urldb_set_url_persistence(url, true); data = urldb_get_url_data(url); } if (data != NULL) { link = tree_get_link_details(hotlist_tree, x, y, &before); node = tree_create_URL_node(NULL, NULL, url, NULL, hotlist_node_callback, NULL); tree_link_node(hotlist_tree, link, node, before); } }
/** * Internal routine to actually perform global history addition * * \param url The URL to add * \param data URL data associated with URL * \return true (for urldb_iterate_entries) */ bool global_history_add_internal(const char *url, const struct url_data *data) { int i, j; struct node *parent = NULL; struct node *link; struct node *node; bool before = false; int visit_date; assert(url && data); visit_date = data->last_visit; /* find parent node */ for (i = 0; i < global_history_base_node_count; i++) { if (global_history_base_node_time[i] <= visit_date) { parent = global_history_base_node[i]; break; } } /* the entry is too old to care about */ if (!parent) return true; if (parent->deleted) { /* parent was deleted, so find place to insert it */ link = global_history_tree->root; for (j = global_history_base_node_count - 1; j >= 0; j--) { if (!global_history_base_node[j]->deleted && global_history_base_node_time[j] > global_history_base_node_time[i]) { link = global_history_base_node[j]; before = true; break; } } tree_set_node_selected(global_history_tree, parent, false); tree_set_node_expanded(global_history_tree, parent, false); tree_link_node(link, parent, before); if (!global_history_init) { tree_recalculate_node(global_history_tree, parent, true); tree_recalculate_node_positions(global_history_tree, global_history_tree->root); tree_redraw_area(global_history_tree, 0, 0, 16384, 16384); } } /* find any previous occurance */ if (!global_history_init) { node = ro_gui_global_history_find(url); if (node) { /* \todo: calculate old/new positions and redraw * only the relevant portion */ tree_redraw_area(global_history_tree, 0, 0, 16384, 16384); tree_update_URL_node(node, url, data); tree_delink_node(node); tree_link_node(parent, node, false); tree_handle_node_changed(global_history_tree, node, false, true); /* ro_gui_tree_scroll_visible(hotlist_tree, &node->data); */ return true; } } /* Add the node at the bottom */ node = tree_create_URL_node_shared(parent, url, data); if ((!global_history_init) && (node)) { tree_redraw_area(global_history_tree, node->box.x - NODE_INSTEP, 0, NODE_INSTEP, 16384); tree_handle_node_changed(global_history_tree, node, true, false); } return true; }