NetSurf
Data Structures | Functions | Variables
url_suggest.c File Reference

URL Suggestion Menu (implementation). More...

#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <oslib/wimp.h>
#include "utils/messages.h"
#include "utils/nsurl.h"
#include "netsurf/url_db.h"
#include "riscos/menus.h"
#include "riscos/url_suggest.h"
Include dependency graph for url_suggest.c:

Go to the source code of this file.

Data Structures

struct  url_suggest_item
 

Functions

static bool ro_gui_url_suggest_callback (nsurl *url, const struct url_data *data)
 Callback function for urldb_iterate_entries. More...
 
static wimp_MENU (URL_SUGGEST_MAX_URLS)
 Initialise the URL suggestion menu. More...
 
bool ro_gui_url_suggest_get_menu_available (void)
 Check if there is a URL suggestion menu available for use. More...
 
bool ro_gui_url_suggest_prepare_menu (void)
 Builds the URL suggestion menu. More...
 
const char * ro_gui_url_suggest_get_selection (wimp_selection *selection)
 Process a selection from the URL Suggest menu. More...
 

Variables

static int suggest_entries
 
static time_t suggest_time
 
static struct url_suggest_itemsuggest_list
 

Detailed Description

URL Suggestion Menu (implementation).

Definition in file url_suggest.c.

Function Documentation

◆ ro_gui_url_suggest_callback()

bool ro_gui_url_suggest_callback ( nsurl url,
const struct url_data data 
)
static

Callback function for urldb_iterate_entries.

Parameters
urlURL which matches
dataData associated with URL
Returns
true to continue iteration, false otherwise

Definition at line 158 of file url_suggest.c.

References CONTENT_HTML, CONTENT_TEXTPLAIN, count(), url_data::last_visit, url_suggest_item::next, nsurl_access(), suggest_entries, suggest_list, suggest_time, url_data::type, url_suggest_item::url, URL_SUGGEST_MAX_URLS, url_data::visits, and url_suggest_item::weight.

Referenced by ro_gui_url_suggest_prepare_menu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_suggest_get_menu_available()

bool ro_gui_url_suggest_get_menu_available ( void  )

Check if there is a URL suggestion menu available for use.

Todo:
Ideally this should be able to decide if there's a menu available without actually having to build it all.
Returns
true if the menu has entries; else false.

Definition at line 81 of file url_suggest.c.

References ro_gui_url_suggest_prepare_menu().

Referenced by ro_gui_url_bar_update_urlsuggest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_suggest_get_selection()

const char * ro_gui_url_suggest_get_selection ( wimp_selection *  selection)

Process a selection from the URL Suggest menu.

Parameters
*selectionThe menu selection.
Returns
Pointer to the URL that was selected, or NULL for none.

Definition at line 230 of file url_suggest.c.

References ro_gui_url_suggest_menu, and url_suggest_item::url.

Referenced by ro_gui_url_bar_menu_select().

Here is the caller graph for this function:

◆ ro_gui_url_suggest_prepare_menu()

bool ro_gui_url_suggest_prepare_menu ( void  )

Builds the URL suggestion menu.

This is called by ro_gui_menu_create() when it is asked to display the url_suggest_menu.

/return true if the menu has entries; else false.

Definition at line 94 of file url_suggest.c.

References url_suggest_item::next, ro_gui_url_suggest_callback(), ro_gui_url_suggest_menu, suggest_entries, suggest_list, suggest_time, url_suggest_item::url, URL_SUGGEST_MAX_URLS, and urldb_iterate_entries().

Referenced by ro_gui_dialog_open_url_menu_prepare(), ro_gui_dialog_prepare_open_url(), ro_gui_options_home_initialise(), ro_gui_options_home_menu_prepare(), ro_gui_url_bar_menu_prepare(), and ro_gui_url_suggest_get_menu_available().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wimp_MENU()

static wimp_MENU ( URL_SUGGEST_MAX_URLS  )
static

Initialise the URL suggestion menu.

This MUST be called before anything tries to use the URL menu.

Returns
true if initialisation was OK; else false.

Definition at line 48 of file url_suggest.c.

References messages_get(), ro_gui_menu_init_structure(), ro_gui_url_suggest_menu, suggest_entries, and URL_SUGGEST_MAX_URLS.

Here is the call graph for this function:

Variable Documentation

◆ suggest_entries

int suggest_entries
static

◆ suggest_list

struct url_suggest_item* suggest_list
static

Definition at line 46 of file url_suggest.c.

Referenced by ro_gui_url_suggest_callback(), and ro_gui_url_suggest_prepare_menu().

◆ suggest_time

time_t suggest_time
static

Definition at line 45 of file url_suggest.c.

Referenced by ro_gui_url_suggest_callback(), and ro_gui_url_suggest_prepare_menu().