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 1724cb96e9c7ff8d07a8189ec5144b9782be8803
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Fri Jan 23 21:10:18 2026 +0000
typebuf - show icons if cmd recognised
---
src/backends/default/open.c | 70 ++++++++++++++++++++++++++++++++++-----------
src/efm/efm.c | 64 ++---------------------------------------
src/efm/efm_back_end.c | 8 ++++++
src/efm/efm_structs.h | 2 ++
src/efm/efm_typebuf.c | 38 +++++++++++++++++++++++-
src/efm/efm_typebuf.h | 1 +
src/efm/efm_util.c | 70 +++++++++++++++++++++++++++++++++++++++++++++
src/efm/efm_util.h | 2 ++
8 files changed, 176 insertions(+), 79 deletions(-)
diff --git a/src/backends/default/open.c b/src/backends/default/open.c
index 859b70d..61a9201 100644
--- a/src/backends/default/open.c
+++ b/src/backends/default/open.c
@@ -18,6 +18,7 @@
#include <grp.h>
#include "cmd.h"
+#include "efreet_desktop.h"
#include "eina_hash.h"
#include "eina_list.h"
#include "eina_strbuf.h"
@@ -1632,23 +1633,58 @@ do_handle_cmd(Cmd *c)
}
else if (!strcmp(c->command, "typebuf"))
{
- KEY_WALK_BEGIN
- {
- if (!strcmp(key, "op"))
- {
- fprintf(stderr, "XXX: ZZZ: typebuf op [%s]\n", data);
- }
- else if (!strcmp(key, "line"))
- {
- fprintf(stderr, "XXX: ZZZ: typebuf line [%s]\n", data);
- }
- else if (!strcmp(key, "cursor-pos"))
- {
- int cpos = atoi(data);
- fprintf(stderr, "XXX: ZZZ: typebuf cpos=%i\n", cpos);
- }
- }
- KEY_WALK_END
+ const char *op, *cpos_str, *line_str;
+ int cpos = -1;
+ char **args = NULL, **p;
+
+ // XXX: now handle typebuf commands in the backend
+ // XXX: if its a valid cmd - tell front end
+ op = cmd_key_find(c, "op");
+ line_str = cmd_key_find(c, "line");
+ cpos_str = cmd_key_find(c, "cursor-pos");
+
+ if (cpos_str) cpos = atoi(cpos_str);
+ if (line_str) args = eina_str_split(line_str, " ", -1);
+ if (args)
+ {
+ if (!strcmp(args[0], "rm"))
+ {
+ Eina_Strbuf *strbuf = cmd_strbuf_new("typebuf-icon");
+ if (strbuf)
+ {
+ cmd_strbuf_append(strbuf, "icon", "std:edit-delete");
+ cmd_strbuf_print_consume(strbuf);
+ }
+ }
+ else
+ {
+ Efreet_Desktop *d = efreet_util_desktop_exec_find(args[0]);
+
+ if (d)
+ {
+ Eina_Strbuf *strbuf = cmd_strbuf_new("typebuf-icon");
+ if (strbuf)
+ {
+ Eina_Strbuf *buf2 = eina_strbuf_new();
+
+ if (buf2)
+ {
+ eina_strbuf_append(buf2, "std:");
+ eina_strbuf_append(buf2, d->icon);
+ cmd_strbuf_append(strbuf, "icon",
+ eina_strbuf_string_get(buf2));
+ eina_strbuf_free(buf2);
+ }
+ cmd_strbuf_print_consume(strbuf);
+ }
+ }
+ efreet_desktop_free(d);
+ }
+// for (p = args; *p != NULL; p++)
+// fprintf(stderr, "XXX:ZZZ: [%s]\n", *p);
+ }
+ free(*args);
+ free(args);
}
// cmd_dump_sterr(c);
}
diff --git a/src/efm/efm.c b/src/efm/efm.c
index 1f64704..4ea7d55 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -701,6 +701,7 @@ _smart_del(Evas_Object *obj)
{
evas_object_del(sd->o_typebuf);
sd->o_typebuf = NULL;
+ sd->o_typebuf_icon = NULL; // deleted with parent typebuf
}
if (sd->o_typebuf_over)
{
@@ -756,6 +757,7 @@ _smart_del(Evas_Object *obj)
EINA_LIST_FREE(sd->typebuf.history, s) eina_stringshare_del(s);
eina_stringshare_replace(&sd->typebuf.restore, NULL);
eina_stringshare_replace(&sd->typebuf.prevcmd.line, NULL);
+ eina_stringshare_replace(&sd->typebuf.icon, NULL);
if (sd->dnd_drop_data)
{
free(sd->dnd_drop_data);
@@ -1830,67 +1832,7 @@ _menu_icon_radcheck_add(Evas_Object *o_base, int icon_col, const char *icon, int
elm_table_pack(o, elm_radio_add(o_base), 0, 0, 1, 1);
if (icon)
{ // we have an icon to add to the icon column
- // icon can be,,,,
- //
- // "std:menu-eject" - native to elm menus (strip std:)
- // "std:menu/folder" - native to elm menus (strip std:)
- // "file:/path/to/file.png" - use efm_icon
- // "/path/to/file.png" - same as above
- // "icon:/path/to/file" - use efm_icon
- // "thumb:/path/to/file" - use efm_icon
- // "video:/path/to/file.mp4" - use efm_icon
- // "fdo:icon-name" - use efreet to look up icon then use that
- o = NULL;
- if (!strncmp(icon, "std:", 4))
- {
- o = elm_icon_add(o_base);
- elm_icon_standard_set(o, icon + 4);
- }
- else if (!strncmp(icon, "file:", 5))
- {
- o = efm_icon_add(o_base);
- efm_icon_keep_aspect_set(o, EINA_TRUE);
- efm_icon_file_set(o, icon + 5);
- }
- else if (!strncmp(icon, "/", 1))
- {
- o = efm_icon_add(o_base);
- efm_icon_keep_aspect_set(o, EINA_TRUE);
- efm_icon_file_set(o, icon);
- }
- else if (!strncmp(icon, "thumb:", 6))
- {
- o = efm_icon_add(o_base);
- efm_icon_keep_aspect_set(o, EINA_TRUE);
- efm_icon_thumb_set(o, icon + 6);
- }
- else if (!strncmp(icon, "video:", 6))
- {
- o = efm_icon_add(o_base);
- efm_icon_keep_aspect_set(o, EINA_TRUE);
- efm_icon_video_set(o, icon + 6);
- }
- else if (!strncmp(icon, "fdo:", 4))
- {
- o = elm_icon_add(o_base);
- elm_icon_standard_set(o, icon + 4);
- }
- else if (!strncmp(icon, "edje:", 5))
- {
- char *dup = strdup(icon);
-
- if (dup)
- {
- char *delim = strchr(dup, '|'); // | == magic delimiter char
- if (delim)
- {
- *delim = 0; // break string at delim /path/file.edj|group
- o = edje_object_add(evas_object_evas_get(o_base));
- edje_object_file_set(o, dup + 5, delim + 1);
- }
- free(dup);
- }
- }
+ o = _flex_icon_add(o_base, icon);
// XXX: what if its an alpha thumb - needs color multiply by fg!
if (o)
{
diff --git a/src/efm/efm_back_end.c b/src/efm/efm_back_end.c
index dc323ba..4e4140d 100644
--- a/src/efm/efm_back_end.c
+++ b/src/efm/efm_back_end.c
@@ -5,6 +5,7 @@
#include "efm_util.h"
#include "efm_back_end.h"
#include "efm_private.h"
+#include "efm_typebuf.h"
void
_size_message(Evas_Object *o, double v)
@@ -657,6 +658,13 @@ _cb_thread_notify(void *data, Ecore_Thread *th EINA_UNUSED, void *msg)
_reset(sd);
CMD_DONE;
}
+ else if (!strcmp(c->command, "typebuf-icon"))
+ {
+ const char *icon = cmd_key_find(c, "icon");
+
+ typebuf_icon(sd, icon);
+ CMD_DONE;
+ }
// below commands all send a path for a specific file
path = file = cmd_key_find(c, "path");
diff --git a/src/efm/efm_structs.h b/src/efm/efm_structs.h
index fc4b197..4b0e0dc 100644
--- a/src/efm/efm_structs.h
+++ b/src/efm/efm_structs.h
@@ -47,6 +47,7 @@ struct _Smart_Data
Evas_Object *o_over;
Evas_Object *o_typebuf_over;
Evas_Object *o_typebuf;
+ Evas_Object *o_typebuf_icon;
Evas_Object *o_detail_header;
Evas_Object *o_detail_header_item[7];
@@ -86,6 +87,7 @@ struct _Smart_Data
{
Eina_Stringshare *restore;
Eina_List *history;
+ const char *icon;
int history_pos;
int cursor_ignore;
struct
diff --git a/src/efm/efm_typebuf.c b/src/efm/efm_typebuf.c
index c3a985d..7d5bb32 100644
--- a/src/efm/efm_typebuf.c
+++ b/src/efm/efm_typebuf.c
@@ -1,5 +1,7 @@
#include "efm_typebuf.h"
#include "efm_util.h"
+#include "eina_stringshare.h"
+#include "elm_entry_eo.legacy.h"
static int
_typebuf_command_detect(const char *str)
@@ -191,6 +193,7 @@ _typebuf_format(Smart_Data *sd)
{
_typebuf_command_clear(sd, s);
_typebuf_cmd_reset(sd);
+ typebuf_icon(sd, NULL);
}
// put cursor back where it was
elm_entry_cursor_pos_set(sd->o_typebuf, cpos);
@@ -404,6 +407,7 @@ typebuf_add(Smart_Data *sd, Evas_Event_Key_Down *ev)
sd->typebuf_on = EINA_TRUE;
// new entry obj to start fresh
if (sd->o_typebuf) evas_object_del(sd->o_typebuf);
+ sd->o_typebuf_icon = NULL;
sd->typebuf.history_pos = -1;
sd->o_typebuf = o = elm_entry_add(sd->o_scroller);
elm_object_style_set(o, "blank");
@@ -428,4 +432,36 @@ typebuf_add(Smart_Data *sd, Evas_Event_Key_Down *ev)
edje_object_signal_emit(sd->o_typebuf_over, "e,state,typebuf,start", "e");
elm_object_focus_set(o, EINA_TRUE);
_typebuf_format(sd);
-}
\ No newline at end of file
+}
+
+void
+typebuf_icon(Smart_Data *sd, const char *icon)
+{
+ if (!sd->typebuf_on) return;
+
+ if ((icon) && (icon[0]))
+ {
+ Evas_Object *o;
+
+ // same icon - skip
+ if (sd->typebuf.icon && (!strcmp(sd->typebuf.icon, icon))) return;
+ // replace icon with new one
+ if (sd->o_typebuf_icon) evas_object_del(sd->o_typebuf_icon);
+ sd->o_typebuf_icon = o = _flex_icon_add(sd->o_scroller, icon);
+ 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);
+ elm_entry_icon_visible_set(sd->o_typebuf, EINA_TRUE);
+ elm_object_part_content_set(sd->o_typebuf, "icon", o);
+ evas_object_show(o);
+ }
+ else
+ {
+ if (sd->o_typebuf_icon)
+ {
+ elm_entry_icon_visible_set(sd->o_typebuf, EINA_FALSE);
+ evas_object_del(sd->o_typebuf_icon);
+ sd->o_typebuf_icon = NULL;
+ }
+ eina_stringshare_replace(&sd->typebuf.icon, NULL);
+ }
+}
diff --git a/src/efm/efm_typebuf.h b/src/efm/efm_typebuf.h
index 6f26538..c0dbae6 100644
--- a/src/efm/efm_typebuf.h
+++ b/src/efm/efm_typebuf.h
@@ -7,5 +7,6 @@
void typebuf_del(Smart_Data *sd);
void typebuf_add(Smart_Data *sd, Evas_Event_Key_Down *ev);
+void typebuf_icon(Smart_Data *sd, const char *icon);
#endif
\ No newline at end of file
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 30597be..394996b 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -1,3 +1,4 @@
+#include "Evas.h"
#include "cmd.h"
#include "efm.h"
#include "efm_util.h"
@@ -2971,3 +2972,72 @@ _efm_icon_bring_in(Icon *icon)
elm_scroller_region_bring_in(icon->sd->o_scroller, ix, iy, iw, ih);
}
+
+Evas_Object *
+_flex_icon_add(Evas_Object *o_base, const char *icon)
+{
+ Evas_Object *o = NULL;
+
+ // icon can be,,,,
+ //
+ // "std:menu-eject" - native to elm menus (strip std:)
+ // "std:menu/folder" - native to elm menus (strip std:)
+ // "file:/path/to/file.png" - use efm_icon
+ // "/path/to/file.png" - same as above
+ // "icon:/path/to/file" - use efm_icon
+ // "thumb:/path/to/file" - use efm_icon
+ // "video:/path/to/file.mp4" - use efm_icon
+ // "fdo:icon-name" - use efreet to look up icon then use that
+ o = NULL;
+ if (!strncmp(icon, "std:", 4))
+ {
+ o = elm_icon_add(o_base);
+ elm_icon_standard_set(o, icon + 4);
+ }
+ else if (!strncmp(icon, "file:", 5))
+ {
+ o = efm_icon_add(o_base);
+ efm_icon_keep_aspect_set(o, EINA_TRUE);
+ efm_icon_file_set(o, icon + 5);
+ }
+ else if (!strncmp(icon, "/", 1))
+ {
+ o = efm_icon_add(o_base);
+ efm_icon_keep_aspect_set(o, EINA_TRUE);
+ efm_icon_file_set(o, icon);
+ }
+ else if (!strncmp(icon, "thumb:", 6))
+ {
+ o = efm_icon_add(o_base);
+ efm_icon_keep_aspect_set(o, EINA_TRUE);
+ efm_icon_thumb_set(o, icon + 6);
+ }
+ else if (!strncmp(icon, "video:", 6))
+ {
+ o = efm_icon_add(o_base);
+ efm_icon_keep_aspect_set(o, EINA_TRUE);
+ efm_icon_video_set(o, icon + 6);
+ }
+ else if (!strncmp(icon, "fdo:", 4))
+ {
+ o = elm_icon_add(o_base);
+ elm_icon_standard_set(o, icon + 4);
+ }
+ else if (!strncmp(icon, "edje:", 5))
+ {
+ char *dup = strdup(icon);
+
+ if (dup)
+ {
+ char *delim = strchr(dup, '|'); // | == magic delimiter char
+ if (delim)
+ {
+ *delim = 0; // break string at delim /path/file.edj|group
+ o = edje_object_add(evas_object_evas_get(o_base));
+ edje_object_file_set(o, dup + 5, delim + 1);
+ }
+ free(dup);
+ }
+ }
+ return o;
+}
\ No newline at end of file
diff --git a/src/efm/efm_util.h b/src/efm/efm_util.h
index 5f4cb5e..afad3b5 100644
--- a/src/efm/efm_util.h
+++ b/src/efm/efm_util.h
@@ -80,4 +80,6 @@ Eina_Bool _efm_icons_run(Smart_Data *sd, Eina_Bool last_sel);
void _efm_icon_bring_in(Icon *icon);
+Evas_Object *_flex_icon_add(Evas_Object *o_base, const char *icon);
+
#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.