summaryrefslogtreecommitdiff
path: root/desktop/hotlist.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-08-20 20:03:46 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-08-20 20:04:42 +0100
commit7e6079ea49c74b87ca2823118166d1a16ff2439a (patch)
tree379abc32b7b9296124d0ff30a486dd724f75ed02 /desktop/hotlist.c
parent50efc3be3c1da1b2151f0d67aaee9513450e86c5 (diff)
downloadnetsurf-7e6079ea49c74b87ca2823118166d1a16ff2439a.tar.gz
netsurf-7e6079ea49c74b87ca2823118166d1a16ff2439a.tar.bz2
Complete editing of entry title and URL values.
Diffstat (limited to 'desktop/hotlist.c')
-rw-r--r--desktop/hotlist.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index 94d20e446..5a07961f8 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -336,6 +336,11 @@ static nserror hotlist_tree_node_entry_cb(
struct treeview_node_msg msg, void *data)
{
struct hotlist_entry *e = data;
+ const char *old_text;
+ nsurl *old_url;
+ nsurl *url;
+ nserror err;
+ bool match;
switch (msg.msg) {
case TREE_MSG_NODE_DELETE:
@@ -344,6 +349,46 @@ static nserror hotlist_tree_node_entry_cb(
break;
case TREE_MSG_NODE_EDIT:
+ if (lwc_string_isequal(hl_ctx.fields[HL_TITLE].field,
+ msg.data.node_edit.field, &match) ==
+ lwc_error_ok && match == true &&
+ msg.data.node_edit.text != NULL &&
+ msg.data.node_edit.text[0] != '\0') {
+ /* Requst to change the entry title text */
+ old_text = e->data[HL_TITLE].value;
+ e->data[HL_TITLE].value =
+ strdup(msg.data.node_edit.text);
+
+ if (e->data[HL_TITLE].value == NULL) {
+ e->data[HL_TITLE].value = old_text;
+ } else {
+ e->data[HL_TITLE].value_len =
+ strlen(e->data[HL_TITLE].value);
+ treeview_update_node_entry(hl_ctx.tree,
+ e->entry, e->data, e);
+ free((void *)old_text);
+ }
+
+ } else if (lwc_string_isequal(hl_ctx.fields[HL_URL].field,
+ msg.data.node_edit.field, &match) ==
+ lwc_error_ok && match == true &&
+ msg.data.node_edit.text != NULL &&
+ msg.data.node_edit.text[0] != '\0') {
+ /* Requst to change the entry URL text */
+ err = nsurl_create(msg.data.node_edit.text, &url);
+ if (err != NSERROR_OK)
+ return err;
+
+ old_url = e->url;
+
+ e->url = url;
+ e->data[HL_URL].value = nsurl_access(url);
+ e->data[HL_URL].value_len = nsurl_length(e->url);
+
+ treeview_update_node_entry(hl_ctx.tree,
+ e->entry, e->data, e);
+ nsurl_unref(old_url);
+ }
break;
case TREE_MSG_NODE_LAUNCH: