logo

badwolf

Unnamed repository; edit this file 'description' to name the repository.
commit: 1e6380d4fca4e8aa6fdcb6f507f0b9f7866e2eea
parent: 61b316b14a139c3905f3ccf78e8caf2e5551e8d8
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  7 Jan 2019 17:57:01 +0100

badwolf.c: Formatting

Diffstat:

Mbadwolf.c46+++++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -5,7 +5,8 @@ #include <gtk/gtk.h> #include <webkit2/webkit2.h> -struct Client { +struct Client +{ GtkWidget *main_window; GtkWidget *box; GtkWidget *location; @@ -18,22 +19,22 @@ static gboolean WebViewCb_close(WebKitWebView *_webView, GtkWidget *window) return TRUE; } -static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason, gpointer user_data) +static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, + WebKitWebProcessTerminationReason reason, + gpointer user_data) { char *str_reason; - switch(reason) { - case WEBKIT_WEB_PROCESS_CRASHED: - str_reason = "the web process crashed."; - break; - ;; - case WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT: - str_reason = "the web process exceeded the memory limit."; - break; - ;; - default: - str_reason = "the web process terminated for an unknown reason."; - ;; + switch(reason) + { + case WEBKIT_WEB_PROCESS_CRASHED: + str_reason = "the web process crashed."; + break; + case WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT: + str_reason = "the web process exceeded the memory limit."; + break; + default: + str_reason = "the web process terminated for an unknown reason."; } fprintf(stderr, "BadWolf [signal: web-process-terminated]: %s", str_reason); @@ -52,17 +53,17 @@ static gboolean WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, return TRUE; } -static gboolean WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data) { +static gboolean +WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data) +{ const gchar *title; struct Client *browser = (struct Client *)user_data; title = webkit_web_view_get_title(browser->webView); - if (title == NULL) - title = webkit_web_view_get_uri(browser->webView); + if(title == NULL) title = webkit_web_view_get_uri(browser->webView); - if (title == NULL) - title = "BadWolf"; + if(title == NULL) title = "BadWolf"; gtk_window_set_title(GTK_WINDOW(browser->main_window), title); @@ -72,7 +73,7 @@ static gboolean WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspe int main(int argc, char *argv[]) { struct Client *browser = calloc(1, sizeof(struct Client)); - char *target_url = "about:blank"; + char *target_url = "about:blank"; if(argv[1]) target_url = argv[1]; @@ -91,7 +92,10 @@ int main(int argc, char *argv[]) g_signal_connect(browser->main_window, "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(browser->webView, "close", G_CALLBACK(WebViewCb_close), browser->main_window); - g_signal_connect(browser->webView, "web-process-terminated", G_CALLBACK(WebViewCb_web_process_terminated), NULL); + g_signal_connect(browser->webView, + "web-process-terminated", + G_CALLBACK(WebViewCb_web_process_terminated), + NULL); g_signal_connect(browser->webView, "notify::uri", G_CALLBACK(WebViewCb_notify__uri), browser); g_signal_connect(browser->webView, "notify::title", G_CALLBACK(WebViewCb_notify__title), browser);