This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit a18395122f7d0e80e2e308b671ff48e4a4152663
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Sun Mar 23 12:27:17 2025 +0000
glue in some more menu item callbacks to work
---
src/efm/efm.c | 11 +++++-
src/efm/efm_popup_menu.c | 94 ++++++++++++++++++++++++++++--------------------
src/efm/efm_structs.h | 2 ++
src/efm/efm_util.c | 72 +++++++++++++++++++++++++++++++++++++
src/efm/efm_util.h | 83 ++++++++++++++++++++++--------------------
src/efm/main.c | 10 ++++++
6 files changed, 195 insertions(+), 77 deletions(-)
diff --git a/src/efm/efm.c b/src/efm/efm.c
index ecf87a5..ee9db25 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -370,7 +370,6 @@ _cb_back_mouse_down(void *data, Evas *e EINA_UNUSED,
Evas_Event_Mouse_Down *ev = event_info;
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
- // XXX: exit rename mode if on...
elm_object_focus_set(sd->o_scroller, EINA_TRUE);
if (ev->button == 1)
{
@@ -874,6 +873,16 @@ _smart_del(Evas_Object *obj)
ecore_job_del(sd->refocus_job);
sd->refocus_job = NULL;
}
+ if (sd->close_job)
+ {
+ ecore_job_del(sd->close_job);
+ sd->close_job = NULL;
+ }
+ if (sd->reset_job)
+ {
+ ecore_job_del(sd->reset_job);
+ sd->reset_job = NULL;
+ }
if (sd->thread)
{
if (sd->thread_data) sd->thread_data->sd = NULL;
diff --git a/src/efm/efm_popup_menu.c b/src/efm/efm_popup_menu.c
index 692e1e2..5e9d735 100644
--- a/src/efm/efm_popup_menu.c
+++ b/src/efm/efm_popup_menu.c
@@ -125,15 +125,17 @@ _cb_menu_item_open_all(void *data, void *data2 EINA_UNUSED,
const Efm_Menu_Item *menu_item EINA_UNUSED)
{
Popup_Context *ctx = data;
- printf("open all select dialog %p\n", ctx);
+ printf("XXX: open all select dialog %p\n", ctx);
}
static void
-_cb_menu_item_rename(void *data, void *data2, Evas_Object *efm,
- const Efm_Menu_Item *menu_item)
+_cb_menu_item_rename(void *data, void *data2 EINA_UNUSED,
+ Evas_Object *efm EINA_UNUSED,
+ const Efm_Menu_Item *menu_item EINA_UNUSED)
{
Popup_Context *ctx = data;
- printf("rename\n");
+
+ _efm_sel_rename(ctx->sd);
}
static void
@@ -141,7 +143,7 @@ _cb_menu_item_cut(void *data, void *data2, Evas_Object *efm,
const Efm_Menu_Item *menu_item)
{
Popup_Context *ctx = data;
- printf("cut\n");
+ printf("XXX: cut\n");
}
static void
@@ -149,7 +151,7 @@ _cb_menu_item_copy(void *data, void *data2, Evas_Object *efm,
const Efm_Menu_Item *menu_item)
{
Popup_Context *ctx = data;
- printf("copy\n");
+ printf("XXX: copy\n");
}
static void
@@ -157,7 +159,7 @@ _cb_menu_item_paste(void *data, void *data2, Evas_Object *efm,
const Efm_Menu_Item *menu_item)
{
Popup_Context *ctx = data;
- printf("paste\n");
+ printf("XXX: paste\n");
}
static void
@@ -165,7 +167,7 @@ _cb_menu_item_delete(void *data, void *data2, Evas_Object *efm,
const Efm_Menu_Item *menu_item)
{
Popup_Context *ctx = data;
- printf("delete\n");
+ printf("XXX: delete\n");
}
static void
@@ -173,31 +175,47 @@ _cb_menu_item_props(void *data, void *data2, Evas_Object *efm,
const Efm_Menu_Item *menu_item)
{
Popup_Context *ctx = data;
- printf("props\n");
+ printf("XXX: props\n");
}
static void
-_cb_menu_item_sel_all(void *data, void *data2, Evas_Object *efm,
- const Efm_Menu_Item *menu_item)
+_cb_menu_item_sel_all(void *data, void *data2 EINA_UNUSED,
+ Evas_Object *efm EINA_UNUSED,
+ const Efm_Menu_Item *menu_item EINA_UNUSED)
{
Popup_Context *ctx = data;
- printf("sel all\n");
+
+ _efm_sel_all(ctx->sd);
}
static void
-_cb_menu_item_sel_none(void *data, void *data2, Evas_Object *efm,
- const Efm_Menu_Item *menu_item)
+_cb_menu_item_sel_none(void *data, void *data2 EINA_UNUSED,
+ Evas_Object *efm EINA_UNUSED,
+ const Efm_Menu_Item *menu_item EINA_UNUSED)
{
Popup_Context *ctx = data;
- printf("sel none\n");
+
+ _efm_sel_none(ctx->sd);
}
static void
-_cb_menu_item_refresh(void *data, void *data2, Evas_Object *efm,
- const Efm_Menu_Item *menu_item)
+_cb_job_refresh(void *data)
+{
+ Smart_Data *sd = data;
+
+ sd->reset_job = NULL;
+ _reset(sd);
+}
+
+static void
+_cb_menu_item_refresh(void *data, void *data2 EINA_UNUSED,
+ Evas_Object *efm EINA_UNUSED,
+ const Efm_Menu_Item *menu_item EINA_UNUSED)
{
Popup_Context *ctx = data;
- printf("refresh\n");
+
+ if (ctx->sd->reset_job) ecore_job_del(ctx->sd->reset_job);
+ ctx->sd->reset_job = ecore_job_add(_cb_job_refresh, ctx->sd);
}
static void
@@ -205,15 +223,27 @@ _cb_menu_item_mkdir(void *data, void *data2, Evas_Object *efm,
const Efm_Menu_Item *menu_item)
{
Popup_Context *ctx = data;
- printf("mkdir\n");
+ printf("XXX: mkdir\n");
}
static void
-_cb_menu_item_close(void *data, void *data2, Evas_Object *efm,
- const Efm_Menu_Item *menu_item)
+_cb_job_close(void *data)
+{
+ Smart_Data *sd = data;
+
+ sd->close_job = NULL;
+ evas_object_smart_callback_call(sd->o_smart, "close", NULL);
+}
+
+static void
+_cb_menu_item_close(void *data, void *data2 EINA_UNUSED,
+ Evas_Object *efm EINA_UNUSED,
+ const Efm_Menu_Item *menu_item EINA_UNUSED)
{
Popup_Context *ctx = data;
- printf("close\n");
+
+ if (ctx->sd->close_job) ecore_job_del(ctx->sd->close_job);
+ ctx->sd->close_job = ecore_job_add(_cb_job_close, ctx->sd);
}
Efm_Menu *
@@ -318,6 +348,7 @@ _efm_popup_icon_menu_add(Smart_Data *sd, Icon *ic, Evas_Coord x, Evas_Coord y)
// XXX: sort
// XXX: show hidden
}
+ // XXX: need option to remove this for desktop icons
_efm_menu_it_separator(m1);
_efm_menu_it_normal(m1, "Close", "std:window-close", _cb_menu_item_close, ctx,
NULL);
@@ -331,24 +362,10 @@ _efm_popup_main_menu_add(Smart_Data *sd, Evas_Coord x, Evas_Coord y)
{ // menu click in blank area
Popup_Context *ctx;
Efm_Menu *m1, *m2;
- Eina_List *bl, *il;
- Block *block;
- Icon *ic = NULL;
+ Icon *ic;
printf("POPUP MENU\n");
- // find firt selected icon
- EINA_LIST_FOREACH(sd->blocks, bl, block)
- {
- if (block->selected_num > 0)
- {
- EINA_LIST_FOREACH(block->icons, il, ic)
- {
- if (ic->selected) goto found;
- ic = NULL;
- }
- }
- }
-found:
+ ic = _efm_sel_first_get(sd);
// if we have selected icons then do the same menu as if first icon menu
if (ic) return _efm_popup_icon_menu_add(sd, ic, x, y);
@@ -384,6 +401,7 @@ found:
// XXX: sort
// XXX: show hidden
}
+ // XXX: need option to remove this for desktop icons
_efm_menu_it_separator(m1);
_efm_menu_it_normal(m1, "Close", "std:window-close", _cb_menu_item_close, ctx,
NULL);
diff --git a/src/efm/efm_structs.h b/src/efm/efm_structs.h
index 2e444ca..ec784a1 100644
--- a/src/efm/efm_structs.h
+++ b/src/efm/efm_structs.h
@@ -68,6 +68,8 @@ struct _Smart_Data
Ecore_Job *size_bars_update_job;
Ecore_Job *size_max_update_job;
Ecore_Job *header_change_job;
+ Ecore_Job *close_job;
+ Ecore_Job *reset_job;
Icon *last_selected;
Icon *last_focused_before;
Icon *last_focused;
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index e688539..fb2b57b 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -6,6 +6,8 @@
#include "efm_dnd.h"
#include "efm_back_end.h"
#include "efm_private.h"
+#include "efm_structs.h"
+#include "eina_list.h"
#include "eina_strbuf.h"
#include "eina_types.h"
#include "mimeapps.h"
@@ -1731,6 +1733,8 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
{ // can call this for add AND update - working on update now
Evas_Object *o, *o2;
+ // XXX: this should be broken up into each icon tpe and maybe into
+ // XXX: more files - but for now this will do
if (!detail) detail = "";
if (!strcmp(format, "text")) // format: just the string as-is
{
@@ -2433,12 +2437,14 @@ _icon_free(Icon *icon)
}
if (icon->sd->drop_over == icon) icon->sd->drop_over = NULL;
if (icon->sd->rename_icon == icon) _icon_rename_end(icon);
+ // XXX: this is going to be not very optimal...
icon->sd->icons = eina_list_remove(icon->sd->icons, icon);
}
if (icon->block)
{
if (icon->selected) icon->block->selected_num--;
if (icon->realized) icon->block->realized_num--;
+ // XXX: this is going to be not very optimal but better than the above
icon->block->icons = eina_list_remove(icon->block->icons, icon);
}
if (icon->longpress_timer)
@@ -2542,3 +2548,69 @@ _cb_reblock(void *data)
sd->reblocked = EINA_TRUE;
evas_object_smart_changed(sd->o_smart);
}
+
+void
+_efm_sel_all(Smart_Data *sd)
+{
+ Icon *i1, *i2;
+
+ if (!sd->icons) return;
+ i1 = sd->icons->data;
+ i2 = eina_list_last_data_get(sd->icons);
+ _select_range(i1, i2);
+}
+
+void
+_efm_sel_none(Smart_Data *sd)
+{
+ _unselect_all(sd);
+}
+
+Icon *
+_efm_sel_first_get(Smart_Data *sd)
+{
+ Eina_List *bl, *il;
+ Block *block;
+ Icon *ic;
+
+ EINA_LIST_FOREACH(sd->blocks, bl, block)
+ {
+ if (block->selected_num > 0)
+ {
+ EINA_LIST_FOREACH(block->icons, il, ic)
+ {
+ if (ic->selected) return ic;
+ }
+ }
+ }
+ return NULL;
+}
+
+Icon *
+_efm_sel_last_get(Smart_Data *sd)
+{
+ Eina_List *bl, *il;
+ Block *block;
+ Icon *ic;
+
+ EINA_LIST_REVERSE_FOREACH(sd->blocks, bl, block)
+ {
+ if (block->selected_num > 0)
+ {
+ EINA_LIST_REVERSE_FOREACH(block->icons, il, ic)
+ {
+ if (ic->selected) return ic;
+ }
+ }
+ }
+ return NULL;
+}
+
+void
+_efm_sel_rename(Smart_Data *sd)
+{
+ Icon *ic = _efm_sel_first_get(sd);
+
+ if (!ic) return;
+ _icon_rename_begin(ic);
+}
diff --git a/src/efm/efm_util.h b/src/efm/efm_util.h
index 9c62570..0caf3c7 100644
--- a/src/efm/efm_util.h
+++ b/src/efm/efm_util.h
@@ -15,51 +15,58 @@ typedef enum
EFM_FOCUS_DIR_PGUP
} Efm_Focus_Dir;
-char *_escape_parse(const char *str);
-Eina_Bool _selected_icons_uri_strbuf_append(Smart_Data *sd,
- Eina_Strbuf *strbuf);
-void _detail_realized_items_resize(Smart_Data *sd);
-double _scale_get(Smart_Data *sd);
-Eina_List *_icons_path_find(const char *path);
-Eina_Bool _icon_focus_dir(Smart_Data *sd, Efm_Focus_Dir dir);
-void _icon_rename_end(Icon *icon);
-void _icon_open_with_cmd_strbuf_append(Eina_Strbuf *strbuf,
- const char *key, Smart_Data *sd);
-void _icon_path_cmd_strbuf_append(Eina_Strbuf *strbuf,
- const char *key,
- Smart_Data *sd, Icon *icon);
-void _uri_list_cmd_strbuf_append(Eina_Strbuf *strbuf, const char *key,
- const char *urilist);
-void _icon_over_off(Icon *icon);
-void _icon_over_on(Icon *icon);
-void _icon_select(Icon *icon);
-void _icon_unselect(Icon *icon);
-Eina_Bool _unselect_all(Smart_Data *sd);
-void _select_range(Icon *icon_from, Icon *icon_to);
-Icon *_icon_dup(Icon *icon);
+char *_escape_parse(const char *str);
+Eina_Bool _selected_icons_uri_strbuf_append(Smart_Data *sd,
+ Eina_Strbuf *strbuf);
+void _detail_realized_items_resize(Smart_Data *sd);
+double _scale_get(Smart_Data *sd);
+Eina_List *_icons_path_find(const char *path);
+Eina_Bool _icon_focus_dir(Smart_Data *sd, Efm_Focus_Dir dir);
+void _icon_rename_end(Icon *icon);
+void _icon_open_with_cmd_strbuf_append(Eina_Strbuf *strbuf,
+ const char *key, Smart_Data *sd);
+void _icon_path_cmd_strbuf_append(Eina_Strbuf *strbuf,
+ const char *key,
+ Smart_Data *sd, Icon *icon);
+void _uri_list_cmd_strbuf_append(Eina_Strbuf *strbuf, const char *key,
+ const char *urilist);
+void _icon_over_off(Icon *icon);
+void _icon_over_on(Icon *icon);
+void _icon_select(Icon *icon);
+void _icon_unselect(Icon *icon);
+Eina_Bool _unselect_all(Smart_Data *sd);
+void _select_range(Icon *icon_from, Icon *icon_to);
+Icon *_icon_dup(Icon *icon);
-void _efm_sel_store_start(Smart_Data *sd, Evas_Coord x, Evas_Coord y);
-void _efm_sel_store_end(Smart_Data *sd, Evas_Coord x, Evas_Coord y);
-void _efm_sel_start(Smart_Data *sd);
-void _efm_sel_end(Smart_Data *sd);
+void _efm_sel_store_start(Smart_Data *sd, Evas_Coord x, Evas_Coord y);
+void _efm_sel_store_end(Smart_Data *sd, Evas_Coord x, Evas_Coord y);
+void _efm_sel_start(Smart_Data *sd);
+void _efm_sel_end(Smart_Data *sd);
-void _icon_focus(Smart_Data *sd);
+void _icon_focus(Smart_Data *sd);
-void _icon_focus_show(Smart_Data *sd);
-void _icon_focus_hide(Smart_Data *sd);
-void _icon_object_clear(Icon *icon);
+void _icon_focus_show(Smart_Data *sd);
+void _icon_focus_hide(Smart_Data *sd);
+void _icon_object_clear(Icon *icon);
void _efm_focus_position(Smart_Data *sd);
Eina_Rectangle _efm_sel_rect_get(Smart_Data *sd);
void _efm_sel_position(Smart_Data *sd);
-void _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
- const char *theme_edj_file, int col, const char *detail,
- const char *format);
-void _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e,
- const char *theme_edj_file, Eina_Bool clip_set, int num);
-void _icon_free(Icon *icon);
-void _block_free(Block *block);
-void _cb_reblock(void *data);
+void _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
+ const char *theme_edj_file, int col,
+ const char *detail, const char *format);
+void _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e,
+ const char *theme_edj_file, Eina_Bool clip_set,
+ int num);
+void _icon_free(Icon *icon);
+void _block_free(Block *block);
+void _cb_reblock(void *data);
+
+void _efm_sel_all(Smart_Data *sd);
+void _efm_sel_none(Smart_Data *sd);
+Icon *_efm_sel_first_get(Smart_Data *sd);
+Icon *_efm_sel_last_get(Smart_Data *sd);
+void _efm_sel_rename(Smart_Data *sd);
#endif
diff --git a/src/efm/main.c b/src/efm/main.c
index 6cf91f6..0a8f121 100644
--- a/src/efm/main.c
+++ b/src/efm/main.c
@@ -1,5 +1,7 @@
// test gui front-end for new efm
+#include "Elementary.h"
#include "efm.h"
+#include "eina_types.h"
// #include "efm_icon.h"
@@ -81,6 +83,13 @@ _cb_header_change(void *data, Evas_Object *obj EINA_UNUSED,
}
}
+static void
+_cb_close(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ evas_object_del(data);
+}
+
EAPI_MAIN int
elm_main(int argc, char **argv)
{
@@ -165,6 +174,7 @@ elm_main(int argc, char **argv)
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_smart_callback_add(o, "header_change", _cb_header_change, efm);
+ evas_object_smart_callback_add(o, "close", _cb_close, win);
elm_object_content_set(sc, o);
efm_scroller_set(o, sc);
efm_path_set(o, path);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.