mirror of
https://github.com/davatorium/rofi.git
synced 2025-01-27 15:25:24 -05:00
[Theme] Fix @media printing in -dump-theme
.
This commit is contained in:
parent
31fc5c9d35
commit
0a3734dce4
1 changed files with 52 additions and 41 deletions
|
@ -464,23 +464,33 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
|
||||||
putchar ( '\n' );
|
putchar ( '\n' );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rofi_theme_print_index ( ThemeWidget *widget )
|
static void rofi_theme_print_index ( ThemeWidget *widget, int index )
|
||||||
{
|
{
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gpointer key, value;
|
gpointer key, value;
|
||||||
|
|
||||||
|
if ( widget->media ) {
|
||||||
|
printf("%s {\n", widget->name );
|
||||||
|
for ( unsigned int i = 0; i < widget->num_widgets; i++ ) {
|
||||||
|
rofi_theme_print_index ( widget->widgets[i], index+4 );
|
||||||
|
}
|
||||||
|
printf("}\n");
|
||||||
|
} else {
|
||||||
if ( widget->properties ) {
|
if ( widget->properties ) {
|
||||||
int index = 0;
|
|
||||||
GList *list = NULL;
|
GList *list = NULL;
|
||||||
ThemeWidget *w = widget;
|
ThemeWidget *w = widget;
|
||||||
while ( w ) {
|
while ( w ) {
|
||||||
if ( g_strcmp0 ( w->name, "Root" ) == 0 ) {
|
if ( g_strcmp0 ( w->name, "Root" ) == 0 ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ( w->media ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
list = g_list_prepend ( list, w->name );
|
list = g_list_prepend ( list, w->name );
|
||||||
w = w->parent;
|
w = w->parent;
|
||||||
}
|
}
|
||||||
if ( g_list_length ( list ) > 0 ) {
|
if ( g_list_length ( list ) > 0 ) {
|
||||||
index = 4;
|
printf("%*s", index, "");
|
||||||
for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) {
|
for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||||
char *name = (char *) iter->data;
|
char *name = (char *) iter->data;
|
||||||
fputs ( name, stdout );
|
fputs ( name, stdout );
|
||||||
|
@ -494,8 +504,7 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
|
||||||
printf ( " {\n" );
|
printf ( " {\n" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
index = 4;
|
printf ( "%*s* {\n", index, "" );
|
||||||
printf ( "* {\n" );
|
|
||||||
}
|
}
|
||||||
size_t property_name_length = 0;
|
size_t property_name_length = 0;
|
||||||
g_hash_table_iter_init ( &iter, widget->properties );
|
g_hash_table_iter_init ( &iter, widget->properties );
|
||||||
|
@ -506,20 +515,22 @@ static void rofi_theme_print_index ( ThemeWidget *widget )
|
||||||
g_hash_table_iter_init ( &iter, widget->properties );
|
g_hash_table_iter_init ( &iter, widget->properties );
|
||||||
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
|
while ( g_hash_table_iter_next ( &iter, &key, &value ) ) {
|
||||||
Property *p = (Property *) value;
|
Property *p = (Property *) value;
|
||||||
rofi_theme_print_property_index ( property_name_length, index, p );
|
rofi_theme_print_property_index ( property_name_length, index+4, p );
|
||||||
}
|
}
|
||||||
printf ( "}\n" );
|
printf ( "%*s}\n", index, "" );
|
||||||
g_list_free ( list );
|
g_list_free ( list );
|
||||||
}
|
}
|
||||||
for ( unsigned int i = 0; i < widget->num_widgets; i++ ) {
|
for ( unsigned int i = 0; i < widget->num_widgets; i++ ) {
|
||||||
rofi_theme_print_index ( widget->widgets[i] );
|
rofi_theme_print_index ( widget->widgets[i], index );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void rofi_theme_print ( ThemeWidget *widget )
|
void rofi_theme_print ( ThemeWidget *widget )
|
||||||
{
|
{
|
||||||
if ( widget != NULL ) {
|
if ( widget != NULL ) {
|
||||||
printf ( "/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION );
|
printf ( "/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION );
|
||||||
rofi_theme_print_index ( widget );
|
rofi_theme_print_index ( widget, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue