diff options
author | Steve Fryatt <steve@stevefryatt.org.uk> | 2011-10-13 20:40:52 +0000 |
---|---|---|
committer | Steve Fryatt <steve@stevefryatt.org.uk> | 2011-10-13 20:40:52 +0000 |
commit | 797838270e6d8eec7c53e32fef5c94e09d4a640b (patch) | |
tree | 29cc9883b054c64e6593fdfc32cbbf24d9fb5216 /riscos/hotlist.c | |
parent | c91a4b703539857f1c3b382e1b9e561091fc5512 (diff) | |
download | netsurf-797838270e6d8eec7c53e32fef5c94e09d4a640b.tar.gz netsurf-797838270e6d8eec7c53e32fef5c94e09d4a640b.tar.bz2 |
Bring external hotlist support in line with Bookmaker's interpretation.
svn path=/trunk/netsurf/; revision=13042
Diffstat (limited to 'riscos/hotlist.c')
-rw-r--r-- | riscos/hotlist.c | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/riscos/hotlist.c b/riscos/hotlist.c index 34aec9081..a01fb0307 100644 --- a/riscos/hotlist.c +++ b/riscos/hotlist.c @@ -47,6 +47,7 @@ #include "riscos/wimp_event.h" #include "utils/log.h" #include "utils/messages.h" +#include "utils/schedule.h" #include "utils/utils.h" #include "utils/url.h" @@ -60,6 +61,7 @@ static bool ro_gui_hotlist_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action); static void ro_gui_hotlist_toolbar_click(button_bar_action action); static void ro_gui_hotlist_addurl_bounce(wimp_message *message); +static void ro_gui_hotlist_scheduled_callback(void *p); struct ro_treeview_callbacks ro_hotlist_treeview_callbacks = { ro_gui_hotlist_toolbar_click, @@ -458,25 +460,23 @@ void ro_gui_hotlist_add_page(const char *url) if (url == NULL) return; - /* First pass the page to NetSurf's own hotlist. */ + /* If we're not using external hotlists, add the page to NetSurf's + * own hotlist and return... + */ - hotlist_add_page(url); + if (!option_external_hotlists) { + hotlist_add_page(url); + return; + } - /* Then pass it on to any helper applications that might be - * interested. - * - * The RMA storage is freed on receipt of a Message_HotlistChanged or - * a bounce from Message_HotlistAddURL. Some clients don't seem to - * bother sending back a Message_HotlistChanged, so in this case the - * strings are left in situ in RMA and cleared the next time we need - * to send a message. + /* ...otherwise try broadcasting the details to any other + * interested parties. If no-one answers, we'll fall back to + * NetSurf's hotlist anyway when the message bounces. */ - if (hotlist_url != NULL || hotlist_title != NULL) - ro_gui_hotlist_add_cleanup(); + ro_gui_hotlist_add_cleanup(); - if (!option_external_hotlists) - return; + LOG(("Sending Hotlist AddURL to potential hotlist clients.")); data = urldb_get_url_data(url); if (data == NULL) @@ -503,6 +503,12 @@ void ro_gui_hotlist_add_page(const char *url) if (!ro_message_send_message(wimp_USER_MESSAGE_RECORDED, &message, 0, ro_gui_hotlist_addurl_bounce)) ro_gui_hotlist_add_cleanup(); + + /* Listen for the next Null poll, as an indication that the + * message didn't bounce. + */ + + schedule(0, ro_gui_hotlist_scheduled_callback, NULL); } @@ -515,6 +521,30 @@ void ro_gui_hotlist_add_page(const char *url) static void ro_gui_hotlist_addurl_bounce(wimp_message *message) { LOG(("Hotlist AddURL Bounced")); + + if (hotlist_url != NULL) + hotlist_add_page(hotlist_url); + + ro_gui_hotlist_add_cleanup(); + + /* There's no longer any need to listen for the next Null poll. */ + + schedule_remove(ro_gui_hotlist_scheduled_callback, NULL); +} + + +/** + * Callback to schedule for the next available Null poll, by which point + * a hotlist client will have claimed the Message_HotlistAddURL and any + * details in RMA can safely be discarded. + * + * \param *p Unused data pointer. + */ + +static void ro_gui_hotlist_scheduled_callback(void *p) +{ + LOG(("Hotlist AddURL was claimed by something.")); + ro_gui_hotlist_add_cleanup(); } |