NetSurf
Data Structures | Macros | Functions | Variables
hotlist.c File Reference

Implementation of GTK bookmark (hotlist) manager. More...

#include <stdint.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
#include "desktop/hotlist.h"
#include "gtk/compat.h"
#include "gtk/plotters.h"
#include "gtk/resources.h"
#include "gtk/corewindow.h"
#include "gtk/hotlist.h"
Include dependency graph for hotlist.c:

Go to the source code of this file.

Data Structures

struct  nsgtk_hotlist_window
 hotlist window container for gtk. More...
 
struct  menu_events
 

Macros

#define MENUPROTO(x)
 
#define MENUEVENT(x)   { #x, G_CALLBACK(nsgtk_on_##x##_activate) }
 
#define MENUHANDLER(x)
 

Functions

 MENUPROTO (export)
 
 MENUPROTO (new_folder)
 
 MENUPROTO (new_entry)
 
 MENUPROTO (edit_selected)
 
 MENUPROTO (delete_selected)
 
 MENUPROTO (select_all)
 
 MENUPROTO (clear_selection)
 
 MENUPROTO (expand_all)
 
 MENUPROTO (expand_directories)
 
 MENUPROTO (expand_addresses)
 
 MENUPROTO (collapse_all)
 
 MENUPROTO (collapse_directories)
 
 MENUPROTO (collapse_addresses)
 
 MENUPROTO (launch)
 
 MENUHANDLER (export)
 
 MENUHANDLER (new_folder)
 
 MENUHANDLER (new_entry)
 
 MENUHANDLER (edit_selected)
 
 MENUHANDLER (delete_selected)
 
 MENUHANDLER (select_all)
 
 MENUHANDLER (clear_selection)
 
 MENUHANDLER (expand_all)
 
 MENUHANDLER (expand_directories)
 
 MENUHANDLER (expand_addresses)
 
 MENUHANDLER (collapse_all)
 
 MENUHANDLER (collapse_directories)
 
 MENUHANDLER (collapse_addresses)
 
 MENUHANDLER (launch)
 
static void nsgtk_hotlist_init_menu (struct nsgtk_hotlist_window *hlwin)
 Connects menu events in the hotlist window. More...
 
static nserror nsgtk_hotlist_mouse (struct nsgtk_corewindow *nsgtk_cw, browser_mouse_state mouse_state, int x, int y)
 callback for mouse action on hotlist window More...
 
static nserror nsgtk_hotlist_key (struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
 callback for keypress on hotlist window More...
 
static nserror nsgtk_hotlist_draw (struct nsgtk_corewindow *nsgtk_cw, struct rect *r)
 callback on draw event for hotlist window More...
 
static nserror nsgtk_hotlist_init (void)
 Creates the window for the hotlist tree. More...
 
nserror nsgtk_hotlist_present (void)
 make the hotlist window visible. More...
 
nserror nsgtk_hotlist_destroy (void)
 Free any resources allocated for the hotlist window. More...
 

Variables

static struct nsgtk_hotlist_windowhotlist_window = NULL
 
static struct menu_events menu_events []
 

Detailed Description

Implementation of GTK bookmark (hotlist) manager.

Definition in file hotlist.c.

Macro Definition Documentation

◆ MENUEVENT

#define MENUEVENT (   x)    { #x, G_CALLBACK(nsgtk_on_##x##_activate) }

Definition at line 54 of file hotlist.c.

◆ MENUHANDLER

#define MENUHANDLER (   x)
Value:
gboolean nsgtk_on_##x##_activate(GtkMenuItem *widget, \
gpointer g)

Definition at line 55 of file hotlist.c.

◆ MENUPROTO

#define MENUPROTO (   x)
Value:
static gboolean nsgtk_on_##x##_activate( \
GtkMenuItem *widget, gpointer g)

Definition at line 52 of file hotlist.c.

Function Documentation

◆ MENUHANDLER() [1/14]

MENUHANDLER ( clear_selection  )

Definition at line 179 of file hotlist.c.

References hotlist_keypress(), and NS_KEY_CLEAR_SELECTION.

Here is the call graph for this function:

◆ MENUHANDLER() [2/14]

MENUHANDLER ( collapse_addresses  )

Definition at line 216 of file hotlist.c.

References hotlist_contract().

Here is the call graph for this function:

