EphyWebView

EphyWebView — Epiphany custom WebkitWebView

Synopsis

struct              EphyWebView;
enum                EphyWebViewChrome;
struct              EphyWebViewClass;
enum                EphyWebViewDocumentType;
enum                EphyWebViewNavigationFlags;
                    EphyWebViewPrivate;
enum                EphyWebViewSecurityLevel;
void                ephy_web_view_copy_back_history     (EphyWebView *source,
                                                         EphyWebView *dest);
const char *        ephy_web_view_get_address           (EphyWebView *view);
EphyWebViewDocumentType ephy_web_view_get_document_type (EphyWebView *view);
GdkPixbuf *         ephy_web_view_get_icon              (EphyWebView *view);
gboolean            ephy_web_view_get_is_blank          (EphyWebView *view);
const char *        ephy_web_view_get_link_message      (EphyWebView *view);
const char *        ephy_web_view_get_loading_title     (EphyWebView *view);
EphyWebViewNavigationFlags ephy_web_view_get_navigation_flags
                                                        (EphyWebView *view);
void                ephy_web_view_get_security_level    (EphyWebView *view,
                                                         EphyWebViewSecurityLevel *level,
                                                         GTlsCertificate **certificate,
                                                         GTlsCertificateFlags *errors);
const char *        ephy_web_view_get_status_message    (EphyWebView *view);
const char *        ephy_web_view_get_title             (EphyWebView *view);
const char *        ephy_web_view_get_title_composite   (EphyWebView *view);
const char *        ephy_web_view_get_typed_address     (EphyWebView *view);
gboolean            ephy_web_view_get_visibility        (EphyWebView *view);
gboolean            ephy_web_view_has_modified_forms    (EphyWebView *view);
gboolean            ephy_web_view_is_loading            (EphyWebView *view);
gboolean            ephy_web_view_load_failed           (EphyWebView *view);
void                ephy_web_view_load_request          (EphyWebView *view);
void                ephy_web_view_load_url              (EphyWebView *view,
                                                         const char *url);
GtkWidget *         ephy_web_view_new                   (void);
void                ephy_web_view_popups_manager_reset  (EphyWebView *view);
void                ephy_web_view_save                  (EphyWebView *view,
                                                         const char *uri);
void                ephy_web_view_set_link_message      (EphyWebView *view,
                                                         const char *link_message);
void                ephy_web_view_set_loading_title     (EphyWebView *view,
                                                         const char *title,
                                                         gboolean is_address);
void                ephy_web_view_set_security_level    (EphyWebView *view,
                                                         EphyWebViewSecurityLevel level);
void                ephy_web_view_set_typed_address     (EphyWebView *view,
                                                         const char *address);
void                ephy_web_view_set_visibility        (EphyWebView *view,
                                                         gboolean visibility);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkWidget
               +----GtkContainer
                     +----WebKitWebView
                           +----EphyWebView

Implemented Interfaces

EphyWebView implements AtkImplementorIface, GtkBuildable and GtkScrollable.

Properties

  "address"                  gchar*                : Read
  "document-type"            EphyWebViewDocumentType  : Read
  "embed-title"              gchar*                : Read
  "hidden-popup-count"       gint                  : Read
  "icon"                     GdkPixbuf*            : Read
  "is-blank"                 gboolean              : Read
  "link-message"             gchar*                : Read
  "navigation"               EphyWebViewNavigationFlags  : Read
  "popups-allowed"           gboolean              : Read / Write
  "security-level"           EphyWebViewSecurityLevel  : Read
  "status-message"           gchar*                : Read
  "typed-address"            gchar*                : Read / Write
  "visibility"               gboolean              : Read

Signals

  "content-blocked"                                : Run Last
  "ge-feed-link"                                   : Run First
  "ge-modal-alert"                                 : Run Last
  "ge-modal-alert-closed"                          : Run Last
  "ge-popup-blocked"                               : Run First
  "ge-search-link"                                 : Run First
  "loading-homepage"                               : Run First
  "new-document-now"                               : Run First
  "new-window"                                     : Run First
  "search-key-press"                               : Run Last

Description

EphyWebView wraps WebkitWebView implementing custom functionality on top of it.

