extra: display the source

This commit is contained in:
Marcel Hollerbach 2017-04-05 16:06:44 +02:00
parent af5e103c7a
commit 0bf20cea61
3 changed files with 30 additions and 7 deletions

View File

@ -135,10 +135,7 @@ static void
_popup_theme(Evas_Object *win, Extra_Theme *theme)
{
Evas_Object *o, *inwin, *table;
char title_str[1024], author_str[1024];
snprintf(title_str, sizeof(title_str), "<title>%s</title>", theme->obj.name);
snprintf(author_str, sizeof(author_str), "<link>%s</link>", theme->obj.author);
Eina_Strbuf *buf;
inwin = o = elm_win_inwin_add(win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -152,8 +149,11 @@ _popup_theme(Evas_Object *win, Extra_Theme *theme)
evas_object_event_callback_add(inwin, EVAS_CALLBACK_MOUSE_UP, _detail_preview_del, o);
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "<title>%s</title>", theme->obj.name);
o = elm_label_add(inwin);
elm_object_text_set(o, title_str);
elm_object_text_set(o, eina_strbuf_release(buf));
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, 0.0, EVAS_HINT_FILL);
evas_object_show(o);
@ -169,8 +169,11 @@ _popup_theme(Evas_Object *win, Extra_Theme *theme)
evas_object_show(o);
elm_table_pack(table, o, 0, 1, 2, 1);
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "<link>%s</link>", theme->obj.author);
o = elm_entry_add(inwin);
elm_object_text_set(o, author_str);
elm_object_text_set(o, eina_strbuf_release(buf));
elm_entry_editable_set(o, EINA_FALSE);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -185,6 +188,17 @@ _popup_theme(Evas_Object *win, Extra_Theme *theme)
evas_object_show(o);
elm_table_pack(table, o, 0, 3, 2, 2);
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "<link>%s</link>", theme->obj.source, theme->obj.source);
o = elm_entry_add(inwin);
elm_entry_editable_set(o, EINA_FALSE);
elm_object_text_set(o, eina_strbuf_release(buf));
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
elm_table_pack(table, o, 0, 4, 2, 2);
elm_win_inwin_activate(inwin);
}

View File

@ -38,6 +38,7 @@ typedef struct {
Eina_Strbuf *author;
Eina_Strbuf *name;
Eina_Strbuf *version;
Eina_Strbuf *source;
Eina_Strbuf *id;
} Theme_Object;
@ -52,6 +53,7 @@ _fill_themes(Eina_Strbuf *buf)
EXTRA_JSON_TO_LIST_TEMPLATE_INIT(template, Theme_Object,
EXTRA_JSON_STRUCT_FIELD("description", Theme_Object, description, EINA_FALSE),
EXTRA_JSON_STRUCT_FIELD("author", Theme_Object, author, EINA_FALSE),
EXTRA_JSON_STRUCT_FIELD("source", Theme_Object, source, EINA_FALSE),
EXTRA_JSON_STRUCT_FIELD("name", Theme_Object, name, EINA_TRUE),
EXTRA_JSON_STRUCT_FIELD("version", Theme_Object, version, EINA_TRUE),
EXTRA_JSON_STRUCT_FIELD("theme_id", Theme_Object, id, EINA_TRUE)
@ -71,6 +73,7 @@ _fill_themes(Eina_Strbuf *buf)
theme->theme.obj.name = sec_strdup(obj->name);
theme->theme.obj.author = sec_strdup(obj->author);
theme->theme.description = sec_strdup(obj->description);
theme->theme.obj.source = sec_strdup(obj->source);
theme->theme.obj.version = versionNumb;
_theme_list = eina_list_append(_theme_list, theme);
@ -94,6 +97,7 @@ typedef struct {
typedef struct {
Eina_Strbuf *author;
Eina_Strbuf *name;
Eina_Strbuf *source;
Eina_Strbuf *version;
Eina_Strbuf *id;
} Background_Object;
@ -108,6 +112,7 @@ _fill_backgrounds(Eina_Strbuf *buf)
EXTRA_JSON_TO_LIST_TEMPLATE_INIT(template, Background_Object,
EXTRA_JSON_STRUCT_FIELD("author", Background_Object, author, EINA_FALSE),
EXTRA_JSON_STRUCT_FIELD("source", Background_Object, source, EINA_FALSE),
EXTRA_JSON_STRUCT_FIELD("name", Background_Object, name, EINA_TRUE),
EXTRA_JSON_STRUCT_FIELD("version", Background_Object, version, EINA_TRUE),
EXTRA_JSON_STRUCT_FIELD("background-id", Background_Object, id, EINA_TRUE),
@ -125,6 +130,7 @@ _fill_backgrounds(Eina_Strbuf *buf)
background->background.obj.author = sec_strdup(obj->author);
background->background.obj.id = sec_strdup(obj->id);
background->background.obj.name = sec_strdup(obj->name);
background->background.obj.source = sec_strdup(obj->source);
background->background.obj.version = versionNumb;
_background_list = eina_list_append(_background_list, background);
@ -618,7 +624,9 @@ extra_theme_installed_old(Extra_Theme *t)
}
}
eina_list_free(files);
EINA_LIST_FREE(files, file)
free(n);
eina_strbuf_free(buf);
return b;
}

View File

@ -46,6 +46,7 @@ typedef struct _Extra_Base_Object
const char *id;
const char *name;
const char *author;
const char *source;
int version;
} Extra_Base_Object;