forked from enlightenment/enlightenment
e17/evry:
- evry gadget now shows a window that works with illume for keyboard input - added app menu browser - evry_icon_get refactoring SVN revision: 62518
This commit is contained in:
parent
c3595e9d2b
commit
034e60d9d5
|
@ -110,7 +110,6 @@ e_modapi_init(E_Module *m)
|
||||||
SET(action_find);
|
SET(action_find);
|
||||||
SET(api_version_check);
|
SET(api_version_check);
|
||||||
SET(type_register);
|
SET(type_register);
|
||||||
SET(icon_mime_get);
|
|
||||||
SET(icon_theme_get);
|
SET(icon_theme_get);
|
||||||
SET(fuzzy_match);
|
SET(fuzzy_match);
|
||||||
SET(util_exec_app);
|
SET(util_exec_app);
|
||||||
|
@ -526,7 +525,7 @@ _e_mod_run_defer_cb(void *data)
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
|
||||||
zone = data;
|
zone = data;
|
||||||
if (zone) evry_show(zone, E_ZONE_EDGE_NONE, _params);
|
if (zone) evry_show(zone, E_ZONE_EDGE_NONE, _params, EINA_TRUE);
|
||||||
|
|
||||||
_idler = NULL;
|
_idler = NULL;
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
@ -570,7 +569,7 @@ _e_mod_action_cb_edge(E_Object *obj __UNUSED__, const char *params, E_Event_Zon
|
||||||
|
|
||||||
if (_idler) ecore_idle_enterer_del(_idler);
|
if (_idler) ecore_idle_enterer_del(_idler);
|
||||||
|
|
||||||
evry_show(ev->zone, ev->edge, _params);
|
evry_show(ev->zone, ev->edge, _params, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* menu item callback(s) */
|
/* menu item callback(s) */
|
||||||
|
|
|
@ -205,7 +205,7 @@ void evry_plugin_update(Evry_Plugin *plugin, int state);
|
||||||
void evry_clear_input(Evry_Plugin *p);
|
void evry_clear_input(Evry_Plugin *p);
|
||||||
|
|
||||||
/* evry_util.c */
|
/* evry_util.c */
|
||||||
Evas_Object *evry_icon_mime_get(const char *mime, Evas *e);
|
/* Evas_Object *evry_icon_mime_get(const char *mime, Evas *e); */
|
||||||
Evas_Object *evry_icon_theme_get(const char *icon, Evas *e);
|
Evas_Object *evry_icon_theme_get(const char *icon, Evas *e);
|
||||||
int evry_fuzzy_match(const char *str, const char *match);
|
int evry_fuzzy_match(const char *str, const char *match);
|
||||||
Eina_List *evry_fuzzy_match_sort(Eina_List *items);
|
Eina_List *evry_fuzzy_match_sort(Eina_List *items);
|
||||||
|
@ -281,7 +281,7 @@ void evry_plug_collection_shutdown(void);
|
||||||
|
|
||||||
int evry_init(void);
|
int evry_init(void);
|
||||||
int evry_shutdown(void);
|
int evry_shutdown(void);
|
||||||
Evry_Window *evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params);
|
Evry_Window *evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup);
|
||||||
void evry_hide(Evry_Window *win, int clear);
|
void evry_hide(Evry_Window *win, int clear);
|
||||||
|
|
||||||
int evry_plug_actions_init();
|
int evry_plug_actions_init();
|
||||||
|
|
|
@ -147,7 +147,7 @@ _evry_cb_item_changed(__UNUSED__ void *data, __UNUSED__ int type, void *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
Evry_Window *
|
Evry_Window *
|
||||||
evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params)
|
evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup)
|
||||||
{
|
{
|
||||||
Evry_Window *win;
|
Evry_Window *win;
|
||||||
Evry_Selector *sel;
|
Evry_Selector *sel;
|
||||||
|
@ -163,18 +163,22 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params)
|
||||||
if (!(win = _evry_window_new(zone, edge)))
|
if (!(win = _evry_window_new(zone, edge)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
e_win_layer_set(win->ewin, 255);
|
if (popup)
|
||||||
ecore_x_netwm_window_type_set(win->ewin->evas_win,
|
{
|
||||||
ECORE_X_WINDOW_TYPE_UTILITY);
|
e_win_layer_set(win->ewin, 255);
|
||||||
|
ecore_x_netwm_window_type_set(win->ewin->evas_win,
|
||||||
|
ECORE_X_WINDOW_TYPE_UTILITY);
|
||||||
|
|
||||||
ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything");
|
ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything");
|
||||||
ecore_evas_show(win->ewin->ecore_evas);
|
|
||||||
|
ecore_evas_show(win->ewin->ecore_evas);
|
||||||
if (e_grabinput_get(win->ewin->evas_win, 0, win->ewin->evas_win))
|
|
||||||
win->grab = 1;
|
|
||||||
else
|
|
||||||
ERR("could not acquire grab");
|
|
||||||
|
|
||||||
|
if (e_grabinput_get(win->ewin->evas_win, 0, win->ewin->evas_win))
|
||||||
|
win->grab = 1;
|
||||||
|
else
|
||||||
|
ERR("could not acquire grab");
|
||||||
|
}
|
||||||
|
|
||||||
evry_history_load();
|
evry_history_load();
|
||||||
|
|
||||||
if (params)
|
if (params)
|
||||||
|
@ -1236,7 +1240,8 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
|
||||||
evas_object_del(sel->o_thumb);
|
evas_object_del(sel->o_thumb);
|
||||||
sel->o_thumb = NULL;
|
sel->o_thumb = NULL;
|
||||||
|
|
||||||
if (it->type != EVRY_TYPE_FILE) return 0;
|
if (it->type != EVRY_TYPE_FILE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
GET_FILE(file, it);
|
GET_FILE(file, it);
|
||||||
|
|
||||||
|
@ -1605,23 +1610,26 @@ evry_browse_item(Evry_Item *it)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((it->plugin->browse) &&
|
if ((it->plugin->browse) && (pp = it->plugin->browse(it->plugin, it)))
|
||||||
(pp = it->plugin->browse(it->plugin, it)))
|
|
||||||
{
|
{
|
||||||
plugins = eina_list_append(plugins, pp);
|
plugins = eina_list_append(plugins, pp);
|
||||||
pref = pp;
|
pref = pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
/* items of type NONE can only be browsed by their own plugin */
|
||||||
|
if (!CHECK_TYPE(it, EVRY_TYPE_NONE))
|
||||||
{
|
{
|
||||||
if (!p->browse)
|
EINA_LIST_FOREACH(sel->plugins, l, p)
|
||||||
continue;
|
{
|
||||||
|
if (!p->browse)
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((pref) && (!strcmp(p->name, pref->name)))
|
if ((pref) && (!strcmp(p->name, pref->name)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((pp = p->browse(p, it)))
|
if ((pp = p->browse(p, it)))
|
||||||
plugins = eina_list_append(plugins, pp);
|
plugins = eina_list_append(plugins, pp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "evry_types.h"
|
#include "evry_types.h"
|
||||||
|
|
||||||
#define EVRY_API_VERSION 27
|
#define EVRY_API_VERSION 28
|
||||||
|
|
||||||
#define EVRY_ACTION_OTHER 0
|
#define EVRY_ACTION_OTHER 0
|
||||||
#define EVRY_ACTION_FINISHED 1
|
#define EVRY_ACTION_FINISHED 1
|
||||||
|
@ -101,8 +101,8 @@ struct _Evry_API
|
||||||
Evry_Type (*type_register)(const char *type);
|
Evry_Type (*type_register)(const char *type);
|
||||||
|
|
||||||
/* evry_util.c */
|
/* evry_util.c */
|
||||||
Evas_Object *(*icon_mime_get)(const char *mime, Evas *e);
|
|
||||||
Evas_Object *(*icon_theme_get)(const char *icon, Evas *e);
|
Evas_Object *(*icon_theme_get)(const char *icon, Evas *e);
|
||||||
|
|
||||||
int (*fuzzy_match)(const char *str, const char *match);
|
int (*fuzzy_match)(const char *str, const char *match);
|
||||||
int (*util_exec_app)(const Evry_Item *it_app, const Evry_Item *it_file);
|
int (*util_exec_app)(const Evry_Item *it_app, const Evry_Item *it_file);
|
||||||
char *(*util_url_escape)(const char *string, int inlength);
|
char *(*util_url_escape)(const char *string, int inlength);
|
||||||
|
@ -197,10 +197,10 @@ struct _Evry_Event_Action_Performed
|
||||||
EVRY_ITEM(_it)->icon = eina_stringshare_add(_icon);
|
EVRY_ITEM(_it)->icon = eina_stringshare_add(_icon);
|
||||||
|
|
||||||
#define CHECK_TYPE(_item, _type) \
|
#define CHECK_TYPE(_item, _type) \
|
||||||
(((Evry_Item *)_item)->type && ((Evry_Item *)_item)->type == _type)
|
(((Evry_Item *)_item)->type == _type)
|
||||||
|
|
||||||
#define CHECK_SUBTYPE(_item, _type) \
|
#define CHECK_SUBTYPE(_item, _type) \
|
||||||
(((Evry_Item *)_item)->subtype && ((Evry_Item *)_item)->subtype == _type)
|
(((Evry_Item *)_item)->subtype == _type)
|
||||||
|
|
||||||
#define IS_BROWSEABLE(_item) ((Evry_Item *)_item)->browseable
|
#define IS_BROWSEABLE(_item) ((Evry_Item *)_item)->browseable
|
||||||
|
|
||||||
|
|
|
@ -153,19 +153,28 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
if (ev->button == 1)
|
if (ev->button == 1)
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h;
|
/* Evas_Coord x, y, w, h; */
|
||||||
int cx, cy, pw, ph;
|
/* int cx, cy, pw, ph; */
|
||||||
Evry_Window *win;
|
Evry_Window *win;
|
||||||
|
|
||||||
|
if (inst->win)
|
||||||
|
{
|
||||||
|
evry_hide(inst->win, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
win = evry_show(e_util_zone_current_get(e_manager_current_get()), 0, "Start");
|
win = evry_show(e_util_zone_current_get(e_manager_current_get()), 0, "Start", EINA_FALSE);
|
||||||
if (!win) return;
|
if (!win) return;
|
||||||
|
|
||||||
evas_object_geometry_get(inst->o_button, &x, &y, &w, &h);
|
e_win_show(win->ewin);
|
||||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
|
|
||||||
&cx, &cy, NULL, NULL);
|
|
||||||
x += cx;
|
/* evas_object_geometry_get(inst->o_button, &x, &y, &w, &h);
|
||||||
y += cy;
|
* e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
|
||||||
|
* &cx, &cy, NULL, NULL);
|
||||||
|
* x += cx;
|
||||||
|
* y += cy; */
|
||||||
|
|
||||||
/* evas_object_resize(win->o_main,
|
/* evas_object_resize(win->o_main,
|
||||||
* evry_conf->edge_width,
|
* evry_conf->edge_width,
|
||||||
* evry_conf->edge_height);
|
* evry_conf->edge_height);
|
||||||
|
@ -174,46 +183,46 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
|
||||||
* evry_conf->edge_width,
|
* evry_conf->edge_width,
|
||||||
* evry_conf->edge_height); */
|
* evry_conf->edge_height); */
|
||||||
|
|
||||||
pw = win->ewin->w;
|
/* pw = win->ewin->w;
|
||||||
ph = win->ewin->h;
|
* ph = win->ewin->h;
|
||||||
|
*
|
||||||
switch (inst->gcc->gadcon->orient)
|
* switch (inst->gcc->gadcon->orient)
|
||||||
{
|
* {
|
||||||
|
*
|
||||||
case E_GADCON_ORIENT_TOP:
|
* case E_GADCON_ORIENT_TOP:
|
||||||
case E_GADCON_ORIENT_CORNER_TL:
|
* case E_GADCON_ORIENT_CORNER_TL:
|
||||||
case E_GADCON_ORIENT_CORNER_TR:
|
* case E_GADCON_ORIENT_CORNER_TR:
|
||||||
e_win_move(win->ewin, x, y + h);
|
* e_win_move(win->ewin, x, y + h);
|
||||||
break;
|
* break;
|
||||||
case E_GADCON_ORIENT_BOTTOM:
|
* case E_GADCON_ORIENT_BOTTOM:
|
||||||
case E_GADCON_ORIENT_CORNER_BR:
|
* case E_GADCON_ORIENT_CORNER_BR:
|
||||||
case E_GADCON_ORIENT_CORNER_BL:
|
* case E_GADCON_ORIENT_CORNER_BL:
|
||||||
e_win_move(win->ewin, x, y - ph);
|
* e_win_move(win->ewin, x, y - ph);
|
||||||
break;
|
* break;
|
||||||
case E_GADCON_ORIENT_LEFT:
|
* case E_GADCON_ORIENT_LEFT:
|
||||||
case E_GADCON_ORIENT_CORNER_LT:
|
* case E_GADCON_ORIENT_CORNER_LT:
|
||||||
case E_GADCON_ORIENT_CORNER_LB:
|
* case E_GADCON_ORIENT_CORNER_LB:
|
||||||
e_win_move(win->ewin, x + w, y);
|
* e_win_move(win->ewin, x + w, y);
|
||||||
break;
|
* break;
|
||||||
case E_GADCON_ORIENT_RIGHT:
|
* case E_GADCON_ORIENT_RIGHT:
|
||||||
case E_GADCON_ORIENT_CORNER_RT:
|
* case E_GADCON_ORIENT_CORNER_RT:
|
||||||
case E_GADCON_ORIENT_CORNER_RB:
|
* case E_GADCON_ORIENT_CORNER_RB:
|
||||||
e_win_move(win->ewin, x - pw, y);
|
* e_win_move(win->ewin, x - pw, y);
|
||||||
break;
|
* break;
|
||||||
case E_GADCON_ORIENT_FLOAT:
|
* case E_GADCON_ORIENT_FLOAT:
|
||||||
case E_GADCON_ORIENT_HORIZ:
|
* case E_GADCON_ORIENT_HORIZ:
|
||||||
case E_GADCON_ORIENT_VERT:
|
* case E_GADCON_ORIENT_VERT:
|
||||||
default:
|
* default:
|
||||||
break;
|
* break;
|
||||||
}
|
* } */
|
||||||
|
|
||||||
inst->win = win;
|
inst->win = win;
|
||||||
|
|
||||||
if (win->ewin->x + pw > win->zone->w)
|
/* if (win->ewin->x + pw > win->zone->w)
|
||||||
e_win_move(win->ewin, win->zone->w - pw, win->ewin->y);
|
* e_win_move(win->ewin, win->zone->w - pw, win->ewin->y);
|
||||||
|
*
|
||||||
if (win->ewin->y + ph > win->zone->h)
|
* if (win->ewin->y + ph > win->zone->h)
|
||||||
e_win_move(win->ewin, win->ewin->x, win->zone->h - ph);
|
* e_win_move(win->ewin, win->ewin->x, win->zone->h - ph); */
|
||||||
|
|
||||||
e_gadcon_locked_set(inst->gcc->gadcon, 1);
|
e_gadcon_locked_set(inst->gcc->gadcon, 1);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (it->usage >= 0)
|
if (it->usage >= 0)
|
||||||
evry_history_item_usage_set(it, input, context);
|
evry_history_item_usage_set(it, input, context);
|
||||||
|
|
||||||
if (it->usage && it->usage > max_usage)
|
if (it->usage && (it->usage > max_usage))
|
||||||
max_usage = it->usage;
|
max_usage = it->usage;
|
||||||
|
|
||||||
if (it->fuzzy_match == 0)
|
if (it->fuzzy_match == 0)
|
||||||
|
@ -222,9 +222,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(pp->items, ll, it)
|
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||||
{
|
{
|
||||||
if (((it->usage >= 0) &&
|
if ((!subj_sel) || (it->usage < 0) ||
|
||||||
(evry_history_item_usage_set(it, input, context))) ||
|
(evry_history_item_usage_set(it, input, context)))
|
||||||
(!subj_sel))
|
|
||||||
{
|
{
|
||||||
it->fuzzy_match = 0;
|
it->fuzzy_match = 0;
|
||||||
items = eina_list_append(items, it);
|
items = eina_list_append(items, it);
|
||||||
|
|
|
@ -17,17 +17,21 @@ typedef struct _Plugin Plugin;
|
||||||
typedef struct _Module_Config Module_Config;
|
typedef struct _Module_Config Module_Config;
|
||||||
typedef struct _E_Exe E_Exe;
|
typedef struct _E_Exe E_Exe;
|
||||||
typedef struct _E_Exe_List E_Exe_List;
|
typedef struct _E_Exe_List E_Exe_List;
|
||||||
|
typedef struct _Item_Menu Item_Menu;
|
||||||
|
|
||||||
struct _Plugin
|
struct _Plugin
|
||||||
{
|
{
|
||||||
Evry_Plugin base;
|
Evry_Plugin base;
|
||||||
|
Eina_Bool browse;
|
||||||
const char *input;
|
const char *input;
|
||||||
Eina_List *apps_mime;
|
Eina_List *apps_mime;
|
||||||
Eina_List *apps_all;
|
Eina_List *apps_all;
|
||||||
Eina_List *apps_hist;
|
Eina_List *apps_hist;
|
||||||
|
Eina_List *menu_items;
|
||||||
|
|
||||||
Eina_Hash *added;
|
Eina_Hash *added;
|
||||||
|
Efreet_Menu *menu;;
|
||||||
|
|
||||||
Evry_Item_App *command;
|
Evry_Item_App *command;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,6 +55,13 @@ struct _Module_Config
|
||||||
E_Module *module;
|
E_Module *module;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _Item_Menu
|
||||||
|
{
|
||||||
|
Evry_Item base;
|
||||||
|
|
||||||
|
Efreet_Menu *menu;;
|
||||||
|
};
|
||||||
|
|
||||||
static const Evry_API *evry = NULL;
|
static const Evry_API *evry = NULL;
|
||||||
static Evry_Module *evry_module = NULL;
|
static Evry_Module *evry_module = NULL;
|
||||||
static Eina_List *handlers = NULL;
|
static Eina_List *handlers = NULL;
|
||||||
|
@ -70,6 +81,9 @@ static Eina_List *exe_list2 = NULL;
|
||||||
static Eina_List *apps_cache = NULL;
|
static Eina_List *apps_cache = NULL;
|
||||||
static void _scan_executables();
|
static void _scan_executables();
|
||||||
|
|
||||||
|
|
||||||
|
#define GET_MENU(_m, _it) Item_Menu *_m = (Item_Menu *)_it
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
static void _hash_free(void *data)
|
static void _hash_free(void *data)
|
||||||
|
@ -78,39 +92,6 @@ static void _hash_free(void *data)
|
||||||
EVRY_ITEM_FREE(app);
|
EVRY_ITEM_FREE(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_icon_get(Evry_Item *it, Evas *e)
|
|
||||||
{
|
|
||||||
GET_APP(app, it);
|
|
||||||
Evas_Object *o = NULL;
|
|
||||||
|
|
||||||
if (app->desktop && app->desktop->icon)
|
|
||||||
{
|
|
||||||
if (app->desktop->icon[0] == '/')
|
|
||||||
{
|
|
||||||
o = e_icon_add(e);
|
|
||||||
e_icon_preload_set(o, 1);
|
|
||||||
|
|
||||||
if (!e_icon_file_set(o, app->desktop->icon))
|
|
||||||
{
|
|
||||||
evas_object_del(o);
|
|
||||||
o = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!o)
|
|
||||||
o = evry->icon_theme_get(app->desktop->icon, e);
|
|
||||||
|
|
||||||
if (!o)
|
|
||||||
o = e_util_desktop_icon_add(app->desktop, 128, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!o)
|
|
||||||
o = evry->icon_theme_get("system-run", e);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_exec_open_file_action(Evry_Action *act)
|
_exec_open_file_action(Evry_Action *act)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +99,7 @@ _exec_open_file_action(Evry_Action *act)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_item_free(Evry_Item *item)
|
_cb_item_free(Evry_Item *item)
|
||||||
{
|
{
|
||||||
GET_APP(app, item);
|
GET_APP(app, item);
|
||||||
|
|
||||||
|
@ -135,7 +116,7 @@ _item_new(Plugin *p, const char *label, const char *id)
|
||||||
{
|
{
|
||||||
Evry_Item_App *app;
|
Evry_Item_App *app;
|
||||||
|
|
||||||
app = EVRY_ITEM_NEW(Evry_Item_App, p, label, _icon_get, _item_free);
|
app = EVRY_ITEM_NEW(Evry_Item_App, p, label, NULL, _cb_item_free);
|
||||||
EVRY_ACTN(app)->action = &_exec_open_file_action;
|
EVRY_ACTN(app)->action = &_exec_open_file_action;
|
||||||
EVRY_ACTN(app)->it1.type = EVRY_TYPE_FILE;
|
EVRY_ACTN(app)->it1.type = EVRY_TYPE_FILE;
|
||||||
EVRY_ITEM(app)->id = eina_stringshare_add(id);
|
EVRY_ITEM(app)->id = eina_stringshare_add(id);
|
||||||
|
@ -148,6 +129,24 @@ _item_new(Plugin *p, const char *label, const char *id)
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Item_Menu *
|
||||||
|
_item_menu_add(Plugin *p, Efreet_Menu *menu)
|
||||||
|
{
|
||||||
|
Item_Menu *m;
|
||||||
|
|
||||||
|
m = EVRY_ITEM_NEW(Item_Menu, p, NULL, NULL, NULL);
|
||||||
|
EVRY_ITEM(m)->type = EVRY_TYPE_NONE;
|
||||||
|
EVRY_ITEM(m)->browseable = EINA_TRUE;
|
||||||
|
EVRY_ITEM(m)->label = eina_stringshare_add(menu->name);
|
||||||
|
EVRY_ITEM(m)->icon = eina_stringshare_add(menu->icon);
|
||||||
|
EVRY_ITEM(m)->usage = -1;
|
||||||
|
|
||||||
|
m->menu = menu;
|
||||||
|
p->menu_items = eina_list_append(p->menu_items, m);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_cb_sort(const void *data1, const void *data2)
|
_cb_sort(const void *data1, const void *data2)
|
||||||
{
|
{
|
||||||
|
@ -331,7 +330,7 @@ _begin_exe(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
|
|
||||||
p->added = eina_hash_string_small_new(_hash_free);
|
p->added = eina_hash_string_small_new(_hash_free);
|
||||||
|
|
||||||
app = EVRY_ITEM_NEW(Evry_Item_App, p, NULL, _icon_get, _item_free);
|
app = EVRY_ITEM_NEW(Evry_Item_App, p, NULL, NULL, _cb_item_free);
|
||||||
EVRY_ACTN(app)->action = &_exec_open_file_action;
|
EVRY_ACTN(app)->action = &_exec_open_file_action;
|
||||||
EVRY_ACTN(app)->remember_context = EINA_TRUE;
|
EVRY_ACTN(app)->remember_context = EINA_TRUE;
|
||||||
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
|
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
|
||||||
|
@ -532,27 +531,55 @@ static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *plugin, const Evry_Item *item)
|
_begin(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
Plugin *p;
|
Plugin *p;
|
||||||
|
|
||||||
if (item && (item != _act_open_with))
|
if (item && (item != _act_open_with))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
EVRY_PLUGIN_INSTANCE(p, plugin)
|
EVRY_PLUGIN_INSTANCE(p, plugin);
|
||||||
p->added = eina_hash_string_small_new(_hash_free);
|
p->added = eina_hash_string_small_new(_hash_free);
|
||||||
|
p->menu = efreet_menu_get();
|
||||||
|
|
||||||
|
return EVRY_PLUGIN(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evry_Plugin *
|
||||||
|
_browse(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
|
{
|
||||||
|
Plugin *p;
|
||||||
|
|
||||||
|
if (!item)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!CHECK_TYPE(item, EVRY_TYPE_NONE))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
EVRY_PLUGIN_INSTANCE(p, plugin);
|
||||||
|
GET_MENU(m, item);
|
||||||
|
|
||||||
|
p->added = eina_hash_string_small_new(_hash_free);
|
||||||
|
p->menu = m->menu;
|
||||||
|
p->browse = EINA_TRUE;
|
||||||
|
|
||||||
return EVRY_PLUGIN(p);
|
return EVRY_PLUGIN(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_finish(Evry_Plugin *plugin)
|
_finish(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
GET_PLUGIN(p, plugin);
|
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
|
Evry_Item *it;
|
||||||
|
|
||||||
|
GET_PLUGIN(p, plugin);
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
|
/* TODO share with browse instances */
|
||||||
if (p->added)
|
if (p->added)
|
||||||
eina_hash_free(p->added);
|
eina_hash_free(p->added);
|
||||||
|
|
||||||
|
if ((!p->browse) && (p->menu))
|
||||||
|
efreet_menu_free(p->menu);
|
||||||
|
|
||||||
EINA_LIST_FREE(p->apps_all, desktop)
|
EINA_LIST_FREE(p->apps_all, desktop)
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
|
|
||||||
|
@ -561,6 +588,9 @@ _finish(Evry_Plugin *plugin)
|
||||||
EINA_LIST_FREE(p->apps_mime, desktop)
|
EINA_LIST_FREE(p->apps_mime, desktop)
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
|
|
||||||
|
EINA_LIST_FREE(p->menu_items, it)
|
||||||
|
EVRY_ITEM_FREE(it);
|
||||||
|
|
||||||
E_FREE(p);
|
E_FREE(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,36 +602,64 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
History_Types *ht;
|
History_Types *ht;
|
||||||
|
|
||||||
|
Efreet_Menu *entry;
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
if (input)
|
if (!p->browse)
|
||||||
{
|
{
|
||||||
if (!p->apps_all)
|
if (input)
|
||||||
p->apps_all = _desktop_list_get();
|
|
||||||
|
|
||||||
_desktop_list_add(p, p->apps_all, input);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_desktop_list_add(p, p->apps_mime, input);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!input && !(plugin->items))
|
|
||||||
{
|
|
||||||
if (!p->apps_hist)
|
|
||||||
{
|
{
|
||||||
ht = evry->history_types_get(EVRY_TYPE_APP);
|
if (!p->apps_all)
|
||||||
if (ht) eina_hash_foreach(ht->types, _hist_items_get_cb, p);
|
p->apps_all = _desktop_list_get();
|
||||||
|
|
||||||
|
_desktop_list_add(p, p->apps_all, input);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_desktop_list_add(p, p->apps_mime, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
_desktop_list_add(p, p->apps_hist, NULL);
|
if ((!input) && (!plugin->items))
|
||||||
|
{
|
||||||
|
if (!p->apps_hist)
|
||||||
|
{
|
||||||
|
ht = evry->history_types_get(EVRY_TYPE_APP);
|
||||||
|
if (ht) eina_hash_foreach(ht->types, _hist_items_get_cb, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
_desktop_list_add(p, p->apps_hist, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(plugin->items, l, it)
|
||||||
|
evry->history_item_usage_set(it, input, NULL);
|
||||||
|
|
||||||
|
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((p->menu) && (!p->menu_items))
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(p->menu->entries, l, entry)
|
||||||
|
{
|
||||||
|
if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
|
||||||
|
{
|
||||||
|
_item_desktop_add(p, entry->desktop, i++);
|
||||||
|
}
|
||||||
|
else if (entry->type == EFREET_MENU_ENTRY_MENU)
|
||||||
|
{
|
||||||
|
_item_menu_add(p, entry);
|
||||||
|
}
|
||||||
|
/* else if (entry->type == EFREET_MENU_ENTRY_SEPARATOR)
|
||||||
|
* continue;
|
||||||
|
* else if (entry->type == EFREET_MENU_ENTRY_HEADER)
|
||||||
|
* continue; */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(plugin->items, l, it)
|
EINA_LIST_FOREACH(p->menu_items, l, it)
|
||||||
evry->history_item_usage_set(it, input, NULL);
|
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
|
||||||
|
|
||||||
return !!(plugin->items);
|
return !!(plugin->items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,6 +1087,7 @@ _plugins_init(const Evry_API *api)
|
||||||
p = EVRY_PLUGIN_BASE("Applications", _module_icon, EVRY_TYPE_APP,
|
p = EVRY_PLUGIN_BASE("Applications", _module_icon, EVRY_TYPE_APP,
|
||||||
_begin, _finish, _fetch);
|
_begin, _finish, _fetch);
|
||||||
p->complete = &_complete;
|
p->complete = &_complete;
|
||||||
|
p->browse = &_browse;
|
||||||
p->config_path = "extensions/everything-apps";
|
p->config_path = "extensions/everything-apps";
|
||||||
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
|
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
|
||||||
_plugins = eina_list_append(_plugins, p);
|
_plugins = eina_list_append(_plugins, p);
|
||||||
|
|
|
@ -46,19 +46,16 @@ _finish(Evry_Plugin *plugin)
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_icon_get(Evry_Item *item, Evas *e)
|
_icon_get(Evry_Item *item, Evas *e)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
|
||||||
Settings_Item *it = (Settings_Item *) item;
|
Settings_Item *it = (Settings_Item *) item;
|
||||||
|
|
||||||
|
if (!item->icon)
|
||||||
|
{
|
||||||
|
if (it->eci && it->eci->icon)
|
||||||
|
item->icon = eina_stringshare_add(it->eci->icon);
|
||||||
|
else if (it->ecat->icon)
|
||||||
|
item->icon = eina_stringshare_add(it->ecat->icon);
|
||||||
|
}
|
||||||
|
|
||||||
if (it->eci && it->eci->icon &&
|
|
||||||
((o = evry->icon_theme_get(it->eci->icon, e)) ||
|
|
||||||
(o = e_util_icon_add(it->eci->icon, e))))
|
|
||||||
return o;
|
|
||||||
|
|
||||||
if (it->ecat->icon &&
|
|
||||||
((o = evry->icon_theme_get(it->ecat->icon, e)) ||
|
|
||||||
(o = e_util_icon_add(it->ecat->icon, e))))
|
|
||||||
return o;
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,146 +391,116 @@ evry_util_plugin_items_add(Evry_Plugin *p, Eina_List *items, const char *input,
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
evry_icon_theme_get(const char *icon, Evas *e)
|
evry_icon_theme_get(const char *icon, Evas *e)
|
||||||
{
|
|
||||||
Evas_Object *obj = e_icon_add(e);
|
|
||||||
e_icon_preload_set(obj, 1);
|
|
||||||
e_icon_scale_size_set(obj, 128);
|
|
||||||
|
|
||||||
if (!e_util_icon_theme_set(obj, icon))
|
|
||||||
{
|
|
||||||
evas_object_del(obj);
|
|
||||||
obj = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_evry_icon_mime_theme_get(const char *mime, Evas *e)
|
|
||||||
{
|
{
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
|
|
||||||
char buf[1024];
|
if (!icon)
|
||||||
const char *file;
|
|
||||||
|
|
||||||
if (snprintf(buf, sizeof(buf), "e/icons/fileman/mime/%s", mime) >= (int)sizeof(buf))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
o = e_icon_add(e);
|
||||||
|
e_icon_scale_size_set(o, 128);
|
||||||
|
e_icon_preload_set(o, 1);
|
||||||
|
|
||||||
file = e_theme_edje_file_get("base/theme/icons", buf);
|
if (icon[0] == '/')
|
||||||
if (file && file[0])
|
|
||||||
{
|
{
|
||||||
o = edje_object_add(e);
|
if (!e_icon_file_set(o, icon))
|
||||||
if (!o) return NULL;
|
|
||||||
if (!edje_object_file_set(o, file, buf))
|
|
||||||
{
|
{
|
||||||
evas_object_del(o);
|
evas_object_del(o);
|
||||||
return NULL;
|
o = NULL;
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Evas_Object *
|
|
||||||
evry_icon_mime_get(const char *mime, Evas *e)
|
|
||||||
{
|
|
||||||
Evas_Object *o = NULL;
|
|
||||||
const char *icon;
|
|
||||||
|
|
||||||
if (!e_config->icon_theme_overrides)
|
|
||||||
o = _evry_icon_mime_theme_get(mime, e);
|
|
||||||
|
|
||||||
if (o) return o;
|
|
||||||
|
|
||||||
icon = efreet_mime_type_icon_get(mime, e_config->icon_theme, 128);
|
|
||||||
if (icon)
|
|
||||||
o = e_util_icon_add(icon, e);
|
|
||||||
if (o) return o;
|
|
||||||
|
|
||||||
return _evry_icon_mime_theme_get(mime, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_file_icon_get(Evry_Item *it, Evas *e)
|
|
||||||
{
|
|
||||||
Evas_Object *o = NULL;
|
|
||||||
GET_FILE(file, it);
|
|
||||||
|
|
||||||
if (it->icon)
|
|
||||||
{
|
|
||||||
if (it->icon[0] == '/')
|
|
||||||
{
|
|
||||||
o = e_icon_add(e);
|
|
||||||
e_icon_preload_set(o, 1);
|
|
||||||
|
|
||||||
if (!e_icon_file_set(o, it->icon))
|
|
||||||
{
|
|
||||||
evas_object_del(o);
|
|
||||||
o = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!e_util_icon_theme_set(o, icon))
|
||||||
if (!(o) && (!it->icon) && file->mime &&
|
|
||||||
(/*(!strncmp(file->mime, "image/", 6)) || */
|
|
||||||
(!strncmp(file->mime, "video/", 6)) ||
|
|
||||||
(!strncmp(file->mime, "application/pdf", 15))) &&
|
|
||||||
(evry_file_url_get(file)))
|
|
||||||
{
|
{
|
||||||
char *sum = evry_util_md5_sum(file->url);
|
evas_object_del(o);
|
||||||
|
o = NULL;
|
||||||
snprintf(thumb_buf, sizeof(thumb_buf),
|
|
||||||
"%s/.thumbnails/normal/%s.png",
|
|
||||||
e_user_homedir_get(), sum);
|
|
||||||
free(sum);
|
|
||||||
|
|
||||||
if (ecore_file_exists(thumb_buf))
|
|
||||||
it->icon = eina_stringshare_add(thumb_buf);
|
|
||||||
else
|
|
||||||
it->icon = eina_stringshare_add("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(o) &&it->browseable)
|
|
||||||
o = evry_icon_theme_get("folder", e);
|
|
||||||
|
|
||||||
if (!(o) && file->mime)
|
|
||||||
o = evry_icon_mime_get(file->mime, e);
|
|
||||||
|
|
||||||
if (!o)
|
|
||||||
o = evry_icon_mime_get("unknown", e);
|
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
evry_util_icon_get(Evry_Item *it, Evas *e)
|
evry_util_icon_get(Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
|
|
||||||
if (!o && it->icon_get)
|
if (it->icon_get)
|
||||||
o = it->icon_get(it, e);
|
o = it->icon_get(it, e);
|
||||||
if (o) return o;
|
if (o) return o;
|
||||||
|
|
||||||
if (CHECK_TYPE(it, EVRY_TYPE_FILE))
|
if ((it->icon) && (it->icon[0] == '/'))
|
||||||
o = _file_icon_get(it, e);
|
o = evry_icon_theme_get(it->icon, e);
|
||||||
if (o) return o;
|
if (o) return o;
|
||||||
|
|
||||||
if (!o && it->icon && it->icon[0] == '/')
|
if (CHECK_TYPE(it, EVRY_TYPE_FILE))
|
||||||
{
|
{
|
||||||
o = e_icon_add(e);
|
const char *icon;
|
||||||
e_icon_preload_set(o, 1);
|
char *sum;
|
||||||
|
|
||||||
|
GET_FILE(file, it);
|
||||||
|
|
||||||
if (!e_icon_file_set(o, it->icon))
|
if (it->browseable)
|
||||||
|
o = evry_icon_theme_get("folder", e);
|
||||||
|
if (o) return o;
|
||||||
|
|
||||||
|
if ((!it->icon) && (file->mime) &&
|
||||||
|
(/*(!strncmp(file->mime, "image/", 6)) || */
|
||||||
|
(!strncmp(file->mime, "video/", 6)) ||
|
||||||
|
(!strncmp(file->mime, "application/pdf", 15))) &&
|
||||||
|
(evry_file_url_get(file)))
|
||||||
{
|
{
|
||||||
evas_object_del(o);
|
sum = evry_util_md5_sum(file->url);
|
||||||
o = NULL;
|
|
||||||
|
snprintf(thumb_buf, sizeof(thumb_buf),
|
||||||
|
"%s/.thumbnails/normal/%s.png",
|
||||||
|
e_user_homedir_get(), sum);
|
||||||
|
free(sum);
|
||||||
|
|
||||||
|
if ((o = evry_icon_theme_get(thumb_buf, e)))
|
||||||
|
{
|
||||||
|
it->icon = eina_stringshare_add(thumb_buf);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((!it->icon) && (file->mime))
|
||||||
|
{
|
||||||
|
icon = efreet_mime_type_icon_get(file->mime, e_config->icon_theme, 128);
|
||||||
|
/* XXX can do _ref ?*/
|
||||||
|
if ((o = evry_icon_theme_get(icon, e)))
|
||||||
|
{
|
||||||
|
/* it->icon = eina_stringshare_add(icon); */
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((icon = efreet_mime_type_icon_get("unknown", e_config->icon_theme, 128)))
|
||||||
|
it->icon = eina_stringshare_add(icon);
|
||||||
|
else
|
||||||
|
it->icon = eina_stringshare_add("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CHECK_TYPE(it, EVRY_TYPE_APP))
|
||||||
|
{
|
||||||
|
GET_APP(app, it);
|
||||||
|
|
||||||
|
o = e_util_desktop_icon_add(app->desktop, 128, e);
|
||||||
|
if (o) return o;
|
||||||
|
|
||||||
|
o = evry_icon_theme_get("system-run", e);
|
||||||
|
if (o) return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!o && it->icon)
|
if (it->icon)
|
||||||
o = evry_icon_theme_get(it->icon, e);
|
o = evry_icon_theme_get(it->icon, e);
|
||||||
|
if (o) return o;
|
||||||
|
|
||||||
|
if (it->browseable)
|
||||||
|
o = evry_icon_theme_get("folder", e);
|
||||||
|
if (o) return o;
|
||||||
|
|
||||||
|
o = evry_icon_theme_get("unknown", e);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -393,9 +393,8 @@ _e_smart_reconfigure_do(void *data)
|
||||||
Smart_Data *sd = evas_object_smart_data_get(obj);
|
Smart_Data *sd = evas_object_smart_data_get(obj);
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Item *it;
|
Item *it;
|
||||||
int iw, changed = 0;
|
int changed = 0;
|
||||||
Evas_Coord x, y, xx, yy, ww, hh, mw, mh, ox = 0, oy = 0;
|
Evas_Coord x = 0, y = 0, xx, yy, ww, hh, mw = 0, mh = 0;
|
||||||
Evas_Coord aspect_w, aspect_h;
|
|
||||||
|
|
||||||
if (!sd) return ECORE_CALLBACK_CANCEL;
|
if (!sd) return ECORE_CALLBACK_CANCEL;
|
||||||
|
|
||||||
|
@ -407,86 +406,41 @@ _e_smart_reconfigure_do(void *data)
|
||||||
if (sd->cx < 0) sd->cx = 0;
|
if (sd->cx < 0) sd->cx = 0;
|
||||||
if (sd->cy < 0) sd->cy = 0;
|
if (sd->cy < 0) sd->cy = 0;
|
||||||
|
|
||||||
aspect_w = sd->w;
|
|
||||||
aspect_h = sd->h;
|
|
||||||
|
|
||||||
if (sd->view->mode == VIEW_MODE_LIST)
|
if (sd->view->mode == VIEW_MODE_LIST)
|
||||||
{
|
{
|
||||||
iw = sd->w;
|
ww = sd->w;
|
||||||
hh = SIZE_LIST;
|
hh = SIZE_LIST;
|
||||||
}
|
}
|
||||||
else if (sd->view->mode == VIEW_MODE_DETAIL)
|
else if (sd->view->mode == VIEW_MODE_DETAIL)
|
||||||
{
|
{
|
||||||
iw = sd->w;
|
ww = sd->w;
|
||||||
hh = SIZE_DETAIL;
|
hh = SIZE_DETAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int size;
|
int div;
|
||||||
int cnt = eina_list_count(sd->items);
|
|
||||||
double col = 1;
|
|
||||||
int width = sd->w - 8;
|
|
||||||
|
|
||||||
if (cnt < 5)
|
if (sd->view->zoom == 0)
|
||||||
{
|
ww = 96;
|
||||||
col = 2;
|
|
||||||
aspect_w = width * 2;
|
|
||||||
}
|
|
||||||
else if ((cnt < 9) && (sd->w < (double)sd->h * 1.2))
|
|
||||||
{
|
|
||||||
col = 2;
|
|
||||||
aspect_w = width * 3;
|
|
||||||
}
|
|
||||||
else if (cnt < 10)
|
|
||||||
{
|
|
||||||
col = 3;
|
|
||||||
aspect_w = width * 3;
|
|
||||||
}
|
|
||||||
else if (sd->view->zoom == 0)
|
|
||||||
{
|
|
||||||
size = 96;
|
|
||||||
aspect_w = width * (1 + (sd->h / size));
|
|
||||||
col = width / size;
|
|
||||||
}
|
|
||||||
else if (sd->view->zoom == 1)
|
else if (sd->view->zoom == 1)
|
||||||
{
|
ww = 128;
|
||||||
size = 128;
|
|
||||||
col = width / size;
|
|
||||||
aspect_w = width * (1 + (sd->h / size));
|
|
||||||
}
|
|
||||||
|
|
||||||
else /* if (sd->view->zoom == 2) */
|
else /* if (sd->view->zoom == 2) */
|
||||||
{
|
ww = 192;
|
||||||
size = 192;
|
|
||||||
col = width / size;
|
|
||||||
aspect_w = width * (1 + (sd->h / size));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (col < 1) col = 1;
|
div = sd->w / ww;
|
||||||
|
if (div < 1) div = 1;
|
||||||
|
ww += (sd->w - div * ww) / div;
|
||||||
|
|
||||||
iw = width / col;
|
div = sd->h / div;
|
||||||
aspect_w /= col;
|
if (div < 1) div = 1;
|
||||||
|
hh = ww + (sd->h - div * ww) / div;
|
||||||
|
|
||||||
|
if (hh > ww)
|
||||||
|
hh = ww + (sd->h - (div + 1) * ww) / (div + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aspect_w <= 0) aspect_w = 1;
|
|
||||||
if (aspect_h <= 0) aspect_h = 1;
|
|
||||||
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
ww = iw;
|
|
||||||
|
|
||||||
if (sd->view->mode == VIEW_MODE_THUMB)
|
|
||||||
hh = (aspect_h * iw) / (aspect_w);
|
|
||||||
|
|
||||||
mw = mh = 0;
|
|
||||||
EINA_LIST_FOREACH(sd->items, l, it)
|
EINA_LIST_FOREACH(sd->items, l, it)
|
||||||
{
|
{
|
||||||
if (x > (sd->w - ww))
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
y += hh;
|
|
||||||
}
|
|
||||||
|
|
||||||
it->x = x;
|
it->x = x;
|
||||||
it->y = y;
|
it->y = y;
|
||||||
it->w = ww;
|
it->w = ww;
|
||||||
|
@ -495,10 +449,16 @@ _e_smart_reconfigure_do(void *data)
|
||||||
if ((x + ww) > mw) mw = x + ww;
|
if ((x + ww) > mw) mw = x + ww;
|
||||||
if ((y + hh) > mh) mh = y + hh;
|
if ((y + hh) > mh) mh = y + hh;
|
||||||
x += ww;
|
x += ww;
|
||||||
|
|
||||||
|
if (x <= (sd->w - ww))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
y += hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd->view->mode == VIEW_MODE_LIST ||
|
if ((sd->view->mode == VIEW_MODE_LIST) ||
|
||||||
sd->view->mode == VIEW_MODE_DETAIL)
|
(sd->view->mode == VIEW_MODE_DETAIL))
|
||||||
mh += sd->h % hh;
|
mh += sd->h % hh;
|
||||||
|
|
||||||
if ((mw != sd->cw) || (mh != sd->ch))
|
if ((mw != sd->cw) || (mh != sd->ch))
|
||||||
|
@ -518,16 +478,10 @@ _e_smart_reconfigure_do(void *data)
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd->view->mode == VIEW_MODE_THUMB)
|
|
||||||
{
|
|
||||||
if (sd->w > sd->cw) ox = (sd->w - sd->cw) / 2;
|
|
||||||
if (sd->h > sd->ch) oy = (sd->h - sd->ch) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sd->items, l, it)
|
EINA_LIST_FOREACH(sd->items, l, it)
|
||||||
{
|
{
|
||||||
xx = sd->x - sd->cx + it->x + ox;
|
xx = sd->x - sd->cx + it->x;
|
||||||
yy = sd->y - sd->cy + it->y + oy;
|
yy = sd->y - sd->cy + it->y;
|
||||||
|
|
||||||
if (E_INTERSECTS(xx, yy, it->w, it->h, 0, sd->y - it->h,
|
if (E_INTERSECTS(xx, yy, it->w, it->h, 0, sd->y - it->h,
|
||||||
sd->x + sd->w, sd->y + sd->h + it->h))
|
sd->x + sd->w, sd->y + sd->h + it->h))
|
||||||
|
|
Loading…
Reference in New Issue