NetSurf
Data Structures | Macros | Functions | Variables
scaffolding.c File Reference
#include <gtk/gtk.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsurl.h"
#include "utils/nsoption.h"
#include "netsurf/browser_window.h"
#include "desktop/browser_history.h"
#include "desktop/hotlist.h"
#include "gtk/compat.h"
#include "gtk/toolbar_items.h"
#include "gtk/menu.h"
#include "gtk/local_history.h"
#include "gtk/gui.h"
#include "gtk/download.h"
#include "gtk/window.h"
#include "gtk/warn.h"
#include "gtk/tabs.h"
#include "gtk/resources.h"
#include "gtk/scaffolding.h"
Include dependency graph for scaffolding.c:

Go to the source code of this file.

Data Structures

struct  nsgtk_menu
 menu entry context More...
 
struct  nsgtk_scaffolding
 Core scaffolding structure. More...
 

Macros

#define TOOLBAR_ITEM_p(identifier, name)
 handle menu activate signals by calling toolbar item activation More...
 
#define TOOLBAR_ITEM_y(identifier, name)
 
#define TOOLBAR_ITEM_n(identifier, name)
 
#define TOOLBAR_ITEM(identifier, name, sensitivity, clicked, activate, label, iconame)    TOOLBAR_ITEM_ ## activate(identifier, name)
 
#define TOOLBAR_ITEM_p(identifier, name, iconame)
 handle menu activate signals by calling toolbar item activation More...
 
#define TOOLBAR_ITEM_y(identifier, name, iconame)
 
#define TOOLBAR_ITEM_n(identifier, name, iconame)
 
#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label, iconame)
 
#define ITEM_MB(p, q, r)
 
#define ITEM_MBP(p, q, r)
 
#define ITEM_MBp(p, q, r)
 
#define SENSITIVITY(q)
 

Functions

static void popup_menu_hide (struct nsgtk_popup_menu *menu, bool nav, bool cnp)
 Helper to hide popup menu entries by grouping. More...
 
static void popup_menu_show (struct nsgtk_popup_menu *menu, bool nav, bool cnp)
 Helper to show popup menu entries by grouping. More...
 
static void scaffolding_window_destroy (GtkWidget *widget, gpointer data)
 resource cleanup function for window destruction. More...
 
static gboolean scaffolding_window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 gtk event callback on window delete event. More...
 
static void scaffolding_update_context (struct nsgtk_scaffolding *g)
 Update the scaffolding controls. More...
 
static guint nsgtk_scaffolding_update_edit_actions_sensitivity (struct nsgtk_scaffolding *g)
 edit the sensitivity of focused widget More...
 
static void nsgtk_scaffolding_enable_edit_actions_sensitivity (struct nsgtk_scaffolding *g)
 make edit actions sensitive More...
 
static gboolean nsgtk_window_edit_menu_shown (GtkWidget *widget, struct nsgtk_scaffolding *g)
 gtk event for edit menu being show More...
 
static gboolean nsgtk_window_edit_menu_hidden (GtkWidget *widget, struct nsgtk_scaffolding *g)
 gtk event handler for edit menu being hidden More...
 
static gboolean nsgtk_window_popup_menu_hidden (GtkWidget *widget, struct nsgtk_scaffolding *g)
 gtk event handler for popup menu being hidden. More...
 
static void nsgtk_window_tabs_add (GtkNotebook *notebook, GtkWidget *page, guint page_num, struct nsgtk_scaffolding *g)
 Update the menus when the number of tabs changes. More...
 
static void nsgtk_window_tabs_remove (GtkNotebook *notebook, GtkWidget *page, guint page_num, struct nsgtk_scaffolding *gs)
 Update the menus when the number of tabs changes. More...
 
static gboolean nsgtk_on_savelink_activate_menu (GtkMenuItem *widget, gpointer data)
 
static gboolean nsgtk_on_link_openwin_activate_menu (GtkMenuItem *widget, gpointer data)
 Handler for opening new window from a link. More...
 
static gboolean nsgtk_on_link_opentab_activate_menu (GtkMenuItem *widget, gpointer data)
 Handler for opening new tab from a link. More...
 
static gboolean nsgtk_on_link_bookmark_activate_menu (GtkMenuItem *widget, gpointer data)
 Handler for bookmarking a link. More...
 
static gboolean nsgtk_on_link_copy_activate_menu (GtkMenuItem *widget, gpointer data)
 Handler for copying a link. More...
 
static gboolean nsgtk_on_find_activate_menu (GtkMenuItem *widget, gpointer data)
 
static nserror get_bar_show (bool *menu, bool *tool)
 
static nserror set_bar_show (const char *bar, bool show)
 
static gboolean nsgtk_on_menubar_activate_menu (GtkMenuItem *widget, gpointer data)
 
static gboolean nsgtk_on_toolbar_activate_menu (GtkMenuItem *widget, gpointer data)
 
static gboolean nsgtk_on_nexttab_activate_menu (GtkMenuItem *widget, gpointer data)
 
static gboolean nsgtk_on_prevtab_activate_menu (GtkMenuItem *widget, gpointer data)
 
static gboolean nsgtk_on_closetab_activate_menu (GtkMenuItem *widget, gpointer data)
 menu signal handler for activation on close tab item More...
 
static void nsgtk_menu_connect_signals (struct nsgtk_scaffolding *g)
 attach gtk signal handlers for menus More...
 
static struct nsgtk_bar_submenucreate_scaffolding_bar_menu (struct nsgtk_scaffolding *gs, GtkAccelGroup *group, bool showmenu, bool showtool)
 Create and connect handlers to bar menu. More...
 
static struct nsgtk_burger_menucreate_scaffolding_burger_menu (struct nsgtk_scaffolding *gs, GtkAccelGroup *group, bool showbar, bool showtool)
 Create and connect handlers to burger menu. More...
 
static struct nsgtk_popup_menucreate_scaffolding_popup_menu (struct nsgtk_scaffolding *gs, GtkAccelGroup *group, bool showbar, bool showtool)
 Create and connect handlers to popup menu. More...
 
static struct nsgtk_link_menucreate_scaffolding_link_menu (struct nsgtk_scaffolding *g, GtkAccelGroup *group)
 Create and connect handlers to link popup menu. More...
 
static nserror nsgtk_menu_initialise (struct nsgtk_scaffolding *g)
 initialiase the menu signal handlers ready for connection More...
 
static void nsgtk_menu_set_sensitivity (struct nsgtk_scaffolding *g)
 
static void nsgtk_menu_set_icons (struct nsgtk_scaffolding *g)
 
static nserror nsgtk_menus_create (struct nsgtk_scaffolding *gs)
 create and initialise menus More...
 
void nsgtk_scaffolding_set_title (struct gui_window *gw, const char *title)
 set the title in the window More...
 
nserror nsgtk_scaffolding_throbber (struct gui_window *gw, bool active)
 Update scaffolding window when throbber state changes. More...
 
nserror nsgtk_scaffolding_destroy_all (void)
 causes all scaffolding windows to be destroyed. More...
 
GtkWindow * nsgtk_scaffolding_window (struct nsgtk_scaffolding *g)
 Get the gtk window for a scaffolding. More...
 
GtkNotebook * nsgtk_scaffolding_notebook (struct nsgtk_scaffolding *g)
 Get the gtk notebook from a scaffold. More...
 
GtkMenuBar * nsgtk_scaffolding_menu_bar (struct nsgtk_scaffolding *gs)
 
struct nsgtk_scaffoldingnsgtk_scaffolding_iterate (struct nsgtk_scaffolding *g)
 Iterate through available scaffolding. More...
 
struct gui_windownsgtk_scaffolding_top_level (struct nsgtk_scaffolding *g)
 
void nsgtk_scaffolding_set_top_level (struct gui_window *gw)
 Set the current active top level gui window. More...
 
void nsgtk_scaffolding_set_sensitivity (struct nsgtk_scaffolding *g)
 update the sensitivity of context sensitive UI elements More...
 
nserror nsgtk_scaffolding_toolbar_context_menu (struct nsgtk_scaffolding *gs)
 open the toolbar context menu More...
 
nserror nsgtk_scaffolding_burger_menu (struct nsgtk_scaffolding *gs)
 open the burger menu More...
 
void nsgtk_scaffolding_context_menu (struct nsgtk_scaffolding *g, gdouble x, gdouble y)
 Open a context sensitive menu. More...
 
struct nsgtk_scaffoldingnsgtk_current_scaffolding (void)
 Obtain the most recently used scaffolding element. More...
 
struct nsgtk_scaffoldingnsgtk_scaffolding_from_notebook (GtkNotebook *notebook)
 find which scaffolding contains a gtk notebook More...
 
struct nsgtk_scaffoldingnsgtk_new_scaffolding (struct gui_window *toplevel)
 create a new scaffolding for a window. More...
 
nserror nsgtk_scaffolding_position_page_info (struct nsgtk_scaffolding *gs, struct nsgtk_pi_window *win)
 Position the page-info popup in the right place. More...
 
nserror nsgtk_scaffolding_position_local_history (struct nsgtk_scaffolding *gs)
 Position the local-history popup in the right place. More...
 

Variables

static struct nsgtk_scaffoldingscaf_current
 current scaffold for model dialogue use More...
 
static struct nsgtk_scaffoldingscaf_list = NULL
 global list for interface changes More...
 
static struct browser_window_features current_menu_features
 holds the context data for what's under the pointer, when the contextual menu is opened. More...
 

Macro Definition Documentation

◆ ITEM_MB

#define ITEM_MB (   p,
  q,
 
)
Value:
g->menus[p##_BUTTON].main = g->menu_bar->r##_submenu->q##_menuitem; \
g->menus[p##_BUTTON].burger = g->burger_menu->r##_submenu->q##_menuitem

◆ ITEM_MBP

#define ITEM_MBP (   p,
  q,
 
)
Value:
g->menus[p##_BUTTON].main = g->menu_bar->r##_submenu->q##_menuitem; \
g->menus[p##_BUTTON].burger = g->burger_menu->r##_submenu->q##_menuitem; \
g->menus[p##_BUTTON].popup = g->popup_menu->r##_submenu->q##_menuitem

◆ ITEM_MBp

#define ITEM_MBp (   p,
  q,
 
)
Value:
g->menus[p##_BUTTON].main = g->menu_bar->r##_submenu->q##_menuitem; \
g->menus[p##_BUTTON].burger = g->burger_menu->r##_submenu->q##_menuitem; \
g->menus[p##_BUTTON].popup = g->popup_menu->q##_menuitem

◆ SENSITIVITY

#define SENSITIVITY (   q)
Value:
i = q##_BUTTON; \
if (g->menus[i].main != NULL) \
gtk_widget_set_sensitive(GTK_WIDGET(g->menus[i].main), \
g->menus[i].sensitivity); \
if (g->menus[i].burger != NULL) \
gtk_widget_set_sensitive(GTK_WIDGET(g->menus[i].burger), \
g->menus[i].sensitivity); \
if (g->menus[i].popup != NULL) \
gtk_widget_set_sensitive(GTK_WIDGET(g->menus[i].popup), \
g->menus[i].sensitivity);

◆ TOOLBAR_ITEM [1/2]

#define TOOLBAR_ITEM (   identifier,
  name,
  sensitivity,
  clicked,
  activate,
  label,
  iconame 
)     TOOLBAR_ITEM_ ## activate(identifier, name)

Definition at line 487 of file scaffolding.c.

◆ TOOLBAR_ITEM [2/2]

#define TOOLBAR_ITEM (   identifier,
  name,
  snstvty,
  clicked,
  activate,
  label,
  iconame 
)
Value:
g->menus[identifier].sensitivity = snstvty; \
TOOLBAR_ITEM_ ## activate(identifier, name, iconame)

Definition at line 487 of file scaffolding.c.

◆ TOOLBAR_ITEM_n [1/2]

#define TOOLBAR_ITEM_n (   identifier,
  name 
)

Definition at line 486 of file scaffolding.c.

◆ TOOLBAR_ITEM_n [2/2]

#define TOOLBAR_ITEM_n (   identifier,
  name,
  iconame 
)
Value:
g->menus[identifier].mhandler = NULL; \
g->menus[identifier].iconname = iconame;

Definition at line 486 of file scaffolding.c.

◆ TOOLBAR_ITEM_p [1/2]

#define TOOLBAR_ITEM_p (   identifier,
  name 
)
Value:
static gboolean \
nsgtk_on_##name##_activate_menu(GtkMenuItem *widget, gpointer data) \
{ \
struct nsgtk_scaffolding *gs = (struct nsgtk_scaffolding *)data;\
nsgtk_window_item_activate(gs->top_level, identifier); \
return TRUE; \
}
Core scaffolding structure.
Definition: scaffolding.c:64

handle menu activate signals by calling toolbar item activation

Definition at line 477 of file scaffolding.c.

◆ TOOLBAR_ITEM_p [2/2]

#define TOOLBAR_ITEM_p (   identifier,
  name,
  iconame 
)
Value:
g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \
g->menus[identifier].iconname = iconame;

handle menu activate signals by calling toolbar item activation

Definition at line 477 of file scaffolding.c.

◆ TOOLBAR_ITEM_y [1/2]

#define TOOLBAR_ITEM_y (   identifier,
  name 
)

Definition at line 485 of file scaffolding.c.

◆ TOOLBAR_ITEM_y [2/2]

#define TOOLBAR_ITEM_y (   identifier,
  name,
  iconame 
)
Value:
g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \
g->menus[identifier].iconname = iconame;

Definition at line 485 of file scaffolding.c.

Function Documentation

◆ create_scaffolding_bar_menu()

static struct nsgtk_bar_submenu * create_scaffolding_bar_menu ( struct nsgtk_scaffolding gs,
GtkAccelGroup *  group,
bool  showmenu,
bool  showtool 
)
static

Create and connect handlers to bar menu.

Parameters
gsscaffolding to attach popup menu to.
groupThe accelerator group to use for the popup.
showmenuif the bar menu should be shown
showtoolif the toolabar should be shown
Returns
menu structure on success or NULL on error.

Definition at line 837 of file scaffolding.c.

References nsgtk_bar_submenu::bar_menu, nsgtk_scaffolding::builder, nsgtk_edit_menu::edit, nsgtk_bar_submenu::edit_submenu, nsgtk_toolbars_submenu::menubar_menuitem, nsgtk_menu_bar_create(), nsgtk_on_menubar_activate_menu(), nsgtk_on_toolbar_activate_menu(), nsgtk_window_edit_menu_hidden(), nsgtk_window_edit_menu_shown(), nsgtk_toolbars_submenu::toolbar_menuitem, nsgtk_view_menu::toolbars_submenu, and nsgtk_bar_submenu::view_submenu.

Referenced by nsgtk_menus_create().

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

◆ create_scaffolding_burger_menu()

static struct nsgtk_burger_menu * create_scaffolding_burger_menu ( struct nsgtk_scaffolding gs,
GtkAccelGroup *  group,
bool  showbar,
bool  showtool 
)
static

Create and connect handlers to burger menu.

Parameters
gscaffolding to attach popup menu to.
groupThe accelerator group to use for the popup.
showbarif the bar menu should be shown
showtoolif the toolabar should be shown
Returns
menu structure on success or NULL on error.

Definition at line 903 of file scaffolding.c.

References nsgtk_toolbars_submenu::menubar_menuitem, nsgtk_burger_menu_create(), nsgtk_on_menubar_activate_menu(), nsgtk_on_toolbar_activate_menu(), nsgtk_toolbars_submenu::toolbar_menuitem, nsgtk_view_menu::toolbars_submenu, and nsgtk_burger_menu::view_submenu.

Referenced by nsgtk_menus_create().

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

◆ create_scaffolding_link_menu()

static struct nsgtk_link_menu * create_scaffolding_link_menu ( struct nsgtk_scaffolding g,
GtkAccelGroup *  group 
)
static

Create and connect handlers to link popup menu.

Parameters
gscaffolding to attach popup menu to.
groupThe accelerator group to use for the popup.
Returns
true on success or false on error.

Definition at line 987 of file scaffolding.c.

References nsgtk_link_menu::bookmark_menuitem, nsgtk_link_menu::copy_menuitem, nsgtk_link_menu_create(), nsgtk_on_link_bookmark_activate_menu(), nsgtk_on_link_copy_activate_menu(), nsgtk_on_link_opentab_activate_menu(), nsgtk_on_link_openwin_activate_menu(), nsgtk_on_savelink_activate_menu(), nsgtk_link_menu::opentab_menuitem, nsgtk_link_menu::openwin_menuitem, and nsgtk_link_menu::save_menuitem.

Referenced by nsgtk_menus_create().

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

◆ create_scaffolding_popup_menu()

static struct nsgtk_popup_menu * create_scaffolding_popup_menu ( struct nsgtk_scaffolding gs,
GtkAccelGroup *  group,
bool  showbar,
bool  showtool 
)
static

Create and connect handlers to popup menu.

Parameters
gsscaffolding to attach popup menu to.
groupThe accelerator group to use for the popup.
showbarif the bar menu should be shown
showtoolif the toolabar should be shown
Returns
menu structure on success or NULL on error.

Definition at line 942 of file scaffolding.c.

References nsgtk_toolbars_submenu::menubar_menuitem, nsgtk_on_menubar_activate_menu(), nsgtk_on_toolbar_activate_menu(), nsgtk_popup_menu_create(), nsgtk_window_popup_menu_hidden(), nsgtk_popup_menu::popup_menu, popup_menu_hide(), nsgtk_toolbars_submenu::toolbar_menuitem, and nsgtk_popup_menu::toolbars_submenu.

Referenced by nsgtk_menus_create().

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

◆ get_bar_show()

static nserror get_bar_show ( bool *  menu,
bool *  tool 
)
static

Definition at line 615 of file scaffolding.c.

References NSERROR_OK, and nsoption_charp.

Referenced by nsgtk_menus_create(), and set_bar_show().

Here is the caller graph for this function:

◆ nsgtk_current_scaffolding()

struct nsgtk_scaffolding * nsgtk_current_scaffolding ( void  )

Obtain the most recently used scaffolding element.

This allows tabs to be opened in the most recently used window

Definition at line 1473 of file scaffolding.c.

References scaf_current, and scaf_list.

Referenced by gui_window_create(), nsgtk_local_history_present(), nsgtk_page_info(), and nsgtk_show_uri().

Here is the caller graph for this function:

◆ nsgtk_menu_connect_signals()

static void nsgtk_menu_connect_signals ( struct nsgtk_scaffolding g)
static

attach gtk signal handlers for menus

Definition at line 801 of file scaffolding.c.

References BACK_BUTTON, nsgtk_menu::burger, nsgtk_menu::main, nsgtk_scaffolding::menus, nsgtk_menu::mhandler, PLACEHOLDER_BUTTON, and nsgtk_menu::popup.

Referenced by nsgtk_menus_create().

Here is the caller graph for this function:

◆ nsgtk_menu_initialise()

static nserror nsgtk_menu_initialise ( struct nsgtk_scaffolding g)
static

initialiase the menu signal handlers ready for connection

Definition at line 1029 of file scaffolding.c.

References CUSTOMIZE_BUTTON, nsgtk_toolbars_submenu::customize_menuitem, ITEM_MB, ITEM_MBP, ITEM_MBp, nsgtk_scaffolding::menus, NSERROR_OK, nsgtk_menu::popup, nsgtk_scaffolding::popup_menu, reload, nsgtk_popup_menu::toolbars_submenu, and view.

Referenced by nsgtk_menus_create().

Here is the caller graph for this function:

◆ nsgtk_menu_set_icons()

static void nsgtk_menu_set_icons ( struct nsgtk_scaffolding g)
static

Definition at line 1163 of file scaffolding.c.

References BACK_BUTTON, nsgtk_menu::burger, nsgtk_menu::iconname, nsgtk_menu::main, nsgtk_scaffolding::menus, nsgtk_image_menu_item_set_image(), PLACEHOLDER_BUTTON, and nsgtk_menu::popup.

Referenced by nsgtk_menus_create().

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

◆ nsgtk_menu_set_sensitivity()

static void nsgtk_menu_set_sensitivity ( struct nsgtk_scaffolding g)
static

Definition at line 1139 of file scaffolding.c.

References BACK_BUTTON, nsgtk_menu::burger, nsgtk_menu::main, nsgtk_scaffolding::menus, PLACEHOLDER_BUTTON, nsgtk_menu::popup, and nsgtk_menu::sensitivity.

Referenced by nsgtk_menus_create().

Here is the caller graph for this function:

◆ nsgtk_menus_create()

static nserror nsgtk_menus_create ( struct nsgtk_scaffolding gs)
static

create and initialise menus

There are four menus held by the scaffolding:

  1. Main menubar menu. This can be hidden which causes the right click popup context menu to use the burger menu.
  2. Burger menu. This can be opened from a burger icon on the toolbar.
  3. popup context menu. This is opened by right mouse clicking on the toolbar or browser area
  4. link context menu Opened like the other popup menu when the mouse is over a link in the browser area

The cut, copy, paste, delete and back, forwards, stop, reload groups of menu entries are context sensitive and must be updated as appropriate when a menu is opened which contains those groups.

Definition at line 1211 of file scaffolding.c.

References nsgtk_scaffolding::burger_menu, create_scaffolding_bar_menu(), create_scaffolding_burger_menu(), create_scaffolding_link_menu(), create_scaffolding_popup_menu(), get_bar_show(), nsgtk_scaffolding::link_menu, nsgtk_scaffolding::menu_bar, NSERROR_OK, nsgtk_menu_connect_signals(), nsgtk_menu_initialise(), nsgtk_menu_set_icons(), nsgtk_menu_set_sensitivity(), nsgtk_scaffolding::popup_menu, and nsgtk_scaffolding::window.

Referenced by nsgtk_new_scaffolding().

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

◆ nsgtk_new_scaffolding()

struct nsgtk_scaffolding * nsgtk_new_scaffolding ( struct gui_window gw)

create a new scaffolding for a window.

Parameters
gwThe gui window to create the new scaffold around.
Returns
The newly constructed scaffold or NULL on error.

set this window's size and position to what's in the options, or some sensible default if they are not set yet.

Definition at line 1496 of file scaffolding.c.

References nsgtk_scaffolding::builder, nsgtk_scaffolding::next, nsgtk_scaffolding::notebook, NSERROR_OK, nsgtk_builder_new_from_resname(), nsgtk_menus_create(), nsgtk_notebook_create(), nsgtk_window_tabs_add(), nsgtk_window_tabs_remove(), NSLOG, nsoption_int, nsgtk_scaffolding::prev, scaf_list, scaffolding_window_delete_event(), scaffolding_window_destroy(), nsgtk_scaffolding::tabs_remove_handler_id, nsgtk_scaffolding::top_level, and nsgtk_scaffolding::window.

Referenced by gui_window_create().

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

◆ nsgtk_on_closetab_activate_menu()

static gboolean nsgtk_on_closetab_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

menu signal handler for activation on close tab item

Definition at line 787 of file scaffolding.c.

References nsgtk_scaffolding::notebook, and nsgtk_tab_close_current().

