From: Daniel Carl Date: Fri, 5 Apr 2013 16:15:05 +0000 (+0200) Subject: Removed function prefixes of static functions. X-Git-Url: https://git.owens.tech/projects.html/projects.html/git?a=commitdiff_plain;h=790e1ba9d10313c3aaad0a50a5e4d3ccada41fb0;p=vimb.git Removed function prefixes of static functions. --- diff --git a/src/completion.c b/src/completion.c index a69607b..d106c58 100644 --- a/src/completion.c +++ b/src/completion.c @@ -30,14 +30,14 @@ typedef struct { char *prefix; } Completion; -static GList *completion_init_completion(GList *target, GList *source, +static GList *init_completion(GList *target, GList *source, Comp_Func func, const char *input, const char *prefix); -static GList *completion_update(GList *completion, GList *active, gboolean back); -static void completion_show(gboolean back); -static void completion_set_entry_text(Completion *completion); -static char *completion_get_text(Completion *completion); -static Completion *completion_get_new(const char *label, const char *prefix); -static void completion_free(Completion *completion); +static GList *update(GList *completion, GList *active, gboolean back); +static void show(gboolean back); +static void set_entry_text(Completion *completion); +static char *get_text(Completion *completion); +static Completion *get_new(const char *label, const char *prefix); +static void free_completion(Completion *completion); gboolean completion_complete(gboolean back) { @@ -48,10 +48,10 @@ gboolean completion_complete(gboolean back) && vb.comps.active && (vb.state.mode & VB_MODE_COMPLETE) ) { - char *text = completion_get_text((Completion*)vb.comps.active->data); + char *text = get_text((Completion*)vb.comps.active->data); if (!strcmp(input, text)) { /* updatecompletions */ - vb.comps.active = completion_update(vb.comps.completions, vb.comps.active, back); + vb.comps.active = update(vb.comps.completions, vb.comps.active, back); g_free(text); return TRUE; } else { @@ -74,26 +74,26 @@ gboolean completion_complete(gboolean back) if (!strncmp(input, ":set ", 5)) { source = g_hash_table_get_keys(vb.settings); source = g_list_sort(source, (GCompareFunc)g_strcmp0); - vb.comps.completions = completion_init_completion( + vb.comps.completions = init_completion( vb.comps.completions, source, (Comp_Func)g_str_has_prefix, &input[5], ":set " ); g_list_free(source); } else if (!strncmp(input, ":open ", 6)) { source = history_get_all(HISTORY_URL); - vb.comps.completions = completion_init_completion( + vb.comps.completions = init_completion( vb.comps.completions, source, (Comp_Func)util_strcasestr, &input[6], ":open " ); history_list_free(&source); } else if (!strncmp(input, ":tabopen ", 9)) { source = history_get_all(HISTORY_URL); - vb.comps.completions = completion_init_completion( + vb.comps.completions = init_completion( vb.comps.completions, source, (Comp_Func)util_strcasestr, &input[9], ":tabopen " ); history_list_free(&source); } else { source = g_hash_table_get_keys(vb.behave.commands); source = g_list_sort(source, (GCompareFunc)g_strcmp0); - vb.comps.completions = completion_init_completion( + vb.comps.completions = init_completion( vb.comps.completions, source, (Comp_Func)g_str_has_prefix, &input[1], ":" ); g_list_free(source); @@ -102,14 +102,14 @@ gboolean completion_complete(gboolean back) if (!vb.comps.completions) { return false; } - completion_show(back); + show(back); return TRUE; } void completion_clean() { - g_list_free_full(vb.comps.completions, (GDestroyNotify)completion_free); + g_list_free_full(vb.comps.completions, (GDestroyNotify)free_completion); vb.comps.completions = NULL; if (vb.gui.compbox) { @@ -124,7 +124,7 @@ void completion_clean() vb.state.mode &= ~VB_MODE_COMPLETE; } -static GList *completion_init_completion(GList *target, GList *source, +static GList *init_completion(GList *target, GList *source, Comp_Func func, const char *input, const char *prefix) { char *command = NULL, *data = NULL, **token = NULL; @@ -152,7 +152,7 @@ static GList *completion_init_completion(GList *target, GList *source, } } if (match) { - Completion *completion = completion_get_new(data, prefix); + Completion *completion = get_new(data, prefix); gtk_box_pack_start(GTK_BOX(vb.gui.compbox), completion->event, TRUE, TRUE, 0); /* use prepend because that faster */ target = g_list_prepend(target, completion); @@ -165,7 +165,7 @@ static GList *completion_init_completion(GList *target, GList *source, return target; } -static GList *completion_update(GList *completion, GList *active, gboolean back) +static GList *update(GList *completion, GList *active, gboolean back) { GList *old, *new; Completion *comp; @@ -225,12 +225,12 @@ static GList *completion_update(GList *completion, GList *active, gboolean back) VB_WIDGET_SET_STATE(((Completion*)new->data)->event, VB_GTK_STATE_ACTIVE); active = new; - completion_set_entry_text(active->data); + set_entry_text(active->data); return active; } /* allow to chenge the direction of display */ -static void completion_show(gboolean back) +static void show(gboolean back) { guint max = vb.config.max_completion_items; int i = 0; @@ -250,14 +250,14 @@ static void completion_show(gboolean back) VB_WIDGET_SET_STATE(active->label, VB_GTK_STATE_ACTIVE); VB_WIDGET_SET_STATE(active->event, VB_GTK_STATE_ACTIVE); - completion_set_entry_text(active); + set_entry_text(active); gtk_widget_show(vb.gui.compbox); } } -static void completion_set_entry_text(Completion *completion) +static void set_entry_text(Completion *completion) { - char *text = completion_get_text(completion); + char *text = get_text(completion); gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), text); gtk_editable_set_position(GTK_EDITABLE(vb.gui.inputbox), -1); g_free(text); @@ -266,7 +266,7 @@ static void completion_set_entry_text(Completion *completion) /** * Retrieves the full new allocated entry text for given completion item. */ -static char *completion_get_text(Completion *completion) +static char *get_text(Completion *completion) { char *text = NULL; @@ -284,7 +284,7 @@ static char *completion_get_text(Completion *completion) return text; } -static Completion *completion_get_new(const char *label, const char *prefix) +static Completion *get_new(const char *label, const char *prefix) { const int padding = 2; Completion *c = g_new0(Completion, 1); @@ -321,7 +321,7 @@ static Completion *completion_get_new(const char *label, const char *prefix) return c; } -static void completion_free(Completion *completion) +static void free_completion(Completion *completion) { gtk_widget_destroy(completion->event); g_free(completion->prefix); diff --git a/src/dom.c b/src/dom.c index c325fc7..e9b0642 100644 --- a/src/dom.c +++ b/src/dom.c @@ -22,25 +22,25 @@ extern VbCore vb; -static gboolean dom_auto_insert(Element *element); -static gboolean dom_editable_focus_cb(Element *element, Event *event); -static Element *dom_get_active_element(Document *doc); +static gboolean auto_insert(Element *element); +static gboolean editable_focus_cb(Element *element, Event *event); +static Element *get_active_element(Document *doc); void dom_check_auto_insert(void) { Document *doc = webkit_web_view_get_dom_document(vb.gui.webview); - Element *active = dom_get_active_element(doc); + Element *active = get_active_element(doc); /* the focus was not set automatically - add event listener to track focus * events on the document */ - if (!dom_auto_insert(active)) { + if (!auto_insert(active)) { HtmlElement *element = webkit_dom_document_get_body(doc); if (!element) { element = WEBKIT_DOM_HTML_ELEMENT(webkit_dom_document_get_document_element(doc)); } webkit_dom_event_target_add_event_listener( - WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(dom_editable_focus_cb), true, NULL + WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(editable_focus_cb), true, NULL ); } } @@ -51,7 +51,7 @@ void dom_check_auto_insert(void) void dom_clear_focus(void) { Document *doc = webkit_web_view_get_dom_document(vb.gui.webview); - Element *active = dom_get_active_element(doc); + Element *active = get_active_element(doc); if (active) { webkit_dom_element_blur(active); @@ -90,7 +90,7 @@ gboolean dom_is_editable(Element *element) return result; } -static gboolean dom_auto_insert(Element *element) +static gboolean auto_insert(Element *element) { if (dom_is_editable(element)) { vb_set_mode(VB_MODE_INSERT, false); @@ -99,19 +99,19 @@ static gboolean dom_auto_insert(Element *element) return false; } -static gboolean dom_editable_focus_cb(Element *element, Event *event) +static gboolean editable_focus_cb(Element *element, Event *event) { webkit_dom_event_target_remove_event_listener( - WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(dom_editable_focus_cb), true + WEBKIT_DOM_EVENT_TARGET(element), "focus", G_CALLBACK(editable_focus_cb), true ); if (CLEAN_MODE(vb.state.mode) != VB_MODE_INSERT) { EventTarget *target = webkit_dom_event_get_target(event); - dom_auto_insert((void*)target); + auto_insert((void*)target); } return false; } -static Element *dom_get_active_element(Document *doc) +static Element *get_active_element(Document *doc) { char *tagname; Document *d = NULL; @@ -125,10 +125,10 @@ static Element *dom_get_active_element(Document *doc) if (!g_strcmp0(tagname, "FRAME")) { d = webkit_dom_html_frame_element_get_content_document(WEBKIT_DOM_HTML_FRAME_ELEMENT(active)); - result = dom_get_active_element(d); + result = get_active_element(d); } else if (!g_strcmp0(tagname, "IFRAME")) { d = webkit_dom_html_iframe_element_get_content_document(WEBKIT_DOM_HTML_IFRAME_ELEMENT(active)); - result = dom_get_active_element(d); + result = get_active_element(d); } g_free(tagname); diff --git a/src/hints.c b/src/hints.c index 48c265c..a739006 100644 --- a/src/hints.c +++ b/src/hints.c @@ -30,11 +30,11 @@ extern VbCore vb; extern const unsigned int MAXIMUM_HINTS; -static void hints_run_script(char *js); -static void hints_fire(); -static void hints_observe_input(gboolean observe); -static gboolean hints_changed_callback(GtkEditable *entry); -static gboolean hints_keypress_callback(WebKitWebView *webview, GdkEventKey *event); +static void run_script(char *js); +static void fire(); +static void observe_input(gboolean observe); +static gboolean changed_cb(GtkEditable *entry); +static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event); void hints_init(WebKitWebFrame *frame) { @@ -47,7 +47,7 @@ void hints_clear() { char *js, *value = NULL; - hints_observe_input(false); + observe_input(false); if (CLEAN_MODE(vb.state.mode) == VB_MODE_HINTING) { js = g_strdup_printf("%s.clear();", HINT_VAR); vb_eval_script(webkit_web_view_get_main_frame(vb.gui.webview), js, HINT_FILE, &value); @@ -89,33 +89,33 @@ void hints_create(const char *input, guint mode, const guint prefixLength) MAXIMUM_HINTS ); - hints_observe_input(TRUE); + observe_input(TRUE); - hints_run_script(js); + run_script(js); g_free(js); } js = g_strdup_printf("%s.create('%s');", HINT_VAR, input ? input : ""); - hints_run_script(js); + run_script(js); g_free(js); } void hints_update(const gulong num) { char *js = g_strdup_printf("%s.update(%lu);", HINT_VAR, num); - hints_run_script(js); + run_script(js); g_free(js); } void hints_focus_next(const gboolean back) { char *js = g_strdup_printf(back ? "%s.focusPrev()" : "%s.focusNext();", HINT_VAR); - hints_run_script(js); + run_script(js); g_free(js); } -static void hints_run_script(char *js) +static void run_script(char *js) { char *value = NULL; int mode = vb.hints.mode; @@ -156,21 +156,21 @@ static void hints_run_script(char *js) g_free(value); } -static void hints_fire() +static void fire() { char *js = g_strdup_printf("%s.fire();", HINT_VAR); - hints_run_script(js); + run_script(js); g_free(js); } -static void hints_observe_input(gboolean observe) +static void observe_input(gboolean observe) { if (observe) { vb.hints.change_handler = g_signal_connect( - G_OBJECT(vb.gui.inputbox), "changed", G_CALLBACK(hints_changed_callback), NULL + G_OBJECT(vb.gui.inputbox), "changed", G_CALLBACK(changed_cb), NULL ); vb.hints.keypress_handler = g_signal_connect( - G_OBJECT(vb.gui.inputbox), "key-press-event", G_CALLBACK(hints_keypress_callback), NULL + G_OBJECT(vb.gui.inputbox), "key-press-event", G_CALLBACK(keypress_cb), NULL ); } else if (vb.hints.change_handler && vb.hints.keypress_handler) { g_signal_handler_disconnect(G_OBJECT(vb.gui.inputbox), vb.hints.change_handler); @@ -180,7 +180,7 @@ static void hints_observe_input(gboolean observe) } } -static gboolean hints_changed_callback(GtkEditable *entry) +static gboolean changed_cb(GtkEditable *entry) { const char *text = GET_TEXT(); @@ -190,14 +190,14 @@ static gboolean hints_changed_callback(GtkEditable *entry) return TRUE; } -static gboolean hints_keypress_callback(WebKitWebView *webview, GdkEventKey *event) +static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event) { int numval; guint keyval = event->keyval; guint state = CLEAN_STATE_WITH_SHIFT(event); if (keyval == GDK_Return) { - hints_fire(); + fire(); return TRUE; } if (keyval == GDK_BackSpace && (state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK)) { diff --git a/src/history.c b/src/history.c index 8c9aeec..11b59be 100644 --- a/src/history.c +++ b/src/history.c @@ -35,10 +35,10 @@ static struct { GList *active; } history; -static GList *history_get_list(const char *input); -static const char *history_get_file_by_type(HistoryType type); -static GList *history_load(const char *file); -static void history_write_to_file(GList *list, const char *file); +static GList *get_list(const char *input); +static const char *get_file_by_type(HistoryType type); +static GList *load(const char *file); +static void write_to_file(GList *list, const char *file); /** @@ -49,8 +49,8 @@ void history_cleanup(void) { const char *file; for (HistoryType i = HISTORY_FIRST; i < HISTORY_LAST; i++) { - file = history_get_file_by_type(i); - history_write_to_file(history_load(file), file); + file = get_file_by_type(i); + write_to_file(load(file), file); } } @@ -60,7 +60,7 @@ void history_cleanup(void) void history_add(HistoryType type, const char *value) { FILE *f; - const char *file = history_get_file_by_type(type); + const char *file = get_file_by_type(type); if ((f = fopen(file, "a+"))) { file_lock_set(fileno(f), F_WRLCK); @@ -77,7 +77,7 @@ void history_add(HistoryType type, const char *value) */ GList *history_get_all(HistoryType type) { - return history_load(history_get_file_by_type(type)); + return load(get_file_by_type(type)); } /** @@ -89,7 +89,7 @@ char *history_get(const char *input, gboolean prev) GList *new = NULL; if (!history.active) { - history.active = history_get_list(input); + history.active = get_list(input); history.active = g_list_append(history.active, g_strdup("")); /* start with latest added items */ history.active = g_list_last(history.active); @@ -129,7 +129,7 @@ void history_list_free(GList **list) * Retrieves the list of matching history items. * The list must be freed. */ -static GList *history_get_list(const char *input) +static GList *get_list(const char *input) { HistoryType type; GList *result = NULL; @@ -155,7 +155,7 @@ static GList *history_get_list(const char *input) return NULL; } - GList *src = history_load(history_get_file_by_type(type)); + GList *src = load(get_file_by_type(type)); /* generate new history list with the matching items */ for (GList *l = src; l; l = l->next) { @@ -168,7 +168,7 @@ static GList *history_get_list(const char *input) return result; } -static const char *history_get_file_by_type(HistoryType type) +static const char *get_file_by_type(HistoryType type) { return vb.files[file_map[type]]; } @@ -177,7 +177,7 @@ static const char *history_get_file_by_type(HistoryType type) * Loads history items form file but eleminate duplicates. * Oldest entries first. */ -static GList *history_load(const char *file) +static GList *load(const char *file) { /* read the history items from file */ GList *list = NULL; @@ -227,7 +227,7 @@ static GList *history_load(const char *file) /** * Loads the entries from file, make them unique and write them back to file. */ -static void history_write_to_file(GList *list, const char *file) +static void write_to_file(GList *list, const char *file) { FILE *f; if ((f = fopen(file, "w"))) { diff --git a/src/keybind.c b/src/keybind.c index e4961bf..0d2af7e 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -24,25 +24,25 @@ extern VbCore vb; -static void keybind_rebuild_modkeys(void); -static GSList *keybind_find(int mode, guint modkey, guint modmask, guint keyval); -static void keybind_str_to_keybind(char *str, Keybind *key); -static guint keybind_str_to_modmask(const char *str); -static guint keybind_str_to_value(const char *str); -static gboolean keybind_keypress_callback(WebKitWebView *webview, GdkEventKey *event); -static void keybind_free(Keybind *keybind); +static void rebuild_modkeys(void); +static GSList *find(int mode, guint modkey, guint modmask, guint keyval); +static void string_to_keybind(char *str, Keybind *key); +static guint string_to_modmask(const char *str); +static guint string_to_value(const char *str); +static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event); +static void free_keybind(Keybind *keybind); void keybind_init(void) { vb.behave.modkeys = g_string_new(""); - g_signal_connect(G_OBJECT(vb.gui.box), "key-press-event", G_CALLBACK(keybind_keypress_callback), NULL); + g_signal_connect(G_OBJECT(vb.gui.box), "key-press-event", G_CALLBACK(keypress_cb), NULL); } void keybind_cleanup(void) { if (vb.behave.keys) { - g_slist_free_full(vb.behave.keys, (GDestroyNotify)keybind_free); + g_slist_free_full(vb.behave.keys, (GDestroyNotify)free_keybind); } if (vb.behave.modkeys) { g_string_free(vb.behave.modkeys, TRUE); @@ -69,7 +69,7 @@ gboolean keybind_add_from_string(char *keys, const char *command, const Mode mod keybind->param = g_strdup(token[1]); g_strfreev(token); - keybind_str_to_keybind(keys, keybind); + string_to_keybind(keys, keybind); /* add the keybinding to the list */ vb.behave.keys = g_slist_prepend(vb.behave.keys, keybind); @@ -92,17 +92,17 @@ gboolean keybind_remove_from_string(char *str, const Mode mode) g_strstrip(str); /* fill the keybind with data from given string */ - keybind_str_to_keybind(str, &keybind); + string_to_keybind(str, &keybind); - GSList *link = keybind_find(keybind.mode, keybind.modkey, keybind.modmask, keybind.keyval); + GSList *link = find(keybind.mode, keybind.modkey, keybind.modmask, keybind.keyval); if (link) { - keybind_free((Keybind*)link->data); + free_keybind((Keybind*)link->data); vb.behave.keys = g_slist_delete_link(vb.behave.keys, link); } if (keybind.modkey && strchr(vb.behave.modkeys->str, keybind.modkey) != NULL) { /* remove eventually no more used modkeys */ - keybind_rebuild_modkeys(); + rebuild_modkeys(); } return TRUE; } @@ -111,7 +111,7 @@ gboolean keybind_remove_from_string(char *str, const Mode mode) * Discard all knows modkeys and walk through all keybindings to aggregate * them new. */ -static void keybind_rebuild_modkeys(void) +static void rebuild_modkeys(void) { GSList *link; /* remove previous modkeys */ @@ -130,7 +130,7 @@ static void keybind_rebuild_modkeys(void) } } -static GSList *keybind_find(int mode, guint modkey, guint modmask, guint keyval) +static GSList *find(int mode, guint modkey, guint modmask, guint keyval) { GSList *link; for (link = vb.behave.keys; link != NULL; link = link->next) { @@ -150,7 +150,7 @@ static GSList *keybind_find(int mode, guint modkey, guint modmask, guint keyval) /** * Configures the given keybind by also given string. */ -static void keybind_str_to_keybind(char *str, Keybind *keybind) +static void string_to_keybind(char *str, Keybind *keybind) { char **string = NULL; guint len = 0; @@ -180,11 +180,11 @@ static void keybind_str_to_keybind(char *str, Keybind *keybind) len = g_strv_length(string); if (len == 4) { /* key with modmask like */ - keybind->modmask = keybind_str_to_modmask(string[1]); - keybind->keyval = keybind_str_to_value(string[2]); + keybind->modmask = string_to_modmask(string[1]); + keybind->keyval = string_to_value(string[2]); } else if (len == 3) { /* key without modmask like */ - keybind->keyval = keybind_str_to_value(string[1]); + keybind->keyval = string_to_value(string[1]); } g_strfreev(string); } @@ -205,7 +205,7 @@ static void keybind_str_to_keybind(char *str, Keybind *keybind) } } -static guint keybind_str_to_modmask(const char *str) +static guint string_to_modmask(const char *str) { if (g_ascii_strcasecmp(str, "ctrl") == 0) { return GDK_CONTROL_MASK; @@ -217,7 +217,7 @@ static guint keybind_str_to_modmask(const char *str) return 0; } -static guint keybind_str_to_value(const char *str) +static guint string_to_value(const char *str) { if (!strcmp(str, "tab")) { return GDK_Tab; @@ -234,7 +234,7 @@ static guint keybind_str_to_value(const char *str) return str[0]; } -static gboolean keybind_keypress_callback(WebKitWebView *webview, GdkEventKey *event) +static gboolean keypress_cb(WebKitWebView *webview, GdkEventKey *event) { guint keyval = event->keyval; guint state = CLEAN_STATE_WITH_SHIFT(event); @@ -265,7 +265,7 @@ static gboolean keybind_keypress_callback(WebKitWebView *webview, GdkEventKey *e } /* check for keybinding */ - GSList *link = keybind_find(CLEAN_MODE(vb.state.mode), vb.state.modkey, state, keyval); + GSList *link = find(CLEAN_MODE(vb.state.mode), vb.state.modkey, state, keyval); if (link) { Keybind *keybind = (Keybind*)link->data; @@ -277,7 +277,7 @@ static gboolean keybind_keypress_callback(WebKitWebView *webview, GdkEventKey *e return false; } -static void keybind_free(Keybind *keybind) +static void free_keybind(Keybind *keybind) { g_free(keybind->command); g_free(keybind->param); diff --git a/src/main.c b/src/main.c index 00d8fc6..8d348bf 100644 --- a/src/main.c +++ b/src/main.c @@ -36,43 +36,43 @@ static char **args; VbCore vb; /* callbacks */ -static void vb_webview_progress_cb(WebKitWebView *view, GParamSpec *pspec); -static void vb_webview_download_progress_cb(WebKitWebView *view, GParamSpec *pspec); -static void vb_webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec); -static void vb_destroy_window_cb(GtkWidget *widget); -static void vb_inputbox_activate_cb(GtkEntry *entry); -static gboolean vb_inputbox_keyrelease_cb(GtkEntry *entry, GdkEventKey *event); -static void vb_scroll_cb(GtkAdjustment *adjustment); -static WebKitWebView *vb_inspector_new(WebKitWebInspector *inspector, WebKitWebView *webview); -static gboolean vb_inspector_show(WebKitWebInspector *inspector); -static gboolean vb_inspector_close(WebKitWebInspector *inspector); -static void vb_inspector_finished(WebKitWebInspector *inspector); -static gboolean vb_button_relase_cb(WebKitWebView *webview, GdkEventButton *event); -static gboolean vb_new_window_policy_cb( +static void webview_progress_cb(WebKitWebView *view, GParamSpec *pspec); +static void webview_download_progress_cb(WebKitWebView *view, GParamSpec *pspec); +static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec); +static void destroy_window_cb(GtkWidget *widget); +static void inputbox_activate_cb(GtkEntry *entry); +static gboolean inputbox_keyrelease_cb(GtkEntry *entry, GdkEventKey *event); +static void scroll_cb(GtkAdjustment *adjustment); +static WebKitWebView *inspector_new(WebKitWebInspector *inspector, WebKitWebView *webview); +static gboolean inspector_show(WebKitWebInspector *inspector); +static gboolean inspector_close(WebKitWebInspector *inspector); +static void inspector_finished(WebKitWebInspector *inspector); +static gboolean button_relase_cb(WebKitWebView *webview, GdkEventButton *event); +static gboolean new_window_policy_cb( WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navig, WebKitWebPolicyDecision *policy); -static void vb_hover_link_cb(WebKitWebView *webview, const char *title, const char *link); -static void vb_title_changed_cb(WebKitWebView *webview, WebKitWebFrame *frame, const char *title); -static gboolean vb_mimetype_decision_cb(WebKitWebView *webview, +static void hover_link_cb(WebKitWebView *webview, const char *title, const char *link); +static void title_changed_cb(WebKitWebView *webview, WebKitWebFrame *frame, const char *title); +static gboolean mimetype_decision_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetworkRequest *request, char* mime_type, WebKitWebPolicyDecision *decision); -static gboolean vb_download_requested_cb(WebKitWebView *view, WebKitDownload *download); -static void vb_download_progress_cp(WebKitDownload *download, GParamSpec *pspec); -static void vb_request_start_cb(WebKitWebView *webview, WebKitWebFrame *frame, +static gboolean download_requested_cb(WebKitWebView *view, WebKitDownload *download); +static void download_progress_cp(WebKitDownload *download, GParamSpec *pspec); +static void request_start_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitWebResource *resource, WebKitNetworkRequest *request, WebKitNetworkResponse *response); /* functions */ -static void vb_run_user_script(WebKitWebFrame *frame); -static char *vb_jsref_to_string(JSContextRef context, JSValueRef ref); -static void vb_init_core(void); -static void vb_read_config(void); -static void vb_setup_signals(); -static void vb_init_files(void); -static gboolean vb_hide_message(); -static void vb_set_status(const StatusType status); -void vb_inputbox_print(gboolean force, const MessageType type, gboolean hide, const char *message); -static void vb_destroy_client(); +static void run_user_script(WebKitWebFrame *frame); +static char *jsref_to_string(JSContextRef context, JSValueRef ref); +static void init_core(void); +static void read_config(void); +static void setup_signals(); +static void init_files(void); +static gboolean hide_message(); +static void set_status(const StatusType status); +void inputbox_print(gboolean force, const MessageType type, gboolean hide, const char *message); +static void destroy_client(); void vb_echo_force(const MessageType type,gboolean hide, const char *error, ...) { @@ -83,7 +83,7 @@ void vb_echo_force(const MessageType type,gboolean hide, const char *error, ...) vsnprintf(message, 255, error, arg_list); va_end(arg_list); - vb_inputbox_print(TRUE, type, hide, message); + inputbox_print(TRUE, type, hide, message); } void vb_echo(const MessageType type, gboolean hide, const char *error, ...) @@ -95,7 +95,7 @@ void vb_echo(const MessageType type, gboolean hide, const char *error, ...) vsnprintf(message, 255, error, arg_list); va_end(arg_list); - vb_inputbox_print(false, type, hide, message); + inputbox_print(false, type, hide, message); } gboolean vb_eval_script(WebKitWebFrame *frame, char *script, char *file, char **value) @@ -113,11 +113,11 @@ gboolean vb_eval_script(WebKitWebFrame *frame, char *script, char *file, char ** JSStringRelease(str); if (result) { - *value = vb_jsref_to_string(js, result); + *value = jsref_to_string(js, result); return TRUE; } - *value = vb_jsref_to_string(js, exception); + *value = jsref_to_string(js, exception); return false; } @@ -338,20 +338,20 @@ void vb_update_urlbar(const char *uri) gtk_label_set_text(GTK_LABEL(vb.gui.statusbar.left), uri); } -static gboolean vb_hide_message() +static gboolean hide_message() { - vb_inputbox_print(false, VB_MSG_NORMAL, false, ""); + inputbox_print(false, VB_MSG_NORMAL, false, ""); return false; } -static void vb_webview_progress_cb(WebKitWebView *view, GParamSpec *pspec) +static void webview_progress_cb(WebKitWebView *view, GParamSpec *pspec) { vb.state.progress = webkit_web_view_get_progress(view) * 100; vb_update_statusbar(); } -static void vb_webview_download_progress_cb(WebKitWebView *view, GParamSpec *pspec) +static void webview_download_progress_cb(WebKitWebView *view, GParamSpec *pspec) { if (vb.state.downloads) { vb.state.progress = 0; @@ -364,7 +364,7 @@ static void vb_webview_download_progress_cb(WebKitWebView *view, GParamSpec *psp vb_update_statusbar(); } -static void vb_webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) +static void webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) { const char *uri = webkit_web_view_get_uri(vb.gui.webview); @@ -384,18 +384,18 @@ static void vb_webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) WebKitNetworkRequest *request = webkit_web_data_source_get_request(src); SoupMessage *msg = webkit_network_request_get_message(request); SoupMessageFlags flags = soup_message_get_flags(msg); - vb_set_status( + set_status( (flags & SOUP_MESSAGE_CERTIFICATE_TRUSTED) ? VB_STATUS_SSL_VALID : VB_STATUS_SSL_INVALID ); } else { - vb_set_status(VB_STATUS_NORMAL); + set_status(VB_STATUS_NORMAL); } /* inject the hinting javascript */ hints_init(frame); /* run user script file */ - vb_run_user_script(frame); + run_user_script(frame); } /* status bar is updated by vb_set_mode */ @@ -422,12 +422,12 @@ static void vb_webview_load_status_cb(WebKitWebView *view, GParamSpec *pspec) } } -static void vb_destroy_window_cb(GtkWidget *widget) +static void destroy_window_cb(GtkWidget *widget) { - vb_destroy_client(); + destroy_client(); } -static void vb_inputbox_activate_cb(GtkEntry *entry) +static void inputbox_activate_cb(GtkEntry *entry) { const char *text; char *command = NULL; @@ -471,22 +471,22 @@ static void vb_inputbox_activate_cb(GtkEntry *entry) g_free(command); } -static gboolean vb_inputbox_keyrelease_cb(GtkEntry *entry, GdkEventKey *event) +static gboolean inputbox_keyrelease_cb(GtkEntry *entry, GdkEventKey *event) { return false; } -static void vb_scroll_cb(GtkAdjustment *adjustment) +static void scroll_cb(GtkAdjustment *adjustment) { vb_update_statusbar(); } -static WebKitWebView *vb_inspector_new(WebKitWebInspector *inspector, WebKitWebView *webview) +static WebKitWebView *inspector_new(WebKitWebInspector *inspector, WebKitWebView *webview) { return WEBKIT_WEB_VIEW(webkit_web_view_new()); } -static gboolean vb_inspector_show(WebKitWebInspector *inspector) +static gboolean inspector_show(WebKitWebInspector *inspector) { WebKitWebView *webview; int height; @@ -509,7 +509,7 @@ static gboolean vb_inspector_show(WebKitWebInspector *inspector) return TRUE; } -static gboolean vb_inspector_close(WebKitWebInspector *inspector) +static gboolean inspector_close(WebKitWebInspector *inspector) { WebKitWebView *webview; @@ -525,12 +525,12 @@ static gboolean vb_inspector_close(WebKitWebInspector *inspector) return TRUE; } -static void vb_inspector_finished(WebKitWebInspector *inspector) +static void inspector_finished(WebKitWebInspector *inspector) { g_free(vb.gui.inspector); } -static void vb_set_status(const StatusType status) +static void set_status(const StatusType status) { if (vb.state.status_type != status) { vb.state.status_type = status; @@ -539,7 +539,7 @@ static void vb_set_status(const StatusType status) } } -void vb_inputbox_print(gboolean force, const MessageType type, gboolean hide, const char *message) +void inputbox_print(gboolean force, const MessageType type, gboolean hide, const char *message) { /* don't print message if the input is focussed */ if (!force && gtk_widget_is_focus(GTK_WIDGET(vb.gui.inputbox))) { @@ -554,11 +554,11 @@ void vb_inputbox_print(gboolean force, const MessageType type, gboolean hide, co gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), message); gtk_editable_set_position(GTK_EDITABLE(vb.gui.inputbox), strlen(message) > INPUT_LENGTH ? 0 : -1); if (hide) { - g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)vb_hide_message, NULL); + g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)hide_message, NULL); } } -static void vb_run_user_script(WebKitWebFrame *frame) +static void run_user_script(WebKitWebFrame *frame) { char *js = NULL, *value = NULL; GError *error = NULL; @@ -575,7 +575,7 @@ static void vb_run_user_script(WebKitWebFrame *frame) } } -static char *vb_jsref_to_string(JSContextRef context, JSValueRef ref) +static char *jsref_to_string(JSContextRef context, JSValueRef ref) { char *string; JSStringRef str_ref = JSValueToStringCopy(context, ref, NULL); @@ -588,7 +588,7 @@ static char *vb_jsref_to_string(JSContextRef context, JSValueRef ref) return string; } -static void vb_init_core(void) +static void init_core(void) { Gui *gui = &vb.gui; @@ -639,7 +639,7 @@ static void vb_init_core(void) gtk_paned_pack1(GTK_PANED(gui->pane), GTK_WIDGET(gui->box), TRUE, TRUE); - vb_setup_signals(); + setup_signals(); /* Put all part together */ gtk_container_add(GTK_CONTAINER(gui->scroll), GTK_WIDGET(gui->webview)); @@ -659,12 +659,12 @@ static void vb_init_core(void) * and keyboard events */ gtk_widget_grab_focus(GTK_WIDGET(gui->webview)); - vb_init_files(); + init_files(); session_init(); setting_init(); command_init(); keybind_init(); - vb_read_config(); + read_config(); /* initially apply input style */ vb_update_input_style(); @@ -673,7 +673,7 @@ static void vb_init_core(void) gtk_widget_show_all(gui->window); } -static void vb_read_config(void) +static void read_config(void) { char *line, **lines; @@ -704,24 +704,24 @@ static void vb_read_config(void) g_strfreev(lines); } -static void vb_setup_signals() +static void setup_signals() { WebKitWebFrame *frame = webkit_web_view_get_main_frame(vb.gui.webview); /* Set up callbacks so that if either the main window or the browser * instance is closed, the program will exit */ - g_signal_connect(vb.gui.window, "destroy", G_CALLBACK(vb_destroy_window_cb), NULL); + g_signal_connect(vb.gui.window, "destroy", G_CALLBACK(destroy_window_cb), NULL); g_object_connect( G_OBJECT(vb.gui.webview), - "signal::notify::progress", G_CALLBACK(vb_webview_progress_cb), NULL, - "signal::notify::load-status", G_CALLBACK(vb_webview_load_status_cb), NULL, - "signal::button-release-event", G_CALLBACK(vb_button_relase_cb), NULL, - "signal::new-window-policy-decision-requested", G_CALLBACK(vb_new_window_policy_cb), NULL, - "signal::hovering-over-link", G_CALLBACK(vb_hover_link_cb), NULL, - "signal::title-changed", G_CALLBACK(vb_title_changed_cb), NULL, - "signal::mime-type-policy-decision-requested", G_CALLBACK(vb_mimetype_decision_cb), NULL, - "signal::download-requested", G_CALLBACK(vb_download_requested_cb), NULL, - "signal::resource-request-starting", G_CALLBACK(vb_request_start_cb), NULL, + "signal::notify::progress", G_CALLBACK(webview_progress_cb), NULL, + "signal::notify::load-status", G_CALLBACK(webview_load_status_cb), NULL, + "signal::button-release-event", G_CALLBACK(button_relase_cb), NULL, + "signal::new-window-policy-decision-requested", G_CALLBACK(new_window_policy_cb), NULL, + "signal::hovering-over-link", G_CALLBACK(hover_link_cb), NULL, + "signal::title-changed", G_CALLBACK(title_changed_cb), NULL, + "signal::mime-type-policy-decision-requested", G_CALLBACK(mimetype_decision_cb), NULL, + "signal::download-requested", G_CALLBACK(download_requested_cb), NULL, + "signal::resource-request-starting", G_CALLBACK(request_start_cb), NULL, NULL ); @@ -730,28 +730,28 @@ static void vb_setup_signals() g_object_connect( G_OBJECT(vb.gui.inputbox), - "signal::activate", G_CALLBACK(vb_inputbox_activate_cb), NULL, - "signal::key-release-event", G_CALLBACK(vb_inputbox_keyrelease_cb), NULL, + "signal::activate", G_CALLBACK(inputbox_activate_cb), NULL, + "signal::key-release-event", G_CALLBACK(inputbox_keyrelease_cb), NULL, NULL ); /* webview adjustment */ g_object_connect(G_OBJECT(vb.gui.adjust_v), - "signal::value-changed", G_CALLBACK(vb_scroll_cb), NULL, + "signal::value-changed", G_CALLBACK(scroll_cb), NULL, NULL ); /* inspector */ g_object_connect( G_OBJECT(vb.gui.inspector), - "signal::inspect-web-view", G_CALLBACK(vb_inspector_new), NULL, - "signal::show-window", G_CALLBACK(vb_inspector_show), NULL, - "signal::close-window", G_CALLBACK(vb_inspector_close), NULL, - "signal::finished", G_CALLBACK(vb_inspector_finished), NULL, + "signal::inspect-web-view", G_CALLBACK(inspector_new), NULL, + "signal::show-window", G_CALLBACK(inspector_show), NULL, + "signal::close-window", G_CALLBACK(inspector_close), NULL, + "signal::finished", G_CALLBACK(inspector_finished), NULL, NULL ); } -static void vb_init_files(void) +static void init_files(void) { char *path = util_get_config_dir(); @@ -786,7 +786,7 @@ static void vb_init_files(void) g_free(path); } -static gboolean vb_button_relase_cb(WebKitWebView *webview, GdkEventButton *event) +static gboolean button_relase_cb(WebKitWebView *webview, GdkEventButton *event) { gboolean propagate = false; WebKitHitTestResultContext context; @@ -813,7 +813,7 @@ static gboolean vb_button_relase_cb(WebKitWebView *webview, GdkEventButton *even return propagate; } -static gboolean vb_new_window_policy_cb( +static gboolean new_window_policy_cb( WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navig, WebKitWebPolicyDecision *policy) { @@ -827,7 +827,7 @@ static gboolean vb_new_window_policy_cb( return false; } -static void vb_hover_link_cb(WebKitWebView *webview, const char *title, const char *link) +static void hover_link_cb(WebKitWebView *webview, const char *title, const char *link) { char *message; if (link) { @@ -839,12 +839,12 @@ static void vb_hover_link_cb(WebKitWebView *webview, const char *title, const ch } } -static void vb_title_changed_cb(WebKitWebView *webview, WebKitWebFrame *frame, const char *title) +static void title_changed_cb(WebKitWebView *webview, WebKitWebFrame *frame, const char *title) { gtk_window_set_title(GTK_WINDOW(vb.gui.window), title); } -static gboolean vb_mimetype_decision_cb(WebKitWebView *webview, +static gboolean mimetype_decision_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetworkRequest *request, char *mime_type, WebKitWebPolicyDecision *decision) { @@ -856,7 +856,7 @@ static gboolean vb_mimetype_decision_cb(WebKitWebView *webview, return false; } -static gboolean vb_download_requested_cb(WebKitWebView *view, WebKitDownload *download) +static gboolean download_requested_cb(WebKitWebView *view, WebKitDownload *download) { WebKitDownloadStatus status; char *uri = NULL; @@ -887,8 +887,8 @@ static gboolean vb_download_requested_cb(WebKitWebView *view, WebKitDownload *do vb.state.downloads = g_list_prepend(vb.state.downloads, download); /* connect signal handler to check if the download is done */ - g_signal_connect(download, "notify::status", G_CALLBACK(vb_download_progress_cp), NULL); - g_signal_connect(download, "notify::progress", G_CALLBACK(vb_webview_download_progress_cb), NULL); + g_signal_connect(download, "notify::status", G_CALLBACK(download_progress_cp), NULL); + g_signal_connect(download, "notify::progress", G_CALLBACK(webview_download_progress_cb), NULL); vb_update_statusbar(); @@ -898,7 +898,7 @@ static gboolean vb_download_requested_cb(WebKitWebView *view, WebKitDownload *do /** * Callback to filter started resource request. */ -static void vb_request_start_cb(WebKitWebView *webview, WebKitWebFrame *frame, +static void request_start_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitWebResource *resource, WebKitNetworkRequest *request, WebKitNetworkResponse *response) { @@ -908,7 +908,7 @@ static void vb_request_start_cb(WebKitWebView *webview, WebKitWebFrame *frame, } } -static void vb_download_progress_cp(WebKitDownload *download, GParamSpec *pspec) +static void download_progress_cp(WebKitDownload *download, GParamSpec *pspec) { WebKitDownloadStatus status = webkit_download_get_status(download); @@ -930,7 +930,7 @@ static void vb_download_progress_cp(WebKitDownload *download, GParamSpec *pspec) vb_update_statusbar(); } -static void vb_destroy_client() +static void destroy_client() { const char *uri = webkit_web_view_get_uri(vb.gui.webview); /* write last URL into file for recreation */ @@ -1000,7 +1000,7 @@ int main(int argc, char *argv[]) vb.embed = strtol(winid, NULL, 0); } - vb_init_core(); + init_core(); /* command line argument: URL */ Arg arg = {VB_TARGET_CURRENT}; diff --git a/src/searchengine.c b/src/searchengine.c index 5f59d60..82f2f1f 100644 --- a/src/searchengine.c +++ b/src/searchengine.c @@ -27,22 +27,22 @@ typedef struct { char *uri; } Searchengine; -static GSList *searchengine_find(const char *handle); -static gboolean searchengine_is_valid_uri(const char *uri); -static void searchengine_free(Searchengine *se); +static GSList *find(const char *handle); +static gboolean is_valid_uri(const char *uri); +static void free_searchengine(Searchengine *se); void searchengine_cleanup(void) { if (vb.behave.searchengines) { - g_slist_free_full(vb.behave.searchengines, (GDestroyNotify)searchengine_free); + g_slist_free_full(vb.behave.searchengines, (GDestroyNotify)free_searchengine); } } gboolean searchengine_add(const char *handle, const char *uri) { /* validate if the uri contains only one %s sequence */ - if (!searchengine_is_valid_uri(uri)) { + if (!is_valid_uri(uri)) { return false; } Searchengine *s = g_new0(Searchengine, 1); @@ -57,10 +57,10 @@ gboolean searchengine_add(const char *handle, const char *uri) gboolean searchengine_remove(const char *handle) { - GSList *list = searchengine_find(handle); + GSList *list = find(handle); if (list) { - searchengine_free((Searchengine*)list->data); + free_searchengine((Searchengine*)list->data); vb.behave.searchengines = g_slist_delete_link(vb.behave.searchengines, list); return TRUE; @@ -90,7 +90,7 @@ char *searchengine_get_uri(const char *string) if ((p = strchr(string, ' '))) { *p = '\0'; /* is the first word the handle? */ - if ((l = searchengine_find(string))) { + if ((l = find(string))) { tmpl = ((Searchengine*)l->data)->uri; query = soup_uri_encode(p + 1, "&"); } else { @@ -98,7 +98,7 @@ char *searchengine_get_uri(const char *string) } } - if (!tmpl && (l = searchengine_find(vb.behave.searchengine_default))) { + if (!tmpl && (l = find(vb.behave.searchengine_default))) { tmpl = ((Searchengine*)l->data)->uri; query = soup_uri_encode(string, "&"); } @@ -113,7 +113,7 @@ char *searchengine_get_uri(const char *string) return NULL; } -static GSList *searchengine_find(const char *handle) +static GSList *find(const char *handle) { GSList *s; for (s = vb.behave.searchengines; s != NULL; s = s->next) { @@ -125,7 +125,7 @@ static GSList *searchengine_find(const char *handle) return NULL; } -static gboolean searchengine_is_valid_uri(const char *uri) +static gboolean is_valid_uri(const char *uri) { int count = 0; @@ -141,7 +141,7 @@ static gboolean searchengine_is_valid_uri(const char *uri) return count == 1; } -static void searchengine_free(Searchengine *se) +static void free_searchengine(Searchengine *se) { g_free(se->uri); g_free(se->handle); diff --git a/src/session.c b/src/session.c index dad0b28..90ddb63 100644 --- a/src/session.c +++ b/src/session.c @@ -21,14 +21,28 @@ #include "main.h" #include "session.h" -G_DEFINE_TYPE(SessionCookieJar, session_cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT) - -static SoupCookieJar *session_cookiejar_new(const char *file, gboolean ro); -static void session_cookiejar_changed(SoupCookieJar *self, SoupCookie *old, SoupCookie *new); -static void session_cookiejar_class_init(SessionCookieJarClass *class); -static void session_cookiejar_finalize(GObject *self); -static void session_cookiejar_init(SessionCookieJar *self); -static void session_cookiejar_set_property(GObject *self, guint prop_id, +#define COOKIEJAR_TYPE (cookiejar_get_type()) +#define COOKIEJAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), COOKIEJAR_TYPE, CookieJar)) + +typedef struct { + SoupCookieJarText parent_instance; + int lock; +} CookieJar; + +typedef struct { + SoupCookieJarTextClass parent_class; +} CookieJarClass; + +static GType cookiejar_get_type(void); + +G_DEFINE_TYPE(CookieJar, cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT) + +static SoupCookieJar *cookiejar_new(const char *file, gboolean ro); +static void cookiejar_changed(SoupCookieJar *self, SoupCookie *old, SoupCookie *new); +static void cookiejar_class_init(CookieJarClass *class); +static void cookiejar_finalize(GObject *self); +static void cookiejar_init(CookieJar *self); +static void cookiejar_set_property(GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec); extern VbCore vb; @@ -42,54 +56,54 @@ void session_init(void) vb.soup_session = webkit_get_default_session(); soup_session_add_feature( vb.soup_session, - SOUP_SESSION_FEATURE(session_cookiejar_new(vb.files[FILES_COOKIE], false)) + SOUP_SESSION_FEATURE(cookiejar_new(vb.files[FILES_COOKIE], false)) ); g_object_set(vb.soup_session, "max-conns", SETTING_MAX_CONNS , NULL); g_object_set(vb.soup_session, "max-conns-per-host", SETTING_MAX_CONNS_PER_HOST, NULL); } -static SoupCookieJar *session_cookiejar_new(const char *file, gboolean ro) +static SoupCookieJar *cookiejar_new(const char *file, gboolean ro) { return g_object_new( - SESSION_COOKIEJAR_TYPE, SOUP_COOKIE_JAR_TEXT_FILENAME, file, SOUP_COOKIE_JAR_READ_ONLY, ro, NULL + COOKIEJAR_TYPE, SOUP_COOKIE_JAR_TEXT_FILENAME, file, SOUP_COOKIE_JAR_READ_ONLY, ro, NULL ); } -static void session_cookiejar_changed(SoupCookieJar *self, SoupCookie *old_cookie, SoupCookie *new_cookie) +static void cookiejar_changed(SoupCookieJar *self, SoupCookie *old_cookie, SoupCookie *new_cookie) { - flock(SESSION_COOKIEJAR(self)->lock, LOCK_EX); + flock(COOKIEJAR(self)->lock, LOCK_EX); if (new_cookie && !new_cookie->expires) { soup_cookie_set_expires(new_cookie, soup_date_new_from_now(vb.config.cookie_timeout)); } - SOUP_COOKIE_JAR_CLASS(session_cookiejar_parent_class)->changed(self, old_cookie, new_cookie); - flock(SESSION_COOKIEJAR(self)->lock, LOCK_UN); + SOUP_COOKIE_JAR_CLASS(cookiejar_parent_class)->changed(self, old_cookie, new_cookie); + flock(COOKIEJAR(self)->lock, LOCK_UN); } -static void session_cookiejar_class_init(SessionCookieJarClass *class) +static void cookiejar_class_init(CookieJarClass *class) { - SOUP_COOKIE_JAR_CLASS(class)->changed = session_cookiejar_changed; - G_OBJECT_CLASS(class)->get_property = G_OBJECT_CLASS(session_cookiejar_parent_class)->get_property; - G_OBJECT_CLASS(class)->set_property = session_cookiejar_set_property; - G_OBJECT_CLASS(class)->finalize = session_cookiejar_finalize; + SOUP_COOKIE_JAR_CLASS(class)->changed = cookiejar_changed; + G_OBJECT_CLASS(class)->get_property = G_OBJECT_CLASS(cookiejar_parent_class)->get_property; + G_OBJECT_CLASS(class)->set_property = cookiejar_set_property; + G_OBJECT_CLASS(class)->finalize = cookiejar_finalize; g_object_class_override_property(G_OBJECT_CLASS(class), 1, "filename"); } -static void session_cookiejar_finalize(GObject *self) +static void cookiejar_finalize(GObject *self) { - close(SESSION_COOKIEJAR(self)->lock); - G_OBJECT_CLASS(session_cookiejar_parent_class)->finalize(self); + close(COOKIEJAR(self)->lock); + G_OBJECT_CLASS(cookiejar_parent_class)->finalize(self); } -static void session_cookiejar_init(SessionCookieJar *self) +static void cookiejar_init(CookieJar *self) { self->lock = open(vb.files[FILES_COOKIE], 0); } -static void session_cookiejar_set_property(GObject *self, guint prop_id, const +static void cookiejar_set_property(GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec) { - flock(SESSION_COOKIEJAR(self)->lock, LOCK_SH); - G_OBJECT_CLASS(session_cookiejar_parent_class)->set_property(self, prop_id, value, pspec); - flock(SESSION_COOKIEJAR(self)->lock, LOCK_UN); + flock(COOKIEJAR(self)->lock, LOCK_SH); + G_OBJECT_CLASS(cookiejar_parent_class)->set_property(self, prop_id, value, pspec); + flock(COOKIEJAR(self)->lock, LOCK_UN); } diff --git a/src/session.h b/src/session.h index fceb9e4..d0c6630 100644 --- a/src/session.h +++ b/src/session.h @@ -20,23 +20,6 @@ #ifndef _SESSION_H #define _SESSION_H -#include -#include - -#define SESSION_COOKIEJAR_TYPE (session_cookiejar_get_type()) -#define SESSION_COOKIEJAR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SESSION_COOKIEJAR_TYPE, SessionCookieJar)) - -typedef struct { - SoupCookieJarText parent_instance; - int lock; -} SessionCookieJar; - -typedef struct { - SoupCookieJarTextClass parent_class; -} SessionCookieJarClass; - -GType session_cookiejar_get_type(void); - void session_init(void); #endif /* end of include guard: _SESSION_H */ diff --git a/src/setting.c b/src/setting.c index 72b98fa..03041e1 100644 --- a/src/setting.c +++ b/src/setting.c @@ -22,85 +22,85 @@ extern VbCore vb; -static Arg *setting_char_to_arg(const char *str, const Type type); -static void setting_print_value(const Setting *s, void *value); -static gboolean setting_webkit(const Setting *s, const SettingType type); -static gboolean setting_cookie_timeout(const Setting *s, const SettingType type); -static gboolean setting_scrollstep(const Setting *s, const SettingType type); -static gboolean setting_status_color_bg(const Setting *s, const SettingType type); -static gboolean setting_status_color_fg(const Setting *s, const SettingType type); -static gboolean setting_status_font(const Setting *s, const SettingType type); -static gboolean setting_input_style(const Setting *s, const SettingType type); -static gboolean setting_completion_style(const Setting *s, const SettingType type); -static gboolean setting_hint_style(const Setting *s, const SettingType type); -static gboolean setting_strict_ssl(const Setting *s, const SettingType type); -static gboolean setting_ca_bundle(const Setting *s, const SettingType type); -static gboolean setting_home_page(const Setting *s, const SettingType type); -static gboolean setting_download_path(const Setting *s, const SettingType type); -static gboolean setting_proxy(const Setting *s, const SettingType type); -static gboolean setting_user_style(const Setting *s, const SettingType type); -static gboolean setting_history_max_items(const Setting *s, const SettingType type); +static Arg *char_to_arg(const char *str, const Type type); +static void print_value(const Setting *s, void *value); +static gboolean webkit(const Setting *s, const SettingType type); +static gboolean cookie_timeout(const Setting *s, const SettingType type); +static gboolean scrollstep(const Setting *s, const SettingType type); +static gboolean status_color_bg(const Setting *s, const SettingType type); +static gboolean status_color_fg(const Setting *s, const SettingType type); +static gboolean status_font(const Setting *s, const SettingType type); +static gboolean input_style(const Setting *s, const SettingType type); +static gboolean completion_style(const Setting *s, const SettingType type); +static gboolean hint_style(const Setting *s, const SettingType type); +static gboolean strict_ssl(const Setting *s, const SettingType type); +static gboolean ca_bundle(const Setting *s, const SettingType type); +static gboolean home_page(const Setting *s, const SettingType type); +static gboolean download_path(const Setting *s, const SettingType type); +static gboolean proxy(const Setting *s, const SettingType type); +static gboolean user_style(const Setting *s, const SettingType type); +static gboolean history_max_items(const Setting *s, const SettingType type); static Setting default_settings[] = { /* webkit settings */ /* alias, name, type, func, arg */ - {"images", "auto-load-images", TYPE_BOOLEAN, setting_webkit, {0}}, - {"cursivfont", "cursive-font-family", TYPE_CHAR, setting_webkit, {0}}, - {"defaultencondig", "default-encoding", TYPE_CHAR, setting_webkit, {0}}, - {"defaultfont", "default-font-family", TYPE_CHAR, setting_webkit, {0}}, - {"fontsize", "default-font-size", TYPE_INTEGER, setting_webkit, {0}}, - {"monofontsize", "default-monospace-font-size", TYPE_INTEGER, setting_webkit, {0}}, - {"caret", "enable-caret-browsing", TYPE_BOOLEAN, setting_webkit, {0}}, - {"webinspector", "enable-developer-extras", TYPE_BOOLEAN, setting_webkit, {0}}, - {"offlinecache", "enable-offline-web-application-cache", TYPE_BOOLEAN, setting_webkit, {0}}, - {"pagecache", "enable-page-cache", TYPE_BOOLEAN, setting_webkit, {0}}, - {"plugins", "enable-plugins", TYPE_BOOLEAN, setting_webkit, {0}}, - {"scripts", "enable-scripts", TYPE_BOOLEAN, setting_webkit, {0}}, - {"xssauditor", "enable-xss-auditor", TYPE_BOOLEAN, setting_webkit, {0}}, - {"minimumfontsize", "minimum-font-size", TYPE_INTEGER, setting_webkit, {0}}, - {"monofont", "monospace-font-family", TYPE_CHAR, setting_webkit, {0}}, - {"backgrounds", "print-backgrounds", TYPE_BOOLEAN, setting_webkit, {0}}, - {"sansfont", "sans-serif-font-family", TYPE_CHAR, setting_webkit, {0}}, - {"seriffont", "serif-font-family", TYPE_CHAR, setting_webkit, {0}}, - {"useragent", "user-agent", TYPE_CHAR, setting_webkit, {0}}, + {"images", "auto-load-images", TYPE_BOOLEAN, webkit, {0}}, + {"cursivfont", "cursive-font-family", TYPE_CHAR, webkit, {0}}, + {"defaultencondig", "default-encoding", TYPE_CHAR, webkit, {0}}, + {"defaultfont", "default-font-family", TYPE_CHAR, webkit, {0}}, + {"fontsize", "default-font-size", TYPE_INTEGER, webkit, {0}}, + {"monofontsize", "default-monospace-font-size", TYPE_INTEGER, webkit, {0}}, + {"caret", "enable-caret-browsing", TYPE_BOOLEAN, webkit, {0}}, + {"webinspector", "enable-developer-extras", TYPE_BOOLEAN, webkit, {0}}, + {"offlinecache", "enable-offline-web-application-cache", TYPE_BOOLEAN, webkit, {0}}, + {"pagecache", "enable-page-cache", TYPE_BOOLEAN, webkit, {0}}, + {"plugins", "enable-plugins", TYPE_BOOLEAN, webkit, {0}}, + {"scripts", "enable-scripts", TYPE_BOOLEAN, webkit, {0}}, + {"xssauditor", "enable-xss-auditor", TYPE_BOOLEAN, webkit, {0}}, + {"minimumfontsize", "minimum-font-size", TYPE_INTEGER, webkit, {0}}, + {"monofont", "monospace-font-family", TYPE_CHAR, webkit, {0}}, + {"backgrounds", "print-backgrounds", TYPE_BOOLEAN, webkit, {0}}, + {"sansfont", "sans-serif-font-family", TYPE_CHAR, webkit, {0}}, + {"seriffont", "serif-font-family", TYPE_CHAR, webkit, {0}}, + {"useragent", "user-agent", TYPE_CHAR, webkit, {0}}, /* internal variables */ - {NULL, "stylesheet", TYPE_BOOLEAN, setting_user_style, {0}}, - - {NULL, "proxy", TYPE_BOOLEAN, setting_proxy, {0}}, - {NULL, "cookie-timeout", TYPE_INTEGER, setting_cookie_timeout, {0}}, - {NULL, "strict-ssl", TYPE_BOOLEAN, setting_strict_ssl, {0}}, - - {NULL, "scrollstep", TYPE_INTEGER, setting_scrollstep, {0}}, - {NULL, "status-color-bg", TYPE_COLOR, setting_status_color_bg, {0}}, - {NULL, "status-color-fg", TYPE_COLOR, setting_status_color_fg, {0}}, - {NULL, "status-font", TYPE_FONT, setting_status_font, {0}}, - {NULL, "status-ssl-color-bg", TYPE_COLOR, setting_status_color_bg, {0}}, - {NULL, "status-ssl-color-fg", TYPE_COLOR, setting_status_color_fg, {0}}, - {NULL, "status-ssl-font", TYPE_FONT, setting_status_font, {0}}, - {NULL, "status-sslinvalid-color-bg", TYPE_COLOR, setting_status_color_bg, {0}}, - {NULL, "status-sslinvalid-color-fg", TYPE_COLOR, setting_status_color_fg, {0}}, - {NULL, "status-sslinvalid-font", TYPE_FONT, setting_status_font, {0}}, - {NULL, "input-bg-normal", TYPE_COLOR, setting_input_style, {0}}, - {NULL, "input-bg-error", TYPE_COLOR, setting_input_style, {0}}, - {NULL, "input-fg-normal", TYPE_COLOR, setting_input_style, {0}}, - {NULL, "input-fg-error", TYPE_COLOR, setting_input_style, {0}}, - {NULL, "input-font-normal", TYPE_FONT, setting_input_style, {0}}, - {NULL, "input-font-error", TYPE_FONT, setting_input_style, {0}}, - {NULL, "completion-font", TYPE_FONT, setting_completion_style, {0}}, - {NULL, "completion-fg-normal", TYPE_COLOR, setting_completion_style, {0}}, - {NULL, "completion-fg-active", TYPE_COLOR, setting_completion_style, {0}}, - {NULL, "completion-bg-normal", TYPE_COLOR, setting_completion_style, {0}}, - {NULL, "completion-bg-active", TYPE_COLOR, setting_completion_style, {0}}, - {NULL, "max-completion-items", TYPE_INTEGER, setting_completion_style, {0}}, - {NULL, "hint-bg", TYPE_CHAR, setting_hint_style, {0}}, - {NULL, "hint-bg-focus", TYPE_CHAR, setting_hint_style, {0}}, - {NULL, "hint-fg", TYPE_CHAR, setting_hint_style, {0}}, - {NULL, "hint-style", TYPE_CHAR, setting_hint_style, {0}}, - {NULL, "ca-bundle", TYPE_CHAR, setting_ca_bundle, {0}}, - {NULL, "home-page", TYPE_CHAR, setting_home_page, {0}}, - {NULL, "download-path", TYPE_CHAR, setting_download_path, {0}}, - {NULL, "history-max-items", TYPE_INTEGER, setting_history_max_items, {0}}, + {NULL, "stylesheet", TYPE_BOOLEAN, user_style, {0}}, + + {NULL, "proxy", TYPE_BOOLEAN, proxy, {0}}, + {NULL, "cookie-timeout", TYPE_INTEGER, cookie_timeout, {0}}, + {NULL, "strict-ssl", TYPE_BOOLEAN, strict_ssl, {0}}, + + {NULL, "scrollstep", TYPE_INTEGER, scrollstep, {0}}, + {NULL, "status-color-bg", TYPE_COLOR, status_color_bg, {0}}, + {NULL, "status-color-fg", TYPE_COLOR, status_color_fg, {0}}, + {NULL, "status-font", TYPE_FONT, status_font, {0}}, + {NULL, "status-ssl-color-bg", TYPE_COLOR, status_color_bg, {0}}, + {NULL, "status-ssl-color-fg", TYPE_COLOR, status_color_fg, {0}}, + {NULL, "status-ssl-font", TYPE_FONT, status_font, {0}}, + {NULL, "status-sslinvalid-color-bg", TYPE_COLOR, status_color_bg, {0}}, + {NULL, "status-sslinvalid-color-fg", TYPE_COLOR, status_color_fg, {0}}, + {NULL, "status-sslinvalid-font", TYPE_FONT, status_font, {0}}, + {NULL, "input-bg-normal", TYPE_COLOR, input_style, {0}}, + {NULL, "input-bg-error", TYPE_COLOR, input_style, {0}}, + {NULL, "input-fg-normal", TYPE_COLOR, input_style, {0}}, + {NULL, "input-fg-error", TYPE_COLOR, input_style, {0}}, + {NULL, "input-font-normal", TYPE_FONT, input_style, {0}}, + {NULL, "input-font-error", TYPE_FONT, input_style, {0}}, + {NULL, "completion-font", TYPE_FONT, completion_style, {0}}, + {NULL, "completion-fg-normal", TYPE_COLOR, completion_style, {0}}, + {NULL, "completion-fg-active", TYPE_COLOR, completion_style, {0}}, + {NULL, "completion-bg-normal", TYPE_COLOR, completion_style, {0}}, + {NULL, "completion-bg-active", TYPE_COLOR, completion_style, {0}}, + {NULL, "max-completion-items", TYPE_INTEGER, completion_style, {0}}, + {NULL, "hint-bg", TYPE_CHAR, hint_style, {0}}, + {NULL, "hint-bg-focus", TYPE_CHAR, hint_style, {0}}, + {NULL, "hint-fg", TYPE_CHAR, hint_style, {0}}, + {NULL, "hint-style", TYPE_CHAR, hint_style, {0}}, + {NULL, "ca-bundle", TYPE_CHAR, ca_bundle, {0}}, + {NULL, "home-page", TYPE_CHAR, home_page, {0}}, + {NULL, "download-path", TYPE_CHAR, download_path, {0}}, + {NULL, "history-max-items", TYPE_INTEGER, history_max_items, {0}}, }; void setting_init(void) @@ -150,7 +150,7 @@ gboolean setting_run(char *name, const char *param) if (type == SETTING_SET) { /* if string param is given convert it to the required data type and set * it to the arg of the setting */ - a = setting_char_to_arg(param, s->type); + a = char_to_arg(param, s->type); if (a == NULL) { vb_echo(VB_MSG_ERROR, TRUE, "No valid value"); return false; @@ -197,7 +197,7 @@ gboolean setting_run(char *name, const char *param) /** * Converts string representing also given data type into and Arg. */ -static Arg *setting_char_to_arg(const char *str, const Type type) +static Arg *char_to_arg(const char *str, const Type type) { if (!str) { return NULL; @@ -231,7 +231,7 @@ static Arg *setting_char_to_arg(const char *str, const Type type) /** * Print the setting value to the input box. */ -static void setting_print_value(const Setting *s, void *value) +static void print_value(const Setting *s, void *value) { const char *name = s->alias ? s->alias : s->name; char *string = NULL; @@ -267,7 +267,7 @@ static void setting_print_value(const Setting *s, void *value) } } -static gboolean setting_webkit(const Setting *s, const SettingType type) +static gboolean webkit(const Setting *s, const SettingType type) { WebKitWebSettings *web_setting = webkit_web_view_get_settings(vb.gui.webview); @@ -285,7 +285,7 @@ static gboolean setting_webkit(const Setting *s, const SettingType type) } /* print the new value */ - setting_print_value(s, &value); + print_value(s, &value); } else { g_object_set(G_OBJECT(web_setting), s->name, s->arg.i ? TRUE : false, NULL); } @@ -295,7 +295,7 @@ static gboolean setting_webkit(const Setting *s, const SettingType type) if (type == SETTING_GET) { int value; g_object_get(G_OBJECT(web_setting), s->name, &value, NULL); - setting_print_value(s, &value); + print_value(s, &value); } else { g_object_set(G_OBJECT(web_setting), s->name, s->arg.i, NULL); } @@ -305,7 +305,7 @@ static gboolean setting_webkit(const Setting *s, const SettingType type) if (type == SETTING_GET) { gfloat value; g_object_get(G_OBJECT(web_setting), s->name, &value, NULL); - setting_print_value(s, &value); + print_value(s, &value); } else { g_object_set(G_OBJECT(web_setting), s->name, (gfloat)(s->arg.i / 1000000.0), NULL); } @@ -317,7 +317,7 @@ static gboolean setting_webkit(const Setting *s, const SettingType type) if (type == SETTING_GET) { char *value = NULL; g_object_get(G_OBJECT(web_setting), s->name, &value, NULL); - setting_print_value(s, value); + print_value(s, value); } else { g_object_set(G_OBJECT(web_setting), s->name, s->arg.s, NULL); } @@ -326,10 +326,10 @@ static gboolean setting_webkit(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_cookie_timeout(const Setting *s, const SettingType type) +static gboolean cookie_timeout(const Setting *s, const SettingType type) { if (type == SETTING_GET) { - setting_print_value(s, &vb.config.cookie_timeout); + print_value(s, &vb.config.cookie_timeout); } else { vb.config.cookie_timeout = s->arg.i; } @@ -337,10 +337,10 @@ static gboolean setting_cookie_timeout(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_scrollstep(const Setting *s, const SettingType type) +static gboolean scrollstep(const Setting *s, const SettingType type) { if (type == SETTING_GET) { - setting_print_value(s, &vb.config.scrollstep); + print_value(s, &vb.config.scrollstep); } else { vb.config.scrollstep = s->arg.i; } @@ -348,7 +348,7 @@ static gboolean setting_scrollstep(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_status_color_bg(const Setting *s, const SettingType type) +static gboolean status_color_bg(const Setting *s, const SettingType type) { StatusType stype; if (g_str_has_prefix(s->name, "status-sslinvalid")) { @@ -360,7 +360,7 @@ static gboolean setting_status_color_bg(const Setting *s, const SettingType type } if (type == SETTING_GET) { - setting_print_value(s, &vb.style.status_bg[stype]); + print_value(s, &vb.style.status_bg[stype]); } else { VB_COLOR_PARSE(&vb.style.status_bg[stype], s->arg.s); vb_update_status_style(); @@ -369,7 +369,7 @@ static gboolean setting_status_color_bg(const Setting *s, const SettingType type return TRUE; } -static gboolean setting_status_color_fg(const Setting *s, const SettingType type) +static gboolean status_color_fg(const Setting *s, const SettingType type) { StatusType stype; if (g_str_has_prefix(s->name, "status-sslinvalid")) { @@ -381,7 +381,7 @@ static gboolean setting_status_color_fg(const Setting *s, const SettingType type } if (type == SETTING_GET) { - setting_print_value(s, &vb.style.status_fg[stype]); + print_value(s, &vb.style.status_fg[stype]); } else { VB_COLOR_PARSE(&vb.style.status_fg[stype], s->arg.s); vb_update_status_style(); @@ -390,7 +390,7 @@ static gboolean setting_status_color_fg(const Setting *s, const SettingType type return TRUE; } -static gboolean setting_status_font(const Setting *s, const SettingType type) +static gboolean status_font(const Setting *s, const SettingType type) { StatusType stype; if (g_str_has_prefix(s->name, "status-sslinvalid")) { @@ -402,7 +402,7 @@ static gboolean setting_status_font(const Setting *s, const SettingType type) } if (type == SETTING_GET) { - setting_print_value(s, vb.style.status_font[stype]); + print_value(s, vb.style.status_font[stype]); } else { if (vb.style.status_font[stype]) { /* free previous font description */ @@ -415,7 +415,7 @@ static gboolean setting_status_font(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_input_style(const Setting *s, const SettingType type) +static gboolean input_style(const Setting *s, const SettingType type) { Style *style = &vb.style; MessageType itype = g_str_has_suffix(s->name, "normal") ? VB_MSG_NORMAL : VB_MSG_ERROR; @@ -423,7 +423,7 @@ static gboolean setting_input_style(const Setting *s, const SettingType type) if (s->type == TYPE_FONT) { /* input font */ if (type == SETTING_GET) { - setting_print_value(s, style->input_font[itype]); + print_value(s, style->input_font[itype]); } else { if (style->input_font[itype]) { pango_font_description_free(style->input_font[itype]); @@ -441,7 +441,7 @@ static gboolean setting_input_style(const Setting *s, const SettingType type) } if (type == SETTING_GET) { - setting_print_value(s, color); + print_value(s, color); } else { VB_COLOR_PARSE(color, s->arg.s); } @@ -453,7 +453,7 @@ static gboolean setting_input_style(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_completion_style(const Setting *s, const SettingType type) +static gboolean completion_style(const Setting *s, const SettingType type) { Style *style = &vb.style; CompletionStyle ctype = g_str_has_suffix(s->name, "normal") ? VB_COMP_NORMAL : VB_COMP_ACTIVE; @@ -461,13 +461,13 @@ static gboolean setting_completion_style(const Setting *s, const SettingType typ if (s->type == TYPE_INTEGER) { /* max completion items */ if (type == SETTING_GET) { - setting_print_value(s, &vb.config.max_completion_items); + print_value(s, &vb.config.max_completion_items); } else { vb.config.max_completion_items = s->arg.i; } } else if (s->type == TYPE_FONT) { if (type == SETTING_GET) { - setting_print_value(s, style->comp_font); + print_value(s, style->comp_font); } else { if (style->comp_font) { pango_font_description_free(style->comp_font); @@ -485,7 +485,7 @@ static gboolean setting_completion_style(const Setting *s, const SettingType typ } if (type == SETTING_GET) { - setting_print_value(s, color); + print_value(s, color); } else { VB_COLOR_PARSE(color, s->arg.s); } @@ -494,30 +494,30 @@ static gboolean setting_completion_style(const Setting *s, const SettingType typ return TRUE; } -static gboolean setting_hint_style(const Setting *s, const SettingType type) +static gboolean hint_style(const Setting *s, const SettingType type) { Style *style = &vb.style; if (!g_strcmp0(s->name, "hint-bg")) { if (type == SETTING_GET) { - setting_print_value(s, style->hint_bg); + print_value(s, style->hint_bg); } else { OVERWRITE_STRING(style->hint_bg, s->arg.s) } } else if (!g_strcmp0(s->name, "hint-bg-focus")) { if (type == SETTING_GET) { - setting_print_value(s, style->hint_bg_focus); + print_value(s, style->hint_bg_focus); } else { OVERWRITE_STRING(style->hint_bg_focus, s->arg.s) } } else if (!g_strcmp0(s->name, "hint-fg")) { if (type == SETTING_GET) { - setting_print_value(s, style->hint_fg); + print_value(s, style->hint_fg); } else { OVERWRITE_STRING(style->hint_fg, s->arg.s) } } else { if (type == SETTING_GET) { - setting_print_value(s, style->hint_style); + print_value(s, style->hint_style); } else { OVERWRITE_STRING(style->hint_style, s->arg.s); } @@ -526,13 +526,13 @@ static gboolean setting_hint_style(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_strict_ssl(const Setting *s, const SettingType type) +static gboolean strict_ssl(const Setting *s, const SettingType type) { gboolean value; if (type != SETTING_SET) { g_object_get(vb.soup_session, "ssl-strict", &value, NULL); if (type == SETTING_GET) { - setting_print_value(s, &value); + print_value(s, &value); return TRUE; } @@ -545,12 +545,12 @@ static gboolean setting_strict_ssl(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_ca_bundle(const Setting *s, const SettingType type) +static gboolean ca_bundle(const Setting *s, const SettingType type) { char *value; if (type == SETTING_GET) { g_object_get(vb.soup_session, "ssl-ca-file", &value, NULL); - setting_print_value(s, value); + print_value(s, value); g_free(value); } else { g_object_set(vb.soup_session, "ssl-ca-file", s->arg.s, NULL); @@ -559,10 +559,10 @@ static gboolean setting_ca_bundle(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_home_page(const Setting *s, const SettingType type) +static gboolean home_page(const Setting *s, const SettingType type) { if (type == SETTING_GET) { - setting_print_value(s, vb.config.home_page); + print_value(s, vb.config.home_page); } else { OVERWRITE_STRING(vb.config.home_page, s->arg.s); } @@ -570,10 +570,10 @@ static gboolean setting_home_page(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_download_path(const Setting *s, const SettingType type) +static gboolean download_path(const Setting *s, const SettingType type) { if (type == SETTING_GET) { - setting_print_value(s, vb.config.download_dir); + print_value(s, vb.config.download_dir); } else { if (vb.config.download_dir) { g_free(vb.config.download_dir); @@ -592,7 +592,7 @@ static gboolean setting_download_path(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_proxy(const Setting *s, const SettingType type) +static gboolean proxy(const Setting *s, const SettingType type) { gboolean enabled; char *proxy, *proxy_new; @@ -604,7 +604,7 @@ static gboolean setting_proxy(const Setting *s, const SettingType type) enabled = (proxy_uri != NULL); if (type == SETTING_GET) { - setting_print_value(s, &enabled); + print_value(s, &enabled); return TRUE; } @@ -613,7 +613,7 @@ static gboolean setting_proxy(const Setting *s, const SettingType type) if (type == SETTING_TOGGLE) { enabled = !enabled; /* print the new value */ - setting_print_value(s, &enabled); + print_value(s, &enabled); } else { enabled = s->arg.i; } @@ -638,7 +638,7 @@ static gboolean setting_proxy(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_user_style(const Setting *s, const SettingType type) +static gboolean user_style(const Setting *s, const SettingType type) { gboolean enabled = false; char *uri = NULL; @@ -648,7 +648,7 @@ static gboolean setting_user_style(const Setting *s, const SettingType type) enabled = (uri != NULL); if (type == SETTING_GET) { - setting_print_value(s, &enabled); + print_value(s, &enabled); return TRUE; } @@ -657,7 +657,7 @@ static gboolean setting_user_style(const Setting *s, const SettingType type) if (type == SETTING_TOGGLE) { enabled = !enabled; /* print the new value */ - setting_print_value(s, &enabled); + print_value(s, &enabled); } else { enabled = s->arg.i; } @@ -673,10 +673,10 @@ static gboolean setting_user_style(const Setting *s, const SettingType type) return TRUE; } -static gboolean setting_history_max_items(const Setting *s, const SettingType type) +static gboolean history_max_items(const Setting *s, const SettingType type) { if (type == SETTING_GET) { - setting_print_value(s, &vb.config.history_max); + print_value(s, &vb.config.history_max); return TRUE; }