summaryrefslogtreecommitdiff
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-about-handler.c91
-rw-r--r--embed/ephy-download.c207
-rw-r--r--embed/ephy-downloads-manager.c5
-rw-r--r--embed/ephy-embed-container.c10
-rw-r--r--embed/ephy-embed-event.c17
-rw-r--r--embed/ephy-embed-prefs.c185
-rw-r--r--embed/ephy-embed-shell.c172
-rw-r--r--embed/ephy-embed-utils.c28
-rw-r--r--embed/ephy-embed.c135
-rw-r--r--embed/ephy-encoding.c122
-rw-r--r--embed/ephy-encodings.c193
-rw-r--r--embed/ephy-file-monitor.c40
-rw-r--r--embed/ephy-find-toolbar.c799
-rw-r--r--embed/ephy-web-extension-proxy.c106
-rw-r--r--embed/ephy-web-view.c520
-rw-r--r--embed/web-extension/ephy-embed-form-auth.c7
-rw-r--r--embed/web-extension/ephy-uri-tester.c649
-rw-r--r--embed/web-extension/ephy-web-dom-utils.c38
-rw-r--r--embed/web-extension/ephy-web-extension-main.c2
-rw-r--r--embed/web-extension/ephy-web-extension.c142
-rw-r--r--embed/web-extension/ephy-web-overview-model.c22
-rw-r--r--embed/web-extension/ephy-web-overview.c63
22 files changed, 1719 insertions, 1834 deletions
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index b64fcb015..791926e36 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -34,8 +34,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-struct _EphyAboutHandler
-{
+struct _EphyAboutHandler {
GObject parent_instance;
EphySMaps *smaps;
@@ -79,8 +78,8 @@ ephy_about_handler_get_smaps (EphyAboutHandler *handler)
static void
ephy_about_handler_finish_request (WebKitURISchemeRequest *request,
- gchar *data,
- gssize data_length)
+ gchar *data,
+ gssize data_length)
{
GInputStream *stream;
@@ -96,7 +95,7 @@ typedef struct {
} EphyAboutRequest;
static EphyAboutRequest *
-ephy_about_request_new (EphyAboutHandler *handler,
+ephy_about_request_new (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
EphyAboutRequest *about_request;
@@ -119,7 +118,7 @@ ephy_about_request_free (EphyAboutRequest *about_request)
static void
get_plugins_cb (WebKitWebContext *web_context,
- GAsyncResult *result,
+ GAsyncResult *result,
EphyAboutRequest *about_request)
{
GString *data_str;
@@ -132,7 +131,7 @@ get_plugins_cb (WebKitWebContext *web_context,
data_str = g_string_new ("<html>");
g_string_append_printf (data_str, "<head><title>%s</title>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
"</head><body>",
_("Installed plugins"));
g_string_append_printf (data_str, "<h1>%s</h1>", _("Plugins"));
@@ -157,7 +156,7 @@ get_plugins_cb (WebKitWebContext *web_context,
mime_types = webkit_plugin_get_mime_info_list (plugin);
for (m = mime_types; m; m = m->next) {
- WebKitMimeInfo *mime_info = (WebKitMimeInfo *) m->data;
+ WebKitMimeInfo *mime_info = (WebKitMimeInfo *)m->data;
const gchar * const *extensions;
guint i;
@@ -185,7 +184,7 @@ get_plugins_cb (WebKitWebContext *web_context,
}
static gboolean
-ephy_about_handler_handle_plugins (EphyAboutHandler *handler,
+ephy_about_handler_handle_plugins (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
@@ -199,8 +198,8 @@ ephy_about_handler_handle_plugins (EphyAboutHandler *handler,
}
static void
-handle_memory_finished_cb (EphyAboutHandler *handler,
- GAsyncResult *result,
+handle_memory_finished_cb (EphyAboutHandler *handler,
+ GAsyncResult *result,
WebKitURISchemeRequest *request)
{
GString *data_str;
@@ -213,7 +212,7 @@ handle_memory_finished_cb (EphyAboutHandler *handler,
if (memory) {
g_string_append_printf (data_str, "<head><title>%s</title>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
"</head><body>",
_("Memory usage"));
@@ -230,9 +229,9 @@ handle_memory_finished_cb (EphyAboutHandler *handler,
}
static void
-handle_memory_sync (GTask *task,
- gpointer source_object,
- gpointer task_data,
+handle_memory_sync (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
GCancellable *cancellable)
{
EphyAboutHandler *handler = EPHY_ABOUT_HANDLER (source_object);
@@ -243,7 +242,7 @@ handle_memory_sync (GTask *task,
}
static gboolean
-ephy_about_handler_handle_memory (EphyAboutHandler *handler,
+ephy_about_handler_handle_memory (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
GTask *task;
@@ -258,7 +257,7 @@ ephy_about_handler_handle_memory (EphyAboutHandler *handler,
}
static gboolean
-ephy_about_handler_handle_about (EphyAboutHandler *handler,
+ephy_about_handler_handle_about (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
char *data;
@@ -274,7 +273,7 @@ ephy_about_handler_handle_about (EphyAboutHandler *handler,
data = g_strdup_printf ("<html><head><title>%s</title>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
"</head><body>"
"<div class=\"dialog\">"
"<img src=\"file://%s\"/>"
@@ -301,14 +300,14 @@ ephy_about_handler_handle_about (EphyAboutHandler *handler,
}
static gboolean
-ephy_about_handler_handle_epiphany (EphyAboutHandler *handler,
+ephy_about_handler_handle_epiphany (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
char *data;
data = g_strdup_printf ("<html class=\"epiphany-html\"><head><title>%s</title>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
"</head><body class=\"epiphany-body\">"
"<div id=\"ephytext\">"
"“Il semble que la perfection soit atteinte non quand il n'y a plus rien à"
@@ -326,8 +325,8 @@ ephy_about_handler_handle_epiphany (EphyAboutHandler *handler,
}
static void
-handle_applications_finished_cb (EphyAboutHandler *handler,
- GAsyncResult *result,
+handle_applications_finished_cb (EphyAboutHandler *handler,
+ GAsyncResult *result,
WebKitURISchemeRequest *request)
{
GString *data_str;
@@ -337,7 +336,7 @@ handle_applications_finished_cb (EphyAboutHandler *handler,
data_str = g_string_new (NULL);
g_string_append_printf (data_str, "<html><head><title>%s</title>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">"
"<script>"
" function deleteWebApp(appID) {"
" window.webkit.messageHandlers.aboutApps.postMessage(appID);"
@@ -355,7 +354,7 @@ handle_applications_finished_cb (EphyAboutHandler *handler,
applications = g_task_propagate_pointer (G_TASK (result), NULL);
for (p = applications; p; p = p->next) {
- EphyWebApplication *app = (EphyWebApplication*)p->data;
+ EphyWebApplication *app = (EphyWebApplication *)p->data;
g_string_append_printf (data_str,
"<tbody><tr id =\"%s\">"
@@ -378,9 +377,9 @@ handle_applications_finished_cb (EphyAboutHandler *handler,
}
static void
-handle_applications_sync (GTask *task,
- gpointer source_object,
- gpointer task_data,
+handle_applications_sync (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
GCancellable *cancellable)
{
g_task_return_pointer (task,
@@ -389,7 +388,7 @@ handle_applications_sync (GTask *task,
}
static gboolean
-ephy_about_handler_handle_applications (EphyAboutHandler *handler,
+ephy_about_handler_handle_applications (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
GTask *task;
@@ -409,8 +408,8 @@ typedef struct {
} GetSnapshotPathAsyncData;
static void
-got_snapshot_path_for_url_cb (EphySnapshotService *service,
- GAsyncResult *result,
+got_snapshot_path_for_url_cb (EphySnapshotService *service,
+ GAsyncResult *result,
GetSnapshotPathAsyncData *data)
{
char *snapshot;
@@ -430,9 +429,9 @@ got_snapshot_path_for_url_cb (EphySnapshotService *service,
}
static void
-history_service_query_urls_cb (EphyHistoryService *history,
- gboolean success,
- GList *urls,
+history_service_query_urls_cb (EphyHistoryService *history,
+ gboolean success,
+ GList *urls,
WebKitURISchemeRequest *request)
{
EphySnapshotService *snapshot_service = ephy_snapshot_service_get_default ();
@@ -451,7 +450,7 @@ history_service_query_urls_cb (EphyHistoryService *history,
"<head>\n"
" <title>%s</title>\n"
" <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n"
- " <link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">\n"
+ " <link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">\n"
" <script>\n"
" document.onkeypress = function listenKeypress(event) {\n"
" // Remove from overview when Del is pressed\n"
@@ -499,9 +498,9 @@ history_service_query_urls_cb (EphyHistoryService *history,
}
g_string_append (data_str,
- "<div id=\"overview\">\n"
- " <div id=\"overview-grid\">\n"
- " <ul id=\"overview-item-list\">\n");
+ "<div id=\"overview\">\n"
+ " <div id=\"overview-grid\">\n"
+ " <ul id=\"overview-item-list\">\n");
for (l = urls; l; l = g_list_next (l)) {
EphyHistoryURL *url = (EphyHistoryURL *)l->data;
@@ -541,14 +540,14 @@ history_service_query_urls_cb (EphyHistoryService *history,
" </div>\n"
"</body></html>\n");
-out:
+ out:
data_length = data_str->len;
ephy_about_handler_finish_request (request, g_string_free (data_str, FALSE), data_length);
g_object_unref (request);
}
static gboolean
-ephy_about_handler_handle_html_overview (EphyAboutHandler *handler,
+ephy_about_handler_handle_html_overview (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
EphyHistoryService *history;
@@ -569,7 +568,7 @@ ephy_about_handler_handle_html_overview (EphyAboutHandler *handler,
}
static gboolean
-ephy_about_handler_handle_incognito (EphyAboutHandler *handler,
+ephy_about_handler_handle_incognito (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
char *data;
@@ -582,7 +581,7 @@ ephy_about_handler_handle_incognito (EphyAboutHandler *handler,
"<head>\n"
"<title>%s</title>\n"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
- "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS"\" rel=\"stylesheet\" type=\"text/css\">\n"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" type=\"text/css\">\n"
"</head>\n"
"<body class=\"incognito-body\">\n"
" <div id=\"mainblock\">\n"
@@ -604,7 +603,7 @@ ephy_about_handler_handle_incognito (EphyAboutHandler *handler,
"download will be kept."),
_("Incognito mode hides your activity only from people using this "
"computer."),
- _("It will not hide your activity from your employer if you are at "
+ _("It will not hide your activity from your employer if you are at "
"work. Your internet service provider, your government, other "
"governments, the websites that you visit, and advertisers on "
"these websites may still be tracking you."));
@@ -615,7 +614,7 @@ ephy_about_handler_handle_incognito (EphyAboutHandler *handler,
}
static void
-ephy_about_handler_handle_blank (EphyAboutHandler *handler,
+ephy_about_handler_handle_blank (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
ephy_about_handler_finish_request (request, g_strdup ("<html></html>"), -1);
@@ -628,11 +627,11 @@ ephy_about_handler_new (void)
}
void
-ephy_about_handler_handle_request (EphyAboutHandler *handler,
+ephy_about_handler_handle_request (EphyAboutHandler *handler,
WebKitURISchemeRequest *request)
{
const char *path;
- gboolean handled = FALSE;
+ gboolean handled = FALSE;
path = webkit_uri_scheme_request_get_path (request);
@@ -641,7 +640,7 @@ ephy_about_handler_handle_request (EphyAboutHandler *handler,
else if (!g_strcmp0 (path, "memory"))
handled = ephy_about_handler_handle_memory (handler, request);
else if (!g_strcmp0 (path, "epiphany"))
- handled = ephy_about_handler_handle_epiphany (handler, request);
+ handled = ephy_about_handler_handle_epiphany (handler, request);
else if (!g_strcmp0 (path, "applications"))
handled = ephy_about_handler_handle_applications (handler, request);
else if (!g_strcmp0 (path, "overview"))
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index cf88bfe2e..69d4e89ec 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -35,8 +35,7 @@
#include <glib/gi18n.h>
#include <string.h>
-struct _EphyDownload
-{
+struct _EphyDownload {
GObject parent_instance;
WebKitDownload *download;
@@ -52,8 +51,7 @@ struct _EphyDownload
G_DEFINE_TYPE (EphyDownload, ephy_download, G_TYPE_OBJECT)
-enum
-{
+enum {
PROP_0,
PROP_DOWNLOAD,
PROP_DESTINATION,
@@ -65,8 +63,7 @@ enum
static GParamSpec *obj_properties[LAST_PROP];
-enum
-{
+enum {
FILENAME_SUGGESTED,
ERROR,
COMPLETED,
@@ -176,11 +173,11 @@ decide_action_from_mime (EphyDownload *ephy_download)
}
/* From the old embed/mozilla/MozDownload.cpp */
-static const char*
+static const char *
file_is_compressed (const char *filename)
{
int i;
- static const char * const compression[] = {".gz", ".bz2", ".Z", ".lz", ".xz", NULL};
+ static const char * const compression[] = { ".gz", ".bz2", ".Z", ".lz", ".xz", NULL };
for (i = 0; compression[i] != NULL; i++) {
if (g_str_has_suffix (filename, compression[i]))
@@ -190,7 +187,7 @@ file_is_compressed (const char *filename)
return NULL;
}
-static const char*
+static const char *
parse_extension (const char *filename)
{
const char *compression;
@@ -201,7 +198,7 @@ parse_extension (const char *filename)
/* if the file is compressed we might have a double extension */
if (compression != NULL) {
int i;
- static const char * const extensions[] = {"tar", "ps", "xcf", "dvi", "txt", "text", NULL};
+ static const char * const extensions[] = { "tar", "ps", "xcf", "dvi", "txt", "text", NULL };
for (i = 0; extensions[i] != NULL; i++) {
char *suffix;
@@ -302,7 +299,7 @@ set_destination_uri_for_suggested_filename (EphyDownload *download, const char *
**/
void
ephy_download_set_destination_uri (EphyDownload *download,
- const char *destination)
+ const char *destination)
{
g_return_if_fail (EPHY_IS_DOWNLOAD (download));
g_return_if_fail (destination != NULL);
@@ -321,7 +318,7 @@ ephy_download_set_destination_uri (EphyDownload *download,
* files" is set.
**/
void
-ephy_download_set_action (EphyDownload *download,
+ephy_download_set_action (EphyDownload *download,
EphyDownloadActionType action)
{
g_return_if_fail (EPHY_IS_DOWNLOAD (download));
@@ -456,48 +453,48 @@ ephy_download_failed (EphyDownload *download,
*
**/
gboolean
-ephy_download_do_download_action (EphyDownload *download,
+ephy_download_do_download_action (EphyDownload *download,
EphyDownloadActionType action)
{
- GFile *destination;
- const char *destination_uri;
- gboolean ret = FALSE;
-
- destination_uri = webkit_download_get_destination (download->download);
- destination = g_file_new_for_uri (destination_uri);
-
- switch ((action ? action : download->action)) {
- case EPHY_DOWNLOAD_ACTION_AUTO:
- LOG ("ephy_download_do_download_action: auto");
- ret = ephy_download_do_download_action (download, decide_action_from_mime (download));
- break;
- case EPHY_DOWNLOAD_ACTION_BROWSE_TO:
- LOG ("ephy_download_do_download_action: browse_to");
+ GFile *destination;
+ const char *destination_uri;
+ gboolean ret = FALSE;
+
+ destination_uri = webkit_download_get_destination (download->download);
+ destination = g_file_new_for_uri (destination_uri);
+
+ switch ((action ? action : download->action)) {
+ case EPHY_DOWNLOAD_ACTION_AUTO:
+ LOG ("ephy_download_do_download_action: auto");
+ ret = ephy_download_do_download_action (download, decide_action_from_mime (download));
+ break;
+ case EPHY_DOWNLOAD_ACTION_BROWSE_TO:
+ LOG ("ephy_download_do_download_action: browse_to");
+ ret = ephy_file_browse_to (destination, download->start_time);
+ break;
+ case EPHY_DOWNLOAD_ACTION_OPEN:
+ LOG ("ephy_download_do_download_action: open");
+ ret = ephy_embed_shell_launch_handler (ephy_embed_shell_get_default (),
+ destination, NULL, download->start_time);
+ if (!ret)
ret = ephy_file_browse_to (destination, download->start_time);
- break;
- case EPHY_DOWNLOAD_ACTION_OPEN:
- LOG ("ephy_download_do_download_action: open");
- ret = ephy_embed_shell_launch_handler (ephy_embed_shell_get_default (),
- destination, NULL, download->start_time);
- if (!ret)
- ret = ephy_file_browse_to (destination, download->start_time);
- break;
- case EPHY_DOWNLOAD_ACTION_NONE:
- LOG ("ephy_download_do_download_action: none");
- ret = TRUE;
- break;
- case EPHY_DOWNLOAD_ACTION_DO_NOTHING:
- LOG ("ephy_download_do_download_action: nothing");
- ret = TRUE;
- break;
- default:
- LOG ("ephy_download_do_download_action: unhandled action");
- ret = FALSE;
- break;
- }
- g_object_unref (destination);
+ break;
+ case EPHY_DOWNLOAD_ACTION_NONE:
+ LOG ("ephy_download_do_download_action: none");
+ ret = TRUE;
+ break;
+ case EPHY_DOWNLOAD_ACTION_DO_NOTHING:
+ LOG ("ephy_download_do_download_action: nothing");
+ ret = TRUE;
+ break;
+ default:
+ LOG ("ephy_download_do_download_action: unhandled action");
+ ret = FALSE;
+ break;
+ }
+ g_object_unref (destination);
- return ret;
+ return ret;
}
static void
@@ -513,7 +510,7 @@ ephy_download_dispose (GObject *object)
download->download = NULL;
}
- g_clear_error(&download->error);
+ g_clear_error (&download->error);
g_clear_pointer (&download->content_type, g_free);
G_OBJECT_CLASS (ephy_download_parent_class)->dispose (object);
@@ -535,11 +532,11 @@ ephy_download_class_init (EphyDownloadClass *klass)
*/
obj_properties[PROP_DOWNLOAD] =
g_param_spec_object ("download",
- "Internal WebKitDownload",
- "The WebKitDownload used internally by EphyDownload",
- WEBKIT_TYPE_DOWNLOAD,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
+ "Internal WebKitDownload",
+ "The WebKitDownload used internally by EphyDownload",
+ WEBKIT_TYPE_DOWNLOAD,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* EphyDownload::destination:
@@ -548,11 +545,11 @@ ephy_download_class_init (EphyDownloadClass *klass)
*/
obj_properties[PROP_DESTINATION] =
g_param_spec_string ("destination",
- "Destination",
- "Destination file URI",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
+ "Destination",
+ "Destination file URI",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* EphyDownload::action:
@@ -563,12 +560,12 @@ ephy_download_class_init (EphyDownloadClass *klass)
*/
obj_properties[PROP_ACTION] =
g_param_spec_enum ("action",
- "Download action",
- "Action to take when download finishes",
- EPHY_TYPE_DOWNLOAD_ACTION_TYPE,
- EPHY_DOWNLOAD_ACTION_NONE,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
+ "Download action",
+ "Action to take when download finishes",
+ EPHY_TYPE_DOWNLOAD_ACTION_TYPE,
+ EPHY_DOWNLOAD_ACTION_NONE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* EphyDownload::start-time:
@@ -578,19 +575,19 @@ ephy_download_class_init (EphyDownloadClass *klass)
*/
obj_properties[PROP_START_TIME] =
g_param_spec_uint ("start-time",
- "Event start time",
- "Time for focus-stealing prevention.",
- 0, G_MAXUINT32, 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
+ "Event start time",
+ "Time for focus-stealing prevention.",
+ 0, G_MAXUINT32, 0,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
obj_properties[PROP_CONTENT_TYPE] =
g_param_spec_string ("content-type",
- "Content Type",
- "The download content type",
- NULL,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
+ "Content Type",
+ "The download content type",
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
@@ -601,13 +598,13 @@ ephy_download_class_init (EphyDownloadClass *klass)
* suggested filename from WebKit.
**/
signals[FILENAME_SUGGESTED] = g_signal_new ("filename-suggested",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE,
- 1,
- G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* EphyDownload::completed:
@@ -615,24 +612,24 @@ ephy_download_class_init (EphyDownloadClass *klass)
* The ::completed signal is emitted when @download has finished downloading.
**/
signals[COMPLETED] = g_signal_new ("completed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE,
- 0);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 0);
/**
* EphyDownload::error:
*
* The ::error signal wraps the @download ::error signal.
**/
signals[ERROR] = g_signal_new ("error",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE,
- 1, G_TYPE_POINTER);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 1, G_TYPE_POINTER);
}
static void
@@ -649,8 +646,8 @@ ephy_download_init (EphyDownload *download)
static void
download_response_changed_cb (WebKitDownload *wk_download,
- GParamSpec *spec,
- EphyDownload *download)
+ GParamSpec *spec,
+ EphyDownload *download)
{
WebKitURIResponse *response;
const char *mime_type;
@@ -667,8 +664,8 @@ download_response_changed_cb (WebKitDownload *wk_download,
static gboolean
download_decide_destination_cb (WebKitDownload *wk_download,
- const gchar *suggested_filename,
- EphyDownload *download)
+ const gchar *suggested_filename,
+ EphyDownload *download)
{
if (webkit_download_get_destination (wk_download))
return TRUE;
@@ -683,8 +680,8 @@ download_decide_destination_cb (WebKitDownload *wk_download,
static void
download_created_destination_cb (WebKitDownload *wk_download,
- const char *destination,
- EphyDownload *download)
+ const char *destination,
+ EphyDownload *download)
{
char *filename;
char *content_type;
@@ -727,7 +724,7 @@ download_created_destination_cb (WebKitDownload *wk_download,
static void
download_finished_cb (WebKitDownload *wk_download,
- EphyDownload *download)
+ EphyDownload *download)
{
download->finished = TRUE;
g_signal_emit (download, signals[COMPLETED], 0);
@@ -741,8 +738,8 @@ download_finished_cb (WebKitDownload *wk_download,
static void
download_failed_cb (WebKitDownload *wk_download,
- GError *error,
- EphyDownload *download)
+ GError *error,
+ EphyDownload *download)
{
g_signal_handlers_disconnect_by_func (wk_download, download_finished_cb, download);
diff --git a/embed/ephy-downloads-manager.c b/embed/ephy-downloads-manager.c
index 0ad8d463f..a2c13c4e5 100644
--- a/embed/ephy-downloads-manager.c
+++ b/embed/ephy-downloads-manager.c
@@ -33,8 +33,7 @@ enum {
LAST_SIGNAL
};
-struct _EphyDownloadsManager
-{
+struct _EphyDownloadsManager {
GObject parent_instance;
GList *downloads;
@@ -57,7 +56,7 @@ ephy_downloads_manager_acquire_session_inhibitor (EphyDownloadsManager *manager)
manager->inhibitor_cookie = gtk_application_inhibit (GTK_APPLICATION (ephy_embed_shell_get_default ()),
NULL,
GTK_APPLICATION_INHIBIT_LOGOUT | GTK_APPLICATION_INHIBIT_SUSPEND,
- "Downloading");
+ "Downloading");
if (manager->inhibitor_cookie == 0)
g_warning ("Failed to acquire session inhibitor for active download. Is gnome-session running?");
diff --git a/embed/ephy-embed-container.c b/embed/ephy-embed-container.c
index cb216496a..9ba5f718d 100644
--- a/embed/ephy-embed-container.c
+++ b/embed/ephy-embed-container.c
@@ -51,9 +51,9 @@ ephy_embed_container_default_init (EphyEmbedContainerInterface *iface)
**/
gint
ephy_embed_container_add_child (EphyEmbedContainer *container,
- EphyEmbed *child,
- gint position,
- gboolean set_active)
+ EphyEmbed *child,
+ gint position,
+ gboolean set_active)
{
EphyEmbedContainerInterface *iface;
@@ -73,7 +73,7 @@ ephy_embed_container_add_child (EphyEmbedContainer *container,
**/
void
ephy_embed_container_set_active_child (EphyEmbedContainer *container,
- EphyEmbed *child)
+ EphyEmbed *child)
{
EphyEmbedContainerInterface *iface;
@@ -94,7 +94,7 @@ ephy_embed_container_set_active_child (EphyEmbedContainer *container,
**/
void
ephy_embed_container_remove_child (EphyEmbedContainer *container,
- EphyEmbed *child)
+ EphyEmbed *child)
{
EphyEmbedContainerInterface *iface;
diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c
index bc491dbe2..aa013c9ed 100644
--- a/embed/ephy-embed-event.c
+++ b/embed/ephy-embed-event.c
@@ -116,10 +116,10 @@ ephy_embed_event_get_coords (EphyEmbedEvent *event,
* @name: the name of the property
* @value: (out): a variable to hold its value
*/
-void
-ephy_embed_event_get_property (EphyEmbedEvent *event,
- const char *name,
- GValue *value)
+void
+ephy_embed_event_get_property (EphyEmbedEvent *event,
+ const char *name,
+ GValue *value)
{
g_return_if_fail (EPHY_IS_EMBED_EVENT (event));
g_return_if_fail (name);
@@ -132,27 +132,26 @@ ephy_embed_event_get_property (EphyEmbedEvent *event,
}
gboolean
-ephy_embed_event_has_property (EphyEmbedEvent *event,
- const char *name)
+ephy_embed_event_has_property (EphyEmbedEvent *event,
+ const char *name)
{
g_return_val_if_fail (EPHY_IS_EMBED_EVENT (event), FALSE);
g_return_val_if_fail (name, FALSE);
return g_object_class_find_property (G_OBJECT_GET_CLASS (event->hit_test_result),
name) != NULL;
-
}
/**
* ephy_embed_event_get_hit_test_result:
* @event: an #EphyEmbedEvent
- *
+ *
* Returns: (transfer none): returns the #WebKitHitTestResult associated with @event
**/
WebKitHitTestResult *
ephy_embed_event_get_hit_test_result (EphyEmbedEvent *event)
{
g_return_val_if_fail (EPHY_IS_EMBED_EVENT (event), NULL);
-
+
return event->hit_test_result;
}
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 8dc1e844f..044761f92 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -30,12 +30,11 @@
#include <math.h>
#include <webkit2/webkit2.h>
-typedef struct
-{
+typedef struct {
const char *schema;
const char *key;
const char *webkit_pref;
- void (*callback) (GSettings *settings, const char *key, gpointer data);
+ void (*callback)(GSettings *settings, const char *key, gpointer data);
} PrefData;
#define ENABLE_SCRIPTS_SETTING "enable-javascript"
@@ -44,8 +43,8 @@ static WebKitSettings *webkit_settings = NULL;
static void
user_style_sheet_output_stream_splice_cb (GOutputStream *output_stream,
- GAsyncResult *result,
- gpointer user_data)
+ GAsyncResult *result,
+ gpointer user_data)
{
gssize bytes;
@@ -63,9 +62,9 @@ user_style_sheet_output_stream_splice_cb (GOutputStream *output_stream,
}
static void
-user_style_seet_read_cb (GFile *file,
+user_style_seet_read_cb (GFile *file,
GAsyncResult *result,
- gpointer user_data)
+ gpointer user_data)
{
GFileInputStream *input_stream;
GOutputStream *output_stream;
@@ -87,9 +86,9 @@ user_style_seet_read_cb (GFile *file,
}
static void
-webkit_pref_callback_user_stylesheet (GSettings *settings,
+webkit_pref_callback_user_stylesheet (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
gboolean value;
@@ -119,7 +118,7 @@ webkit_pref_get_vendor_user_agent (void)
branding_keyfile = g_key_file_new ();
- if (g_key_file_load_from_file (branding_keyfile, SHARE_DIR"/branding.conf",
+ if (g_key_file_load_from_file (branding_keyfile, SHARE_DIR "/branding.conf",
G_KEY_FILE_NONE, NULL)) {
char *vendor;
char *vendor_sub;
@@ -178,9 +177,9 @@ webkit_pref_get_internal_user_agent (void)
}
static void
-webkit_pref_callback_user_agent (GSettings *settings,
+webkit_pref_callback_user_agent (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
char *value;
const char *internal_user_agent;
@@ -234,9 +233,9 @@ normalize_font_size (gdouble font_size)
}
static void
-webkit_pref_callback_font_size (GSettings *settings,
+webkit_pref_callback_font_size (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
char *webkit_pref = data;
char *value = NULL;
@@ -248,8 +247,7 @@ webkit_pref_callback_font_size (GSettings *settings,
/* If we are changing a GNOME font value and we are not using GNOME fonts in
* Epiphany, return. */
if (g_strcmp0 (schema, EPHY_PREFS_WEB_SCHEMA) != 0 &&
- g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_USE_GNOME_FONTS) != TRUE)
- {
+ g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_USE_GNOME_FONTS) != TRUE) {
g_free (schema);
return;
}
@@ -258,7 +256,7 @@ webkit_pref_callback_font_size (GSettings *settings,
value = g_settings_get_string (settings, key);
if (value) {
- PangoFontDescription* desc;
+ PangoFontDescription *desc;
desc = pango_font_description_from_string (value);
size = pango_font_description_get_size (desc);
@@ -272,9 +270,9 @@ webkit_pref_callback_font_size (GSettings *settings,
}
static void
-webkit_pref_callback_font_family (GSettings *settings,
+webkit_pref_callback_font_family (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
char *webkit_pref = data;
char *value = NULL;
@@ -285,8 +283,7 @@ webkit_pref_callback_font_family (GSettings *settings,
/* If we are changing a GNOME font value and we are not using GNOME fonts in
* Epiphany, return. */
if (g_strcmp0 (schema, EPHY_PREFS_WEB_SCHEMA) != 0 &&
- g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_USE_GNOME_FONTS) != TRUE)
- {
+ g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_USE_GNOME_FONTS) != TRUE) {
g_free (schema);
return;
}
@@ -295,7 +292,7 @@ webkit_pref_callback_font_family (GSettings *settings,
value = g_settings_get_string (settings, key);
if (value) {
- PangoFontDescription* desc;
+ PangoFontDescription *desc;
const char *family = NULL;
desc = pango_font_description_from_string (value);
@@ -336,9 +333,9 @@ normalize_languages (char **languages)
/* Based on Christian Persch's code from gecko backend of epiphany
(old transform_accept_languages_list() function) */
static void
-webkit_pref_callback_accept_languages (GSettings *settings,
+webkit_pref_callback_accept_languages (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
GArray *array;
char **languages;
@@ -351,12 +348,12 @@ webkit_pref_callback_accept_languages (GSettings *settings,
array = g_array_new (TRUE, FALSE, sizeof (char *));
for (i = 0; languages[i]; i++) {
- if (!g_strcmp0 (languages[i], "system")) {
- ephy_langs_append_languages (array);
- } else if (languages[i][0] != '\0') {
- char *str = g_ascii_strdown (languages[i], -1);
- g_array_append_val (array, str);
- }
+ if (!g_strcmp0 (languages[i], "system")) {
+ ephy_langs_append_languages (array);
+ } else if (languages[i][0] != '\0') {
+ char *str = g_ascii_strdown (languages[i], -1);
+ g_array_append_val (array, str);
+ }
}
ephy_langs_sanitise (array);
@@ -376,7 +373,7 @@ webkit_pref_callback_accept_languages (GSettings *settings,
void
ephy_embed_prefs_set_cookie_accept_policy (WebKitCookieManager *cookie_manager,
- const char *settings_policy)
+ const char *settings_policy)
{
WebKitCookieAcceptPolicy policy;
@@ -395,9 +392,9 @@ ephy_embed_prefs_set_cookie_accept_policy (WebKitCookieManager *cookie_manager,
}
static void
-webkit_pref_callback_cookie_accept_policy (GSettings *settings,
+webkit_pref_callback_cookie_accept_policy (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
WebKitCookieManager *cookie_manager;
char *value;
@@ -443,17 +440,17 @@ ephy_embed_prefs_update_font_settings (GSettings *ephy_settings, const char *key
}
static void
-webkit_pref_callback_gnome_fonts (GSettings *ephy_settings,
+webkit_pref_callback_gnome_fonts (GSettings *ephy_settings,
const char *key,
- gpointer data)
+ gpointer data)
{
ephy_embed_prefs_update_font_settings (ephy_settings, key);
}
static void
-webkit_pref_callback_enable_spell_checking (GSettings *settings,
+webkit_pref_callback_enable_spell_checking (GSettings *settings,
const char *key,
- gpointer data)
+ gpointer data)
{
WebKitWebContext *web_context;
gboolean value = FALSE;
@@ -468,7 +465,7 @@ webkit_pref_callback_enable_spell_checking (GSettings *settings,
char **languages = g_settings_get_strv (settings, EPHY_PREFS_WEB_LANGUAGE);
char **normalized = normalize_languages (languages);
- webkit_web_context_set_spell_checking_languages (web_context, (const char* const *)normalized);
+ webkit_web_context_set_spell_checking_languages (web_context, (const char * const *)normalized);
g_strfreev (languages);
g_strfreev (normalized);
@@ -477,68 +474,68 @@ webkit_pref_callback_enable_spell_checking (GSettings *settings,
static void
gtk_settings_xft_dpi_changed_cb (GtkSettings *gtk_settings,
- GParamSpec *pspec,
- gpointer data)
+ GParamSpec *pspec,
+ gpointer data)
{
GSettings *gsettings = ephy_settings_get (EPHY_PREFS_WEB_SCHEMA);
ephy_embed_prefs_update_font_settings (gsettings, EPHY_PREFS_WEB_USE_GNOME_FONTS);
}
static const PrefData webkit_pref_entries[] =
- {
- /* Epiphany font settings */
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_SERIF_FONT,
- "default-font-size",
- webkit_pref_callback_font_size },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_MONOSPACE_FONT,
- "default-monospace-font-size",
- webkit_pref_callback_font_size },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_SERIF_FONT,
- "default-font-family",
- webkit_pref_callback_font_family },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_SANS_SERIF_FONT,
- "sans-serif-font-family",
- webkit_pref_callback_font_family },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_MONOSPACE_FONT,
- "monospace-font-family",
- webkit_pref_callback_font_family },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_SERIF_FONT,
- "serif-font-family",
- webkit_pref_callback_font_family },
-
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_USE_GNOME_FONTS,
- NULL,
- webkit_pref_callback_gnome_fonts },
-
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING,
- NULL,
- webkit_pref_callback_enable_spell_checking },
-
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_ENABLE_USER_CSS,
- "user-stylesheet-uri",
- webkit_pref_callback_user_stylesheet },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_LANGUAGE,
- "accept-language",
- webkit_pref_callback_accept_languages },
- { EPHY_PREFS_SCHEMA,
- EPHY_PREFS_USER_AGENT,
- "user-agent",
- webkit_pref_callback_user_agent },
- { EPHY_PREFS_WEB_SCHEMA,
- EPHY_PREFS_WEB_COOKIES_POLICY,
- "accept-policy",
- webkit_pref_callback_cookie_accept_policy },
- };
+{
+ /* Epiphany font settings */
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_SERIF_FONT,
+ "default-font-size",
+ webkit_pref_callback_font_size },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_MONOSPACE_FONT,
+ "default-monospace-font-size",
+ webkit_pref_callback_font_size },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_SERIF_FONT,
+ "default-font-family",
+ webkit_pref_callback_font_family },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_SANS_SERIF_FONT,
+ "sans-serif-font-family",
+ webkit_pref_callback_font_family },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_MONOSPACE_FONT,
+ "monospace-font-family",
+ webkit_pref_callback_font_family },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_SERIF_FONT,
+ "serif-font-family",
+ webkit_pref_callback_font_family },
+
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_USE_GNOME_FONTS,
+ NULL,
+ webkit_pref_callback_gnome_fonts },
+
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING,
+ NULL,
+ webkit_pref_callback_enable_spell_checking },
+
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_ENABLE_USER_CSS,
+ "user-stylesheet-uri",
+ webkit_pref_callback_user_stylesheet },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_LANGUAGE,
+ "accept-language",
+ webkit_pref_callback_accept_languages },
+ { EPHY_PREFS_SCHEMA,
+ EPHY_PREFS_USER_AGENT,
+ "user-agent",
+ webkit_pref_callback_user_agent },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_COOKIES_POLICY,
+ "accept-policy",
+ webkit_pref_callback_cookie_accept_policy },
+};
static gpointer
ephy_embed_prefs_init (gpointer user_data)
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 5d9f7f0d7..a9901f737 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -61,8 +61,7 @@ typedef struct {
GList *web_extensions;
} EphyEmbedShellPrivate;
-enum
-{
+enum {
RESTORED_WINDOW,
WEB_VIEW_CREATED,
PAGE_CREATED,
@@ -74,8 +73,7 @@ enum
static guint signals[LAST_SIGNAL];
-enum
-{
+enum {
PROP_0,
PROP_MODE,
N_PROPERTIES
@@ -112,8 +110,8 @@ ephy_embed_shell_dispose (GObject *object)
static void
web_extension_form_auth_data_message_received_cb (WebKitUserContentManager *manager,
- WebKitJavascriptResult *message,
- EphyEmbedShell *shell)
+ WebKitJavascriptResult *message,
+ EphyEmbedShell *shell)
{
guint request_id;
guint64 page_id;
@@ -134,9 +132,9 @@ web_extension_form_auth_data_message_received_cb (WebKitUserContentManager *mana
static void
history_service_query_urls_cb (EphyHistoryService *service,
- gboolean success,
- GList *urls,
- EphyEmbedShell *shell)
+ gboolean success,
+ GList *urls,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GList *l;
@@ -164,16 +162,16 @@ ephy_embed_shell_update_overview_urls (EphyEmbedShell *shell)
query->ignore_local = TRUE;
ephy_history_service_query_urls (priv->global_history_service, query, NULL,
- (EphyHistoryJobCallback) history_service_query_urls_cb,
+ (EphyHistoryJobCallback)history_service_query_urls_cb,
shell);
ephy_history_query_free (query);
}
static void
history_service_urls_visited_cb (EphyHistoryService *history,
- EphyEmbedShell *shell)
+ EphyEmbedShell *shell)
{
- ephy_embed_shell_update_overview_urls (shell);
+ ephy_embed_shell_update_overview_urls (shell);
}
static gboolean
@@ -193,9 +191,9 @@ ephy_embed_shell_update_overview_timeout_cb (EphyEmbedShell *shell)
static void
history_set_url_hidden_cb (EphyHistoryService *service,
- gboolean success,
- gpointer result_data,
- EphyEmbedShell *shell)
+ gboolean success,
+ gpointer result_data,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -212,8 +210,8 @@ history_set_url_hidden_cb (EphyHistoryService *service,
static void
web_extension_overview_message_received_cb (WebKitUserContentManager *manager,
- WebKitJavascriptResult *message,
- EphyEmbedShell *shell)
+ WebKitJavascriptResult *message,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
char *url_to_remove;
@@ -223,7 +221,7 @@ web_extension_overview_message_received_cb (WebKitUserContentManager *manager,
priv->hiding_overview_item++;
ephy_history_service_set_url_hidden (priv->global_history_service,
url_to_remove, TRUE, NULL,
- (EphyHistoryJobCallback) history_set_url_hidden_cb,
+ (EphyHistoryJobCallback)history_set_url_hidden_cb,
shell);
g_free (url_to_remove);
@@ -232,13 +230,13 @@ web_extension_overview_message_received_cb (WebKitUserContentManager *manager,
/* Wait for the CSS animations to finish before refreshing */
priv->update_overview_timeout_id =
- g_timeout_add (OVERVIEW_RELOAD_DELAY, (GSourceFunc) ephy_embed_shell_update_overview_timeout_cb, shell);
+ g_timeout_add (OVERVIEW_RELOAD_DELAY, (GSourceFunc)ephy_embed_shell_update_overview_timeout_cb, shell);
}
static void
web_extension_tls_error_page_message_received_cb (WebKitUserContentManager *manager,
- WebKitJavascriptResult *message,
- EphyEmbedShell *shell)
+ WebKitJavascriptResult *message,
+ EphyEmbedShell *shell)
{
guint64 page_id;
@@ -248,8 +246,8 @@ web_extension_tls_error_page_message_received_cb (WebKitUserContentManager *mana
static void
web_extension_about_apps_message_received_cb (WebKitUserContentManager *manager,
- WebKitJavascriptResult *message,
- EphyEmbedShell *shell)
+ WebKitJavascriptResult *message,
+ EphyEmbedShell *shell)
{
char *app_id;
@@ -260,9 +258,9 @@ web_extension_about_apps_message_received_cb (WebKitUserContentManager *manager,
static void
history_service_url_title_changed_cb (EphyHistoryService *service,
- const char *url,
- const char *title,
- EphyEmbedShell *shell)
+ const char *url,
+ const char *title,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GList *l;
@@ -276,8 +274,8 @@ history_service_url_title_changed_cb (EphyHistoryService *service,
static void
history_service_url_deleted_cb (EphyHistoryService *service,
- const char *url,
- EphyEmbedShell *shell)
+ const char *url,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GList *l;
@@ -291,8 +289,8 @@ history_service_url_deleted_cb (EphyHistoryService *service,
static void
history_service_host_deleted_cb (EphyHistoryService *service,
- const char *deleted_url,
- EphyEmbedShell *shell)
+ const char *deleted_url,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GList *l;
@@ -311,7 +309,7 @@ history_service_host_deleted_cb (EphyHistoryService *service,
static void
history_service_cleared_cb (EphyHistoryService *service,
- EphyEmbedShell *shell)
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GList *l;
@@ -331,8 +329,8 @@ typedef struct {
static DelayedThumbnailUpdateData *
delayed_thumbnail_update_data_new (EphyWebExtensionProxy *extension,
- const char *url,
- const char *path)
+ const char *url,
+ const char *path)
{
DelayedThumbnailUpdateData *data = g_new (DelayedThumbnailUpdateData, 1);
data->extension = extension;
@@ -371,9 +369,9 @@ delayed_thumbnail_update_cb (DelayedThumbnailUpdateData *data)
void
ephy_embed_shell_set_thumbnail_path (EphyEmbedShell *shell,
- const char *url,
- time_t mtime,
- const char *path)
+ const char *url,
+ time_t mtime,
+ const char *path)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GList *l;
@@ -461,7 +459,7 @@ ephy_embed_shell_restored_window (EphyEmbedShell *shell)
static void
about_request_cb (WebKitURISchemeRequest *request,
- EphyEmbedShell *shell)
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -495,7 +493,7 @@ ephy_resource_request_cb (WebKitURISchemeRequest *request)
static void
web_extension_destroyed (EphyEmbedShell *shell,
- GObject *web_extension)
+ GObject *web_extension)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -503,7 +501,7 @@ web_extension_destroyed (EphyEmbedShell *shell,
}
static void
-ephy_embed_shell_watch_web_extension (EphyEmbedShell *shell,
+ephy_embed_shell_watch_web_extension (EphyEmbedShell *shell,
EphyWebExtensionProxy *web_extension)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -514,14 +512,14 @@ ephy_embed_shell_watch_web_extension (EphyEmbedShell *shell,
static void
ephy_embed_shell_unwatch_web_extension (EphyWebExtensionProxy *web_extension,
- EphyEmbedShell *shell)
+ EphyEmbedShell *shell)
{
g_object_weak_unref (G_OBJECT (web_extension), (GWeakNotify)web_extension_destroyed, shell);
}
static void
-initialize_web_extensions (WebKitWebContext* web_context,
- EphyEmbedShell *shell)
+initialize_web_extensions (WebKitWebContext *web_context,
+ EphyEmbedShell *shell)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
GVariant *user_data;
@@ -542,17 +540,17 @@ initialize_web_extensions (WebKitWebContext* web_context,
static void
web_extension_page_created (EphyWebExtensionProxy *extension,
- guint64 page_id,
- EphyEmbedShell *shell)
+ guint64 page_id,
+ EphyEmbedShell *shell)
{
g_object_set_data (G_OBJECT (extension), "initialized", GINT_TO_POINTER (TRUE));
g_signal_emit (shell, signals[PAGE_CREATED], 0, page_id, extension);
}
static gboolean
-new_connection_cb (GDBusServer *server,
+new_connection_cb (GDBusServer *server,
GDBusConnection *connection,
- EphyEmbedShell *shell)
+ EphyEmbedShell *shell)
{
EphyWebExtensionProxy *extension = ephy_web_extension_proxy_new (connection);
ephy_embed_shell_watch_web_extension (shell, extension);
@@ -565,9 +563,9 @@ new_connection_cb (GDBusServer *server,
static gboolean
authorize_authenticated_peer_cb (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials,
- EphyEmbedShell *shell)
+ GIOStream *stream,
+ GCredentials *credentials,
+ EphyEmbedShell *shell)
{
return ephy_dbus_peer_is_authorized (credentials);
}
@@ -611,7 +609,7 @@ ephy_embed_shell_setup_web_extensions_server (EphyEmbedShell *shell)
G_CALLBACK (new_connection_cb), shell);
g_dbus_server_start (priv->dbus_server);
-out:
+ out:
g_free (address);
g_free (guid);
g_object_unref (observer);
@@ -630,14 +628,14 @@ ephy_embed_shell_setup_process_model (EphyEmbedShell *shell)
process_model = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_PROCESS_MODEL);
switch (process_model) {
- case EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
- max_processes = 1;
- break;
- case EPHY_PREFS_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW:
- max_processes = g_settings_get_uint (EPHY_SETTINGS_MAIN, EPHY_PREFS_MAX_PROCESSES);
- break;
- default:
- g_assert_not_reached ();
+ case EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
+ max_processes = 1;
+ break;
+ case EPHY_PREFS_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW:
+ max_processes = g_settings_get_uint (EPHY_SETTINGS_MAIN, EPHY_PREFS_MAX_PROCESSES);
+ break;
+ default:
+ g_assert_not_reached ();
}
webkit_web_context_set_process_model (priv->web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
@@ -670,7 +668,7 @@ ephy_embed_shell_create_web_context (EphyEmbedShell *shell)
}
static void
-ephy_embed_shell_startup (GApplication* application)
+ephy_embed_shell_startup (GApplication *application)
{
EphyEmbedShell *shell = EPHY_EMBED_SHELL (application);
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -762,7 +760,7 @@ ephy_embed_shell_startup (GApplication* application)
}
static void
-ephy_embed_shell_shutdown (GApplication* application)
+ephy_embed_shell_shutdown (GApplication *application)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (EPHY_EMBED_SHELL (application));
@@ -783,36 +781,36 @@ ephy_embed_shell_shutdown (GApplication* application)
}
static void
-ephy_embed_shell_set_property (GObject *object,
- guint prop_id,
+ephy_embed_shell_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (EPHY_EMBED_SHELL (object));
switch (prop_id) {
- case PROP_MODE:
- priv->mode = g_value_get_enum (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ case PROP_MODE:
+ priv->mode = g_value_get_enum (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
-ephy_embed_shell_get_property (GObject *object,
- guint prop_id,
- GValue *value,
+ephy_embed_shell_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (EPHY_EMBED_SHELL (object));
switch (prop_id) {
- case PROP_MODE:
- g_value_set_enum (value, priv->mode);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ case PROP_MODE:
+ g_value_set_enum (value, priv->mode);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@@ -864,7 +862,7 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass)
EPHY_TYPE_EMBED_SHELL_MODE,
EPHY_EMBED_SHELL_MODE_BROWSER,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-
+
g_object_class_install_properties (object_class,
N_PROPERTIES,
object_properties);
@@ -974,7 +972,7 @@ ephy_embed_shell_get_default (void)
void
ephy_embed_shell_set_page_setup (EphyEmbedShell *shell,
- GtkPageSetup *page_setup)
+ GtkPageSetup *page_setup)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
char *path;
@@ -1036,7 +1034,7 @@ ephy_embed_shell_get_page_setup (EphyEmbedShell *shell)
*
**/
void
-ephy_embed_shell_set_print_settings (EphyEmbedShell *shell,
+ephy_embed_shell_set_print_settings (EphyEmbedShell *shell,
GtkPrintSettings *settings)
{
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
@@ -1094,7 +1092,7 @@ ephy_embed_shell_get_print_settings (EphyEmbedShell *shell)
/**
* ephy_embed_shell_get_mode:
* @shell: an #EphyEmbedShell
- *
+ *
* Returns: the global mode of the @shell
**/
EphyEmbedShellMode
@@ -1103,7 +1101,7 @@ ephy_embed_shell_get_mode (EphyEmbedShell *shell)
EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), EPHY_EMBED_SHELL_MODE_BROWSER);
-
+
return priv->mode;
}
@@ -1113,18 +1111,18 @@ ephy_embed_shell_get_mode (EphyEmbedShell *shell)
* @file: a #GFile to open
* @mime_type: the mime type of @file or %NULL
* @user_time: user time to prevent focus stealing
- *
+ *
* Tries to open @file with the right application, making sure we will
* not call ourselves in the process. This is needed to avoid
* potential infinite loops when opening unknown file types.
- *
+ *
* Returns: %TRUE on success
**/
gboolean
ephy_embed_shell_launch_handler (EphyEmbedShell *shell,
- GFile *file,
- const char *mime_type,
- guint32 user_time)
+ GFile *file,
+ const char *mime_type,
+ guint32 user_time)
{
GAppInfo *app;
GList *list = NULL;
@@ -1154,7 +1152,7 @@ ephy_embed_shell_launch_handler (EphyEmbedShell *shell,
/**
* ephy_embed_shell_clear_cache:
* @shell: an #EphyEmbedShell
- *
+ *
* Clears the HTTP cache (temporarily saved web pages).
**/
void
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 4a22ab8a4..cb870807d 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -38,7 +38,6 @@ static GRegex *domain_regex;
char *
ephy_embed_utils_link_message_parse (const char *message)
{
-
char *status_message;
char **splitted_message;
int i = 1;
@@ -46,7 +45,7 @@ ephy_embed_utils_link_message_parse (const char *message)
GString *tmp;
status_message = ephy_string_blank_chr (g_strdup (message));
-
+
if (!status_message || !g_str_has_prefix (status_message, "mailto:"))
return status_message;
@@ -55,14 +54,14 @@ ephy_embed_utils_link_message_parse (const char *message)
*/
p = strchr (status_message, '?');
if (p != NULL) *p = '\0';
-
+
/* Then we also want to check if there is more than an email address
* in the mailto: list.
*/
splitted_message = g_strsplit_set (status_message, ";", -1);
tmp = g_string_new (g_strdup_printf (_("Send an email message to “%s”"),
(splitted_message[0] + 7)));
-
+
while (splitted_message [i] != NULL) {
g_string_append_printf (tmp, ", “%s”", splitted_message[i]);
i++;
@@ -137,7 +136,7 @@ gboolean
ephy_embed_utils_address_is_existing_absolute_filename (const char *address)
{
return g_path_is_absolute (address) &&
- g_file_test (address, G_FILE_TEST_EXISTS);
+ g_file_test (address, G_FILE_TEST_EXISTS);
}
static gboolean
@@ -179,16 +178,16 @@ ephy_embed_utils_address_is_valid (const char *address)
scheme = g_uri_parse_scheme (address);
retval = scheme ||
- ephy_embed_utils_address_is_existing_absolute_filename (address) ||
- g_regex_match (get_non_search_regex (), address, 0, NULL) ||
- is_public_domain (address);
+ ephy_embed_utils_address_is_existing_absolute_filename (address) ||
+ g_regex_match (get_non_search_regex (), address, 0, NULL) ||
+ is_public_domain (address);
g_free (scheme);
return retval;
}
-char*
+char *
ephy_embed_utils_normalize_address (const char *address)
{
char *effective_address = NULL;
@@ -250,7 +249,6 @@ ephy_embed_utils_autosearch_address (const char *search_key)
g_free (url_search);
return effective_address;
-
}
char *
@@ -267,17 +265,17 @@ ephy_embed_utils_url_is_empty (const char *location)
{
gboolean is_empty = FALSE;
- if (location == NULL ||
- location[0] == '\0' ||
+ if (location == NULL ||
+ location[0] == '\0' ||
strcmp (location, "about:blank") == 0)
is_empty = TRUE;
-
+
return is_empty;
}
/* This is the list of addresses that should never be shown in the
* window's location entry. */
-static const char * do_not_show_address[] = {
+static const char *do_not_show_address[] = {
"about:blank",
"ephy-about:incognito",
"ephy-about:overview",
@@ -305,7 +303,7 @@ ephy_embed_utils_get_title_from_address (const char *address)
if (g_str_has_prefix (address, "file://"))
return g_strdup (address + 7);
- if (!strcmp (address, EPHY_ABOUT_SCHEME":overview") ||
+ if (!strcmp (address, EPHY_ABOUT_SCHEME ":overview") ||
!strcmp (address, "about:overview"))
return g_strdup (_("Most Visited"));
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index e64df1f8a..1069abc12 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -38,9 +38,9 @@
#include <glib/gi18n.h>
#include <webkit2/webkit2.h>
-static void ephy_embed_constructed (GObject *object);
-static void ephy_embed_restored_window_cb (EphyEmbedShell *shell,
- EphyEmbed *embed);
+static void ephy_embed_constructed (GObject *object);
+static void ephy_embed_restored_window_cb (EphyEmbedShell *shell,
+ EphyEmbed *embed);
#define EPHY_EMBED_STATUSBAR_TAB_MESSAGE_CONTEXT_DESCRIPTION "tab_message"
#define MAX_TITLE_LENGTH 512 /* characters */
@@ -88,8 +88,7 @@ struct _EphyEmbed {
G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_BOX)
-enum
-{
+enum {
PROP_0,
PROP_WEB_VIEW,
PROP_TITLE,
@@ -238,7 +237,7 @@ remove_from_destroy_list_cb (GtkWidget *widget, EphyEmbed *embed)
}
static void
-ephy_embed_set_title (EphyEmbed *embed,
+ephy_embed_set_title (EphyEmbed *embed,
const char *title)
{
char *new_title;
@@ -268,31 +267,31 @@ ephy_embed_set_title (EphyEmbed *embed,
static void
web_view_title_changed_cb (WebKitWebView *web_view,
- GParamSpec *spec,
- EphyEmbed *embed)
+ GParamSpec *spec,
+ EphyEmbed *embed)
{
ephy_embed_set_title (embed, webkit_web_view_get_title (web_view));
}
static void
-load_changed_cb (WebKitWebView *web_view,
+load_changed_cb (WebKitWebView *web_view,
WebKitLoadEvent load_event,
- EphyEmbed *embed)
+ EphyEmbed *embed)
{
switch (load_event) {
- case WEBKIT_LOAD_COMMITTED:
- ephy_embed_destroy_top_widgets (embed);
- break;
- case WEBKIT_LOAD_FINISHED: {
- const char *title = webkit_web_view_get_title (web_view);
- if (ephy_web_view_get_is_blank (EPHY_WEB_VIEW (web_view)) || !title || !*title)
- ephy_embed_set_title (embed, NULL);
- break;
- }
- case WEBKIT_LOAD_STARTED:
- case WEBKIT_LOAD_REDIRECTED:
- default:
- break;
+ case WEBKIT_LOAD_COMMITTED:
+ ephy_embed_destroy_top_widgets (embed);
+ break;
+ case WEBKIT_LOAD_FINISHED: {
+ const char *title = webkit_web_view_get_title (web_view);
+ if (ephy_web_view_get_is_blank (EPHY_WEB_VIEW (web_view)) || !title || !*title)
+ ephy_embed_set_title (embed, NULL);
+ break;
+ }
+ case WEBKIT_LOAD_STARTED:
+ case WEBKIT_LOAD_REDIRECTED:
+ default:
+ break;
}
}
@@ -330,8 +329,8 @@ ephy_embed_entering_fullscreen (EphyEmbed *embed)
g_source_remove (embed->fullscreen_message_id);
embed->fullscreen_message_id = g_timeout_add_seconds (5,
- (GSourceFunc)fullscreen_message_label_hide,
- embed);
+ (GSourceFunc)fullscreen_message_label_hide,
+ embed);
g_source_set_name_by_id (embed->fullscreen_message_id, "[epiphany] fullscreen_message_label_hide");
}
}
@@ -392,7 +391,7 @@ ephy_embed_finalize (GObject *object)
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
GSList *list;
- g_signal_handlers_disconnect_by_func(shell, ephy_embed_restored_window_cb, embed);
+ g_signal_handlers_disconnect_by_func (shell, ephy_embed_restored_window_cb, embed);
list = embed->destroy_on_transition_list;
for (; list; list = list->next) {
@@ -424,52 +423,50 @@ ephy_embed_finalize (GObject *object)
}
static void
-ephy_embed_set_property (GObject *object,
- guint prop_id,
+ephy_embed_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
EphyEmbed *embed = EPHY_EMBED (object);
- switch (prop_id)
- {
- case PROP_WEB_VIEW:
- embed->web_view = g_value_get_object (value);
- break;
- case PROP_TITLE:
- ephy_embed_set_title (embed, g_value_get_string (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ switch (prop_id) {
+ case PROP_WEB_VIEW:
+ embed->web_view = g_value_get_object (value);
+ break;
+ case PROP_TITLE:
+ ephy_embed_set_title (embed, g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-ephy_embed_get_property (GObject *object,
- guint prop_id,
- GValue *value,
+ephy_embed_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
EphyEmbed *embed = EPHY_EMBED (object);
- switch (prop_id)
- {
- case PROP_WEB_VIEW:
- g_value_set_object (value, ephy_embed_get_web_view (embed));
- break;
- case PROP_TITLE:
- g_value_set_string (value, ephy_embed_get_title (embed));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ switch (prop_id) {
+ case PROP_WEB_VIEW:
+ g_value_set_object (value, ephy_embed_get_web_view (embed));
+ break;
+ case PROP_TITLE:
+ g_value_set_string (value, ephy_embed_get_title (embed));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
ephy_embed_find_toolbar_close_cb (EphyFindToolbar *toolbar,
- EphyEmbed *embed)
+ EphyEmbed *embed)
{
ephy_find_toolbar_close (embed->find_toolbar);
@@ -508,7 +505,7 @@ ephy_embed_class_init (EphyEmbedClass *klass)
static gboolean
ephy_embed_attach_inspector_cb (WebKitWebInspector *inspector,
- EphyEmbed *embed)
+ EphyEmbed *embed)
{
GtkWidget *inspector_view = GTK_WIDGET (webkit_web_inspector_get_web_view (inspector));
int inspected_view_height;
@@ -526,7 +523,7 @@ ephy_embed_attach_inspector_cb (WebKitWebInspector *inspector,
static void
ephy_embed_set_fullscreen_message (EphyEmbed *embed,
- gboolean is_html5_fullscreen)
+ gboolean is_html5_fullscreen)
{
char *message;
@@ -539,7 +536,7 @@ ephy_embed_set_fullscreen_message (EphyEmbed *embed,
static gboolean
entering_fullscreen_cb (WebKitWebView *web_view,
- EphyEmbed *embed)
+ EphyEmbed *embed)
{
ephy_embed_set_fullscreen_message (embed, TRUE);
return FALSE;
@@ -547,7 +544,7 @@ entering_fullscreen_cb (WebKitWebView *web_view,
static gboolean
leaving_fullscreen_cb (WebKitWebView *web_view,
- EphyEmbed *embed)
+ EphyEmbed *embed)
{
ephy_embed_set_fullscreen_message (embed, FALSE);
return FALSE;
@@ -580,7 +577,7 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed
ephy_embed_statusbar_push (embed, embed->tab_message_id, message);
} else {
/* A short timeout before hiding the statusbar ensures that while moving
- over a series of links, the overlay widget doesn't flicker on and off. */
+ over a series of links, the overlay widget doesn't flicker on and off. */
if (embed->pop_statusbar_later_source_id == 0) {
embed->pop_statusbar_later_source_id = g_timeout_add (250, pop_statusbar_later_cb, embed);
g_source_set_name_by_id (embed->pop_statusbar_later_source_id, "[epiphany] pop_statusbar_later_cb");
@@ -690,13 +687,13 @@ ephy_embed_restored_window_cb (EphyEmbedShell *shell, EphyEmbed *embed)
static void
ephy_embed_mapped_cb (GtkWidget *widget, gpointer data)
{
- ephy_embed_maybe_load_delayed_request ((EphyEmbed*)widget);
+ ephy_embed_maybe_load_delayed_request ((EphyEmbed *)widget);
}
static void
ephy_embed_constructed (GObject *object)
{
- EphyEmbed *embed = (EphyEmbed*)object;
+ EphyEmbed *embed = (EphyEmbed *)object;
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
GtkWidget *paned;
WebKitWebInspector *inspector;
@@ -711,7 +708,7 @@ ephy_embed_constructed (GObject *object)
/* Skeleton */
overlay = gtk_overlay_new ();
- gtk_widget_add_events (overlay,
+ gtk_widget_add_events (overlay,
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
gtk_container_add (GTK_CONTAINER (overlay), GTK_WIDGET (embed->web_view));
@@ -800,12 +797,12 @@ ephy_embed_init (EphyEmbed *embed)
/**
* ephy_embed_get_web_view:
* @embed: and #EphyEmbed
- *
+ *
* Returns the #EphyWebView wrapped by @embed.
- *
+ *
* Returns: (transfer none): an #EphyWebView
**/
-EphyWebView*
+EphyWebView *
ephy_embed_get_web_view (EphyEmbed *embed)
{
g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
@@ -816,12 +813,12 @@ ephy_embed_get_web_view (EphyEmbed *embed)
/**
* ephy_embed_get_find_toolbar:
* @embed: and #EphyEmbed
- *
+ *
* Returns the #EphyFindToolbar wrapped by @embed.
- *
+ *
* Returns: (transfer none): an #EphyFindToolbar
**/
-EphyFindToolbar*
+EphyFindToolbar *
ephy_embed_get_find_toolbar (EphyEmbed *embed)
{
g_return_val_if_fail (EPHY_IS_EMBED (embed), NULL);
diff --git a/embed/ephy-encoding.c b/embed/ephy-encoding.c
index a0665a515..dec62dfec 100644
--- a/embed/ephy-encoding.c
+++ b/embed/ephy-encoding.c
@@ -21,8 +21,7 @@
#include <string.h>
-struct _EphyEncoding
-{
+struct _EphyEncoding {
GObject parent_instance;
char *title;
@@ -62,9 +61,9 @@ ephy_encoding_finalize (GObject *object)
}
static void
-ephy_encoding_get_property (GObject *object,
- guint prop_id,
- GValue *value,
+ephy_encoding_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
EphyEncoding *encoding = EPHY_ENCODING (object);
@@ -105,8 +104,7 @@ elide_underscores (const char *original)
for (p = original; *p; p++) {
if (!last_underscore && *p == '_') {
last_underscore = TRUE;
- }
- else {
+ } else {
last_underscore = FALSE;
*q++ = *p;
}
@@ -118,53 +116,53 @@ elide_underscores (const char *original)
}
static void
-ephy_encoding_set_property (GObject *object,
- guint prop_id,
+ephy_encoding_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
EphyEncoding *encoding = EPHY_ENCODING (object);
switch (prop_id) {
- case PROP_TITLE: {
- char *elided, *collate_key, *normalised;
-
- g_free (encoding->title);
- encoding->title = g_strdup (g_value_get_string (value));
-
- elided = elide_underscores (encoding->title);
- normalised = g_utf8_normalize (elided, -1, G_NORMALIZE_DEFAULT);
- collate_key = g_utf8_collate_key (normalised, -1);
-
- g_object_set (object,
- "title-elided", elided,
- "collation-key", collate_key,
- NULL);
-
- g_free (collate_key);
- g_free (normalised);
- g_free (elided);
-
- break;
- }
- case PROP_TITLE_ELIDED:
- g_free (encoding->title_elided);
- encoding->title_elided = g_strdup (g_value_get_string (value));
- break;
- case PROP_COLLATION_KEY:
- g_free (encoding->collation_key);
- encoding->collation_key = g_strdup (g_value_get_string (value));
- break;
- case PROP_ENCODING:
- g_free (encoding->encoding);
- encoding->encoding = g_strdup (g_value_get_string (value));
- break;
- case PROP_LANGUAGE_GROUPS:
- encoding->language_groups = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ case PROP_TITLE: {
+ char *elided, *collate_key, *normalised;
+
+ g_free (encoding->title);
+ encoding->title = g_strdup (g_value_get_string (value));
+
+ elided = elide_underscores (encoding->title);
+ normalised = g_utf8_normalize (elided, -1, G_NORMALIZE_DEFAULT);
+ collate_key = g_utf8_collate_key (normalised, -1);
+
+ g_object_set (object,
+ "title-elided", elided,
+ "collation-key", collate_key,
+ NULL);
+
+ g_free (collate_key);
+ g_free (normalised);
+ g_free (elided);
+
+ break;
+ }
+ case PROP_TITLE_ELIDED:
+ g_free (encoding->title_elided);
+ encoding->title_elided = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_COLLATION_KEY:
+ g_free (encoding->collation_key);
+ encoding->collation_key = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_ENCODING:
+ g_free (encoding->encoding);
+ encoding->encoding = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_LANGUAGE_GROUPS:
+ encoding->language_groups = g_value_get_int (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
@@ -193,25 +191,25 @@ ephy_encoding_class_init (EphyEncodingClass *klass)
obj_properties[PROP_COLLATION_KEY] =
g_param_spec_string ("collation-key",
- "Collation Key",
- "The encoding's collation key",
- "",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ "Collation Key",
+ "The encoding's collation key",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_ENCODING] =
g_param_spec_string ("encoding",
- "Encoding",
- "The encoding's encoding",
- "",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ "Encoding",
+ "The encoding's encoding",
+ "",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_LANGUAGE_GROUPS] =
g_param_spec_int ("language-groups",
- "Language Groups",
- "The encoding's language groups",
- LG_NONE, LG_ALL,
- LG_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ "Language Groups",
+ "The encoding's language groups",
+ LG_NONE, LG_ALL,
+ LG_NONE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, LAST_PROP, obj_properties);
}
diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c
index faac0808b..ccceb2a5d 100644
--- a/embed/ephy-encodings.c
+++ b/embed/ephy-encodings.c
@@ -27,16 +27,14 @@
#include <glib/gi18n.h>
-struct _EphyEncodings
-{
+struct _EphyEncodings {
GObject parent_instance;
GHashTable *hash;
GSList *recent;
};
-enum
-{
+enum {
ENCODING_ADDED,
LAST_SIGNAL
};
@@ -48,98 +46,97 @@ static guint signals[LAST_SIGNAL];
* NOTE: if you add/remove/change encodings, please also update the
* schema in epiphany.schemas.in
*/
-static const
-struct
-{
+static const
+struct {
const char *title;
const char *code;
EphyLanguageGroup groups;
}
encoding_entries [] =
-{
- { N_("Arabic (_IBM-864)"), "IBM864", LG_ARABIC },
- { N_("Arabic (ISO-_8859-6)"), "ISO-8859-6", LG_ARABIC },
- { N_("Arabic (_MacArabic)"), "x-mac-arabic", LG_ARABIC },
- { N_("Arabic (_Windows-1256)"), "windows-1256", LG_ARABIC },
- { N_("Baltic (_ISO-8859-13)"), "ISO-8859-13", LG_BALTIC },
- { N_("Baltic (I_SO-8859-4)"), "ISO-8859-4", LG_BALTIC },
- { N_("Baltic (_Windows-1257)"), "windows-1257", LG_BALTIC },
- { N_("_Armenian (ARMSCII-8)"), "armscii-8", LG_CAUCASIAN },
- { N_("_Georgian (GEOSTD8)"), "geostd8", LG_CAUCASIAN },
- { N_("Central European (_IBM-852)"), "IBM852", LG_C_EUROPEAN },
- { N_("Central European (I_SO-8859-2)"), "ISO-8859-2", LG_C_EUROPEAN },
- { N_("Central European (_MacCE)"), "x-mac-ce", LG_C_EUROPEAN },
- { N_("Central European (_Windows-1250)"), "windows-1250", LG_C_EUROPEAN },
- { N_("Chinese Simplified (_GB18030)"), "gb18030", LG_CHINESE_SIMP },
- { N_("Chinese Simplified (G_B2312)"), "GB2312", LG_CHINESE_SIMP },
- { N_("Chinese Simplified (GB_K)"), "x-gbk", LG_CHINESE_SIMP },
- { N_("Chinese Simplified (_HZ)"), "HZ-GB-2312", LG_CHINESE_SIMP },
- { N_("Chinese Simplified (_ISO-2022-CN)"), "ISO-2022-CN", LG_CHINESE_SIMP },
- { N_("Chinese Traditional (Big_5)"), "Big5", LG_CHINESE_TRAD },
- { N_("Chinese Traditional (Big5-HK_SCS)"), "Big5-HKSCS", LG_CHINESE_TRAD },
- { N_("Chinese Traditional (_EUC-TW)"), "x-euc-tw", LG_CHINESE_TRAD },
- { N_("Cyrillic (_IBM-855)"), "IBM855", LG_CYRILLIC },
- { N_("Cyrillic (I_SO-8859-5)"), "ISO-8859-5", LG_CYRILLIC },
- { N_("Cyrillic (IS_O-IR-111)"), "ISO-IR-111", LG_CYRILLIC },
- { N_("Cyrillic (_KOI8-R)"), "KOI8-R", LG_CYRILLIC },
- { N_("Cyrillic (_MacCyrillic)"), "x-mac-cyrillic", LG_CYRILLIC },
- { N_("Cyrillic (_Windows-1251)"), "windows-1251", LG_CYRILLIC },
- { N_("Cyrillic/_Russian (IBM-866)"), "IBM866", LG_CYRILLIC },
- { N_("Greek (_ISO-8859-7)"), "ISO-8859-7", LG_GREEK },
- { N_("Greek (_MacGreek)"), "x-mac-greek", LG_GREEK },
- { N_("Greek (_Windows-1253)"), "windows-1253", LG_GREEK },
- { N_("Gujarati (_MacGujarati)"), "x-mac-gujarati", LG_INDIAN },
- { N_("Gurmukhi (Mac_Gurmukhi)"), "x-mac-gurmukhi", LG_INDIAN },
- { N_("Hindi (Mac_Devanagari)"), "x-mac-devanagari", LG_INDIAN },
- { N_("Hebrew (_IBM-862)"), "IBM862", LG_HEBREW },
- { N_("Hebrew (IS_O-8859-8-I)"), "ISO-8859-8-I", LG_HEBREW },
- { N_("Hebrew (_MacHebrew)"), "x-mac-hebrew", LG_HEBREW },
- { N_("Hebrew (_Windows-1255)"), "windows-1255", LG_HEBREW },
- { N_("_Visual Hebrew (ISO-8859-8)"), "ISO-8859-8", LG_HEBREW },
- { N_("Japanese (_EUC-JP)"), "EUC-JP", LG_JAPANESE },
- { N_("Japanese (_ISO-2022-JP)"), "ISO-2022-JP", LG_JAPANESE },
- { N_("Japanese (_Shift-JIS)"), "Shift_JIS", LG_JAPANESE },
- { N_("Korean (_EUC-KR)"), "EUC-KR", LG_KOREAN },
- { N_("Korean (_ISO-2022-KR)"), "ISO-2022-KR", LG_KOREAN },
- { N_("Korean (_JOHAB)"), "x-johab", LG_KOREAN },
- { N_("Korean (_UHC)"), "x-windows-949", LG_KOREAN },
- { N_("_Celtic (ISO-8859-14)"), "ISO-8859-14", LG_NORDIC },
- { N_("_Icelandic (MacIcelandic)"), "x-mac-icelandic", LG_NORDIC },
- { N_("_Nordic (ISO-8859-10)"), "ISO-8859-10", LG_NORDIC },
- { N_("_Persian (MacFarsi)"), "x-mac-farsi", LG_PERSIAN },
- { N_("Croatian (Mac_Croatian)"), "x-mac-croatian", LG_SE_EUROPEAN },
- { N_("_Romanian (MacRomanian)"), "x-mac-romanian", LG_SE_EUROPEAN },
- { N_("R_omanian (ISO-8859-16)"), "ISO-8859-16", LG_SE_EUROPEAN },
- { N_("South _European (ISO-8859-3)"), "ISO-8859-3", LG_SE_EUROPEAN },
- { N_("Thai (TIS-_620)"), "TIS-620", LG_THAI },
- { N_("Thai (IS_O-8859-11)"), "iso-8859-11", LG_THAI },
- { N_("_Thai (Windows-874)"), "windows-874", LG_THAI },
- { N_("Turkish (_IBM-857)"), "IBM857", LG_TURKISH },
- { N_("Turkish (I_SO-8859-9)"), "ISO-8859-9", LG_TURKISH },
- { N_("Turkish (_MacTurkish)"), "x-mac-turkish", LG_TURKISH },
- { N_("Turkish (_Windows-1254)"), "windows-1254", LG_TURKISH },
- { N_("Unicode (UTF-_8)"), "UTF-8", LG_UNICODE },
- { N_("Cyrillic/Ukrainian (_KOI8-U)"), "KOI8-U", LG_UKRAINIAN },
- { N_("Cyrillic/Ukrainian (Mac_Ukrainian)"), "x-mac-ukrainian", LG_UKRAINIAN },
- { N_("Vietnamese (_TCVN)"), "x-viet-tcvn5712", LG_VIETNAMESE },
- { N_("Vietnamese (_VISCII)"), "VISCII", LG_VIETNAMESE },
- { N_("Vietnamese (V_PS)"), "x-viet-vps", LG_VIETNAMESE },
- { N_("Vietnamese (_Windows-1258)"), "windows-1258", LG_VIETNAMESE },
- { N_("Western (_IBM-850)"), "IBM850", LG_WESTERN },
- { N_("Western (_ISO-8859-1)"), "ISO-8859-1", LG_WESTERN },
- { N_("Western (IS_O-8859-15)"), "ISO-8859-15", LG_WESTERN },
- { N_("Western (_MacRoman)"), "x-mac-roman", LG_WESTERN },
- { N_("Western (_Windows-1252)"), "windows-1252", LG_WESTERN },
+{
+ { N_("Arabic (_IBM-864)"), "IBM864", LG_ARABIC },
+ { N_("Arabic (ISO-_8859-6)"), "ISO-8859-6", LG_ARABIC },
+ { N_("Arabic (_MacArabic)"), "x-mac-arabic", LG_ARABIC },
+ { N_("Arabic (_Windows-1256)"), "windows-1256", LG_ARABIC },
+ { N_("Baltic (_ISO-8859-13)"), "ISO-8859-13", LG_BALTIC },
+ { N_("Baltic (I_SO-8859-4)"), "ISO-8859-4", LG_BALTIC },
+ { N_("Baltic (_Windows-1257)"), "windows-1257", LG_BALTIC },
+ { N_("_Armenian (ARMSCII-8)"), "armscii-8", LG_CAUCASIAN },
+ { N_("_Georgian (GEOSTD8)"), "geostd8", LG_CAUCASIAN },
+ { N_("Central European (_IBM-852)"), "IBM852", LG_C_EUROPEAN },
+ { N_("Central European (I_SO-8859-2)"), "ISO-8859-2", LG_C_EUROPEAN },
+ { N_("Central European (_MacCE)"), "x-mac-ce", LG_C_EUROPEAN },
+ { N_("Central European (_Windows-1250)"), "windows-1250", LG_C_EUROPEAN },
+ { N_("Chinese Simplified (_GB18030)"), "gb18030", LG_CHINESE_SIMP },
+ { N_("Chinese Simplified (G_B2312)"), "GB2312", LG_CHINESE_SIMP },
+ { N_("Chinese Simplified (GB_K)"), "x-gbk", LG_CHINESE_SIMP },
+ { N_("Chinese Simplified (_HZ)"), "HZ-GB-2312", LG_CHINESE_SIMP },
+ { N_("Chinese Simplified (_ISO-2022-CN)"), "ISO-2022-CN", LG_CHINESE_SIMP },
+ { N_("Chinese Traditional (Big_5)"), "Big5", LG_CHINESE_TRAD },
+ { N_("Chinese Traditional (Big5-HK_SCS)"), "Big5-HKSCS", LG_CHINESE_TRAD },
+ { N_("Chinese Traditional (_EUC-TW)"), "x-euc-tw", LG_CHINESE_TRAD },
+ { N_("Cyrillic (_IBM-855)"), "IBM855", LG_CYRILLIC },
+ { N_("Cyrillic (I_SO-8859-5)"), "ISO-8859-5", LG_CYRILLIC },
+ { N_("Cyrillic (IS_O-IR-111)"), "ISO-IR-111", LG_CYRILLIC },
+ { N_("Cyrillic (_KOI8-R)"), "KOI8-R", LG_CYRILLIC },
+ { N_("Cyrillic (_MacCyrillic)"), "x-mac-cyrillic", LG_CYRILLIC },
+ { N_("Cyrillic (_Windows-1251)"), "windows-1251", LG_CYRILLIC },
+ { N_("Cyrillic/_Russian (IBM-866)"), "IBM866", LG_CYRILLIC },
+ { N_("Greek (_ISO-8859-7)"), "ISO-8859-7", LG_GREEK },
+ { N_("Greek (_MacGreek)"), "x-mac-greek", LG_GREEK },
+ { N_("Greek (_Windows-1253)"), "windows-1253", LG_GREEK },
+ { N_("Gujarati (_MacGujarati)"), "x-mac-gujarati", LG_INDIAN },
+ { N_("Gurmukhi (Mac_Gurmukhi)"), "x-mac-gurmukhi", LG_INDIAN },
+ { N_("Hindi (Mac_Devanagari)"), "x-mac-devanagari", LG_INDIAN },
+ { N_("Hebrew (_IBM-862)"), "IBM862", LG_HEBREW },
+ { N_("Hebrew (IS_O-8859-8-I)"), "ISO-8859-8-I", LG_HEBREW },
+ { N_("Hebrew (_MacHebrew)"), "x-mac-hebrew", LG_HEBREW },
+ { N_("Hebrew (_Windows-1255)"), "windows-1255", LG_HEBREW },
+ { N_("_Visual Hebrew (ISO-8859-8)"), "ISO-8859-8", LG_HEBREW },
+ { N_("Japanese (_EUC-JP)"), "EUC-JP", LG_JAPANESE },
+ { N_("Japanese (_ISO-2022-JP)"), "ISO-2022-JP", LG_JAPANESE },
+ { N_("Japanese (_Shift-JIS)"), "Shift_JIS", LG_JAPANESE },
+ { N_("Korean (_EUC-KR)"), "EUC-KR", LG_KOREAN },
+ { N_("Korean (_ISO-2022-KR)"), "ISO-2022-KR", LG_KOREAN },
+ { N_("Korean (_JOHAB)"), "x-johab", LG_KOREAN },
+ { N_("Korean (_UHC)"), "x-windows-949", LG_KOREAN },
+ { N_("_Celtic (ISO-8859-14)"), "ISO-8859-14", LG_NORDIC },
+ { N_("_Icelandic (MacIcelandic)"), "x-mac-icelandic", LG_NORDIC },
+ { N_("_Nordic (ISO-8859-10)"), "ISO-8859-10", LG_NORDIC },
+ { N_("_Persian (MacFarsi)"), "x-mac-farsi", LG_PERSIAN },
+ { N_("Croatian (Mac_Croatian)"), "x-mac-croatian", LG_SE_EUROPEAN },
+ { N_("_Romanian (MacRomanian)"), "x-mac-romanian", LG_SE_EUROPEAN },
+ { N_("R_omanian (ISO-8859-16)"), "ISO-8859-16", LG_SE_EUROPEAN },
+ { N_("South _European (ISO-8859-3)"), "ISO-8859-3", LG_SE_EUROPEAN },
+ { N_("Thai (TIS-_620)"), "TIS-620", LG_THAI },
+ { N_("Thai (IS_O-8859-11)"), "iso-8859-11", LG_THAI },
+ { N_("_Thai (Windows-874)"), "windows-874", LG_THAI },
+ { N_("Turkish (_IBM-857)"), "IBM857", LG_TURKISH },
+ { N_("Turkish (I_SO-8859-9)"), "ISO-8859-9", LG_TURKISH },
+ { N_("Turkish (_MacTurkish)"), "x-mac-turkish", LG_TURKISH },
+ { N_("Turkish (_Windows-1254)"), "windows-1254", LG_TURKISH },
+ { N_("Unicode (UTF-_8)"), "UTF-8", LG_UNICODE },
+ { N_("Cyrillic/Ukrainian (_KOI8-U)"), "KOI8-U", LG_UKRAINIAN },
+ { N_("Cyrillic/Ukrainian (Mac_Ukrainian)"), "x-mac-ukrainian", LG_UKRAINIAN },
+ { N_("Vietnamese (_TCVN)"), "x-viet-tcvn5712", LG_VIETNAMESE },
+ { N_("Vietnamese (_VISCII)"), "VISCII", LG_VIETNAMESE },
+ { N_("Vietnamese (V_PS)"), "x-viet-vps", LG_VIETNAMESE },
+ { N_("Vietnamese (_Windows-1258)"), "windows-1258", LG_VIETNAMESE },
+ { N_("Western (_IBM-850)"), "IBM850", LG_WESTERN },
+ { N_("Western (_ISO-8859-1)"), "ISO-8859-1", LG_WESTERN },
+ { N_("Western (IS_O-8859-15)"), "ISO-8859-15", LG_WESTERN },
+ { N_("Western (_MacRoman)"), "x-mac-roman", LG_WESTERN },
+ { N_("Western (_Windows-1252)"), "windows-1252", LG_WESTERN },
/* The following encodings are so rarely used that we don't want to
* pollute the "related" part of the encodings menu with them, so we
* set the language group to 0 here.
*/
- { N_("English (_US-ASCII)"), "us-ascii", 0 },
- { N_("Unicode (UTF-_16 BE)"), "UTF-16BE", 0 },
- { N_("Unicode (UTF-1_6 LE)"), "UTF-16LE", 0 },
- { N_("Unicode (UTF-_32 BE)"), "UTF-32BE", 0 },
- { N_("Unicode (UTF-3_2 LE)"), "UTF-32LE", 0 },
+ { N_("English (_US-ASCII)"), "us-ascii", 0 },
+ { N_("Unicode (UTF-_16 BE)"), "UTF-16BE", 0 },
+ { N_("Unicode (UTF-1_6 LE)"), "UTF-16LE", 0 },
+ { N_("Unicode (UTF-_32 BE)"), "UTF-32BE", 0 },
+ { N_("Unicode (UTF-3_2 LE)"), "UTF-32LE", 0 },
};
#define RECENT_MAX 4
@@ -183,9 +180,9 @@ ephy_encodings_class_init (EphyEncodingsClass *klass)
}
static EphyEncoding *
-add_encoding (EphyEncodings *encodings,
- const char *title,
- const char *code,
+add_encoding (EphyEncodings *encodings,
+ const char *title,
+ const char *code,
EphyLanguageGroup groups)
{
EphyEncoding *encoding;
@@ -202,8 +199,8 @@ add_encoding (EphyEncodings *encodings,
EphyEncoding *
ephy_encodings_get_encoding (EphyEncodings *encodings,
- const char *code,
- gboolean add_if_not_found)
+ const char *code,
+ gboolean add_if_not_found)
{
EphyEncoding *encoding;
@@ -236,16 +233,16 @@ get_encodings_foreach (gpointer key,
gpointer value,
gpointer user_data)
{
- GetEncodingsData *data = (GetEncodingsData*)user_data;
+ GetEncodingsData *data = (GetEncodingsData *)user_data;
EphyLanguageGroup group;
-
+
group = ephy_encoding_get_language_groups (EPHY_ENCODING (value));
if ((group & data->group_mask) != 0)
data->list = g_list_prepend (data->list, value);
}
GList *
-ephy_encodings_get_encodings (EphyEncodings *encodings,
+ephy_encodings_get_encodings (EphyEncodings *encodings,
EphyLanguageGroup group_mask)
{
GList *list = NULL;
@@ -264,7 +261,7 @@ get_all_encodings (gpointer key,
gpointer value,
gpointer user_data)
{
- GList **l = (GList**)user_data;
+ GList **l = (GList **)user_data;
*l = g_list_prepend (*l, value);
}
@@ -283,14 +280,14 @@ ephy_encodings_get_all (EphyEncodings *encodings)
void
ephy_encodings_add_recent (EphyEncodings *encodings,
- const char *code)
+ const char *code)
{
GSList *element, *l;
GVariantBuilder builder;
g_return_if_fail (EPHY_IS_ENCODINGS (encodings));
g_return_if_fail (code != NULL);
-
+
if (ephy_encodings_get_encoding (encodings, code, FALSE) == NULL)
return;
@@ -368,7 +365,7 @@ ephy_encodings_init (EphyEncodings *encodings)
/* Get the list of recently used encodings. */
list = g_settings_get_strv (EPHY_SETTINGS_STATE,
- EPHY_PREFS_STATE_RECENT_ENCODINGS);
+ EPHY_PREFS_STATE_RECENT_ENCODINGS);
/* Make sure the list has no duplicates (GtkUIManager goes
* crazy otherwise), and only valid entries.
diff --git a/embed/ephy-file-monitor.c b/embed/ephy-file-monitor.c
index 7e2e069ec..7bd377dfa 100644
--- a/embed/ephy-file-monitor.c
+++ b/embed/ephy-file-monitor.c
@@ -27,8 +27,7 @@
#define RELOAD_DELAY 250 /* ms */
#define RELOAD_DELAY_MAX_TICKS 40 /* RELOAD_DELAY * RELOAD_DELAY_MAX_TICKS = 10 s */
-struct _EphyFileMonitor
-{
+struct _EphyFileMonitor {
GObject parent;
GFileMonitor *monitor;
@@ -100,11 +99,11 @@ ephy_file_monitor_reload_cb (EphyFileMonitor *monitor)
}
static void
-ephy_file_monitor_changed_cb (GFileMonitor *monitor,
- GFile *file,
- GFile *other_file,
+ephy_file_monitor_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
GFileMonitorEvent event_type,
- EphyFileMonitor *file_monitor)
+ EphyFileMonitor *file_monitor)
{
gboolean should_reload;
@@ -162,7 +161,7 @@ ephy_file_monitor_changed_cb (GFileMonitor *monitor,
void
ephy_file_monitor_update_location (EphyFileMonitor *file_monitor,
- const char *address)
+ const char *address)
{
gboolean local;
char *anchor;
@@ -207,8 +206,7 @@ ephy_file_monitor_update_location (EphyFileMonitor *file_monitor,
file_monitor);
file_monitor->monitor_directory = TRUE;
LOG ("Installed monitor for directory '%s'", url);
- }
- else if (file_type == G_FILE_TYPE_REGULAR) {
+ } else if (file_type == G_FILE_TYPE_REGULAR) {
file_monitor->monitor = g_file_monitor_file (file, 0, NULL, NULL);
g_signal_connect (file_monitor->monitor, "changed",
G_CALLBACK (ephy_file_monitor_changed_cb),
@@ -230,9 +228,9 @@ ephy_file_monitor_dispose (GObject *object)
}
static void
-ephy_file_monitor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
+ephy_file_monitor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
EphyFileMonitor *monitor = EPHY_FILE_MONITOR (object);
@@ -242,16 +240,16 @@ ephy_file_monitor_get_property (GObject *object,
g_value_set_object (value, monitor->view);
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
-ephy_file_monitor_set_property (GObject *object,
- guint prop_id,
+ephy_file_monitor_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
EphyFileMonitor *monitor = EPHY_FILE_MONITOR (object);
@@ -260,7 +258,7 @@ ephy_file_monitor_set_property (GObject *object,
monitor->view = g_value_get_object (value);
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@@ -276,10 +274,10 @@ ephy_file_monitor_class_init (EphyFileMonitorClass *klass)
obj_properties[PROP_VIEW] =
g_param_spec_object ("view",
- "View",
- "The file monitor's associated view",
- EPHY_TYPE_WEB_VIEW,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+ "View",
+ "The file monitor's associated view",
+ EPHY_TYPE_WEB_VIEW,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, LAST_PROP, obj_properties);
}
diff --git a/embed/ephy-find-toolbar.c b/embed/ephy-find-toolbar.c
index 54d2c75dd..0efe2e876 100644
--- a/embed/ephy-find-toolbar.c
+++ b/embed/ephy-find-toolbar.c
@@ -31,55 +31,50 @@
#include <string.h>
#include <webkit2/webkit2.h>
-struct _EphyFindToolbar
-{
- GtkSearchBar parent_instance;
-
- WebKitWebView *web_view;
- WebKitFindController *controller;
- GtkWidget *entry;
- GtkWidget *next;
- GtkWidget *prev;
- guint find_again_source_id;
- guint find_source_id;
- char *find_string;
- guint preedit_changed : 1;
- guint prevent_activate : 1;
- guint activated : 1;
- guint links_only : 1;
- guint typing_ahead : 1;
+struct _EphyFindToolbar {
+ GtkSearchBar parent_instance;
+
+ WebKitWebView *web_view;
+ WebKitFindController *controller;
+ GtkWidget *entry;
+ GtkWidget *next;
+ GtkWidget *prev;
+ guint find_again_source_id;
+ guint find_source_id;
+ char *find_string;
+ guint preedit_changed : 1;
+ guint prevent_activate : 1;
+ guint activated : 1;
+ guint links_only : 1;
+ guint typing_ahead : 1;
};
G_DEFINE_TYPE (EphyFindToolbar, ephy_find_toolbar, GTK_TYPE_SEARCH_BAR)
-enum
-{
- PROP_0,
- PROP_WEB_VIEW,
- LAST_PROP
+enum {
+ PROP_0,
+ PROP_WEB_VIEW,
+ LAST_PROP
};
static GParamSpec *obj_properties[LAST_PROP];
-enum
-{
- CLOSE,
- LAST_SIGNAL
+enum {
+ CLOSE,
+ LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
-typedef enum
-{
- EPHY_FIND_RESULT_FOUND = 0,
- EPHY_FIND_RESULT_NOTFOUND = 1,
- EPHY_FIND_RESULT_FOUNDWRAPPED = 2
+typedef enum {
+ EPHY_FIND_RESULT_FOUND = 0,
+ EPHY_FIND_RESULT_NOTFOUND = 1,
+ EPHY_FIND_RESULT_FOUNDWRAPPED = 2
} EphyFindResult;
-typedef enum
-{
- EPHY_FIND_DIRECTION_NEXT,
- EPHY_FIND_DIRECTION_PREV
+typedef enum {
+ EPHY_FIND_DIRECTION_NEXT,
+ EPHY_FIND_DIRECTION_PREV
} EphyFindDirection;
/* private functions */
@@ -88,253 +83,239 @@ static void ephy_find_toolbar_set_web_view (EphyFindToolbar *toolbar, WebKitWebV
static void
set_status (EphyFindToolbar *toolbar,
- EphyFindResult result)
-{
- const char *icon_name = "edit-find-symbolic";
- const char *tooltip = NULL;
-
- switch (result)
- {
- case EPHY_FIND_RESULT_FOUND:
- break;
- case EPHY_FIND_RESULT_NOTFOUND:
- icon_name = "face-uncertain-symbolic";
- tooltip = _("Text not found");
- gtk_widget_error_bell (GTK_WIDGET (toolbar));
-
- break;
- case EPHY_FIND_RESULT_FOUNDWRAPPED:
- icon_name = "view-wrapped-symbolic";
- tooltip = _("Search wrapped back to the top");
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- gtk_widget_set_sensitive (toolbar->prev, result != EPHY_FIND_RESULT_NOTFOUND);
- gtk_widget_set_sensitive (toolbar->next, result != EPHY_FIND_RESULT_NOTFOUND);
-
- g_object_set (toolbar->entry,
- "primary-icon-name", icon_name,
- "primary-icon-activatable", FALSE,
- "primary-icon-sensitive", FALSE,
- "primary-icon-tooltip-text", tooltip,
- NULL);
+ EphyFindResult result)
+{
+ const char *icon_name = "edit-find-symbolic";
+ const char *tooltip = NULL;
+
+ switch (result) {
+ case EPHY_FIND_RESULT_FOUND:
+ break;
+ case EPHY_FIND_RESULT_NOTFOUND:
+ icon_name = "face-uncertain-symbolic";
+ tooltip = _("Text not found");
+ gtk_widget_error_bell (GTK_WIDGET (toolbar));
+
+ break;
+ case EPHY_FIND_RESULT_FOUNDWRAPPED:
+ icon_name = "view-wrapped-symbolic";
+ tooltip = _("Search wrapped back to the top");
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ gtk_widget_set_sensitive (toolbar->prev, result != EPHY_FIND_RESULT_NOTFOUND);
+ gtk_widget_set_sensitive (toolbar->next, result != EPHY_FIND_RESULT_NOTFOUND);
+
+ g_object_set (toolbar->entry,
+ "primary-icon-name", icon_name,
+ "primary-icon-activatable", FALSE,
+ "primary-icon-sensitive", FALSE,
+ "primary-icon-tooltip-text", tooltip,
+ NULL);
}
static void
clear_status (EphyFindToolbar *toolbar)
{
- g_object_set (toolbar->entry,
- "primary-icon-name", "edit-find-symbolic",
- NULL);
+ g_object_set (toolbar->entry,
+ "primary-icon-name", "edit-find-symbolic",
+ NULL);
- gtk_widget_set_sensitive (toolbar->prev, FALSE);
- gtk_widget_set_sensitive (toolbar->next, FALSE);
+ gtk_widget_set_sensitive (toolbar->prev, FALSE);
+ gtk_widget_set_sensitive (toolbar->next, FALSE);
- if (toolbar->web_view == NULL) return;
+ if (toolbar->web_view == NULL) return;
- webkit_find_controller_search_finish (toolbar->controller);
+ webkit_find_controller_search_finish (toolbar->controller);
}
/* Code adapted from gtktreeview.c:gtk_tree_view_key_press() and
* gtk_tree_view_real_start_interactive_seach()
*/
static gboolean
-tab_search_key_press_cb (WebKitWebView *web_view,
- GdkEventKey *event,
- EphyFindToolbar *toolbar)
+tab_search_key_press_cb (WebKitWebView *web_view,
+ GdkEventKey *event,
+ EphyFindToolbar *toolbar)
{
- GtkWidget *widget = (GtkWidget *) toolbar;
-
- g_return_val_if_fail (event != NULL, FALSE);
-
- /* check for / and ' which open the find toolbar in text resp. link mode */
- if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (widget)) == FALSE)
- {
- if (event->keyval == GDK_KEY_slash)
- {
- ephy_find_toolbar_open (toolbar, FALSE, TRUE);
- return TRUE;
- }
- else if (event->keyval == GDK_KEY_apostrophe)
- {
- ephy_find_toolbar_open (toolbar, TRUE, TRUE);
- return TRUE;
- }
- }
-
- return FALSE;
+ GtkWidget *widget = (GtkWidget *)toolbar;
+
+ g_return_val_if_fail (event != NULL, FALSE);
+
+ /* check for / and ' which open the find toolbar in text resp. link mode */
+ if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (widget)) == FALSE) {
+ if (event->keyval == GDK_KEY_slash) {
+ ephy_find_toolbar_open (toolbar, FALSE, TRUE);
+ return TRUE;
+ } else if (event->keyval == GDK_KEY_apostrophe) {
+ ephy_find_toolbar_open (toolbar, TRUE, TRUE);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
static void
-real_find (EphyFindToolbar *toolbar,
+real_find (EphyFindToolbar *toolbar,
EphyFindDirection direction)
{
- WebKitFindOptions options = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE;
+ WebKitFindOptions options = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE;
- if (!g_strcmp0 (toolbar->find_string, ""))
- return;
+ if (!g_strcmp0 (toolbar->find_string, ""))
+ return;
- if (direction == EPHY_FIND_DIRECTION_PREV)
- options |= WEBKIT_FIND_OPTIONS_BACKWARDS;
+ if (direction == EPHY_FIND_DIRECTION_PREV)
+ options |= WEBKIT_FIND_OPTIONS_BACKWARDS;
- webkit_find_controller_search (toolbar->controller, toolbar->find_string, options, G_MAXUINT);
+ webkit_find_controller_search (toolbar->controller, toolbar->find_string, options, G_MAXUINT);
}
static gboolean
do_search (EphyFindToolbar *toolbar)
{
- toolbar->find_source_id = 0;
+ toolbar->find_source_id = 0;
- real_find (toolbar, EPHY_FIND_DIRECTION_NEXT);
+ real_find (toolbar, EPHY_FIND_DIRECTION_NEXT);
- return FALSE;
+ return FALSE;
}
static void
found_text_cb (WebKitFindController *controller,
- guint n_matches,
- EphyFindToolbar *toolbar)
+ guint n_matches,
+ EphyFindToolbar *toolbar)
{
- WebKitFindOptions options;
- EphyFindResult result;
+ WebKitFindOptions options;
+ EphyFindResult result;
- options = webkit_find_controller_get_options (controller);
- /* FIXME: it's not possible to remove the wrap flag, so the status is now always wrapped. */
- result = options & WEBKIT_FIND_OPTIONS_WRAP_AROUND ? EPHY_FIND_RESULT_FOUNDWRAPPED : EPHY_FIND_RESULT_FOUND;
- set_status (toolbar, result);
+ options = webkit_find_controller_get_options (controller);
+ /* FIXME: it's not possible to remove the wrap flag, so the status is now always wrapped. */
+ result = options & WEBKIT_FIND_OPTIONS_WRAP_AROUND ? EPHY_FIND_RESULT_FOUNDWRAPPED : EPHY_FIND_RESULT_FOUND;
+ set_status (toolbar, result);
}
static void
failed_to_find_text_cb (WebKitFindController *controller,
- EphyFindToolbar *toolbar)
+ EphyFindToolbar *toolbar)
{
- WebKitFindOptions options;
+ WebKitFindOptions options;
- options = webkit_find_controller_get_options (controller);
- if (options & WEBKIT_FIND_OPTIONS_WRAP_AROUND) {
- set_status (toolbar, EPHY_FIND_RESULT_NOTFOUND);
- return;
- }
+ options = webkit_find_controller_get_options (controller);
+ if (options & WEBKIT_FIND_OPTIONS_WRAP_AROUND) {
+ set_status (toolbar, EPHY_FIND_RESULT_NOTFOUND);
+ return;
+ }
- options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
- webkit_find_controller_search (controller, toolbar->find_string, options, G_MAXUINT);
+ options |= WEBKIT_FIND_OPTIONS_WRAP_AROUND;
+ webkit_find_controller_search (controller, toolbar->find_string, options, G_MAXUINT);
}
static void
update_find_string (EphyFindToolbar *toolbar)
{
- g_free (toolbar->find_string);
- toolbar->find_string = g_strdup (gtk_entry_get_text (GTK_ENTRY (toolbar->entry)));
+ g_free (toolbar->find_string);
+ toolbar->find_string = g_strdup (gtk_entry_get_text (GTK_ENTRY (toolbar->entry)));
- if (toolbar->find_source_id != 0) {
- g_source_remove (toolbar->find_source_id);
- toolbar->find_source_id = 0;
- }
+ if (toolbar->find_source_id != 0) {
+ g_source_remove (toolbar->find_source_id);
+ toolbar->find_source_id = 0;
+ }
- if (strlen (toolbar->find_string) == 0) {
- clear_status (toolbar);
- return;
- }
+ if (strlen (toolbar->find_string) == 0) {
+ clear_status (toolbar);
+ return;
+ }
- toolbar->find_source_id = g_timeout_add (300, (GSourceFunc)do_search, toolbar);
- g_source_set_name_by_id (toolbar->find_source_id, "[epiphany] do_search");
+ toolbar->find_source_id = g_timeout_add (300, (GSourceFunc)do_search, toolbar);
+ g_source_set_name_by_id (toolbar->find_source_id, "[epiphany] do_search");
}
static gboolean
ephy_find_toolbar_activate_link (EphyFindToolbar *toolbar,
- GdkModifierType mask)
+ GdkModifierType mask)
{
- return FALSE;
+ return FALSE;
}
static gboolean
-entry_key_press_event_cb (GtkEntry *entry,
- GdkEventKey *event,
- EphyFindToolbar *toolbar)
-{
- guint mask = gtk_accelerator_get_default_mod_mask ();
- gboolean handled = FALSE;
-
- if ((event->state & mask) == 0)
- {
- handled = TRUE;
- switch (event->keyval)
- {
- case GDK_KEY_Escape:
- /* Hide the toolbar when ESC is pressed */
- ephy_find_toolbar_request_close (toolbar);
- break;
- default:
- handled = FALSE;
- break;
- }
- }
- else if ((event->state & mask) == GDK_CONTROL_MASK &&
- (event->keyval == GDK_KEY_Return ||
- event->keyval == GDK_KEY_KP_Enter ||
- event->keyval == GDK_KEY_ISO_Enter))
- {
- handled = ephy_find_toolbar_activate_link (toolbar, event->state);
- }
- else if ((event->state & mask) == GDK_SHIFT_MASK &&
- (event->keyval == GDK_KEY_Return ||
- event->keyval == GDK_KEY_KP_Enter ||
- event->keyval == GDK_KEY_ISO_Enter))
- {
- handled = TRUE;
- ephy_find_toolbar_find_previous (toolbar);
- }
-
- return handled;
+entry_key_press_event_cb (GtkEntry *entry,
+ GdkEventKey *event,
+ EphyFindToolbar *toolbar)
+{
+ guint mask = gtk_accelerator_get_default_mod_mask ();
+ gboolean handled = FALSE;
+
+ if ((event->state & mask) == 0) {
+ handled = TRUE;
+ switch (event->keyval) {
+ case GDK_KEY_Escape:
+ /* Hide the toolbar when ESC is pressed */
+ ephy_find_toolbar_request_close (toolbar);
+ break;
+ default:
+ handled = FALSE;
+ break;
+ }
+ } else if ((event->state & mask) == GDK_CONTROL_MASK &&
+ (event->keyval == GDK_KEY_Return ||
+ event->keyval == GDK_KEY_KP_Enter ||
+ event->keyval == GDK_KEY_ISO_Enter)) {
+ handled = ephy_find_toolbar_activate_link (toolbar, event->state);
+ } else if ((event->state & mask) == GDK_SHIFT_MASK &&
+ (event->keyval == GDK_KEY_Return ||
+ event->keyval == GDK_KEY_KP_Enter ||
+ event->keyval == GDK_KEY_ISO_Enter)) {
+ handled = TRUE;
+ ephy_find_toolbar_find_previous (toolbar);
+ }
+
+ return handled;
}
static void
-entry_activate_cb (GtkWidget *entry,
- EphyFindToolbar *toolbar)
-{
- if (toolbar->typing_ahead)
- {
- ephy_find_toolbar_activate_link (toolbar, 0);
- }
- else
- {
- ephy_find_toolbar_find_next (toolbar);
- }
+entry_activate_cb (GtkWidget *entry,
+ EphyFindToolbar *toolbar)
+{
+ if (toolbar->typing_ahead) {
+ ephy_find_toolbar_activate_link (toolbar, 0);
+ } else {
+ ephy_find_toolbar_find_next (toolbar);
+ }
}
static void
ephy_find_toolbar_grab_focus (GtkWidget *widget)
{
- EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (widget);
+ EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (widget);
- gtk_widget_grab_focus (toolbar->entry);
+ gtk_widget_grab_focus (toolbar->entry);
}
static gboolean
ephy_find_toolbar_draw (GtkWidget *widget,
- cairo_t *cr)
+ cairo_t *cr)
{
- GtkStyleContext *context;
+ GtkStyleContext *context;
- context = gtk_widget_get_style_context (widget);
+ context = gtk_widget_get_style_context (widget);
- gtk_style_context_save (context);
- gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget));
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget));
- gtk_render_background (context, cr, 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
+ gtk_render_background (context, cr, 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
- gtk_render_frame (context, cr, 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
+ gtk_render_frame (context, cr, 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
- gtk_style_context_restore (context);
+ gtk_style_context_restore (context);
- return GTK_WIDGET_CLASS (ephy_find_toolbar_parent_class)->draw (widget, cr);
+ return GTK_WIDGET_CLASS (ephy_find_toolbar_parent_class)->draw (widget, cr);
}
static void
@@ -345,159 +326,155 @@ search_entry_clear_cb (GtkEntry *entry,
}
static void
-search_entry_changed_cb (GtkEntry *entry,
+search_entry_changed_cb (GtkEntry *entry,
EphyFindToolbar *toolbar)
{
- const char *str;
- const char *primary_icon_name = "edit-find-symbolic";
- const char *secondary_icon_name = NULL;
- gboolean primary_active = FALSE;
- gboolean secondary_active = FALSE;
-
- str = gtk_entry_get_text (entry);
-
- if (str == NULL || *str == '\0') {
- primary_icon_name = "edit-find-symbolic";
- } else {
- secondary_icon_name = "edit-clear-symbolic";
- secondary_active = TRUE;
- }
-
- g_object_set (entry,
- "primary-icon-name", primary_icon_name,
- "primary-icon-activatable", primary_active,
- "primary-icon-sensitive", primary_active,
- "secondary-icon-name", secondary_icon_name,
- "secondary-icon-activatable", secondary_active,
- "secondary-icon-sensitive", secondary_active,
- NULL);
-
- update_find_string (toolbar);
+ const char *str;
+ const char *primary_icon_name = "edit-find-symbolic";
+ const char *secondary_icon_name = NULL;
+ gboolean primary_active = FALSE;
+ gboolean secondary_active = FALSE;
+
+ str = gtk_entry_get_text (entry);
+
+ if (str == NULL || *str == '\0') {
+ primary_icon_name = "edit-find-symbolic";
+ } else {
+ secondary_icon_name = "edit-clear-symbolic";
+ secondary_active = TRUE;
+ }
+
+ g_object_set (entry,
+ "primary-icon-name", primary_icon_name,
+ "primary-icon-activatable", primary_active,
+ "primary-icon-sensitive", primary_active,
+ "secondary-icon-name", secondary_icon_name,
+ "secondary-icon-activatable", secondary_active,
+ "secondary-icon-sensitive", secondary_active,
+ NULL);
+
+ update_find_string (toolbar);
}
static void
ephy_find_toolbar_load_changed_cb (WebKitWebView *web_view,
- WebKitLoadEvent load_event,
- EphyFindToolbar *toolbar)
+ WebKitLoadEvent load_event,
+ EphyFindToolbar *toolbar)
{
- if (load_event == WEBKIT_LOAD_STARTED &&
- gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (toolbar)))
- {
- ephy_find_toolbar_close (toolbar);
- }
+ if (load_event == WEBKIT_LOAD_STARTED &&
+ gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (toolbar))) {
+ ephy_find_toolbar_close (toolbar);
+ }
}
static void
ephy_find_toolbar_init (EphyFindToolbar *toolbar)
{
- GtkWidget *box;
- GtkSizeGroup *size_group;
-
- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_style_context_add_class (gtk_widget_get_style_context (box),
- GTK_STYLE_CLASS_RAISED);
- gtk_style_context_add_class (gtk_widget_get_style_context (box),
- GTK_STYLE_CLASS_LINKED);
- gtk_container_add (GTK_CONTAINER (toolbar), box);
-
- toolbar->entry = gtk_entry_new ();
- gtk_entry_set_width_chars (GTK_ENTRY (toolbar->entry), 32);
- gtk_entry_set_max_length (GTK_ENTRY (toolbar->entry), 512);
- gtk_entry_set_placeholder_text (GTK_ENTRY (toolbar->entry), _("Type to search…"));
- gtk_container_add (GTK_CONTAINER (box), toolbar->entry);
-
- /* Prev */
- toolbar->prev = gtk_button_new_from_icon_name ("go-up-symbolic", GTK_ICON_SIZE_MENU);
- gtk_widget_set_tooltip_text (toolbar->prev,
- _("Find previous occurrence of the search string"));
- gtk_container_add (GTK_CONTAINER (box), toolbar->prev);
- gtk_widget_show_all (toolbar->prev);
- gtk_widget_set_sensitive (toolbar->prev, FALSE);
-
- /* Next */
- toolbar->next = gtk_button_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
- gtk_widget_set_tooltip_text (toolbar->next,
- _("Find next occurrence of the search string"));
- gtk_container_add (GTK_CONTAINER (box), toolbar->next);
- gtk_widget_set_sensitive (toolbar->next, FALSE);
-
- gtk_size_group_add_widget (size_group, toolbar->entry);
- gtk_size_group_add_widget (size_group, toolbar->next);
- gtk_size_group_add_widget (size_group, toolbar->prev);
- g_object_unref (size_group);
-
- /* connect signals */
- g_signal_connect (toolbar->entry, "icon-release",
- G_CALLBACK (search_entry_clear_cb), toolbar);
- g_signal_connect (toolbar->entry, "key-press-event",
- G_CALLBACK (entry_key_press_event_cb), toolbar);
- g_signal_connect_after (toolbar->entry, "changed",
- G_CALLBACK (search_entry_changed_cb), toolbar);
- g_signal_connect (toolbar->entry, "activate",
- G_CALLBACK (entry_activate_cb), toolbar);
- g_signal_connect_swapped (toolbar->next, "clicked",
- G_CALLBACK (ephy_find_toolbar_find_next), toolbar);
- g_signal_connect_swapped (toolbar->prev, "clicked",
- G_CALLBACK (ephy_find_toolbar_find_previous), toolbar);
- gtk_search_bar_connect_entry (GTK_SEARCH_BAR (toolbar),
- GTK_ENTRY (toolbar->entry));
-
- search_entry_changed_cb (GTK_ENTRY (toolbar->entry), toolbar);
-
- gtk_widget_show_all (GTK_WIDGET (toolbar));
+ GtkWidget *box;
+ GtkSizeGroup *size_group;
+
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_style_context_add_class (gtk_widget_get_style_context (box),
+ GTK_STYLE_CLASS_RAISED);
+ gtk_style_context_add_class (gtk_widget_get_style_context (box),
+ GTK_STYLE_CLASS_LINKED);
+ gtk_container_add (GTK_CONTAINER (toolbar), box);
+
+ toolbar->entry = gtk_entry_new ();
+ gtk_entry_set_width_chars (GTK_ENTRY (toolbar->entry), 32);
+ gtk_entry_set_max_length (GTK_ENTRY (toolbar->entry), 512);
+ gtk_entry_set_placeholder_text (GTK_ENTRY (toolbar->entry), _("Type to search…"));
+ gtk_container_add (GTK_CONTAINER (box), toolbar->entry);
+
+ /* Prev */
+ toolbar->prev = gtk_button_new_from_icon_name ("go-up-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_tooltip_text (toolbar->prev,
+ _("Find previous occurrence of the search string"));
+ gtk_container_add (GTK_CONTAINER (box), toolbar->prev);
+ gtk_widget_show_all (toolbar->prev);
+ gtk_widget_set_sensitive (toolbar->prev, FALSE);
+
+ /* Next */
+ toolbar->next = gtk_button_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_tooltip_text (toolbar->next,
+ _("Find next occurrence of the search string"));
+ gtk_container_add (GTK_CONTAINER (box), toolbar->next);
+ gtk_widget_set_sensitive (toolbar->next, FALSE);
+
+ gtk_size_group_add_widget (size_group, toolbar->entry);
+ gtk_size_group_add_widget (size_group, toolbar->next);
+ gtk_size_group_add_widget (size_group, toolbar->prev);
+ g_object_unref (size_group);
+
+ /* connect signals */
+ g_signal_connect (toolbar->entry, "icon-release",
+ G_CALLBACK (search_entry_clear_cb), toolbar);
+ g_signal_connect (toolbar->entry, "key-press-event",
+ G_CALLBACK (entry_key_press_event_cb), toolbar);
+ g_signal_connect_after (toolbar->entry, "changed",
+ G_CALLBACK (search_entry_changed_cb), toolbar);
+ g_signal_connect (toolbar->entry, "activate",
+ G_CALLBACK (entry_activate_cb), toolbar);
+ g_signal_connect_swapped (toolbar->next, "clicked",
+ G_CALLBACK (ephy_find_toolbar_find_next), toolbar);
+ g_signal_connect_swapped (toolbar->prev, "clicked",
+ G_CALLBACK (ephy_find_toolbar_find_previous), toolbar);
+ gtk_search_bar_connect_entry (GTK_SEARCH_BAR (toolbar),
+ GTK_ENTRY (toolbar->entry));
+
+ search_entry_changed_cb (GTK_ENTRY (toolbar->entry), toolbar);
+
+ gtk_widget_show_all (GTK_WIDGET (toolbar));
}
static void
ephy_find_toolbar_dispose (GObject *object)
{
- EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (object);
+ EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (object);
- if (toolbar->find_again_source_id != 0)
- {
- g_source_remove (toolbar->find_again_source_id);
- toolbar->find_again_source_id = 0;
- }
+ if (toolbar->find_again_source_id != 0) {
+ g_source_remove (toolbar->find_again_source_id);
+ toolbar->find_again_source_id = 0;
+ }
- if (toolbar->find_source_id != 0)
- {
- g_source_remove (toolbar->find_source_id);
- toolbar->find_source_id = 0;
- }
+ if (toolbar->find_source_id != 0) {
+ g_source_remove (toolbar->find_source_id);
+ toolbar->find_source_id = 0;
+ }
- G_OBJECT_CLASS (ephy_find_toolbar_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ephy_find_toolbar_parent_class)->dispose (object);
}
#ifndef G_DISABLE_ASSERT
G_GNUC_NORETURN
#endif
static void
-ephy_find_toolbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ephy_find_toolbar_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- /* no readable properties */
- g_assert_not_reached ();
+ /* no readable properties */
+ g_assert_not_reached ();
}
static void
-ephy_find_toolbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (object);
-
- switch (prop_id)
- {
- case PROP_WEB_VIEW:
- ephy_find_toolbar_set_web_view (toolbar, (WebKitWebView *) g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
+ephy_find_toolbar_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (object);
+
+ switch (prop_id) {
+ case PROP_WEB_VIEW:
+ ephy_find_toolbar_set_web_view (toolbar, (WebKitWebView *)g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
static void
@@ -513,32 +490,32 @@ ephy_find_toolbar_finalize (GObject *o)
static void
ephy_find_toolbar_class_init (EphyFindToolbarClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->dispose = ephy_find_toolbar_dispose;
- object_class->finalize = ephy_find_toolbar_finalize;
- object_class->get_property = ephy_find_toolbar_get_property;
- object_class->set_property = ephy_find_toolbar_set_property;
-
- widget_class->draw = ephy_find_toolbar_draw;
- widget_class->grab_focus = ephy_find_toolbar_grab_focus;
-
- signals[CLOSE] =
- g_signal_new ("close",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE, 0);
-
- obj_properties[PROP_WEB_VIEW] =
- g_param_spec_object ("web-view",
- "WebView",
- "Parent web view",
- WEBKIT_TYPE_WEB_VIEW,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->dispose = ephy_find_toolbar_dispose;
+ object_class->finalize = ephy_find_toolbar_finalize;
+ object_class->get_property = ephy_find_toolbar_get_property;
+ object_class->set_property = ephy_find_toolbar_set_property;
+
+ widget_class->draw = ephy_find_toolbar_draw;
+ widget_class->grab_focus = ephy_find_toolbar_grab_focus;
+
+ signals[CLOSE] =
+ g_signal_new ("close",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+
+ obj_properties[PROP_WEB_VIEW] =
+ g_param_spec_object ("web-view",
+ "WebView",
+ "Parent web view",
+ WEBKIT_TYPE_WEB_VIEW,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
}
/* public functions */
@@ -546,111 +523,105 @@ ephy_find_toolbar_class_init (EphyFindToolbarClass *klass)
EphyFindToolbar *
ephy_find_toolbar_new (WebKitWebView *web_view)
{
- return g_object_new (EPHY_TYPE_FIND_TOOLBAR,
- "web-view", web_view,
- NULL);
+ return g_object_new (EPHY_TYPE_FIND_TOOLBAR,
+ "web-view", web_view,
+ NULL);
}
const char *
ephy_find_toolbar_get_text (EphyFindToolbar *toolbar)
{
- return gtk_entry_get_text (GTK_ENTRY (toolbar->entry));
+ return gtk_entry_get_text (GTK_ENTRY (toolbar->entry));
}
static void
ephy_find_toolbar_set_web_view (EphyFindToolbar *toolbar,
- WebKitWebView *web_view)
-{
- if (toolbar->web_view == web_view) return;
-
- if (toolbar->web_view != NULL)
- {
- g_signal_handlers_disconnect_matched (toolbar->controller,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, toolbar);
- }
-
- toolbar->web_view = web_view;
- if (web_view != NULL)
- {
- toolbar->controller = webkit_web_view_get_find_controller (web_view);
- g_signal_connect_object (toolbar->controller, "found-text",
- G_CALLBACK (found_text_cb),
- toolbar, 0);
- g_signal_connect_object (toolbar->controller, "failed-to-find-text",
- G_CALLBACK (failed_to_find_text_cb),
- toolbar, 0);
- g_signal_connect (web_view, "load-changed",
- G_CALLBACK (ephy_find_toolbar_load_changed_cb),
- toolbar);
-
- clear_status (toolbar);
-
- g_signal_connect_object (EPHY_WEB_VIEW (web_view), "search-key-press",
- G_CALLBACK (tab_search_key_press_cb),
- toolbar, 0);
- }
+ WebKitWebView *web_view)
+{
+ if (toolbar->web_view == web_view) return;
+
+ if (toolbar->web_view != NULL) {
+ g_signal_handlers_disconnect_matched (toolbar->controller,
+ G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, toolbar);
+ }
+
+ toolbar->web_view = web_view;
+ if (web_view != NULL) {
+ toolbar->controller = webkit_web_view_get_find_controller (web_view);
+ g_signal_connect_object (toolbar->controller, "found-text",
+ G_CALLBACK (found_text_cb),
+ toolbar, 0);
+ g_signal_connect_object (toolbar->controller, "failed-to-find-text",
+ G_CALLBACK (failed_to_find_text_cb),
+ toolbar, 0);
+ g_signal_connect (web_view, "load-changed",
+ G_CALLBACK (ephy_find_toolbar_load_changed_cb),
+ toolbar);
+
+ clear_status (toolbar);
+
+ g_signal_connect_object (EPHY_WEB_VIEW (web_view), "search-key-press",
+ G_CALLBACK (tab_search_key_press_cb),
+ toolbar, 0);
+ }
}
void
ephy_find_toolbar_find_next (EphyFindToolbar *toolbar)
{
- webkit_find_controller_search_next (toolbar->controller);
+ webkit_find_controller_search_next (toolbar->controller);
}
void
ephy_find_toolbar_find_previous (EphyFindToolbar *toolbar)
{
- webkit_find_controller_search_previous (toolbar->controller);
+ webkit_find_controller_search_previous (toolbar->controller);
}
void
ephy_find_toolbar_open (EphyFindToolbar *toolbar,
- gboolean links_only,
- gboolean typing_ahead)
+ gboolean links_only,
+ gboolean typing_ahead)
{
- g_return_if_fail (toolbar->web_view != NULL);
+ g_return_if_fail (toolbar->web_view != NULL);
- toolbar->typing_ahead = typing_ahead;
- toolbar->links_only = links_only;
+ toolbar->typing_ahead = typing_ahead;
+ toolbar->links_only = links_only;
- clear_status (toolbar);
+ clear_status (toolbar);
- gtk_editable_select_region (GTK_EDITABLE (toolbar->entry), 0, -1);
+ gtk_editable_select_region (GTK_EDITABLE (toolbar->entry), 0, -1);
- gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (toolbar), TRUE);
- gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (toolbar), TRUE);
- gtk_widget_grab_focus (toolbar->entry);
+ gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (toolbar), TRUE);
+ gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (toolbar), TRUE);
+ gtk_widget_grab_focus (toolbar->entry);
}
void
ephy_find_toolbar_close (EphyFindToolbar *toolbar)
{
- gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (toolbar), FALSE);
+ gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (toolbar), FALSE);
- if (toolbar->web_view == NULL) return;
+ if (toolbar->web_view == NULL) return;
- webkit_find_controller_search_finish (toolbar->controller);
+ webkit_find_controller_search_finish (toolbar->controller);
}
void
ephy_find_toolbar_request_close (EphyFindToolbar *toolbar)
{
- if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (toolbar)))
- {
- g_signal_emit (toolbar, signals[CLOSE], 0);
- }
+ if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (toolbar))) {
+ g_signal_emit (toolbar, signals[CLOSE], 0);
+ }
}
void
ephy_find_toolbar_toggle_state (EphyFindToolbar *toolbar)
{
- if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (toolbar)))
- {
- ephy_find_toolbar_close (toolbar);
- }
- else
- {
- ephy_find_toolbar_open (toolbar, FALSE, FALSE);
- }
+ if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (toolbar))) {
+ ephy_find_toolbar_close (toolbar);
+ } else {
+ ephy_find_toolbar_open (toolbar, FALSE, FALSE);
+ }
}
diff --git a/embed/ephy-web-extension-proxy.c b/embed/ephy-web-extension-proxy.c
index 6cf067a41..fdbe8d515 100644
--- a/embed/ephy-web-extension-proxy.c
+++ b/embed/ephy-web-extension-proxy.c
@@ -22,8 +22,7 @@
#include "ephy-web-extension-names.h"
#include "ephy-history-service.h"
-struct _EphyWebExtensionProxy
-{
+struct _EphyWebExtensionProxy {
GObject parent_instance;
GCancellable *cancellable;
@@ -33,8 +32,7 @@ struct _EphyWebExtensionProxy
guint page_created_signal_id;
};
-enum
-{
+enum {
PAGE_CREATED,
LAST_SIGNAL
@@ -91,12 +89,12 @@ ephy_web_extension_proxy_class_init (EphyWebExtensionProxyClass *klass)
}
static void
-web_extension_page_created (GDBusConnection *connection,
- const char *sender_name,
- const char *object_path,
- const char *interface_name,
- const char *signal_name,
- GVariant *parameters,
+web_extension_page_created (GDBusConnection *connection,
+ const char *sender_name,
+ const char *object_path,
+ const char *interface_name,
+ const char *signal_name,
+ GVariant *parameters,
EphyWebExtensionProxy *web_extension)
{
guint64 page_id;
@@ -105,8 +103,8 @@ web_extension_page_created (GDBusConnection *connection,
}
static void
-web_extension_proxy_created_cb (GDBusProxy *proxy,
- GAsyncResult *result,
+web_extension_proxy_created_cb (GDBusProxy *proxy,
+ GAsyncResult *result,
EphyWebExtensionProxy *web_extension)
{
GError *error = NULL;
@@ -140,9 +138,9 @@ web_extension_proxy_created_cb (GDBusProxy *proxy,
}
static void
-connection_closed_cb (GDBusConnection *connection,
- gboolean remote_peer_vanished,
- GError *error,
+connection_closed_cb (GDBusConnection *connection,
+ gboolean remote_peer_vanished,
+ GError *error,
EphyWebExtensionProxy *web_extension)
{
if (error) {
@@ -183,8 +181,8 @@ ephy_web_extension_proxy_new (GDBusConnection *connection)
void
ephy_web_extension_proxy_form_auth_data_save_confirmation_response (EphyWebExtensionProxy *web_extension,
- guint request_id,
- gboolean response)
+ guint request_id,
+ gboolean response)
{
g_return_if_fail (EPHY_IS_WEB_EXTENSION_PROXY (web_extension));
@@ -201,9 +199,9 @@ ephy_web_extension_proxy_form_auth_data_save_confirmation_response (EphyWebExten
}
static void
-has_modified_forms_cb (GDBusProxy *proxy,
+has_modified_forms_cb (GDBusProxy *proxy,
GAsyncResult *result,
- GTask *task)
+ GTask *task)
{
GVariant *return_value;
gboolean retval = FALSE;
@@ -220,10 +218,10 @@ has_modified_forms_cb (GDBusProxy *proxy,
void
ephy_web_extension_proxy_web_page_has_modified_forms (EphyWebExtensionProxy *web_extension,
- guint64 page_id,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ guint64 page_id,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GTask *task;
@@ -249,8 +247,8 @@ ephy_web_extension_proxy_web_page_has_modified_forms (EphyWebExtensionProxy *web
gboolean
ephy_web_extension_proxy_web_page_has_modified_forms_finish (EphyWebExtensionProxy *web_extension,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, web_extension), FALSE);
@@ -258,9 +256,9 @@ ephy_web_extension_proxy_web_page_has_modified_forms_finish (EphyWebExtensionPro
}
static void
-get_best_web_app_icon_cb (GDBusProxy *proxy,
+get_best_web_app_icon_cb (GDBusProxy *proxy,
GAsyncResult *result,
- GTask *task)
+ GTask *task)
{
GVariant *retval;
GError *error = NULL;
@@ -276,11 +274,11 @@ get_best_web_app_icon_cb (GDBusProxy *proxy,
void
ephy_web_extension_proxy_get_best_web_app_icon (EphyWebExtensionProxy *web_extension,
- guint64 page_id,
- const char *base_uri,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ guint64 page_id,
+ const char *base_uri,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GTask *task;
@@ -291,7 +289,7 @@ ephy_web_extension_proxy_get_best_web_app_icon (EphyWebExtensionProxy *web_exten
if (web_extension->proxy) {
g_dbus_proxy_call (web_extension->proxy,
"GetBestWebAppIcon",
- g_variant_new("(ts)", page_id, base_uri),
+ g_variant_new ("(ts)", page_id, base_uri),
G_DBUS_CALL_FLAGS_NONE,
-1,
web_extension->cancellable,
@@ -306,11 +304,11 @@ ephy_web_extension_proxy_get_best_web_app_icon (EphyWebExtensionProxy *web_exten
gboolean
ephy_web_extension_proxy_get_best_web_app_icon_finish (EphyWebExtensionProxy *web_extension,
- GAsyncResult *result,
- gboolean *icon_result,
- char **icon_uri,
- char **icon_color,
- GError **error)
+ GAsyncResult *result,
+ gboolean *icon_result,
+ char **icon_uri,
+ char **icon_color,
+ GError **error)
{
GVariant *variant;
GTask *task = G_TASK (result);
@@ -328,9 +326,9 @@ ephy_web_extension_proxy_get_best_web_app_icon_finish (EphyWebExtensionProxy *we
}
static void
-get_web_app_title_cb (GDBusProxy *proxy,
+get_web_app_title_cb (GDBusProxy *proxy,
GAsyncResult *result,
- GTask *task)
+ GTask *task)
{
GVariant *retval;
GError *error = NULL;
@@ -350,10 +348,10 @@ get_web_app_title_cb (GDBusProxy *proxy,
void
ephy_web_extension_proxy_get_web_app_title (EphyWebExtensionProxy *web_extension,
- guint64 page_id,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ guint64 page_id,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GTask *task;
@@ -364,7 +362,7 @@ ephy_web_extension_proxy_get_web_app_title (EphyWebExtensionProxy *web_extension
if (web_extension->proxy) {
g_dbus_proxy_call (web_extension->proxy,
"GetWebAppTitle",
- g_variant_new("(t)", page_id),
+ g_variant_new ("(t)", page_id),
G_DBUS_CALL_FLAGS_NONE,
-1,
web_extension->cancellable,
@@ -379,8 +377,8 @@ ephy_web_extension_proxy_get_web_app_title (EphyWebExtensionProxy *web_extension
char *
ephy_web_extension_proxy_get_web_app_title_finish (EphyWebExtensionProxy *web_extension,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, web_extension), FALSE);
@@ -389,7 +387,7 @@ ephy_web_extension_proxy_get_web_app_title_finish (EphyWebExtensionProxy *web_ex
void
ephy_web_extension_proxy_history_set_urls (EphyWebExtensionProxy *web_extension,
- GList *urls)
+ GList *urls)
{
GList *l;
GVariantBuilder builder;
@@ -415,8 +413,8 @@ ephy_web_extension_proxy_history_set_urls (EphyWebExtensionProxy *web_extension,
void
ephy_web_extension_proxy_history_set_url_thumbnail (EphyWebExtensionProxy *web_extension,
- const char *url,
- const char *path)
+ const char *url,
+ const char *path)
{
if (!web_extension->proxy)
return;
@@ -432,8 +430,8 @@ ephy_web_extension_proxy_history_set_url_thumbnail (EphyWebExtensionProxy *web_e
void
ephy_web_extension_proxy_history_set_url_title (EphyWebExtensionProxy *web_extension,
- const char *url,
- const char *title)
+ const char *url,
+ const char *title)
{
if (!web_extension->proxy)
return;
@@ -449,7 +447,7 @@ ephy_web_extension_proxy_history_set_url_title (EphyWebExtensionProxy *web_exten
void
ephy_web_extension_proxy_history_delete_url (EphyWebExtensionProxy *web_extension,
- const char *url)
+ const char *url)
{
if (!web_extension->proxy)
return;
@@ -465,7 +463,7 @@ ephy_web_extension_proxy_history_delete_url (EphyWebExtensionProxy *web_extensio
void
ephy_web_extension_proxy_history_delete_host (EphyWebExtensionProxy *web_extension,
- const char *host)
+ const char *host)
{
if (!web_extension->proxy)
return;
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index a731475b7..4f3e38698 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -161,7 +161,7 @@ popups_manager_free_info (PopupInfo *popup)
}
static void
-popups_manager_show (PopupInfo *popup,
+popups_manager_show (PopupInfo *popup,
EphyWebView *view)
{
/* Only show popup with non NULL url */
@@ -203,19 +203,19 @@ popups_manager_new_window_info (EphyEmbedContainer *container)
gtk_widget_get_allocation (GTK_WIDGET (embed), &allocation);
features = g_strdup_printf
- ("width=%d,height=%d,toolbar=%d",
- allocation.width,
- allocation.height,
- 1);
+ ("width=%d,height=%d,toolbar=%d",
+ allocation.width,
+ allocation.height,
+ 1);
return features;
}
static void
popups_manager_add (EphyWebView *view,
- const char *url,
- const char *name,
- const char *features)
+ const char *url,
+ const char *name,
+ const char *features)
{
PopupInfo *popup;
@@ -249,7 +249,7 @@ popups_manager_add (EphyWebView *view,
static void
popups_manager_hide (EphyEmbedContainer *container,
- EphyWebView *parent_view)
+ EphyWebView *parent_view)
{
EphyEmbed *embed;
const char *location;
@@ -283,7 +283,7 @@ popups_manager_hide_all (EphyWebView *view)
static void
ephy_web_view_set_popups_allowed (EphyWebView *view,
- gboolean allowed)
+ gboolean allowed)
{
if (allowed) {
popups_manager_show_all (view);
@@ -307,7 +307,7 @@ ephy_web_view_get_popups_allowed (EphyWebView *view)
}
static gboolean
-popups_manager_remove_window (EphyWebView *view,
+popups_manager_remove_window (EphyWebView *view,
EphyEmbedContainer *container)
{
view->shown_popups = g_slist_remove (view->shown_popups, container);
@@ -316,7 +316,7 @@ popups_manager_remove_window (EphyWebView *view,
}
static void
-popups_manager_add_window (EphyWebView *view,
+popups_manager_add_window (EphyWebView *view,
EphyEmbedContainer *container)
{
LOG ("popups_manager_add_window: view %p, container %p", view, container);
@@ -330,10 +330,10 @@ popups_manager_add_window (EphyWebView *view,
static void
disconnect_popup (EphyEmbedContainer *container,
- EphyWebView *view)
+ EphyWebView *view)
{
g_signal_handlers_disconnect_by_func
- (container, G_CALLBACK (popups_manager_remove_window), view);
+ (container, G_CALLBACK (popups_manager_remove_window), view);
}
/**
@@ -360,9 +360,9 @@ ephy_web_view_popups_manager_reset (EphyWebView *view)
}
static void
-ephy_web_view_get_property (GObject *object,
- guint prop_id,
- GValue *value,
+ephy_web_view_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
GParamSpec *pspec)
{
EphyWebView *view = EPHY_WEB_VIEW (object);
@@ -379,7 +379,7 @@ ephy_web_view_get_property (GObject *object,
break;
case PROP_HIDDEN_POPUP_COUNT:
g_value_set_int (value, popup_blocker_n_hidden
- (EPHY_WEB_VIEW (object)));
+ (EPHY_WEB_VIEW (object)));
break;
case PROP_ICON:
g_value_set_object (value, view->icon);
@@ -392,7 +392,7 @@ ephy_web_view_get_property (GObject *object,
break;
case PROP_POPUPS_ALLOWED:
g_value_set_boolean (value, ephy_web_view_get_popups_allowed
- (EPHY_WEB_VIEW (object)));
+ (EPHY_WEB_VIEW (object)));
break;
case PROP_SECURITY:
g_value_set_enum (value, view->security_level);
@@ -409,10 +409,10 @@ ephy_web_view_get_property (GObject *object,
}
static void
-ephy_web_view_set_property (GObject *object,
- guint prop_id,
+ephy_web_view_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
switch (prop_id) {
case PROP_POPUPS_ALLOWED:
@@ -481,8 +481,8 @@ ephy_web_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
static GtkWidget *
ephy_web_view_create_form_auth_save_confirmation_info_bar (EphyWebView *web_view,
- const char *hostname,
- const char *username)
+ const char *hostname,
+ const char *username)
{
GtkWidget *info_bar;
GtkWidget *action_area;
@@ -501,7 +501,7 @@ ephy_web_view_create_form_auth_save_confirmation_info_bar (EphyWebView *web_view
GTK_ORIENTATION_HORIZONTAL);
label = gtk_label_new (NULL);
- /* Translators: The %s the hostname where this is happening.
+ /* Translators: The %s the hostname where this is happening.
* Example: mail.google.com.
*/
message = g_markup_printf_escaped (_("Do you want to save your password for “%s”?"),
@@ -573,7 +573,7 @@ ephy_web_view_clear_history (EphyWebView *view)
static void
ephy_web_view_history_cleared_cb (EphyHistoryService *history_service,
- EphyWebView *view)
+ EphyWebView *view)
{
ephy_web_view_clear_history (view);
}
@@ -584,8 +584,8 @@ typedef struct {
} GetSnapshotPathAsyncData;
static void
-got_snapshot_path_cb (EphySnapshotService *service,
- GAsyncResult *result,
+got_snapshot_path_cb (EphySnapshotService *service,
+ GAsyncResult *result,
GetSnapshotPathAsyncData *data)
{
char *snapshot;
@@ -607,7 +607,7 @@ got_snapshot_path_cb (EphySnapshotService *service,
static gboolean
web_view_check_snapshot (WebKitWebView *web_view)
{
- EphyWebView* view = EPHY_WEB_VIEW (web_view);
+ EphyWebView *view = EPHY_WEB_VIEW (web_view);
EphySnapshotService *service = ephy_snapshot_service_get_default ();
const char *url = webkit_web_view_get_uri (web_view);
GetSnapshotPathAsyncData *data;
@@ -647,8 +647,8 @@ _ephy_web_view_update_icon (EphyWebView *view)
static void
icon_changed_cb (EphyWebView *view,
- GParamSpec *pspec,
- gpointer user_data)
+ GParamSpec *pspec,
+ gpointer user_data)
{
_ephy_web_view_update_icon (view);
}
@@ -659,8 +659,8 @@ typedef struct {
} FormAuthRequestData;
static void
-form_auth_data_save_confirmation_response (GtkInfoBar *info_bar,
- gint response_id,
+form_auth_data_save_confirmation_response (GtkInfoBar *info_bar,
+ gint response_id,
FormAuthRequestData *data)
{
gtk_widget_destroy (GTK_WIDGET (info_bar));
@@ -676,11 +676,11 @@ form_auth_data_save_confirmation_response (GtkInfoBar *info_bar,
static void
form_auth_data_save_requested (EphyEmbedShell *shell,
- guint request_id,
- guint64 page_id,
- const char *hostname,
- const char *username,
- EphyWebView *web_view)
+ guint request_id,
+ guint64 page_id,
+ const char *hostname,
+ const char *username,
+ EphyWebView *web_view)
{
GtkWidget *info_bar;
FormAuthRequestData *data;
@@ -701,8 +701,8 @@ form_auth_data_save_requested (EphyEmbedShell *shell,
static void
allow_tls_certificate_cb (EphyEmbedShell *shell,
- guint64 page_id,
- EphyWebView *view)
+ guint64 page_id,
+ EphyWebView *view)
{
SoupURI *uri;
@@ -721,10 +721,10 @@ allow_tls_certificate_cb (EphyEmbedShell *shell,
}
static void
-page_created_cb (EphyEmbedShell *shell,
- guint64 page_id,
+page_created_cb (EphyEmbedShell *shell,
+ guint64 page_id,
EphyWebExtensionProxy *web_extension,
- EphyWebView *view)
+ EphyWebView *view)
{
if (webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)) != page_id)
return;
@@ -746,17 +746,15 @@ ephy_web_view_dispose (GObject *object)
{
EphyWebView *view = EPHY_WEB_VIEW (object);
- if (view->web_extension)
- {
- g_object_remove_weak_pointer (G_OBJECT (view->web_extension), (gpointer *)&view->web_extension);
- view->web_extension = NULL;
- }
+ if (view->web_extension) {
+ g_object_remove_weak_pointer (G_OBJECT (view->web_extension), (gpointer *)&view->web_extension);
+ view->web_extension = NULL;
+ }
- if (view->password_info_bar)
- {
- g_object_remove_weak_pointer (G_OBJECT (view->password_info_bar), (gpointer *)&view->password_info_bar);
- view->password_info_bar = NULL;
- }
+ if (view->password_info_bar) {
+ g_object_remove_weak_pointer (G_OBJECT (view->password_info_bar), (gpointer *)&view->password_info_bar);
+ view->password_info_bar = NULL;
+ }
g_signal_handlers_disconnect_by_func (view->history_service,
ephy_web_view_history_cleared_cb,
@@ -800,7 +798,7 @@ ephy_web_view_finalize (GObject *object)
static void
_ephy_web_view_set_is_blank (EphyWebView *view,
- gboolean is_blank)
+ gboolean is_blank)
{
if (view->is_blank != is_blank) {
view->is_blank = is_blank;
@@ -810,13 +808,13 @@ _ephy_web_view_set_is_blank (EphyWebView *view,
static void
title_changed_cb (WebKitWebView *web_view,
- GParamSpec *spec,
- gpointer data)
+ GParamSpec *spec,
+ gpointer data)
{
const char *uri;
const char *title;
char *title_from_address = NULL;
- EphyWebView *webview = EPHY_WEB_VIEW (web_view);
+ EphyWebView *webview = EPHY_WEB_VIEW (web_view);
EphyHistoryService *history = webview->history_service;
uri = webkit_web_view_get_uri (web_view);
@@ -837,7 +835,7 @@ title_changed_cb (WebKitWebView *web_view,
*/
static void
ephy_web_view_set_address (EphyWebView *view,
- const char *address)
+ const char *address)
{
GObject *object = G_OBJECT (view);
gboolean is_blank;
@@ -866,8 +864,8 @@ ephy_web_view_set_address (EphyWebView *view,
static void
uri_changed_cb (WebKitWebView *web_view,
- GParamSpec *spec,
- gpointer data)
+ GParamSpec *spec,
+ gpointer data)
{
char *uri;
const char *current_address;
@@ -892,10 +890,10 @@ uri_changed_cb (WebKitWebView *web_view,
}
static void
-mouse_target_changed_cb (EphyWebView *web_view,
+mouse_target_changed_cb (EphyWebView *web_view,
WebKitHitTestResult *hit_test_result,
- guint modifiers,
- gpointer data)
+ guint modifiers,
+ gpointer data)
{
const char *message = NULL;
@@ -1096,13 +1094,13 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
* 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.
**/
- g_signal_new ("new-window",
- EPHY_TYPE_WEB_VIEW,
- G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE,
- 1,
- GTK_TYPE_WIDGET);
+ g_signal_new ("new-window",
+ EPHY_TYPE_WEB_VIEW,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 1,
+ GTK_TYPE_WIDGET);
/**
* EphyWebView::search-key-press:
@@ -1112,13 +1110,13 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
* The ::search-key-press signal is emitted for keypresses which
* should be used for find implementations.
**/
- g_signal_new ("search-key-press",
- EPHY_TYPE_WEB_VIEW,
- G_SIGNAL_RUN_LAST,
- 0, g_signal_accumulator_true_handled, NULL, NULL,
- G_TYPE_BOOLEAN,
- 1,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+ g_signal_new ("search-key-press",
+ EPHY_TYPE_WEB_VIEW,
+ G_SIGNAL_RUN_LAST,
+ 0, g_signal_accumulator_true_handled, NULL, NULL,
+ G_TYPE_BOOLEAN,
+ 1,
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* EphyWebView::download-only-load:
@@ -1127,18 +1125,18 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
* The ::download-only-load signal is emitted when the @view has its main load
* replaced by a download, and that is the only reason why the @view has been created.
**/
- g_signal_new ("download-only-load",
- EPHY_TYPE_WEB_VIEW,
- G_SIGNAL_RUN_FIRST,
- 0, NULL, NULL, NULL,
- G_TYPE_NONE,
- 0);
+ g_signal_new ("download-only-load",
+ EPHY_TYPE_WEB_VIEW,
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 0);
}
static void
new_window_cb (EphyWebView *view,
EphyWebView *new_view,
- gpointer user_data)
+ gpointer user_data)
{
EphyEmbedContainer *container;
@@ -1151,10 +1149,10 @@ new_window_cb (EphyWebView *view,
}
static gboolean
-decide_policy_cb (WebKitWebView *web_view,
- WebKitPolicyDecision *decision,
+decide_policy_cb (WebKitWebView *web_view,
+ WebKitPolicyDecision *decision,
WebKitPolicyDecisionType decision_type,
- gpointer user_data)
+ gpointer user_data)
{
WebKitResponsePolicyDecision *response_decision;
WebKitURIResponse *response;
@@ -1206,19 +1204,19 @@ decide_policy_cb (WebKitWebView *web_view,
}
static void
-decide_on_permission_request (GtkWidget *info_bar,
- int response,
+decide_on_permission_request (GtkWidget *info_bar,
+ int response,
WebKitPermissionRequest *request)
{
gtk_widget_destroy (info_bar);
switch (response) {
- case GTK_RESPONSE_YES:
- webkit_permission_request_allow (request);
- break;
- default:
- webkit_permission_request_deny (request);
- break;
+ case GTK_RESPONSE_YES:
+ webkit_permission_request_allow (request);
+ break;
+ default:
+ webkit_permission_request_deny (request);
+ break;
}
gtk_widget_destroy (info_bar);
@@ -1321,7 +1319,7 @@ get_host_for_url_cb (gpointer service,
static void
restore_zoom_level (EphyWebView *view,
- const char *address)
+ const char *address)
{
if (ephy_embed_utils_address_has_web_scheme (address))
ephy_history_service_get_host_for_url (view->history_service,
@@ -1338,7 +1336,7 @@ restore_zoom_level (EphyWebView *view,
**/
static void
ephy_web_view_set_loading_message (EphyWebView *view,
- const char *address)
+ const char *address)
{
g_clear_pointer (&view->loading_message, g_free);
if (address) {
@@ -1350,7 +1348,7 @@ ephy_web_view_set_loading_message (EphyWebView *view,
if (title != NULL && title[0] != '\0') {
/* translators: %s here is the address of the web page */
- view->loading_message = g_strdup_printf (_ ("Loading “%s”…"), title);
+ view->loading_message = g_strdup_printf (_("Loading “%s”…"), title);
} else {
view->loading_message = g_strdup (_("Loading…"));
}
@@ -1364,7 +1362,7 @@ ephy_web_view_set_loading_message (EphyWebView *view,
static void
ephy_web_view_location_changed (EphyWebView *view,
- const char *location)
+ const char *location)
{
GObject *object = G_OBJECT (view);
@@ -1375,7 +1373,7 @@ ephy_web_view_location_changed (EphyWebView *view,
if (location == NULL || location[0] == '\0') {
ephy_web_view_set_address (view, NULL);
- } else if (g_str_has_prefix (location, EPHY_ABOUT_SCHEME":applications")) {
+ } else if (g_str_has_prefix (location, EPHY_ABOUT_SCHEME ":applications")) {
SoupURI *uri = soup_uri_new (location);
char *new_address;
@@ -1401,7 +1399,7 @@ ephy_web_view_location_changed (EphyWebView *view,
static void
update_security_status_for_committed_load (EphyWebView *view,
- const char *uri)
+ const char *uri)
{
EphySecurityLevel security_level = EPHY_SECURITY_LEVEL_NO_SECURITY;
EphyEmbed *embed = NULL;
@@ -1428,7 +1426,7 @@ update_security_status_for_committed_load (EphyWebView *view,
} else if (webkit_web_view_get_tls_info (WEBKIT_WEB_VIEW (view), &view->certificate, &view->tls_errors)) {
g_object_ref (view->certificate);
security_level = view->tls_errors == 0 ?
- EPHY_SECURITY_LEVEL_STRONG_SECURITY : EPHY_SECURITY_LEVEL_UNACCEPTABLE_CERTIFICATE;
+ EPHY_SECURITY_LEVEL_STRONG_SECURITY : EPHY_SECURITY_LEVEL_UNACCEPTABLE_CERTIFICATE;
} else if (!embed || ephy_embed_has_load_pending (embed)) {
security_level = EPHY_SECURITY_LEVEL_TO_BE_DETERMINED;
}
@@ -1439,9 +1437,9 @@ update_security_status_for_committed_load (EphyWebView *view,
}
static void
-load_changed_cb (WebKitWebView *web_view,
+load_changed_cb (WebKitWebView *web_view,
WebKitLoadEvent load_event,
- gpointer user_data)
+ gpointer user_data)
{
EphyWebView *view = EPHY_WEB_VIEW (web_view);
GObject *object = G_OBJECT (web_view);
@@ -1449,96 +1447,96 @@ load_changed_cb (WebKitWebView *web_view,
g_object_freeze_notify (object);
switch (load_event) {
- case WEBKIT_LOAD_STARTED: {
- const char *loading_uri = NULL;
+ case WEBKIT_LOAD_STARTED: {
+ const char *loading_uri = NULL;
- view->load_failed = FALSE;
+ view->load_failed = FALSE;
- if (view->snapshot_timeout_id) {
- g_source_remove (view->snapshot_timeout_id);
- view->snapshot_timeout_id = 0;
- }
+ if (view->snapshot_timeout_id) {
+ g_source_remove (view->snapshot_timeout_id);
+ view->snapshot_timeout_id = 0;
+ }
- loading_uri = webkit_web_view_get_uri (web_view);
+ loading_uri = webkit_web_view_get_uri (web_view);
- if (ephy_embed_utils_is_no_show_address (loading_uri))
- ephy_web_view_freeze_history (view);
+ if (ephy_embed_utils_is_no_show_address (loading_uri))
+ ephy_web_view_freeze_history (view);
- if (view->address == NULL || view->address[0] == '\0')
- ephy_web_view_set_address (view, loading_uri);
+ if (view->address == NULL || view->address[0] == '\0')
+ ephy_web_view_set_address (view, loading_uri);
- ephy_web_view_set_loading_message (view, loading_uri);
+ ephy_web_view_set_loading_message (view, loading_uri);
- /* Zoom level. */
- restore_zoom_level (view, loading_uri);
+ /* Zoom level. */
+ restore_zoom_level (view, loading_uri);
- break;
- }
- case WEBKIT_LOAD_REDIRECTED:
- /* TODO: Update the loading uri */
- break;
- case WEBKIT_LOAD_COMMITTED: {
- const char *uri;
- view->ever_committed = TRUE;
+ break;
+ }
+ case WEBKIT_LOAD_REDIRECTED:
+ /* TODO: Update the loading uri */
+ break;
+ case WEBKIT_LOAD_COMMITTED: {
+ const char *uri;
+ view->ever_committed = TRUE;
- /* Title and location. */
- uri = webkit_web_view_get_uri (web_view);
- ephy_web_view_location_changed (view, uri);
- update_security_status_for_committed_load (view, uri);
+ /* Title and location. */
+ uri = webkit_web_view_get_uri (web_view);
+ ephy_web_view_location_changed (view, uri);
+ update_security_status_for_committed_load (view, uri);
- /* History. */
- if (!ephy_web_view_is_history_frozen (view)) {
- char *history_uri = NULL;
+ /* History. */
+ if (!ephy_web_view_is_history_frozen (view)) {
+ char *history_uri = NULL;
- /* TODO: move the normalization down to the history service? */
- if (g_str_has_prefix (uri, EPHY_ABOUT_SCHEME))
+ /* TODO: move the normalization down to the history service? */
+ if (g_str_has_prefix (uri, EPHY_ABOUT_SCHEME))
history_uri = g_strdup_printf ("about:%s", uri + EPHY_ABOUT_SCHEME_LEN + 1);
- else
- history_uri = g_strdup (uri);
+ else
+ history_uri = g_strdup (uri);
- ephy_history_service_visit_url (view->history_service,
- history_uri,
- view->visit_type);
+ ephy_history_service_visit_url (view->history_service,
+ history_uri,
+ view->visit_type);
- g_free (history_uri);
- }
+ g_free (history_uri);
+ }
- if (view->loading_error_page)
+ if (view->loading_error_page)
view->loading_error_page = FALSE;
- else
+ else
view->error_page = EPHY_WEB_VIEW_ERROR_PAGE_NONE;
- break;
- }
- case WEBKIT_LOAD_FINISHED:
- ephy_web_view_set_loading_message (view, NULL);
-
- /* Ensure we load the icon for this web view, if available. */
- _ephy_web_view_update_icon (view);
-
- /* Reset visit type. */
- view->visit_type = EPHY_PAGE_VISIT_NONE;
-
- if (!ephy_web_view_is_history_frozen (view) &&
- ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_INCOGNITO) {
- if (!ephy_snapshot_service_lookup_snapshot_path (ephy_snapshot_service_get_default (), webkit_web_view_get_uri (web_view))) {
- /* FIXME: The 1s delay is a workaround to allow time to render the page and get a favicon.
- * https://bugzilla.gnome.org/show_bug.cgi?id=761065
- */
- if (view->snapshot_timeout_id == 0) {
- view->snapshot_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_LOW, 1,
- (GSourceFunc)web_view_check_snapshot,
- web_view, NULL);
+ break;
+ }
+ case WEBKIT_LOAD_FINISHED:
+ ephy_web_view_set_loading_message (view, NULL);
+
+ /* Ensure we load the icon for this web view, if available. */
+ _ephy_web_view_update_icon (view);
+
+ /* Reset visit type. */
+ view->visit_type = EPHY_PAGE_VISIT_NONE;
+
+ if (!ephy_web_view_is_history_frozen (view) &&
+ ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_INCOGNITO) {
+ if (!ephy_snapshot_service_lookup_snapshot_path (ephy_snapshot_service_get_default (), webkit_web_view_get_uri (web_view))) {
+ /* FIXME: The 1s delay is a workaround to allow time to render the page and get a favicon.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=761065
+ */
+ if (view->snapshot_timeout_id == 0) {
+ view->snapshot_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_LOW, 1,
+ (GSourceFunc)web_view_check_snapshot,
+ web_view, NULL);
+ }
}
}
- }
- ephy_web_view_thaw_history (view);
+ ephy_web_view_thaw_history (view);
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
g_object_thaw_notify (object);
@@ -1556,8 +1554,8 @@ load_changed_cb (WebKitWebView *web_view,
**/
void
ephy_web_view_set_placeholder (EphyWebView *view,
- const char *uri,
- const char *title)
+ const char *uri,
+ const char *title)
{
char *html;
@@ -1718,10 +1716,10 @@ ephy_web_view_get_error_page (EphyWebView *view)
*
**/
void
-ephy_web_view_load_error_page (EphyWebView *view,
- const char *uri,
+ephy_web_view_load_error_page (EphyWebView *view,
+ const char *uri,
EphyWebViewErrorPage page,
- GError *error)
+ GError *error)
{
GString *html = g_string_new ("");
const char *reason;
@@ -1813,7 +1811,7 @@ ephy_web_view_load_error_page (EphyWebView *view,
custom_class = "tls-error";
/* Access key for the "Accept Risk" button on the TLS error page. */
accesskey = C_("accept-risk-access-key", "R");
- load_anyway_js = g_strdup_printf ("window.webkit.messageHandlers.tlsErrorPage.postMessage(%"G_GUINT64_FORMAT");",
+ load_anyway_js = g_strdup_printf ("window.webkit.messageHandlers.tlsErrorPage.postMessage(%"G_GUINT64_FORMAT ");",
webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)));
break;
case EPHY_WEB_VIEW_ERROR_PAGE_NONE:
@@ -1860,11 +1858,11 @@ ephy_web_view_load_error_page (EphyWebView *view,
}
static gboolean
-load_failed_cb (WebKitWebView *web_view,
+load_failed_cb (WebKitWebView *web_view,
WebKitLoadEvent load_event,
- const char *uri,
- GError *error,
- gpointer user_data)
+ const char *uri,
+ GError *error,
+ gpointer user_data)
{
EphyWebView *view = EPHY_WEB_VIEW (web_view);
@@ -1882,53 +1880,53 @@ load_failed_cb (WebKitWebView *web_view,
(error->domain == WEBKIT_PLUGIN_ERROR), FALSE);
switch (error->code) {
- case WEBKIT_NETWORK_ERROR_FAILED:
- case WEBKIT_NETWORK_ERROR_TRANSPORT:
- case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
- case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
- case WEBKIT_POLICY_ERROR_FAILED:
- case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE:
- case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI:
- case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
- case WEBKIT_PLUGIN_ERROR_FAILED:
- case WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN:
- case WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN:
- case WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE:
- case WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED:
- ephy_web_view_load_error_page (view, uri, EPHY_WEB_VIEW_ERROR_PAGE_NETWORK_ERROR, error);
- return TRUE;
- case WEBKIT_NETWORK_ERROR_CANCELLED:
+ case WEBKIT_NETWORK_ERROR_FAILED:
+ case WEBKIT_NETWORK_ERROR_TRANSPORT:
+ case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
+ case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
+ case WEBKIT_POLICY_ERROR_FAILED:
+ case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE:
+ case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI:
+ case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
+ case WEBKIT_PLUGIN_ERROR_FAILED:
+ case WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN:
+ case WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN:
+ case WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE:
+ case WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED:
+ ephy_web_view_load_error_page (view, uri, EPHY_WEB_VIEW_ERROR_PAGE_NETWORK_ERROR, error);
+ return TRUE;
+ case WEBKIT_NETWORK_ERROR_CANCELLED:
{
if (!view->typed_address) {
- const char* prev_uri;
+ const char *prev_uri;
prev_uri = webkit_web_view_get_uri (web_view);
ephy_web_view_set_address (view, prev_uri);
}
}
break;
- case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
- /* If we are going to download something, and this is the first
- * page to load in this tab, we may want to close it down. */
- if (!view->ever_committed)
- g_signal_emit_by_name (view, "download-only-load", NULL);
- break;
- /* In case the resource is going to be showed with a plugin just let
- * WebKit do it */
- case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
- default:
- break;
+ case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
+ /* If we are going to download something, and this is the first
+ * page to load in this tab, we may want to close it down. */
+ if (!view->ever_committed)
+ g_signal_emit_by_name (view, "download-only-load", NULL);
+ break;
+ /* In case the resource is going to be showed with a plugin just let
+ * WebKit do it */
+ case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
+ default:
+ break;
}
return FALSE;
}
static gboolean
-load_failed_with_tls_error_cb (WebKitWebView *web_view,
- const char *uri,
- GTlsCertificate *certificate,
+load_failed_with_tls_error_cb (WebKitWebView *web_view,
+ const char *uri,
+ GTlsCertificate *certificate,
GTlsCertificateFlags errors,
- gpointer user_data)
+ gpointer user_data)
{
EphyWebView *view = EPHY_WEB_VIEW (web_view);
@@ -1945,9 +1943,9 @@ load_failed_with_tls_error_cb (WebKitWebView *web_view,
}
static void
-mixed_content_detected_cb (WebKitWebView *web_view,
+mixed_content_detected_cb (WebKitWebView *web_view,
WebKitInsecureContentEvent event,
- gpointer user_data)
+ gpointer user_data)
{
EphyWebView *view = EPHY_WEB_VIEW (web_view);
@@ -1957,7 +1955,7 @@ mixed_content_detected_cb (WebKitWebView *web_view,
static void
close_web_view_cb (WebKitWebView *web_view,
- gpointer user_data)
+ gpointer user_data)
{
GtkWidget *widget = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
@@ -1974,8 +1972,8 @@ close_web_view_cb (WebKitWebView *web_view,
static void
zoom_changed_cb (WebKitWebView *web_view,
- GParamSpec *pspec,
- gpointer user_data)
+ GParamSpec *pspec,
+ gpointer user_data)
{
const char *address;
double zoom;
@@ -1994,7 +1992,7 @@ zoom_changed_cb (WebKitWebView *web_view,
}
static gboolean
-script_dialog_cb (WebKitWebView *web_view,
+script_dialog_cb (WebKitWebView *web_view,
WebKitScriptDialog *dialog)
{
if (webkit_script_dialog_get_dialog_type (dialog) != WEBKIT_SCRIPT_DIALOG_BEFORE_UNLOAD_CONFIRM)
@@ -2122,7 +2120,7 @@ ephy_web_view_new_with_related_view (WebKitWebView *related_view)
* Loads the given #WebKitNetworkRequest in the given #EphyWebView.
**/
void
-ephy_web_view_load_request (EphyWebView *view,
+ephy_web_view_load_request (EphyWebView *view,
WebKitURIRequest *request)
{
const char *url;
@@ -2149,9 +2147,9 @@ typedef struct {
static void
effective_url_head_cb (SoupSession *session,
SoupMessage *message,
- gpointer user_data)
+ gpointer user_data)
{
- HEADAttemptData *data = (HEADAttemptData*)user_data;
+ HEADAttemptData *data = (HEADAttemptData *)user_data;
EphyWebView *view = data->view;
@@ -2191,7 +2189,7 @@ effective_url_head_cb (SoupSession *session,
**/
void
ephy_web_view_load_url (EphyWebView *view,
- const char *url)
+ const char *url)
{
char *effective_url;
@@ -2231,7 +2229,7 @@ ephy_web_view_is_overview (EphyWebView *view)
if (!view->address)
return FALSE;
- return (!strcmp (view->address, EPHY_ABOUT_SCHEME":overview") ||
+ return (!strcmp (view->address, EPHY_ABOUT_SCHEME ":overview") ||
!strcmp (view->address, "about:overview"));
}
@@ -2399,7 +2397,7 @@ ephy_web_view_get_link_message (EphyWebView *view)
**/
void
ephy_web_view_set_link_message (EphyWebView *view,
- const char *address)
+ const char *address)
{
char *decoded_address;
@@ -2427,7 +2425,7 @@ ephy_web_view_set_link_message (EphyWebView *view,
* Sets @view's security-level property to @level.
**/
void
-ephy_web_view_set_security_level (EphyWebView *view,
+ephy_web_view_set_security_level (EphyWebView *view,
EphySecurityLevel level)
{
g_return_if_fail (EPHY_IS_WEB_VIEW (view));
@@ -2479,7 +2477,7 @@ ephy_web_view_get_typed_address (EphyWebView *view)
**/
void
ephy_web_view_set_typed_address (EphyWebView *view,
- const char *address)
+ const char *address)
{
g_return_if_fail (EPHY_IS_WEB_VIEW (view));
@@ -2491,8 +2489,8 @@ ephy_web_view_set_typed_address (EphyWebView *view,
static void
has_modified_forms_cb (EphyWebExtensionProxy *web_extension,
- GAsyncResult *result,
- GTask *task)
+ GAsyncResult *result,
+ GTask *task)
{
gboolean retval;
@@ -2516,10 +2514,10 @@ has_modified_forms_cb (EphyWebExtensionProxy *web_extension,
* Return value: %TRUE if @view has user-modified forms
**/
void
-ephy_web_view_has_modified_forms (EphyWebView *view,
- GCancellable *cancellable,
+ephy_web_view_has_modified_forms (EphyWebView *view,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
- gpointer user_data)
+ gpointer user_data)
{
GTask *task;
@@ -2541,9 +2539,9 @@ ephy_web_view_has_modified_forms (EphyWebView *view,
}
gboolean
-ephy_web_view_has_modified_forms_finish (EphyWebView *view,
+ephy_web_view_has_modified_forms_finish (EphyWebView *view,
GAsyncResult *result,
- GError **error)
+ GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, view), FALSE);
@@ -2567,8 +2565,8 @@ get_best_web_app_icon_async_data_free (GetBestWebAppIconAsyncData *data)
static void
get_best_web_app_icon_cb (EphyWebExtensionProxy *web_extension,
- GAsyncResult *result,
- GTask *task)
+ GAsyncResult *result,
+ GTask *task)
{
gboolean retval = FALSE;
char *uri = NULL;
@@ -2589,10 +2587,10 @@ get_best_web_app_icon_cb (EphyWebExtensionProxy *web_extension,
}
void
-ephy_web_view_get_best_web_app_icon (EphyWebView *view,
- GCancellable *cancellable,
+ephy_web_view_get_best_web_app_icon (EphyWebView *view,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
- gpointer user_data)
+ gpointer user_data)
{
GTask *task;
@@ -2615,12 +2613,12 @@ ephy_web_view_get_best_web_app_icon (EphyWebView *view,
}
gboolean
-ephy_web_view_get_best_web_app_icon_finish (EphyWebView *view,
+ephy_web_view_get_best_web_app_icon_finish (EphyWebView *view,
GAsyncResult *result,
- gboolean *icon_result,
- char **icon_uri,
- GdkRGBA *icon_color,
- GError **error)
+ gboolean *icon_result,
+ char **icon_uri,
+ GdkRGBA *icon_color,
+ GError **error)
{
GetBestWebAppIconAsyncData *data;
GTask *task = G_TASK (result);
@@ -2646,8 +2644,8 @@ ephy_web_view_get_best_web_app_icon_finish (EphyWebView *view,
static void
get_web_app_title_cb (EphyWebExtensionProxy *web_extension,
- GAsyncResult *result,
- GTask *task)
+ GAsyncResult *result,
+ GTask *task)
{
char *retval;
GError *error = NULL;
@@ -2661,10 +2659,10 @@ get_web_app_title_cb (EphyWebExtensionProxy *web_extension,
}
void
-ephy_web_view_get_web_app_title (EphyWebView *view,
- GCancellable *cancellable,
+ephy_web_view_get_web_app_title (EphyWebView *view,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
- gpointer user_data)
+ gpointer user_data)
{
GTask *task;
@@ -2686,9 +2684,9 @@ ephy_web_view_get_web_app_title (EphyWebView *view,
}
char *
-ephy_web_view_get_web_app_title_finish (EphyWebView *view,
+ephy_web_view_get_web_app_title_finish (EphyWebView *view,
GAsyncResult *result,
- GError **error)
+ GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, view), NULL);
@@ -2707,9 +2705,9 @@ ephy_web_view_get_web_app_title_finish (EphyWebView *view,
* have been found with that certificate.
**/
void
-ephy_web_view_get_security_level (EphyWebView *view,
- EphySecurityLevel *level,
- GTlsCertificate **certificate,
+ephy_web_view_get_security_level (EphyWebView *view,
+ EphySecurityLevel *level,
+ GTlsCertificate **certificate,
GTlsCertificateFlags *errors)
{
g_return_if_fail (EPHY_IS_WEB_VIEW (view));
@@ -2747,7 +2745,7 @@ ephy_web_view_print_failed (EphyWebView *view, GError *error)
static void
print_operation_finished_cb (WebKitPrintOperation *operation,
- EphyWebView *view)
+ EphyWebView *view)
{
ephy_embed_shell_set_page_setup (ephy_embed_shell_get_default (),
webkit_print_operation_get_page_setup (operation));
@@ -2755,8 +2753,8 @@ print_operation_finished_cb (WebKitPrintOperation *operation,
static void
print_operation_failed_cb (WebKitPrintOperation *operation,
- GError *error,
- EphyWebView *view)
+ GError *error,
+ EphyWebView *view)
{
g_signal_handlers_disconnect_by_func (operation, print_operation_finished_cb, view);
ephy_web_view_print_failed (view, error);
@@ -2801,8 +2799,8 @@ ephy_web_view_print (EphyWebView *view)
static void
web_resource_get_data_cb (WebKitWebResource *resource,
- GAsyncResult *result,
- GOutputStream *output_stream)
+ GAsyncResult *result,
+ GOutputStream *output_stream)
{
guchar *data;
gsize data_length;
@@ -2828,8 +2826,8 @@ web_resource_get_data_cb (WebKitWebResource *resource,
}
static void
-ephy_web_view_save_main_resource_cb (GFile *file,
- GAsyncResult *result,
+ephy_web_view_save_main_resource_cb (GFile *file,
+ GAsyncResult *result,
WebKitWebView *view)
{
GFileOutputStream *output_stream;
diff --git a/embed/web-extension/ephy-embed-form-auth.c b/embed/web-extension/ephy-embed-form-auth.c
index 1ce650490..054277953 100644
--- a/embed/web-extension/ephy-embed-form-auth.c
+++ b/embed/web-extension/ephy-embed-form-auth.c
@@ -19,8 +19,7 @@
#include <config.h>
#include "ephy-embed-form-auth.h"
-struct _EphyEmbedFormAuth
-{
+struct _EphyEmbedFormAuth {
GObject parent_instance;
guint64 page_id;
@@ -62,7 +61,7 @@ EphyEmbedFormAuth *
ephy_embed_form_auth_new (WebKitWebPage *web_page,
WebKitDOMNode *username_node,
WebKitDOMNode *password_node,
- const char* username)
+ const char *username)
{
EphyEmbedFormAuth *form_auth;
@@ -103,7 +102,7 @@ ephy_embed_form_auth_get_page_id (EphyEmbedFormAuth *form_auth)
return form_auth->page_id;
}
-const char*
+const char *
ephy_embed_form_auth_get_username (EphyEmbedFormAuth *form_auth)
{
return form_auth->username;
diff --git a/embed/web-extension/ephy-uri-tester.c b/embed/web-extension/ephy-uri-tester.c
index 76cdc3b29..c2c97ab0c 100644
--- a/embed/web-extension/ephy-uri-tester.c
+++ b/embed/web-extension/ephy-uri-tester.c
@@ -35,8 +35,7 @@
#define SIGNATURE_SIZE 8
#define UPDATE_FREQUENCY 24 * 60 * 60 /* In seconds */
-struct _EphyUriTester
-{
+struct _EphyUriTester {
GObject parent_instance;
GSList *filters;
@@ -61,8 +60,7 @@ struct _EphyUriTester
GRegex *regex_frame_add;
};
-enum
-{
+enum {
PROP_0,
PROP_FILTERS,
PROP_BASE_DATA_DIR,
@@ -93,9 +91,9 @@ ephy_uri_tester_ensure_data_dir (const char *base_data_dir)
return folder;
}
-static char*
+static char *
ephy_uri_tester_get_fileuri_for_url (EphyUriTester *tester,
- const char *url)
+ const char *url)
{
char *filename = NULL;
char *path = NULL;
@@ -121,8 +119,8 @@ typedef struct {
} RetrieveFilterAsyncData;
static void
-ephy_uri_tester_retrieve_filter_finished (GFile *src,
- GAsyncResult *result,
+ephy_uri_tester_retrieve_filter_finished (GFile *src,
+ GAsyncResult *result,
RetrieveFilterAsyncData *data)
{
GError *error = NULL;
@@ -140,8 +138,8 @@ ephy_uri_tester_retrieve_filter_finished (GFile *src,
static void
ephy_uri_tester_retrieve_filter (EphyUriTester *tester,
- const char *url,
- const char *fileuri)
+ const char *url,
+ const char *fileuri)
{
GFile *src;
GFile *dest;
@@ -184,21 +182,19 @@ ephy_uri_tester_filter_is_valid (const char *fileuri)
NULL,
NULL);
result = FALSE;
- if (file_info)
- {
- GTimeVal current_time;
- GTimeVal mod_time;
-
- g_get_current_time (&current_time);
- g_file_info_get_modification_time (file_info, &mod_time);
-
- if (current_time.tv_sec > mod_time.tv_sec)
- {
- gint64 expire_time = mod_time.tv_sec + UPDATE_FREQUENCY;
- result = current_time.tv_sec < expire_time;
- }
- g_object_unref (file_info);
+ if (file_info) {
+ GTimeVal current_time;
+ GTimeVal mod_time;
+
+ g_get_current_time (&current_time);
+ g_file_info_get_modification_time (file_info, &mod_time);
+
+ if (current_time.tv_sec > mod_time.tv_sec) {
+ gint64 expire_time = mod_time.tv_sec + UPDATE_FREQUENCY;
+ result = current_time.tv_sec < expire_time;
}
+ g_object_unref (file_info);
+ }
g_object_unref (file);
@@ -213,18 +209,17 @@ ephy_uri_tester_load_patterns (EphyUriTester *tester)
char *fileuri = NULL;
/* Load patterns from the list of filters. */
- for (filter = tester->filters; filter; filter = g_slist_next(filter))
- {
- url = (char*)filter->data;
- fileuri = ephy_uri_tester_get_fileuri_for_url (tester, url);
+ for (filter = tester->filters; filter; filter = g_slist_next (filter)) {
+ url = (char *)filter->data;
+ fileuri = ephy_uri_tester_get_fileuri_for_url (tester, url);
- if (!ephy_uri_tester_filter_is_valid (fileuri))
- ephy_uri_tester_retrieve_filter (tester, url, fileuri);
- else
- ephy_uri_tester_parse_file_at_uri (tester, fileuri);
+ if (!ephy_uri_tester_filter_is_valid (fileuri))
+ ephy_uri_tester_retrieve_filter (tester, url, fileuri);
+ else
+ ephy_uri_tester_parse_file_at_uri (tester, fileuri);
- g_free (fileuri);
- }
+ g_free (fileuri);
+ }
}
static void
@@ -235,53 +230,47 @@ ephy_uri_tester_load_filters (EphyUriTester *tester)
filepath = g_build_filename (tester->data_dir, FILTERS_LIST_FILENAME, NULL);
- if (g_file_test (filepath, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
- {
- GFile *file = NULL;
- char *contents = NULL;
- gsize length = 0;
- GError *error = NULL;
-
- file = g_file_new_for_path (filepath);
- if (g_file_load_contents (file, NULL, &contents, &length, NULL, &error))
- {
- char **urls_array = NULL;
- char *url = NULL;
- int i = 0;
-
- urls_array = g_strsplit (contents, ";", -1);
- for (i = 0; urls_array [i]; i++)
- {
- url = g_strstrip (g_strdup (urls_array[i]));
- if (!g_str_equal (url, ""))
- list = g_slist_prepend (list, url);
- }
- g_strfreev (urls_array);
-
- g_free (contents);
- }
-
- if (error)
- {
- LOG ("Error loading filters from %s: %s", filepath, error->message);
- g_error_free (error);
- }
+ if (g_file_test (filepath, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ GFile *file = NULL;
+ char *contents = NULL;
+ gsize length = 0;
+ GError *error = NULL;
+
+ file = g_file_new_for_path (filepath);
+ if (g_file_load_contents (file, NULL, &contents, &length, NULL, &error)) {
+ char **urls_array = NULL;
+ char *url = NULL;
+ int i = 0;
+
+ urls_array = g_strsplit (contents, ";", -1);
+ for (i = 0; urls_array [i]; i++) {
+ url = g_strstrip (g_strdup (urls_array[i]));
+ if (!g_str_equal (url, ""))
+ list = g_slist_prepend (list, url);
+ }
+ g_strfreev (urls_array);
- g_object_unref (file);
+ g_free (contents);
}
- else
- {
- /* No file exists yet, so use the default filter and save it. */
- list = g_slist_prepend (list, g_strdup (DEFAULT_FILTER_URL));
+
+ if (error) {
+ LOG ("Error loading filters from %s: %s", filepath, error->message);
+ g_error_free (error);
}
+ g_object_unref (file);
+ } else {
+ /* No file exists yet, so use the default filter and save it. */
+ list = g_slist_prepend (list, g_strdup (DEFAULT_FILTER_URL));
+ }
+
g_free (filepath);
- ephy_uri_tester_set_filters (tester, g_slist_reverse(list));
+ ephy_uri_tester_set_filters (tester, g_slist_reverse (list));
}
#if 0
-TODO: Use this to create a filters dialog, or something.
+ TODO: Use this to create a filters dialog, or something.
static void
ephy_uri_tester_save_filters (EphyUriTester *tester)
@@ -291,30 +280,28 @@ ephy_uri_tester_save_filters (EphyUriTester *tester)
filepath = g_build_filename (tester->data_dir, FILTERS_LIST_FILENAME, NULL);
- if ((file = g_fopen (filepath, "w")))
- {
- GSList *item = NULL;
- char *filter = NULL;
+ if ((file = g_fopen (filepath, "w"))) {
+ GSList *item = NULL;
+ char *filter = NULL;
- for (item = tester->filters; item; item = g_slist_next (item))
- {
- filter = g_strdup_printf ("%s;", (char*)item->data);
- fputs (filter, file);
- g_free (filter);
- }
- fclose (file);
+ for (item = tester->filters; item; item = g_slist_next (item)) {
+ filter = g_strdup_printf ("%s;", (char *)item->data);
+ fputs (filter, file);
+ g_free (filter);
}
+ fclose (file);
+ }
g_free (filepath);
}
#endif
static inline int
-ephy_uri_tester_check_rule (EphyUriTester *tester,
- GRegex *regex,
- const char *patt,
- const char *req_uri,
- const char *page_uri,
- gboolean whitelist)
+ephy_uri_tester_check_rule (EphyUriTester *tester,
+ GRegex *regex,
+ const char *patt,
+ const char *req_uri,
+ const char *page_uri,
+ gboolean whitelist)
{
char *opts;
GHashTable *optslist = tester->optslist;
@@ -325,11 +312,10 @@ ephy_uri_tester_check_rule (EphyUriTester *tester,
return FALSE;
opts = g_hash_table_lookup (optslist, patt);
- if (opts && g_regex_match (tester->regex_third_party, opts, 0, NULL))
- {
- if (page_uri && g_regex_match_full (regex, page_uri, -1, 0, 0, NULL, NULL))
- return FALSE;
- }
+ if (opts && g_regex_match (tester->regex_third_party, opts, 0, NULL)) {
+ if (page_uri && g_regex_match_full (regex, page_uri, -1, 0, 0, NULL, NULL))
+ return FALSE;
+ }
/* TODO: Domain and document opt check */
if (whitelist)
LOG ("whitelisted by pattern regexp=%s -- %s", g_regex_get_pattern (regex), req_uri);
@@ -339,10 +325,10 @@ ephy_uri_tester_check_rule (EphyUriTester *tester,
}
static inline gboolean
-ephy_uri_tester_is_matched_by_pattern (EphyUriTester *tester,
- const char *req_uri,
- const char *page_uri,
- gboolean whitelist)
+ephy_uri_tester_is_matched_by_pattern (EphyUriTester *tester,
+ const char *req_uri,
+ const char *page_uri,
+ gboolean whitelist)
{
GHashTableIter iter;
gpointer patt, regex;
@@ -351,20 +337,19 @@ ephy_uri_tester_is_matched_by_pattern (EphyUriTester *tester,
pattern = tester->whitelisted_pattern;
g_hash_table_iter_init (&iter, pattern);
- while (g_hash_table_iter_next (&iter, &patt, &regex))
- {
- if (ephy_uri_tester_check_rule (tester, regex, patt, req_uri, page_uri, whitelist))
- return TRUE;
- }
+ while (g_hash_table_iter_next (&iter, &patt, &regex)) {
+ if (ephy_uri_tester_check_rule (tester, regex, patt, req_uri, page_uri, whitelist))
+ return TRUE;
+ }
return FALSE;
}
static inline gboolean
-ephy_uri_tester_is_matched_by_key (EphyUriTester *tester,
- const char *opts,
- const char *req_uri,
- const char *page_uri,
- gboolean whitelist)
+ephy_uri_tester_is_matched_by_key (EphyUriTester *tester,
+ const char *opts,
+ const char *req_uri,
+ const char *page_uri,
+ gboolean whitelist)
{
char *uri;
int len;
@@ -379,35 +364,34 @@ ephy_uri_tester_is_matched_by_key (EphyUriTester *tester,
memset (&sig[0], 0, sizeof (sig));
/* Signatures are made on pattern, so we need to convert url to a pattern as well */
- guri = ephy_uri_tester_fixup_regexp ("", (char*)req_uri);
+ guri = ephy_uri_tester_fixup_regexp ("", (char *)req_uri);
uri = guri->str;
len = guri->len;
- for (pos = len - SIGNATURE_SIZE; pos >= 0; pos--)
- {
- GRegex *regex;
- strncpy (sig, uri + pos, SIGNATURE_SIZE);
- regex = g_hash_table_lookup (keys, sig);
-
- /* Dont check if regex is already blacklisted */
- if (!regex || g_list_find (regex_bl, regex))
- continue;
- ret = ephy_uri_tester_check_rule (tester, regex, sig, req_uri, page_uri, whitelist);
- if (ret)
- break;
- regex_bl = g_list_prepend (regex_bl, regex);
- }
+ for (pos = len - SIGNATURE_SIZE; pos >= 0; pos--) {
+ GRegex *regex;
+ strncpy (sig, uri + pos, SIGNATURE_SIZE);
+ regex = g_hash_table_lookup (keys, sig);
+
+ /* Dont check if regex is already blacklisted */
+ if (!regex || g_list_find (regex_bl, regex))
+ continue;
+ ret = ephy_uri_tester_check_rule (tester, regex, sig, req_uri, page_uri, whitelist);
+ if (ret)
+ break;
+ regex_bl = g_list_prepend (regex_bl, regex);
+ }
g_string_free (guri, TRUE);
g_list_free (regex_bl);
return ret;
}
static gboolean
-ephy_uri_tester_is_matched (EphyUriTester *tester,
- const char *opts,
- const char *req_uri,
- const char *page_uri,
- gboolean whitelist)
+ephy_uri_tester_is_matched (EphyUriTester *tester,
+ const char *opts,
+ const char *req_uri,
+ const char *page_uri,
+ gboolean whitelist)
{
char *value;
GHashTable *urlcache = tester->urlcache;
@@ -419,18 +403,16 @@ ephy_uri_tester_is_matched (EphyUriTester *tester,
return GPOINTER_TO_INT (value);
/* Look for a match either by key or by pattern. */
- if (ephy_uri_tester_is_matched_by_key (tester, opts, req_uri, page_uri, whitelist))
- {
- g_hash_table_insert (urlcache, g_strdup (req_uri), g_strdup ("1"));
- return TRUE;
- }
+ if (ephy_uri_tester_is_matched_by_key (tester, opts, req_uri, page_uri, whitelist)) {
+ g_hash_table_insert (urlcache, g_strdup (req_uri), g_strdup ("1"));
+ return TRUE;
+ }
/* Matching by pattern is pretty expensive, so do it if needed only. */
- if (ephy_uri_tester_is_matched_by_pattern (tester, req_uri, page_uri, whitelist))
- {
- g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE));
- return TRUE;
- }
+ if (ephy_uri_tester_is_matched_by_pattern (tester, req_uri, page_uri, whitelist)) {
+ g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE));
+ return TRUE;
+ }
g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (FALSE));
return FALSE;
@@ -448,54 +430,50 @@ ephy_uri_tester_fixup_regexp (const char *prefix, char *src)
str = g_string_new (prefix);
/* lets strip first .* */
- if (src[0] == '*')
- {
- (void)*src++;
- }
+ if (src[0] == '*') {
+ (void)*src++;
+ }
- do
- {
- switch (*src)
- {
- case '*':
- g_string_append (str, ".*");
- break;
- /*case '.':
- g_string_append (str, "\\.");
- break;*/
- case '?':
- case '[':
- case ']':
- g_string_append_printf (str, "\\%c", *src);
- break;
- case '|':
- /* FIXME: We actually need to match :[0-9]+ or '/'. Sign means
- "here could be port number or nothing". So bla.com^ will match
- bla.com/ or bla.com:8080/ but not bla.com.au/ */
- case '^':
- case '+':
- break;
- default:
- g_string_append_printf (str,"%c", *src);
- break;
- }
- src++;
+ do {
+ switch (*src) {
+ case '*':
+ g_string_append (str, ".*");
+ break;
+ /*case '.':
+ g_string_append (str, "\\.");
+ break;*/
+ case '?':
+ case '[':
+ case ']':
+ g_string_append_printf (str, "\\%c", *src);
+ break;
+ case '|':
+ /* FIXME: We actually need to match :[0-9]+ or '/'. Sign means
+ "here could be port number or nothing". So bla.com^ will match
+ bla.com/ or bla.com:8080/ but not bla.com.au/ */
+ case '^':
+ case '+':
+ break;
+ default:
+ g_string_append_printf (str, "%c", *src);
+ break;
}
- while (*src);
+ src++;
+ } while (*src);
len = str->len;
/* We dont need .* in the end of url. Thats stupid */
- if (str->str && str->str[len-1] == '*' && str->str[len-2] == '.')
- g_string_erase (str, len-2, 2);
+ if (str->str && str->str[len - 1] == '*' && str->str[len - 2] == '.')
+ g_string_erase (str, len - 2, 2);
return str;
}
static void
ephy_uri_tester_compile_regexp (EphyUriTester *tester,
- GString *gpatt,
- const char *opts,
- gboolean whitelist)
+ GString *gpatt,
+ const char *opts,
+ gboolean whitelist)
{
GHashTable *pattern;
GHashTable *keys;
@@ -514,126 +492,110 @@ ephy_uri_tester_compile_regexp (EphyUriTester *tester,
/* TODO: Play with optimization flags */
regex = g_regex_new (patt, G_REGEX_OPTIMIZE | G_REGEX_JAVASCRIPT_COMPAT,
G_REGEX_MATCH_NOTEMPTY, &error);
- if (error)
- {
- g_warning ("%s: %s", G_STRFUNC, error->message);
- g_error_free (error);
- return;
- }
+ if (error) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ return;
+ }
pattern = tester->pattern;
keys = tester->keys;
optslist = tester->optslist;
- if (whitelist)
- {
- pattern = tester->whitelisted_pattern;
- keys = tester->whitelisted_keys;
- optslist = tester->whitelisted_optslist;
- }
+ if (whitelist) {
+ pattern = tester->whitelisted_pattern;
+ keys = tester->whitelisted_keys;
+ optslist = tester->whitelisted_optslist;
+ }
- if (!g_regex_match (tester->regex_pattern, patt, 0, NULL))
- {
- int signature_count = 0;
- int pos = 0;
- char *sig;
-
- for (pos = len - SIGNATURE_SIZE; pos >= 0; pos--) {
- sig = g_strndup (patt + pos, SIGNATURE_SIZE);
- if (!strchr (sig, '*') &&
- !g_hash_table_lookup (keys, sig))
- {
- LOG ("sig: %s %s", sig, patt);
- g_hash_table_insert (keys, g_strdup (sig), g_regex_ref (regex));
- g_hash_table_insert (optslist, g_strdup (sig), g_strdup (opts));
- signature_count++;
- }
- else
- {
- if (sig[0] == '*' &&
- !g_hash_table_lookup (pattern, patt))
- {
- LOG ("patt2: %s %s", sig, patt);
- g_hash_table_insert (pattern, g_strdup (patt), g_regex_ref (regex));
- g_hash_table_insert (optslist, g_strdup (patt), g_strdup (opts));
- }
- }
- g_free (sig);
+ if (!g_regex_match (tester->regex_pattern, patt, 0, NULL)) {
+ int signature_count = 0;
+ int pos = 0;
+ char *sig;
+
+ for (pos = len - SIGNATURE_SIZE; pos >= 0; pos--) {
+ sig = g_strndup (patt + pos, SIGNATURE_SIZE);
+ if (!strchr (sig, '*') &&
+ !g_hash_table_lookup (keys, sig)) {
+ LOG ("sig: %s %s", sig, patt);
+ g_hash_table_insert (keys, g_strdup (sig), g_regex_ref (regex));
+ g_hash_table_insert (optslist, g_strdup (sig), g_strdup (opts));
+ signature_count++;
+ } else {
+ if (sig[0] == '*' &&
+ !g_hash_table_lookup (pattern, patt)) {
+ LOG ("patt2: %s %s", sig, patt);
+ g_hash_table_insert (pattern, g_strdup (patt), g_regex_ref (regex));
+ g_hash_table_insert (optslist, g_strdup (patt), g_strdup (opts));
+ }
}
- g_regex_unref (regex);
-
- if (signature_count > 1 && g_hash_table_lookup (pattern, patt))
- g_hash_table_remove (pattern, patt);
- }
- else
- {
- LOG ("patt: %s%s", patt, "");
- /* Pattern is a regexp chars */
- g_hash_table_insert (pattern, g_strdup (patt), regex);
- g_hash_table_insert (optslist, g_strdup (patt), g_strdup (opts));
+ g_free (sig);
}
+ g_regex_unref (regex);
+
+ if (signature_count > 1 && g_hash_table_lookup (pattern, patt))
+ g_hash_table_remove (pattern, patt);
+ } else {
+ LOG ("patt: %s%s", patt, "");
+ /* Pattern is a regexp chars */
+ g_hash_table_insert (pattern, g_strdup (patt), regex);
+ g_hash_table_insert (optslist, g_strdup (patt), g_strdup (opts));
+ }
}
static void
ephy_uri_tester_add_url_pattern (EphyUriTester *tester,
- const char *prefix,
- const char *type,
- char *line,
- gboolean whitelist)
+ const char *prefix,
+ const char *type,
+ char *line,
+ gboolean whitelist)
{
- char **data;
- char *patt;
- GString *format_patt;
- const char *opts;
-
- data = g_strsplit (line, "$", -1);
- if (!data || !data[0])
- {
- g_strfreev (data);
- return;
- }
-
- if (data[1] && data[2])
- {
- patt = g_strconcat (data[0], data[1], NULL);
- opts = g_strconcat (type, ",", data[2], NULL);
- }
- else if (data[1])
- {
- patt = data[0];
- opts = g_strconcat (type, ",", data[1], NULL);
- }
- else
- {
- patt = data[0];
- opts = type;
- }
-
- if (g_regex_match (tester->regex_subdocument, opts, 0, NULL))
- {
- if (data[1] && data[2])
- g_free (patt);
- if (data[1])
- g_free ((char *)opts);
- g_strfreev (data);
- return;
- }
-
- format_patt = ephy_uri_tester_fixup_regexp (prefix, patt);
+ char **data;
+ char *patt;
+ GString *format_patt;
+ const char *opts;
- if (whitelist)
- LOG ("whitelist: %s opts %s", format_patt->str, opts);
- else
- LOG ("blacklist: %s opts %s", format_patt->str, opts);
+ data = g_strsplit (line, "$", -1);
+ if (!data || !data[0]) {
+ g_strfreev (data);
+ return;
+ }
- ephy_uri_tester_compile_regexp (tester, format_patt, opts, whitelist);
+ if (data[1] && data[2]) {
+ patt = g_strconcat (data[0], data[1], NULL);
+ opts = g_strconcat (type, ",", data[2], NULL);
+ } else if (data[1]) {
+ patt = data[0];
+ opts = g_strconcat (type, ",", data[1], NULL);
+ } else {
+ patt = data[0];
+ opts = type;
+ }
+ if (g_regex_match (tester->regex_subdocument, opts, 0, NULL)) {
if (data[1] && data[2])
- g_free (patt);
+ g_free (patt);
if (data[1])
- g_free ((char *)opts);
+ g_free ((char *)opts);
g_strfreev (data);
+ return;
+ }
+
+ format_patt = ephy_uri_tester_fixup_regexp (prefix, patt);
- g_string_free (format_patt, TRUE);
+ if (whitelist)
+ LOG ("whitelist: %s opts %s", format_patt->str, opts);
+ else
+ LOG ("blacklist: %s opts %s", format_patt->str, opts);
+
+ ephy_uri_tester_compile_regexp (tester, format_patt, opts, whitelist);
+
+ if (data[1] && data[2])
+ g_free (patt);
+ if (data[1])
+ g_free ((char *)opts);
+ g_strfreev (data);
+
+ g_string_free (format_patt, TRUE);
}
static inline void
@@ -645,49 +607,43 @@ ephy_uri_tester_frame_add (EphyUriTester *tester, char *line)
(void)*line++;
if (strchr (line, '\'')
|| (strchr (line, ':')
- && !g_regex_match (tester->regex_frame_add, line, 0, NULL)))
- {
- return;
- }
+ && !g_regex_match (tester->regex_frame_add, line, 0, NULL))) {
+ return;
+ }
g_string_append (tester->blockcss, separator);
g_string_append (tester->blockcss, line);
}
static inline void
-ephy_uri_tester_frame_add_private (EphyUriTester *tester,
- const char *line,
- const char *sep)
+ephy_uri_tester_frame_add_private (EphyUriTester *tester,
+ const char *line,
+ const char *sep)
{
char **data;
data = g_strsplit (line, sep, 2);
if (!(data[1] && *data[1])
- || strchr (data[1], '\'')
+ || strchr (data[1], '\'')
|| (strchr (data[1], ':')
- && !g_regex_match (tester->regex_frame_add, data[1], 0, NULL)))
- {
- g_strfreev (data);
- return;
- }
+ && !g_regex_match (tester->regex_frame_add, data[1], 0, NULL))) {
+ g_strfreev (data);
+ return;
+ }
- if (strchr (data[0], ','))
- {
- char **domains;
- int i;
+ if (strchr (data[0], ',')) {
+ char **domains;
+ int i;
- domains = g_strsplit (data[0], ",", -1);
- for (i = 0; domains[i]; i++)
- {
- g_string_append_printf (tester->blockcssprivate, ";sites['%s']+=',%s'",
- g_strstrip (domains[i]), data[1]);
- }
- g_strfreev (domains);
- }
- else
- {
+ domains = g_strsplit (data[0], ",", -1);
+ for (i = 0; domains[i]; i++) {
g_string_append_printf (tester->blockcssprivate, ";sites['%s']+=',%s'",
- data[0], data[1]);
+ g_strstrip (domains[i]), data[1]);
}
+ g_strfreev (domains);
+ } else {
+ g_string_append_printf (tester->blockcssprivate, ";sites['%s']+=',%s'",
+ data[0], data[1]);
+ }
g_strfreev (data);
}
@@ -708,11 +664,10 @@ ephy_uri_tester_parse_line (EphyUriTester *tester,
return;
/* Whitelisted exception rules */
- if (g_str_has_prefix (line, "@@"))
- {
- ephy_uri_tester_parse_line (tester, line+2, TRUE);
- return;
- }
+ if (g_str_has_prefix (line, "@@")) {
+ ephy_uri_tester_parse_line (tester, line + 2, TRUE);
+ return;
+ }
/* FIXME: No support for domain= */
if (strstr (line, "domain="))
@@ -723,45 +678,40 @@ ephy_uri_tester_parse_line (EphyUriTester *tester,
return;
/* Got CSS block hider */
- if (line[0] == '#' && line[1] == '#' )
- {
- ephy_uri_tester_frame_add (tester, line);
- return;
- }
+ if (line[0] == '#' && line[1] == '#') {
+ ephy_uri_tester_frame_add (tester, line);
+ return;
+ }
/* Got CSS block hider. Workaround */
if (line[0] == '#')
return;
/* Got per domain CSS hider rule */
- if (strstr (line, "##"))
- {
- ephy_uri_tester_frame_add_private (tester, line, "##");
- return;
- }
+ if (strstr (line, "##")) {
+ ephy_uri_tester_frame_add_private (tester, line, "##");
+ return;
+ }
/* Got per domain CSS hider rule. Workaround */
- if (strchr (line, '#'))
- {
- ephy_uri_tester_frame_add_private (tester, line, "#");
- return;
- }
+ if (strchr (line, '#')) {
+ ephy_uri_tester_frame_add_private (tester, line, "#");
+ return;
+ }
/* Got URL blocker rule */
- if (line[0] == '|' && line[1] == '|' )
- {
- (void)*line++;
- (void)*line++;
- /* set a regex prefix to ensure that '||' patterns are anchored at the
- * start and that any characters (if any) preceding the domain specified
- * by the rule is separated from it by a dot '.' */
- ephy_uri_tester_add_url_pattern (tester, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?", "fulluri", line, whitelist);
- return;
- }
- if (line[0] == '|')
- {
- (void)*line++;
- ephy_uri_tester_add_url_pattern (tester, "^", "fulluri", line, whitelist);
- return;
- }
+ if (line[0] == '|' && line[1] == '|') {
+ (void)*line++;
+ (void)*line++;
+ /* set a regex prefix to ensure that '||' patterns are anchored at the
+ * start and that any characters (if any) preceding the domain specified
+ * by the rule is separated from it by a dot '.' */
+ ephy_uri_tester_add_url_pattern (tester, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?", "fulluri", line, whitelist);
+ return;
+ }
+ if (line[0] == '|') {
+ (void)*line++;
+ ephy_uri_tester_add_url_pattern (tester, "^", "fulluri", line, whitelist);
+ return;
+ }
ephy_uri_tester_add_url_pattern (tester, "", "uri", line, whitelist);
}
@@ -890,17 +840,16 @@ ephy_uri_tester_constructed (GObject *object)
}
static void
-ephy_uri_tester_set_property (GObject *object,
- guint prop_id,
+ephy_uri_tester_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
EphyUriTester *tester = EPHY_URI_TESTER (object);
- switch (prop_id)
- {
+ switch (prop_id) {
case PROP_FILTERS:
- ephy_uri_tester_set_filters (tester, (GSList*) g_value_get_pointer (value));
+ ephy_uri_tester_set_filters (tester, (GSList *)g_value_get_pointer (value));
break;
case PROP_BASE_DATA_DIR:
tester->data_dir = ephy_uri_tester_ensure_data_dir (g_value_get_string (value));
@@ -908,7 +857,7 @@ ephy_uri_tester_set_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
- }
+ }
}
static void
@@ -955,7 +904,7 @@ ephy_uri_tester_class_init (EphyUriTesterClass *klass)
g_param_spec_pointer ("filters",
"filters",
"filters",
- G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS );
+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_BASE_DATA_DIR] =
g_param_spec_string ("base-data-dir",
@@ -977,8 +926,8 @@ ephy_uri_tester_new (const char *base_data_dir)
gboolean
ephy_uri_tester_test_uri (EphyUriTester *tester,
- const char *req_uri,
- const char *page_uri)
+ const char *req_uri,
+ const char *page_uri)
{
/* check whitelisting rules before the normal ones */
if (ephy_uri_tester_is_matched (tester, NULL, req_uri, page_uri, TRUE))
diff --git a/embed/web-extension/ephy-web-dom-utils.c b/embed/web-extension/ephy-web-dom-utils.c
index 6ffb86b11..cf327866a 100644
--- a/embed/web-extension/ephy-web-dom-utils.c
+++ b/embed/web-extension/ephy-web-dom-utils.c
@@ -159,8 +159,8 @@ resolve_uri (const char *base_uri,
static gboolean
get_icon_from_mstile (WebKitDOMDocument *document,
- char **uri_out,
- char **color_out)
+ char **uri_out,
+ char **color_out)
{
gboolean ret;
WebKitDOMNodeList *metas;
@@ -203,8 +203,8 @@ get_icon_from_mstile (WebKitDOMDocument *document,
static gboolean
get_icon_from_ogp (WebKitDOMDocument *document,
- char **uri_out,
- char **color_out)
+ char **uri_out,
+ char **color_out)
{
gboolean ret;
WebKitDOMNodeList *metas;
@@ -242,8 +242,8 @@ get_icon_from_ogp (WebKitDOMDocument *document,
static gboolean
get_icon_from_touch_icon (WebKitDOMDocument *document,
- char **uri_out,
- char **color_out)
+ char **uri_out,
+ char **color_out)
{
gboolean ret;
WebKitDOMNodeList *links;
@@ -279,8 +279,8 @@ get_icon_from_touch_icon (WebKitDOMDocument *document,
static gboolean
get_icon_from_favicon (WebKitDOMDocument *document,
- char **uri_out,
- char **color_out)
+ char **uri_out,
+ char **color_out)
{
gboolean ret;
WebKitDOMNodeList *links;
@@ -344,11 +344,11 @@ ephy_web_dom_utils_get_best_icon (WebKitDOMDocument *document,
* http://stackoverflow.com/questions/21991044/how-to-get-high-resolution-website-logo-favicon-for-a-given-url
*/
ret = get_icon_from_mstile (document, &image, &color);
- if (! ret)
+ if (!ret)
ret = get_icon_from_ogp (document, &image, &color);
- if (! ret)
+ if (!ret)
ret = get_icon_from_touch_icon (document, &image, &color);
- if (! ret)
+ if (!ret)
ret = get_icon_from_favicon (document, &image, &color);
if (uri_out != NULL)
@@ -364,8 +364,8 @@ ephy_web_dom_utils_get_best_icon (WebKitDOMDocument *document,
gboolean
ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *form,
- WebKitDOMNode **username,
- WebKitDOMNode **password)
+ WebKitDOMNode **username,
+ WebKitDOMNode **password)
{
WebKitDOMHTMLCollection *elements;
WebKitDOMNode *username_node = NULL;
@@ -421,7 +421,7 @@ ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *form,
g_free (element_name);
}
- g_object_unref(elements);
+ g_object_unref (elements);
if (found_auth_no_username_elements && password_node) {
g_clear_object (&username_node);
@@ -457,8 +457,8 @@ ephy_web_dom_utils_find_form_auth_elements (WebKitDOMHTMLFormElement *form,
**/
void
ephy_web_dom_utils_get_absolute_position_for_element (WebKitDOMElement *element,
- double *x,
- double *y)
+ double *x,
+ double *y)
{
WebKitDOMElement *parent;
double offset_top, offset_left;
@@ -492,8 +492,8 @@ ephy_web_dom_utils_get_absolute_position_for_element (WebKitDOMElement *element,
**/
void
ephy_web_dom_utils_get_absolute_bottom_for_element (WebKitDOMElement *element,
- double *x,
- double *y)
+ double *x,
+ double *y)
{
double offset_height;
@@ -513,7 +513,7 @@ ephy_web_dom_utils_get_absolute_bottom_for_element (WebKitDOMElement *element,
* Returns: a newly allocated string with the selection or %NULL.
**/
char *
-ephy_web_dom_utils_get_selection_as_string (WebKitDOMDOMSelection *selection)
+ephy_web_dom_utils_get_selection_as_string (WebKitDOMDOMSelection *selection)
{
char *string;
WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
diff --git a/embed/web-extension/ephy-web-extension-main.c b/embed/web-extension/ephy-web-extension-main.c
index 9c416a014..0dd24095d 100644
--- a/embed/web-extension/ephy-web-extension-main.c
+++ b/embed/web-extension/ephy-web-extension-main.c
@@ -30,7 +30,7 @@ static EphyWebExtension *extension = NULL;
G_MODULE_EXPORT void
webkit_web_extension_initialize_with_user_data (WebKitWebExtension *webkit_extension,
- GVariant *user_data)
+ GVariant *user_data)
{
const char *server_address;
const char *dot_dir;
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index d72245a2b..a0ec04d82 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -42,8 +42,7 @@
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
#include <JavaScriptCore/JavaScript.h>
-struct _EphyWebExtension
-{
+struct _EphyWebExtension {
GObject parent_instance;
WebKitWebExtension *extension;
@@ -108,10 +107,10 @@ static const char introspection_xml[] =
G_DEFINE_TYPE (EphyWebExtension, ephy_web_extension, G_TYPE_OBJECT)
static gboolean
-web_page_send_request (WebKitWebPage *web_page,
- WebKitURIRequest *request,
+web_page_send_request (WebKitWebPage *web_page,
+ WebKitURIRequest *request,
WebKitURIResponse *redirected_response,
- EphyWebExtension *extension)
+ EphyWebExtension *extension)
{
const char *request_uri;
const char *page_uri;
@@ -140,7 +139,7 @@ web_page_send_request (WebKitWebPage *web_page,
}
if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_ADBLOCK))
- return FALSE;
+ return FALSE;
page_uri = webkit_web_page_get_uri (web_page);
@@ -150,7 +149,7 @@ web_page_send_request (WebKitWebPage *web_page,
/* Always load data requests, as uri_tester won't do any good here. */
if (g_str_has_prefix (request_uri, SOUP_URI_SCHEME_DATA))
- return FALSE;
+ return FALSE;
ret = ephy_uri_tester_test_uri (extension->uri_tester, request_uri, page_uri);
if (ret)
@@ -275,7 +274,7 @@ request_decision_on_storing (EphyEmbedFormAuth *form_auth)
static void
should_store_cb (const char *username,
const char *password,
- gpointer user_data)
+ gpointer user_data)
{
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
@@ -310,8 +309,8 @@ should_store_cb (const char *username,
static gboolean
form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
- WebKitDOMEvent *dom_event,
- WebKitWebPage *web_page)
+ WebKitDOMEvent *dom_event,
+ WebKitWebPage *web_page)
{
EphyEmbedFormAuth *form_auth;
SoupURI *uri;
@@ -360,7 +359,7 @@ form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
static void
fill_form_cb (const char *username,
const char *password,
- gpointer user_data)
+ gpointer user_data)
{
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
WebKitDOMNode *username_node;
@@ -380,7 +379,7 @@ fill_form_cb (const char *username,
}
static gint
-ephy_form_auth_data_compare (EphyFormAuthData *form_data,
+ephy_form_auth_data_compare (EphyFormAuthData *form_data,
EphyEmbedFormAuth *form_auth)
{
WebKitDOMNode *username_node;
@@ -395,7 +394,7 @@ ephy_form_auth_data_compare (EphyFormAuthData *form_data,
"name", &password_field_name, NULL);
retval = g_strcmp0 (username_field_name, form_data->form_username) == 0 &&
- g_strcmp0 (password_field_name, form_data->form_password) == 0;
+ g_strcmp0 (password_field_name, form_data->form_password) == 0;
g_free (username_field_name);
g_free (password_field_name);
@@ -444,7 +443,7 @@ pre_fill_form (EphyEmbedFormAuth *form_auth)
username,
fill_form_cb,
g_object_ref (form_auth),
- (GDestroyNotify) g_object_unref);
+ (GDestroyNotify)g_object_unref);
g_free (username);
g_free (uri_str);
@@ -467,8 +466,8 @@ remove_user_choices (WebKitDOMDocument *document)
}
static gboolean
-username_changed_cb (WebKitDOMNode *username_node,
- WebKitDOMEvent *dom_event,
+username_changed_cb (WebKitDOMNode *username_node,
+ WebKitDOMEvent *dom_event,
EphyEmbedFormAuth *form_auth)
{
pre_fill_form (form_auth);
@@ -481,7 +480,7 @@ user_chosen_cb (WebKitDOMNode *li,
WebKitDOMNode *username_node)
{
WebKitDOMElement *anchor;
- const char* username;
+ const char *username;
anchor = webkit_dom_element_get_first_element_child (WEBKIT_DOM_ELEMENT (li));
@@ -494,7 +493,7 @@ user_chosen_cb (WebKitDOMNode *li,
}
GtkStyleContext *global_entry_context = NULL;
-static GtkStyleContext*
+static GtkStyleContext *
get_entry_style_context (void)
{
GtkWidgetPath *path;
@@ -513,7 +512,7 @@ get_entry_style_context (void)
return global_entry_context;
}
-static char*
+static char *
get_selected_bgcolor (void)
{
GdkRGBA color;
@@ -525,7 +524,7 @@ get_selected_bgcolor (void)
return gdk_rgba_to_string (&color);
}
-static char*
+static char *
get_selected_fgcolor (void)
{
GdkRGBA color;
@@ -537,7 +536,7 @@ get_selected_fgcolor (void)
return gdk_rgba_to_string (&color);
}
-static char*
+static char *
get_bgcolor (void)
{
GdkRGBA color;
@@ -549,7 +548,7 @@ get_bgcolor (void)
return gdk_rgba_to_string (&color);
}
-static char*
+static char *
get_fgcolor (void)
{
GdkRGBA color;
@@ -561,7 +560,7 @@ get_fgcolor (void)
return gdk_rgba_to_string (&color);
}
-static char*
+static char *
get_user_choice_style (gboolean selected)
{
char *style_attribute;
@@ -581,7 +580,7 @@ get_user_choice_style (gboolean selected)
return style_attribute;
}
-static char*
+static char *
get_user_choice_anchor_style (gboolean selected)
{
char *style_attribute;
@@ -613,7 +612,7 @@ show_user_choices (WebKitDOMDocument *document,
double x, y;
double input_width;
char *style_attribute;
- char* username;
+ char *username;
g_object_get (username_node,
"value", &username,
@@ -654,8 +653,8 @@ show_user_choices (WebKitDOMDocument *document,
"padding: 0;",
NULL);
- auth_data_list = (GSList*)g_object_get_data (G_OBJECT (username_node),
- "ephy-auth-data-list");
+ auth_data_list = (GSList *)g_object_get_data (G_OBJECT (username_node),
+ "ephy-auth-data-list");
username_node_ever_edited =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (username_node),
@@ -668,13 +667,13 @@ show_user_choices (WebKitDOMDocument *document,
char *child_style;
gboolean is_selected;
- data = (EphyFormAuthData*)iter->data;
+ data = (EphyFormAuthData *)iter->data;
/* Filter out the available names that do not match, but show all options in
* case we have been triggered by something other than the user editing the
* input.
*/
- if (username_node_ever_edited && !g_str_has_prefix(data->username, username))
+ if (username_node_ever_edited && !g_str_has_prefix (data->username, username))
continue;
is_selected = !g_strcmp0 (username, data->username);
@@ -713,7 +712,7 @@ show_user_choices (WebKitDOMDocument *document,
NULL);
}
- g_free (username);
+ g_free (username);
body = WEBKIT_DOM_NODE (webkit_dom_document_get_body (document));
webkit_dom_node_append_child (WEBKIT_DOM_NODE (body),
WEBKIT_DOM_NODE (main_div),
@@ -755,8 +754,8 @@ clear_password_field (WebKitDOMNode *username_node)
EphyEmbedFormAuth *form_auth;
WebKitDOMNode *password_node;
- form_auth = (EphyEmbedFormAuth*)g_object_get_data (G_OBJECT (username_node),
- "ephy-form-auth");
+ form_auth = (EphyEmbedFormAuth *)g_object_get_data (G_OBJECT (username_node),
+ "ephy-form-auth");
password_node = ephy_embed_form_auth_get_password_node (form_auth);
webkit_dom_html_input_element_set_value (WEBKIT_DOM_HTML_INPUT_ELEMENT (password_node), "");
@@ -767,8 +766,8 @@ pre_fill_password (WebKitDOMNode *username_node)
{
EphyEmbedFormAuth *form_auth;
- form_auth = (EphyEmbedFormAuth*)g_object_get_data (G_OBJECT (username_node),
- "ephy-form-auth");
+ form_auth = (EphyEmbedFormAuth *)g_object_get_data (G_OBJECT (username_node),
+ "ephy-form-auth");
pre_fill_form (form_auth);
}
@@ -781,7 +780,7 @@ username_node_keydown_cb (WebKitDOMNode *username_node,
WebKitDOMDocument *document;
WebKitDOMElement *main_div;
WebKitDOMElement *container;
- WebKitDOMElement *selected= NULL;
+ WebKitDOMElement *selected = NULL;
WebKitDOMElement *to_select = NULL;
WebKitDOMElement *anchor;
WebKitDOMKeyboardEvent *keyboard_event;
@@ -883,7 +882,7 @@ username_node_input_cb (WebKitDOMNode *username_node,
WebKitDOMDocument *document;
WebKitDOMElement *main_div;
- g_object_set_data (G_OBJECT (username_node), "ephy-user-ever-edited", GINT_TO_POINTER(TRUE));
+ g_object_set_data (G_OBJECT (username_node), "ephy-user-ever-edited", GINT_TO_POINTER (TRUE));
document = webkit_web_page_get_dom_document (web_page);
remove_user_choices (document);
show_user_choices (document, username_node);
@@ -905,7 +904,7 @@ form_destroyed_cb (gpointer form_auth, GObject *form)
}
static void
-web_page_document_loaded (WebKitWebPage *web_page,
+web_page_document_loaded (WebKitWebPage *web_page,
EphyWebExtension *extension)
{
WebKitDOMHTMLCollection *forms = NULL;
@@ -923,7 +922,7 @@ web_page_document_loaded (WebKitWebPage *web_page,
if (forms_n == 0) {
LOG ("No forms found.");
- g_object_unref(forms);
+ g_object_unref (forms);
return;
}
@@ -992,12 +991,12 @@ web_page_document_loaded (WebKitWebPage *web_page,
LOG ("No pre-fillable/hookable form found");
}
- g_object_unref(forms);
+ g_object_unref (forms);
}
static void
-web_page_uri_changed (WebKitWebPage *web_page,
- GParamSpec *param_spec,
+web_page_uri_changed (WebKitWebPage *web_page,
+ GParamSpec *param_spec,
EphyWebExtension *extension)
{
EphyWebOverview *overview = NULL;
@@ -1009,10 +1008,10 @@ web_page_uri_changed (WebKitWebPage *web_page,
}
static gboolean
-web_page_context_menu (WebKitWebPage *web_page,
- WebKitContextMenu *context_menu,
+web_page_context_menu (WebKitWebPage *web_page,
+ WebKitContextMenu *context_menu,
WebKitWebHitTestResult *hit_test_result,
- gpointer user_data)
+ gpointer user_data)
{
char *string;
GVariantBuilder builder;
@@ -1028,8 +1027,7 @@ web_page_context_menu (WebKitWebPage *web_page,
string = ephy_web_dom_utils_get_selection_as_string (selection);
g_object_unref (selection);
- if (!string || *string == '\0')
- {
+ if (!string || *string == '\0') {
g_free (string);
return FALSE;
}
@@ -1046,7 +1044,7 @@ web_page_context_menu (WebKitWebPage *web_page,
static void
ephy_web_extension_emit_page_created (EphyWebExtension *extension,
- guint64 page_id)
+ guint64 page_id)
{
GError *error = NULL;
@@ -1084,7 +1082,7 @@ ephy_web_extension_emit_page_created_signals_pending (EphyWebExtension *extensio
static void
ephy_web_extension_queue_page_created_signal_emission (EphyWebExtension *extension,
- guint64 page_id)
+ guint64 page_id)
{
if (!extension->page_created_signals_pending)
extension->page_created_signals_pending = g_array_new (FALSE, FALSE, sizeof (guint64));
@@ -1093,7 +1091,7 @@ ephy_web_extension_queue_page_created_signal_emission (EphyWebExtension *extensi
static void
ephy_web_extension_page_created_cb (EphyWebExtension *extension,
- WebKitWebPage *web_page)
+ WebKitWebPage *web_page)
{
guint64 page_id;
@@ -1119,8 +1117,8 @@ ephy_web_extension_page_created_cb (EphyWebExtension *extension,
static WebKitWebPage *
get_webkit_web_page_or_return_dbus_error (GDBusMethodInvocation *invocation,
- WebKitWebExtension *web_extension,
- guint64 page_id)
+ WebKitWebExtension *web_extension,
+ guint64 page_id)
{
WebKitWebPage *web_page = webkit_web_extension_get_page (web_extension, page_id);
if (!web_page) {
@@ -1131,14 +1129,14 @@ get_webkit_web_page_or_return_dbus_error (GDBusMethodInvocation *invocation,
}
static void
-handle_method_call (GDBusConnection *connection,
- const char *sender,
- const char *object_path,
- const char *interface_name,
- const char *method_name,
- GVariant *parameters,
+handle_method_call (GDBusConnection *connection,
+ const char *sender,
+ const char *object_path,
+ const char *interface_name,
+ const char *method_name,
+ GVariant *parameters,
GDBusMethodInvocation *invocation,
- gpointer user_data)
+ gpointer user_data)
{
EphyWebExtension *extension = EPHY_WEB_EXTENSION (user_data);
@@ -1195,7 +1193,7 @@ handle_method_call (GDBusConnection *connection,
return;
}
- document= webkit_web_page_get_dom_document (web_page);
+ document = webkit_web_page_get_dom_document (web_page);
result = ephy_web_dom_utils_get_best_icon (document, base_uri, &uri, &color);
g_dbus_method_invocation_return_value (invocation,
@@ -1298,9 +1296,9 @@ ephy_web_extension_dispose (GObject *object)
}
if (extension->page_created_signals_pending) {
- g_array_free (extension->page_created_signals_pending, TRUE);
- extension->page_created_signals_pending = NULL;
- }
+ g_array_free (extension->page_created_signals_pending, TRUE);
+ extension->page_created_signals_pending = NULL;
+ }
g_clear_object (&extension->cancellable);
g_clear_object (&extension->dbus_connection);
@@ -1325,7 +1323,7 @@ ephy_web_extension_init (EphyWebExtension *extension)
}
static gpointer
-ephy_web_extension_create_instance(gpointer data)
+ephy_web_extension_create_instance (gpointer data)
{
return g_object_new (EPHY_TYPE_WEB_EXTENSION, NULL);
}
@@ -1338,8 +1336,8 @@ ephy_web_extension_get (void)
}
static void
-dbus_connection_created_cb (GObject *source_object,
- GAsyncResult *result,
+dbus_connection_created_cb (GObject *source_object,
+ GAsyncResult *result,
EphyWebExtension *extension)
{
static GDBusNodeInfo *introspection_data = NULL;
@@ -1378,19 +1376,19 @@ dbus_connection_created_cb (GObject *source_object,
static gboolean
authorize_authenticated_peer_cb (GDBusAuthObserver *observer,
- GIOStream *stream,
- GCredentials *credentials,
- EphyWebExtension *extension)
+ GIOStream *stream,
+ GCredentials *credentials,
+ EphyWebExtension *extension)
{
return ephy_dbus_peer_is_authorized (credentials);
}
void
-ephy_web_extension_initialize (EphyWebExtension *extension,
+ephy_web_extension_initialize (EphyWebExtension *extension,
WebKitWebExtension *wk_extension,
- const char *server_address,
- const char *dot_dir,
- gboolean is_private_profile)
+ const char *server_address,
+ const char *dot_dir,
+ gboolean is_private_profile)
{
GDBusAuthObserver *observer;
diff --git a/embed/web-extension/ephy-web-overview-model.c b/embed/web-extension/ephy-web-overview-model.c
index 7a8687fdf..bc6f97523 100644
--- a/embed/web-extension/ephy-web-overview-model.c
+++ b/embed/web-extension/ephy-web-overview-model.c
@@ -21,8 +21,7 @@
#include <libsoup/soup.h>
-struct _EphyWebOverviewModel
-{
+struct _EphyWebOverviewModel {
GObject parent_instance;
GList *items;
@@ -31,8 +30,7 @@ struct _EphyWebOverviewModel
G_DEFINE_TYPE (EphyWebOverviewModel, ephy_web_overview_model, G_TYPE_OBJECT)
-enum
-{
+enum {
URLS_CHANGED,
THUMBNAIL_CHANGED,
TITLE_CHANGED,
@@ -110,7 +108,7 @@ ephy_web_overview_model_new (void)
void
ephy_web_overview_model_set_urls (EphyWebOverviewModel *model,
- GList *urls)
+ GList *urls)
{
g_return_if_fail (EPHY_IS_WEB_OVERVIEW_MODEL (model));
@@ -129,8 +127,8 @@ ephy_web_overview_model_get_urls (EphyWebOverviewModel *model)
void
ephy_web_overview_model_set_url_thumbnail (EphyWebOverviewModel *model,
- const char *url,
- const char *path)
+ const char *url,
+ const char *path)
{
const char *thumbnail_path;
@@ -146,7 +144,7 @@ ephy_web_overview_model_set_url_thumbnail (EphyWebOverviewModel *model,
const char *
ephy_web_overview_model_get_url_thumbnail (EphyWebOverviewModel *model,
- const char *url)
+ const char *url)
{
g_return_val_if_fail (EPHY_IS_WEB_OVERVIEW_MODEL (model), NULL);
@@ -155,8 +153,8 @@ ephy_web_overview_model_get_url_thumbnail (EphyWebOverviewModel *model,
void
ephy_web_overview_model_set_url_title (EphyWebOverviewModel *model,
- const char *url,
- const char *title)
+ const char *url,
+ const char *title)
{
GList *l;
gboolean changed = FALSE;
@@ -183,7 +181,7 @@ ephy_web_overview_model_set_url_title (EphyWebOverviewModel *model,
void
ephy_web_overview_model_delete_url (EphyWebOverviewModel *model,
- const char *url)
+ const char *url)
{
GList *l;
gboolean changed = FALSE;
@@ -211,7 +209,7 @@ ephy_web_overview_model_delete_url (EphyWebOverviewModel *model,
void
ephy_web_overview_model_delete_host (EphyWebOverviewModel *model,
- const char *host)
+ const char *host)
{
GList *l;
gboolean changed = FALSE;
diff --git a/embed/web-extension/ephy-web-overview.c b/embed/web-extension/ephy-web-overview.c
index 14ad5f674..e252bfe8c 100644
--- a/embed/web-extension/ephy-web-overview.c
+++ b/embed/web-extension/ephy-web-overview.c
@@ -25,8 +25,7 @@
#include <webkitdom/WebKitDOMElementUnstable.h>
#include <webkitdom/WebKitDOMDOMTokenList.h>
-struct _EphyWebOverview
-{
+struct _EphyWebOverview {
GObject parent_instance;
WebKitWebPage *web_page;
@@ -38,8 +37,7 @@ struct _EphyWebOverview
G_DEFINE_TYPE (EphyWebOverview, ephy_web_overview, G_TYPE_OBJECT)
-enum
-{
+enum {
PROP_0,
PROP_WEB_PAGE,
PROP_MODEL,
@@ -70,7 +68,7 @@ overview_item_new (WebKitDOMElement *anchor)
nodes = webkit_dom_node_get_child_nodes (WEBKIT_DOM_NODE (anchor));
n_nodes = webkit_dom_node_list_get_length (nodes);
for (i = 0; i < n_nodes; i++) {
- WebKitDOMNode* node = webkit_dom_node_list_item (nodes, i);
+ WebKitDOMNode *node = webkit_dom_node_list_item (nodes, i);
WebKitDOMElement *element;
char *tag;
@@ -111,7 +109,7 @@ overview_item_free (OverviewItem *item)
static void
update_thumbnail_element_style (WebKitDOMElement *thumbnail,
- const char *path)
+ const char *path)
{
char *style;
@@ -122,12 +120,12 @@ update_thumbnail_element_style (WebKitDOMElement *thumbnail,
static void
ephy_web_overview_model_urls_changed (EphyWebOverviewModel *model,
- EphyWebOverview *overview)
+ EphyWebOverview *overview)
{
GList *urls;
GList *l;
GList *items;
- OverviewItem* item;
+ OverviewItem *item;
urls = ephy_web_overview_model_get_urls (model);
@@ -250,9 +248,9 @@ apply_delayed_thumbnail_change (gpointer key,
static void
ephy_web_overview_model_thumbnail_changed (EphyWebOverviewModel *model,
- const char *url,
- const char *path,
- EphyWebOverview *overview)
+ const char *url,
+ const char *path,
+ EphyWebOverview *overview)
{
GList *l;
for (l = overview->items; l; l = g_list_next (l)) {
@@ -283,9 +281,9 @@ ephy_web_overview_model_thumbnail_changed (EphyWebOverviewModel *model,
static void
ephy_web_overview_model_title_changed (EphyWebOverviewModel *model,
- const char *url,
- const char *title,
- EphyWebOverview *overview)
+ const char *url,
+ const char *title,
+ EphyWebOverview *overview)
{
GList *l;
@@ -301,8 +299,8 @@ ephy_web_overview_model_title_changed (EphyWebOverviewModel *model,
}
static void
-ephy_web_overview_update_thumbnail_in_model_from_element (EphyWebOverview *overview,
- const char *url,
+ephy_web_overview_update_thumbnail_in_model_from_element (EphyWebOverview *overview,
+ const char *url,
WebKitDOMElement *thumbnail)
{
WebKitDOMCSSStyleDeclaration *style;
@@ -342,7 +340,7 @@ ephy_web_overview_update_thumbnail_in_model_from_element (EphyWebOverview *overv
}
static void
-ephy_web_overview_document_loaded (WebKitWebPage *web_page,
+ephy_web_overview_document_loaded (WebKitWebPage *web_page,
EphyWebOverview *overview)
{
WebKitDOMDocument *document;
@@ -353,7 +351,7 @@ ephy_web_overview_document_loaded (WebKitWebPage *web_page,
nodes = webkit_dom_document_get_elements_by_tag_name (document, "a");
n_nodes = webkit_dom_node_list_get_length (nodes);
for (i = 0; i < n_nodes; i++) {
- WebKitDOMElement* element = WEBKIT_DOM_ELEMENT (webkit_dom_node_list_item (nodes, i));
+ WebKitDOMElement *element = WEBKIT_DOM_ELEMENT (webkit_dom_node_list_item (nodes, i));
char *class;
class = webkit_dom_element_get_class_name (element);
@@ -381,24 +379,23 @@ ephy_web_overview_document_loaded (WebKitWebPage *web_page,
}
static void
-ephy_web_overview_set_property (GObject *object,
- guint prop_id,
+ephy_web_overview_set_property (GObject *object,
+ guint prop_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
EphyWebOverview *overview = EPHY_WEB_OVERVIEW (object);
- switch (prop_id)
- {
- case PROP_WEB_PAGE:
- overview->web_page = g_value_get_object (value);
- break;
- case PROP_MODEL:
- overview->model = g_value_get_object (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ switch (prop_id) {
+ case PROP_WEB_PAGE:
+ overview->web_page = g_value_get_object (value);
+ break;
+ case PROP_MODEL:
+ overview->model = g_value_get_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
@@ -471,7 +468,7 @@ ephy_web_overview_init (EphyWebOverview *overview)
}
EphyWebOverview *
-ephy_web_overview_new (WebKitWebPage *web_page,
+ephy_web_overview_new (WebKitWebPage *web_page,
EphyWebOverviewModel *model)
{
g_return_val_if_fail (WEBKIT_IS_WEB_PAGE (web_page), NULL);