diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-01-08 18:03:31 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-01-08 18:03:31 +0100 |
commit | 35a9b04f87d1b6d46b4a2eb85db153173a45967d (patch) | |
tree | 5bfd5e01752bf61a4d681338a8c8b75f30e530e9 /source/theme.c | |
parent | 5d1fa66c301ce6ae3707260576083222a40f31ac (diff) |
Print position as textual in dump-theme.
Diffstat (limited to 'source/theme.c')
-rw-r--r-- | source/theme.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/source/theme.c b/source/theme.c index 8aa3fb5b..ed8b7bd1 100644 --- a/source/theme.c +++ b/source/theme.c @@ -89,14 +89,27 @@ static void rofi_theme_print_distance ( Distance d ) printf("dash "); } } -static void rofi_theme_print_property_index ( int depth, Property *p ) -{ - printf("%*s%s: ", depth, "", p->name ); +/** Textual representation of Window Location */ +const char const * WindowLocationStr[9] = { + "center", + "northwest", + "north", + "northeast", + "east", + "southeast", + "south", + "southwest", + "west" +}; + +static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p ) +{ + int pl = strlen ( p->name ); + printf("%*s%s:%*s ", depth, "", p->name, (int)pnl-pl,"" ); switch ( p->type ) { case P_POSITION: - // TODO Name - printf("%d;", p->value.i); + printf("%s;", WindowLocationStr[p->value.i]); break; case P_STRING: printf("\"%s\";", p->value.s); @@ -178,11 +191,18 @@ static void rofi_theme_print_index ( ThemeWidget *widget ) index = 4; printf("* {\n"); } + size_t property_name_length = 0; + g_hash_table_iter_init (&iter, widget->properties); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + Property *p = (Property*)value; + property_name_length = MAX ( strlen (p->name), property_name_length ); + } g_hash_table_iter_init (&iter, widget->properties); while (g_hash_table_iter_next (&iter, &key, &value)) { Property *p = (Property*)value; - rofi_theme_print_property_index ( index, p ); + rofi_theme_print_property_index ( property_name_length, index, p ); } printf("}\n"); g_list_free ( list ); |