logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: d995f70a93c8701b0bb881e10ba19f367badc950
parent: 7e77cef6c4bad117074236cce3c5114d1b763660
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 11 Apr 2019 01:51:56 +0200

Merge branch 'formatting' into develop

Diffstat:

M.clang-format1+
Mbadwolf.c83++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
2 files changed, 52 insertions(+), 32 deletions(-)

diff --git a/.clang-format b/.clang-format @@ -5,6 +5,7 @@ AlignTrailingComments: true AllowShortCaseLabelsOnASingleLine: true AllowShortFunctionsOnASingleLine: true AllowShortIfStatementsOnASingleLine: true +AlwaysBreakAfterReturnType: AllDefinitions BinPackArguments: false BinPackParameters: false BreakBeforeBraces: Allman diff --git a/badwolf.c b/badwolf.c @@ -36,6 +36,7 @@ static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason); static gboolean WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data); +GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser); static gboolean WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data); static gboolean @@ -48,7 +49,7 @@ static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView, WebKitHitTestResult *hit, guint modifiers, gpointer user_data); -static WebKitWebView *WebViewCb_create(WebKitWebView *webView, +static WebKitWebView *WebViewCb_create(WebKitWebView *related_web_view, WebKitNavigationAction *navigation_action, gpointer user_data); static gboolean locationCb_activate(GtkEntry *location, gpointer user_data); @@ -59,14 +60,15 @@ static gboolean SearchEntryCb_search__changed(GtkSearchEntry *search, gpointer u static gboolean SearchEntryCb_stop__search(GtkSearchEntry *search, gpointer user_data); struct Client * new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web_view); -void new_tabCb_clicked(GtkButton *new_tab, gpointer user_data); -void closeCb_clicked(GtkButton *close, gpointer user_data); int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser); -GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser); +static void new_tabCb_clicked(GtkButton *new_tab, gpointer user_data); +static void closeCb_clicked(GtkButton *close, gpointer user_data); +static void +notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data); gint get_tab_position(GtkContainer *notebook, GtkWidget *child); -int main(int argc, char *argv[]); -static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data) +static gboolean +WebViewCb_close(WebKitWebView *webView, gpointer user_data) { (void)webView; struct Client *browser = (struct Client *)user_data; @@ -81,8 +83,8 @@ static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data) return TRUE; } -static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, - WebKitWebProcessTerminationReason reason) +static gboolean +WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason) { (void)webView; char *str_reason; @@ -101,7 +103,8 @@ static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, return FALSE; } -static gboolean WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data) +static gboolean +WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data) { (void)webView; (void)pspec; @@ -115,7 +118,8 @@ static gboolean WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, return TRUE; } -GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser) +GtkWidget * +badwolf_new_tab_box(const gchar *title, struct Client *browser) { (void)browser; GtkWidget *tab_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); @@ -169,7 +173,8 @@ WebViewCb_notify__is__playing__audio(WebKitWebView *webView, GParamSpec *pspec, return TRUE; } -void webView_tab_label_change(struct Client *browser) +void +webView_tab_label_change(struct Client *browser) { const gchar *title; GtkWidget *notebook = browser->window->notebook; @@ -188,9 +193,10 @@ void webView_tab_label_change(struct Client *browser) gtk_window_set_title(GTK_WINDOW(browser->window->main_window), title); } -static gboolean WebViewCb_notify__estimated_load_progress(WebKitWebView *webView, - GParamSpec *pspec, - gpointer user_data) +static gboolean +WebViewCb_notify__estimated_load_progress(WebKitWebView *webView, + GParamSpec *pspec, + gpointer user_data) { (void)webView; (void)pspec; @@ -207,10 +213,11 @@ static gboolean WebViewCb_notify__estimated_load_progress(WebKitWebView *webView return TRUE; } -static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView, - WebKitHitTestResult *hit, - guint modifiers, - gpointer user_data) +static gboolean +WebViewCb_mouse_target_changed(WebKitWebView *webView, + WebKitHitTestResult *hit, + guint modifiers, + gpointer user_data) { (void)webView; (void)modifiers; @@ -222,9 +229,10 @@ static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView, return TRUE; } -static WebKitWebView *WebViewCb_create(WebKitWebView *related_web_view, - WebKitNavigationAction *navigation_action, - gpointer user_data) +static WebKitWebView * +WebViewCb_create(WebKitWebView *related_web_view, + WebKitNavigationAction *navigation_action, + gpointer user_data) { (void)navigation_action; struct Window *window = (struct Window *)user_data; @@ -240,7 +248,8 @@ static WebKitWebView *WebViewCb_create(WebKitWebView *related_web_view, } } -static gboolean locationCb_activate(GtkEntry *location, gpointer user_data) +static gboolean +locationCb_activate(GtkEntry *location, gpointer user_data) { const char *target_url; struct Client *browser = (struct Client *)user_data; @@ -252,7 +261,8 @@ static gboolean locationCb_activate(GtkEntry *location, gpointer user_data) return TRUE; } -static gboolean javascriptCb_toggled(GtkButton *javascript, gpointer user_data) +static gboolean +javascriptCb_toggled(GtkButton *javascript, gpointer user_data) { struct Client *browser = (struct Client *)user_data; @@ -266,7 +276,8 @@ static gboolean javascriptCb_toggled(GtkButton *javascript, gpointer user_data) return TRUE; } -static gboolean SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_data) +static gboolean +SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_data) { (void)search; struct Client *browser = (struct Client *)user_data; @@ -277,7 +288,8 @@ static gboolean SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_ return TRUE; } -static gboolean SearchEntryCb_previous__match(GtkSearchEntry *search, gpointer user_data) +static gboolean +SearchEntryCb_previous__match(GtkSearchEntry *search, gpointer user_data) { (void)search; struct Client *browser = (struct Client *)user_data; @@ -288,7 +300,8 @@ static gboolean SearchEntryCb_previous__match(GtkSearchEntry *search, gpointer u return TRUE; } -static gboolean SearchEntryCb_search__changed(GtkSearchEntry *search, gpointer user_data) +static gboolean +SearchEntryCb_search__changed(GtkSearchEntry *search, gpointer user_data) { struct Client *browser = (struct Client *)user_data; WebKitFindController *findController = webkit_web_view_get_find_controller(browser->webView); @@ -299,7 +312,8 @@ static gboolean SearchEntryCb_search__changed(GtkSearchEntry *search, gpointer u return TRUE; } -static gboolean SearchEntryCb_stop__search(GtkSearchEntry *search, gpointer user_data) +static gboolean +SearchEntryCb_stop__search(GtkSearchEntry *search, gpointer user_data) { (void)search; struct Client *browser = (struct Client *)user_data; @@ -421,7 +435,8 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web return browser; } -int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) +int +badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) { gint current_page = gtk_notebook_get_current_page(notebook); gchar *title = "New tab"; @@ -441,7 +456,8 @@ int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) return 0; } -void new_tabCb_clicked(GtkButton *new_tab, gpointer user_data) +static void +new_tabCb_clicked(GtkButton *new_tab, gpointer user_data) { (void)new_tab; struct Window *window = (struct Window *)user_data; @@ -450,7 +466,8 @@ void new_tabCb_clicked(GtkButton *new_tab, gpointer user_data) badwolf_new_tab(GTK_NOTEBOOK(window->notebook), browser); } -void closeCb_clicked(GtkButton *close, gpointer user_data) +static void +closeCb_clicked(GtkButton *close, gpointer user_data) { (void)close; struct Client *browser = (struct Client *)user_data; @@ -469,7 +486,8 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gtk_window_set_title(GTK_WINDOW(window->main_window), gtk_widget_get_tooltip_text(label)); } -gint get_tab_position(GtkContainer *notebook, GtkWidget *child) +gint +get_tab_position(GtkContainer *notebook, GtkWidget *child) { GValue position = G_VALUE_INIT; g_value_init(&position, G_TYPE_INT); @@ -479,7 +497,8 @@ gint get_tab_position(GtkContainer *notebook, GtkWidget *child) return g_value_get_int(&position); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { struct Window *window = g_malloc(sizeof(struct Client)); gchar *target_url = NULL;