devilhorns pushed a commit to branch master. http://git.enlightenment.org/apps/express.git/commit/?id=5e09435d3944d0708bc114eb9e5eb483b4868b78
commit 5e09435d3944d0708bc114eb9e5eb483b4868b78 Author: Chris Michael <[email protected]> Date: Wed Aug 12 15:59:17 2015 -0400 express: Add support for activating links into a popup Signed-off-by: Chris Michael <[email protected]> --- src/bin/grid.c | 96 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 35 deletions(-) diff --git a/src/bin/grid.c b/src/bin/grid.c index 399e8b6..92ee337 100644 --- a/src/bin/grid.c +++ b/src/bin/grid.c @@ -7,6 +7,7 @@ #include "theme.h" #include "dbus.h" #include "gravatar.h" +#include "media.h" /* local function prototypes */ static void _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force); @@ -18,6 +19,20 @@ static Evas_Smart *_smart = NULL; static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL; /* local functions */ +static Eina_Bool +_should_inline(const Evas_Object *obj) +{ + const Evas *evas; + const Evas_Modifier *mods; + + evas = evas_object_evas_get(obj); + mods = evas_key_modifier_get(evas); + + if (evas_key_modifier_is_set(mods, "Control")) return EINA_FALSE; + + return EINA_TRUE; +} + static void _coord_to_cursor(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *cx, int *cy) { @@ -228,7 +243,7 @@ _cb_link_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, } static void -_link_activate(Evas_Object *obj, Eina_Bool may_inline EINA_UNUSED) +_link_activate(Evas_Object *obj, Eina_Bool may_inline) { Grid *sd; char buff[PATH_MAX], *s, *esc; @@ -283,23 +298,24 @@ _link_activate(Evas_Object *obj, Eina_Bool may_inline EINA_UNUSED) esc = ecore_file_escape_name(s); if (esc) { - /* int type; */ - /* type = media_src_type_get(sd->link.string); */ - /* if (may_inline && _should_inline(obj)) */ - /* { */ - /* if ((type == MEDIA_TYPE_IMG) || */ - /* (type == MEDIA_TYPE_SCALE) || */ - /* (type == MEDIA_TYPE_EDJE)) */ - /* { */ - /* evas_object_smart_callback_call(obj, "popup", NULL); */ - /* handled = EINA_TRUE; */ - /* } */ - /* else if (type == MEDIA_TYPE_MOV) */ - /* { */ - /* evas_object_smart_callback_call(obj, "popup", NULL); */ - /* handled = EINA_TRUE; */ - /* } */ - /* } */ + int type; + + type = _media_src_type_get(sd->link.str); + if (may_inline && _should_inline(obj)) + { + if ((type == MEDIA_TYPE_IMG) || + (type == MEDIA_TYPE_SCALE) || + (type == MEDIA_TYPE_EDJE)) + { + evas_object_smart_callback_call(obj, "popup", NULL); + handled = EINA_TRUE; + } + else if (type == MEDIA_TYPE_MOV) + { + evas_object_smart_callback_call(obj, "popup", NULL); + handled = EINA_TRUE; + } + } if (!handled) { /* if ((type == MEDIA_TYPE_IMG) || */ @@ -335,24 +351,24 @@ _link_activate(Evas_Object *obj, Eina_Bool may_inline EINA_UNUSED) esc = ecore_file_escape_name(s); if (esc) { - /* int type; */ + int type; - /* type = media_src_type_get(sd->link.string); */ - /* if (may_inline && _should_inline(obj)) */ - /* { */ - /* if ((type == MEDIA_TYPE_IMG) || */ - /* (type == MEDIA_TYPE_SCALE) || */ - /* (type == MEDIA_TYPE_EDJE)) */ - /* { */ - /* evas_object_smart_callback_call(obj, "popup", NULL); */ - /* handled = EINA_TRUE; */ - /* } */ - /* else if (type == MEDIA_TYPE_MOV) */ - /* { */ - /* evas_object_smart_callback_call(obj, "popup", NULL); */ - /* handled = EINA_TRUE; */ - /* } */ - /* } */ + type = _media_src_type_get(sd->link.str); + if (may_inline && _should_inline(obj)) + { + if ((type == MEDIA_TYPE_IMG) || + (type == MEDIA_TYPE_SCALE) || + (type == MEDIA_TYPE_EDJE)) + { + evas_object_smart_callback_call(obj, "popup", NULL); + handled = EINA_TRUE; + } + else if (type == MEDIA_TYPE_MOV) + { + evas_object_smart_callback_call(obj, "popup", NULL); + handled = EINA_TRUE; + } + } if (!handled) { /* if ((type == MEDIA_TYPE_IMG) || */ @@ -2543,3 +2559,13 @@ _row_color_simple_create(int fg_primary_color) return ret; } + +const char * +_grid_link_get(Evas_Object *obj) +{ + Grid *sd; + + /* try to get the objects smart data */ + if (!(sd = evas_object_smart_data_get(obj))) return NULL; + return sd->link.str; +} --
