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 6b9cc3fa07614af29f085fb9766d021976f12bd2
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Tue Oct 17 20:34:59 2023 +0100

    add custom detail view progress type
---
 src/backends/table/open | 21 ++++++++++++++++-----
 src/efm/efm_util.c      | 47 ++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/src/backends/table/open b/src/backends/table/open
index df74dc3..03eba84 100755
--- a/src/backends/table/open
+++ b/src/backends/table/open
@@ -111,19 +111,30 @@ function handle_cmd_dir_set() {
 # begin initial listing of files
   e_cmd "list-begin"
 # define some params we're going to use
-  D="detail-format=text,text,text,checkview,timestamp,size detail1=one detail2=two detail3=three"
 # an icon image to use
   e_val_escape M ${DIR}"ic.jpg"
   M="type=file icon="${M}
 # add one new file (4 of them) with params
+
+D="detail-format=text,text,progress,checkview,timestamp,size"
   e_val_escape F ${DIR}"abba"
-  e_cmd "file-add path="${F}" "${M}" "${D}" detail4=1 detail5=0 detail6=576/65536"
+  e_cmd "file-add path="${F}" "${M}" "${D}\
+    " detail1=one detail2=two detail3=33/100 detail4=1 detail5=0 detail6=576/65536"
+
+  D="detail-format=text,text,progress,checkview,timestamp,size"
   e_val_escape F ${DIR}"boopy__==!@#$%^&*();"
-  e_cmd "file-add path="${F}" "${M}" "${D}" detail4=0 detail5=1696332215 detail6=16384/65536"
+  e_cmd "file-add path="${F}" "${M}" "${D}\
+    " detail1=one detail2=two detail3=noval,55/100 detail4=0 detail5=1696332215 detail6=16384/65536"
+
+  D="detail-format=text,text,text,checkview,timestamp,size"
   e_val_escape F ${DIR}"g h i"
-  e_cmd "file-add path="${F}" "${M}" "${D}" detail4=true detail5=1696322215 detail6=65535/65536"
+  e_cmd "file-add path="${F}" "${M}" "${D}\
+    " detail1=one detail2=two detail3=three detail4=true detail5=1696322215 detail6=65535/65536"
+
+  D="detail-format=text,text,text,checkview,timestamp,size"
   e_val_escape F ${DIR}"z~"
-  e_cmd "file-add path="${F}" "${M}" "${D}" detail4=false detail5=1296332215 detail6=7823/65536"
+  e_cmd "file-add path="${F}" "${M}" "${D}\
+    " detail1=one detail2=two detail3=three detail4=false detail5=1296332215 detail6=7823/65536"
 # end initial listing of files
   e_cmd "list-end"
 }
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 9138228..2849dd3 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -1243,10 +1243,16 @@ _icon_detail_edje_text_set_free(Evas_Object *o, const char *part, char *str)
   free(str);
 }
 
+static char *
+_cb_progress_noval(double v EINA_UNUSED)
+{
+  return "";
+}
+
 static void
 _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
-                 const char *theme_edj_file, int col,
-                 const char *detail, const char *format)
+                 const char *theme_edj_file, int col, const char *detail,
+                 const char *format)
 {
   Evas_Object *o;
   char buf[128];
@@ -1307,17 +1313,36 @@ _icon_detail_add(Icon *icon, Smart_Data *sd, Evas *e,
       o = _icon_detail_grid_add(icon, sd, col);
       o = _icon_detail_grid_sub_edje_add(icon, e, theme_edj_file, col,
                                          "e/fileman/default/check");
-      if ((!strcasecmp(detail, "1")) ||
-          (!strcasecmp(detail, "on")) ||
-          (!strcasecmp(detail, "true")) ||
-          (!strcasecmp(detail, "yes")))
+      if ((!strcasecmp(detail, "1")) || (!strcasecmp(detail, "on"))
+          || (!strcasecmp(detail, "true")) || (!strcasecmp(detail, "yes")))
         edje_object_signal_emit(o, "e,state,on", "e");
-      else
-        edje_object_signal_emit(o, "e,state,off", "e");
+      else edje_object_signal_emit(o, "e,state,off", "e");
     }
-  else
-    fprintf(stderr, "Uknown format for file '%s' column %i format '%s'\n",
-            icon->info.file, col, format);
+  else if (!strcmp(format, "progress"))
+    { // format: 33/100 or noval,41/50 - value / maxvalue optional noval
+      int val = 0, max = 100;
+
+      o = _icon_detail_grid_add(icon, sd, col);
+      o = elm_progressbar_add(o);
+      elm_progressbar_horizontal_set(o, EINA_TRUE);
+      elm_progressbar_span_size_set(o, 1);
+      elm_grid_pack(icon->o_list_detail_swallow[col], o, 0, 0, 1, 1);
+      if (sscanf(detail, "%i/%i", &val, &max) == 2)
+        {
+          if (max < 1) max = 0;
+        }
+      else if (sscanf(detail, "noval,%i/%i", &val, &max) == 2)
+        {
+          elm_progressbar_unit_format_function_set(o, _cb_progress_noval,
+                                                   NULL);
+          if (max < 1) max = 0;
+        }
+      elm_progressbar_value_set(o, (double)val / (double)max);
+      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.

Reply via email to