commit: 6c28568f2fe50e0cea5206dbba6dc307c3adb7da
parent: 272ed4245759fb4070984fb4d6fc7dafd2da7779
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 12 Mar 2019 09:00:39 +0100
Add `make format` and format the code
Diffstat:
3 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/.clang-format b/.clang-format
@@ -0,0 +1,20 @@
+AlignAfterOpenBracket: true
+AlignConsecutiveAssignments: true
+AlignOperands: true
+AlignTrailingComments: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: true
+AllowShortIfStatementsOnASingleLine: true
+BinPackArguments: false
+BinPackParameters: false
+BreakBeforeBraces: Allman
+SpaceBeforeParens: Never
+IncludeBlocks: Regroup
+ReflowComments: false
+SortIncludes: true
+UseTab: ForIndentation
+IndentWidth: 2
+TabWidth: 2
+ColumnLimit: 100
+
+NamespaceIndentation: All
diff --git a/Makefile b/Makefile
@@ -11,4 +11,7 @@ install: badwolf
clean:
rm badwolf
+format: *.c *.h
+ clang-format -style=file -assume-filename=~/.clang-format -i *.c *.h
+
.PHONY: clean install
diff --git a/badwolf.c b/badwolf.c
@@ -327,13 +327,28 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
gtk_widget_set_tooltip_text(browser->javascript, "Toggle javascript");
- gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->javascript), FALSE, FALSE, BADWOLF_TOOLBAR_PADDING);
- gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->location), TRUE, TRUE, BADWOLF_TOOLBAR_PADDING);
- gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->search), FALSE, FALSE, BADWOLF_TOOLBAR_PADDING);
-
- gtk_box_pack_start(GTK_BOX(browser->box), GTK_WIDGET(browser->toolbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
- gtk_box_pack_start(GTK_BOX(browser->box), GTK_WIDGET(browser->webView), TRUE, TRUE, BADWOLF_BOX_PADDING);
- gtk_box_pack_start(GTK_BOX(browser->box), GTK_WIDGET(browser->statusbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
+ gtk_box_pack_start(GTK_BOX(browser->toolbar),
+ GTK_WIDGET(browser->javascript),
+ FALSE,
+ FALSE,
+ BADWOLF_TOOLBAR_PADDING);
+ gtk_box_pack_start(GTK_BOX(browser->toolbar),
+ GTK_WIDGET(browser->location),
+ TRUE,
+ TRUE,
+ BADWOLF_TOOLBAR_PADDING);
+ gtk_box_pack_start(GTK_BOX(browser->toolbar),
+ GTK_WIDGET(browser->search),
+ FALSE,
+ FALSE,
+ BADWOLF_TOOLBAR_PADDING);
+
+ gtk_box_pack_start(
+ GTK_BOX(browser->box), GTK_WIDGET(browser->toolbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
+ gtk_box_pack_start(
+ GTK_BOX(browser->box), GTK_WIDGET(browser->webView), TRUE, TRUE, BADWOLF_BOX_PADDING);
+ gtk_box_pack_start(
+ GTK_BOX(browser->box), GTK_WIDGET(browser->statusbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
gtk_widget_set_halign(browser->statusbar, GTK_ALIGN_START);
gtk_label_set_single_line_mode(GTK_LABEL(browser->statusbar), TRUE);
@@ -433,8 +448,8 @@ void closeCb_clicked(GtkButton *close, gpointer user_data)
(void)close;
struct Client *browser = (struct Client *)user_data;
GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook);
- GValue position = G_VALUE_INIT;
- g_value_init (&position, G_TYPE_INT);
+ GValue position = G_VALUE_INIT;
+ g_value_init(&position, G_TYPE_INT);
gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", &position);