From 69e3176f4e36a0d8d18c716386ada69969720a30 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Mon, 8 Jan 2018 23:17:02 +0100 Subject: [PATCH] options_background: rewrite to have multiple widgets --- src/bin/options.c | 1 - src/bin/options_background.c | 383 ++++++++++++++++++++--------------- 2 files changed, 222 insertions(+), 162 deletions(-) diff --git a/src/bin/options.c b/src/bin/options.c index 63ef8638..2798718b 100644 --- a/src/bin/options.c +++ b/src/bin/options.c @@ -80,7 +80,6 @@ _cb_op_del_delay(void *data) evas_object_del(ctx->opbox); evas_object_del(ctx->frame); options_font_clear(); - options_background_clear(); options_theme_clear(); free(ctx); diff --git a/src/bin/options_background.c b/src/bin/options_background.c index 29ca431d..05fe49a9 100644 --- a/src/bin/options_background.c +++ b/src/bin/options_background.c @@ -1,6 +1,7 @@ #include "private.h" #include +#include #include "config.h" #include "termio.h" #include "media.h" @@ -11,6 +12,24 @@ #include "main.h" #include +typedef struct _Background_Ctx { + Config *config; + Evas_Object *frame; + Evas_Object *flip; + Evas_Object *bg_grid; + Evas_Object *term; + Evas_Object *entry; + Evas_Object *bubble; + Evas_Object *op_trans; + Evas_Object *op_opacity; + Evas_Object *op_shine_slider; + + Eina_Stringshare *system_path; + Eina_Stringshare *user_path; + Eina_List *background_list; + Ecore_Timer *bubble_disappear; +} Background_Ctx; + typedef struct _Background_Item { const char *path; @@ -25,31 +44,14 @@ typedef struct _Insert_Gen_Grid_Item_Notify } Insert_Gen_Grid_Item_Notify; -static Eina_Stringshare *_system_path, - *_user_path; - -static Evas_Object *_bg_grid = NULL, - *_term = NULL, - *_entry = NULL, - *_flip = NULL, - *_bubble = NULL; - -static Eina_List *_backgroundlist = NULL; - -static Ecore_Timer *_bubble_disappear; - -static Ecore_Thread *_thread; -static Evas_Object *op_trans, *op_opacity; -static Evas_Object *op_shine_slider = NULL; - static void _cb_op_shine_sel(void *data, Evas_Object *obj, void *_event EINA_UNUSED) { - Evas_Object *termio_obj = data; - Config *config = termio_config_get(termio_obj); - Term *term = termio_term_get(termio_obj); + Background_Ctx *ctx = data; + Config *config = ctx->config; + Term *term = termio_term_get(ctx->term); Win *wn = term_win_get(term); int shine = elm_slider_value_get(obj); Eina_List *l, *wn_list; @@ -69,10 +71,11 @@ _cb_op_video_trans_chg(void *data, Evas_Object *obj, void *_event EINA_UNUSED) { - Evas_Object *term = data; - Config *config = termio_config_get(term); + Background_Ctx *ctx = data; + Config *config = ctx->config; + config->translucent = elm_check_state_get(obj); - elm_object_disabled_set(op_opacity, !config->translucent); + elm_object_disabled_set(ctx->op_opacity, !config->translucent); main_trans_update(config); config_save(config, NULL); } @@ -82,64 +85,70 @@ _cb_op_video_opacity_chg(void *data, Evas_Object *obj, void *_event EINA_UNUSED) { - Evas_Object *term = data; - Config *config = termio_config_get(term); + Background_Ctx *ctx = data; + Config *config = ctx->config; + config->opacity = elm_slider_value_get(obj); - if (!config->translucent) return; + if (!config->translucent) + return; main_trans_update(config); config_save(config, NULL); } static void -_cb_fileselector(void *_data EINA_UNUSED, +_cb_fileselector(void *data, Evas_Object *obj, void *event) { + Background_Ctx *ctx = data; - if (event) - { - elm_object_text_set(_entry, elm_fileselector_path_get(obj)); - elm_flip_go_to(_flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT); - } - else - { - elm_flip_go_to(_flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT); - } + if (event) + { + elm_object_text_set(ctx->entry, elm_fileselector_path_get(obj)); + elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT); + } + else + { + elm_flip_go_to(ctx->flip, EINA_TRUE, ELM_FLIP_PAGE_LEFT); + } } static Eina_Bool -_cb_timer_bubble_disappear(void *_data EINA_UNUSED) +_cb_timer_bubble_disappear(void *data) { - evas_object_del(_bubble); - _bubble_disappear = NULL; + Background_Ctx *ctx = data; + evas_object_del(ctx->bubble); + ctx->bubble = NULL; + ctx->bubble_disappear = NULL; return ECORE_CALLBACK_CANCEL; } static void -_bubble_show(char *text) +_bubble_show(Background_Ctx *ctx, char *text) { - Evas_Object *opbox = elm_object_top_widget_get(_bg_grid); + Evas_Object *opbox = elm_object_top_widget_get(ctx->bg_grid); Evas_Object *o; int x = 0, y = 0, w , h; - evas_object_geometry_get(_bg_grid, &x, &y, &w ,&h); - if (_bubble_disappear) + evas_object_geometry_get(ctx->bg_grid, &x, &y, &w ,&h); + if (ctx->bubble_disappear) { - ecore_timer_del(_bubble_disappear); - _cb_timer_bubble_disappear(NULL); + ecore_timer_del(ctx->bubble_disappear); + _cb_timer_bubble_disappear(ctx); } - _bubble = elm_bubble_add(opbox); - elm_bubble_pos_set(_bubble, ELM_BUBBLE_POS_BOTTOM_RIGHT); - evas_object_resize(_bubble, 200, 50); - evas_object_move(_bubble, (x + w - 200), (y + h - 50)); - evas_object_show(_bubble); + ctx->bubble = elm_bubble_add(opbox); + elm_bubble_pos_set(ctx->bubble, ELM_BUBBLE_POS_BOTTOM_RIGHT); + evas_object_resize(ctx->bubble, 200, 50); + evas_object_move(ctx->bubble, (x + w - 200), (y + h - 50)); + evas_object_show(ctx->bubble); - o = elm_label_add(_bubble); + o = elm_label_add(ctx->bubble); elm_object_text_set(o, text); - elm_object_content_set(_bubble, o); + elm_object_content_set(ctx->bubble, o); - _bubble_disappear = ecore_timer_add(2.0, _cb_timer_bubble_disappear, NULL); + ctx->bubble_disappear = ecore_timer_add(2.0, + _cb_timer_bubble_disappear, ctx); } static char * @@ -150,18 +159,22 @@ _grid_text_get(void *data, Background_Item *item = data; const char *s; - if (!item->path) return strdup(_("None")); + if (!item->path) + return strdup(_("None")); s = ecore_file_file_get(item->path); - if (s) return strdup(s); + if (s) + return strdup(s); return NULL; } static Evas_Object * _grid_content_get(void *data, Evas_Object *obj, const char *part) { + Background_Ctx *ctx = evas_object_data_get(obj, "ctx"); + assert(ctx); Background_Item *item = data; Evas_Object *o, *oe; - Config *config = termio_config_get(_term); + Config *config = ctx->config; char path[PATH_MAX]; if (!strcmp(part, "elm.swallow.icon")) @@ -181,7 +194,8 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part) } else { - if (!config->theme) return NULL; + if (!config->theme) + return NULL; snprintf(path, PATH_MAX, "%s/themes/%s", elm_app_data_dir_get(), config->theme); o = elm_layout_add(obj); @@ -200,11 +214,12 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part) static void _item_selected(void *data, - Evas_Object *_obj EINA_UNUSED, + Evas_Object *obj, void *_event EINA_UNUSED) { + Background_Ctx *ctx = evas_object_data_get(obj, "ctx"); Background_Item *item = data; - Config *config = termio_config_get(_term); + Config *config = ctx->config; if (!config) return; if (!item->path) @@ -223,17 +238,18 @@ _item_selected(void *data, } static void -_insert_gengrid_item(Insert_Gen_Grid_Item_Notify *msg_data) +_insert_gengrid_item(Background_Ctx *ctx, + Insert_Gen_Grid_Item_Notify *msg_data) { Insert_Gen_Grid_Item_Notify *insert_msg = msg_data; - Config *config = termio_config_get(_term); + Config *config = ctx->config; if (insert_msg && insert_msg->item && insert_msg->class && config) { Background_Item *item = insert_msg->item; Elm_Gengrid_Item_Class *item_class = insert_msg->class; - item->item = elm_gengrid_item_append(_bg_grid, item_class, item, + item->item = elm_gengrid_item_append(ctx->bg_grid, item_class, item, _item_selected, item); if ((!item->path) && (!config->background)) { @@ -255,8 +271,8 @@ _insert_gengrid_item(Insert_Gen_Grid_Item_Notify *msg_data) } static Eina_List* -_rec_read_directorys(Eina_List *list, const char *root_path, - Elm_Gengrid_Item_Class *class) +_rec_read_directorys(Background_Ctx *ctx, Eina_List *list, + const char *root_path, Elm_Gengrid_Item_Class *class) { Eina_List *childs = ecore_file_ls(root_path); char *file_name, path[PATH_MAX]; @@ -296,7 +312,7 @@ _rec_read_directorys(Eina_List *list, const char *root_path, notify->class = class; notify->item = item; //ecore_thread_feedback(th, notify); - _insert_gengrid_item(notify); + _insert_gengrid_item(ctx, notify); } } break; @@ -310,31 +326,30 @@ _rec_read_directorys(Eina_List *list, const char *root_path, } static void -_refresh_directory(const char* data) +_refresh_directory(Background_Ctx *ctx, const char* data) { Background_Item *item; Elm_Gengrid_Item_Class *item_class; - // This will run elm_gengrid_clear - elm_gengrid_clear(_bg_grid); + elm_gengrid_clear(ctx->bg_grid); - if (_backgroundlist) + if (ctx->background_list) { - EINA_LIST_FREE(_backgroundlist, item) + EINA_LIST_FREE(ctx->background_list, item) { if (item->path) eina_stringshare_del(item->path); free(item); } - _backgroundlist = NULL; + ctx->background_list = NULL; } item_class = elm_gengrid_item_class_new(); item_class->func.text_get = _grid_text_get; item_class->func.content_get = _grid_content_get; item = calloc(1, sizeof(Background_Item)); - _backgroundlist = eina_list_append(_backgroundlist, item); + ctx->background_list = eina_list_append(ctx->background_list, item); //Insert None Item Insert_Gen_Grid_Item_Notify *notify = calloc(1, @@ -344,66 +359,92 @@ _refresh_directory(const char* data) notify->class = item_class; notify->item = item; - _insert_gengrid_item(notify); + _insert_gengrid_item(ctx, notify); } - _backgroundlist = _rec_read_directorys(_backgroundlist, data, + ctx->background_list = _rec_read_directorys(ctx, ctx->background_list, data, item_class); elm_gengrid_item_class_free(item_class); - _thread = NULL; } static void -_gengrid_refresh_samples(const char *path) +_gengrid_refresh_samples(Background_Ctx *ctx, const char *path) { if(!ecore_file_exists(path)) return; - _refresh_directory(path); + _refresh_directory(ctx, path); } static void -_cb_entry_changed(void *_data EINA_UNUSED, +_cb_entry_changed(void *data, Evas_Object *parent, void *_event EINA_UNUSED) { + Background_Ctx *ctx = data; const char *path = elm_object_text_get(parent); - _gengrid_refresh_samples(path); + _gengrid_refresh_samples(ctx, path); } static void -_cb_hoversel_select(void *data, - Evas_Object *_hoversel EINA_UNUSED, - void *_event EINA_UNUSED) +_cb_hoversel_select(Background_Ctx *ctx, const Eina_Stringshare *path) { Evas_Object *o; - char *path = data; if (path) { - elm_object_text_set(_entry, path); + elm_object_text_set(ctx->entry, path); } else { - o = elm_object_part_content_get(_flip, "back"); - elm_fileselector_path_set(o, elm_object_text_get(_entry)); - elm_flip_go_to(_flip, EINA_FALSE, ELM_FLIP_PAGE_RIGHT); + o = elm_object_part_content_get(ctx->flip, "back"); + elm_fileselector_path_set(o, elm_object_text_get(ctx->entry)); + elm_flip_go_to(ctx->flip, EINA_FALSE, ELM_FLIP_PAGE_RIGHT); } } static void -_system_background_dir_init(void) +_cb_hoversel_select_system(void *data, + Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Background_Ctx *ctx = data; + + _cb_hoversel_select(ctx, ctx->system_path); +} +static void +_cb_hoversel_select_user(void *data, + Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Background_Ctx *ctx = data; + + _cb_hoversel_select(ctx, ctx->user_path); +} + +static void +_cb_hoversel_select_none(void *data, + Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + Background_Ctx *ctx = data; + _cb_hoversel_select(ctx, NULL); +} + +static void +_system_background_dir_init(Background_Ctx *ctx) { char path[PATH_MAX]; snprintf(path, PATH_MAX, "%s/backgrounds/", elm_app_data_dir_get()); - if (_system_path) - eina_stringshare_replace(&_system_path, path); + if (ctx->system_path) + eina_stringshare_replace(&ctx->system_path, path); else - _system_path = eina_stringshare_add(path); + ctx->system_path = eina_stringshare_add(path); } static const char* -_user_background_dir_init(void){ +_user_background_dir_init(Background_Ctx *ctx) +{ char path[PATH_MAX], *user; user = getenv("HOME"); @@ -412,52 +453,53 @@ _user_background_dir_init(void){ snprintf(path, PATH_MAX, "%s/.config/terminology/background/", user); if (!ecore_file_exists(path)) ecore_file_mkpath(path); - if (!_user_path) - _user_path = eina_stringshare_add(path); + if (!ctx->user_path) + ctx->user_path = eina_stringshare_add(path); else - eina_stringshare_replace(&_user_path, path); - return _user_path; + eina_stringshare_replace(&ctx->user_path, path); + return ctx->user_path; } static const char* -_import_background(const char* background) +_import_background(Background_Ctx *ctx, const char* background) { char path[PATH_MAX]; const char *filename = ecore_file_file_get(background); if (!filename) return NULL; - if (!_user_background_dir_init()) + if (!_user_background_dir_init(ctx)) return NULL; - snprintf(path, PATH_MAX, "%s/%s", _user_path, filename); + snprintf(path, PATH_MAX, "%s/%s", ctx->user_path, filename); if (!ecore_file_cp(background, path)) return NULL; return eina_stringshare_add(path); } static void -_cb_grid_doubleclick(void *_data EINA_UNUSED, +_cb_grid_doubleclick(void *data, Evas_Object *_obj EINA_UNUSED, void *_event EINA_UNUSED) { - Config *config = termio_config_get(_term); + Background_Ctx *ctx = data; + Config *config = ctx->config; char *config_background_dir = ecore_file_dir_get(config->background); - if (!_user_path) { - if (!_user_background_dir_init()) + if (!ctx->user_path) { + if (!_user_background_dir_init(ctx)) return; } if (!config->background) return; - if (strncmp(config_background_dir, _user_path, + if (strncmp(config_background_dir, ctx->user_path, strlen(config_background_dir)) == 0) { - _bubble_show(_("Source file is target file")); + _bubble_show(ctx, _("Source file is target file")); free(config_background_dir); return; } - const char *newfile = _import_background(config->background); + const char *newfile = _import_background(ctx, config->background); if (newfile) { @@ -465,50 +507,88 @@ _cb_grid_doubleclick(void *_data EINA_UNUSED, config_save(config, NULL); main_media_update(config); eina_stringshare_del(newfile); - _bubble_show(_("Picture imported")); - elm_object_text_set(_entry, config_background_dir); + _bubble_show(ctx, _("Picture imported")); + elm_object_text_set(ctx->entry, config_background_dir); } else { - _bubble_show(_("Failed")); + _bubble_show(ctx, _("Failed")); } free(config_background_dir); } +static void +_parent_del_cb(void *data, + Evas *_e EINA_UNUSED, + Evas_Object *_obj EINA_UNUSED, + void *_event_info EINA_UNUSED) +{ + Background_Ctx *ctx = data; + Background_Item *item; + + EINA_LIST_FREE(ctx->background_list, item) + { + if (item->path) + eina_stringshare_del(item->path); + free(item); + } + ctx->background_list = NULL; + if (ctx->user_path) + { + eina_stringshare_del(ctx->user_path); + ctx->user_path = NULL; + } + if (ctx->system_path) + { + eina_stringshare_del(ctx->system_path); + ctx->system_path = NULL; + } + free(ctx); +} + + void options_background(Evas_Object *opbox, Evas_Object *term) { - Evas_Object *frame, *o, *bx, *bx2; + Evas_Object *o, *bx, *bx2; Config *config = termio_config_get(term); char path[PATH_MAX], *config_background_dir; + Background_Ctx *ctx; - _term = term; + ctx = calloc(1, sizeof(*ctx)); + assert(ctx); - frame = o = elm_frame_add(opbox); + ctx->config = config; + ctx->term = term; + + ctx->frame = o = elm_frame_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(o, _("Background")); evas_object_show(o); elm_box_pack_end(opbox, o); - _flip = o = elm_flip_add(opbox); + evas_object_event_callback_add(ctx->frame, EVAS_CALLBACK_DEL, + _parent_del_cb, ctx); + + ctx->flip = o = elm_flip_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_content_set(frame, o); + elm_object_content_set(ctx->frame, o); evas_object_show(o); o = elm_fileselector_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(_flip, "back", o); + elm_object_part_content_set(ctx->flip, "back", o); elm_fileselector_folder_only_set(o, EINA_TRUE); - evas_object_smart_callback_add(o, "done", _cb_fileselector, NULL); + evas_object_smart_callback_add(o, "done", _cb_fileselector, ctx); evas_object_show(o); bx = o = elm_box_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(_flip, "front", bx); + elm_object_part_content_set(ctx->flip, "front", bx); evas_object_show(o); o = elm_label_add(opbox); @@ -518,7 +598,7 @@ options_background(Evas_Object *opbox, Evas_Object *term) elm_box_pack_end(bx, o); evas_object_show(o); - op_shine_slider = o = elm_slider_add(opbox); + ctx->op_shine_slider = o = elm_slider_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); elm_slider_span_size_set(o, 40); @@ -533,11 +613,11 @@ options_background(Evas_Object *opbox, Evas_Object *term) evas_object_show(o); evas_object_smart_callback_add(o, "delay,changed", - _cb_op_shine_sel, term); + _cb_op_shine_sel, ctx); - op_trans = o = elm_check_add(opbox); + ctx->op_trans = o = elm_check_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); elm_object_text_set(o, _("Translucent")); @@ -545,9 +625,9 @@ options_background(Evas_Object *opbox, Evas_Object *term) elm_box_pack_end(bx, o); evas_object_show(o); evas_object_smart_callback_add(o, "changed", - _cb_op_video_trans_chg, term); + _cb_op_video_trans_chg, ctx); - op_opacity = o = elm_slider_add(opbox); + ctx->op_opacity = o = elm_slider_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5); elm_slider_span_size_set(o, 40); @@ -559,7 +639,7 @@ options_background(Evas_Object *opbox, Evas_Object *term) elm_box_pack_end(bx, o); evas_object_show(o); evas_object_smart_callback_add(o, "changed", - _cb_op_video_opacity_chg, term); + _cb_op_video_opacity_chg, ctx); o = elm_separator_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); @@ -576,13 +656,15 @@ options_background(Evas_Object *opbox, Evas_Object *term) evas_object_show(o); - _entry = o = elm_entry_add(opbox); + ctx->entry = o = elm_entry_add(opbox); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0); elm_entry_single_line_set(o, EINA_TRUE); elm_entry_scrollable_set(o, EINA_TRUE); - elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); - evas_object_smart_callback_add(_entry, "changed", _cb_entry_changed, NULL); + elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_OFF); + evas_object_smart_callback_add(ctx->entry, "changed", + _cb_entry_changed, ctx); elm_box_pack_start(bx2, o); evas_object_show(o); @@ -594,20 +676,22 @@ options_background(Evas_Object *opbox, Evas_Object *term) evas_object_show(o); snprintf(path, PATH_MAX, "%s/backgrounds/", elm_app_data_dir_get()); - _system_background_dir_init(); - elm_hoversel_item_add(o, _("System"), NULL, ELM_ICON_NONE, _cb_hoversel_select , - _system_path); - if (_user_background_dir_init()) - elm_hoversel_item_add(o, _("User"), NULL, ELM_ICON_NONE, _cb_hoversel_select , - _user_path); + _system_background_dir_init(ctx); + elm_hoversel_item_add(o, _("System"), NULL, ELM_ICON_NONE, + _cb_hoversel_select_system, ctx); + if (_user_background_dir_init(ctx)) + elm_hoversel_item_add(o, _("User"), NULL, ELM_ICON_NONE, + _cb_hoversel_select_user, ctx); //In the other case it has failed, so dont show the user item - elm_hoversel_item_add(o, _("Other"), NULL, ELM_ICON_NONE, _cb_hoversel_select , - NULL); + elm_hoversel_item_add(o, _("Other"), NULL, ELM_ICON_NONE, + _cb_hoversel_select_none, ctx); - _bg_grid = o = elm_gengrid_add(opbox); + ctx->bg_grid = o = elm_gengrid_add(opbox); + evas_object_data_set(ctx->bg_grid, "ctx", ctx); evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_smart_callback_add(o, "clicked,double", _cb_grid_doubleclick, NULL); + evas_object_smart_callback_add(o, "clicked,double", + _cb_grid_doubleclick, ctx); elm_gengrid_item_size_set(o, elm_config_scale_get() * 100, elm_config_scale_get() * 80); elm_box_pack_end(bx, o); @@ -623,34 +707,11 @@ options_background(Evas_Object *opbox, Evas_Object *term) if (config->background) { config_background_dir = ecore_file_dir_get(config->background); - elm_object_text_set(_entry, config_background_dir); + elm_object_text_set(ctx->entry, config_background_dir); free(config_background_dir); } else { - elm_object_text_set(_entry, _system_path); - } -} - -void -options_background_clear(void) -{ - Background_Item *item; - - EINA_LIST_FREE(_backgroundlist, item) - { - if (item->path) eina_stringshare_del(item->path); - free(item); - } - _backgroundlist = NULL; - if (_user_path) - { - eina_stringshare_del(_user_path); - _user_path = NULL; - } - if (_system_path) - { - eina_stringshare_del(_system_path); - _system_path = NULL; + elm_object_text_set(ctx->entry, ctx->system_path); } }