forked from enlightenment/edi
theme: add a title to theme edcs and use that.
This makes it a little neater.
This commit is contained in:
parent
86423d23c8
commit
11f9ba8609
|
@ -1,5 +1,8 @@
|
|||
collections {
|
||||
data {
|
||||
item: "title" "Black theme";
|
||||
}
|
||||
|
||||
collections {
|
||||
/* simple layout to pack our scrolling content into an elm_layout */
|
||||
group { name: "elm/code/layout/default";
|
||||
data {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
collections {
|
||||
data {
|
||||
item: "title" "Solarized";
|
||||
}
|
||||
|
||||
collections {
|
||||
/* simple layout to pack our scrolling content into an elm_layout */
|
||||
group { name: "elm/code/layout/default";
|
||||
data {
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
data {
|
||||
item: "title" "Solarized Dark";
|
||||
}
|
||||
|
||||
collections {
|
||||
|
||||
/* simple layout to pack our scrolling content into an elm_layout */
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
collections {
|
||||
data {
|
||||
item: "title" "Black on White";
|
||||
}
|
||||
|
||||
collections {
|
||||
/* simple layout to pack our scrolling content into an elm_layout */
|
||||
group { name: "elm/code/layout/default";
|
||||
data {
|
||||
|
|
|
@ -35,6 +35,25 @@ edi_theme_elm_code_set(Evas_Object *obj, const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
Edi_Theme *
|
||||
edi_theme_theme_by_name(const char *name)
|
||||
{
|
||||
Eina_List *l;
|
||||
Edi_Theme *theme;
|
||||
|
||||
if (!name) return NULL;
|
||||
|
||||
edi_theme_themes_get();
|
||||
|
||||
EINA_LIST_FOREACH(_edi_themes, l, theme)
|
||||
{
|
||||
if (!strcmp(theme->name, name))
|
||||
return theme;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
edi_theme_themes_get(void)
|
||||
{
|
||||
|
@ -49,6 +68,8 @@ edi_theme_themes_get(void)
|
|||
theme = malloc(sizeof(Edi_Theme));
|
||||
theme->name = strdup("default");
|
||||
theme->path = edi_path_append(elm_theme_system_dir_get(), "default.edj");
|
||||
theme->title = strdup("Default");
|
||||
|
||||
_edi_themes = eina_list_append(_edi_themes, theme);
|
||||
|
||||
files = ecore_file_ls(directory);
|
||||
|
@ -60,8 +81,8 @@ edi_theme_themes_get(void)
|
|||
name = strdup(file);
|
||||
name[strlen(name) - 4] = '\0';
|
||||
theme->name = name;
|
||||
|
||||
theme->path = edi_path_append(directory, file);
|
||||
theme->title = edje_file_data_get(theme->path, "title");
|
||||
_edi_themes = eina_list_append(_edi_themes, theme);
|
||||
}
|
||||
free(file);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
typedef struct _Edi_Theme {
|
||||
char *name;
|
||||
char *path;
|
||||
char *title;
|
||||
} Edi_Theme;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -47,6 +48,16 @@ void edi_theme_elm_code_set(Evas_Object *obj, const char *name);
|
|||
*/
|
||||
Eina_List *edi_theme_themes_get(void);
|
||||
|
||||
/**
|
||||
* Get theme obj by its name.
|
||||
*
|
||||
* @return the theme obj matching the name.
|
||||
*
|
||||
* @ingroup Theme
|
||||
*/
|
||||
Edi_Theme *edi_theme_theme_by_name(const char *name);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -146,12 +146,15 @@ _edi_settings_font_preview_add(Evas_Object *parent, const char *font_name, int f
|
|||
static void
|
||||
_edi_settings_display_theme_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Edi_Theme *theme;
|
||||
const char *text = elm_object_item_text_get(event_info);
|
||||
|
||||
theme = elm_object_item_data_get(event_info);
|
||||
|
||||
if (_edi_project_config->gui.theme)
|
||||
eina_stringshare_del(_edi_project_config->gui.theme);
|
||||
|
||||
_edi_project_config->gui.theme = eina_stringshare_add(text);
|
||||
_edi_project_config->gui.theme = eina_stringshare_add(theme->name);
|
||||
_edi_project_config_save();
|
||||
|
||||
elm_object_text_set(obj, text);
|
||||
|
@ -162,14 +165,10 @@ static char *
|
|||
_edi_settings_display_theme_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
|
||||
{
|
||||
Edi_Theme *current;
|
||||
int i;
|
||||
|
||||
i = (int)(uintptr_t) data;
|
||||
current = eina_list_nth(edi_theme_themes_get(), i);
|
||||
current = data;
|
||||
|
||||
if (!current) return NULL;
|
||||
|
||||
return strdup(current->name);
|
||||
return strdup(current->title);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
|
@ -180,7 +179,6 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
Elm_Genlist_Item_Class *itc;
|
||||
Edi_Theme *theme;
|
||||
Eina_List *themes, *l;
|
||||
int i = 0;
|
||||
|
||||
frame = _edi_settings_panel_create(parent, _("Display"));
|
||||
box = elm_object_part_content_get(frame, "default");
|
||||
|
@ -227,7 +225,7 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
if (!_edi_project_config->gui.theme)
|
||||
elm_object_text_set(combobox, _("default"));
|
||||
else
|
||||
elm_object_text_set(combobox, _edi_project_config->gui.theme);
|
||||
elm_object_text_set(combobox, edi_theme_theme_by_name(_edi_project_config->gui.theme)->title);
|
||||
|
||||
elm_table_pack(table, combobox, 1, 1, 1, 1);
|
||||
elm_box_pack_end(box, table);
|
||||
|
@ -239,8 +237,7 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
|
||||
EINA_LIST_FOREACH(themes, l, theme)
|
||||
{
|
||||
elm_genlist_item_append(combobox, itc, (void *)(uintptr_t) i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t) i);
|
||||
i++;
|
||||
elm_genlist_item_append(combobox, itc, theme, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
}
|
||||
|
||||
elm_genlist_realized_items_update(combobox);
|
||||
|
|
Loading…
Reference in New Issue