diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 0c2bfbf..507a554 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -16,6 +16,7 @@ log.c log.h \ theme.c theme.h \ widget.c widget.h \ widget_option.c widget_option.h \ +widget_style.c widget_style.h \ main.c common.h \ gui_mobile.c gui_mobile.h \ util.c util.h diff --git a/src/bin/common.h b/src/bin/common.h index 2d05874..9a1a876 100644 --- a/src/bin/common.h +++ b/src/bin/common.h @@ -45,6 +45,7 @@ extern ETV_Data *ed; #include "log.h" #include "theme.h" +#include "widget_style.h" #include "widget_option.h" #include "gui.h" #include "gui_mobile.h" diff --git a/src/bin/gui.c b/src/bin/gui.c index 7e899d8..fa978b2 100644 --- a/src/bin/gui.c +++ b/src/bin/gui.c @@ -13,13 +13,6 @@ extern ETV_Data *ed; return; \ } -typedef struct _Style_Data Style_Data; -struct _Style_Data -{ - Widget_Type widget_type; - const char *style; -}; - static void _gui_widget_load(void); int @@ -561,7 +554,7 @@ _gui_widget_style_load(Evas_Object *parent, Widget_Type type) { Evas_Object *o = NULL; Eina_List *styles = NULL, *l = NULL; - char *style = NULL; + const char *style = NULL; Style_Data *sd = NULL; // widget styles list @@ -577,6 +570,7 @@ _gui_widget_style_load(Evas_Object *parent, Widget_Type type) sd = (Style_Data *)calloc(1, sizeof(Style_Data)); sd->widget_type = type; sd->style = style; + style = widget_style_filter(sd); elm_list_item_append(o, style, NULL, NULL, _style_list_sel_cb, sd); } diff --git a/src/bin/widget.c b/src/bin/widget.c index d9a9818..9ca2316 100644 --- a/src/bin/widget.c +++ b/src/bin/widget.c @@ -77,59 +77,6 @@ static const char *lbl[] = { "Edbus" }; -/* - * Get the first part from the orig_style - * - * h_item/default -> h_item (list) - * item_compress_odd/default -> item_compress_odd (list) - */ -static void -_style_split_1(const char *orig_style, char style[PATH_MAX]) -{ - char buf[PATH_MAX] = {0, }; - const char *tok_ptr; - - strncpy(buf, orig_style, sizeof(buf)); - tok_ptr = strtok(buf, "/"); - strcpy(style, tok_ptr); - //INF("%s", style); -} - -/* - * Get the second part from the orig_style - * - * base/default -> default (actionslider) - * base/hoversel_horizontal/entry -> hoversel_horizontal (button) - * item/default/default -> default (genlist item) - * item/full/default -> full (genlist item) - */ -static const char * -_style_split_2(const char *orig_style) -{ - char buf[PATH_MAX] = {0, }; - const char *style; - - strncpy(buf, orig_style, sizeof(buf)); - style = strtok(buf, "/"); - style = strtok(NULL, "/"); - //INF("%s", style); - - return style; -} - -/* Split the style into two parts - * FIXME: DOES NOT WORK! -static void -_split_style(const char *style EINA_UNUSED, const char **style1 EINA_UNUSED, const char **style2 EINA_UNUSED) -{ - char buf[PATH_MAX] = {0, }; - - strncpy(buf, style, sizeof(buf)); - *style1 = strtok(buf, "/"); - *style2 = strtok(NULL, "/"); -} - */ - /* Remove "/default" from the end of string. * * arrow_left/default -> arrow_left (icon) diff --git a/src/bin/widget_style.c b/src/bin/widget_style.c new file mode 100644 index 0000000..129f4a1 --- /dev/null +++ b/src/bin/widget_style.c @@ -0,0 +1,103 @@ +#include +#include "common.h" + +/* + * Get the first part from the orig_style + * + * h_item/default -> h_item (list) + * item_compress_odd/default -> item_compress_odd (list) + */ +void +_style_split_1(const char *orig_style, char style[PATH_MAX]) +{ + char buf[PATH_MAX] = {0, }; + const char *tok_ptr; + + strncpy(buf, orig_style, sizeof(buf)); + tok_ptr = strtok(buf, "/"); + strcpy(style, tok_ptr); + //INF("%s", style); +} + +/* + * Get the second part from the orig_style + * + * base/default -> default (actionslider) + * base/hoversel_horizontal/entry -> hoversel_horizontal (button) + * item/default/default -> default (genlist item) + * item/full/default -> full (genlist item) + */ +const char * +_style_split_2(const char *orig_style) +{ + char buf[PATH_MAX] = {0, }; + const char *style; + + strncpy(buf, orig_style, sizeof(buf)); + style = strtok(buf, "/"); + style = strtok(NULL, "/"); + //INF("%s", style); + + return style; +} + +/* Split the style into two parts + * FIXME: DOES NOT WORK! +static void +_split_style(const char *style EINA_UNUSED, const char **style1 EINA_UNUSED, const char **style2 EINA_UNUSED) +{ + char buf[PATH_MAX] = {0, }; + + strncpy(buf, style, sizeof(buf)); + *style1 = strtok(buf, "/"); + *style2 = strtok(NULL, "/"); +} + */ + + +const char * +widget_style_filter(const Style_Data *sd) +{ + const char *style = NULL; + + switch (sd->widget_type) + { + case ETV_ID_ACTIONSLIDER: + case ETV_ID_BG: + case ETV_ID_BORDER: + case ETV_ID_BUTTON: + case ETV_ID_CALENDAR: + case ETV_ID_CHECK: + case ETV_ID_CONFORMANT: + case ETV_ID_DATETIME: + case ETV_ID_DAYSELECTOR: + case ETV_ID_FILESELECTOR: + case ETV_ID_FILESELECTOR_ENTRY: + case ETV_ID_FLIPSELECTOR: + case ETV_ID_FRAME: + case ETV_ID_HOVER: + style = sd->style + strlen("base/"); + break; + + case ETV_ID_BUBBLE: + case ETV_ID_CLOCK: + case ETV_ID_COLORSELECTOR: + case ETV_ID_CTXPOPUP: + case ETV_ID_DISKSELECTOR: + case ETV_ID_ENTRY: + case ETV_ID_EWS: + case ETV_ID_FOCUS_HIGHLIGHT: + case ETV_ID_GENGRID: + case ETV_ID_GENLIST: + case ETV_ID_ICON: + case ETV_ID_INDEX: + default: + //style = _style_split_2(sd->style); + break; + } + + if (style) + return style; + else + return sd->style; +} diff --git a/src/bin/widget_style.h b/src/bin/widget_style.h new file mode 100644 index 0000000..5ab9a28 --- /dev/null +++ b/src/bin/widget_style.h @@ -0,0 +1,15 @@ +#ifndef __INCLUDE_WIDGET_STYLE__ +#define __INCLUDE_WIDGET_STYLE__ + +typedef struct _Style_Data Style_Data; +struct _Style_Data +{ + Widget_Type widget_type; + const char *style; +}; + +void _style_split_1(const char *orig_style, char style[PATH_MAX]); +const char * _style_split_2(const char *orig_style); +const char * widget_style_filter(const Style_Data *sd); + +#endif