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.
This commit is contained in:
Daniel Juyung Seo 2015-02-04 08:24:18 +09:00
parent 7169bbd001
commit f39ec0aa7d
3 changed files with 14 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);