2004-06-30 21:44:11 +04:00
|
|
|
/*
|
2005-03-19 02:52:38 +03:00
|
|
|
* Copyright 2004, 2005 Richard Wilson <info@tinct.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-06-30 21:44:11 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Hotlist (implementation).
|
|
|
|
*/
|
|
|
|
|
2009-03-28 22:59:46 +03:00
|
|
|
#include <ctype.h>
|
2004-06-30 21:44:11 +04:00
|
|
|
#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-04 18:59:29 +04:00
|
|
|
#include "oslib/osfile.h"
|
2004-06-30 21:44:11 +04:00
|
|
|
#include "oslib/wimp.h"
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "content/content.h"
|
|
|
|
#include "content/urldb.h"
|
|
|
|
#include "desktop/tree.h"
|
|
|
|
#include "riscos/dialog.h"
|
|
|
|
#include "riscos/menus.h"
|
|
|
|
#include "riscos/options.h"
|
|
|
|
#include "riscos/theme.h"
|
|
|
|
#include "riscos/treeview.h"
|
|
|
|
#include "riscos/wimp.h"
|
|
|
|
#include "riscos/wimp_event.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "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
|
|
|
|
|
|
|
|
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
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
static const struct {
|
|
|
|
const char *url;
|
|
|
|
const char *msg_key;
|
|
|
|
} default_entries[] = {
|
2007-05-21 20:02:42 +04:00
|
|
|
{ "http://www.netsurf-browser.org/", "HotlistHomepage" },
|
2009-01-10 03:34:56 +03:00
|
|
|
{ "http://www.netsurf-browser.org/downloads/riscos/testbuilds", "HotlistTestBuild" },
|
|
|
|
{ "http://www.netsurf-browser.org/documentation", "HotlistDocumentation" },
|
2006-04-10 03:21:13 +04:00
|
|
|
{ "http://sourceforge.net/tracker/?atid=464312&group_id=51719",
|
|
|
|
"HotlistBugTracker" },
|
|
|
|
{ "http://sourceforge.net/tracker/?atid=464315&group_id=51719",
|
|
|
|
"HotlistFeatureRequest" }
|
|
|
|
};
|
|
|
|
#define ENTRIES_COUNT (sizeof(default_entries) / sizeof(default_entries[0]))
|
|
|
|
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_hotlist_initialise(void)
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
FILE *fp;
|
|
|
|
struct node *node;
|
2006-04-10 03:21:13 +04:00
|
|
|
const struct url_data *data;
|
2004-07-04 23:27:42 +04:00
|
|
|
|
2006-01-07 00:25:34 +03:00
|
|
|
/* create our window */
|
|
|
|
hotlist_window = ro_gui_dialog_create("tree");
|
|
|
|
ro_gui_set_window_title(hotlist_window,
|
|
|
|
messages_get("Hotlist"));
|
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
|
|
|
|
*/
|
2006-01-08 04:51:33 +03:00
|
|
|
fp = fopen(option_hotlist_path, "r");
|
2004-12-09 13:30:44 +03:00
|
|
|
if (!fp) {
|
2006-04-10 03:21:13 +04:00
|
|
|
int i;
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
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;
|
2006-04-10 03:21:13 +04:00
|
|
|
|
|
|
|
for (i = 0; i != ENTRIES_COUNT; i++) {
|
|
|
|
data = urldb_get_url_data(default_entries[i].url);
|
2006-04-15 19:23:23 +04:00
|
|
|
if (!data) {
|
2006-04-10 03:21:13 +04:00
|
|
|
urldb_add_url(default_entries[i].url);
|
2006-06-15 02:46:12 +04:00
|
|
|
urldb_set_url_persistence(
|
|
|
|
default_entries[i].url,
|
|
|
|
true);
|
2006-04-15 19:23:23 +04:00
|
|
|
data = urldb_get_url_data(
|
|
|
|
default_entries[i].url);
|
|
|
|
}
|
2006-04-10 03:21:13 +04:00
|
|
|
if (data) {
|
|
|
|
tree_create_URL_node(node,
|
|
|
|
default_entries[i].url, data,
|
|
|
|
messages_get(default_entries[i].msg_key));
|
|
|
|
}
|
2006-01-06 15:59:29 +03:00
|
|
|
}
|
2004-12-09 13:30:44 +03:00
|
|
|
tree_initialise(hotlist_tree);
|
|
|
|
} else {
|
2005-04-08 00:46:22 +04:00
|
|
|
fclose(fp);
|
2006-01-08 04:51:33 +03:00
|
|
|
hotlist_tree = options_load_tree(option_hotlist_path);
|
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
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void ro_gui_hotlist_save(void)
|
|
|
|
{
|
2005-04-08 00:46:22 +04:00
|
|
|
os_error *error;
|
|
|
|
|
2006-01-06 15:59:29 +03:00
|
|
|
if (!hotlist_tree)
|
|
|
|
return;
|
2004-12-09 13:30:44 +03:00
|
|
|
|
|
|
|
/* Save to our file
|
|
|
|
*/
|
2006-01-08 04:51:33 +03:00
|
|
|
options_save_tree(hotlist_tree, option_hotlist_save,
|
2005-02-07 17:28:43 +03:00
|
|
|
"NetSurf hotlist");
|
2006-01-08 04:51:33 +03:00
|
|
|
error = xosfile_set_type(option_hotlist_save, 0xfaf);
|
2004-12-09 13:30:44 +03:00
|
|
|
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
|
|
|
|
*/
|
2008-07-27 02:29:15 +04: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
|
|
|
*/
|
2008-07-27 02:29:15 +04:00
|
|
|
void hotlist_visited(struct content *content)
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
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,
|
2008-07-27 02:29:15 +04:00
|
|
|
struct node *node)
|
|
|
|
{
|
2004-12-09 13:30:44 +03:00
|
|
|
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-04-10 03:21:13 +04:00
|
|
|
tree_update_URL_node(node, content->url, 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
|
|
|
*/
|
2008-07-27 02:29:15 +04: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;
|
2006-01-08 04:51:33 +03:00
|
|
|
|
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");
|
2006-01-08 04:51:33 +03:00
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
ro_gui_set_window_title(dialog_folder, title);
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_folder, ICON_FOLDER_NAME, name, true);
|
2005-12-31 07:36:24 +03:00
|
|
|
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
|
|
|
*/
|
2008-07-27 02:29:15 +04: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);
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(dialog_entry, ICON_ENTRY_NAME, name, true);
|
|
|
|
ro_gui_set_icon_string(dialog_entry, ICON_ENTRY_URL, url, true);
|
2005-12-31 07:36:24 +03:00
|
|
|
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
|
|
|
*/
|
2008-07-27 02:29:15 +04: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;
|
2009-03-28 22:59:46 +03:00
|
|
|
const char *icon;
|
2005-12-31 07:36:24 +03:00
|
|
|
char *title;
|
2004-12-09 13:30:44 +03:00
|
|
|
char *url = NULL;
|
2009-03-28 22:59:46 +03:00
|
|
|
url_func_result res;
|
2006-04-10 03:21:13 +04:00
|
|
|
const struct url_data *data;
|
2005-12-31 07:36:24 +03:00
|
|
|
|
|
|
|
/* get our data */
|
|
|
|
if (w == dialog_entry) {
|
2009-03-28 22:59:46 +03:00
|
|
|
icon = ro_gui_get_icon_string(w, ICON_ENTRY_URL);
|
|
|
|
|
|
|
|
res = url_normalize(icon, &url);
|
|
|
|
if (res != URL_FUNC_OK) {
|
|
|
|
warn_user(res == URL_FUNC_FAILED ? "NoURLError"
|
|
|
|
: "NoMemory", 0);
|
2005-12-31 07:36:24 +03:00
|
|
|
return false;
|
2006-01-08 04:51:33 +03:00
|
|
|
}
|
2009-03-28 22:59:46 +03:00
|
|
|
|
|
|
|
icon = ro_gui_get_icon_string(w, ICON_ENTRY_NAME);
|
|
|
|
while (isspace(*icon))
|
|
|
|
icon++;
|
|
|
|
title = strdup(icon);
|
|
|
|
|
2004-12-09 13:30:44 +03:00
|
|
|
node = dialog_entry_node;
|
|
|
|
} else {
|
2009-03-28 22:59:46 +03:00
|
|
|
icon = ro_gui_get_icon_string(w, ICON_FOLDER_NAME);
|
|
|
|
while (isspace(*icon))
|
|
|
|
icon++;
|
|
|
|
title = strdup(icon);
|
|
|
|
|
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
|
|
|
|
2009-03-28 22:59:46 +03:00
|
|
|
if (title != NULL)
|
|
|
|
strip(title);
|
|
|
|
|
|
|
|
/* check for lack of text */
|
|
|
|
if (title == NULL || title[0] == '\0') {
|
2005-12-31 07:36:24 +03:00
|
|
|
free(url);
|
|
|
|
free(title);
|
|
|
|
node = NULL;
|
2009-03-28 22:59:46 +03:00
|
|
|
if (title == NULL)
|
2005-12-31 07:36:24 +03:00
|
|
|
warn_user("NoMemory", 0);
|
2009-03-28 22:59:46 +03:00
|
|
|
else if (title[0] == '\0')
|
2005-12-31 07:36:24 +03:00
|
|
|
warn_user("NoNameError", 0);
|
|
|
|
return false;
|
2004-07-29 15:40:48 +04:00
|
|
|
}
|
2009-03-28 22:59:46 +03:00
|
|
|
ro_gui_set_icon_string(w, url ? ICON_ENTRY_NAME : ICON_FOLDER_NAME,
|
|
|
|
title, false);
|
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) {
|
2006-04-10 03:21:13 +04:00
|
|
|
data = urldb_get_url_data(url);
|
2006-04-15 19:23:23 +04:00
|
|
|
if (!data) {
|
2006-04-10 03:21:13 +04:00
|
|
|
urldb_add_url(url);
|
2006-06-15 02:46:12 +04:00
|
|
|
urldb_set_url_persistence(url, true);
|
2006-04-15 19:23:23 +04:00
|
|
|
data = urldb_get_url_data(url);
|
|
|
|
}
|
2005-12-31 07:36:24 +03:00
|
|
|
if (!data) {
|
|
|
|
free(url);
|
|
|
|
free(title);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!data->title)
|
2006-04-10 03:21:13 +04:00
|
|
|
urldb_set_url_title(url, title);
|
2005-12-31 07:36:24 +03:00
|
|
|
node = dialog_entry_node = tree_create_URL_node(
|
2006-04-10 03:21:13 +04:00
|
|
|
hotlist_tree->root, url, data, title);
|
2006-01-08 04:51:33 +03:00
|
|
|
|
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) {
|
2008-07-27 02:29:15 +04:00
|
|
|
free((void *)element->text);
|
2005-12-31 07:36:24 +03:00
|
|
|
element->text = url;
|
2008-08-05 05:23:04 +04:00
|
|
|
ro_gui_set_icon_string(w, ICON_ENTRY_URL, url, true);
|
2004-12-09 13:30:44 +03:00
|
|
|
}
|
2008-07-27 02:29:15 +04:00
|
|
|
free((void *)node->data.text);
|
2005-12-31 07:36:24 +03:00
|
|
|
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
|
|
|
}
|