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 c3436cc9979bc5b2101936a8d15d9b6ae3d2eab9
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Mon Oct 23 00:21:58 2023 +0100
add button details
---
TODO.md | 21 +++++-------
src/backends/table/open | 11 ++++---
src/efm/efm_util.c | 88 +++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 94 insertions(+), 26 deletions(-)
diff --git a/TODO.md b/TODO.md
index 93a9c39..3aa1378 100644
--- a/TODO.md
+++ b/TODO.md
@@ -57,18 +57,15 @@
* Lock view mode from backend
* Disable dnd/cnp from backend
* Streamline detail mode
- * Std detail mode keep
- * Above format would be a type per col. Types to support:
- * graph
- * solid
- * line
- * bars
- * multiple graphs
- * slider
- * range (slider 2 val)
- * button
- * segmentcontrol
- * hoversel
+ * graph
+ * solid
+ * line
+ * bars
+ * multiple graphs
+ * slider
+ * range (slider 2 val)
+ * segmentcontrol
+ * hoversel
## Medium term
diff --git a/src/backends/table/open b/src/backends/table/open
index 5e961df..da21a53 100755
--- a/src/backends/table/open
+++ b/src/backends/table/open
@@ -116,15 +116,15 @@ function handle_cmd_dir_set() {
M="type=file icon="${M}
# add one new file (4 of them) with params
-D="detail-format=text,text,progress,checkview,timestamp,size"
+D="detail-format=text,text,progress,checkview,button,size"
e_val_escape F ${DIR}"abba"
e_cmd "file-add path="${F}" "${M}" "${D}\
- " detail1=one detail2=two detail3=33/100 detail4=1 detail5=0 detail6=576/65536"
+ " detail1=one detail2=two detail3=33/100 detail4=1 detail5=Click,dance.gif detail6=576/65536"
- D="detail-format=text,text,progress,checkview,timestamp,size"
+ D="detail-format=text,text,progress,checkview,button,size"
e_val_escape F ${DIR}"boopy__==!@#$%^&*();"
e_cmd "file-add path="${F}" "${M}" "${D}\
- " detail1=one detail2=two detail3=noval,55/100 detail4=0 detail5=1696332215 detail6=16384/65536"
+ " detail1=one detail2=two detail3=noval,55/100 detail4=0 detail5=Pressme,std:security-high detail6=16384/65536"
D="detail-format=icon,check,circle,checkview,timestamp,size"
e_val_escape F ${DIR}"g h i"
@@ -187,6 +187,9 @@ function handle_cmd() {
file-detail-change )
e_err "file-detail-change" ${ARGS[0]} ${ARGS[1]} ${ARGS[2]} ${ARGS[3]} ${ARGS[4]} ${ARGS[5]}
;;
+ file-detail-clicked )
+ e_err "file-detail-clicked" ${ARGS[0]} ${ARGS[1]} ${ARGS[2]} ${ARGS[3]}
+ ;;
esac
}
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 6228d07..1a7cc9e 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -1255,11 +1255,11 @@ static void
_cb_icon_detail_check_changed(void *data, Evas_Object *o,
void *info EINA_UNUSED)
{
- Icon *icon = data;
- Eina_Strbuf *buf = cmd_strbuf_new("file-detail-change");
- const char *state = "false";
- char detail[32];
- int v;
+ Icon *icon = data;
+ Eina_Strbuf *buf = cmd_strbuf_new("file-detail-change");
+ const char *state = "false";
+ char detail[32];
+ int v;
_icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
v = (int)(unsigned long)evas_object_data_get(o, "detail");
@@ -1270,6 +1270,22 @@ _cb_icon_detail_check_changed(void *data, Evas_Object *o,
cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
}
+static void
+_cb_icon_detail_button_clicked(void *data, Evas_Object *o,
+ void *info EINA_UNUSED)
+{
+ Icon *icon = data;
+ Eina_Strbuf *buf = cmd_strbuf_new("file-detail-clicked");
+ char detail[32];
+ int v;
+
+ _icon_path_cmd_strbuf_append(buf, "path", icon->sd, icon);
+ v = (int)(unsigned long)evas_object_data_get(o, "detail");
+ snprintf(detail, sizeof(detail), "detail%i", v);
+ cmd_strbuf_append(buf, "detail", detail);
+ cmd_strbuf_exe_consume(buf, icon->sd->exe_open);
+}
+
static void
_icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
const char *theme_edj_file, int col, const char *detail,
@@ -1388,8 +1404,7 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
o = efm_icon_add(o);
efm_icon_keep_aspect_set(o, EINA_TRUE);
evas_object_pass_events_set(o, EINA_TRUE);
- if (detail[0] == '/')
- efm_icon_file_set(o, detail);
+ if (detail[0] == '/') efm_icon_file_set(o, detail);
else
{
Eina_Strbuf *strbuf = eina_strbuf_new();
@@ -1422,9 +1437,62 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
evas_object_show(o2);
evas_object_show(o);
}
- else fprintf(stderr,
- "Uknown format for file '%s' column %i format '%s'\n",
- icon->info.file, col, format);
+ else if (!strcmp(format, "button"))
+ { // format: Label or Label,icon where icon is same as icon above
+ char *label, *p;
+
+ o = _icon_detail_grid_add(icon, sd, col);
+ o = elm_button_add(o);
+ elm_object_focus_allow_set(o, EINA_FALSE);
+ evas_object_data_set(o, "detail", (void *)(unsigned long)(col + 1));
+ evas_object_propagate_events_set(o, EINA_FALSE);
+ label = strdup(detail);
+ if (label)
+ {
+ p = strchr(label, ',');
+ if (p)
+ {
+ *p = 0;
+ p++;
+ if (!strncmp(p, "std:", 4))
+ {
+ o2 = elm_icon_add(o);
+ evas_object_pass_events_set(o2, EINA_TRUE);
+ elm_icon_standard_set(o2, p + 4);
+ elm_object_part_content_set(o, "icon", o2);
+ evas_object_show(o2);
+ }
+ else
+ {
+ o2 = efm_icon_add(o);
+ efm_icon_keep_aspect_set(o2, EINA_TRUE);
+ evas_object_pass_events_set(o2, EINA_TRUE);
+ if (p[0] == '/') efm_icon_file_set(o2, p);
+ else
+ {
+ Eina_Strbuf *strbuf = eina_strbuf_new();
+
+ eina_strbuf_append(strbuf, sd->config.path);
+ eina_strbuf_append(strbuf, p);
+ efm_icon_file_set(o2, eina_strbuf_string_get(strbuf));
+ eina_strbuf_free(strbuf);
+ }
+ elm_object_part_content_set(o, "icon", o2);
+ evas_object_show(o2);
+ }
+ }
+ elm_object_text_set(o, label);
+ evas_object_smart_callback_add(o, "clicked",
+ _cb_icon_detail_button_clicked,
+ icon);
+ free(label);
+ }
+ elm_grid_pack(icon->o_list_detail_swallow[col], o, 0, 0, 1, 1);
+ evas_object_show(o);
+ }
+ else
+ fprintf(stderr, "Uknown format for file '%s' column %i format '%s'\n",
+ icon->info.file, col, format);
}
static void
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.