seoz pushed a commit to branch master. http://git.enlightenment.org/tools/elm-theme-viewer.git/commit/?id=f39ec0aa7dea3f9c5c8e7e0d4d75b13afb1044e8
commit f39ec0aa7dea3f9c5c8e7e0d4d75b13afb1044e8 Author: Daniel Juyung Seo <seojuyu...@gmail.com> Date: Wed Feb 4 08:24:18 2015 +0900 ETV: Add theme style listing feature. Use -l option to list up all the widget styles. After listing up the program will be shutdown automatically. --- src/bin/main.c | 12 +++++++++--- src/bin/theme.c | 5 ++++- src/bin/theme.h | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/bin/main.c b/src/bin/main.c index 68839a3..f0d4633 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -25,6 +25,8 @@ static const Ecore_Getopt options = { "automatically."),*/ // TODO: enable in v0.2 ECORE_GETOPT_STORE_STR('w', "widget", "Set the widget to launch from command line."), + ECORE_GETOPT_STORE_TRUE('l', "list", + "Lists up all the styles in the theme file and exit."), ECORE_GETOPT_VERSION ('V', "version"), ECORE_GETOPT_COPYRIGHT('C', "copyright"), ECORE_GETOPT_LICENSE ('L', "license"), @@ -47,6 +49,7 @@ main(int argc, char **argv) Eina_Bool fullscreen = EINA_FALSE; Eina_Bool quit_option = EINA_FALSE; Eina_Bool tizen = EINA_FALSE; + Eina_Bool list = EINA_FALSE; Evas_Coord width = WIN_WIDTH, height = WIN_HEIGHT; char *widget = NULL; @@ -57,6 +60,7 @@ main(int argc, char **argv) ECORE_GETOPT_VALUE_BOOL(fullscreen), //ECORE_GETOPT_VALUE_BOOL(tizen), // TODO: enable in v0.2 ECORE_GETOPT_VALUE_STR(widget), + ECORE_GETOPT_VALUE_BOOL(list), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), @@ -109,7 +113,8 @@ main(int argc, char **argv) // TODO: run this in a background theme_init(); - theme_load(edje_file); + theme_load(edje_file, list); + if (list) goto list; theme_set(edje_file); ed->tizen = tizen; @@ -140,9 +145,10 @@ end: if (option_init_ret) option_shutdown(); if (gui_init_ret) gui_shutdown(); - ETV_SAFE_FREE(ed, free); - theme_unset(edje_file); + +list: + ETV_SAFE_FREE(ed, free); theme_shutdown(); eina_stringshare_del(edje_file); diff --git a/src/bin/theme.c b/src/bin/theme.c index 97de9c4..eb0a105 100644 --- a/src/bin/theme.c +++ b/src/bin/theme.c @@ -73,7 +73,7 @@ _style_compare_cb(const void *data1, const void *data2) } void -theme_load(const char *edje_file) +theme_load(const char *edje_file, Eina_Bool list) { Eina_List *groups = NULL, *l = NULL, *ll = NULL; char *group = NULL, *token = NULL, *widget = NULL; @@ -134,6 +134,9 @@ theme_load(const char *edje_file) wd->styles = eina_list_prepend(wd->styles, wds); else wd->styles = eina_list_append(wd->styles, wds); + + if (list) + printf("Widget: %-20s\t\tStyle: %s\n", widget, style); } edje_file_collection_list_free(groups); diff --git a/src/bin/theme.h b/src/bin/theme.h index 42ed3fa..866ca38 100644 --- a/src/bin/theme.h +++ b/src/bin/theme.h @@ -10,7 +10,7 @@ void theme_init(void); void theme_shutdown(void); void theme_set(const char *edje_file); void theme_unset(const char *edje_file); -void theme_load(const char *edje_file); +void theme_load(const char *edje_file, Eina_Bool list); void theme_widgets_print(void); Eina_List * theme_widget_styles_get(Widget_Type widget); void theme_widget_styles_print(Widget_Type widget); --