Details

struct EphyWebView

struct EphyWebView;


enum EphyWebViewChrome

typedef enum {
  EPHY_WEB_VIEW_CHROME_TOOLBAR    = 1 << 0,
  EPHY_WEB_VIEW_CHROME_DOWNLOADS_BOX = 1 << 1
} EphyWebViewChrome;


struct EphyWebViewClass

struct EphyWebViewClass {
  WebKitWebViewClass parent_class;

  /* Signals */
  void   (* feed_link)          (EphyWebView *view,
                                 const char *type,
                                 const char *title,
                                 const char *address);
  void   (* search_link)        (EphyWebView *view,
                                 const char *type,
                                 const char *title,
                                 const char *address);
  void   (* popup_blocked)      (EphyWebView *view,
                                 const char *address,
                                 const char *target,
                                 const char *features);
  void   (* content_blocked)    (EphyWebView *view,
                                 const char *uri);
  gboolean (* modal_alert)      (EphyWebView *view);
  void   (* modal_alert_closed) (EphyWebView *view);
  void   (* new_window)         (EphyWebView *view,
                                 EphyWebView *new_view);
  gboolean (* search_key_press) (EphyWebView *view,
                                 GdkEventKey *event);
  void   (* new_document_now)   (EphyWebView *view,
                                 const char *uri);
  void   (* loading_homepage)   (EphyWebView *view);
};


enum EphyWebViewDocumentType

typedef enum {
  EPHY_WEB_VIEW_DOCUMENT_HTML,
  EPHY_WEB_VIEW_DOCUMENT_XML,
  EPHY_WEB_VIEW_DOCUMENT_IMAGE,
  EPHY_WEB_VIEW_DOCUMENT_OTHER
} EphyWebViewDocumentType;


enum EphyWebViewNavigationFlags

typedef enum {
  EPHY_WEB_VIEW_NAV_BACK    = 1 << 0,
  EPHY_WEB_VIEW_NAV_FORWARD = 1 << 1
} EphyWebViewNavigationFlags;


EphyWebViewPrivate

typedef struct _EphyWebViewPrivate EphyWebViewPrivate;


enum EphyWebViewSecurityLevel

typedef enum {
  EPHY_WEB_VIEW_STATE_IS_UNKNOWN,
  EPHY_WEB_VIEW_STATE_IS_INSECURE,
  EPHY_WEB_VIEW_STATE_IS_BROKEN,
  EPHY_WEB_VIEW_STATE_IS_SECURE_LOW,
  EPHY_WEB_VIEW_STATE_IS_SECURE_MED,
  EPHY_WEB_VIEW_STATE_IS_SECURE_HIGH
} EphyWebViewSecurityLevel;


ephy_web_view_copy_back_history ()

void                ephy_web_view_copy_back_history     (EphyWebView *source,
                                                         EphyWebView *dest);

Sets the back history (up to the current item) of source as the back history of dest.

Useful to keep the history when opening links in new tabs or windows.

source :

the EphyWebView from which to get the back history

dest :

the EphyWebView to copy the history to

ephy_web_view_get_address ()

const char *        ephy_web_view_get_address           (EphyWebView *view);

Returns the address of the currently loaded page.

view :

an EphyWebView

Returns :

view's address. Will never be NULL.

ephy_web_view_get_document_type ()

EphyWebViewDocumentType ephy_web_view_get_document_type (EphyWebView *view);

Returns the type of document loaded in the view

view :

an EphyWebView

Returns :

the EphyWebViewDocumentType

ephy_web_view_get_icon ()

GdkPixbuf *         ephy_web_view_get_icon              (EphyWebView *view);

Returns the view's site icon as a GdkPixbuf, or NULL if it is not available.

view :

an EphyWebView

Returns :

a the view's site icon. [transfer none]

ephy_web_view_get_is_blank ()

gboolean            ephy_web_view_get_is_blank          (EphyWebView *view);

Returns whether the view's address is "blank".

view :

an EphyWebView

Returns :

TRUE if the view's address is "blank"

ephy_web_view_get_link_message ()

const char *        ephy_web_view_get_link_message      (EphyWebView *view);

When the user is hovering the mouse over a hyperlink, returns the URL of the hyperlink.

view :

an EphyWebView

Returns :

the URL of the link over which the mouse is hovering

ephy_web_view_get_loading_title ()

const char *        ephy_web_view_get_loading_title     (EphyWebView *view);

Returns the loading title for view.

view :

an EphyWebView

Returns :

the provisional title of view while loading

ephy_web_view_get_navigation_flags ()

EphyWebViewNavigationFlags ephy_web_view_get_navigation_flags
                                                        (EphyWebView *view);

Returns view's navigation flags.

view :

an EphyWebView

Returns :

view's navigation flags

ephy_web_view_get_security_level ()

void                ephy_web_view_get_security_level    (EphyWebView *view,
                                                         EphyWebViewSecurityLevel *level,
                                                         GTlsCertificate **certificate,
                                                         GTlsCertificateFlags *errors);

Fetches the EphyWebViewSecurityLevel and a GTlsCertificate associated with view and a GTlsCertificateFlags showing what problems, if any, have been found with that certificate.

view :

an EphyWebView

level :

return value of security level. [out]

certificate :

return value of TLS certificate. [out][transfer none]

errors :

return value of TLS errors. [out]

ephy_web_view_get_status_message ()

const char *        ephy_web_view_get_status_message    (EphyWebView *view);

Returns the message displayed in view's EphyWindow's EphyStatusbar. If the user is hovering the mouse over a hyperlink, this function will return the same value as ephy_web_view_get_link_message(). Otherwise, it will return a network status message, or NULL.

The message returned has a limited lifetime, and so should be copied with g_strdup() if it must be stored.

view :

an EphyWebView

Returns :

The current statusbar message

ephy_web_view_get_title ()

const char *        ephy_web_view_get_title             (EphyWebView *view);

view :

an EphyWebView

Returns :

the title of the web page displayed in view

ephy_web_view_get_title_composite ()

const char *        ephy_web_view_get_title_composite   (EphyWebView *view);

Returns the title of the web page loaded in view.

This differs from ephy_web_view_get_title in that this function will return a special title while the page is still loading.

view :

an EphyView

Returns :

view's web page's title. Will never be NULL.

ephy_web_view_get_typed_address ()

const char *        ephy_web_view_get_typed_address     (EphyWebView *view);

Returns the text that the user introduced in the view's EphyWindow location entry, if any.

This is not guaranteed to be the same as view's location, available through ephy_web_view_get_address(). As the user types a new address into the location entry, ephy_web_view_get_typed_address()'s returned string will change. When the load starts, ephy_web_view_get_typed_address() will return NULL, and ephy_web_view_get_address() will return the new page being loaded. Note that the typed_address can be changed again while a load is in progress (in case the user starts to type again in the location entry); in that case ephy_web_view_get_typed_address() will be again non-NULL, and the contents of the entry will not be overwritten.

view :

an EphyWebView

Returns :

view's EphyWindow's location entry text when view is selected.

ephy_web_view_get_visibility ()

gboolean            ephy_web_view_get_visibility        (EphyWebView *view);

Returns whether the view's toplevel is visible or not. Used mostly for popup visibility management.

view :

an EphyWebView

Returns :

TRUE if view's "visibility" property is set

ephy_web_view_has_modified_forms ()

gboolean            ephy_web_view_has_modified_forms    (EphyWebView *view);

Returns TRUE if the user has modified <input> or <textarea> values in view's loaded document.

view :

an EphyWebView

Returns :

TRUE if view has user-modified forms

ephy_web_view_is_loading ()

gboolean            ephy_web_view_is_loading            (EphyWebView *view);

Returns whether the web page in view has finished loading. A web page is only finished loading after all images, styles, and other dependencies have been downloaded and rendered, or when the load has failed for some reason.

view :

an EphyWebView

Returns :

TRUE if the page is still loading, FALSE if complete

ephy_web_view_load_failed ()

gboolean            ephy_web_view_load_failed           (EphyWebView *view);

Returns whether the web page in view has failed to load.

view :

an EphyWebView

Returns :

TRUE if the page failed to load, FALSE if it's loading or load finished successfully

