summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <none@none>2012-08-23 10:59:07 +0200
committerportix <none@none>2012-08-23 10:59:07 +0200
commit6010bfed1988b10564c718a3ded677d57fd0b1ff (patch)
tree2941cedb800c1951a09492d2e7bc738597f050f8 /src
parentc75b37ea9cce3508283b4a929f372dca4b92f664 (diff)
downloaddwb-6010bfed1988b10564c718a3ded677d57fd0b1ff.zip
Renaming variables
Diffstat (limited to 'src')
-rw-r--r--src/adblock.c120
-rw-r--r--src/application.c110
-rw-r--r--src/completion.c56
-rw-r--r--src/domain.c16
-rw-r--r--src/download.c38
-rw-r--r--src/entry.c8
-rw-r--r--src/js.c1
-rw-r--r--src/scripts.c222
-rw-r--r--src/session.c28
-rw-r--r--src/soup.c54
-rw-r--r--src/view.c26
11 files changed, 339 insertions, 340 deletions
diff --git a/src/adblock.c b/src/adblock.c
index cfa7c77d..61f23abb 100644
--- a/src/adblock.c
+++ b/src/adblock.c
@@ -75,17 +75,17 @@ typedef struct _AdblockElementHider {
/*}}}*/
/* Static variables {{{*/
-static GPtrArray *_simple_rules;
-static GPtrArray *_simple_exceptions;
-static GPtrArray *_rules;
-static GPtrArray *_exceptions;
-static GHashTable *_hider_rules;
-gboolean _has_hider_rules;
+static GPtrArray *m_simple_rules;
+static GPtrArray *m_simple_exceptions;
+static GPtrArray *m_rules;
+static GPtrArray *m_exceptions;
+static GHashTable *m_hider_rules;
+gboolean m_has_hider_rules;
/* only used to freeing elementhider */
-static GSList *_hider_list;
-static GString *_css_rules;
-static GString *_css_exceptions;
-static gboolean _init = false;
+static GSList *m_hider_list;
+static GString *m_css_rules;
+static GString *m_css_exceptions;
+static gboolean m_init = false;
/*}}}*//*}}}*/
@@ -249,8 +249,8 @@ adblock_prepare_match(const char *uri, const char *baseURI, AdblockAttribute att
const char *basedomain = domain_get_base_for_host(basehost);
gboolean thirdparty = g_strcmp0(domain, basedomain);
- if (!adblock_match(_exceptions, realuri, host, domain, basehost, basedomain, attributes, thirdparty)) {
- if (adblock_match(_rules, realuri, host, domain, basehost, basedomain, attributes, thirdparty)) {
+ if (!adblock_match(m_exceptions, realuri, host, domain, basehost, basedomain, attributes, thirdparty)) {
+ if (adblock_match(m_rules, realuri, host, domain, basehost, basedomain, attributes, thirdparty)) {
ret = true;
}
}
@@ -302,7 +302,7 @@ adblock_apply_element_hider(WebKitWebFrame *frame, GList *gl) {
gboolean has_exception = false;
for (int i=0; subdomains[i]; i++) {
- list = g_hash_table_lookup(_hider_rules, subdomains[i]);
+ list = g_hash_table_lookup(m_hider_rules, subdomains[i]);
if (list) {
for (GSList *l = list; l; l=l->next) {
hider = l->data;
@@ -318,10 +318,10 @@ adblock_apply_element_hider(WebKitWebFrame *frame, GList *gl) {
}
/* Adding replaced exceptions */
if (! has_exception) {
- g_string_append(css_rule, _css_exceptions->str);
+ g_string_append(css_rule, m_css_exceptions->str);
}
- if (_css_rules != NULL && _css_rules->len > 1) {
- g_string_append(css_rule, _css_rules->str);
+ if (m_css_rules != NULL && m_css_rules->len > 1) {
+ g_string_append(css_rule, m_css_rules->str);
}
if (css_rule != NULL && css_rule->len > 0) {
if (css_rule->str[css_rule->len-1] == ',')
@@ -469,8 +469,8 @@ adblock_resource_request_cb(WebKitWebView *wv, WebKitWebFrame *frame,
return;
gboolean thirdparty = g_strcmp0(domain, firstdomain);
- if (!adblock_match(_simple_exceptions, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) {
- if (adblock_match(_simple_rules, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) {
+ if (!adblock_match(m_simple_exceptions, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) {
+ if (adblock_match(m_simple_rules, uri, host, domain, firsthost, firstdomain, attribute, thirdparty)) {
webkit_network_request_set_uri(request, "about:blank");
}
}
@@ -496,7 +496,7 @@ adblock_load_status_cb(WebKitWebView *wv, GParamSpec *p, GList *gl) {
gboolean
adblock_running() {
- return _init && GET_BOOL("adblocker");
+ return m_init && GET_BOOL("adblocker");
}
/* adblock_disconnect(GList *) {{{*/
@@ -524,13 +524,13 @@ adblock_disconnect(GList *gl) {
/* adblock_connect() {{{*/
void
adblock_connect(GList *gl) {
- if (!_init && !adblock_init())
+ if (!m_init && !adblock_init())
return;
- if (_rules->len > 0 || _css_rules->len > 0 || _has_hider_rules) {
+ if (m_rules->len > 0 || m_css_rules->len > 0 || m_has_hider_rules) {
VIEW(gl)->status->signals[SIG_AD_LOAD_STATUS] = g_signal_connect(WEBVIEW(gl), "notify::load-status", G_CALLBACK(adblock_load_status_cb), gl);
VIEW(gl)->status->signals[SIG_AD_FRAME_CREATED] = g_signal_connect(WEBVIEW(gl), "frame-created", G_CALLBACK(adblock_frame_created_cb), gl);
}
- if (_simple_rules->len > 0) {
+ if (m_simple_rules->len > 0) {
VIEW(gl)->status->signals[SIG_AD_RESOURCE_REQUEST] = g_signal_connect(WEBVIEW(gl), "resource-request-starting", G_CALLBACK(adblock_resource_request_cb), gl);
}
}/*}}}*/
@@ -592,29 +592,29 @@ adblock_rule_parse(char *filterlist) {
domain++;
else
hider_exc = false;
- list = g_hash_table_lookup(_hider_rules, domain);
+ list = g_hash_table_lookup(m_hider_rules, domain);
if (list == NULL) {
list = g_slist_append(list, hider);
- g_hash_table_insert(_hider_rules, g_strdup(domain), list);
+ g_hash_table_insert(m_hider_rules, g_strdup(domain), list);
}
else {
list = g_slist_append(list, hider);
(void) list;
}
- _has_hider_rules = true;
+ m_has_hider_rules = true;
}
hider->exception = hider_exc;
if (hider_exc) {
- g_string_append(_css_exceptions, tmp + 2);
- g_string_append_c(_css_exceptions, ',');
+ g_string_append(m_css_exceptions, tmp + 2);
+ g_string_append_c(m_css_exceptions, ',');
}
- _hider_list = g_slist_append(_hider_list, hider);
+ m_hider_list = g_slist_append(m_hider_list, hider);
g_free(domains);
}
/* general rules */
else {
- g_string_append(_css_rules, tmp + 2);
- g_string_append_c(_css_rules, ',');
+ g_string_append(m_css_rules, tmp + 2);
+ g_string_append_c(m_css_rules, ',');
}
}
/* Request patterns */
@@ -774,15 +774,15 @@ adblock_rule_parse(char *filterlist) {
if (!(attributes & ~(AA_SUBDOCUMENT | AA_DOCUMENT))) {
if (exception)
- g_ptr_array_add(_simple_exceptions, adrule);
+ g_ptr_array_add(m_simple_exceptions, adrule);
else
- g_ptr_array_add(_simple_rules, adrule);
+ g_ptr_array_add(m_simple_rules, adrule);
}
else {
if (exception)
- g_ptr_array_add(_exceptions, adrule);
+ g_ptr_array_add(m_exceptions, adrule);
else
- g_ptr_array_add(_rules, adrule);
+ g_ptr_array_add(m_rules, adrule);
}
}
error_out:
@@ -795,31 +795,31 @@ error_out:
/* adblock_end() {{{*/
void
adblock_end() {
- if (_css_rules != NULL)
- g_string_free(_css_rules, true);
- if (_css_exceptions != NULL)
- g_string_free(_css_exceptions, true);
- if (_rules != NULL)
- g_ptr_array_free(_rules, true);
- if (_simple_rules != NULL)
- g_ptr_array_free(_simple_rules, true);
- if (_simple_exceptions != NULL)
- g_ptr_array_free(_simple_exceptions, true);
- if(_exceptions != NULL)
- g_ptr_array_free(_exceptions, true);
- if (_hider_rules != NULL)
- g_hash_table_remove_all(_hider_rules);
- if (_hider_list != NULL) {
- for (GSList *l = _hider_list; l; l=l->next)
+ if (m_css_rules != NULL)
+ g_string_free(m_css_rules, true);
+ if (m_css_exceptions != NULL)
+ g_string_free(m_css_exceptions, true);
+ if (m_rules != NULL)
+ g_ptr_array_free(m_rules, true);
+ if (m_simple_rules != NULL)
+ g_ptr_array_free(m_simple_rules, true);
+ if (m_simple_exceptions != NULL)
+ g_ptr_array_free(m_simple_exceptions, true);
+ if(m_exceptions != NULL)
+ g_ptr_array_free(m_exceptions, true);
+ if (m_hider_rules != NULL)
+ g_hash_table_remove_all(m_hider_rules);
+ if (m_hider_list != NULL) {
+ for (GSList *l = m_hider_list; l; l=l->next)
adblock_element_hider_free((AdblockElementHider*)l->data);
- g_slist_free(_hider_list);
+ g_slist_free(m_hider_list);
}
}/*}}}*/
/* adblock_init() {{{*/
gboolean
adblock_init() {
- if (_init)
+ if (m_init)
return true;
if (!GET_BOOL("adblocker"))
return false;
@@ -832,14 +832,14 @@ adblock_init() {
fprintf(stderr, "Filterlist not found: %s\n", filterlist);
return false;
}
- _rules = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
- _exceptions = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
- _simple_rules = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
- _simple_exceptions = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
- _hider_rules = g_hash_table_new_full((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal, (GDestroyNotify)g_free, NULL);
- _css_exceptions = g_string_new(NULL);
- _css_rules = g_string_new(NULL);
+ m_rules = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
+ m_exceptions = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
+ m_simple_rules = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
+ m_simple_exceptions = g_ptr_array_new_with_free_func((GDestroyNotify)adblock_rule_free);
+ m_hider_rules = g_hash_table_new_full((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal, (GDestroyNotify)g_free, NULL);
+ m_css_exceptions = g_string_new(NULL);
+ m_css_rules = g_string_new(NULL);
adblock_rule_parse(filterlist);
- _init = true;
+ m_init = true;
return true;
}/*}}}*//*}}}*/
diff --git a/src/application.c b/src/application.c
index a1c69d7b..44c2c771 100644
--- a/src/application.c
+++ b/src/application.c
@@ -31,28 +31,28 @@ static GOptionContext * application_get_option_context(void);
static void application_start(GApplication *, char **);
/* Option parsing arguments {{{ */
-static gboolean opt_list_sessions = false;
-static gboolean opt_single = false;
-static gboolean opt_override_restore = false;
-static gboolean opt_version = false;
-static gboolean opt_force = false;
-static gboolean opt_enable_scripts = false;
-static gchar *opt_restore = NULL;
-static gchar **opt_exe = NULL;
-static gchar **scripts = NULL;
-static GIOChannel *_fallback_channel;
+static gboolean m_opt_list_sessions = false;
+static gboolean m_opt_single = false;
+static gboolean m_opt_override_restore = false;
+static gboolean m_opt_version = false;
+static gboolean m_opt_force = false;
+static gboolean m_opt_enable_scripts = false;
+static gchar *m_opt_restore = NULL;
+static gchar **m_opt_exe = NULL;
+static gchar **m_scripts = NULL;
+static GIOChannel *m_fallback_channel;
static GOptionEntry options[] = {
{ "embed", 'e', 0, G_OPTION_ARG_INT64, &dwb.gui.wid, "Embed into window with window id wid", "wid"},
- { "force", 'f', 0, G_OPTION_ARG_NONE, &opt_force, "Force restoring a saved session, even if another process has restored the session", NULL },
- { "list-sessions", 'l', 0, G_OPTION_ARG_NONE, &opt_list_sessions, "List saved sessions and exit", NULL },
- { "new-instance", 'n', 0, G_OPTION_ARG_NONE, &opt_single, "Open a new instance, overrides 'single-instance'", NULL},
+ { "force", 'f', 0, G_OPTION_ARG_NONE, &m_opt_force, "Force restoring a saved session, even if another process has restored the session", NULL },
+ { "list-sessions", 'l', 0, G_OPTION_ARG_NONE, &m_opt_list_sessions, "List saved sessions and exit", NULL },
+ { "new-instance", 'n', 0, G_OPTION_ARG_NONE, &m_opt_single, "Open a new instance, overrides 'single-instance'", NULL},
{ "restore", 'r', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, &application_parse_option, "Restore session with name 'sessionname' or default if name is omitted", "sessionname"},
- { "override-restore", 'R', 0, G_OPTION_ARG_NONE, &opt_override_restore, "Don't restore last session even if 'save-session' is set", NULL},
+ { "override-restore", 'R', 0, G_OPTION_ARG_NONE, &m_opt_override_restore, "Don't restore last session even if 'save-session' is set", NULL},
{ "profile", 'p', 0, G_OPTION_ARG_STRING, &dwb.misc.profile, "Load configuration for 'profile'", "profile" },
- { "execute", 'x', 0, G_OPTION_ARG_STRING_ARRAY, &opt_exe, "Execute commands", NULL},
- { "version", 'v', 0, G_OPTION_ARG_NONE, &opt_version, "Show version information and exit", NULL},
- { "scripts", 's', 0, G_OPTION_ARG_FILENAME_ARRAY, &scripts, "Execute a script", NULL},
- { "enable-scripts", 'S', 0, G_OPTION_ARG_NONE, &opt_enable_scripts, "Enable javascript api", NULL},
+ { "execute", 'x', 0, G_OPTION_ARG_STRING_ARRAY, &m_opt_exe, "Execute commands", NULL},
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &m_opt_version, "Show version information and exit", NULL},
+ { "scripts", 's', 0, G_OPTION_ARG_FILENAME_ARRAY, &m_scripts, "Execute a script", NULL},
+ { "enable-scripts", 'S', 0, G_OPTION_ARG_NONE, &m_opt_enable_scripts, "Enable javascript api", NULL},
{ NULL }
};
static GOptionContext *option_context;
@@ -81,7 +81,7 @@ struct _DwbApplicationClass
};
G_DEFINE_TYPE(DwbApplication, dwb_application, G_TYPE_APPLICATION);
-static DwbApplication *_app;
+static DwbApplication *m_app;
static void
dwb_application_main(GApplication *app) {
@@ -151,8 +151,8 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_
*exit_status = 1;
return true;
}
- if (scripts != NULL) {
- scripts_execute_scripts(scripts);
+ if (m_scripts != NULL) {
+ scripts_execute_scripts(m_scripts);
g_application_hold(app);
return true;
}
@@ -162,21 +162,21 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_
argc_remain = g_strv_length(*argv);
- if (opt_exe != NULL)
- argc_exe = g_strv_length(opt_exe);
+ if (m_opt_exe != NULL)
+ argc_exe = g_strv_length(m_opt_exe);
dwb_init_files();
dwb_init_settings();
- if (opt_list_sessions) {
+ if (m_opt_list_sessions) {
session_list();
return true;
}
- if (opt_version) {
+ if (m_opt_version) {
dwb_version();
return true;
}
single_instance = GET_BOOL("single-instance");
- if (opt_single || !single_instance) {
+ if (m_opt_single || !single_instance) {
g_application_set_flags(app, G_APPLICATION_NON_UNIQUE);
}
GDBusConnection *bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
@@ -191,10 +191,10 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_
return false;
count = i = 0;
restore_args[count++] = g_strdup((*argv)[0]);
- if (opt_exe != NULL) {
- for (; opt_exe[i] != NULL; i++) {
+ if (m_opt_exe != NULL) {
+ for (; m_opt_exe[i] != NULL; i++) {
restore_args[2*i + count] = g_strdup("-x");
- restore_args[2*i + 1 + count] = opt_exe[i];
+ restore_args[2*i + 1 + count] = m_opt_exe[i];
}
}
for (; (*argv)[count]; count++) {
@@ -233,7 +233,7 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_
if ( (ff = fdopen(fd, "w")) )
remote = true;
if ( remote ) {
- if (argc_remain > 1 || opt_exe != NULL) {
+ if (argc_remain > 1 || m_opt_exe != NULL) {
for (int i=1; (*argv)[i]; i++) {
if ( (path = application_local_path((*argv)[i])) ) {
fprintf(ff, "tabopen %s\n", path);
@@ -243,22 +243,22 @@ dwb_application_local_command_line(GApplication *app, gchar ***argv, gint *exit_
fprintf(ff, "tabopen %s\n", (*argv)[i]);
}
}
- if (opt_exe != NULL) {
- for (int i = 0; opt_exe[i]; i++) {
- fprintf(ff, "%s\n", opt_exe[i]);
+ if (m_opt_exe != NULL) {
+ for (int i = 0; m_opt_exe[i]; i++) {
+ fprintf(ff, "%s\n", m_opt_exe[i]);
}
}
goto clean;
}
}
else {
- GIOChannel *_fallback_channel = g_io_channel_new_file(unififo, "r+", NULL);
- g_io_add_watch(_fallback_channel, G_IO_IN, (GIOFunc)application_handle_channel, NULL);
+ GIOChannel *m_fallback_channel = g_io_channel_new_file(unififo, "r+", NULL);
+ g_io_add_watch(m_fallback_channel, G_IO_IN, (GIOFunc)application_handle_channel, NULL);
}
}
}
- if (GET_BOOL("save-session") && !remote && !opt_single)
- opt_force = true;
+ if (GET_BOOL("save-session") && !remote && !m_opt_single)
+ m_opt_force = true;
application_start(app, *argv);
clean:
if (ff != NULL)
@@ -299,10 +299,10 @@ application_execute_args(char **argv) {
view_add(argv[i], false);
}
}
- if (opt_exe != NULL) {
- int length = g_strv_length(opt_exe);
+ if (m_opt_exe != NULL) {
+ int length = g_strv_length(m_opt_exe);
for (int i=offset; i<length; i++) {
- dwb_parse_commands(opt_exe[i]);
+ dwb_parse_commands(m_opt_exe[i]);
}
offset = length;
}
@@ -318,18 +318,18 @@ application_start(GApplication *app, char **argv) {
dwb_init();
dwb_pack(GET_CHAR("widget-packing"), false);
- scripts_init(opt_enable_scripts);
+ scripts_init(m_opt_enable_scripts);
- if (opt_force)
+ if (m_opt_force)
session_flags |= SESSION_FORCE;
/* restore session */
- if (! opt_override_restore) {
- if (GET_BOOL("save-session") || opt_restore != NULL) {
- restored = session_restore(opt_restore, session_flags);
+ if (! m_opt_override_restore) {
+ if (GET_BOOL("save-session") || m_opt_restore != NULL) {
+ restored = session_restore(m_opt_restore, session_flags);
}
}
else {
- session_restore(opt_restore, session_flags | SESSION_ONLY_MARK);
+ session_restore(m_opt_restore, session_flags | SESSION_ONLY_MARK);
}
if ((! restored && g_strv_length(argv) == 1)) {
view_add(NULL, false);
@@ -365,9 +365,9 @@ static gboolean /* application_parse_option(const gchar *key, const gchar *value
application_parse_option(const gchar *key, const gchar *value, gpointer data, GError **error) {
if (!g_strcmp0(key, "-r") || !g_strcmp0(key, "--restore")) {
if (value != NULL)
- opt_restore = g_strdup(value);
+ m_opt_restore = g_strdup(value);
else
- opt_restore = g_strdup("default");
+ m_opt_restore = g_strdup("default");
return true;
}
else {
@@ -378,17 +378,17 @@ application_parse_option(const gchar *key, const gchar *value, gpointer data, GE
void /* application_stop() {{{*/
application_stop(void) {
- if (_fallback_channel != NULL) {
- g_io_channel_shutdown(_fallback_channel, true, NULL);
- g_io_channel_unref(_fallback_channel);
+ if (m_fallback_channel != NULL) {
+ g_io_channel_shutdown(m_fallback_channel, true, NULL);
+ g_io_channel_unref(m_fallback_channel);
}
- g_application_release(G_APPLICATION(_app));
+ g_application_release(G_APPLICATION(m_app));
}/*}}}*/
gint /* application_run(gint, char **) {{{*/
application_run(gint argc, gchar **argv) {
- _app = dwb_application_new("org.bitbucket.dwb", 0);
- gint ret = g_application_run(G_APPLICATION(_app), argc, argv);
- g_object_unref(_app);
+ m_app = dwb_application_new("org.bitbucket.dwb", 0);
+ gint ret = g_application_run(G_APPLICATION(m_app), argc, argv);
+ g_object_unref(m_app);
return ret;
}/*}}}*/
diff --git a/src/completion.c b/src/completion.c
index 2218e804..c7cf2fe9 100644
--- a/src/completion.c
+++ b/src/completion.c
@@ -29,11 +29,11 @@ static GList * completion_update_completion(GtkWidget *box, GList *comps, GList
static GList * completion_get_simple_completion(GList *gl);
typedef gboolean (*Match_Func)(char*, const char*);
-static char *_typed;
-static int _last_buf;
-static gboolean _leading0 = false;
-static char *_current_command;
-static int _command_len;
+static char *m_typed;
+static int m_last_buf;
+static gboolean m_leading0 = false;
+static char *m_current_command;
+static int m_command_len;
/* GUI_FUNCTIONS {{{*/
/* completion_modify_completion_item(Completion *c, GdkColor *fg, GdkColor *bg, PangoFontDescription *fd) {{{*/
@@ -97,7 +97,7 @@ completion_init_completion(GList *store, GList *gl, gboolean word_beginnings, vo
const char *input = GET_TEXT();
gboolean match;
char **token = NULL;
- _typed = g_strdup(input);
+ m_typed = g_strdup(input);
if (dwb.state.mode & COMMAND_MODE)
input = strchr(input, ' ');
if (input == NULL)
@@ -147,9 +147,9 @@ completion_set_entry_text(Completion *c) {
break;
}
- if (dwb.state.mode & COMMAND_MODE && _current_command) {
- gtk_entry_set_text(GTK_ENTRY(dwb.gui.entry), _current_command);
- l = strlen(_current_command);
+ if (dwb.state.mode & COMMAND_MODE && m_current_command) {
+ gtk_entry_set_text(GTK_ENTRY(dwb.gui.entry), m_current_command);
+ l = strlen(m_current_command);
gtk_editable_insert_text(GTK_EDITABLE(dwb.gui.entry), " ", -1, &l);
gtk_editable_insert_text(GTK_EDITABLE(dwb.gui.entry), text, -1, &l);
}
@@ -249,17 +249,17 @@ completion_clean_completion(gboolean set_text) {
dwb.comps.view = NULL;
dwb.comps.completions = NULL;
dwb.comps.active_comp = NULL;
- if (set_text && _typed != NULL)
- entry_set_text(_typed);
+ if (set_text && m_typed != NULL)
+ entry_set_text(m_typed);
- FREE0(_current_command);
- _command_len = 0;
+ FREE0(m_current_command);
+ m_command_len = 0;
- FREE0(_typed);
+ FREE0(m_typed);
if (dwb.state.mode & COMPLETE_BUFFER) {
- _last_buf = 0;
- _leading0 = false;
+ m_last_buf = 0;
+ m_leading0 = false;
dwb.state.mode &= ~COMPLETE_BUFFER;
dwb_change_mode(NORMAL_MODE, true);
}
@@ -419,7 +419,7 @@ completion_get_quickmarks(int back) {
Quickmark *q;
char *escaped = NULL;
const char *input = GET_TEXT();
- _typed = g_strdup(input);
+ m_typed = g_strdup(input);
for (GList *l = dwb.fc.quickmarks; l; l=l->next) {
q = l->data;
if (g_str_has_prefix(q->key, input)) {
@@ -459,18 +459,18 @@ completion_buffer_key_press(GdkEventKey *e) {
completion_buffer_exec(g_list_nth(dwb.state.views, value-1));
}
else {
- _last_buf = 10*_last_buf + value;
- if (_last_buf > length) {
+ m_last_buf = 10*m_last_buf + value;
+ if (m_last_buf > length) {
completion_clean_completion(false);
dwb_change_mode(NORMAL_MODE, true);
return;
}
- if (_last_buf != 0) {
- if ((_last_buf < 10 && _leading0 == true) || _last_buf >= 10)
- completion_buffer_exec(g_list_nth(dwb.state.views, _last_buf-1));
+ if (m_last_buf != 0) {
+ if ((m_last_buf < 10 && m_leading0 == true) || m_last_buf >= 10)
+ completion_buffer_exec(g_list_nth(dwb.state.views, m_last_buf-1));
}
else
- _leading0 = true;
+ m_leading0 = true;
}
}
}
@@ -537,12 +537,12 @@ completion_command_line() {
}
}
if (ret) {
- _command_len = util_strlen_trailing_space(text);
- if ((_command_len > 0 && g_ascii_isspace(text[_command_len-1])) || token[1] != NULL) {
- FREE0(_current_command);
- _current_command = g_strdup(token[0]);
+ m_command_len = util_strlen_trailing_space(text);
+ if ((m_command_len > 0 && g_ascii_isspace(text[m_command_len-1])) || token[1] != NULL) {
+ FREE0(m_current_command);
+ m_current_command = g_strdup(token[0]);
dwb.state.mode |= COMPLETE_COMMAND_MODE;
- _command_len++;
+ m_command_len++;
}
else
ret = false;
diff --git a/src/domain.c b/src/domain.c
index 2112277f..1bc0024e 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -21,7 +21,7 @@
#include "domain.h"
#include "tlds.h"
-static GHashTable *_tld_table;
+static GHashTable *m_tld_table;
GSList *
domain_get_cookie_domains(WebKitWebView *wv) {
@@ -118,7 +118,7 @@ const char *
domain_get_base_for_host(const char *host) {
if (host == NULL)
return NULL;
- g_return_val_if_fail(_tld_table != NULL, NULL);
+ g_return_val_if_fail(m_tld_table != NULL, NULL);
const char *cur_domain = host;
const char *prev_domain = host;
@@ -127,7 +127,7 @@ domain_get_base_for_host(const char *host) {
char *nextdot = strchr(cur_domain, '.');
char *entry = NULL;
while (1) {
- entry = g_hash_table_lookup(_tld_table, cur_domain);
+ entry = g_hash_table_lookup(m_tld_table, cur_domain);
if (entry != NULL) {
if (*entry == '*') {
ret = pprev_domain;
@@ -158,22 +158,22 @@ domain_get_base_for_host(const char *host) {
}
void
domain_end() {
- if (_tld_table) {
- g_hash_table_unref(_tld_table);
- _tld_table = NULL;
+ if (m_tld_table) {
+ g_hash_table_unref(m_tld_table);
+ m_tld_table = NULL;
}
}
void
domain_init() {
- _tld_table = g_hash_table_new((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal);
+ m_tld_table = g_hash_table_new((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal);
char *eff_tld;
for (int i=0; (eff_tld = TLDS_EFFECTIVE[i]); i++) {
if (*eff_tld == '*' || *eff_tld == '!')
eff_tld++;
if (*eff_tld == '.')
eff_tld++;
- g_hash_table_insert(_tld_table, eff_tld, TLDS_EFFECTIVE[i]);
+ g_hash_table_insert(m_tld_table, eff_tld, TLDS_EFFECTIVE[i]);
}
}
diff --git a/src/download.c b/src/download.c
index 6fd7887b..638e1b2c 100644
--- a/src/download.c
+++ b/src/download.c
@@ -48,9 +48,9 @@ typedef struct _DwbDownloadStatus {
#define DWB_DOWNLOAD(X) ((DwbDownload*)((X)->data))
-static GList *_downloads = NULL;
-static char *_lastdir = NULL;
-static DownloadAction _lastaction;
+static GList *m_downloads = NULL;
+static char *m_lastdir = NULL;
+static DownloadAction m_lastaction;
/* dwb_get_command_from_mimetype(char *mimetype){{{*/
static char *
@@ -129,7 +129,7 @@ download_spawn_external(const char *uri, const char *filename, WebKitDownload *d
/* download_get_download_label(WebKitDownload *) {{{*/
static GList *
download_get_download_label(WebKitDownload *download) {
- for (GList *l = _downloads; l; l=l->next) {
+ for (GList *l = m_downloads; l; l=l->next) {
DwbDownload *label = l->data;
if (label->download == download) {
return l;
@@ -257,7 +257,7 @@ download_delay(DwbDownload *download) {
g_free(download->path);
g_free(download->mimetype);
g_free(download);
- if (!_downloads) {
+ if (!m_downloads) {
gtk_widget_hide(dwb.gui.downloadbar);
}
return false;
@@ -299,7 +299,7 @@ download_status_cb(WebKitDownload *download, GParamSpec *p, DwbDownloadStatus *d
g_signal_handler_disconnect(label->event, label->sig_button);
label->download = NULL;
g_timeout_add_seconds(dwb.misc.message_delay, (GSourceFunc)download_delay, label);
- _downloads = g_list_delete_link(_downloads, list);
+ m_downloads = g_list_delete_link(m_downloads, list);
}
if (dwb.state.mimetype_request) {
g_free(dwb.state.mimetype_request);
@@ -321,13 +321,13 @@ download_button_press_cb(GtkWidget *w, GdkEventButton *e, GList *gl) {
DwbStatus
download_cancel(int number) {
- if (_downloads == NULL)
+ if (m_downloads == NULL)
return STATUS_ERROR;
if (number <= 0) {
- webkit_download_cancel(DWB_DOWNLOAD(_downloads)->download);
+ webkit_download_cancel(DWB_DOWNLOAD(m_downloads)->download);
return STATUS_OK;
}
- for (GList *l = _downloads; l; l=l->next) {
+ for (GList *l = m_downloads; l; l=l->next) {
if ((gint)DWB_DOWNLOAD(l)->n == number) {
webkit_download_cancel(DWB_DOWNLOAD(l)->download);
return STATUS_OK;
@@ -455,7 +455,7 @@ download_start(const char *path) {
char *cache_name = g_build_filename(dwb.files[FILES_CACHEDIR], filename, NULL);
fullpath = g_strconcat("file://", cache_name, NULL);
g_free(cache_name);
- _lastaction = DL_ACTION_EXECUTE;
+ m_lastaction = DL_ACTION_EXECUTE;
}
else {
if (!path || *path == '\0') {
@@ -485,7 +485,7 @@ download_start(const char *path) {
path = path_buffer;
}
}
- _lastaction = DL_ACTION_DOWNLOAD;
+ m_lastaction = DL_ACTION_DOWNLOAD;
}
if (external && dwb.state.dl_action == DL_ACTION_DOWNLOAD) {
@@ -495,28 +495,28 @@ download_start(const char *path) {
}
else {
webkit_download_set_destination_uri(dwb.state.download, fullpath);
- int n = g_list_length(_downloads)+1;
+ int n = g_list_length(m_downloads)+1;
DwbDownload *active = download_add_progress_label(dwb.state.fview, filename, n);
active->action = dwb.state.dl_action;
active->path = g_strdup(path);
active->n = n;
active->mimetype = dwb.state.mimetype_request != NULL ? g_strdup(dwb.state.mimetype_request) : NULL;
gtk_widget_show_all(dwb.gui.downloadbar);
- _downloads = g_list_prepend(_downloads, active);
+ m_downloads = g_list_prepend(m_downloads, active);
DwbDownloadStatus *s = dwb_malloc(sizeof(DwbDownloadStatus));
s->blue = s->time = 0;
s->download = active;
s->progress = 0;
s->speedtime = g_get_monotonic_time();
- active->sig_button = g_signal_connect(active->event, "button-press-event", G_CALLBACK(download_button_press_cb), _downloads);
+ active->sig_button = g_signal_connect(active->event, "button-press-event", G_CALLBACK(download_button_press_cb), m_downloads);
g_signal_connect(dwb.state.download, "notify::current-size", G_CALLBACK(download_progress_cb), s);
g_signal_connect(dwb.state.download, "notify::status", G_CALLBACK(download_status_cb), s);
webkit_download_start(dwb.state.download);
dwb.state.download_ref_count++;
}
- g_free(_lastdir);
+ g_free(m_lastdir);
if (dwb.state.dl_action != DL_ACTION_EXECUTE) {
- _lastdir = g_strdup(path);
+ m_lastdir = g_strdup(path);
}
}
@@ -537,8 +537,8 @@ download_entry_set_directory() {
entry_set_text(default_dir);
return;
}
- else if (_lastdir != NULL) {
- entry_set_text(_lastdir);
+ else if (m_lastdir != NULL) {
+ entry_set_text(m_lastdir);
return;
}
else
@@ -584,7 +584,7 @@ download_get_path(GList *gl, WebKitDownload *d) {
entry_focus();
dwb.state.mode = DOWNLOAD_GET_PATH;
dwb.state.download = d;
- if ( _lastaction != DL_ACTION_DOWNLOAD &&
+ if ( m_lastaction != DL_ACTION_DOWNLOAD &&
( command != NULL || g_file_test(uri, G_FILE_TEST_EXISTS)) ) {
dwb.state.dl_action = DL_ACTION_EXECUTE;
download_entry_set_spawn_command(command);
diff --git a/src/entry.c b/src/entry.c
index 6b989b46..1f69a871 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -18,7 +18,7 @@
#include "dwb.h"
#include "entry.h"
-static char *_store;
+static char *m_store;
/* dwb_entry_history_forward {{{*/
DwbStatus
entry_history_forward(GList **last) {
@@ -26,7 +26,7 @@ entry_history_forward(GList **last) {
GList *prev = NULL;
if (*last != NULL) {
if ((*last)->prev == NULL) {
- text = _store;
+ text = m_store;
}
else {
prev = (*last)->prev;
@@ -50,8 +50,8 @@ entry_history_back(GList **list, GList **last) {
GList *next;
if (*last == NULL) {
next = *list;
- g_free(_store);
- _store = g_strdup(GET_TEXT());
+ g_free(m_store);
+ m_store = g_strdup(GET_TEXT());
}
else if ((*last)->next != NULL)
next = (*last)->next;
diff --git a/src/js.c b/src/js.c
index 412f66f2..ce566175 100644
--- a/src/js.c
+++ b/src/js.c
@@ -61,7 +61,6 @@ js_get_object_property(JSContextRef ctx, JSObjectRef arg, const char *name) {
if (exc != NULL)
return NULL;
return ret;
-
}/*}}}*/
JSValueRef
diff --git a/src/scripts.c b/src/scripts.c
index d7fa89ea..b7a50e43 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -40,7 +40,7 @@
#define PROP_LENGTH 128
#define G_FILE_TEST_VALID (G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK | G_FILE_TEST_IS_DIR | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_EXISTS)
-typedef struct _Sigmap {
+typedef struct m_Sigmap {
int sig;
const char *name;
} Sigmap;
@@ -55,7 +55,7 @@ struct _CallbackData {
StopCallbackNotify notify;
};
-static Sigmap _sigmap[] = {
+static Sigmap m_sigmap[] = {
{ SCRIPTS_SIG_NAVIGATION, "navigation" },
{ SCRIPTS_SIG_LOAD_STATUS, "loadStatus" },
{ SCRIPTS_SIG_MIME_TYPE, "mimeType" },
@@ -159,13 +159,13 @@ static void callback(CallbackData *c);
static void make_callback(JSContextRef ctx, JSObjectRef this, GObject *gobject, const char *signalname, JSValueRef value, StopCallbackNotify notify, JSValueRef *exception);
static JSObjectRef make_object(JSContextRef ctx, GObject *o);
-static JSObjectRef _sigObjects[SCRIPTS_SIG_LAST];
-static JSGlobalContextRef _global_context;
-static GSList *_script_list;
-static JSClassRef _webview_class, _frame_class, _download_class, _default_class, _download_class, _message_class;
-static gboolean _commandline = false;
-static JSObjectRef _arrayConstructor;
-static JSObjectRef _completion_callback;
+static JSObjectRef m_sig_objects[SCRIPTS_SIG_LAST];
+static JSGlobalContextRef m_global_context;
+static GSList *m_script_list;
+static JSClassRef m_webview_class, m_frame_class, m_download_class, m_default_class, m_download_class, m_message_class;
+static gboolean m_commandline = false;
+static JSObjectRef m_array_contructor;
+static JSObjectRef m_completion_callback;
static GQuark ref_quark;
/* MISC {{{*/
@@ -240,11 +240,11 @@ callback_data_new(GObject *gobject, JSObjectRef object, JSObjectRef callback, St
CallbackData *c = g_malloc(sizeof(CallbackData));
c->gobject = gobject != NULL ? g_object_ref(gobject) : NULL;
if (object != NULL) {
- JSValueProtect(_global_context, object);
+ JSValueProtect(m_global_context, object);
c->object = object;
}
if (object != NULL) {
- JSValueProtect(_global_context, callback);
+ JSValueProtect(m_global_context, callback);
c->callback = callback;
}
c->notify = notify;
@@ -258,10 +258,10 @@ callback_data_free(CallbackData *c) {
if (c->gobject != NULL)
g_object_unref(c->gobject);
if (c->object != NULL)
- JSValueUnprotect(_global_context, c->object);
- JSValueUnprotect(_global_context, c->object);
+ JSValueUnprotect(m_global_context, c->object);
+ JSValueUnprotect(m_global_context, c->object);
if (c->object != NULL)
- JSValueUnprotect(_global_context, c->callback);
+ JSValueUnprotect(m_global_context, c->callback);
g_free(c);
}
}/*}}}*/
@@ -280,10 +280,10 @@ make_callback(JSContextRef ctx, JSObjectRef this, GObject *gobject, const char *
static void
callback(CallbackData *c) {
gboolean ret = false;
- JSValueRef val[] = { c->object != NULL ? c->object : JSValueMakeNull(_global_context) };
- JSValueRef jsret = JSObjectCallAsFunction(_global_context, c->callback, NULL, 1, val, NULL);
- if (JSValueIsBoolean(_global_context, jsret))
- ret = JSValueToBoolean(_global_context, jsret);
+ JSValueRef val[] = { c->object != NULL ? c->object : JSValueMakeNull(m_global_context) };
+ JSValueRef jsret = JSObjectCallAsFunction(m_global_context, c->callback, NULL, 1, val, NULL);
+ if (JSValueIsBoolean(m_global_context, jsret))
+ ret = JSValueToBoolean(m_global_context, jsret);
if (ret || (c != NULL && c->gobject != NULL && c->notify != NULL && c->notify(c))) {
g_signal_handlers_disconnect_by_func(c->gobject, callback, c);
callback_data_free(c);
@@ -587,8 +587,8 @@ scripts_eval_key(KeyMap *m, Arg *arg) {
json = util_create_json(1, INTEGER, "nummod", dwb.state.nummod);
else
json = util_create_json(2, INTEGER, "nummod", dwb.state.nummod, CHAR, "arg", arg->p);
- JSValueRef argv[] = { js_json_to_value(_global_context, json) };
- JSObjectCallAsFunction(_global_context, arg->arg, NULL, 1, argv, NULL);
+ JSValueRef argv[] = { js_json_to_value(m_global_context, json) };
+ JSObjectCallAsFunction(m_global_context, arg->arg, NULL, 1, argv, NULL);
g_free(json);
return STATUS_OK;
}/*}}}*/
@@ -687,7 +687,7 @@ global_execute(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, s
/* global_exit {{{*/
static JSValueRef
global_exit(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exc) {
- if (_commandline)
+ if (m_commandline)
application_stop();
else
dwb_end();
@@ -738,17 +738,17 @@ error_out:
/* global_send_request {{{*/
JSObjectRef
get_message_data(SoupMessage *msg) {
- JSObjectRef o = JSObjectMake(_global_context, NULL, NULL);
- js_set_object_property(_global_context, o, "body", msg->response_body->data, NULL);
- JSObjectRef ho = JSObjectMake(_global_context, NULL, NULL);
+ JSObjectRef o = JSObjectMake(m_global_context, NULL, NULL);
+ js_set_object_property(m_global_context, o, "body", msg->response_body->data, NULL);
+ JSObjectRef ho = JSObjectMake(m_global_context, NULL, NULL);
const char *name, *value;
SoupMessageHeadersIter iter;
soup_message_headers_iter_init(&iter, msg->response_headers);
while (soup_message_headers_iter_next(&iter, &name, &value)) {
- js_set_object_property(_global_context, ho, name, value, NULL);
+ js_set_object_property(m_global_context, ho, name, value, NULL);
}
JSStringRef s = JSStringCreateWithUTF8CString("headers");
- JSObjectSetProperty(_global_context, o, s, ho, kJSDefaultProperty, NULL);
+ JSObjectSetProperty(m_global_context, o, s, ho, kJSDefaultProperty, NULL);
JSStringRelease(s);
return o;
}
@@ -756,8 +756,8 @@ void
request_callback(SoupSession *session, SoupMessage *message, JSObjectRef function) {
if (message->response_body->data != NULL) {
JSObjectRef o = get_message_data(message);
- JSValueRef vals[] = { o, make_object(_global_context, G_OBJECT(message)) };
- JSObjectCallAsFunction(_global_context, function, NULL, 2, vals, NULL);
+ JSValueRef vals[] = { o, make_object(m_global_context, G_OBJECT(message)) };
+ JSObjectCallAsFunction(m_global_context, function, NULL, 2, vals, NULL);
}
}
static JSValueRef
@@ -811,21 +811,21 @@ global_send_request_sync(JSContextRef ctx, JSObjectRef f, JSObjectRef thisObject
void
scripts_completion_activate(void) {
const char *text = GET_TEXT();
- JSValueRef val[] = { js_char_to_value(_global_context, text) };
- JSObjectCallAsFunction(_global_context, _completion_callback, NULL, 1, val, NULL);
+ JSValueRef val[] = { js_char_to_value(m_global_context, text) };
+ JSObjectCallAsFunction(m_global_context, m_completion_callback, NULL, 1, val, NULL);
completion_clean_completion(false);
dwb_change_mode(NORMAL_MODE, true);
}
static JSValueRef
global_tab_complete(JSContextRef ctx, JSObjectRef f, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exc) {
- if (argc < 3 || !JSValueIsInstanceOfConstructor(ctx, argv[1], _arrayConstructor, exc)) {
+ if (argc < 3 || !JSValueIsInstanceOfConstructor(ctx, argv[1], m_array_contructor, exc)) {
js_make_exception(ctx, exc, EXCEPTION("tabComplete: invalid argument."));
return JSValueMakeUndefined(ctx);
}
- _completion_callback = JSValueToObject(ctx, argv[2], exc);
- if (_completion_callback == NULL)
+ m_completion_callback = JSValueToObject(ctx, argv[2], exc);
+ if (m_completion_callback == NULL)
return JSValueMakeUndefined(ctx);
- if (!JSObjectIsFunction(ctx, _completion_callback)) {
+ if (!JSObjectIsFunction(ctx, m_completion_callback)) {
js_make_exception(ctx, exc, EXCEPTION("tabComplete: arguments[2] is not a function."));
return JSValueMakeUndefined(ctx);
}
@@ -873,10 +873,10 @@ error_out:
/* timeout_callback {{{*/
static gboolean
timeout_callback(JSObjectRef obj) {
- JSValueRef val = JSObjectCallAsFunction(_global_context, obj, NULL, 0, NULL, NULL);
+ JSValueRef val = JSObjectCallAsFunction(m_global_context, obj, NULL, 0, NULL, NULL);
if (val == NULL)
return false;
- return !JSValueIsBoolean(_global_context, val) || JSValueToBoolean(_global_context, val);
+ return !JSValueIsBoolean(m_global_context, val) || JSValueToBoolean(m_global_context, val);
}/*}}}*/
/* global_timer_stop {{{*/
@@ -1008,10 +1008,10 @@ spawn_output(GIOChannel *channel, GIOCondition condition, JSObjectRef callback)
return false;
}
else if (g_io_channel_read_to_end(channel, &content, &length, NULL) == G_IO_STATUS_NORMAL && content != NULL) {
- JSValueRef arg = js_char_to_value(_global_context, content);
+ JSValueRef arg = js_char_to_value(m_global_context, content);
if (arg != NULL) {
JSValueRef argv[] = { arg };
- JSObjectCallAsFunction(_global_context, callback, NULL, 1, argv , NULL);
+ JSObjectCallAsFunction(m_global_context, callback, NULL, 1, argv , NULL);
}
g_free(content);
return true;
@@ -1282,7 +1282,7 @@ static JSValueRef
io_print(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exc) {
if (argc == 0) {
js_make_exception(ctx, exc, EXCEPTION("io.print needs an argument."));
- return JSValueMakeUndefined(_global_context);
+ return JSValueMakeUndefined(m_global_context);
}
FILE *stream = stdout;
@@ -1354,7 +1354,7 @@ download_constructor_cb(JSContextRef ctx, JSObjectRef constructor, size_t argc,
return JSValueToObject(ctx, JSValueMakeNull(ctx), NULL);
}
WebKitDownload *download = webkit_download_new(request);
- return JSObjectMake(ctx, _download_class, download);
+ return JSObjectMake(ctx, m_download_class, download);
}/*}}}*/
/* stop_download_notify {{{*/
@@ -1404,13 +1404,13 @@ signal_set(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef
return false;
for (int i = SCRIPTS_SIG_FIRST; i<SCRIPTS_SIG_LAST; i++) {
- if (strcmp(name, _sigmap[i].name))
+ if (strcmp(name, m_sigmap[i].name))
continue;
if (JSValueIsNull(ctx, value)) {
dwb.misc.script_signals &= ~(1<<i);
}
else if ( (o = JSValueToObject(ctx, value, exception)) != NULL && JSObjectIsFunction(ctx, o)) {
- _sigObjects[i] = o;
+ m_sig_objects[i] = o;
dwb.misc.script_signals |= (1<<i);
}
break;
@@ -1421,7 +1421,7 @@ signal_set(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef
/* scripts_emit {{{*/
gboolean
scripts_emit(ScriptSignal *sig) {
- JSObjectRef function = _sigObjects[sig->signal];
+ JSObjectRef function = m_sig_objects[sig->signal];
if (function == NULL)
return false;
@@ -1434,13 +1434,13 @@ scripts_emit(ScriptSignal *sig) {
val[i++] = sig->jsobj;
}
for (int j=0; j<sig->numobj; j++) {
- val[i++] = make_object(_global_context, G_OBJECT(sig->objects[j]));
+ val[i++] = make_object(m_global_context, G_OBJECT(sig->objects[j]));
}
- JSValueRef vson = js_json_to_value(_global_context, sig->json);
- val[i++] = vson == NULL ? JSValueMakeNull(_global_context) : vson;
- JSValueRef js_ret = JSObjectCallAsFunction(_global_context, function, NULL, numargs, val, NULL);
- if (JSValueIsBoolean(_global_context, js_ret)) {
- return JSValueToBoolean(_global_context, js_ret);
+ JSValueRef vson = js_json_to_value(m_global_context, sig->json);
+ val[i++] = vson == NULL ? JSValueMakeNull(m_global_context) : vson;
+ JSValueRef js_ret = JSObjectCallAsFunction(m_global_context, function, NULL, numargs, val, NULL);
+ if (JSValueIsBoolean(m_global_context, js_ret)) {
+ return JSValueToBoolean(m_global_context, js_ret);
}
return false;
}/*}}}*/
@@ -1452,7 +1452,7 @@ scripts_emit(ScriptSignal *sig) {
void
object_destroy_cb(JSObjectRef o) {
JSObjectSetPrivate(o, NULL);
- JSValueUnprotect(_global_context, o);
+ JSValueUnprotect(m_global_context, o);
}
static JSObjectRef
@@ -1466,27 +1466,27 @@ make_object(JSContextRef ctx, GObject *o) {
return retobj;
JSClassRef class;
if (WEBKIT_IS_WEB_VIEW(o))
- class = _webview_class;
+ class = m_webview_class;
else if (WEBKIT_IS_WEB_FRAME(o))
- class = _frame_class;
+ class = m_frame_class;
else if (WEBKIT_IS_DOWNLOAD(o))
- class = _download_class;
+ class = m_download_class;
else if (SOUP_IS_MESSAGE(o))
- class = _message_class;
+ class = m_message_class;
else
- class = _default_class;
+ class = m_default_class;
retobj = JSObjectMake(ctx, class, o);
g_object_set_qdata_full(o, ref_quark, retobj, (GDestroyNotify)object_destroy_cb);
- JSValueProtect(_global_context, retobj);
+ JSValueProtect(m_global_context, retobj);
return retobj;
}/*}}}*/
static gboolean
connect_callback(JSObjectRef func) {
- JSValueRef ret = JSObjectCallAsFunction(_global_context, func, NULL, 0, NULL, NULL);
- if (JSValueIsBoolean(_global_context, ret))
- return JSValueToBoolean(_global_context, ret);
+ JSValueRef ret = JSObjectCallAsFunction(m_global_context, func, NULL, 0, NULL, NULL);
+ if (JSValueIsBoolean(m_global_context, ret))
+ return JSValueToBoolean(m_global_context, ret);
return false;
}
static JSValueRef
@@ -1684,11 +1684,11 @@ create_global_object() {
};
JSClassRef class = create_class("dwb", global_functions, NULL);
- _global_context = JSGlobalContextCreate(class);
+ m_global_context = JSGlobalContextCreate(class);
JSClassRelease(class);
- JSObjectRef global_object = JSContextGetGlobalObject(_global_context);
+ JSObjectRef global_object = JSContextGetGlobalObject(m_global_context);
JSStaticValue data_values[] = {
{ "profile", data_get_profile, NULL, kJSDefaultAttributes },
@@ -1699,7 +1699,7 @@ create_global_object() {
{ 0, 0, 0, 0 },
};
class = create_class("data", NULL, data_values);
- create_object(_global_context, class, global_object, kJSDefaultAttributes, "data", NULL);
+ create_object(m_global_context, class, global_object, kJSDefaultAttributes, "data", NULL);
JSClassRelease(class);
JSStaticFunction io_functions[] = {
@@ -1713,7 +1713,7 @@ create_global_object() {
{ 0, 0, 0 },
};
class = create_class("io", io_functions, NULL);
- create_object(_global_context, class, global_object, kJSPropertyAttributeDontDelete, "io", NULL);
+ create_object(m_global_context, class, global_object, kJSPropertyAttributeDontDelete, "io", NULL);
JSClassRelease(class);
JSStaticFunction system_functions[] = {
@@ -1725,7 +1725,7 @@ create_global_object() {
{ 0, 0, 0 },
};
class = create_class("system", system_functions, NULL);
- create_object(_global_context, class, global_object, kJSDefaultAttributes, "system", NULL);
+ create_object(m_global_context, class, global_object, kJSDefaultAttributes, "system", NULL);
JSClassRelease(class);
JSStaticFunction tab_functions[] = {
@@ -1739,7 +1739,7 @@ create_global_object() {
{ 0, 0, 0, 0 },
};
class = create_class("tabs", tab_functions, tab_values);
- create_object(_global_context, class, global_object, kJSDefaultAttributes, "tabs", NULL);
+ create_object(m_global_context, class, global_object, kJSDefaultAttributes, "tabs", NULL);
JSClassRelease(class);
JSClassDefinition cd = kJSClassDefinitionEmpty;
@@ -1747,17 +1747,17 @@ create_global_object() {
cd.setProperty = signal_set;
class = JSClassCreate(&cd);
- create_object(_global_context, class, global_object, kJSDefaultAttributes, "signals", NULL);
+ create_object(m_global_context, class, global_object, kJSDefaultAttributes, "signals", NULL);
JSClassRelease(class);
class = create_class("extensions", NULL, NULL);
- create_object(_global_context, class, global_object, kJSDefaultAttributes, "extensions", NULL);
+ create_object(m_global_context, class, global_object, kJSDefaultAttributes, "extensions", NULL);
JSClassRelease(class);
cd = kJSClassDefinitionEmpty;
cd.className = "globals";
class = JSClassCreate(&cd);
- create_object(_global_context, class, global_object, kJSPropertyAttributeDontDelete, "globals", NULL);
+ create_object(m_global_context, class, global_object, kJSPropertyAttributeDontDelete, "globals", NULL);
class = JSClassCreate(&cd);
JSClassRelease(class);
@@ -1766,7 +1766,7 @@ create_global_object() {
{ 0, 0, 0 },
};
class = create_class("util", util_functions, NULL);
- create_object(_global_context, class, global_object, kJSDefaultAttributes, "util", NULL);
+ create_object(m_global_context, class, global_object, kJSDefaultAttributes, "util", NULL);
JSClassRelease(class);
/* Default gobject class */
@@ -1775,34 +1775,34 @@ create_global_object() {
cd.getProperty = get_property;
cd.setProperty = set_property;
- _default_class = JSClassCreate(&cd);
+ m_default_class = JSClassCreate(&cd);
/* Webview */
cd.staticFunctions = wv_functions;
cd.staticValues = wv_values;
- _webview_class = JSClassCreate(&cd);
+ m_webview_class = JSClassCreate(&cd);
/* Frame */
cd.staticFunctions = frame_functions;
cd.staticValues = frame_values;
- _frame_class = JSClassCreate(&cd);
+ m_frame_class = JSClassCreate(&cd);
/* SoupMessage */
cd.staticFunctions = default_functions;
cd.staticValues = message_values;
- _message_class = JSClassCreate(&cd);
+ m_message_class = JSClassCreate(&cd);
/* download */
cd.className = "Download";
cd.staticFunctions = download_functions;
cd.staticValues = NULL;
- _download_class = JSClassCreate(&cd);
+ m_download_class = JSClassCreate(&cd);
- JSObjectRef constructor = JSObjectMakeConstructor(_global_context, _download_class, download_constructor_cb);
+ JSObjectRef constructor = JSObjectMakeConstructor(m_global_context, m_download_class, download_constructor_cb);
JSStringRef name = JSStringCreateWithUTF8CString("Download");
- JSObjectSetProperty(_global_context, JSContextGetGlobalObject(_global_context), name, constructor, kJSDefaultProperty, NULL);
+ JSObjectSetProperty(m_global_context, JSContextGetGlobalObject(m_global_context), name, constructor, kJSDefaultProperty, NULL);
JSStringRelease(name);
}/*}}}*/
/*}}}*/
@@ -1815,24 +1815,24 @@ apply_scripts() {
JSValueRef ret, init;
JSObjectRef retobj, initobj;
GSList *scripts = NULL;
- for (GSList *l = _script_list; l; l=l->next) {
- JSObjectRef o = JSObjectMake(_global_context, NULL, NULL);
- if ( (ret = JSObjectCallAsFunction(_global_context, l->data, o, 0, NULL, NULL)) == NULL)
+ for (GSList *l = m_script_list; l; l=l->next) {
+ JSObjectRef o = JSObjectMake(m_global_context, NULL, NULL);
+ if ( (ret = JSObjectCallAsFunction(m_global_context, l->data, o, 0, NULL, NULL)) == NULL)
continue;
- if ( (retobj = JSValueToObject(_global_context, ret, NULL)) == NULL)
+ if ( (retobj = JSValueToObject(m_global_context, ret, NULL)) == NULL)
continue;
- if ( (init = JSObjectGetProperty(_global_context, retobj, on_init, NULL)) == NULL)
+ if ( (init = JSObjectGetProperty(m_global_context, retobj, on_init, NULL)) == NULL)
continue;
- if ((initobj = JSValueToObject(_global_context, init, NULL)) != NULL && JSObjectIsFunction(_global_context, initobj)) {
+ if ((initobj = JSValueToObject(m_global_context, init, NULL)) != NULL && JSObjectIsFunction(m_global_context, initobj)) {
scripts = g_slist_prepend(scripts, initobj);
}
}
- g_slist_free(_script_list);
+ g_slist_free(m_script_list);
for (GSList *l = scripts; l; l=l->next) {
- JSObjectCallAsFunction(_global_context, l->data, NULL, 0, NULL, NULL);
+ JSObjectCallAsFunction(m_global_context, l->data, NULL, 0, NULL, NULL);
}
g_slist_free(scripts);
- _script_list = NULL;
+ m_script_list = NULL;
JSStringRelease(on_init);
}/*}}}*/
@@ -1840,18 +1840,18 @@ apply_scripts() {
void
scripts_create_tab(GList *gl) {
static gboolean applied = false;
- if (_global_context == NULL ) {
+ if (m_global_context == NULL ) {
VIEW(gl)->script_wv = NULL;
return;
}
- JSObjectRef o = make_object(_global_context, G_OBJECT(VIEW(gl)->web));
+ JSObjectRef o = make_object(m_global_context, G_OBJECT(VIEW(gl)->web));
if (EMIT_SCRIPT(CREATE_TAB)) {
ScriptSignal signal = { o, SCRIPTS_SIG_META(NULL, CREATE_TAB, 0) };
scripts_emit(&signal);
}
- JSValueProtect(_global_context, o);
+ JSValueProtect(m_global_context, o);
VIEW(gl)->script_wv = o;
if (!applied) {
apply_scripts();
@@ -1867,19 +1867,19 @@ scripts_remove_tab(JSObjectRef obj) {
ScriptSignal signal = { obj, SCRIPTS_SIG_META(NULL, CLOSE_TAB, 0) };
scripts_emit(&signal);
}
- JSValueUnprotect(_global_context, obj);
+ JSValueUnprotect(m_global_context, obj);
}
}/*}}}*/
/* scripts_init_script {{{*/
void
scripts_init_script(const char *path, const char *script) {
- if (_global_context == NULL)
+ if (m_global_context == NULL)
create_global_object();
char *debug = g_strdup_printf("try { %s } catch(e) { io.debug(\"In file %s\", e); }", script, path);
- JSObjectRef function = js_make_function(_global_context, debug);
+ JSObjectRef function = js_make_function(m_global_context, debug);
if (function != NULL) {
- _script_list = g_slist_prepend(_script_list, function);
+ m_script_list = g_slist_prepend(m_script_list, function);
}
g_free(debug);
}/*}}}*/
@@ -1887,7 +1887,7 @@ scripts_init_script(const char *path, const char *script) {
void
evaluate(const char *script) {
JSStringRef js_script = JSStringCreateWithUTF8CString(script);
- JSEvaluateScript(_global_context, js_script, NULL, NULL, 0, NULL);
+ JSEvaluateScript(m_global_context, js_script, NULL, NULL, 0, NULL);
JSStringRelease(js_script);
}
@@ -1895,7 +1895,7 @@ evaluate(const char *script) {
void
scripts_init(gboolean force) {
dwb.misc.script_signals = 0;
- if (_global_context == NULL) {
+ if (m_global_context == NULL) {
if (force)
create_global_object();
else
@@ -1911,21 +1911,21 @@ scripts_init(gboolean force) {
util_get_directory_content(content, dir, "js");
if (content != NULL) {
JSStringRef js_script = JSStringCreateWithUTF8CString(content->str);
- JSEvaluateScript(_global_context, js_script, NULL, NULL, 0, NULL);
+ JSEvaluateScript(m_global_context, js_script, NULL, NULL, 0, NULL);
JSStringRelease(js_script);
}
g_string_free(content, true);
g_free(dir);
}
- JSObjectRef o = JSObjectMakeArray(_global_context, 0, NULL, NULL);
- _arrayConstructor = js_get_object_property(_global_context, o, "constructor");
- JSValueProtect(_global_context, _arrayConstructor);
+ JSObjectRef o = JSObjectMakeArray(m_global_context, 0, NULL, NULL);
+ m_array_contructor = js_get_object_property(m_global_context, o, "constructor");
+ JSValueProtect(m_global_context, m_array_contructor);
}/*}}}*/
void
scripts_execute_scripts(char **scripts) {
g_return_if_fail(scripts != NULL);
- _commandline = true;
+ m_commandline = true;
scripts_init(true);
char *content;
@@ -1940,14 +1940,14 @@ scripts_execute_scripts(char **scripts) {
}
gboolean
scripts_execute_one(const char *script) {
- if (_global_context != NULL)
- return js_execute(_global_context, script, NULL) != NULL;
+ if (m_global_context != NULL)
+ return js_execute(m_global_context, script, NULL) != NULL;
return false;
}
void
scripts_unbind(JSObjectRef obj) {
if (obj != NULL) {
- JSValueUnprotect(_global_context, obj);
+ JSValueUnprotect(m_global_context, obj);
}
}
@@ -1955,14 +1955,14 @@ scripts_unbind(JSObjectRef obj) {
/* scripts_end {{{*/
void
scripts_end() {
- if (_global_context != NULL) {
- JSValueUnprotect(_global_context, _arrayConstructor);
- JSClassRelease(_default_class);
- JSClassRelease(_webview_class);
- JSClassRelease(_frame_class);
- JSClassRelease(_download_class);
- JSClassRelease(_message_class);
- JSGlobalContextRelease(_global_context);
- _global_context = NULL;
+ if (m_global_context != NULL) {
+ JSValueUnprotect(m_global_context, m_array_contructor);
+ JSClassRelease(m_default_class);
+ JSClassRelease(m_webview_class);
+ JSClassRelease(m_frame_class);
+ JSClassRelease(m_download_class);
+ JSClassRelease(m_message_class);
+ JSGlobalContextRelease(m_global_context);
+ m_global_context = NULL;
}
}/*}}}*//*}}}*/
diff --git a/src/session.c b/src/session.c
index 8d12122d..9b79e109 100644
--- a/src/session.c
+++ b/src/session.c
@@ -23,8 +23,8 @@
#include "view.h"
#include "session.h"
-static char *_session_name;
-static gboolean _has_marked = true;
+static char *m_session_name;
+static gboolean m_has_marked = true;
typedef struct _SessionTab {
GList *gl;
@@ -125,7 +125,7 @@ session_load_status_callback(WebKitWebView *wv, GParamSpec *p, SessionTab *tab)
}
void
session_clear_session() {
- session_save_file(_session_name ? _session_name : "default", "", true);
+ session_save_file(m_session_name ? m_session_name : "default", "", true);
}
/* session_load_webview(WebKitWebView *, char *, int *){{{*/
@@ -180,24 +180,24 @@ session_restore(char *name, int flags) {
gboolean ret = false;
int locked_state = 0;
if (name == NULL) {
- _session_name = g_strdup("default");
+ m_session_name = g_strdup("default");
}
else
- _session_name = name;
+ m_session_name = name;
- char *group = session_get_group(_session_name, &is_marked);
+ char *group = session_get_group(m_session_name, &is_marked);
if (is_marked && (flags & SESSION_FORCE) == 0) {
- fprintf(stderr, "Warning: Session '%s' will not be restored.\n", _session_name);
- fprintf(stderr, "There is already a restored session open with name '%s'.\n", _session_name);
+ fprintf(stderr, "Warning: Session '%s' will not be restored.\n", m_session_name);
+ fprintf(stderr, "There is already a restored session open with name '%s'.\n", m_session_name);
fputs("To force opening a saved session use -f or --force.\n", stderr);
- _has_marked = false;
+ m_has_marked = false;
goto clean;
}
if (group == NULL) {
return false;
}
char *group_begin = strchr(group, '\n');
- session_save_file(_session_name, group_begin+1, true);
+ session_save_file(m_session_name, group_begin+1, true);
if (flags & SESSION_ONLY_MARK)
goto clean;
char **lines = g_strsplit(group, "\n", -1);
@@ -251,12 +251,12 @@ clean:
gboolean
session_save(const char *name, int flags) {
if (!name) {
- if (_session_name)
- name = _session_name;
+ if (m_session_name)
+ name = m_session_name;
else if (flags & SESSION_FORCE)
name = "default";
}
- if (!_has_marked && (flags & SESSION_FORCE) == 0)
+ if (!m_has_marked && (flags & SESSION_FORCE) == 0)
return false;
GString *buffer = g_string_new(NULL);
@@ -275,7 +275,7 @@ session_save(const char *name, int flags) {
}
}
session_save_file(name, buffer->str, false);
- g_free(_session_name);
+ g_free(m_session_name);
g_string_free(buffer, true);
return true;
}/*}}}*/
diff --git a/src/soup.c b/src/soup.c
index 39dd8e82..8ed21148 100644
--- a/src/soup.c
+++ b/src/soup.c
@@ -22,10 +22,10 @@
#include "util.h"
#include "domain.h"
#include "soup.h"
-static SoupCookieJar *_jar;
-static guint _changed_id;
-static SoupCookieJar *_tmpJar;
-static SoupCookieJar *_persJar;
+static SoupCookieJar *m_jar;
+static guint m_changed_id;
+static SoupCookieJar *m_tmp_jar;
+static SoupCookieJar *m_pers_jar;
/*{{{*/
static void
@@ -106,7 +106,7 @@ DwbStatus
dwb_soup_allow_cookie(GList **whitelist, const char *filename, CookieStorePolicy policy) {
DwbStatus ret = STATUS_ERROR;
- GSList *last_cookies = soup_cookie_jar_all_cookies(_tmpJar);
+ GSList *last_cookies = soup_cookie_jar_all_cookies(m_tmp_jar);
if (last_cookies == NULL)
return dwb_soup_allow_cookie_simple(whitelist, filename, policy);
@@ -143,7 +143,7 @@ dwb_soup_allow_cookie(GList **whitelist, const char *filename, CookieStorePolicy
dwb_soup_save_cookies(allowed);
/* Save all cookies to the jar */
for (GSList *l = allowed; l; l=l->next)
- soup_cookie_jar_add_cookie(_jar, l->data);
+ soup_cookie_jar_add_cookie(m_jar, l->data);
/* soup_cookie_jar_add_cookie steals the cookie, it must no be freed */
g_slist_free(allowed);
@@ -156,7 +156,7 @@ dwb_soup_allow_cookie(GList **whitelist, const char *filename, CookieStorePolicy
/* dwb_soup_clean() {{{*/
void
dwb_soup_clean() {
- dwb_soup_clear_jar(_tmpJar);
+ dwb_soup_clear_jar(m_tmp_jar);
}/*}}}*/
/* dwb_soup_get_host_from_request(WebKitNetworkRequest ) {{{*/
@@ -216,7 +216,7 @@ dwb_soup_set_cookie_accept_policy(const char *policy) {
apo = 0;
ret = STATUS_ERROR;
}
- soup_cookie_jar_set_accept_policy(_jar, apo);
+ soup_cookie_jar_set_accept_policy(m_jar, apo);
return ret;
}/*}}}*/
@@ -238,18 +238,18 @@ static void
dwb_soup_cookie_changed_cb(SoupCookieJar *jar, SoupCookie *old, SoupCookie *new, gpointer *p) {
//SoupCookieJar *j = soup_cookie_jar_text_new(dwb.files[FILES_COOKIES], false);
if (old) {
- soup_cookie_jar_delete_cookie(_persJar, old);
+ soup_cookie_jar_delete_cookie(m_pers_jar, old);
}
if (new) {
if (dwb.state.cookie_store_policy == COOKIE_STORE_PERSISTENT || dwb_soup_test_cookie_allowed(dwb.fc.cookies_allow, new)) {
- soup_cookie_jar_add_cookie(_persJar, soup_cookie_copy(new));
+ soup_cookie_jar_add_cookie(m_pers_jar, soup_cookie_copy(new));
}
else {
- soup_cookie_jar_add_cookie(_tmpJar, soup_cookie_copy(new));
+ soup_cookie_jar_add_cookie(m_tmp_jar, soup_cookie_copy(new));
if (dwb.state.cookie_store_policy == COOKIE_STORE_NEVER && !dwb_soup_test_cookie_allowed(dwb.fc.cookies_session_allow, new) ) {
- g_signal_handler_block(jar, _changed_id);
+ g_signal_handler_block(jar, m_changed_id);
soup_cookie_jar_delete_cookie(jar, new);
- g_signal_handler_unblock(jar, _changed_id);
+ g_signal_handler_unblock(jar, m_changed_id);
}
}
}
@@ -259,7 +259,7 @@ void
dwb_soup_sync_cookies() {
int fd = open(dwb.files[FILES_COOKIES], 0);
flock(fd, LOCK_EX);
- GSList *all_cookies = soup_cookie_jar_all_cookies(_persJar);
+ GSList *all_cookies = soup_cookie_jar_all_cookies(m_pers_jar);
SoupCookieJar *j = soup_cookie_jar_text_new(dwb.files[FILES_COOKIES], false);
for (GSList *l = all_cookies; l; l=l->next) {
soup_cookie_jar_add_cookie(j, l->data);
@@ -272,28 +272,28 @@ dwb_soup_sync_cookies() {
void
dwb_soup_clear_cookies() {
- dwb_soup_clear_jar(_tmpJar);
- dwb_soup_clear_jar(_persJar);
- dwb_soup_clear_jar(_jar);
+ dwb_soup_clear_jar(m_tmp_jar);
+ dwb_soup_clear_jar(m_pers_jar);
+ dwb_soup_clear_jar(m_jar);
}
/* dwb_soup_init_cookies {{{*/
void
dwb_soup_init_cookies(SoupSession *s) {
- _jar = soup_cookie_jar_new();
- _tmpJar = soup_cookie_jar_new();
- //_persJar = soup_cookie_jar_new();
- _persJar = soup_cookie_jar_new();
+ m_jar = soup_cookie_jar_new();
+ m_tmp_jar = soup_cookie_jar_new();
+ //m_pers_jar = soup_cookie_jar_new();
+ m_pers_jar = soup_cookie_jar_new();
dwb_soup_set_cookie_accept_policy(GET_CHAR("cookies-accept-policy"));
SoupCookieJar *old_cookies = soup_cookie_jar_text_new(dwb.files[FILES_COOKIES], true);
GSList *l = soup_cookie_jar_all_cookies(old_cookies);
for (; l; l=l->next ) {
- soup_cookie_jar_add_cookie(_jar, soup_cookie_copy(l->data));
+ soup_cookie_jar_add_cookie(m_jar, soup_cookie_copy(l->data));
}
soup_cookies_free(l);
g_object_unref(old_cookies);
- soup_session_add_feature(s, SOUP_SESSION_FEATURE(_jar));
- _changed_id = g_signal_connect(_jar, "changed", G_CALLBACK(dwb_soup_cookie_changed_cb), NULL);
+ soup_session_add_feature(s, SOUP_SESSION_FEATURE(m_jar));
+ m_changed_id = g_signal_connect(m_jar, "changed", G_CALLBACK(dwb_soup_cookie_changed_cb), NULL);
}/*}}}*/
/* dwb_init_proxy{{{*/
@@ -346,9 +346,9 @@ dwb_soup_init_session_features() {
/* dwb_soup_end(() {{{*/
void
dwb_soup_end() {
- g_object_unref(_tmpJar);
- g_object_unref(_jar);
- g_object_unref(_persJar);
+ g_object_unref(m_tmp_jar);
+ g_object_unref(m_jar);
+ g_object_unref(m_pers_jar);
g_free(dwb.misc.proxyuri);
}/*}}}*/
diff --git a/src/view.c b/src/view.c
index d6720b0f..e141c698 100644
--- a/src/view.c
+++ b/src/view.c
@@ -34,9 +34,9 @@
#include "scripts.h"
static void view_ssl_state(GList *);
-static unsigned long _click_time;
-static guint _sig_caret_button_release;
-static guint _sig_caret_motion;
+static unsigned long m_click_time;
+static guint m_sig_caret_button_release;
+static guint m_sig_caret_motion;
static const char const* dummy_icon[] = { "1 1 1 1 ", "- c NONE", "", };
@@ -101,13 +101,13 @@ view_document_finished(WebKitWebView *wv, WebKitWebFrame *frame, GList *gl) {
/* view_button_press_cb(WebKitWebView *web, GdkEventButton *button, GList *gl) {{{*/
static void
view_disconnect_caret(WebKitWebView *web) {
- if (_sig_caret_button_release > 0) {
- g_signal_handler_disconnect(web, _sig_caret_button_release);
- _sig_caret_button_release = 0;
+ if (m_sig_caret_button_release > 0) {
+ g_signal_handler_disconnect(web, m_sig_caret_button_release);
+ m_sig_caret_button_release = 0;
}
- if (_sig_caret_motion > 0) {
- g_signal_handler_disconnect(web, _sig_caret_motion);
- _sig_caret_motion = 0;
+ if (m_sig_caret_motion > 0) {
+ g_signal_handler_disconnect(web, m_sig_caret_motion);
+ m_sig_caret_motion = 0;
}
}
void
@@ -143,7 +143,7 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) {
WebKitHitTestResultContext context;
g_object_get(result, "context", &context, NULL);
gboolean ret = false;
- _click_time = e->time;
+ m_click_time = e->time;
if (EMIT_SCRIPT(BUTTON_PRESS)) {
char *json = util_create_json(8,
UINTEGER, "time", e->time, UINTEGER, "type", e->type,
@@ -168,8 +168,8 @@ view_button_press_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) {
WebKitDOMDOMSelection *selection = webkit_dom_dom_window_get_selection(webkit_dom_document_get_default_view(doc));
webkit_dom_dom_selection_remove_all_ranges(selection);
webkit_dom_dom_selection_add_range(selection, range);
- _sig_caret_button_release = g_signal_connect(web, "button-release-event", G_CALLBACK(view_caret_release_cb), range);
- _sig_caret_motion = g_signal_connect(web, "motion-notify-event", G_CALLBACK(view_caret_motion_cb), range);
+ m_sig_caret_button_release = g_signal_connect(web, "button-release-event", G_CALLBACK(view_caret_release_cb), range);
+ m_sig_caret_motion = g_signal_connect(web, "motion-notify-event", G_CALLBACK(view_caret_motion_cb), range);
ret = true;
}
else if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION && e->type == GDK_BUTTON_PRESS && e->state & GDK_BUTTON1_MASK) {
@@ -222,7 +222,7 @@ view_button_release_cb(WebKitWebView *web, GdkEventButton *e, GList *gl) {
}
if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) {
- if (e->button == 2 || (e->time - _click_time < 200 && (e->button == 1 && e->state & GDK_CONTROL_MASK))) {
+ if (e->button == 2 || (e->time - m_click_time < 200 && (e->button == 1 && e->state & GDK_CONTROL_MASK))) {
g_object_get(result, "link-uri", &uri, NULL);
view_add(uri, dwb.state.background_tabs);
view_disconnect_caret(web);