1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Add @theme import command, that resets the current theme.

This commit is contained in:
Dave Davenport 2017-09-18 17:48:13 +02:00
parent ae8e7d9964
commit 99f2a1a9bf
4 changed files with 20 additions and 2 deletions

View file

@ -288,6 +288,11 @@ GList *rofi_theme_get_list ( const widget *widget, const char * property, const
*/ */
gboolean rofi_theme_is_empty ( void ); gboolean rofi_theme_is_empty ( void );
/**
* Reset the current theme.
*/
void rofi_theme_reset ( void );
#ifdef THEME_CONVERTER #ifdef THEME_CONVERTER
/** /**
* Convert old theme colors into default one. * Convert old theme colors into default one.

View file

@ -229,6 +229,7 @@ C_COMMENT_OPEN "/*"
INCLUDE "@import" INCLUDE "@import"
THEME "@theme"
CONFIGURATION (?i:configuration) CONFIGURATION (?i:configuration)
@ -301,6 +302,11 @@ if ( queue == NULL ){
<INITIAL>{INCLUDE} { <INITIAL>{INCLUDE} {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(INCLUDE); BEGIN(INCLUDE);
}
<INITIAL>{THEME} {
rofi_theme_reset();
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(INCLUDE);
} }
/** Skip all whitespace */ /** Skip all whitespace */
<INCLUDE>{WHITESPACE} {} <INCLUDE>{WHITESPACE} {}

View file

@ -256,8 +256,8 @@ t_entry_list:
%empty { %empty {
// There is always a base widget. // There is always a base widget.
if (rofi_theme == NULL ){ if (rofi_theme == NULL ){
$$ = rofi_theme = g_slice_new0 ( ThemeWidget ); rofi_theme_reset();
rofi_theme->name = g_strdup ( "Root" ); $$ = rofi_theme;
} }
} }
| t_entry_list | t_entry_list

View file

@ -111,6 +111,13 @@ void rofi_theme_property_free ( Property *p )
g_slice_free ( Property, p ); g_slice_free ( Property, p );
} }
void rofi_theme_reset ( void )
{
rofi_theme_free ( rofi_theme );
rofi_theme = g_slice_new0 ( ThemeWidget );
rofi_theme->name = g_strdup("Root");
}
void rofi_theme_free ( ThemeWidget *widget ) void rofi_theme_free ( ThemeWidget *widget )
{ {
if ( widget == NULL ) { if ( widget == NULL ) {