ephy_web_view_load_request ()

void                ephy_web_view_load_request          (EphyWebView *view);

Loads the given WebKitNetworkRequest in the given EphyWebView.

view :

the EphyWebView in which to load the request

ephy_web_view_load_url ()

void                ephy_web_view_load_url              (EphyWebView *view,
                                                         const char *url);

Loads url in view.

view :

an EphyWebView

url :

a URL

ephy_web_view_new ()

GtkWidget *         ephy_web_view_new                   (void);

Equivalent to g_object_new() but returns an GtkWidget so you don't have to cast it when dealing with most code.

Returns :

the newly created EphyWebView widget

ephy_web_view_popups_manager_reset ()

void                ephy_web_view_popups_manager_reset  (EphyWebView *view);

Resets the state of the popups manager in view.

view :

an EphyWebView

ephy_web_view_save ()

void                ephy_web_view_save                  (EphyWebView *view,
                                                         const char *uri);

Saves the currently loaded page of view to uri.

view :

an EphyWebView

uri :

location to store the saved page

ephy_web_view_set_link_message ()

void                ephy_web_view_set_link_message      (EphyWebView *view,
                                                         const char *link_message);

Sets the value of link-message property which tells the URL of the hovered link.

view :

an EphyWebView

link_message :

new value for link-message in view

ephy_web_view_set_loading_title ()

void                ephy_web_view_set_loading_title     (EphyWebView *view,
                                                         const char *title,
                                                         gboolean is_address);

Update view's loading title to title, if is_address is TRUE it will retrieve the title of the page at title.

view :

an EphyWebView

title :

new loading title for view

is_address :

TRUE if title is an address

ephy_web_view_set_security_level ()

void                ephy_web_view_set_security_level    (EphyWebView *view,
                                                         EphyWebViewSecurityLevel level);

Sets view's security-level property to level.

view :

an EphyWebView

level :

the new EphyWebViewSecurityLevel for view

ephy_web_view_set_typed_address ()

void                ephy_web_view_set_typed_address     (EphyWebView *view,
                                                         const char *address);

Sets the text that view's EphyWindow will display in its location toolbar entry when view is selected.

view :

an EphyWebView

address :

the new typed address, or NULL to clear it

ephy_web_view_set_visibility ()

void                ephy_web_view_set_visibility        (EphyWebView *view,
                                                         gboolean visibility);

Sets whether the view's toplevel is visible or not. See ephy_web_view_get_visibility().

view :

an EphyWebView

visibility :

value for the visibility property of view

Property Details

The "address" property

  "address"                  gchar*                : Read

View's current address.

Default value: ""


The "document-type" property

  "document-type"            EphyWebViewDocumentType  : Read

Document type determined for the view.

Default value: EPHY_WEB_VIEW_DOCUMENT_HTML


The "embed-title" property

  "embed-title"              gchar*                : Read

Title for this embed.

Default value: "Blank page"


The "hidden-popup-count" property

  "hidden-popup-count"       gint                  : Read

Number of hidden (blocked) popup windows.

Allowed values: >= 0

Default value: 0


The "icon" property

  "icon"                     GdkPixbuf*            : Read

View's favicon set by the loaded site.


The "is-blank" property

  "is-blank"                 gboolean              : Read

Whether the view is showing the blank address.

Default value: FALSE


The "link-message" property

  "link-message"             gchar*                : Read

???

Default value: NULL


The "navigation" property

  "navigation"               EphyWebViewNavigationFlags  : Read

View's navigation flags as EphyWebViewNavigationFlags.


The "popups-allowed" property

  "popups-allowed"           gboolean              : Read / Write

If popup windows from this view are to be displayed.

Default value: FALSE


The "security-level" property

  "security-level"           EphyWebViewSecurityLevel  : Read

One of EphyWebViewSecurityLevel, determining view's current security level.

Default value: EPHY_WEB_VIEW_STATE_IS_UNKNOWN


The "status-message" property

  "status-message"           gchar*                : Read

Statusbar message corresponding to this view.

Default value: NULL


The "typed-address" property

  "typed-address"            gchar*                : Read / Write

User typed address for the current view.

Default value: ""


The "visibility" property

  "visibility"               gboolean              : Read

The view's visibility.

Default value: FALSE

Signal Details

The "content-blocked" signal

void                user_function                      (EphyWebView *view,
                                                        gchar       *uri,
                                                        gpointer     user_data)      : Run Last

The ::content-blocked signal is emitted when an url has been blocked.

view :

the EphyWebView that received the signal

uri :

blocked URI

user_data :

user data set when the signal handler was connected.

The "ge-feed-link" signal

void                user_function                      (EphyWebView *view,
                                                        gchar       *type,
                                                        gchar       *title,
                                                        gchar       *address,
                                                        gpointer     user_data)      : Run First

The ::ge_rss signal is emitted when embed discovers that a news feed is available for the site it is visiting.

view :

the EphyWebView that received the signal

type :

the mime-type of the news feed

title :

the title of the news feed

address :

the URL to embed's web site's news feed

user_data :

user data set when the signal handler was connected.

The "ge-modal-alert" signal

gboolean            user_function                      (EphyWebView *view,
                                                        gpointer     user_data)      : Run Last

The ::ge-modal-alert signal is emitted when a DOM event will open a modal alert.

Return TRUE to prevent the dialog from being opened.

view :

the EphyWebView that received the signal

user_data :

user data set when the signal handler was connected.

The "ge-modal-alert-closed" signal

void                user_function                      (EphyWebView *view,
                                                        gpointer     user_data)      : Run Last

The ::ge-modal-alert-closed signal is emitted when a modal alert put up by a DOM event was closed.

view :

the EphyWebView that received the signal

user_data :

user data set when the signal handler was connected.

The "ge-popup-blocked" signal

void                user_function                      (EphyWebView *view,
                                                        gchar       *address,
                                                        gchar       *target,
                                                        gchar       *features,
                                                        gpointer     user_data)      : Run First

The ::ge_popup_blocked signal is emitted when the viewed web page requests a popup window (with javascript:open()) but popup windows are not allowed.

view :

the EphyWebView that received the signal

address :

The requested URL

target :

The requested window name, e.g. "_blank"

features :

The requested features: for example, "height=400,width=200"

user_data :

user data set when the signal handler was connected.

The "ge-search-link" signal

void                user_function                      (EphyWebView *view,
                                                        gchar       *type,
                                                        gchar       *title,
                                                        gchar       *address,
                                                        gpointer     user_data)      : Run First

The ::ge_rss signal is emitted when embed discovers that a search description is available for the site it is visiting.

view :

the EphyWebView that received the signal

type :

the mime-type of the search description

title :

the title of the news feed

address :

the URL to embed's web site's search description

user_data :

user data set when the signal handler was connected.

The "loading-homepage" signal

void                user_function                      (EphyWebView *view,
                                                        gpointer     user_data)      : Run First

The ::loading-homepage signal is emitted when the view is about to load the homepage set by the user.

view :

the EphyWebView that received the signal

user_data :

user data set when the signal handler was connected.

The "new-document-now" signal

void                user_function                      (EphyWebView *view,
                                                        gchar       *uri,
                                                        gpointer     user_data)      : Run First

The ::new-document-now signal is emitted when a new page content is being loaded into the browser. It's a good place to do view related changes, for example to restore the zoom level of a page or to set an user style sheet.

view :

the EphyWebView that received the signal

uri :

URI of the new content

user_data :

user data set when the signal handler was connected.

The "new-window" signal

void                user_function                      (EphyWebView *view,
                                                        GtkWidget   *new_view,
                                                        gpointer     user_data)      : Run First

The ::new-window signal is emitted after a new window has been opened by the view. For example, when a JavaScript popup window is opened.

view :

the EphyWebView that received the signal

new_view :

the newly opened EphyWebView

user_data :

user data set when the signal handler was connected.

The "search-key-press" signal

gboolean            user_function                      (EphyWebView *view,
                                                        GdkEvent    *event,
                                                        gpointer     user_data)      : Run Last

The ::search-key-press signal is emitted for keypresses which should be used for find implementations.

view :

the EphyWebView that received the signal

event :

the GdkEventKey which triggered this signal

user_data :

user data set when the signal handler was connected.