mirror of
https://github.com/davatorium/rofi.git
synced 2025-03-03 16:05:20 -05:00
First testing to use GResource to load default theme.
This commit is contained in:
parent
0bb64cf1ad
commit
cc3d889fea
3 changed files with 44 additions and 11 deletions
20
Makefile.am
20
Makefile.am
|
@ -22,7 +22,17 @@ pkgconfig_DATA = pkgconfig/rofi.pc
|
||||||
BUILT_SOURCES=\
|
BUILT_SOURCES=\
|
||||||
lexer/theme-parser.h\
|
lexer/theme-parser.h\
|
||||||
lexer/theme-parser.c\
|
lexer/theme-parser.c\
|
||||||
lexer/theme-lexer.c
|
lexer/theme-lexer.c\
|
||||||
|
resources/resources.c\
|
||||||
|
resources/resources.h
|
||||||
|
|
||||||
|
$(top_builddir)/resources/resources.c: $(top_srcdir)/resources/resources.xml
|
||||||
|
mkdir -p $(top_builddir)/resources/
|
||||||
|
glib-compile-resources $< --generate-source --target=$@ --sourcedir=$(top_srcdir)
|
||||||
|
|
||||||
|
$(top_builddir)/resources/resources.h: $(top_srcdir)/resources/resources.xml
|
||||||
|
mkdir -p $(top_builddir)/resources/
|
||||||
|
glib-compile-resources $< --generate-header --target=$@ --sourcedir=$(top_srcdir)
|
||||||
|
|
||||||
$(top_builddir)/lexer/theme-lexer.c: $(top_srcdir)/lexer/theme-lexer.l
|
$(top_builddir)/lexer/theme-lexer.c: $(top_srcdir)/lexer/theme-lexer.l
|
||||||
|
|
||||||
|
@ -109,11 +119,14 @@ SOURCES=\
|
||||||
include/dialogs/script.h\
|
include/dialogs/script.h\
|
||||||
include/dialogs/window.h\
|
include/dialogs/window.h\
|
||||||
include/dialogs/dialogs.h\
|
include/dialogs/dialogs.h\
|
||||||
include/dialogs/help-keys.h
|
include/dialogs/help-keys.h\
|
||||||
|
resources/resources.c\
|
||||||
|
resources/resources.h
|
||||||
|
|
||||||
rofi_SOURCES=\
|
rofi_SOURCES=\
|
||||||
lexer/theme-parser.y\
|
lexer/theme-parser.y\
|
||||||
lexer/theme-lexer.l\
|
lexer/theme-lexer.l\
|
||||||
|
resources/resources.xml\
|
||||||
$(SOURCES)
|
$(SOURCES)
|
||||||
|
|
||||||
rofi_CFLAGS=\
|
rofi_CFLAGS=\
|
||||||
|
@ -217,6 +230,7 @@ EXTRA_DIST+=\
|
||||||
doc/rofi.doxy.in\
|
doc/rofi.doxy.in\
|
||||||
script/get_git_rev.sh\
|
script/get_git_rev.sh\
|
||||||
$(theme_DATA)\
|
$(theme_DATA)\
|
||||||
|
doc/default_theme.rasi\
|
||||||
Changelog
|
Changelog
|
||||||
##
|
##
|
||||||
# Indent
|
# Indent
|
||||||
|
@ -564,6 +578,8 @@ doxy: doc/rofi.doxy $(rofi_SOURCES)
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
-rm $(top_builddir)/gitconfig.h
|
-rm $(top_builddir)/gitconfig.h
|
||||||
|
-rm $(top_builddir)/resources/resources.h
|
||||||
|
-rm $(top_builddir)/resources/resources.c
|
||||||
|
|
||||||
$(top_builddir)/gitconfig.h: .FORCE
|
$(top_builddir)/gitconfig.h: .FORCE
|
||||||
$(top_srcdir)/script/get_git_rev.sh $(top_srcdir) $(top_builddir)/gitconfig.h
|
$(top_srcdir)/script/get_git_rev.sh $(top_srcdir) $(top_builddir)/gitconfig.h
|
||||||
|
|
6
resources/resources.xml
Normal file
6
resources/resources.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gresources>
|
||||||
|
<gresource prefix="/org/qtools/rofi">
|
||||||
|
<file alias="default_theme.rasi">doc/default_theme.rasi</file>
|
||||||
|
</gresource>
|
||||||
|
</gresources>
|
|
@ -52,6 +52,8 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "resources/resources.h"
|
||||||
|
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
|
@ -887,18 +889,27 @@ int main ( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( rofi_theme_is_empty ( ) ) {
|
if ( rofi_theme_is_empty ( ) ) {
|
||||||
if ( rofi_theme_parse_string ( default_theme ) ) {
|
GBytes *theme_data = g_resource_lookup_data (
|
||||||
g_warning ( "Failed to parse default theme. Giving up.." );
|
resources_get_resource(),
|
||||||
if ( list_of_error_msgs ) {
|
"/org/qtools/rofi/default_theme.rasi",
|
||||||
for ( GList *iter = g_list_first ( list_of_error_msgs );
|
G_RESOURCE_LOOKUP_FLAGS_NONE,
|
||||||
iter != NULL; iter = g_list_next ( iter ) ) {
|
NULL );
|
||||||
g_warning ( "Error: %s%s%s",
|
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 );
|
color_bold, ( (GString *) iter->data )->str, color_reset );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
rofi_theme = NULL;
|
||||||
|
cleanup ();
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
rofi_theme = NULL;
|
g_bytes_unref ( theme_data );
|
||||||
cleanup ();
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
}
|
||||||
rofi_theme_convert_old ();
|
rofi_theme_convert_old ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue