extra: add indicators to the grid so the state of the theme is known
This commit is contained in:
parent
7bc64a439f
commit
264625f496
|
@ -11,6 +11,7 @@ typedef struct {
|
|||
} Small_Preview;
|
||||
|
||||
static Evas_Object* extra_theme_small_preview_new(Evas_Object *par, Extra_Theme *theme);
|
||||
static Evas_Object* extra_theme_small_new(Evas_Object *par, Extra_Theme *theme);
|
||||
|
||||
static Elm_Gengrid_Item_Class *_item_class_basic;
|
||||
|
||||
|
@ -77,7 +78,9 @@ static void
|
|||
_install_done(void *data)
|
||||
{
|
||||
Extra_Theme *theme = data;
|
||||
extra_ui_theme_ask_for_default(theme);
|
||||
|
||||
if (extra_theme_installed(theme))
|
||||
extra_ui_theme_ask_for_default(theme);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -169,7 +172,7 @@ _content_basic_get(void *data, Evas_Object *obj, const char *source)
|
|||
return NULL;
|
||||
|
||||
|
||||
return extra_theme_small_preview_new(obj, data);
|
||||
return extra_theme_small_new(obj, data);
|
||||
}
|
||||
|
||||
static char*
|
||||
|
@ -248,6 +251,54 @@ _small_preview_done_cb(void *data)
|
|||
evas_object_hide(p->progress);
|
||||
}
|
||||
|
||||
static Evas_Object*
|
||||
_icon_add(Evas_Object *obj, const char *name, const char *desc)
|
||||
{
|
||||
Evas_Object *ret;
|
||||
|
||||
ret = elm_icon_add(obj);
|
||||
evas_object_size_hint_min_set(ret, 20, 20);
|
||||
elm_icon_standard_set(ret, name);
|
||||
evas_object_show(ret);
|
||||
|
||||
elm_object_tooltip_text_set(ret, desc);
|
||||
elm_object_tooltip_orient_set(ret, ELM_TOOLTIP_ORIENT_TOP);
|
||||
|
||||
return ret;
|
||||
}
|
||||
static Evas_Object*
|
||||
extra_theme_small_new(Evas_Object *par, Extra_Theme *theme)
|
||||
{
|
||||
Evas_Object *table, *o;
|
||||
int counter = 0;
|
||||
|
||||
table = extra_theme_small_preview_new(par, theme);
|
||||
|
||||
//for available states: downloaded, set as default, new-version available
|
||||
if (extra_theme_installed(theme))
|
||||
{
|
||||
//theme is installed
|
||||
o = _icon_add(par, "emblem-downloads", "This theme is installed");
|
||||
elm_table_pack(table, o, counter, 0, 1, 1);
|
||||
counter ++;
|
||||
}
|
||||
|
||||
if (extra_theme_default_get(theme))
|
||||
{
|
||||
//theme is default
|
||||
o = _icon_add(par, "emblem-default", "This theme is set as default");
|
||||
elm_table_pack(table, o, counter, 0, 1, 1);
|
||||
counter ++;
|
||||
}
|
||||
|
||||
if (!extra_theme_installed(theme) && extra_theme_installed_old(theme))
|
||||
{
|
||||
o = _icon_add(par, "software-update-available", "There are updates available");
|
||||
elm_table_pack(table, o, counter, 0, 1, 1);
|
||||
counter ++;
|
||||
}
|
||||
return table;
|
||||
}
|
||||
static Evas_Object*
|
||||
extra_theme_small_preview_new(Evas_Object *par, Extra_Theme *theme)
|
||||
{
|
||||
|
@ -264,10 +315,11 @@ extra_theme_small_preview_new(Evas_Object *par, Extra_Theme *theme)
|
|||
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(table);
|
||||
|
||||
|
||||
small->image = elm_image_add(table);
|
||||
evas_object_size_hint_weight_set(small->image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(small->image, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_table_pack(table, small->image, 0, 1, 4, 2);
|
||||
elm_table_pack(table, small->image, 0, 0, 4, 3);
|
||||
evas_object_show(small->image);
|
||||
|
||||
small->progress = elm_progressbar_add(table);
|
||||
|
|
Loading…
Reference in New Issue