extra: bring the detail view to the backgrounds

This commit is contained in:
Marcel Hollerbach 2017-04-05 19:54:51 +02:00
parent 36661e17c4
commit b8c6afe5a8
4 changed files with 106 additions and 61 deletions

View File

@ -51,6 +51,16 @@ _fullscreen_background(void *data, Evas_Object *obj EINA_UNUSED, void *event_inf
extra_ui_fullscreen_preview(path);
}
static void
_show_details(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Extra_Background *background = data;
Evas_Object *o;
o = extra_ui_base_object_detail(background, &background->obj, acc, _ui.win);
extra_ui_details_window_show(o);
}
static void
_show_tooltip(Extra_Background *b)
{
@ -78,6 +88,16 @@ _show_tooltip(Extra_Background *b)
elm_box_pack_end(box, o);
evas_object_show(o);
//show details
o = elm_button_add(box);
evas_object_smart_callback_add(o, "clicked", _show_details, b);
elm_object_text_set(o, "Show Details");
evas_object_show(o);
elm_box_pack_end(box, o);
icon = elm_icon_add(o);
elm_icon_standard_set(icon, "document-properties");
elm_object_part_content_set(o, "icon", icon);
//view-fullscreen
o = elm_button_add(box);
elm_object_text_set(o, "Show fullscreen");

View File

@ -27,6 +27,7 @@ typedef struct {
} Extra_Ui_Small_Preview_Accessor;
Evas_Object* extra_ui_small_preview_new(Extra_Ui_Small_Preview_Accessor acc, Evas_Object *par, void *data);
Evas_Object* extra_ui_base_object_detail(void *real_obj, Extra_Base_Object *obj, Extra_Ui_Small_Preview_Accessor acc, Evas_Object *par);
void extra_ui_details_window_show(Evas_Object *content);
void extra_ui_fullscreen_preview(char *path);
void extra_ui_show_popup_toolbar(Evas_Object *content);

View File

@ -17,18 +17,6 @@ static Extra_Ui_Small_Preview_Accessor acc = {
((Extra_ui_preview_download*) extra_theme_preview_download),
};
static void
_fullscreen_picture(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
char *path;
path = extra_theme_preview_get(data);
if (!path) return;
extra_ui_fullscreen_preview(path);
}
static void
_install_done(void *data)
{
@ -122,45 +110,8 @@ static void
_popup_theme(Extra_Theme *theme)
{
Evas_Object *o, *table;
Eina_Strbuf *buf;
table = o = elm_table_add(_ui.win);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "<title>%s</title>", theme->obj.name);
o = elm_label_add(table);
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);
elm_table_pack(table, o, 0, 0, 1, 1);
o = _action_button_create(table, theme);
elm_table_pack(table, o, 1, 0, 1, 1);
o = extra_ui_small_preview_new(acc, table, theme);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _fullscreen_picture, theme);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
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(table);
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);
evas_object_show(o);
elm_table_pack(table, o, 0, 2, 2, 1);
table = extra_ui_base_object_detail(theme, &theme->obj, acc, _ui.win);
o = elm_entry_add(table);
elm_entry_editable_set(o, EINA_FALSE);
@ -170,17 +121,6 @@ _popup_theme(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);
o = elm_entry_add(table);
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);
extra_ui_details_window_show(table);
}

View File

@ -388,3 +388,87 @@ extra_ui_details_window_show(Evas_Object *content)
elm_object_focus_set(content, EINA_TRUE);
}
static void
_fullscreen(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Extra_Ui_Small_Preview_Accessor *acc = evas_object_data_get(obj, "_acc");
char *path;
path = acc->preview_get(data);
if (!path) return;
extra_ui_fullscreen_preview(path);
}
static void
_link(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Extra_Base_Object *ob = data;
Eina_Strbuf *buf;
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "xdg-open %s", ob->source);
ecore_exe_run(eina_strbuf_release(buf), NULL);
}
Evas_Object*
extra_ui_base_object_detail(void *real_obj, Extra_Base_Object *obj, Extra_Ui_Small_Preview_Accessor acc, Evas_Object *par)
{
Evas_Object *o, *table;
Eina_Strbuf *buf;
table = o = elm_table_add(par);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "<title>%s</title>", obj->name);
o = elm_label_add(table);
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);
elm_table_pack(table, o, 0, 0, 1, 1);
o = extra_ui_small_preview_new(acc, table, obj);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _fullscreen, real_obj);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
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>", obj->author);
o = elm_entry_add(table);
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, 0.0);
evas_object_show(o);
elm_table_pack(table, o, 0, 2, 1, 1);
if (obj->source)
{
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "<link>Source</link>");
o = elm_entry_add(table);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _link, obj);
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, 0.0);
evas_object_show(o);
elm_table_pack(table, o, 1, 2, 1, 1);
}
return table;
}