◆ MENUHANDLER() [3/14]

MENUHANDLER ( collapse_all  )

Definition at line 204 of file hotlist.c.

References hotlist_contract().

Here is the call graph for this function:

◆ MENUHANDLER() [4/14]

MENUHANDLER ( collapse_directories  )

Definition at line 210 of file hotlist.c.

References hotlist_contract().

Here is the call graph for this function:

◆ MENUHANDLER() [5/14]

MENUHANDLER ( delete_selected  )

Definition at line 165 of file hotlist.c.

References hotlist_keypress(), and NS_KEY_DELETE_LEFT.

Here is the call graph for this function:

◆ MENUHANDLER() [6/14]

MENUHANDLER ( edit_selected  )

Definition at line 159 of file hotlist.c.

References hotlist_edit_selection().

Here is the call graph for this function:

◆ MENUHANDLER() [7/14]

MENUHANDLER ( expand_addresses  )

Definition at line 198 of file hotlist.c.

References hotlist_expand().

Here is the call graph for this function:

◆ MENUHANDLER() [8/14]

MENUHANDLER ( expand_all  )

Definition at line 186 of file hotlist.c.

References hotlist_expand().

Here is the call graph for this function:

◆ MENUHANDLER() [9/14]

MENUHANDLER ( expand_directories  )

Definition at line 192 of file hotlist.c.

References hotlist_expand().

Here is the call graph for this function:

◆ MENUHANDLER() [10/14]

MENUHANDLER ( export  )

Definition at line 113 of file hotlist.c.

References hotlist_export(), NSGTK_STOCK_CANCEL, NSGTK_STOCK_SAVE, and nsgtk_hotlist_window::wnd.

Here is the call graph for this function:

◆ MENUHANDLER() [11/14]

MENUHANDLER ( launch  )

Definition at line 222 of file hotlist.c.

References hotlist_keypress(), and NS_KEY_CR.

Here is the call graph for this function:

◆ MENUHANDLER() [12/14]

MENUHANDLER ( new_entry  )

Definition at line 152 of file hotlist.c.

References hotlist_add_entry().

Here is the call graph for this function:

◆ MENUHANDLER() [13/14]

MENUHANDLER ( new_folder  )

Definition at line 146 of file hotlist.c.

References hotlist_add_folder().

Here is the call graph for this function:

◆ MENUHANDLER() [14/14]

MENUHANDLER ( select_all  )

Definition at line 171 of file hotlist.c.

References hotlist_keypress(), NS_KEY_ESCAPE, and NS_KEY_SELECT_ALL.

Here is the call graph for this function:

◆ MENUPROTO() [1/14]

MENUPROTO ( clear_selection  )

◆ MENUPROTO() [2/14]

MENUPROTO ( collapse_addresses  )

◆ MENUPROTO() [3/14]

MENUPROTO ( collapse_all  )

◆ MENUPROTO() [4/14]

MENUPROTO ( collapse_directories  )

◆ MENUPROTO() [5/14]

MENUPROTO ( delete_selected  )

◆ MENUPROTO() [6/14]

MENUPROTO ( edit_selected  )

◆ MENUPROTO() [7/14]

MENUPROTO ( expand_addresses  )

◆ MENUPROTO() [8/14]

MENUPROTO ( expand_all  )

◆ MENUPROTO() [9/14]

MENUPROTO ( expand_directories  )

◆ MENUPROTO() [10/14]

MENUPROTO ( export  )

◆ MENUPROTO() [11/14]

MENUPROTO ( launch  )

◆ MENUPROTO() [12/14]

MENUPROTO ( new_entry  )

◆ MENUPROTO() [13/14]

MENUPROTO ( new_folder  )

◆ MENUPROTO() [14/14]

MENUPROTO ( select_all  )

◆ nsgtk_hotlist_destroy()

nserror nsgtk_hotlist_destroy ( void  )

Free any resources allocated for the hotlist window.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 396 of file hotlist.c.

References nsgtk_hotlist_window::builder, nsgtk_hotlist_window::core, hotlist_manager_fini(), hotlist_window, NSERROR_OK, nsgtk_corewindow_fini(), and nsgtk_hotlist_window::wnd.

Referenced by nsgtk_finalise().

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

◆ nsgtk_hotlist_draw()

static nserror nsgtk_hotlist_draw ( struct nsgtk_corewindow nsgtk_cw,
struct rect r 
)
static