Here is the call graph for this function:

◆ nsgtk_on_find_activate_menu()

static gboolean nsgtk_on_find_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Definition at line 606 of file scaffolding.c.

References nsgtk_window_search_toggle(), and nsgtk_scaffolding::top_level.

Here is the call graph for this function:

◆ nsgtk_on_link_bookmark_activate_menu()

static gboolean nsgtk_on_link_bookmark_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Handler for bookmarking a link.

attached to the popup menu.

Definition at line 576 of file scaffolding.c.

References current_menu_features, hotlist_add_url(), and browser_window_features::link.

Referenced by create_scaffolding_link_menu().

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

◆ nsgtk_on_link_copy_activate_menu()

static gboolean nsgtk_on_link_copy_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Handler for copying a link.

attached to the popup menu.

Definition at line 591 of file scaffolding.c.

References clipboard, current_menu_features, browser_window_features::link, and nsurl_access().

Referenced by create_scaffolding_link_menu().

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

◆ nsgtk_on_link_opentab_activate_menu()

static gboolean nsgtk_on_link_opentab_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Handler for opening new tab from a link.

attached to the popup menu.

Definition at line 550 of file scaffolding.c.

References browser_window_create(), browser_window::bw, BW_CREATE_CLONE, BW_CREATE_HISTORY, BW_CREATE_TAB, current_menu_features, gui_window::gui, browser_window_features::link, messages_get_errorcode(), NSERROR_OK, nsgtk_get_browser_window(), nsgtk_warning(), and nsgtk_scaffolding::top_level.

Referenced by create_scaffolding_link_menu().

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

◆ nsgtk_on_link_openwin_activate_menu()

static gboolean nsgtk_on_link_openwin_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Handler for opening new window from a link.

attached to the popup menu.

Definition at line 526 of file scaffolding.c.

References browser_window_create(), browser_window::bw, BW_CREATE_CLONE, BW_CREATE_HISTORY, current_menu_features, gui_window::gui, browser_window_features::link, messages_get_errorcode(), NSERROR_OK, nsgtk_get_browser_window(), nsgtk_warning(), and nsgtk_scaffolding::top_level.

Referenced by create_scaffolding_link_menu().

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

◆ nsgtk_on_menubar_activate_menu()

static gboolean nsgtk_on_menubar_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Definition at line 666 of file scaffolding.c.

References nsgtk_bar_submenu::bar_menu, nsgtk_scaffolding::burger_menu, nsgtk_scaffolding::menu_bar, nsgtk_toolbars_submenu::menubar_menuitem, nsgtk_scaffolding::popup_menu, set_bar_show(), nsgtk_view_menu::toolbars_submenu, nsgtk_popup_menu::toolbars_submenu, nsgtk_bar_submenu::view_submenu, and nsgtk_burger_menu::view_submenu.

Referenced by create_scaffolding_bar_menu(), create_scaffolding_burger_menu(), and create_scaffolding_popup_menu().

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

◆ nsgtk_on_nexttab_activate_menu()

static gboolean nsgtk_on_nexttab_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Definition at line 762 of file scaffolding.c.

References nsgtk_scaffolding::notebook, and nsgtk_tab_next().

Here is the call graph for this function:

◆ nsgtk_on_prevtab_activate_menu()

static gboolean nsgtk_on_prevtab_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Definition at line 773 of file scaffolding.c.

References nsgtk_scaffolding::notebook, and nsgtk_tab_prev().

Here is the call graph for this function:

◆ nsgtk_on_savelink_activate_menu()

static gboolean nsgtk_on_savelink_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Definition at line 497 of file scaffolding.c.

References browser_window_navigate(), browser_window::bw, BW_NAVIGATE_DOWNLOAD, current_menu_features, gui_window::gui, browser_window_features::link, messages_get_errorcode(), NSERROR_OK, nsgtk_get_browser_window(), nsgtk_warning(), and nsgtk_scaffolding::top_level.

Referenced by create_scaffolding_link_menu().

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

◆ nsgtk_on_toolbar_activate_menu()

static gboolean nsgtk_on_toolbar_activate_menu ( GtkMenuItem *  widget,
gpointer  data 
)
static

Definition at line 714 of file scaffolding.c.

References nsgtk_scaffolding::burger_menu, nsgtk_scaffolding::menu_bar, nsgtk_window_toolbar_show(), nsgtk_scaffolding::popup_menu, set_bar_show(), nsgtk_toolbars_submenu::toolbar_menuitem, nsgtk_view_menu::toolbars_submenu, nsgtk_popup_menu::toolbars_submenu, nsgtk_bar_submenu::view_submenu, and nsgtk_burger_menu::view_submenu.

Referenced by create_scaffolding_bar_menu(), create_scaffolding_burger_menu(), and create_scaffolding_popup_menu().

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

◆ nsgtk_scaffolding_burger_menu()

nserror nsgtk_scaffolding_burger_menu ( struct nsgtk_scaffolding gs)

open the burger menu

Definition at line 1419 of file scaffolding.c.

References nsgtk_burger_menu::burger_menu, nsgtk_scaffolding::burger_menu, NSERROR_OK, and nsgtk_menu_popup_at_pointer().

Referenced by openmenu_button_clicked_cb().

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

◆ nsgtk_scaffolding_context_menu()

void nsgtk_scaffolding_context_menu ( struct nsgtk_scaffolding g,
gdouble  x,
gdouble  y 
)

Open a context sensitive menu.

Parameters
gthe scaffolding containing the browser window.
xThe x co-ordinate.
yThe y co-ordinate.

Definition at line 1429 of file scaffolding.c.

