diff --git a/data/themes/default.edc b/data/themes/default.edc index d2d4f004e..9f424fffb 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -11881,6 +11881,9 @@ collections { /* begin the collection of edje groups that are in this file */ } group { name: "e/fileman/default/progress"; min: 250 40; + images { + image: "icon_efm_file_del.png" COMP; + } parts { part { name: "bg"; type: IMAGE; @@ -11910,7 +11913,7 @@ collections { /* begin the collection of edje groups that are in this file */ description { state: "default" 0.0; min: 32 32; max: 32 32; - align: 0.02 0.5; + align: 0.01 0.5; rel1.to: "bg"; rel2.to: "bg"; image.normal: "icon_efm_dnd_ask.png"; @@ -11923,6 +11926,10 @@ collections { /* begin the collection of edje groups that are in this file */ inherit: "default" 0.0; image.normal: "icon_efm_dnd_move.png"; } + description { state: "delete" 0.0; + inherit: "default" 0.0; + image.normal: "icon_efm_file_del.png"; + } } part { name: "gauge_bg"; type: IMAGE; @@ -11964,15 +11971,21 @@ collections { /* begin the collection of edje groups that are in this file */ confine:"gauge_confine"; } } - part { name: "e.text.label1"; + part { name: "e.text.info"; type: TEXT; mouse_events: 0; scale: 1; description { state: "default" 0.0; - rel1.to: "icon"; - rel1.relative: 1.0 0.0; - rel2.to: "bg"; - rel2.relative: 1.0 0.6; + rel1 { + relative: 1.0 0.0; + to_x: "icon"; + to_y: "bg"; + } + rel2 { + relative: 0.0 0.6; + to_x: "bt_abort"; + to_y: "icon"; + } color: 0 0 0 255; text { font: "Sans"; @@ -11982,26 +11995,73 @@ collections { /* begin the collection of edje groups that are in this file */ } } } - //~ part { name: "e.text.label2"; - //~ type: TEXT; - //~ mouse_events: 0; - //~ scale: 1; - //~ description { state: "default" 0.0; - //~ align: 0.5 0.0; - //~ rel1.to: "e.text.label1"; - //~ rel1.relative: 0.0 1.3; - //~ //rel1.offset: 5 0; - //~ rel2.to: "e.text.label1"; - //~ rel2.relative: 1.0 3.0; - //~ color: 0 0 0 255; - //~ text { - //~ font: "Sans"; - //~ size: 9; - //~ min: 1 0; - //~ align: 0.0 1.0; - //~ } - //~ } - //~ } + part { name: "bt_abort"; + type: IMAGE; + mouse_events: 0; + description { state: "default" 0.0; + align: 1.0 0.5; + min: 19 19; + max: 19 19; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel1 { + relative: 1.0 0.0; + to_x: "e.text.info"; + to_y: "bg"; + } + rel2 { + relative: 0.99 1.0; + to_x: "bg"; + to_y: "e.text.info"; + } + image.normal: "bd_button_close_shadow.png"; + } + } + part { name: "bt_abort_unfoc"; + type: IMAGE; + mouse_events: 0; + description { state: "default" 0.0; + visible: 1; + color: 255 255 255 255; + rel1.to: "bt_abort"; + rel2.to: "bt_abort"; + image.normal: "bd_button_close_unfocused.png"; + } + description { state: "active" 0.0; + inherit: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1.offset: 0 1; + rel2.offset: -1 0; + } + } + part { name: "bt_abort_foc"; + type: IMAGE; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1.to: "bt_abort"; + rel2.to: "bt_abort"; + image.normal: "bd_button_close_focused.png"; + } + description { state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + rel1.offset: 0 1; + rel2.offset: -1 0; + } + } + part { name: "e.event.abort"; + type: RECT; + mouse_events: 1; + description { state: "default" 0.0; + rel1.to: "bt_abort"; + rel2.to: "bt_abort"; + color: 0 0 0 0; + } + } } programs { program { name: "set_need_attention"; @@ -12043,6 +12103,31 @@ collections { /* begin the collection of edje groups that are in this file */ action: STATE_SET "move" 0.0; target: "icon"; } + program { name: "set_icon_delete"; + signal: "e,action,icon,delete"; + source: "e"; + action: STATE_SET "delete" 0.0; + target: "icon"; + } + program { name: "bt_abort_down"; + signal: "mouse,down,*"; + source: "e.event.abort"; + action: STATE_SET "active" 0.0; + target: "bt_abort_unfoc"; + target: "bt_abort_foc"; + } + program { name: "bt_abort_up"; + signal: "mouse,up,*"; + source: "e.event.abort"; + action: STATE_SET "default" 0.0; + target: "bt_abort_unfoc"; + target: "bt_abort_foc"; + } + program { name: "bt_abort_click"; + signal: "mouse,clicked,*"; + source: "e.event.abort"; + action: SIGNAL_EMIT "e,fm,operation,abort" ""; + } } } group { name: "e/fileman/default/scrollframe"; diff --git a/data/themes/images/icon_efm_file_del.png b/data/themes/images/icon_efm_file_del.png new file mode 100644 index 000000000..019e3d610 Binary files /dev/null and b/data/themes/images/icon_efm_file_del.png differ diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index a47b26c79..7d43c270b 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -419,6 +419,8 @@ static void _e_fm2_volume_eject(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_fm2_icon_removable_update(E_Fm2_Icon *ic); static void _e_fm2_volume_icon_update(E_Volume *v); +static void _e_fm2_operation_abort_internal(E_Fm2_Op_Registry_Entry *ere); + static char *_e_fm2_meta_path = NULL; static Evas_Smart *_e_fm2_smart = NULL; static Eina_List *_e_fm2_list = NULL; @@ -630,7 +632,7 @@ _e_fm2_op_registry_entry_print(const E_Fm2_Op_Registry_Entry *ere) status = status_strings[0]; printf("id: %8d, op: %2d [%s] finished: %hhu, needs_attention: %hhu\n" - " %3d%% (%8zd/%8zd), start_time: %10.0f, eta: %5ds, xwin: %#x\n" + " %3d%% (%lld/%lld), start_time: %10.0f, eta: %5ds, xwin: %#x\n" " src=[%s]\n" " dst=[%s]\n", ere->id, ere->op, status, ere->finished, ere->needs_attention, @@ -933,6 +935,7 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) e_dialog_button_add(dialog, _("Close"), NULL, NULL, dialog); e_dialog_button_focus_num(dialog, 0); e_dialog_title_set(dialog, _("Nonexistent path")); + e_dialog_icon_set(dialog, "dialog-error", 64); snprintf(text, sizeof(text), _("%s doesn't exist."), @@ -2463,7 +2466,7 @@ static int _e_fm_client_file_del(const char *files, Evas_Object *e_fm) { int id = _e_fm_client_send_new(E_FM_OP_REMOVE, (void *)files, strlen(files) + 1); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_REMOVE); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_REMOVE, _e_fm2_operation_abort_internal); return id; } @@ -2471,7 +2474,7 @@ static int _e_fm2_client_file_trash(const char *path, Evas_Object *e_fm) { int id = _e_fm_client_send_new(E_FM_OP_TRASH, (void *)path, strlen(path) + 1); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_TRASH); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_TRASH, _e_fm2_operation_abort_internal); return id; } @@ -2492,7 +2495,7 @@ _e_fm2_client_file_mkdir(const char *path, const char *rel, int rel_to, int x, i memcpy(d + l1 + 1 + l2 + 1 + (2 * sizeof(int)), &y, sizeof(int)); id = _e_fm_client_send_new(E_FM_OP_MKDIR, (void *)d, l); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_MKDIR); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_MKDIR, _e_fm2_operation_abort_internal); return id; } @@ -2500,7 +2503,7 @@ static int _e_fm_client_file_move(const char *args, Evas_Object *e_fm) { int id = _e_fm_client_send_new(E_FM_OP_MOVE, (void *)args, strlen(args) + 1); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_MOVE); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_MOVE, _e_fm2_operation_abort_internal); return id; } @@ -2543,7 +2546,7 @@ _e_fm2_client_file_symlink(const char *path, const char *dest, const char *rel, } id = _e_fm_client_send_new(E_FM_OP_SYMLINK, (void *)d, l); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_SYMLINK); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_SYMLINK, _e_fm2_operation_abort_internal); return id; #else char *args = NULL; @@ -2564,7 +2567,7 @@ static int _e_fm_client_file_copy(const char *args, Evas_Object *e_fm) { int id = _e_fm_client_send_new(E_FM_OP_COPY, (void *)args, strlen(args) + 1); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_COPY); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_COPY, _e_fm2_operation_abort_internal); return id; } @@ -2572,7 +2575,7 @@ static int _e_fm_client_file_symlink(const char *args, Evas_Object *e_fm) { int id = _e_fm_client_send_new(E_FM_OP_SYMLINK, (void *)args, strlen(args) + 1); - e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_SYMLINK); + e_fm2_op_registry_entry_add(id, e_fm, E_FM_OP_SYMLINK, _e_fm2_operation_abort_internal); return id; } @@ -3085,7 +3088,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) case E_FM_OP_PROGRESS:/*progress*/ { int percent, seconds; - size_t done, total; + off_t done, total; char *src = NULL; char *dst = NULL; void *p = e->data; @@ -3095,8 +3098,8 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) #define UP(value, type) (value) = *(type *)p; p += sizeof(type) UP(percent, int); UP(seconds, int); - UP(done, size_t); - UP(total, size_t); + UP(done, off_t); + UP(total, off_t); #undef UP src = p; dst = p + strlen(src) + 1; @@ -3119,8 +3122,17 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) break; case E_FM_OP_QUIT:/*finished*/ - e_fm2_op_registry_entry_del(e->ref); - break; + { + E_Fm2_Op_Registry_Entry *ere = e_fm2_op_registry_entry_get(e->ref); + if (ere) + { + ere->finished = 1; + ere->eta = 0; + e_fm2_op_registry_entry_changed(ere); + } + e_fm2_op_registry_entry_del(e->ref); + } + break; default: break; @@ -9803,3 +9815,26 @@ _e_fm2_icon_removable_update(E_Fm2_Icon *ic) v = e_fm2_hal_volume_find(ic->info.link); _update_volume_icon(v, ic); } + +static void +_e_fm2_operation_abort_internal(E_Fm2_Op_Registry_Entry *ere) +{ + ere->status = E_FM2_OP_STATUS_ABORTED; + ere->finished = 1; + ere->needs_attention = 0; + e_fm2_op_registry_entry_changed(ere); + _e_fm_client_send(E_FM_OP_ABORT, ere->id, NULL, 0); +} + +EAPI void +e_fm2_operation_abort(int id) +{ + E_Fm2_Op_Registry_Entry *ere; + + ere = e_fm2_op_registry_entry_get(id); + if (!ere) return; + + e_fm2_op_registry_entry_ref(ere); + e_fm2_op_registry_entry_abort(ere); + e_fm2_op_registry_entry_unref(ere); +} diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index 170dfb9be..b8480ea62 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -168,6 +168,8 @@ EAPI void e_fm2_pan_child_size_get(Evas_Object *obj, Evas_Coord EAPI void e_fm2_all_icons_update(void); +EAPI void e_fm2_operation_abort(int id); + EAPI Evas_Object * e_fm2_icon_get(Evas *evas, E_Fm2_Icon *ic, void (*gen_func) (void *data, Evas_Object *obj, void *event_info), diff --git a/src/bin/e_fm_main.c b/src/bin/e_fm_main.c index 60386fb9c..845d734fa 100644 --- a/src/bin/e_fm_main.c +++ b/src/bin/e_fm_main.c @@ -1639,6 +1639,13 @@ _e_ipc_cb_server_data(void *data, int type, void *event) } } break; + case E_FM_OP_ABORT: // abort copy/move/delete operation by user + { + E_Fm_Slave *slave = _e_fm_slave_get(e->ref); + if (slave) + _e_fm_slave_send(slave, e->minor, NULL, 0); + } + break; case E_FM_OP_ERROR_RESPONSE_IGNORE_THIS: case E_FM_OP_ERROR_RESPONSE_IGNORE_ALL: case E_FM_OP_ERROR_RESPONSE_ABORT: @@ -1777,8 +1784,8 @@ static int _e_fm_slave_data_cb(void *data, int type, void *event) sdata = e->data; ssize = e->size; - while (ssize) - { + while (ssize >= 3 * sizeof(int)) + { memcpy(&magic, sdata, sizeof(int)); memcpy(&id, sdata + sizeof(int), sizeof(int)); memcpy(&size, sdata + sizeof(int) + sizeof(int), sizeof(int)); @@ -1786,6 +1793,7 @@ static int _e_fm_slave_data_cb(void *data, int type, void *event) if (magic != E_FM_OP_MAGIC) { printf("%s:%s(%d) Wrong magic number from slave #%d. ", __FILE__, __FUNCTION__, __LINE__, slave->id); + break; } sdata += 3 * sizeof(int); diff --git a/src/bin/e_fm_op.c b/src/bin/e_fm_op.c index f04fbde16..1f3ddbe8c 100644 --- a/src/bin/e_fm_op.c +++ b/src/bin/e_fm_op.c @@ -52,7 +52,7 @@ static int _e_fm_op_scan_idler(void *data); static void _e_fm_op_send_error(E_Fm_Op_Task * task, E_Fm_Op_Type type, const char *fmt, ...); static void _e_fm_op_rollback(E_Fm_Op_Task * task); static void _e_fm_op_update_progress_report_simple(int percent, const char *src, const char *dst); -static void _e_fm_op_update_progress(E_Fm_Op_Task *task, long long _plus_e_fm_op_done, long long _plus_e_fm_op_total); +static void _e_fm_op_update_progress(E_Fm_Op_Task *task, off_t _plus_e_fm_op_done, off_t _plus_e_fm_op_total); static void _e_fm_op_copy_stat_info(E_Fm_Op_Task *task); static int _e_fm_op_handle_overwrite(E_Fm_Op_Task *task); @@ -73,7 +73,7 @@ Ecore_Fd_Handler *_e_fm_op_stdin_handler = NULL; Eina_List *_e_fm_op_work_queue = NULL, *_e_fm_op_scan_queue = NULL; Ecore_Idler *_e_fm_op_work_idler_p = NULL, *_e_fm_op_scan_idler_p = NULL; -long long _e_fm_op_done, _e_fm_op_total; /* Type long long should be 64 bits wide everywhere, +off_t _e_fm_op_done, _e_fm_op_total; /* Type long long should be 64 bits wide everywhere, this means that it's max value is 2^63 - 1, which is 8 388 608 terabytes, and this should be enough. Well, we'll be multipling _e_fm_op_done by 100, but @@ -370,11 +370,14 @@ _e_fm_op_task_free(void *t) static void _e_fm_op_remove_link_task(E_Fm_Op_Task *task) { + E_Fm_Op_Task *ltask; + if (task->link) { + ltask = eina_list_data_get(task->link); _e_fm_op_work_queue = eina_list_remove_list(_e_fm_op_work_queue, task->link); - _e_fm_op_task_free(task->link); + _e_fm_op_task_free(ltask); task->link = NULL; } } @@ -892,13 +895,14 @@ _e_fm_op_rollback(E_Fm_Op_Task *task) } if (task->type == E_FM_OP_COPY) - _e_fm_op_update_progress(task, -task->dst.done, -task->src.st.st_size); + _e_fm_op_update_progress(task, -task->dst.done, + -task->src.st.st_size - (task->link ? REMOVECHUNKSIZE : 0)); else _e_fm_op_update_progress(task, -REMOVECHUNKSIZE, -REMOVECHUNKSIZE); } static void -_e_fm_op_update_progress_report(int percent, int eta, double elapsed, size_t done, size_t total, const char *src, const char *dst) +_e_fm_op_update_progress_report(int percent, int eta, double elapsed, off_t done, off_t total, const char *src, const char *dst) { const int magic = E_FM_OP_MAGIC; const int id = E_FM_OP_PROGRESS; @@ -908,7 +912,7 @@ _e_fm_op_update_progress_report(int percent, int eta, double elapsed, size_t don src_len = strlen(src); dst_len = strlen(dst); - size = 2 * sizeof(int) + 2 * sizeof(size_t) + src_len + 1 + dst_len + 1; + size = 2 * sizeof(int) + 2 * sizeof(off_t) + src_len + 1 + dst_len + 1; data = alloca(3 * sizeof(int) + size); if (!data) return; p = data; @@ -921,7 +925,7 @@ _e_fm_op_update_progress_report(int percent, int eta, double elapsed, size_t don P(eta); #undef P -#define P(value) memcpy(p, &(value), sizeof(size_t)); p += sizeof(size_t) +#define P(value) memcpy(p, &(value), sizeof(off_t)); p += sizeof(off_t) P(done); P(total); #undef P @@ -955,7 +959,7 @@ _e_fm_op_update_progress_report_simple(int percent, const char *src, const char * packed and written to STDOUT. */ static void -_e_fm_op_update_progress(E_Fm_Op_Task *task, long long _plus_e_fm_op_done, long long _plus_e_fm_op_total) +_e_fm_op_update_progress(E_Fm_Op_Task *task, off_t _plus_e_fm_op_done, off_t _plus_e_fm_op_total) { static int ppercent = -1; int percent; diff --git a/src/bin/e_fm_op_registry.c b/src/bin/e_fm_op_registry.c index b52083cb1..629ccc670 100644 --- a/src/bin/e_fm_op_registry.c +++ b/src/bin/e_fm_op_registry.c @@ -145,7 +145,7 @@ _e_fm2_op_registry_entry_internal_event(E_Fm2_Op_Registry_Entry_Internal *e, int } Eina_Bool -e_fm2_op_registry_entry_add(int id, Evas_Object *e_fm, E_Fm_Op_Type op) +e_fm2_op_registry_entry_add(int id, Evas_Object *e_fm, E_Fm_Op_Type op, E_Fm2_Op_Registry_Abort_Func abort) { E_Fm2_Op_Registry_Entry_Internal *e; @@ -157,6 +157,7 @@ e_fm2_op_registry_entry_add(int id, Evas_Object *e_fm, E_Fm_Op_Type op) e->entry.start_time = ecore_loop_time_get(); e->entry.op = op; e->entry.status = E_FM2_OP_STATUS_IN_PROGRESS; + e->entry.func.abort = abort; e->references = 1; if (!eina_hash_add(_e_fm2_op_registry, &id, e)) @@ -504,3 +505,12 @@ e_fm2_op_registry_shutdown(void) return 0; } + +EAPI void +e_fm2_op_registry_entry_abort(E_Fm2_Op_Registry_Entry *entry) +{ + if (!entry) return; + + if (entry->func.abort) + entry->func.abort(entry); +} diff --git a/src/bin/e_fm_op_registry.h b/src/bin/e_fm_op_registry.h index 299e1c7cb..d7b39935b 100644 --- a/src/bin/e_fm_op_registry.h +++ b/src/bin/e_fm_op_registry.h @@ -18,12 +18,14 @@ typedef struct _E_Fm2_Op_Registry_Entry E_Fm2_Op_Registry_Entry; #ifndef E_FM_OP_REGISTRY_H #define E_FM_OP_REGISTRY_H +typedef void (*E_Fm2_Op_Registry_Abort_Func)(E_Fm2_Op_Registry_Entry *entry); + struct _E_Fm2_Op_Registry_Entry { int id; int percent; /* XXX use char? */ - size_t done; - size_t total; + off_t done; + off_t total; Evas_Object *e_fm; const char *src; /* stringshared */ const char *dst; /* stringshared */ @@ -33,6 +35,12 @@ struct _E_Fm2_Op_Registry_Entry E_Fm2_Op_Status status; Eina_Bool needs_attention:1; Eina_Bool finished:1; + + // service callbacks + struct + { + E_Fm2_Op_Registry_Abort_Func abort; + } func; }; extern EAPI int E_EVENT_FM_OP_REGISTRY_ADD; @@ -55,12 +63,13 @@ EAPI void e_fm2_op_registry_get_all_free(Eina_List *list); EAPI Eina_Bool e_fm2_op_registry_is_empty(void); EAPI int e_fm2_op_registry_count(void); +EAPI void e_fm2_op_registry_entry_abort(E_Fm2_Op_Registry_Entry *entry); EAPI unsigned int e_fm2_op_registry_init(void); EAPI unsigned int e_fm2_op_registry_shutdown(void); /* E internal/private functions, symbols not exported outside e binary (e_fm.c mainly) */ -Eina_Bool e_fm2_op_registry_entry_add(int id, Evas_Object *e_fm, E_Fm_Op_Type op); +Eina_Bool e_fm2_op_registry_entry_add(int id, Evas_Object *e_fm, E_Fm_Op_Type op, E_Fm2_Op_Registry_Abort_Func abort); Eina_Bool e_fm2_op_registry_entry_del(int id); void e_fm2_op_registry_entry_changed(const E_Fm2_Op_Registry_Entry *entry); void e_fm2_op_registry_entry_e_fm_set(E_Fm2_Op_Registry_Entry *entry, Evas_Object *e_fm); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 9e079c44c..dca171f4a 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -5143,3 +5143,49 @@ _e_gadcon_provider_populate_unrequest(const E_Gadcon_Client_Class *cc) populate_idler = NULL; } } + +EAPI Eina_Bool +e_gadcon_site_is_shelf (E_Gadcon_Site site) +{ + return site == E_GADCON_SITE_SHELF; +} + +EAPI Eina_Bool +e_gadcon_site_is_desktop (E_Gadcon_Site site) +{ + return site == E_GADCON_SITE_DESKTOP; +} + +EAPI Eina_Bool +e_gadcon_site_is_efm_toolbar(E_Gadcon_Site site) +{ + return site == E_GADCON_SITE_EFM_TOOLBAR; +} + +EAPI Eina_Bool +e_gadcon_site_is_any_toolbar(E_Gadcon_Site site) +{ + switch (site) + { + // there should be all toolbar sities identifiers + case E_GADCON_SITE_TOOLBAR: + case E_GADCON_SITE_EFM_TOOLBAR: + return EINA_TRUE; + } + + return EINA_FALSE; +} + +EAPI Eina_Bool +e_gadcon_site_is_not_toolbar(E_Gadcon_Site site) +{ + switch (site) + { + // there should be all toolbar sities identifiers + case E_GADCON_SITE_TOOLBAR: + case E_GADCON_SITE_EFM_TOOLBAR: + return EINA_FALSE; + } + + return EINA_TRUE; +} diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index 2d8ffd9f7..0b97b3b54 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -31,6 +31,16 @@ typedef enum _E_Gadcon_Orient E_GADCON_ORIENT_CORNER_RB } E_Gadcon_Orient; +typedef enum _E_Gadcon_Site +{ + E_GADCON_SITE_UNKNOWN = 0, // when target site is unknown + /* generic sities */ + E_GADCON_SITE_SHELF, + E_GADCON_SITE_DESKTOP, + E_GADCON_SITE_TOOLBAR, // generic toolbar + E_GADCON_SITE_EFM_TOOLBAR // filemanager window toolbar +} E_Gadcon_Site; + #define E_GADCON_CLIENT_STYLE_PLAIN "plain" #define E_GADCON_CLIENT_STYLE_INSET "inset" @@ -134,6 +144,7 @@ struct _E_Gadcon_Client_Class /* Del an id when a gadcon client is removed from the system */ void (*id_del) (E_Gadcon_Client_Class *client_class, const char *id); /* All members below are part of version 3 */ + Eina_Bool (*is_site) (E_Gadcon_Site site); } func; char *default_style; }; @@ -257,5 +268,14 @@ EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc); EAPI void e_gadcon_locked_set(E_Gadcon *gc, int lock); EAPI void e_gadcon_urgent_show(E_Gadcon *gc); +/* site helpers */ + +EAPI Eina_Bool e_gadcon_site_is_shelf (E_Gadcon_Site site); +EAPI Eina_Bool e_gadcon_site_is_desktop (E_Gadcon_Site site); +EAPI Eina_Bool e_gadcon_site_is_efm_toolbar(E_Gadcon_Site site); + +EAPI Eina_Bool e_gadcon_site_is_any_toolbar(E_Gadcon_Site site); // all toolbar sities +EAPI Eina_Bool e_gadcon_site_is_not_toolbar(E_Gadcon_Site site); // all non-toolbar sities + #endif #endif diff --git a/src/bin/e_int_gadcon_config.c b/src/bin/e_int_gadcon_config.c index 1fac27a46..f51ca113c 100644 --- a/src/bin/e_int_gadcon_config.c +++ b/src/bin/e_int_gadcon_config.c @@ -1,8 +1,10 @@ #include "e.h" /* local function protos */ -static void _e_int_gadcon_config(E_Gadcon *gc, const char *title); +static void _e_int_gadcon_config(E_Gadcon *gc, const char *title, void *(*data_func)(E_Config_Dialog*)); static void *_create_data(E_Config_Dialog *cfd); +static void *_create_data_shelf(E_Config_Dialog *cfd); +static void *_create_data_toolbar(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static int _cb_mod_update(void *data, int type, void *event); @@ -17,6 +19,8 @@ static int _gad_list_sort(void *data1, void *data2); struct _E_Config_Dialog_Data { + E_Gadcon_Site site; + Evas_Object *o_avail, *o_sel; Evas_Object *o_add, *o_del; Evas_Object *o_desc; @@ -29,18 +33,18 @@ struct _E_Config_Dialog_Data EAPI void e_int_gadcon_config_shelf(E_Gadcon *gc) { - _e_int_gadcon_config(gc, _("Shelf Contents")); + _e_int_gadcon_config(gc, _("Shelf Contents"), _create_data_shelf); } EAPI void e_int_gadcon_config_toolbar(E_Gadcon *gc) { - _e_int_gadcon_config(gc, _("Toolbar Contents")); + _e_int_gadcon_config(gc, _("Toolbar Contents"), _create_data_toolbar); } /* local functions */ static void -_e_int_gadcon_config(E_Gadcon *gc, const char *title) +_e_int_gadcon_config(E_Gadcon *gc, const char *title, void *(*data_func)(E_Config_Dialog*)) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -51,7 +55,7 @@ _e_int_gadcon_config(E_Gadcon *gc, const char *title) con = e_container_current_get(e_manager_current_get()); - v->create_cfdata = _create_data; + v->create_cfdata = data_func ? data_func : _create_data; v->free_cfdata = _free_data; v->basic.create_widgets = _basic_create; @@ -67,6 +71,29 @@ _create_data(E_Config_Dialog *cfd) E_Config_Dialog_Data *cfdata; cfdata = E_NEW(E_Config_Dialog_Data, 1); + cfdata->site = E_GADCON_SITE_UNKNOWN; + cfdata->gc = cfd->data; + return cfdata; +} + +static void * +_create_data_shelf(E_Config_Dialog *cfd) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = E_NEW(E_Config_Dialog_Data, 1); + cfdata->site = E_GADCON_SITE_SHELF; + cfdata->gc = cfd->data; + return cfdata; +} + +static void * +_create_data_toolbar(E_Config_Dialog *cfd) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = E_NEW(E_Config_Dialog_Data, 1); + cfdata->site = E_GADCON_SITE_EFM_TOOLBAR; cfdata->gc = cfd->data; return cfdata; } @@ -207,6 +234,9 @@ _load_avail_gadgets(void *data) const char *lbl = NULL; if (!(cc = l->data)) continue; + // check the current site is allowed for this gadcon client + if (cc->func.is_site && !cc->func.is_site(cfdata->site)) + continue; if (cc->func.label) lbl = cc->func.label(cc); if (!lbl) lbl = cc->name; if (cc->func.icon) icon = cc->func.icon(cc, evas); diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c index 566fd9a74..5625242c0 100644 --- a/src/modules/battery/e_mod_main.c +++ b/src/modules/battery/e_mod_main.c @@ -24,7 +24,7 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "battery", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c index e5de0727d..dc8d04ed0 100644 --- a/src/modules/clock/e_mod_main.c +++ b/src/modules/clock/e_mod_main.c @@ -19,7 +19,7 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "clock", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/conf/e_mod_main.c b/src/modules/conf/e_mod_main.c index 7a0583928..f26f64dde 100644 --- a/src/modules/conf/e_mod_main.c +++ b/src/modules/conf/e_mod_main.c @@ -38,7 +38,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "configuration", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/connman/e_mod_main.c b/src/modules/connman/e_mod_main.c index d526f5858..7a591b356 100644 --- a/src/modules/connman/e_mod_main.c +++ b/src/modules/connman/e_mod_main.c @@ -36,7 +36,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "connman", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c index f35943bb2..b7518f2e8 100644 --- a/src/modules/cpufreq/e_mod_main.c +++ b/src/modules/cpufreq/e_mod_main.c @@ -24,7 +24,7 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "cpufreq", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index 07c9f2c4c..1a143b339 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -139,6 +139,7 @@ static int _e_fwin_dlg_cb_desk_list_sort(const void *data1, const void *data2); static void _e_fwin_op_registry_listener_cb(void *data, const E_Fm2_Op_Registry_Entry *ere); static int _e_fwin_op_registry_entry_add_cb(void *data, int type, void *event); static void _e_fwin_op_registry_entry_iter(E_Fwin_Page *page); +static void _e_fwin_op_registry_abort_cb(void *data, Evas_Object *obj, const char *emission, const char *source); /* local subsystem globals */ static Eina_List *fwins = NULL; @@ -2174,43 +2175,75 @@ _e_fwin_op_registry_listener_cb(void *data, const E_Fm2_Op_Registry_Entry *ere) // Update element edje_object_part_drag_size_set(o, "e.gauge.bar", ((double)(ere->percent)) / 100, 1.0); - total = e_util_size_string_get(ere->total); + // Update icon switch (ere->op) { case E_FM_OP_COPY: edje_object_signal_emit(o, "e,action,icon,copy", "e"); - if (ere->finished) - snprintf(buf, sizeof(buf), "Copy of %s done", total); - else - snprintf(buf, sizeof(buf), "Copying %s (eta: %d sec)", total, ere->eta); break; case E_FM_OP_MOVE: edje_object_signal_emit(o, "e,action,icon,move", "e"); - if (ere->finished) - snprintf(buf, sizeof(buf), "Move of %s done", total); - else - snprintf(buf, sizeof(buf), "Moving %s (eta: %d sec)", total, ere->eta); break; case E_FM_OP_REMOVE: edje_object_signal_emit(o, "e,action,icon,delete", "e"); - if (ere->finished) - snprintf(buf, sizeof(buf), "Delete done"); - else - snprintf(buf, sizeof(buf), "Deleting files..."); break; default: edje_object_signal_emit(o, "e,action,icon,unknow", "e"); - snprintf(buf, sizeof(buf), "Unknow operation from slave %d", ere->id); - break; } - edje_object_part_text_set(o, "e.text.label1", buf); + + // Update information text + switch (ere->status) + { + case E_FM2_OP_STATUS_ABORTED: + switch (ere->op) + { + case E_FM_OP_COPY: + snprintf(buf, sizeof(buf), _("Copying is aborted")); + break; + case E_FM_OP_MOVE: + snprintf(buf, sizeof(buf), _("Moving is aborted")); + break; + case E_FM_OP_REMOVE: + snprintf(buf, sizeof(buf), _("Deleting is aborted")); + break; + default: + snprintf(buf, sizeof(buf), _("Unknown operation from slave is aborted")); + } + break; + + default: + total = e_util_size_string_get(ere->total); + switch (ere->op) + { + case E_FM_OP_COPY: + if (ere->finished) + snprintf(buf, sizeof(buf), _("Copy of %s done"), total); + else + snprintf(buf, sizeof(buf), _("Copying %s (eta: %d sec)"), total, ere->eta); + break; + case E_FM_OP_MOVE: + if (ere->finished) + snprintf(buf, sizeof(buf), _("Move of %s done"), total); + else + snprintf(buf, sizeof(buf), _("Moving %s (eta: %d sec)"), total, ere->eta); + break; + case E_FM_OP_REMOVE: + if (ere->finished) + snprintf(buf, sizeof(buf), _("Delete done")); + else + snprintf(buf, sizeof(buf), _("Deleting files...")); + break; + default: + snprintf(buf, sizeof(buf), _("Unknow operation from slave %d"), ere->id); + } + E_FREE(total); + } + edje_object_part_text_set(o, "e.text.info", buf); if (ere->needs_attention) edje_object_signal_emit(o, "e,action,set,need_attention", "e"); else edje_object_signal_emit(o, "e,action,set,normal", "e"); - - E_FREE(total); } static int @@ -2255,6 +2288,10 @@ _e_fwin_op_registry_entry_add_cb(void *data, int type, void *event) evas_object_size_hint_align_set(o, 1.0, 1.0); //FIXME this should be theme-configurable evas_object_show(o); + // add abort button callback with id of operation in registry + edje_object_signal_callback_add(o, "e,fm,operation,abort", "", + _e_fwin_op_registry_abort_cb, (void*)ere->id); + //Listen to progress changes e_fm2_op_registry_entry_listener_add(ere, _e_fwin_op_registry_listener_cb, o, _e_fwin_op_registry_free_data); @@ -2273,3 +2310,14 @@ _e_fwin_op_registry_entry_iter(E_Fwin_Page *page) _e_fwin_op_registry_entry_add_cb(page, 0, ere); eina_iterator_free(itr); } + +static void +_e_fwin_op_registry_abort_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + int id; + + id = (int)data; + if (!id) return; + + e_fm2_operation_abort(id); +} diff --git a/src/modules/fileman_opinfo/e-module-fileman_opinfo.edj b/src/modules/fileman_opinfo/e-module-fileman_opinfo.edj index e7f2d592d..cdaf15280 100644 Binary files a/src/modules/fileman_opinfo/e-module-fileman_opinfo.edj and b/src/modules/fileman_opinfo/e-module-fileman_opinfo.edj differ diff --git a/src/modules/fileman_opinfo/e_mod_main.c b/src/modules/fileman_opinfo/e_mod_main.c index a1caef40e..bf76b2f7b 100644 --- a/src/modules/fileman_opinfo/e_mod_main.c +++ b/src/modules/fileman_opinfo/e_mod_main.c @@ -4,90 +4,327 @@ #include "e.h" #include "e_mod_main.h" -typedef struct _Instance Instance; - -struct _Instance +typedef struct _Instance { + char *theme_file; E_Gadcon_Client *gcc; - Evas_Object *o_btn; - Ecore_Event_Handler *fm_op_entry_add_handler; - Ecore_Event_Handler *fm_op_entry_del_handler; -}; + + Evas_Object *o_box, + *o_status; + + Ecore_Event_Handler *fm_op_entry_add_handler, + *fm_op_entry_del_handler; +} Instance; /* gadcon requirements */ -static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style); -static void _gc_shutdown(E_Gadcon_Client *gcc); -static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient); -static char *_gc_label(E_Gadcon_Client_Class *client_class); -static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas); -static const char *_gc_id_new(E_Gadcon_Client_Class *client_class); + +static E_Gadcon_Client *_gc_init (E_Gadcon *gc, const char *name, const char *id, const char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient (E_Gadcon_Client *gcc, E_Gadcon_Orient orient); +static char *_gc_label (E_Gadcon_Client_Class *client_class); +static Evas_Object *_gc_icon (E_Gadcon_Client_Class *client_class, Evas *evas); +static const char *_gc_id_new (E_Gadcon_Client_Class *client_class); + static const E_Gadcon_Client_Class _gadcon_class = { - GADCON_CLIENT_CLASS_VERSION, "efm_info", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL - }, E_GADCON_CLIENT_STYLE_PLAIN + GADCON_CLIENT_CLASS_VERSION, "efm_info", + { + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_desktop + }, + E_GADCON_CLIENT_STYLE_PLAIN }; /******************** PROTOS *******************************************/ -void _opinfo_button_cb(void *data, void *data2); -static void _opinfo_update_gadget(Instance *inst); + +static int _opinfo_op_registry_entry_add_cb (void *data, int type, void *event); +static int _opinfo_op_registry_entry_del_cb (void *data, int type, void *event); +static void _opinfo_op_registry_update_all (Instance *inst); +static void _opinfo_op_registry_listener (void *data, const E_Fm2_Op_Registry_Entry *ere); +static void _opinfo_op_registry_free_data (void *data); +static int _opinfo_op_registry_free_data_delayed(void *data); +static void _opinfo_op_registry_abort_cb (void *data, Evas_Object *obj, const char *emission, const char *source); +static void _opinfo_op_registry_summary_cb (void *data, Evas_Object *obj, const char *emission, const char *source); +static void _opinfo_op_registry_detailed_cb (void *data, Evas_Object *obj, const char *emission, const char *source); +static void _opinfo_op_registry_update_status (Instance *inst); /******************** GLOBALS ******************************************/ + static E_Module *opinfo_module = NULL; /******************** OP_REGISTRY *************************************/ -static int -_opinfo_op_registry_entry_cb(void *data, int type, void *event) + +static void +_opinfo_op_registry_listener(void *data, const E_Fm2_Op_Registry_Entry *ere) { - _opinfo_update_gadget(data); + Evas_Object *o = data; + char *total, buf[PATH_MAX]; + + if (!o || !ere) return; + + // Update icon + switch (ere->op) + { + case E_FM_OP_COPY: + edje_object_signal_emit(o, "e,action,icon,copy", "e"); + break; + case E_FM_OP_MOVE: + edje_object_signal_emit(o, "e,action,icon,move", "e"); + break; + case E_FM_OP_REMOVE: + edje_object_signal_emit(o, "e,action,icon,delete", "e"); + break; + default: + edje_object_signal_emit(o, "e,action,icon,unknow", "e"); + } + + // Update information text + switch (ere->status) + { + case E_FM2_OP_STATUS_ABORTED: + switch (ere->op) + { + case E_FM_OP_COPY: + snprintf(buf, sizeof(buf), _("Copying is aborted")); + break; + case E_FM_OP_MOVE: + snprintf(buf, sizeof(buf), _("Moving is aborted")); + break; + case E_FM_OP_REMOVE: + snprintf(buf, sizeof(buf), _("Deleting is aborted")); + break; + default: + snprintf(buf, sizeof(buf), _("Unknown operation from slave is aborted")); + } + break; + + default: + total = e_util_size_string_get(ere->total); + switch (ere->op) + { + case E_FM_OP_COPY: + if (ere->finished) + snprintf(buf, sizeof(buf), _("Copy of %s done"), total); + else + snprintf(buf, sizeof(buf), _("Copying %s (eta: %d sec)"), total, ere->eta); + break; + case E_FM_OP_MOVE: + if (ere->finished) + snprintf(buf, sizeof(buf), _("Move of %s done"), total); + else + snprintf(buf, sizeof(buf), _("Moving %s (eta: %d sec)"), total, ere->eta); + break; + case E_FM_OP_REMOVE: + if (ere->finished) + snprintf(buf, sizeof(buf), _("Delete done")); + else + snprintf(buf, sizeof(buf), _("Deleting files...")); + break; + default: + snprintf(buf, sizeof(buf), _("Unknow operation from slave %d"), ere->id); + } + E_FREE(total); + } + edje_object_part_text_set(o, "e.text.info", buf); + + // Update detailed information + if (!ere->src) + edje_object_part_text_set(o, "e.text.src", _("(no information)")); + else + { + if (ere->op == E_FM_OP_REMOVE) + snprintf(buf, sizeof(buf), _("File: %s"), ere->src); + else + snprintf(buf, sizeof(buf), _("From: %s"), ere->src); + edje_object_part_text_set(o, "e.text.src", buf); + } + if (!ere->dst || ere->op == E_FM_OP_REMOVE) + edje_object_part_text_set(o, "e.text.dest", _("(no information)")); + else + { + snprintf(buf, sizeof(buf), _("To: %s"), ere->dst); + edje_object_part_text_set(o, "e.text.dest", buf); + } + + // Update gauge + edje_object_part_drag_size_set(o, "e.gauge.bar", ere->percent / 100.0, 1.0); + snprintf(buf, sizeof(buf), "%3i%%", ere->percent); + edje_object_part_text_set(o, "e.text.percent", buf); + + // Update attention + if (ere->needs_attention) + edje_object_signal_emit(o, "e,action,set,need_attention", "e"); + else + edje_object_signal_emit(o, "e,action,set,normal", "e"); +} + +static void +_opinfo_op_registry_free_data(void *data) +{ + ecore_timer_add(5.0, _opinfo_op_registry_free_data_delayed, data); +} + +static int +_opinfo_op_registry_free_data_delayed(void *data) +{ + Evas_Object *o = data; + + if (o) + { + e_box_unpack(o); + evas_object_del(o); + } + + return ECORE_CALLBACK_CANCEL; +} + +static void +_opinfo_op_registry_abort_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + int id; + + id = (int)data; + if (!id) return; + + e_fm2_operation_abort(id); +} + +static void +_opinfo_op_registry_summary_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + int mw, mh; + + edje_object_signal_emit(obj, "state,set,summary", "fileman_opinfo"); + + edje_object_size_min_get(obj, &mw, &mh); + e_box_pack_options_set(obj, 1, 0, 1, 0, 0.0, 0.0, mw, mh, 9999, mh); +} + +static void +_opinfo_op_registry_detailed_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + int mw, xh; + + edje_object_signal_emit(obj, "state,set,detailed", "fileman_opinfo"); + + edje_object_size_min_calc(obj, &mw, NULL); + edje_object_size_max_get(obj, NULL, &xh); + e_box_pack_options_set(obj, 1, 0, 1, 0, 0.0, 0.0, mw, xh, 9999, xh); +} + +static int +_opinfo_op_registry_entry_add_cb(void *data, int type, void *event) +{ + E_Fm2_Op_Registry_Entry *ere = event; + Instance *inst = data; + Evas_Object *o; + int mw, mh, xh; + + if (!inst || !ere) + return ECORE_CALLBACK_RENEW; + + _opinfo_op_registry_update_status(inst); + + if (!(ere->op == E_FM_OP_COPY || ere->op == E_FM_OP_MOVE || ere->op == E_FM_OP_REMOVE)) + return ECORE_CALLBACK_RENEW; + + o = edje_object_add(evas_object_evas_get(inst->o_box)); + if (!e_theme_edje_object_set(o, "base/theme/modules/fileman_opinfo", + "modules/fileman_opinfo/main")) + edje_object_file_set(o, inst->theme_file, "modules/fileman_opinfo/main"); + _opinfo_op_registry_listener(o, ere); + e_box_pack_before(inst->o_box, o, inst->o_status); + evas_object_show(o); + _opinfo_op_registry_summary_cb(inst, o, NULL, NULL); + + edje_object_signal_callback_add(o, "e,fm,operation,abort", "", + _opinfo_op_registry_abort_cb, (void*)ere->id); + edje_object_signal_callback_add(o, "state,request,summary", "fileman_opinfo", + _opinfo_op_registry_summary_cb, inst); + edje_object_signal_callback_add(o, "state,request,detailed", "fileman_opinfo", + _opinfo_op_registry_detailed_cb, inst); + + e_fm2_op_registry_entry_listener_add(ere, _opinfo_op_registry_listener, + o, _opinfo_op_registry_free_data); + + return ECORE_CALLBACK_RENEW; +} + +static int +_opinfo_op_registry_entry_del_cb(void *data, int type, void *event) +{ + Instance *inst = data; + + if (!inst) + return ECORE_CALLBACK_RENEW; + + _opinfo_op_registry_update_status(inst); + return ECORE_CALLBACK_RENEW; } static void -_opinfo_update_gadget(Instance *inst) +_opinfo_op_registry_update_all(Instance *inst) { - char buf[1024]; - int count; - - count = e_fm2_op_registry_count(); - if (count) - snprintf(buf, sizeof(buf), _("%d operations"), count); - else - snprintf(buf, sizeof(buf), _("idle")); - e_widget_button_label_set(inst->o_btn, buf); - e_widget_disabled_set(inst->o_btn, count ? 0 : 1); -} - -void -_opinfo_button_cb(void *data, void *data2) -{ - Ecore_X_Window win; Eina_Iterator *itr; E_Fm2_Op_Registry_Entry *ere; itr = e_fm2_op_registry_iterator_new(); EINA_ITERATOR_FOREACH(itr, ere) - { - win = e_fm2_op_registry_entry_xwin_get(ere); - e_util_dialog_show("TODO","What to show here ?"); - //ecore_x_window_show(win); - } + _opinfo_op_registry_entry_add_cb(inst, 0, ere); eina_iterator_free(itr); + + _opinfo_op_registry_update_status(inst); } + +static void +_opinfo_op_registry_update_status(Instance *inst) +{ + int cnt; + char buf[256]; + + cnt = e_fm2_op_registry_count(); + if (cnt) + { + snprintf(buf, sizeof(buf), _("Processing %d operation(s)"), cnt); + edje_object_part_text_set(inst->o_status, "e.text.info", buf); + } + else + edje_object_part_text_set(inst->o_status, "e.text.info", _("Filemanager is idle")); +} + /******************** GADCON *******************************************/ + static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { - Evas_Object *o; E_Gadcon_Client *gcc; Instance *inst; + int mw, mh; inst = E_NEW(Instance, 1); - o = e_widget_button_add(gc->evas, "", NULL, _opinfo_button_cb, NULL, NULL); - inst->o_btn = o; - _opinfo_update_gadget(inst); + asprintf(&inst->theme_file, "%s/e-module-fileman_opinfo.edj", + e_module_dir_get(opinfo_module)); - gcc = e_gadcon_client_new(gc, name, id, style, o); + // main object + inst->o_box = e_box_add(gc->evas); + e_box_homogenous_set(inst->o_box, 0); + e_box_orientation_set(inst->o_box, 0); + e_box_align_set(inst->o_box, 0, 0); + + // status line + inst->o_status = edje_object_add(evas_object_evas_get(inst->o_box)); + if (!e_theme_edje_object_set(inst->o_status, "base/theme/modules/fileman_opinfo", + "modules/fileman_opinfo/status")) + edje_object_file_set(inst->o_status, inst->theme_file, "modules/fileman_opinfo/status"); + e_box_pack_end(inst->o_box, inst->o_status); + evas_object_show(inst->o_status); + edje_object_size_min_get(inst->o_status, &mw, &mh); + e_box_pack_options_set(inst->o_status, 1, 0, 1, 0, 0.0, 0.0, mw, mh, 9999, mh); + + _opinfo_op_registry_update_all(inst); + + gcc = e_gadcon_client_new(gc, name, id, style, inst->o_box); gcc->data = inst; inst->gcc = gcc; @@ -95,10 +332,10 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) inst->fm_op_entry_add_handler = ecore_event_handler_add(E_EVENT_FM_OP_REGISTRY_ADD, - _opinfo_op_registry_entry_cb, inst); + _opinfo_op_registry_entry_add_cb, inst); inst->fm_op_entry_del_handler = ecore_event_handler_add(E_EVENT_FM_OP_REGISTRY_DEL, - _opinfo_op_registry_entry_cb, inst); + _opinfo_op_registry_entry_del_cb, inst); return gcc; } @@ -106,29 +343,26 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) static void _gc_shutdown(E_Gadcon_Client *gcc) { - Instance *inst; + Instance *inst = gcc->data; - inst = gcc->data; - - if (inst->fm_op_entry_add_handler) + if (inst->fm_op_entry_add_handler) ecore_event_handler_del(inst->fm_op_entry_add_handler); - if (inst->fm_op_entry_del_handler) + if (inst->fm_op_entry_del_handler) ecore_event_handler_del(inst->fm_op_entry_del_handler); - - evas_object_del(inst->o_btn); - free(inst); + e_box_unpack(inst->o_status); + evas_object_del(inst->o_status); + evas_object_del(inst->o_box); + free(inst->theme_file); + E_FREE(inst); } static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient) { - Instance *inst; - Evas_Coord mw, mh; + Instance *inst = gcc->data; + Evas_Coord mw = 200, mh = 100; - inst = gcc->data; - - mw = 120, mh = 40; - evas_object_size_hint_min_set(inst->o_btn, mw, mh); + evas_object_size_hint_min_set(inst->o_box, mw, mh); e_gadcon_client_aspect_set(gcc, mw, mh); e_gadcon_client_min_size_set(gcc, mw, mh); } @@ -143,12 +377,13 @@ static Evas_Object * _gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas) { Evas_Object *o; - char buf[4096]; + char buf[PATH_MAX]; o = edje_object_add(evas); snprintf(buf, sizeof(buf), "%s/e-module-fileman_opinfo.edj", e_module_dir_get(opinfo_module)); edje_object_file_set(o, buf, "icon"); + return o; } @@ -159,10 +394,11 @@ _gc_id_new(E_Gadcon_Client_Class *client_class) } /******************** E MODULE ****************************************/ + EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, - "EFM Info" + "EFM Info" }; EAPI void * @@ -171,6 +407,7 @@ e_modapi_init(E_Module *m) opinfo_module = m; e_gadcon_provider_register(&_gadcon_class); + return m; } @@ -180,6 +417,7 @@ e_modapi_shutdown(E_Module *m) opinfo_module = NULL; e_gadcon_provider_unregister(&_gadcon_class); + return 1; } diff --git a/src/modules/gadman/e_mod_config.c b/src/modules/gadman/e_mod_config.c index 452d151e6..c8ddb16bc 100644 --- a/src/modules/gadman/e_mod_config.c +++ b/src/modules/gadman/e_mod_config.c @@ -297,6 +297,8 @@ _fill_gadgets_list(Evas_Object *ilist) const char *lbl = NULL; if (!(cc = l->data)) continue; + if (cc->func.is_site && !cc->func.is_site(E_GADCON_SITE_DESKTOP)) + continue; if (cc->func.label) lbl = cc->func.label(cc); if (!lbl) lbl = cc->name; if (cc->func.icon) icon = cc->func.icon(cc, evas); diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 694d53ded..4404e0100 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -27,7 +27,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "ibar", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, _gc_id_del + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, _gc_id_del, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_INSET }; diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c index 328a4f859..7c276192d 100644 --- a/src/modules/ibox/e_mod_main.c +++ b/src/modules/ibox/e_mod_main.c @@ -20,7 +20,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "ibox", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, _gc_id_del + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, _gc_id_del, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_INSET }; diff --git a/src/modules/illume/e_mod_gad_bluetooth.c b/src/modules/illume/e_mod_gad_bluetooth.c index f8c8cf743..43fb3f90c 100644 --- a/src/modules/illume/e_mod_gad_bluetooth.c +++ b/src/modules/illume/e_mod_gad_bluetooth.c @@ -26,7 +26,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "illume-bluetooth", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/illume/e_mod_gad_gsm.c b/src/modules/illume/e_mod_gad_gsm.c index 867ab25f1..ba477ef16 100644 --- a/src/modules/illume/e_mod_gad_gsm.c +++ b/src/modules/illume/e_mod_gad_gsm.c @@ -51,7 +51,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "illume-gsm", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/illume/e_mod_gad_usb.c b/src/modules/illume/e_mod_gad_usb.c index 3e37572d5..3da3a3fbe 100644 --- a/src/modules/illume/e_mod_gad_usb.c +++ b/src/modules/illume/e_mod_gad_usb.c @@ -26,7 +26,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "illume-usb", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/illume/e_mod_gad_wifi.c b/src/modules/illume/e_mod_gad_wifi.c index 01da6025d..9009dd240 100644 --- a/src/modules/illume/e_mod_gad_wifi.c +++ b/src/modules/illume/e_mod_gad_wifi.c @@ -28,7 +28,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "illume-wifi", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index b30de2d46..3183eb220 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -985,7 +985,10 @@ _gc_id_new(E_Gadcon_Client_Class *client_class) static const E_Gadcon_Client_Class _gc_class = { GADCON_CLIENT_CLASS_VERSION, _name, - {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL}, + { + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar + }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 3f6d8efe4..7be716995 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -18,7 +18,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "pager", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_INSET }; diff --git a/src/modules/start/e_mod_main.c b/src/modules/start/e_mod_main.c index afd33ed66..5c4eb6d7c 100644 --- a/src/modules/start/e_mod_main.c +++ b/src/modules/start/e_mod_main.c @@ -19,7 +19,8 @@ static const E_Gadcon_Client_Class _gadcon_class = GADCON_CLIENT_CLASS_VERSION, "start", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN }; diff --git a/src/modules/systray/e_mod_main.c b/src/modules/systray/e_mod_main.c index 90f751af2..8e7543f12 100644 --- a/src/modules/systray/e_mod_main.c +++ b/src/modules/systray/e_mod_main.c @@ -1092,7 +1092,10 @@ _gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__) static const E_Gadcon_Client_Class _gc_class = { GADCON_CLIENT_CLASS_VERSION, _name, - {_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL}, + { + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar + }, E_GADCON_CLIENT_STYLE_INSET }; diff --git a/src/modules/temperature/e_mod_main.c b/src/modules/temperature/e_mod_main.c index e729b8890..0c157bfd7 100644 --- a/src/modules/temperature/e_mod_main.c +++ b/src/modules/temperature/e_mod_main.c @@ -24,7 +24,8 @@ static const E_Gadcon_Client_Class _gadcon_class = { GADCON_CLIENT_CLASS_VERSION, "temperature", { - _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL + _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, + e_gadcon_site_is_not_toolbar }, E_GADCON_CLIENT_STYLE_PLAIN };