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 65e9a6cf784266f0545504a7bb4c2766886fcd8d
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Sat Sep 9 11:50:19 2023 +0100
move many config vars to config sub-struct
---
src/efm/efm.c | 50 +++++++++++++++++++++++++-------------------------
src/efm/efm_dnd.c | 7 ++++---
src/efm/efm_structs.h | 10 ++++------
src/efm/efm_util.c | 17 ++++++++---------
4 files changed, 41 insertions(+), 43 deletions(-)
diff --git a/src/efm/efm.c b/src/efm/efm.c
index ce1cd9a..583db25 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -490,7 +490,7 @@ _cb_overlay_detail_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
if (obj == sd->o_list_detail[i])
{
sd->detail_down_start_min_w =
- sd->detail_min_w[i] * _scale_get(sd);
+ sd->config.detail_min_w[i] * _scale_get(sd);
break;
}
}
@@ -528,12 +528,12 @@ _cb_overlay_detail_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
if (obj == sd->o_list_detail[i])
{
o = sd->o_list_detail_swallow[i];
- sd->detail_min_w[i] =
+ sd->config.detail_min_w[i] =
(sd->detail_down_start_min_w -
(ev->cur.canvas.x - sd->detail_down_x)) / _scale_get(sd);
- if (sd->detail_min_w[i] < 0) sd->detail_min_w[i] = 0;
+ if (sd->config.detail_min_w[i] < 0) sd->config.detail_min_w[i] = 0;
snprintf(buf, sizeof(buf), "e.swallow.detail%i", i + 1);
- evas_object_size_hint_min_set(o, sd->detail_min_w[i] * _scale_get(sd), 0);
+ evas_object_size_hint_min_set(o, sd->config.detail_min_w[i] * _scale_get(sd), 0);
edje_object_part_swallow(sd->o_list_detailed_dummy, buf, o);
_reposition_detail_bars(sd);
_detail_realized_items_resize(sd);
@@ -619,7 +619,7 @@ _add_overlay_objects(Smart_Data *sd)
sd->o_list_detail_swallow[i] = o = evas_object_rectangle_add(e);
snprintf(buf, sizeof(buf), "e.swallow.detail%i", i + 1);
- evas_object_size_hint_min_set(o, sd->detail_min_w[i] * _scale_get(sd), 0);
+ evas_object_size_hint_min_set(o, sd->config.detail_min_w[i] * _scale_get(sd), 0);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE,
_cb_overlay_detail_swallow_move, sd);
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE,
@@ -657,13 +657,13 @@ _smart_add(Evas_Object *obj)
EFM_SORT_MODE_DIRS_FIRST;
// XXX: get this from config...
sd->config.icon_size = 40;
- sd->detail_min_w[0] = 50;
- sd->detail_min_w[1] = 120;
- sd->detail_min_w[2] = 130;
- sd->detail_min_w[3] = 60;
- sd->detail_min_w[4] = 60;
- sd->detail_min_w[5] = 120;
- sd->backend = eina_stringshare_add("default");
+ sd->config.detail_min_w[0] = 50;
+ sd->config.detail_min_w[1] = 120;
+ sd->config.detail_min_w[2] = 130;
+ sd->config.detail_min_w[3] = 60;
+ sd->config.detail_min_w[4] = 60;
+ sd->config.detail_min_w[5] = 120;
+ sd->config.backend = eina_stringshare_add("default");
evas_object_size_hint_min_set(obj, 1, 1);
@@ -768,8 +768,8 @@ _smart_del(Evas_Object *obj)
ecore_thread_cancel(sd->thread);
sd->thread = NULL;
}
- eina_stringshare_replace(&(sd->path), NULL);
- eina_stringshare_replace(&(sd->backend), NULL);
+ eina_stringshare_replace(&(sd->config.path), NULL);
+ eina_stringshare_replace(&(sd->config.backend), NULL);
if (sd->exe_open)
{
Pending_Exe_Del *pend = calloc(1, sizeof(Pending_Exe_Del));
@@ -1286,7 +1286,7 @@ _reset(Smart_Data *sd)
eina_strbuf_append(buf, "/.e/e");
}
eina_strbuf_append(buf, "/efm/backends/");
- eina_strbuf_append(buf, sd->backend);
+ eina_strbuf_append(buf, sd->config.backend);
snprintf(envbuf, sizeof(envbuf), "EFM_BACKEND_DIR=%s",
eina_strbuf_string_get(buf));
eina_strbuf_append(buf, "/open");
@@ -1296,7 +1296,7 @@ _reset(Smart_Data *sd)
eina_strbuf_append(buf, elm_app_lib_dir_get());
eina_strbuf_append(buf, "/efm/backends/");
- eina_strbuf_append(buf, sd->backend);
+ eina_strbuf_append(buf, sd->config.backend);
snprintf(envbuf, sizeof(envbuf), "EFM_BACKEND_DIR=%s",
eina_strbuf_string_get(buf));
eina_strbuf_append(buf, "/open");
@@ -1310,11 +1310,11 @@ _reset(Smart_Data *sd)
ECORE_EXE_PIPE_WRITE, NULL);
eina_strbuf_free(buf);
- if (sd->path)
+ if (sd->config.path)
{
_listing_do(sd);
buf = cmd_strbuf_new("dir-set");
- cmd_strbuf_append(buf, "path", sd->path);
+ cmd_strbuf_append(buf, "path", sd->config.path);
cmd_strbuf_exe_consume(buf, sd->exe_open);
}
}
@@ -1668,8 +1668,8 @@ efm_path_set(Evas_Object *obj, const char *path)
path_sane = _sanitize_dir(path);
if (!path_sane) return;
- if ((sd->path) && (!strcmp(sd->path, path_sane))) goto done;
- eina_stringshare_replace(&(sd->path), path_sane);
+ if ((sd->config.path) && (!strcmp(sd->config.path, path_sane))) goto done;
+ eina_stringshare_replace(&(sd->config.path), path_sane);
_reset(sd);
done:
free(path_sane);
@@ -1680,7 +1680,7 @@ efm_path_get(Evas_Object *obj)
{
ENTRY NULL;
- return sd->path;
+ return sd->config.path;
}
////////
@@ -1735,7 +1735,7 @@ efm_column_min_get(Evas_Object *obj, int col)
if (col < 0) return 0;
else if (col >= 6) return 0;
- return sd->detail_min_w[col];
+ return sd->config.detail_min_w[col];
}
void
@@ -1745,7 +1745,7 @@ efm_column_min_set(Evas_Object *obj, int col, Evas_Coord w)
if (col < 0) return;
else if (col >= 6) return;
- sd->detail_min_w[col] = w;
+ sd->config.detail_min_w[col] = w;
}
Evas_Coord
@@ -1769,7 +1769,7 @@ efm_backend_get(Evas_Object *obj)
{
ENTRY NULL;
- return sd->backend;
+ return sd->config.backend;
}
void
@@ -1778,5 +1778,5 @@ efm_backend_set(Evas_Object *obj, const char *backend)
ENTRY;
if (!backend) backend = "default";
- eina_stringshare_replace(&(sd->backend), backend);
+ eina_stringshare_replace(&(sd->config.backend), backend);
}
diff --git a/src/efm/efm_dnd.c b/src/efm/efm_dnd.c
index bff564f..0fbded8 100644
--- a/src/efm/efm_dnd.c
+++ b/src/efm/efm_dnd.c
@@ -152,7 +152,7 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
{
if ((icon->sd == sd) && (icon->drag))
{
- printf(" dropicon is %s%s\n", icon->sd->path, icon->info.file);
+ printf(" dropicon is %s%s\n", icon->sd->config.path, icon->info.file);
delta_x = icon->sd->dnd_x - icon->down_rel_x - icon->geom.x;
delta_y = icon->sd->dnd_y - icon->down_rel_y - icon->geom.y;
icon->drag = EINA_FALSE;
@@ -192,9 +192,10 @@ _cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
}
printf("XXX: -> DROPICON: [%s] %i %i\n", icon->info.file, icon->geom.x, icon->geom.y);
buf = cmd_strbuf_new("meta-set");
- // sd->path always ends in /
+ // sd->config.path always ends in /
// XXX: use strbuf for str
- snprintf(str, sizeof(str), "%s%s", icon->sd->path, icon->info.file);
+ snprintf(str, sizeof(str), "%s%s",
+ icon->sd->config.path, icon->info.file);
cmd_strbuf_append(buf, "path", str);
snprintf(str, sizeof(str), "%i,%i",
(int)(icon->geom.x / _scale_get(icon->sd)),
diff --git a/src/efm/efm_structs.h b/src/efm/efm_structs.h
index 600d0bc..15c11d2 100644
--- a/src/efm/efm_structs.h
+++ b/src/efm/efm_structs.h
@@ -38,10 +38,6 @@ struct _Smart_Data
Evas_Object *o_overlay_grid;
Evas_Object *o_overlay_info;
- Eina_Stringshare *path;
-
- Eina_Stringshare *backend;
-
Ecore_Exe *exe_open;
Ecore_Event_Handler *handler_exe_del;
Ecore_Event_Handler *handler_exe_data;
@@ -72,7 +68,6 @@ struct _Smart_Data
Evas_Coord dnd_scroll_x, dnd_scroll_y;
Evas_Coord detail_down_x, detail_down_y;
Evas_Coord detail_down_start_min_w;
- Evas_Coord detail_min_w[6];
Evas_Coord detail_header_min_h[7];
double focus_start_time;
double focus_pos;
@@ -105,7 +100,10 @@ struct _Smart_Data
struct {
Efm_View_Mode view_mode;
Efm_Sort_Mode sort_mode;
- int icon_size;
+ Evas_Coord icon_size;
+ Eina_Stringshare *path;
+ Eina_Stringshare *backend;
+ Evas_Coord detail_min_w[6];
} config;
};
diff --git a/src/efm/efm_util.c b/src/efm/efm_util.c
index 33d5964..9075e0e 100644
--- a/src/efm/efm_util.c
+++ b/src/efm/efm_util.c
@@ -101,8 +101,7 @@ _icons_path_find(const char *path)
EINA_LIST_FOREACH(block->icons, il, icon)
{
eina_strbuf_reset(strbuf);
- eina_strbuf_append(strbuf, sd->path);
- eina_strbuf_append_char(strbuf, '/');
+ eina_strbuf_append(strbuf, sd->config.path);
eina_strbuf_append(strbuf, icon->info.file);
if (!strcmp(path, eina_strbuf_string_get(strbuf)))
icons = eina_list_append(icons, icon);
@@ -129,8 +128,7 @@ _selected_icons_uri_strbuf_append(Smart_Data *sd, Eina_Strbuf *strbuf)
{
if (!icon->selected) continue; // skip icons not selected
eina_strbuf_append(strbuf, "file://");
- _strbuf_escape_append(strbuf, icon->sd->path);
- eina_strbuf_append_char(strbuf, '/');
+ _strbuf_escape_append(strbuf, icon->sd->config.path);
_strbuf_escape_append(strbuf, icon->info.file);
eina_strbuf_append_char(strbuf, '\n');
added = EINA_TRUE;
@@ -160,7 +158,8 @@ _detail_realized_items_resize(Smart_Data *sd)
{
snprintf(buf, sizeof(buf), "e.swallow.detail%i", i + 1);
o = icon->o_list_detail_swallow[i];
- evas_object_size_hint_min_set(o, sd->detail_min_w[i] * _scale_get(sd), 0);
+ evas_object_size_hint_min_set
+ (o, sd->config.detail_min_w[i] * _scale_get(sd), 0);
edje_object_part_swallow(icon->o_base, buf, o);
}
}
@@ -1158,7 +1157,7 @@ _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e, const char *theme_edj_file
elm_grid_add(sd->o_scroller);
elm_grid_size_set(o2, 1, 1);
evas_object_size_hint_min_set
- (o2, sd->detail_min_w[0] * _scale_get(sd), 0);
+ (o2, sd->config.detail_min_w[0] * _scale_get(sd), 0);
edje_object_part_swallow(icon->o_base, "e.swallow.detail1", o2);
icon->o_list_detail_swallow2[0] = o2 =
edje_object_add(e);
@@ -1216,7 +1215,7 @@ _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e, const char *theme_edj_file
elm_grid_add(sd->o_scroller);
elm_grid_size_set(o2, 1, 1);
evas_object_size_hint_min_set
- (o2, sd->detail_min_w[1] * _scale_get(sd), 0);
+ (o2, sd->config.detail_min_w[1] * _scale_get(sd), 0);
edje_object_part_swallow(icon->o_base, "e.swallow.detail2", o2);
icon->o_list_detail_swallow2[1] = o2 =
edje_object_add(e);
@@ -1258,7 +1257,7 @@ _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e, const char *theme_edj_file
elm_grid_add(sd->o_scroller);
elm_grid_size_set(o2, 1, 1);
evas_object_size_hint_min_set
- (o2, sd->detail_min_w[5] * _scale_get(sd), 0);
+ (o2, sd->config.detail_min_w[5] * _scale_get(sd), 0);
edje_object_part_swallow(icon->o_base, "e.swallow.detail6", o2);
icon->o_list_detail_swallow2[5] = o2 =
edje_object_add(e);
@@ -1298,7 +1297,7 @@ _icon_object_add(Icon *icon, Smart_Data *sd, Evas *e, const char *theme_edj_file
evas_object_rectangle_add(e);
evas_object_color_set(o2, 0, 0, 0, 0);
evas_object_size_hint_min_set
- (o2, sd->detail_min_w[i] * _scale_get(sd), 0);
+ (o2, sd->config.detail_min_w[i] * _scale_get(sd), 0);
snprintf(buf2, sizeof(buf2), "e.swallow.detail%i", i + 1);
edje_object_part_swallow(icon->o_base, buf2, o2);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.