References browser_window_get_features(), browser_window::bw, COPY_BUTTON, nsgtk_popup_menu::copy_menuitem, current_menu_features, CUT_BUTTON, nsgtk_popup_menu::cut_menuitem, browser_window_features::link, nsgtk_link_menu::link_menu, nsgtk_scaffolding::link_menu, nsgtk_scaffolding::menus, nsgtk_get_browser_window(), nsgtk_menu_popup_at_pointer(), nsgtk_scaffolding_update_edit_actions_sensitivity(), PASTE_BUTTON, nsgtk_popup_menu::paste_menuitem, nsgtk_popup_menu::popup_menu, nsgtk_scaffolding::popup_menu, nsgtk_menu::sensitivity, nsgtk_scaffolding::top_level, browser_window::x, and browser_window::y.

Referenced by nsgtk_window_button_press_event().

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

◆ nsgtk_scaffolding_destroy_all()

nserror nsgtk_scaffolding_destroy_all ( void  )

causes all scaffolding windows to be destroyed.

Returns
NSERROR_OK and all scaffolding windows destroyed else NSERROR_INVALID if download in progress and user continued.

Definition at line 1288 of file scaffolding.c.

References nsgtk_scaffolding::next, NSERROR_INVALID, NSERROR_OK, nsgtk_check_for_downloads(), scaf_list, and nsgtk_scaffolding::window.

Referenced by quit_button_clicked_cb().

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

◆ nsgtk_scaffolding_enable_edit_actions_sensitivity()

static void nsgtk_scaffolding_enable_edit_actions_sensitivity ( struct nsgtk_scaffolding g)
static

make edit actions sensitive

Todo:
toolbar sensitivity
Parameters
gThe scaffolding context.

Definition at line 331 of file scaffolding.c.

References COPY_BUTTON, CUT_BUTTON, nsgtk_scaffolding::menus, nsgtk_scaffolding_set_sensitivity(), PASTE_BUTTON, nsgtk_scaffolding::popup_menu, popup_menu_show(), and nsgtk_menu::sensitivity.

Referenced by nsgtk_window_edit_menu_hidden(), and nsgtk_window_popup_menu_hidden().

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

◆ nsgtk_scaffolding_from_notebook()

struct nsgtk_scaffolding * nsgtk_scaffolding_from_notebook ( GtkNotebook *  notebook)

find which scaffolding contains a gtk notebook

Parameters
notebookThe notebook to search for.
Returns
The scaffolding containing the notebook or NULL if not found

Definition at line 1482 of file scaffolding.c.

References nsgtk_scaffolding::next, nsgtk_scaffolding::notebook, and scaf_list.

Referenced by nsgtk_tab_switch_page_after().

Here is the caller graph for this function:

◆ nsgtk_scaffolding_iterate()

struct nsgtk_scaffolding * nsgtk_scaffolding_iterate ( struct nsgtk_scaffolding g)

Iterate through available scaffolding.

Definition at line 1332 of file scaffolding.c.

References nsgtk_scaffolding::next, and scaf_list.

◆ nsgtk_scaffolding_menu_bar()

GtkMenuBar * nsgtk_scaffolding_menu_bar ( struct nsgtk_scaffolding gs)

Definition at line 1323 of file scaffolding.c.

References nsgtk_bar_submenu::bar_menu, and nsgtk_scaffolding::menu_bar.

Referenced by nsgtk_tab_switch_page_after().

Here is the caller graph for this function:

◆ nsgtk_scaffolding_notebook()

GtkNotebook * nsgtk_scaffolding_notebook ( struct nsgtk_scaffolding g)

Get the gtk notebook from a scaffold.

Definition at line 1316 of file scaffolding.c.

References nsgtk_scaffolding::notebook.

Referenced by nsgtk_tab_add(), and nsgtk_window_update_all().

Here is the caller graph for this function:

◆ nsgtk_scaffolding_position_local_history()

nserror nsgtk_scaffolding_position_local_history ( struct nsgtk_scaffolding gs)

Position the local-history popup in the right place.

Parameters
gsThe scaffolding to position relative to

Definition at line 1600 of file scaffolding.c.

References nsgtk_window_position_local_history(), and nsgtk_scaffolding::top_level.

Referenced by nsgtk_local_history_present().

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

◆ nsgtk_scaffolding_position_page_info()

nserror nsgtk_scaffolding_position_page_info ( struct nsgtk_scaffolding gs,
struct nsgtk_pi_window win 
)

Position the page-info popup in the right place.

Parameters
gsThe scaffolding to position relative to
winThe page-info window to position

Definition at line 1593 of file scaffolding.c.

References nsgtk_window_position_page_info(), and nsgtk_scaffolding::top_level.

Referenced by nsgtk_page_info().

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

◆ nsgtk_scaffolding_set_sensitivity()

void nsgtk_scaffolding_set_sensitivity ( struct nsgtk_scaffolding g)

update the sensitivity of context sensitive UI elements

widgets altered in arrays: main right click menu location popup current arrays are: stop reload cut copy paste back forward nexttab prevtab closetab

Definition at line 1376 of file scaffolding.c.

References SENSITIVITY.

Referenced by nsgtk_scaffolding_enable_edit_actions_sensitivity(), nsgtk_scaffolding_update_edit_actions_sensitivity(), nsgtk_window_tabs_add(), nsgtk_window_tabs_remove(), and scaffolding_update_context().

Here is the caller graph for this function:

◆ nsgtk_scaffolding_set_title()

void nsgtk_scaffolding_set_title ( struct gui_window gw,
const char *  title 
)

set the title in the window

Parameters
gwThe gui window to set title on
titleThe title to set which may be NULL

Definition at line 1239 of file scaffolding.c.

References nsgtk_get_scaffold(), SLEN, nsgtk_scaffolding::top_level, and nsgtk_scaffolding::window.

Referenced by gui_window_set_title(), and nsgtk_scaffolding_set_top_level().

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

◆ nsgtk_scaffolding_set_top_level()

void nsgtk_scaffolding_set_top_level ( struct gui_window gw)

Set the current active top level gui window.

Definition at line 1349 of file scaffolding.c.

