2005-05-17 22:06:05 -07:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
/* gadcon requirements */
|
2006-05-31 09:31:51 -07:00
|
|
|
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
2006-02-10 01:26:12 -08:00
|
|
|
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
2008-11-03 19:57:45 -08:00
|
|
|
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
2012-07-27 01:25:22 -07:00
|
|
|
static const char *_gc_label(const E_Gadcon_Client_Class *client_class);
|
|
|
|
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas);
|
|
|
|
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class);
|
2006-02-10 01:26:12 -08:00
|
|
|
/* and actually define the gadcon class that this module provides (just 1) */
|
|
|
|
static const E_Gadcon_Client_Class _gadcon_class =
|
|
|
|
{
|
|
|
|
GADCON_CLIENT_CLASS_VERSION,
|
|
|
|
"start",
|
|
|
|
{
|
List of changes:
1. Gadcon sities:
-- 'E_Gadcon_Site' enum to list all available sities,
-- added 'is_site' callback for distinguish gadcon sities,
-- 'e_gadcon_site_is_*' helpers written to use in gadget modules,
-- gadcon config dialogs modified to show only gadgets that appropriate
to selected gadcon site,
-- all gadget modules updated for using new callback.
When callback is not provided in module, then gadget can be used in
any gadcon site.
2. Filemanager:
-- added error icon to unexisting path dialog,
-- added callback 'func.abort' to 'E_Fm2_Op_Registry_Entry' to specify
abort operation sequence (if not provided, then operation is not
cancelable),
-- added parameter to 'e_fm2_op_registry_entry_add' to specify abort
method on construct 'E_Fm2_Op_Registry_Entry' or make non-cancelable
operation if this function is not provided,
-- added 'e_fm2_operation_abort' call to cancel efm2 operation,
-- added method '_e_fm2_operation_abort_internal' that represent efm2
default handler of operation cancelling,
-- 'done' and 'total' fields of 'E_Fm2_Op_Registry_Entry' changed to
off_t type, also all message handlers modified to work with it
(to show progress for large files correctly),
-- improved file operation progress processing,
-- added cancel button to operation progress gadget in filemanager window,
-- added delete file glyph to operation progress gadget,
-- improved status message for efm2 operation progress.
3. Filemanager slave:
-- fixed critical bug in message handling via stdin/stdout,
-- fixed critical bug in removing task from list,
-- improved 'E_FM_OP_ABORT' handling,
-- fix rollback counting on moving files.
4. Fileman_opinfo module:
-- a new theme writed: status string and gadget for view operation status
in summary and detail modes,
-- summary mode: operation glyph, state message, progressbar, abort button,
-- detail mode: all for summary + from filename, to filename,
-- summary/detailed button works as trigger,
-- added source of module theme and used images.
4. Pathbar module:
-- non-critical fix, just for safety.
Also patch contains several minor updates to serve main task.
SVN revision: 41224
2009-06-29 07:38:03 -07:00
|
|
|
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
|
|
|
|
e_gadcon_site_is_not_toolbar
|
2006-08-08 23:38:35 -07:00
|
|
|
},
|
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
2005-09-23 10:13:47 -07:00
|
|
|
};
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
/* actual module specifics */
|
|
|
|
typedef struct _Instance Instance;
|
2005-05-17 22:06:05 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
struct _Instance
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
Evas_Object *o_button;
|
|
|
|
E_Menu *main_menu;
|
|
|
|
};
|
2006-01-19 20:04:14 -08:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _menu_cb_post(void *data, E_Menu *m);
|
2005-05-17 22:06:05 -07:00
|
|
|
|
2006-05-09 06:02:48 -07:00
|
|
|
static E_Module *start_module = NULL;
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
static E_Gadcon_Client *
|
2006-05-31 09:31:51 -07:00
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o;
|
2006-02-10 01:26:12 -08:00
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
Instance *inst;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
inst = E_NEW(Instance, 1);
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
o = edje_object_add(gc->evas);
|
2010-08-19 09:05:16 -07:00
|
|
|
e_theme_edje_object_set(o, "base/theme/modules/start",
|
|
|
|
"e/modules/start/main");
|
2006-08-22 00:39:11 -07:00
|
|
|
edje_object_signal_emit(o, "e,state,unfocused", "e");
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-12-30 15:32:25 -08:00
|
|
|
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
2006-02-10 01:26:12 -08:00
|
|
|
gcc->data = inst;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
inst->gcc = gcc;
|
|
|
|
inst->o_button = o;
|
|
|
|
inst->main_menu = NULL;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-04-20 04:30:25 -07:00
|
|
|
e_gadcon_client_util_menu_attach(gcc);
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
|
|
|
_button_cb_mouse_down, inst);
|
|
|
|
return gcc;
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
2006-02-10 01:26:12 -08:00
|
|
|
|
2005-05-17 22:06:05 -07:00
|
|
|
static void
|
2006-02-10 01:26:12 -08:00
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
Instance *inst;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
inst = gcc->data;
|
2006-04-21 08:54:11 -07:00
|
|
|
if (inst->main_menu)
|
|
|
|
{
|
|
|
|
e_menu_post_deactivate_callback_set(inst->main_menu, NULL, NULL);
|
|
|
|
e_object_del(E_OBJECT(inst->main_menu));
|
|
|
|
inst->main_menu = NULL;
|
|
|
|
}
|
2006-04-20 04:30:25 -07:00
|
|
|
evas_object_del(inst->o_button);
|
2006-02-10 01:26:12 -08:00
|
|
|
free(inst);
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
2006-02-10 01:26:12 -08:00
|
|
|
|
2005-05-17 22:06:05 -07:00
|
|
|
static void
|
2012-10-23 07:56:02 -07:00
|
|
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
Instance *inst;
|
2008-03-04 20:01:40 -08:00
|
|
|
Evas_Coord mw, mh;
|
2012-10-23 07:56:02 -07:00
|
|
|
char buf[4096];
|
|
|
|
const char *s = "float";
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
inst = gcc->data;
|
2012-10-23 07:56:02 -07:00
|
|
|
switch (orient)
|
|
|
|
{
|
|
|
|
case E_GADCON_ORIENT_FLOAT:
|
|
|
|
s = "float";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_HORIZ:
|
|
|
|
s = "horizontal";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_VERT:
|
|
|
|
s = "vertical";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_LEFT:
|
|
|
|
s = "left";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_RIGHT:
|
|
|
|
s = "right";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_TOP:
|
|
|
|
s = "top";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_BOTTOM:
|
|
|
|
s = "bottom";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_TL:
|
|
|
|
s = "top_left";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_TR:
|
|
|
|
s = "top_right";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_BL:
|
|
|
|
s = "bottom_left";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_BR:
|
|
|
|
s = "bottom_right";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_LT:
|
|
|
|
s = "left_top";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_RT:
|
|
|
|
s = "right_top";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_LB:
|
|
|
|
s = "left_bottom";
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_RB:
|
|
|
|
s = "right_bottom";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
snprintf(buf, sizeof(buf), "e,state,orientation,%s", s);
|
|
|
|
edje_object_signal_emit(inst->o_button, buf, "e");
|
|
|
|
edje_object_message_signal_process(inst->o_button);
|
|
|
|
|
2008-03-04 22:00:25 -08:00
|
|
|
mw = 0, mh = 0;
|
|
|
|
edje_object_size_min_get(inst->o_button, &mw, &mh);
|
|
|
|
if ((mw < 1) || (mh < 1))
|
|
|
|
edje_object_size_min_calc(inst->o_button, &mw, &mh);
|
|
|
|
if (mw < 4) mw = 4;
|
|
|
|
if (mh < 4) mh = 4;
|
|
|
|
e_gadcon_client_aspect_set(gcc, mw, mh);
|
|
|
|
e_gadcon_client_min_size_set(gcc, mw, mh);
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
2006-05-09 06:02:48 -07:00
|
|
|
|
2011-11-14 13:46:57 -08:00
|
|
|
static const char *
|
2012-07-27 01:25:22 -07:00
|
|
|
_gc_label(const E_Gadcon_Client_Class *client_class __UNUSED__)
|
2006-05-09 06:02:48 -07:00
|
|
|
{
|
|
|
|
return _("Start");
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2012-07-27 01:25:22 -07:00
|
|
|
_gc_icon(const E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas)
|
2006-05-09 06:02:48 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o;
|
2010-08-19 09:05:16 -07:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2006-05-09 06:02:48 -07:00
|
|
|
o = edje_object_add(evas);
|
2007-03-24 16:12:23 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-start.edj",
|
2006-05-09 06:02:48 -07:00
|
|
|
e_module_dir_get(start_module));
|
|
|
|
edje_object_file_set(o, buf, "icon");
|
|
|
|
return o;
|
|
|
|
}
|
2007-09-15 17:02:53 -07:00
|
|
|
|
|
|
|
static const char *
|
2012-07-27 01:25:22 -07:00
|
|
|
_gc_id_new(const E_Gadcon_Client_Class *client_class __UNUSED__)
|
2007-09-15 17:02:53 -07:00
|
|
|
{
|
|
|
|
return _gadcon_class.name;
|
|
|
|
}
|
|
|
|
|
2005-05-17 22:06:05 -07:00
|
|
|
static void
|
2010-08-19 09:05:16 -07:00
|
|
|
_button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
Instance *inst;
|
|
|
|
Evas_Event_Mouse_Down *ev;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
inst = data;
|
|
|
|
ev = event_info;
|
|
|
|
if (ev->button == 1)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
2008-11-07 21:56:39 -08:00
|
|
|
int cx, cy;
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
evas_object_geometry_get(inst->o_button, &x, &y, &w, &h);
|
2006-04-20 04:30:25 -07:00
|
|
|
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
|
2008-11-07 21:56:39 -08:00
|
|
|
&cx, &cy, NULL, NULL);
|
2006-02-10 04:21:22 -08:00
|
|
|
x += cx;
|
|
|
|
y += cy;
|
2006-02-10 01:26:12 -08:00
|
|
|
if (!inst->main_menu)
|
|
|
|
inst->main_menu = e_int_menus_main_new();
|
|
|
|
if (inst->main_menu)
|
|
|
|
{
|
2006-02-10 04:21:22 -08:00
|
|
|
int dir;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
e_menu_post_deactivate_callback_set(inst->main_menu,
|
2010-08-19 09:05:16 -07:00
|
|
|
_menu_cb_post, inst);
|
2006-02-10 04:21:22 -08:00
|
|
|
switch (inst->gcc->gadcon->orient)
|
|
|
|
{
|
|
|
|
case E_GADCON_ORIENT_TOP:
|
|
|
|
dir = E_MENU_POP_DIRECTION_DOWN;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_BOTTOM:
|
|
|
|
dir = E_MENU_POP_DIRECTION_UP;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_LEFT:
|
|
|
|
dir = E_MENU_POP_DIRECTION_RIGHT;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_RIGHT:
|
|
|
|
dir = E_MENU_POP_DIRECTION_LEFT;
|
|
|
|
break;
|
2006-02-14 05:09:01 -08:00
|
|
|
case E_GADCON_ORIENT_CORNER_TL:
|
2006-04-22 23:56:22 -07:00
|
|
|
dir = E_MENU_POP_DIRECTION_DOWN;
|
|
|
|
break;
|
2006-02-14 05:09:01 -08:00
|
|
|
case E_GADCON_ORIENT_CORNER_TR:
|
2006-04-22 23:56:22 -07:00
|
|
|
dir = E_MENU_POP_DIRECTION_DOWN;
|
|
|
|
break;
|
2006-02-14 05:09:01 -08:00
|
|
|
case E_GADCON_ORIENT_CORNER_BL:
|
2006-04-22 23:56:22 -07:00
|
|
|
dir = E_MENU_POP_DIRECTION_UP;
|
|
|
|
break;
|
2006-02-14 05:09:01 -08:00
|
|
|
case E_GADCON_ORIENT_CORNER_BR:
|
2006-04-22 23:56:22 -07:00
|
|
|
dir = E_MENU_POP_DIRECTION_UP;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_LT:
|
|
|
|
dir = E_MENU_POP_DIRECTION_RIGHT;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_RT:
|
|
|
|
dir = E_MENU_POP_DIRECTION_LEFT;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_LB:
|
|
|
|
dir = E_MENU_POP_DIRECTION_RIGHT;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_CORNER_RB:
|
|
|
|
dir = E_MENU_POP_DIRECTION_LEFT;
|
|
|
|
break;
|
|
|
|
case E_GADCON_ORIENT_FLOAT:
|
|
|
|
case E_GADCON_ORIENT_HORIZ:
|
|
|
|
case E_GADCON_ORIENT_VERT:
|
2006-02-10 04:21:22 -08:00
|
|
|
default:
|
2006-02-14 05:09:01 -08:00
|
|
|
dir = E_MENU_POP_DIRECTION_AUTO;
|
2006-02-10 04:21:22 -08:00
|
|
|
break;
|
|
|
|
}
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2009-01-24 06:09:37 -08:00
|
|
|
e_gadcon_locked_set(inst->gcc->gadcon, 1);
|
2006-02-10 01:26:12 -08:00
|
|
|
e_menu_activate_mouse(inst->main_menu,
|
|
|
|
e_util_zone_current_get(e_manager_current_get()),
|
2010-08-19 09:05:16 -07:00
|
|
|
x, y, w, h, dir, ev->timestamp);
|
2006-08-22 00:39:11 -07:00
|
|
|
edje_object_signal_emit(inst->o_button, "e,state,focused", "e");
|
2006-02-10 01:26:12 -08:00
|
|
|
}
|
|
|
|
}
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-08-19 09:05:16 -07:00
|
|
|
_menu_cb_post(void *data, E_Menu *m __UNUSED__)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
Instance *inst;
|
2010-08-19 09:05:16 -07:00
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
inst = data;
|
|
|
|
if (!inst->main_menu) return;
|
2009-01-24 06:09:37 -08:00
|
|
|
e_gadcon_locked_set(inst->gcc->gadcon, 0);
|
2006-08-22 00:39:11 -07:00
|
|
|
edje_object_signal_emit(inst->o_button, "e,state,unfocused", "e");
|
2006-02-10 01:26:12 -08:00
|
|
|
e_object_del(E_OBJECT(inst->main_menu));
|
|
|
|
inst->main_menu = NULL;
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
/* module setup */
|
|
|
|
EAPI E_Module_Api e_modapi =
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
E_MODULE_API_VERSION,
|
|
|
|
"Start"
|
|
|
|
};
|
2005-05-17 22:06:05 -07:00
|
|
|
|
2006-06-06 08:33:44 -07:00
|
|
|
EAPI void *
|
2006-02-10 01:26:12 -08:00
|
|
|
e_modapi_init(E_Module *m)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-05-09 06:02:48 -07:00
|
|
|
start_module = m;
|
2006-02-10 01:26:12 -08:00
|
|
|
e_gadcon_provider_register(&_gadcon_class);
|
2006-07-24 21:15:11 -07:00
|
|
|
return m;
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
EAPI int
|
2010-08-19 09:05:16 -07:00
|
|
|
e_modapi_shutdown(E_Module *m __UNUSED__)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-05-09 06:02:48 -07:00
|
|
|
start_module = NULL;
|
2006-02-10 01:26:12 -08:00
|
|
|
e_gadcon_provider_unregister(&_gadcon_class);
|
|
|
|
return 1;
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|
|
|
|
|
2006-02-10 01:26:12 -08:00
|
|
|
EAPI int
|
2010-08-19 09:05:16 -07:00
|
|
|
e_modapi_save(E_Module *m __UNUSED__)
|
2005-05-17 22:06:05 -07:00
|
|
|
{
|
2006-02-10 01:26:12 -08:00
|
|
|
return 1;
|
2005-05-17 22:06:05 -07:00
|
|
|
}
|