diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-10-31 18:00:24 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-10-31 18:00:24 +0100 |
commit | cc3d889fea0ebc10894caa622fbac6d41c891bba (patch) | |
tree | 24954b53bc522cdfed0583de5256d5e00de92a8c /source/rofi.c | |
parent | 0bb64cf1adf3377f7c9847723dbb3ea19e06af13 (diff) |
First testing to use GResource to load default theme.
Diffstat (limited to 'source/rofi.c')
-rw-r--r-- | source/rofi.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/source/rofi.c b/source/rofi.c index 8199e302..85ad95d2 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -52,6 +52,8 @@ #endif #endif +#include "resources/resources.h" + #include "rofi.h" #include "display.h" @@ -887,18 +889,27 @@ int main ( int argc, char *argv[] ) } } if ( rofi_theme_is_empty ( ) ) { - if ( rofi_theme_parse_string ( default_theme ) ) { - g_warning ( "Failed to parse default theme. Giving up.." ); - if ( list_of_error_msgs ) { - for ( GList *iter = g_list_first ( list_of_error_msgs ); - iter != NULL; iter = g_list_next ( iter ) ) { - g_warning ( "Error: %s%s%s", + GBytes *theme_data = g_resource_lookup_data ( + resources_get_resource(), + "/org/qtools/rofi/default_theme.rasi", + G_RESOURCE_LOOKUP_FLAGS_NONE, + NULL ); + if ( theme_data ) { + const char *theme = g_bytes_get_data ( theme_data, NULL ); + if ( rofi_theme_parse_string ( (const char *)theme ) ) { + g_warning ( "Failed to parse default theme. Giving up.." ); + if ( list_of_error_msgs ) { + for ( GList *iter = g_list_first ( list_of_error_msgs ); + iter != NULL; iter = g_list_next ( iter ) ) { + g_warning ( "Error: %s%s%s", color_bold, ( (GString *) iter->data )->str, color_reset ); + } } + rofi_theme = NULL; + cleanup (); + return EXIT_FAILURE; } - rofi_theme = NULL; - cleanup (); - return EXIT_FAILURE; + g_bytes_unref ( theme_data ); } rofi_theme_convert_old (); } |