2004-06-30 21:44:11 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
2005-03-19 02:52:38 +03:00
|
|
|
* Copyright 2004, 2005 Richard Wilson <info@tinct.net>
|
2004-06-30 21:44:11 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Hotlist (implementation).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdbool.h>
|
2004-12-09 13:30:44 +03:00
|
|
|
#include <stdio.h>
|
2004-06-30 21:44:11 +04:00
|
|
|
#include <stdlib.h>
|
2004-07-03 20:28:09 +04:00
|
|
|
#include <time.h>
|
2004-07-09 21:03:35 +04:00
|
|
|
#include <swis.h>
|
2004-07-29 02:23:34 +04:00
|
|
|
#include "libxml/HTMLparser.h"
|
2004-07-29 15:40:48 +04:00
|
|
|
#include "libxml/HTMLtree.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "oslib/colourtrans.h"
|
2004-07-07 04:31:57 +04:00
|
|
|
#include "oslib/dragasprite.h"
|
2004-07-04 18:59:29 +04:00
|
|
|
#include "oslib/osfile.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "oslib/wimp.h"
|
|
|
|
#include "oslib/wimpspriteop.h"
|
2004-07-02 02:56:26 +04:00
|
|
|
#include "netsurf/content/content.h"
|
2004-12-09 13:30:44 +03:00
|
|
|
#include "netsurf/desktop/tree.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "netsurf/riscos/gui.h"
|
2005-04-08 00:46:22 +04:00
|
|
|
#include "netsurf/riscos/menus.h"
|
2004-07-08 02:09:26 +04:00
|
|
|
#include "netsurf/riscos/theme.h"
|
2004-07-09 21:03:35 +04:00
|
|
|
#include "netsurf/riscos/tinct.h"
|
2004-12-09 13:30:44 +03:00
|
|
|
#include "netsurf/riscos/treeview.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "netsurf/riscos/wimp.h"
|
2005-12-31 07:36:24 +03:00
|
|
|
#include "netsurf/riscos/wimp_event.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "netsurf/utils/log.h"
|
2004-07-03 21:30:28 +04:00
|
|
|
#include "netsurf/utils/messages.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "netsurf/utils/utils.h"
|
2004-07-09 21:03:35 +04:00
|
|
|
#include "netsurf/utils/url.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
static void ro_gui_hotlist_visited(struct content *content, struct tree *tree,
|
|
|
|
struct node *node);
|
2005-12-31 07:36:24 +03:00
|
|
|
static bool ro_gui_hotlist_click(wimp_pointer *pointer);
|
2004-06-30 21:44:11 +04:00
|
|
|
|
2005-02-07 17:28:43 +03:00
|
|
|
/* A basic window for the hotlist
|
2004-06-30 21:44:11 +04:00
|
|
|
*/
|
|
|
|
static wimp_window hotlist_window_definition = {
|
|
|
|
{0, 0, 600, 800},
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
wimp_TOP,
|
|
|
|
wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_BACK_ICON |
|
|
|
|
wimp_WINDOW_CLOSE_ICON | wimp_WINDOW_TITLE_ICON |
|
2004-07-29 02:23:34 +04:00
|
|
|
wimp_WINDOW_TOGGLE_ICON | wimp_WINDOW_SIZE_ICON |
|
2004-12-09 13:30:44 +03:00
|
|
|
wimp_WINDOW_VSCROLL | wimp_WINDOW_IGNORE_XEXTENT |
|
|
|
|
wimp_WINDOW_IGNORE_YEXTENT,
|
2004-06-30 21:44:11 +04:00
|
|
|
wimp_COLOUR_BLACK,
|
|
|
|
wimp_COLOUR_LIGHT_GREY,
|
|
|
|
wimp_COLOUR_LIGHT_GREY,
|
2004-07-08 02:09:26 +04:00
|
|
|
wimp_COLOUR_WHITE,
|
2004-06-30 21:44:11 +04:00
|
|
|
wimp_COLOUR_DARK_GREY,
|
|
|
|
wimp_COLOUR_MID_LIGHT_GREY,
|
|
|
|
wimp_COLOUR_CREAM,
|
|
|
|
0,
|
2004-12-09 13:30:44 +03:00
|
|
|
{0, -16384, 16384, 0},
|
2004-07-29 02:23:34 +04:00
|
|
|
wimp_ICON_TEXT | wimp_ICON_INDIRECTED | wimp_ICON_HCENTRED |
|
|
|
|
wimp_ICON_VCENTRED,
|
|
|
|
wimp_BUTTON_DOUBLE_CLICK_DRAG << wimp_ICON_BUTTON_TYPE_SHIFT,
|
2004-06-30 21:44:11 +04:00
|
|
|
wimpspriteop_AREA,
|
|
|
|
1,
|
2005-03-19 02:52:38 +03:00
|
|
|
1,
|
2004-07-09 21:03:35 +04:00
|
|
|
{""},
|
2004-12-09 13:30:44 +03:00
|
|
|
0,
|
|
|
|
{}
|
2004-06-30 21:44:11 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-07-08 02:09:26 +04:00
|
|
|
/* The hotlist window, toolbar and plot origins
|
2004-06-30 21:44:11 +04:00
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
static wimp_w hotlist_window;
|
|
|
|
struct tree *hotlist_tree;
|
2004-07-04 22:44:51 +04:00
|
|
|
|
2004-07-09 02:05:35 +04:00
|
|
|
/* Whether the editing facilities are for add so that we know how
|
|
|
|
to reset the dialog boxes on a adjust-cancel and the action to
|
|
|
|
perform on ok.
|
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
struct node *dialog_folder_node;
|
|
|
|
struct node *dialog_entry_node;
|
2004-07-04 18:59:29 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
void ro_gui_hotlist_initialise(void) {
|
|
|
|
FILE *fp;
|
2005-04-08 00:46:22 +04:00
|
|
|
const char *title;
|
2004-06-30 21:44:11 +04:00
|
|
|
os_error *error;
|
2004-12-09 13:30:44 +03:00
|
|
|
struct node *node;
|
2005-12-31 07:36:24 +03:00
|
|
|
struct url_content *data;
|
2004-07-04 23:27:42 +04:00
|
|
|
|
2004-06-30 21:44:11 +04:00
|
|
|
/* Create our window
|
|
|
|
*/
|
2004-07-09 21:03:35 +04:00
|
|
|
title = messages_get("Hotlist");
|
2005-04-08 00:46:22 +04:00
|
|
|
hotlist_window_definition.title_data.indirected_text.text =
|
|
|
|
strdup(title);
|
2004-07-29 02:23:34 +04:00
|
|
|
hotlist_window_definition.title_data.indirected_text.validation =
|
|
|
|
(char *) -1;
|
2005-04-08 00:46:22 +04:00
|
|
|
hotlist_window_definition.title_data.indirected_text.size =
|
|
|
|
strlen(title);
|
|
|
|
error = xwimp_create_window(&hotlist_window_definition,
|
|
|
|
&hotlist_window);
|
2004-06-30 21:44:11 +04:00
|
|
|
if (error) {
|
2004-07-29 02:23:34 +04:00
|
|
|
LOG(("xwimp_create_window: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
|
|
|
die(error->errmess);
|
2004-06-30 21:44:11 +04:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
ro_gui_wimp_event_register_redraw_window(hotlist_window,
|
|
|
|
ro_gui_tree_redraw);
|
|
|
|
ro_gui_wimp_event_register_open_window(hotlist_window,
|
|
|
|
ro_gui_tree_open);
|
|
|
|
ro_gui_wimp_event_register_mouse_click(hotlist_window,
|
|
|
|
ro_gui_hotlist_click);
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
/* Either load or create a hotlist
|
|
|
|
*/
|
|
|
|
fp = fopen("Choices:WWW.NetSurf.Hotlist", "r");
|
|
|
|
if (!fp) {
|
|
|
|
hotlist_tree = calloc(sizeof(struct tree), 1);
|
|
|
|
if (!hotlist_tree) {
|
2005-04-08 00:46:22 +04:00
|
|
|
warn_user("NoMemory", 0);
|
2004-12-09 13:30:44 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
hotlist_tree->root = tree_create_folder_node(NULL, "Root");
|
|
|
|
if (!hotlist_tree->root) {
|
2005-04-08 00:46:22 +04:00
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
free(hotlist_tree);
|
|
|
|
hotlist_tree = NULL;
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
|
|
|
hotlist_tree->root->expanded = true;
|
|
|
|
node = tree_create_folder_node(hotlist_tree->root, "NetSurf");
|
|
|
|
if (!node)
|
|
|
|
node = hotlist_tree->root;
|
2005-12-31 07:36:24 +03:00
|
|
|
data = url_store_find("http://netsurf.sourceforge.net/");
|
|
|
|
if (data) {
|
|
|
|
tree_create_URL_node(node, data,
|
|
|
|
messages_get("HotlistHomepage"));
|
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
tree_initialise(hotlist_tree);
|
|
|
|
} else {
|
2005-04-08 00:46:22 +04:00
|
|
|
fclose(fp);
|
2005-02-07 17:28:43 +03:00
|
|
|
hotlist_tree = options_load_tree("Choices:WWW.NetSurf.Hotlist");
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
|
|
|
if (!hotlist_tree) return;
|
|
|
|
hotlist_tree->handle = (int)hotlist_window;
|
2005-02-09 02:37:41 +03:00
|
|
|
hotlist_tree->movable = true;
|
2005-12-31 07:36:24 +03:00
|
|
|
ro_gui_wimp_event_set_user_data(hotlist_window, hotlist_tree);
|
|
|
|
ro_gui_wimp_event_register_keypress(hotlist_window,
|
|
|
|
ro_gui_tree_keypress);
|
2004-07-17 17:00:38 +04:00
|
|
|
|
2004-07-08 02:09:26 +04:00
|
|
|
/* Create our toolbar
|
|
|
|
*/
|
2005-04-08 00:46:22 +04:00
|
|
|
hotlist_tree->toolbar = ro_gui_theme_create_toolbar(NULL,
|
|
|
|
THEME_HOTLIST_TOOLBAR);
|
2005-03-19 02:52:38 +03:00
|
|
|
if (hotlist_tree->toolbar)
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_theme_attach_toolbar(hotlist_tree->toolbar,
|
|
|
|
hotlist_window);
|
2004-06-30 21:44:11 +04:00
|
|
|
}
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
|
2004-07-09 02:05:35 +04:00
|
|
|
/**
|
2004-12-09 13:30:44 +03:00
|
|
|
* Perform a save to the default file
|
2004-07-09 02:05:35 +04:00
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
void ro_gui_hotlist_save(void) {
|
2005-04-08 00:46:22 +04:00
|
|
|
os_error *error;
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
if (!hotlist_tree) return;
|
|
|
|
|
|
|
|
/* Save to our file
|
|
|
|
*/
|
2005-02-07 17:28:43 +03:00
|
|
|
options_save_tree(hotlist_tree, "<Choices$Write>.WWW.NetSurf.Hotlist",
|
|
|
|
"NetSurf hotlist");
|
2004-12-09 13:30:44 +03:00
|
|
|
error = xosfile_set_type("<Choices$Write>.WWW.NetSurf.Hotlist", 0xfaf);
|
|
|
|
if (error)
|
|
|
|
LOG(("xosfile_set_type: 0x%x: %s",
|
|
|
|
error->errnum, error->errmess));
|
2004-07-09 02:05:35 +04:00
|
|
|
}
|
|
|
|
|
2004-06-30 21:44:11 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
/**
|
|
|
|
* Respond to a mouse click
|
|
|
|
*
|
|
|
|
* \param pointer the pointer state
|
|
|
|
*/
|
2005-12-31 07:36:24 +03:00
|
|
|
bool ro_gui_hotlist_click(wimp_pointer *pointer) {
|
2004-12-09 13:30:44 +03:00
|
|
|
ro_gui_tree_click(pointer, hotlist_tree);
|
|
|
|
if (pointer->buttons == wimp_CLICK_MENU)
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_create(hotlist_menu, pointer->pos.x,
|
|
|
|
pointer->pos.y, pointer->w);
|
2004-12-09 13:30:44 +03:00
|
|
|
else
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_menu_prepare_action(pointer->w, TREE_SELECTION, false);
|
2005-12-31 07:36:24 +03:00
|
|
|
return true;
|
2004-07-29 15:40:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-12-09 13:30:44 +03:00
|
|
|
* Informs the hotlist that some content has been visited
|
2004-07-29 15:40:48 +04:00
|
|
|
*
|
2004-12-09 13:30:44 +03:00
|
|
|
* \param content the content visited
|
2004-07-29 15:40:48 +04:00
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
void hotlist_visited(struct content *content) {
|
|
|
|
if ((!content) || (!content->url) || (!hotlist_tree))
|
|
|
|
return;
|
|
|
|
ro_gui_hotlist_visited(content, hotlist_tree, hotlist_tree->root);
|
|
|
|
}
|
2004-07-29 15:40:48 +04:00
|
|
|
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
/**
|
|
|
|
* Informs the hotlist that some content has been visited
|
|
|
|
*
|
|
|
|
* \param content the content visited
|
2005-04-08 00:46:22 +04:00
|
|
|
* \param tree the tree to find the URL data from
|
|
|
|
* \param node the node to update siblings and children of
|
2004-12-09 13:30:44 +03:00
|
|
|
*/
|
|
|
|
void ro_gui_hotlist_visited(struct content *content, struct tree *tree,
|
|
|
|
struct node *node) {
|
|
|
|
struct node_element *element;
|
2005-04-08 00:46:22 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
for (; node; node = node->next) {
|
|
|
|
if (!node->folder) {
|
|
|
|
element = tree_find_element(node, TREE_ELEMENT_URL);
|
2005-04-08 00:46:22 +04:00
|
|
|
if ((element) && (!strcmp(element->text,
|
|
|
|
content->url))) {
|
2006-01-06 05:56:00 +03:00
|
|
|
tree_update_URL_node(node, NULL);
|
2005-04-08 00:46:22 +04:00
|
|
|
tree_handle_node_changed(tree, node, true,
|
|
|
|
false);
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
2004-07-16 03:58:08 +04:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
if (node->child)
|
|
|
|
ro_gui_hotlist_visited(content, tree, node->child);
|
2004-07-29 15:40:48 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2004-12-09 13:30:44 +03:00
|
|
|
* Prepares the folder dialog contents for a node
|
2004-07-29 15:40:48 +04:00
|
|
|
*
|
2005-04-08 00:46:22 +04:00
|
|
|
* \param node the node to prepare the dialogue for, or NULL
|
2004-07-29 15:40:48 +04:00
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
void ro_gui_hotlist_prepare_folder_dialog(struct node *node) {
|
2005-12-31 07:36:24 +03:00
|
|
|
const char *name;
|
|
|
|
const char *title;
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
dialog_folder_node = node;
|
|
|
|
if (node) {
|
2005-12-31 07:36:24 +03:00
|
|
|
title = messages_get("EditFolder");
|
|
|
|
name = node->data.text;
|
2004-12-09 13:30:44 +03:00
|
|
|
} else {
|
2005-12-31 07:36:24 +03:00
|
|
|
title = messages_get("NewFolder");
|
|
|
|
name = messages_get("Folder");
|
|
|
|
}
|
|
|
|
ro_gui_set_window_title(dialog_folder, title);
|
|
|
|
ro_gui_set_icon_string(dialog_folder, ICON_FOLDER_NAME, name);
|
|
|
|
ro_gui_wimp_event_memorise(dialog_folder);
|
2004-07-16 03:58:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-06 02:17:59 +04:00
|
|
|
/**
|
2004-12-09 13:30:44 +03:00
|
|
|
* Prepares the entry dialog contents for a node
|
|
|
|
*
|
2005-04-08 00:46:22 +04:00
|
|
|
* \param node the node to prepare the dialogue for, or NULL
|
2004-07-06 02:17:59 +04:00
|
|
|
*/
|
2004-12-09 13:30:44 +03:00
|
|
|
void ro_gui_hotlist_prepare_entry_dialog(struct node *node) {
|
2005-04-08 00:46:22 +04:00
|
|
|
struct node_element *element;
|
2005-12-31 07:36:24 +03:00
|
|
|
const char *name;
|
|
|
|
const char *title;
|
|
|
|
const char *url = "";
|
2004-07-29 15:40:48 +04:00
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
dialog_entry_node = node;
|
|
|
|
if (node) {
|
2005-12-31 07:36:24 +03:00
|
|
|
title = messages_get("EditLink");
|
|
|
|
name = node->data.text;
|
|
|
|
if ((element = tree_find_element(node, TREE_ELEMENT_URL)))
|
|
|
|
url = element->text;
|
2004-12-09 13:30:44 +03:00
|
|
|
} else {
|
2005-12-31 07:36:24 +03:00
|
|
|
title = messages_get("NewLink");
|
|
|
|
name = messages_get("Link");
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
ro_gui_set_window_title(dialog_entry, title);
|
|
|
|
ro_gui_set_icon_string(dialog_entry, ICON_ENTRY_NAME, name);
|
|
|
|
ro_gui_set_icon_string(dialog_entry, ICON_ENTRY_URL, url);
|
|
|
|
ro_gui_wimp_event_memorise(dialog_entry);
|
2004-07-06 02:17:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2005-12-31 07:36:24 +03:00
|
|
|
* Apply the settings of dialog window (folder/entry edit)
|
2004-07-06 02:17:59 +04:00
|
|
|
*
|
2005-12-31 07:36:24 +03:00
|
|
|
* \param w the window to apply
|
2004-07-06 02:17:59 +04:00
|
|
|
*/
|
2005-12-31 07:36:24 +03:00
|
|
|
bool ro_gui_hotlist_dialog_apply(wimp_w w) {
|
2005-04-08 00:46:22 +04:00
|
|
|
struct node_element *element;
|
|
|
|
struct node *node;
|
2005-12-31 07:36:24 +03:00
|
|
|
char *title;
|
|
|
|
char *icon;
|
2004-12-09 13:30:44 +03:00
|
|
|
char *url = NULL;
|
2005-12-31 07:36:24 +03:00
|
|
|
url_func_result res = URL_FUNC_OK;
|
|
|
|
struct url_content *data;
|
|
|
|
|
|
|
|
/* get our data */
|
|
|
|
if (w == dialog_entry) {
|
|
|
|
icon = strip(ro_gui_get_icon_string(w, ICON_ENTRY_URL));
|
|
|
|
if (strlen(icon) == 0) {
|
|
|
|
warn_user("NoURLError", 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
res = url_normalize(icon, &url);
|
|
|
|
title = strip(ro_gui_get_icon_string(w, ICON_ENTRY_NAME));
|
2004-12-09 13:30:44 +03:00
|
|
|
node = dialog_entry_node;
|
|
|
|
} else {
|
2005-12-31 07:36:24 +03:00
|
|
|
title = strip(ro_gui_get_icon_string(w, ICON_FOLDER_NAME));
|
2004-12-09 13:30:44 +03:00
|
|
|
node = dialog_folder_node;
|
2004-07-04 18:59:29 +04:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
title = strdup(title);
|
|
|
|
|
|
|
|
/* check for failed functions or lack of text */
|
|
|
|
if ((title == NULL) || (strlen(title) == 0) || (res != URL_FUNC_OK)) {
|
|
|
|
free(url);
|
|
|
|
free(title);
|
|
|
|
node = NULL;
|
|
|
|
if ((title == NULL) || (res != URL_FUNC_OK))
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
else if (strlen(title) == 0)
|
|
|
|
warn_user("NoNameError", 0);
|
|
|
|
return false;
|
2004-07-29 15:40:48 +04:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
ro_gui_set_icon_string(w,
|
|
|
|
(url ? ICON_ENTRY_NAME : ICON_FOLDER_NAME), title);
|
2004-07-04 23:27:42 +04:00
|
|
|
|
2005-12-31 07:36:24 +03:00
|
|
|
/* update/insert our data */
|
2004-12-09 13:30:44 +03:00
|
|
|
if (!node) {
|
2005-12-31 07:36:24 +03:00
|
|
|
if (url) {
|
|
|
|
data = url_store_find(url);
|
|
|
|
if (!data) {
|
|
|
|
free(url);
|
|
|
|
free(title);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!data->title)
|
|
|
|
data->title = strdup(title);
|
|
|
|
node = dialog_entry_node = tree_create_URL_node(
|
|
|
|
hotlist_tree->root, data, title);
|
|
|
|
|
2005-04-08 00:46:22 +04:00
|
|
|
} else {
|
2005-12-31 07:36:24 +03:00
|
|
|
node = dialog_folder_node = tree_create_folder_node(
|
|
|
|
hotlist_tree->root, title);
|
|
|
|
}
|
|
|
|
free(url);
|
|
|
|
free(title);
|
|
|
|
if (!node) {
|
|
|
|
warn_user("NoMemory", 0);
|
|
|
|
return false;
|
2005-04-08 00:46:22 +04:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
tree_handle_node_changed(hotlist_tree, node, true, false);
|
2005-04-08 00:46:22 +04:00
|
|
|
ro_gui_tree_scroll_visible(hotlist_tree, &node->data);
|
2004-12-09 13:30:44 +03:00
|
|
|
tree_redraw_area(hotlist_tree, node->box.x - NODE_INSTEP,
|
|
|
|
0, NODE_INSTEP, 16384);
|
|
|
|
} else {
|
2005-12-31 07:36:24 +03:00
|
|
|
element = tree_find_element(node, TREE_ELEMENT_URL);
|
|
|
|
if (element) {
|
|
|
|
free(element->text);
|
|
|
|
element->text = url;
|
|
|
|
ro_gui_set_icon_string(w, ICON_ENTRY_URL, url);
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
free(node->data.text);
|
|
|
|
node->data.text = title;
|
2004-12-09 13:30:44 +03:00
|
|
|
tree_handle_node_changed(hotlist_tree, node, true, false);
|
2004-07-29 15:40:48 +04:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
return true;
|
2004-06-30 21:44:11 +04:00
|
|
|
}
|
|
|
|
|
2004-07-04 22:44:51 +04:00
|
|
|
|
2004-07-29 15:40:48 +04:00
|
|
|
/**
|
2004-12-09 13:30:44 +03:00
|
|
|
* Attempts to process an interactive help message request
|
2004-07-29 15:40:48 +04:00
|
|
|
*
|
2004-12-09 13:30:44 +03:00
|
|
|
* \param x the x co-ordinate to give help for
|
|
|
|
* \param y the x co-ordinate to give help for
|
|
|
|
* \return the message code index
|
2004-07-29 15:40:48 +04:00
|
|
|
*/
|
2004-07-16 20:33:45 +04:00
|
|
|
int ro_gui_hotlist_help(int x, int y) {
|
2004-12-09 13:30:44 +03:00
|
|
|
return -1;
|
2004-07-16 20:33:45 +04:00
|
|
|
}
|