References browser_window_get_title(), browser_window::bw, nsgtk_get_browser_window(), nsgtk_get_scaffold(), nsgtk_scaffolding_set_title(), scaf_current, scaffolding_update_context(), and nsgtk_scaffolding::top_level.

Referenced by nsgtk_tab_switch_page_after().

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

◆ nsgtk_scaffolding_throbber()

nserror nsgtk_scaffolding_throbber ( struct gui_window gw,
bool  active 
)

Update scaffolding window when throbber state changes.

Definition at line 1271 of file scaffolding.c.

References nsgtk_scaffolding::menus, NSERROR_OK, nsgtk_get_scaffold(), RELOAD_BUTTON, scaffolding_update_context(), nsgtk_menu::sensitivity, and STOP_BUTTON.

Referenced by throbber().

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

◆ nsgtk_scaffolding_toolbar_context_menu()

nserror nsgtk_scaffolding_toolbar_context_menu ( struct nsgtk_scaffolding gs)

open the toolbar context menu

Definition at line 1407 of file scaffolding.c.

References NSERROR_OK, nsgtk_menu_popup_at_pointer(), nsgtk_popup_menu::popup_menu, nsgtk_scaffolding::popup_menu, and popup_menu_hide().

Referenced by toolbar_popup_context_menu_cb().

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

◆ nsgtk_scaffolding_top_level()

struct gui_window * nsgtk_scaffolding_top_level ( struct nsgtk_scaffolding g)

Definition at line 1342 of file scaffolding.c.

References nsgtk_scaffolding::top_level.

◆ nsgtk_scaffolding_update_edit_actions_sensitivity()

static guint nsgtk_scaffolding_update_edit_actions_sensitivity ( struct nsgtk_scaffolding g)
static

edit the sensitivity of focused widget

Todo:
this needs to update toolbar sensitivity
Parameters
gThe scaffolding context.

Definition at line 290 of file scaffolding.c.

References browser_window_get_editor_flags(), browser_window::bw, BW_EDITOR_CAN_COPY, BW_EDITOR_CAN_CUT, BW_EDITOR_CAN_PASTE, COPY_BUTTON, CUT_BUTTON, nsgtk_scaffolding::menus, nsgtk_get_browser_window(), nsgtk_scaffolding_set_sensitivity(), PASTE_BUTTON, nsgtk_menu::sensitivity, nsgtk_scaffolding::top_level, and nsgtk_scaffolding::window.

Referenced by nsgtk_scaffolding_context_menu(), and nsgtk_window_edit_menu_shown().

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

◆ nsgtk_scaffolding_window()

GtkWindow * nsgtk_scaffolding_window ( struct nsgtk_scaffolding g)

Get the gtk window for a scaffolding.

Definition at line 1310 of file scaffolding.c.

References nsgtk_scaffolding::window.

Referenced by gui_download_window_create(), gui_window_file_gadget_open(), nsgtk_page_info(), and nsgtk_show_uri().

Here is the caller graph for this function:

◆ nsgtk_window_edit_menu_hidden()

static gboolean nsgtk_window_edit_menu_hidden ( GtkWidget *  widget,
struct nsgtk_scaffolding g 
)
static

gtk event handler for edit menu being hidden

Parameters
widgetThe menu widget
gscaffolding handle
Returns
TRUE to indicate event handled

Definition at line 367 of file scaffolding.c.

References nsgtk_scaffolding_enable_edit_actions_sensitivity().

Referenced by create_scaffolding_bar_menu().

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

◆ nsgtk_window_edit_menu_shown()

static gboolean nsgtk_window_edit_menu_shown ( GtkWidget *  widget,
struct nsgtk_scaffolding g 
)
static

gtk event for edit menu being show

Parameters
widgetThe menu widget
gscaffolding handle
Returns
TRUE to indicate event handled

Definition at line 351 of file scaffolding.c.

References nsgtk_scaffolding_update_edit_actions_sensitivity().

Referenced by create_scaffolding_bar_menu().

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

◆ nsgtk_window_popup_menu_hidden()

static gboolean nsgtk_window_popup_menu_hidden ( GtkWidget *  widget,
struct nsgtk_scaffolding g 
)
static

gtk event handler for popup menu being hidden.

Parameters
widgetThe menu widget
gscaffolding handle
Returns
TRUE to indicate event handled

Definition at line 384 of file scaffolding.c.

References nsgtk_scaffolding_enable_edit_actions_sensitivity().

Referenced by create_scaffolding_popup_menu().

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

◆ nsgtk_window_tabs_add()

static void nsgtk_window_tabs_add ( GtkNotebook *  notebook,
GtkWidget *  page,
guint  page_num,
struct nsgtk_scaffolding g 
)
static

Update the menus when the number of tabs changes.

Todo:

toolbar sensitivity

next/previous tab ought to only be visible if there is such a tab

Parameters
notebookThe notebook all the tabs are in
pageThe newly added page container widget
page_numThe index of the newly added page
gThe scaffolding context containing the notebook

Definition at line 403 of file scaffolding.c.

References nsgtk_scaffolding::burger_menu, CLOSETAB_BUTTON, nsgtk_scaffolding::menu_bar, nsgtk_scaffolding::menus, NEXTTAB_BUTTON, nsgtk_scaffolding::notebook, nsgtk_scaffolding_set_sensitivity(), PREVTAB_BUTTON, nsgtk_menu::sensitivity, nsgtk_view_menu::tabs_menuitem, nsgtk_bar_submenu::view_submenu, and nsgtk_burger_menu::view_submenu.

Referenced by nsgtk_new_scaffolding().

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

◆ nsgtk_window_tabs_remove()

static void nsgtk_window_tabs_remove ( GtkNotebook *  notebook,
GtkWidget *  page,
guint  page_num,
struct nsgtk_scaffolding gs 
)
static

Update the menus when the number of tabs changes.

Todo:
toolbar sensitivity
Parameters
notebookThe notebook all the tabs are in
pageThe page container widget being removed
page_numThe index of the removed page
gsThe scaffolding context containing the notebook

