From 8424397130be08c9387998759913a45bca8dc257 Mon Sep 17 00:00:00 2001 From: Jeremy Attali Date: Mon, 16 Dec 2019 01:21:27 -0500 Subject: [PATCH] res: have font awesome working --- include/swappy.h | 2 ++ res/style/popover.css | 6 +++--- src/application.c | 11 +++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/swappy.h b/include/swappy.h index 4c79497..8f18fb7 100644 --- a/include/swappy.h +++ b/include/swappy.h @@ -45,7 +45,9 @@ struct swappy_box { }; struct swappy_state { + GResource *resource; GtkApplication *app; + GtkWindow *window; GtkWidget *area; GtkPopover *popover; diff --git a/res/style/popover.css b/res/style/popover.css index 50e959f..e5e379c 100644 --- a/res/style/popover.css +++ b/res/style/popover.css @@ -1,3 +1,3 @@ -#popover .drawing { - font-family: 'Waybar'; -} \ No newline at end of file +.drawing .text-button { + font-family: "FontAwesome 5 Free Solid"; +} diff --git a/src/application.c b/src/application.c index 17df9b3..62908e0 100644 --- a/src/application.c +++ b/src/application.c @@ -25,6 +25,7 @@ void application_finish(struct swappy_state *state) { g_free(state->storage_path); g_free(state->geometry_str); g_free(state->geometry); + g_resources_unregister(state->resource); g_object_unref(state->app); } @@ -337,6 +338,7 @@ static gint command_line_handler(GtkApplication *app, } bool application_init(struct swappy_state *state) { + GError *error = NULL; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmissing-field-initializers" const GOptionEntry cli_options[] = { @@ -361,6 +363,15 @@ bool application_init(struct swappy_state *state) { g_application_add_main_option_entries(G_APPLICATION(state->app), cli_options); + state->resource = g_resource_load("build/meson-out/swappy.gresource", &error); + + if (error != NULL) { + g_error("unable to load swappy resource file: %s", error->message); + g_error_free(error); + } + + g_resources_register(state->resource); + g_signal_connect(state->app, "command-line", G_CALLBACK(command_line_handler), state);