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 e9729cd8f56a01ef2d0be683b53c3e9225321f8e
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Thu Jul 25 14:41:06 2024 +0100

    menu - test icon types and handle them from icon file
---
 src/efm/efm.c      |  1 +
 src/efm/efm_util.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/src/efm/efm.c b/src/efm/efm.c
index 0635232..a85c361 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -2044,6 +2044,7 @@ _menu_icon_radcheck_add(Evas_Object *o_base, int icon_col, const char *icon, int
           o = elm_icon_add(o_base);
           elm_icon_standard_set(o, icon + 4);
         }
+      // XXX: what if its an alpha thumb - needs colro multiply by fg!
       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_table_pack(o_table, o, icon_col, 0, 1, 1);
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 1103c26..1c9f6c5 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -6,6 +6,7 @@
 #include "efm_dnd.h"
 #include "efm_back_end.h"
 #include "efm_private.h"
+#include "eina_strbuf.h"
 
 // util funcs for the efm view
 static inline int
@@ -1100,8 +1101,11 @@ _cb_icon_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
       if (!dragged)
         {
           Efm_Menu *m1, *m2;
+          Eina_Strbuf *icbuf;
+          const char *icstr;
 
           printf("XXX: right mouse\n");
+          icbuf = eina_strbuf_new();
           m1 = _efm_menu_add("Submenu", "std:mail-reply-all");
           _efm_menu_it_normal(m1, "Item 1", "std:menu/folder", _cb_ic_item1,
                               icon, NULL);
@@ -1112,10 +1116,62 @@ _cb_icon_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
                               _cb_ic_item3, icon, NULL);
           _efm_menu_it_normal(m1, "Item 4", "std:battery", _cb_ic_item4, icon,
                               NULL);
-          
+
           m2 = _efm_menu_add("Main Menu", "std:security-high");
-          _efm_menu_it_normal(m2, "Item 5", "std:system-run", _cb_ic_item5, icon,
-                              NULL);
+          eina_strbuf_reset(icbuf);
+          if (icon->info.thumb)
+            {
+              eina_strbuf_append(icbuf, "thumb:");
+              eina_strbuf_append(icbuf, icon->info.thumb);
+            }
+          else
+            {
+              const char *ic;
+
+              ic = icon->info.pre_lookup_icon;
+              if (!ic) ic = icon->info.icon;
+              if (!ic)
+                {
+//              snprintf(buf, sizeof(buf), "e/icons/fileman/mime/%s",
+//                       icon->info.mime);
+//              icon_file = elm_theme_group_path_find(NULL, buf);
+//              // mime type icon exists
+//              if (icon_file) icon_group = buf;
+//              else
+//                { // use an out-of-theme std mime icon
+                  ic = icon->info.mime_icon;
+//                }
+                }
+//              if (!ic)
+//                {
+//              snprintf(buf, sizeof(buf), "e/icons/fileman/mime/inode/file");
+//              icon_file  = elm_theme_group_path_find(NULL, buf);
+//              icon_group = buf;
+//                }
+              if ((ic) && (ic[0] == '/'))
+                {
+                  // XXX: need common code for this toshare
+                  const char *ext = strrchr(ic, '.');
+                  if (ext
+                      && ((!strcasecmp(ext, ".webm"))
+                          || (!strcasecmp(ext, ".mp4"))
+                          || (!strcasecmp(ext, ".m4v"))))
+                    eina_strbuf_append(icbuf, "video:");
+                  else eina_strbuf_append(icbuf, "file:");
+                  eina_strbuf_append(icbuf, ic);
+                }
+              else if (ic)
+                {
+                  eina_strbuf_append(icbuf, "std:");
+                  eina_strbuf_append(icbuf, ic);
+                }
+            }
+          icstr = eina_strbuf_string_get(icbuf);
+          if ((icstr) && (!icstr[0])) icstr = NULL;
+          _efm_menu_it_normal(m2, icon->info.label, icstr, _cb_ic_item5,
+                              icon, NULL);
+          _efm_menu_it_normal(m2, "Item 5", "std:system-run", _cb_ic_item5,
+                              icon, NULL);
           _efm_menu_it_separator(m2);
           _efm_menu_it_check(m2, "Check 1", "std:folder", EINA_FALSE,
                              _cb_ic_item6, icon, NULL);
@@ -1138,6 +1194,7 @@ _cb_icon_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
           _efm_menu_it_sub(m2, "Submenu here", "fdo:terminology", m1);
 
           _efm_menu_show(icon->sd->o_smart, m2, icon->down_x, icon->down_y);
+          eina_strbuf_free(icbuf);
         }
       icon->sd->last_focused = icon;
       icon->drag             = EINA_FALSE;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to