Definition at line 437 of file scaffolding.c.

References nsgtk_scaffolding::burger_menu, CLOSETAB_BUTTON, gtk_widget_in_destruction, nsgtk_scaffolding::menu_bar, nsgtk_scaffolding::menus, NEXTTAB_BUTTON, nsgtk_scaffolding::notebook, nsgtk_scaffolding_set_sensitivity(), PREVTAB_BUTTON, nsgtk_menu::sensitivity, nsgtk_view_menu::tabs_menuitem, nsgtk_bar_submenu::view_submenu, nsgtk_burger_menu::view_submenu, and nsgtk_scaffolding::window.

Referenced by nsgtk_new_scaffolding().

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

◆ popup_menu_hide()

static void popup_menu_hide ( struct nsgtk_popup_menu menu,
bool  nav,
bool  cnp 
)
static

Helper to hide popup menu entries by grouping.

Parameters
menuThe popup menu to modify.
navflag to indicate if navigation entries should be hidden.
cnpflag to indicate if cut and paste entries should be hidden.
customflag to indicate if menu customisation is hidden.

Definition at line 125 of file scaffolding.c.

References nsgtk_popup_menu::back_menuitem, nsgtk_popup_menu::copy_menuitem, nsgtk_popup_menu::cut_menuitem, nsgtk_popup_menu::first_separator, nsgtk_popup_menu::forward_menuitem, nsgtk_popup_menu::paste_menuitem, nsgtk_popup_menu::reload_menuitem, nsgtk_popup_menu::second_separator, and nsgtk_popup_menu::stop_menuitem.

Referenced by create_scaffolding_popup_menu(), and nsgtk_scaffolding_toolbar_context_menu().

Here is the caller graph for this function:

◆ popup_menu_show()

static void popup_menu_show ( struct nsgtk_popup_menu menu,
bool  nav,
bool  cnp 
)
static

Helper to show popup menu entries by grouping.

Parameters
menuThe popup menu to modify.
navflag to indicate if navigation entries should be visible.
cnpflag to indicate if cut and paste entries should be visible.
customflag to indicate if menu customisation is visible.

Definition at line 157 of file scaffolding.c.

References nsgtk_popup_menu::back_menuitem, nsgtk_popup_menu::copy_menuitem, nsgtk_popup_menu::cut_menuitem, nsgtk_popup_menu::first_separator, nsgtk_popup_menu::forward_menuitem, nsgtk_popup_menu::paste_menuitem, nsgtk_popup_menu::reload_menuitem, nsgtk_popup_menu::second_separator, and nsgtk_popup_menu::stop_menuitem.

Referenced by nsgtk_scaffolding_enable_edit_actions_sensitivity().

Here is the caller graph for this function:

◆ scaffolding_update_context()

static void scaffolding_update_context ( struct nsgtk_scaffolding g)
static

Update the scaffolding controls.

The button sensitivity, url bar and local history visibility are updated

Parameters
gThe scaffolding context to update

Definition at line 267 of file scaffolding.c.

References BACK_BUTTON, browser_window_history_back_available(), browser_window_history_forward_available(), browser_window::bw, FORWARD_BUTTON, nsgtk_scaffolding::menus, nsgtk_get_browser_window(), nsgtk_local_history_hide(), nsgtk_scaffolding_set_sensitivity(), nsgtk_menu::sensitivity, and nsgtk_scaffolding::top_level.

Referenced by nsgtk_scaffolding_set_top_level(), and nsgtk_scaffolding_throbber().

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

◆ scaffolding_window_delete_event()

static gboolean scaffolding_window_delete_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)
static

gtk event callback on window delete event.

prevent window close if download is in progress

Parameters
widgetThe widget receiving the delete event
eventThe event
dataThe context pointer passed when the connection was made.
Returns
TRUE to indicate message handled.

Definition at line 247 of file scaffolding.c.

References nsgtk_check_for_downloads(), and nsgtk_scaffolding::window.

Referenced by nsgtk_new_scaffolding().

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

◆ scaffolding_window_destroy()

static void scaffolding_window_destroy ( GtkWidget *  widget,
gpointer  data 
)
static

resource cleanup function for window destruction.

gtk event called when window is being destroyed. Need to free any resources associated with this scaffold,

Parameters
widgetthe widget being destroyed
dataThe context pointer passed when the connection was made.

Definition at line 188 of file scaffolding.c.

References nsgtk_scaffolding::burger_menu, nsgtk_scaffolding::link_menu, nsgtk_scaffolding::menu_bar, nsgtk_scaffolding::next, nsgtk_scaffolding::notebook, nsgtk_burger_menu_destroy(), nsgtk_complete, nsgtk_link_menu_destroy(), nsgtk_local_history_hide(), nsgtk_menu_bar_destroy(), nsgtk_popup_menu_destroy(), NSLOG, nsgtk_scaffolding::popup_menu, nsgtk_scaffolding::prev, scaf_current, scaf_list, and nsgtk_scaffolding::tabs_remove_handler_id.

Referenced by nsgtk_new_scaffolding().

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

◆ set_bar_show()

static nserror set_bar_show ( const char *  bar,
bool  show 
)
static

Definition at line 637 of file scaffolding.c.

References get_bar_show(), NSERROR_OK, and nsoption_set_charp.

Referenced by nsgtk_on_menubar_activate_menu(), and nsgtk_on_toolbar_activate_menu().

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

Variable Documentation

◆ current_menu_features

struct browser_window_features current_menu_features
static

◆ scaf_current

struct nsgtk_scaffolding* scaf_current
static

current scaffold for model dialogue use

Definition at line 102 of file scaffolding.c.

Referenced by nsgtk_current_scaffolding(), nsgtk_scaffolding_set_top_level(), and scaffolding_window_destroy().

◆ scaf_list

struct nsgtk_scaffolding* scaf_list = NULL
static