diff --git a/makefile b/makefile index fbaa26d..6de5793 100644 --- a/makefile +++ b/makefile @@ -103,6 +103,8 @@ clean: format: $(SRC) $(PLUGINS) $(FORMATTER_C) $(SRC) $(PLUGINS) $(rosenrot.h) + $(FORMATTER_C) $(SRC_4) $(PLUGINS) $(rosenrot.h) + $(FORMATTER_C) $(SRC_4_greenfield) $(PLUGINS) $(rosenrot.h) $(FORMATTER_JS) plugins/readability/readability.js $(FORMATTER_JS) plugins/style/style.js diff --git a/plugins/style/style.js b/plugins/style/style.js index 593b033..cceee1c 100644 --- a/plugins/style/style.js +++ b/plugins/style/style.js @@ -184,7 +184,7 @@ switch (document.domain) { `; break; default: - console.log(`Domain: ${document.domain}`) + console.log(`Domain: ${document.domain}`); console.log("No custom style"); } diff --git a/rosenrot4.c b/rosenrot4.c index 35047c4..46d5bcd 100644 --- a/rosenrot4.c +++ b/rosenrot4.c @@ -2,14 +2,16 @@ #include #include -#include #include "config.h" #include "plugins/plugins.h" +#include /* Global declarations */ static GtkNotebook* notebook; static GtkWidget* window; -typedef enum { _SEARCH, _FIND, _HIDDEN } Bar_entry_mode; +typedef enum { _SEARCH, + _FIND, + _HIDDEN } Bar_entry_mode; static struct { GtkHeaderBar* widget; GtkEntry* line; @@ -363,7 +365,7 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook) guint event_keyval = gdk_key_event_get_keyval(event); GdkModifierType event_state = gdk_event_get_modifier_state(event); - /* https://docs.gtk.org/gdk4/keys.html, https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkevents.h */ + /* https://docs.gtk.org/gdk4/keys.html, https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkevents.h */ if (1) { printf("Keypress state: %d\n", event_state); @@ -385,8 +387,8 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook) return 0; } -static int rose_keypress_event(GtkEventControllerKey *event_controller, int keyval, int keycode, - GdkModifierType state, GtkNotebook* notebook) +static int rose_keypress_event(GtkEventControllerKey* event_controller, int keyval, int keycode, + GdkModifierType state, GtkNotebook* notebook) { printf("New keypress!\n"); @@ -403,7 +405,7 @@ static int rose_keypress_event(GtkEventControllerKey *event_controller, int keyv } */ - return 0; + return 0; } int main(int argc, char** argv) @@ -426,16 +428,16 @@ int main(int argc, char** argv) gtk_window_set_default_size(window, WIDTH, HEIGHT); // GtkEventController *event_controller = gtk_event_controller_key_new(); - // gtk_widget_add_controller(GTK_WIDGET(window), event_controller); - // g_signal_connect(event_controller, "key-pressed", G_CALLBACK(rose_keypress_event), notebook); + // gtk_widget_add_controller(GTK_WIDGET(window), event_controller); + // g_signal_connect(event_controller, "key-pressed", G_CALLBACK(rose_keypress_event), notebook); - // gtk_widget_add_controller(GTK_WIDGET(notebook), event_controller); + // gtk_widget_add_controller(GTK_WIDGET(notebook), event_controller); /* - GtkEventController *event_controller = gtk_event_controller_key_new(); - // g_signal_connect(event_controller, "key-pressed", G_CALLBACK(handle_signal_keypress), NULL); - g_signal_connect(event_controller, "key-pressed", G_CALLBACK(handle_signal_keypress), notebook); - gtk_widget_add_controller(GTK_WIDGET(window), event_controller); + GtkEventController *event_controller = gtk_event_controller_key_new(); + // g_signal_connect(event_controller, "key-pressed", G_CALLBACK(handle_signal_keypress), NULL); + g_signal_connect(event_controller, "key-pressed", G_CALLBACK(handle_signal_keypress), notebook); + gtk_widget_add_controller(GTK_WIDGET(window), event_controller); g_signal_connect(window, "destroy", G_CALLBACK(exit), notebook); */ @@ -471,6 +473,6 @@ int main(int argc, char** argv) } } - while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0) - g_main_context_iteration (NULL, TRUE); + while (g_list_model_get_n_items(gtk_window_get_toplevels()) > 0) + g_main_context_iteration(NULL, TRUE); } diff --git a/rosenrot4_greenfield.c b/rosenrot4_greenfield.c index adaddbb..b2a3807 100644 --- a/rosenrot4_greenfield.c +++ b/rosenrot4_greenfield.c @@ -2,13 +2,15 @@ #include #include -#include #include "config.h" #include "plugins/plugins.h" +#include static GtkNotebook* notebook; -static GtkWidget *window; -typedef enum { _SEARCH, _FIND, _HIDDEN } Bar_entry_mode; +static GtkWidget* window; +typedef enum { _SEARCH, + _FIND, + _HIDDEN } Bar_entry_mode; static struct { GtkHeaderBar* widget; GtkEntry* line; @@ -22,7 +24,7 @@ static int custom_style_enabled = 1; void toggle_bar(GtkNotebook* notebook, Bar_entry_mode mode); void notebook_create_new_tab(GtkNotebook* notebook, const char* uri); -/* Load content */ +/* Load content */ void load_uri(WebKitWebView* view, const char* uri) { if (strlen(uri) == 0) { @@ -33,14 +35,13 @@ void load_uri(WebKitWebView* view, const char* uri) } } - /* Create new tabs */ WebKitWebView* create_new_webview() { char* style; WebKitSettings* settings; WebKitCookieManager* cookiemanager; - WebKitNetworkSession* network_session; + WebKitNetworkSession* network_session; WebKitUserContentManager* contentmanager; settings = webkit_settings_new_with_settings(WEBKIT_DEFAULT_SETTINGS, NULL); @@ -113,41 +114,37 @@ void notebook_create_new_tab(GtkNotebook* notebook, const char* uri) } } - -int -main (int argc, char **argv) +int main(int argc, char** argv) { - // Initialize i18n support with bindtextdomain(), etc. + // Initialize i18n support with bindtextdomain(), etc. - // ... + // ... - // Initialize the widget set - gtk_init (); + // Initialize the widget set + gtk_init(); - // Create the main window - window = gtk_window_new (); - gtk_window_set_default_size(GTK_WINDOW(window), WIDTH, HEIGHT_4); + // Create the main window + window = gtk_window_new(); + gtk_window_set_default_size(GTK_WINDOW(window), WIDTH, HEIGHT_4); - // Set up our GUI elements + // Set up our GUI elements - notebook = GTK_NOTEBOOK(gtk_notebook_new()); - gtk_notebook_set_show_tabs(notebook, true); - gtk_notebook_set_show_border(notebook, false); - // ... + notebook = GTK_NOTEBOOK(gtk_notebook_new()); + gtk_notebook_set_show_tabs(notebook, true); + gtk_notebook_set_show_border(notebook, false); + // ... - // Show the application window - gtk_window_present (GTK_WINDOW (window)); - gtk_window_set_child(GTK_WINDOW(window), GTK_WIDGET(notebook)); + // Show the application window + gtk_window_present(GTK_WINDOW(window)); + gtk_window_set_child(GTK_WINDOW(window), GTK_WIDGET(notebook)); + char* first_uri = argc > 1 ? argv[1] : HOME; + notebook_create_new_tab(notebook, first_uri); - char* first_uri = argc > 1 ? argv[1] : HOME; - notebook_create_new_tab(notebook, first_uri); + // Enter the main event loop, and wait for user interaction + while (!0) + g_main_context_iteration(NULL, TRUE); - - // Enter the main event loop, and wait for user interaction - while (!0) - g_main_context_iteration (NULL, TRUE); - - // The user lost interest - return 0; + // The user lost interest + return 0; }