summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2015-02-04 08:24:18 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2015-02-04 08:24:21 +0900
commitf39ec0aa7dea3f9c5c8e7e0d4d75b13afb1044e8 (patch)
tree74d4be142466997676615e34ccb92ca39dddecc3
parent7169bbd0013b8c31bc098f8b20beeea90f0821c7 (diff)
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.
-rw-r--r--src/bin/main.c12
-rw-r--r--src/bin/theme.c5
-rw-r--r--src/bin/theme.h2
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 = {
25 "automatically."),*/ // TODO: enable in v0.2 25 "automatically."),*/ // TODO: enable in v0.2
26 ECORE_GETOPT_STORE_STR('w', "widget", 26 ECORE_GETOPT_STORE_STR('w', "widget",
27 "Set the widget to launch from command line."), 27 "Set the widget to launch from command line."),
28 ECORE_GETOPT_STORE_TRUE('l', "list",
29 "Lists up all the styles in the theme file and exit."),
28 ECORE_GETOPT_VERSION ('V', "version"), 30 ECORE_GETOPT_VERSION ('V', "version"),
29 ECORE_GETOPT_COPYRIGHT('C', "copyright"), 31 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
30 ECORE_GETOPT_LICENSE ('L', "license"), 32 ECORE_GETOPT_LICENSE ('L', "license"),
@@ -47,6 +49,7 @@ main(int argc, char **argv)
47 Eina_Bool fullscreen = EINA_FALSE; 49 Eina_Bool fullscreen = EINA_FALSE;
48 Eina_Bool quit_option = EINA_FALSE; 50 Eina_Bool quit_option = EINA_FALSE;
49 Eina_Bool tizen = EINA_FALSE; 51 Eina_Bool tizen = EINA_FALSE;
52 Eina_Bool list = EINA_FALSE;
50 Evas_Coord width = WIN_WIDTH, height = WIN_HEIGHT; 53 Evas_Coord width = WIN_WIDTH, height = WIN_HEIGHT;
51 char *widget = NULL; 54 char *widget = NULL;
52 55
@@ -57,6 +60,7 @@ main(int argc, char **argv)
57 ECORE_GETOPT_VALUE_BOOL(fullscreen), 60 ECORE_GETOPT_VALUE_BOOL(fullscreen),
58 //ECORE_GETOPT_VALUE_BOOL(tizen), // TODO: enable in v0.2 61 //ECORE_GETOPT_VALUE_BOOL(tizen), // TODO: enable in v0.2
59 ECORE_GETOPT_VALUE_STR(widget), 62 ECORE_GETOPT_VALUE_STR(widget),
63 ECORE_GETOPT_VALUE_BOOL(list),
60 ECORE_GETOPT_VALUE_BOOL(quit_option), 64 ECORE_GETOPT_VALUE_BOOL(quit_option),
61 ECORE_GETOPT_VALUE_BOOL(quit_option), 65 ECORE_GETOPT_VALUE_BOOL(quit_option),
62 ECORE_GETOPT_VALUE_BOOL(quit_option), 66 ECORE_GETOPT_VALUE_BOOL(quit_option),
@@ -109,7 +113,8 @@ main(int argc, char **argv)
109 113
110 // TODO: run this in a background 114 // TODO: run this in a background
111 theme_init(); 115 theme_init();
112 theme_load(edje_file); 116 theme_load(edje_file, list);
117 if (list) goto list;
113 theme_set(edje_file); 118 theme_set(edje_file);
114 119
115 ed->tizen = tizen; 120 ed->tizen = tizen;
@@ -140,9 +145,10 @@ end:
140 if (option_init_ret) option_shutdown(); 145 if (option_init_ret) option_shutdown();
141 if (gui_init_ret) gui_shutdown(); 146 if (gui_init_ret) gui_shutdown();
142 147
143 ETV_SAFE_FREE(ed, free);
144
145 theme_unset(edje_file); 148 theme_unset(edje_file);
149
150list:
151 ETV_SAFE_FREE(ed, free);
146 theme_shutdown(); 152 theme_shutdown();
147 eina_stringshare_del(edje_file); 153 eina_stringshare_del(edje_file);
148 154
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)
73} 73}
74 74
75void 75void
76theme_load(const char *edje_file) 76theme_load(const char *edje_file, Eina_Bool list)
77{ 77{
78 Eina_List *groups = NULL, *l = NULL, *ll = NULL; 78 Eina_List *groups = NULL, *l = NULL, *ll = NULL;
79 char *group = NULL, *token = NULL, *widget = NULL; 79 char *group = NULL, *token = NULL, *widget = NULL;
@@ -134,6 +134,9 @@ theme_load(const char *edje_file)
134 wd->styles = eina_list_prepend(wd->styles, wds); 134 wd->styles = eina_list_prepend(wd->styles, wds);
135 else 135 else
136 wd->styles = eina_list_append(wd->styles, wds); 136 wd->styles = eina_list_append(wd->styles, wds);
137
138 if (list)
139 printf("Widget: %-20s\t\tStyle: %s\n", widget, style);
137 } 140 }
138 141
139 edje_file_collection_list_free(groups); 142 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);
10void theme_shutdown(void); 10void theme_shutdown(void);
11void theme_set(const char *edje_file); 11void theme_set(const char *edje_file);
12void theme_unset(const char *edje_file); 12void theme_unset(const char *edje_file);
13void theme_load(const char *edje_file); 13void theme_load(const char *edje_file, Eina_Bool list);
14void theme_widgets_print(void); 14void theme_widgets_print(void);
15Eina_List * theme_widget_styles_get(Widget_Type widget); 15Eina_List * theme_widget_styles_get(Widget_Type widget);
16void theme_widget_styles_print(Widget_Type widget); 16void theme_widget_styles_print(Widget_Type widget);