GTK4: formatting pass

This commit is contained in:
NunoSempere 2024-07-20 21:48:06 -04:00
parent 4f3a90daaf
commit b2793329c8
4 changed files with 50 additions and 49 deletions

View File

@ -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

View File

@ -184,7 +184,7 @@ switch (document.domain) {
`;
break;
default:
console.log(`Domain: ${document.domain}`)
console.log(`Domain: ${document.domain}`);
console.log("No custom style");
}

View File

@ -2,14 +2,16 @@
#include <stdlib.h>
#include <string.h>
#include <webkit/webkit.h>
#include "config.h"
#include "plugins/plugins.h"
#include <webkit/webkit.h>
/* 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;
@ -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);
}

View File

@ -2,13 +2,15 @@
#include <stdlib.h>
#include <string.h>
#include <webkit/webkit.h>
#include "config.h"
#include "plugins/plugins.h"
#include <webkit/webkit.h>
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;
@ -33,7 +35,6 @@ void load_uri(WebKitWebView* view, const char* uri)
}
}
/* Create new tabs */
WebKitWebView* create_new_webview()
{
@ -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;
}