callback on draw event for hotlist window

Parameters
nsgtk_cwThe nsgtk core window structure.
rThe rectangle of the window that needs updating.
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 298 of file hotlist.c.

References hotlist_redraw(), redraw_context::interactive, NSERROR_OK, and nsgtk_plotters.

Referenced by nsgtk_hotlist_init().

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

◆ nsgtk_hotlist_init()

static nserror nsgtk_hotlist_init ( void  )
static

Creates the window for the hotlist tree.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 316 of file hotlist.c.

References nsgtk_hotlist_window::builder, nsgtk_corewindow::cb_table, nsgtk_hotlist_window::core, nsgtk_corewindow::draw, nsgtk_corewindow::drawing_area, hotlist_manager_init(), hotlist_window, nsgtk_corewindow::key, nsgtk_corewindow::mouse, NSERROR_NOMEM, NSERROR_OK, nsgtk_builder_new_from_resname(), nsgtk_corewindow_init(), nsgtk_hotlist_draw(), nsgtk_hotlist_init_menu(), nsgtk_hotlist_key(), nsgtk_hotlist_mouse(), NSLOG, nsgtk_corewindow::scrolled, and nsgtk_hotlist_window::wnd.

Referenced by nsgtk_hotlist_present().

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

◆ nsgtk_hotlist_init_menu()

static void nsgtk_hotlist_init_menu ( struct nsgtk_hotlist_window hlwin)
static

Connects menu events in the hotlist window.

Definition at line 232 of file hotlist.c.

References nsgtk_hotlist_window::builder, menu_events, and NSLOG.

Referenced by nsgtk_hotlist_init().

Here is the caller graph for this function:

◆ nsgtk_hotlist_key()

static nserror nsgtk_hotlist_key ( struct nsgtk_corewindow nsgtk_cw,
uint32_t  nskey 
)
static

callback for keypress on hotlist window

Parameters
nsgtk_cwThe nsgtk core window structure.
nskeyThe netsurf key code
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 282 of file hotlist.c.

References hotlist_keypress(), NSERROR_NOT_IMPLEMENTED, and NSERROR_OK.

Referenced by nsgtk_hotlist_init().

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

◆ nsgtk_hotlist_mouse()

static nserror nsgtk_hotlist_mouse ( struct nsgtk_corewindow nsgtk_cw,
browser_mouse_state  mouse_state,
int  x,
int  y 
)
static

callback for mouse action on hotlist window

Parameters
nsgtk_cwThe nsgtk core window structure.
mouse_statenetsurf mouse state on event
xlocation of event
ylocation of event
Returns
NSERROR_OK on success otherwise apropriate error code

Definition at line 265 of file hotlist.c.

References hotlist_mouse_action(), and NSERROR_OK.

Referenced by nsgtk_hotlist_init().

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

◆ nsgtk_hotlist_present()

nserror nsgtk_hotlist_present ( void  )

make the hotlist window visible.

Returns
NSERROR_OK on success else appropriate error code on faliure.

Definition at line 383 of file hotlist.c.

References hotlist_window, NSERROR_OK, nsgtk_hotlist_init(), and nsgtk_hotlist_window::wnd.

Referenced by showbookmarks_button_clicked_cb().

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

Variable Documentation

◆ hotlist_window

struct nsgtk_hotlist_window* hotlist_window = NULL
static

Definition at line 50 of file hotlist.c.

Referenced by nsgtk_hotlist_destroy(), nsgtk_hotlist_init(), and nsgtk_hotlist_present().

◆ menu_events

struct menu_events menu_events[]
static
Initial value:
= {
MENUEVENT(export),
MENUEVENT(new_folder),
MENUEVENT(new_entry),
MENUEVENT(edit_selected),
MENUEVENT(delete_selected),
MENUEVENT(select_all),
MENUEVENT(clear_selection),
MENUEVENT(expand_all),
MENUEVENT(expand_directories),
MENUEVENT(expand_addresses),
MENUEVENT(collapse_all),
MENUEVENT(collapse_directories),
MENUEVENT(collapse_addresses),
MENUEVENT(launch),
{NULL, NULL}
}
#define MENUEVENT(x)
Definition: hotlist.c:54

Definition at line 85 of file hotlist.c.

Referenced by nsgtk_hotlist_init_menu().