ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->hover_style) eina_stringshare_del(wd->hover_style);
- wd->hover_style = NULL;
- if (style) wd->hover_style = eina_stringshare_add(style);
+ eina_stringshare_replace(&wd->hover_style, style);
}
/**
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->hover_style) eina_stringshare_del(wd->hover_style);
- wd->hover_style = NULL;
- if (style) wd->hover_style = eina_stringshare_add(style);
+ eina_stringshare_replace(&wd->hover_style, style);
}
/**
if (!parent)
{
elm_genlist_clear(wd->list);
- if (wd->path) eina_stringshare_del(wd->path);
- wd->path = eina_stringshare_add(path);
+ eina_stringshare_replace(&wd->path, path);
_do_anchors(obj, path);
}
name = elm_entry_entry_get(wd->entry2);
//TODO remove <br>
snprintf(buf, sizeof(buf), "%s/%s", wd->path, name);
- if (wd->selection) eina_stringshare_del(wd->selection);
- wd->selection = eina_stringshare_add(buf);
+ eina_stringshare_replace(&wd->selection, buf);
return wd->selection;
}
elm_hoversel_item_icon_set(Elm_Hoversel_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type)
{
if (!it) return;
- if (it->icon_file) eina_stringshare_del(it->icon_file);
- it->icon_file = eina_stringshare_add(icon_file);
- if (it->icon_group) eina_stringshare_del(it->icon_group);
- it->icon_group = eina_stringshare_add(icon_group);
+ eina_stringshare_replace(&it->icon_file, icon_file);
+ eina_stringshare_replace(&it->icon_group, icon_group);
it->icon_type = icon_type;
}
wd->delay_write = NULL;
}
_save(obj);
- if (wd->file) eina_stringshare_del(wd->file);
- wd->file = NULL;
- if (file) wd->file = eina_stringshare_add(file);
+ eina_stringshare_replace(&wd->file, file);
wd->format = format;
_load(obj);
}
wd->custom_img = NULL;
}
if (!file) return;
- if (wd->file) eina_stringshare_del(wd->file);
- if (file) wd->file = eina_stringshare_add(file);
- else wd->file = NULL;
- if (wd->group) eina_stringshare_del(wd->group);
- if (group) wd->group = eina_stringshare_add(group);
- else wd->group = NULL;
+ eina_stringshare_replace(&wd->file, file);
+ eina_stringshare_replace(&wd->group, group);
if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj")))
{
wd->custom_img = edje_object_add(evas_object_evas_get(wd->img));
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
- if (label) wd->label = eina_stringshare_add(label);
- else wd->label = NULL;
+ eina_stringshare_replace(&wd->label, label);
edje_object_part_text_set(wd->bbl, "elm.text", label);
_sizing_eval(obj);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->info) eina_stringshare_del(wd->info);
- if (info) wd->info = eina_stringshare_add(info);
- else wd->info = NULL;
+ eina_stringshare_replace(&wd->info, info);
edje_object_part_text_set(wd->bbl, "elm.info", info);
_sizing_eval(obj);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
+ eina_stringshare_replace(&wd->label, label);
if (label)
- {
- wd->label = eina_stringshare_add(label);
- edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm");
- }
+ edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm");
else
- {
- wd->label = NULL;
- edje_object_signal_emit(wd->btn, "elm,state,text,hidden", "elm");
- }
+ edje_object_signal_emit(wd->btn, "elm,state,text,hidden", "elm");
edje_object_message_signal_process(wd->btn);
edje_object_part_text_set(wd->btn, "elm.text", label);
_sizing_eval(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
+ eina_stringshare_replace(&wd->label, label);
if (label)
- {
- wd->label = eina_stringshare_add(label);
- edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
- }
+ edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
else
- {
- wd->label = NULL;
- edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
- }
+ edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
edje_object_message_signal_process(wd->chk);
edje_object_part_text_set(wd->chk, "elm.text", label);
_sizing_eval(obj);
Widget_Data *wd = elm_widget_data_get(obj);
const char *sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
if (!wd) return;
- if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
- wd->cut_sel = eina_stringshare_add(sel);
+ eina_stringshare_replace(&wd->cut_sel, sel);
}
static void
char *txt;
if (!wd) return;
evas_object_smart_callback_call(data, "selection,cut", NULL);
- if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
- wd->cut_sel = NULL;
txt = _mkup_to_text(elm_entry_selection_get(data));
- if (txt)
- {
- wd->cut_sel = eina_stringshare_add(txt);
- free(txt);
- }
+ eina_stringshare_replace(&wd->cut_sel, txt);
+ if (txt) free(txt);
edje_object_part_text_insert(wd->ent, "elm.text", "");
wd->changed = EINA_TRUE;
_sizing_eval(data);
ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
return NULL;
}
- if (wd->text) eina_stringshare_del(wd->text);
- wd->text = NULL;
- if (text) wd->text = eina_stringshare_add(text);
+ eina_stringshare_replace(&wd->text, text);
return wd->text;
}
Eina_Bool ret;
if ((!wd) || (!name)) return EINA_FALSE;
- if (wd->stdicon) eina_stringshare_del(wd->stdicon);
- wd->stdicon = eina_stringshare_add(name);
+ eina_stringshare_replace(&wd->stdicon, name);
ret = _elm_theme_icon_set(wd->img, name, "default");
_sizing_eval(obj);
return ret;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (!label) label = "";
- if (wd->label) eina_stringshare_del(wd->label);
- wd->label = eina_stringshare_add(label);
+ eina_stringshare_replace(&wd->label, label);
edje_object_part_text_set(wd->lbl, "elm.text", label);
wd->changed = 1;
_sizing_eval(obj);
val = ecore_x_window_prop_string_get(event->win,
event->atom);
- if (_elm_config->theme)
- {
- eina_stringshare_del(_elm_config->theme);
- _elm_config->theme = NULL;
- }
- if (val)
- {
- _elm_config->theme = eina_stringshare_add(val);
- _elm_theme_parse(val);
- free(val);
- _elm_rescale();
- }
+ eina_stringshare_replace(&_elm_config->theme, val);
+ if (val)
+ {
+ _elm_theme_parse(val);
+ free(val);
+ _elm_rescale();
+ }
}
}
return 1;
s = getenv("ELM_THEME");
if (s)
- {
- if (_elm_config->theme)
- {
- eina_stringshare_del(_elm_config->theme);
- _elm_config->theme = NULL;
- }
- _elm_config->theme = eina_stringshare_add(s);
- }
+ eina_stringshare_replace(&_elm_config->theme, s);
_elm_theme_parse(_elm_config->theme);
s = getenv("ELM_MODULES");
if (s)
- {
- if (_elm_config->modules)
- {
- eina_stringshare_del(_elm_config->modules);
- _elm_config->modules = NULL;
- }
- _elm_config->modules = eina_stringshare_add(s);
- }
+ eina_stringshare_replace(&_elm_config->modules, s);
if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
}
_elm_atom_enlightenment_theme);
if (s)
{
- if (_elm_config->theme)
- {
- eina_stringshare_del(_elm_config->theme);
- _elm_config->theme = NULL;
- }
- _elm_config->theme = eina_stringshare_add(s);
+ eina_stringshare_replace(&_elm_config->theme, s);
_elm_theme_parse(s);
free(s);
}
source = map_sources_tab[wd->source].url_cb(x, y, g->zoom);
- if (gi->file)
- eina_stringshare_del(gi->file);
- gi->file = eina_stringshare_add(buf2);
+ eina_stringshare_replace(&gi->file, buf2);
if (ecore_file_exists(buf2) || g == eina_list_data_get(wd->grids))
{
elm_map_group_class_style_set(Elm_Map_Group_Class *clas, const char *style)
{
if (!clas) return;
- if (clas->style) eina_stringshare_del(clas->style);
- clas->style = NULL;
- if (style) clas->style = eina_stringshare_add(style);
+ eina_stringshare_replace(&clas->style, style);
}
/*
elm_map_marker_class_style_set(Elm_Map_Marker_Class *clas, const char *style)
{
if (!clas) return;
- if (clas->style) eina_stringshare_del(clas->style);
- clas->style = NULL;
- if (style) clas->style = eina_stringshare_add(style);
+ eina_stringshare_replace(&clas->style, style);
}
/*
EAPI void
elm_menu_item_label_set(Elm_Menu_Item *item, const char *label)
{
- if (item->label) eina_stringshare_del(item->label);
+ eina_stringshare_replace(&item->label, label);
+
if (label)
- {
- item->label = eina_stringshare_add(label);
- edje_object_signal_emit(item->o, "elm,state,text,visible", "elm");
- }
+ edje_object_signal_emit(item->o, "elm,state,text,visible", "elm");
else
- {
- item->label = NULL;
- edje_object_signal_emit(item->o, "elm,state,text,hidden", "elm");
- }
+ edje_object_signal_emit(item->o, "elm,state,text,hidden", "elm");
+
edje_object_message_signal_process(item->o);
edje_object_part_text_set(item->o, "elm.text", label);
_sizing_eval(item->menu);
Widget_Data *wd = elm_widget_data_get(obj);
int w, h;
if (!wd) return EVAS_LOAD_ERROR_GENERIC;
- if (wd->file) eina_stringshare_del(wd->file);
- wd->file = eina_stringshare_add(file);
+ if (!eina_stringshare_replace(&wd->file, file)) return EVAS_LOAD_ERROR_NONE;
evas_object_hide(wd->img);
evas_object_image_smooth_scale_set(wd->img, (wd->nosmooth == 0));
evas_object_image_file_set(wd->img, NULL, NULL);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
+ eina_stringshare_replace(&wd->label, label);
if (label)
{
- wd->label = eina_stringshare_add(label);
edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm");
edje_object_message_signal_process(wd->progressbar);
}
else
{
- wd->label = NULL;
edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm");
edje_object_message_signal_process(wd->progressbar);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->units) eina_stringshare_del(wd->units);
+ eina_stringshare_replace(&wd->units, units);
if (units)
{
- wd->units = eina_stringshare_add(units);
edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm");
edje_object_message_signal_process(wd->progressbar);
}
else
{
- wd->units = NULL;
edje_object_signal_emit(wd->progressbar, "elm,state,units,hidden", "elm");
edje_object_message_signal_process(wd->progressbar);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
+ eina_stringshare_replace(&wd->label, label);
if (label)
{
- wd->label = eina_stringshare_add(label);
edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
edje_object_message_signal_process(wd->chk);
}
else
{
- wd->label = NULL;
edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
edje_object_message_signal_process(wd->chk);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
+ eina_stringshare_replace(&wd->label, label);
if (label)
{
- wd->label = eina_stringshare_add(label);
edje_object_signal_emit(wd->slider, "elm,state,text,visible", "elm");
edje_object_message_signal_process(wd->slider);
}
else
{
- wd->label = NULL;
edje_object_signal_emit(wd->slider, "elm,state,text,hidden", "elm");
edje_object_message_signal_process(wd->slider);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->units) eina_stringshare_del(wd->units);
+ eina_stringshare_replace(&wd->units, units);
if (units)
{
- wd->units = eina_stringshare_add(units);
edje_object_signal_emit(wd->slider, "elm,state,units,visible", "elm");
edje_object_message_signal_process(wd->slider);
}
else
{
- wd->units = NULL;
edje_object_signal_emit(wd->slider, "elm,state,units,hidden", "elm");
edje_object_message_signal_process(wd->slider);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->indicator) eina_stringshare_del(wd->indicator);
- if (indicator) wd->indicator = eina_stringshare_add(indicator);
- else wd->indicator = NULL;
+ eina_stringshare_replace(&wd->indicator, indicator);
_indicator_set(obj);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- eina_stringshare_del(wd->transition);
- wd->transition = eina_stringshare_add(transition);
+ eina_stringshare_replace(&wd->transition, transition);
}
/**
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
- wd->label = eina_stringshare_add(fmt);
+ eina_stringshare_replace(&wd->label, fmt);
_write_label(obj);
_sizing_eval(obj);
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
+ eina_stringshare_replace(&wd->label, label);
if (label)
- {
- wd->label = eina_stringshare_add(label);
- edje_object_signal_emit(wd->tgl, "elm,state,text,visible", "elm");
- }
+ edje_object_signal_emit(wd->tgl, "elm,state,text,visible", "elm");
else
- {
- wd->label = NULL;
- edje_object_signal_emit(wd->tgl, "elm,state,text,hidden", "elm");
- }
+ edje_object_signal_emit(wd->tgl, "elm,state,text,hidden", "elm");
edje_object_message_signal_process(wd->tgl);
edje_object_part_text_set(wd->tgl, "elm.text", label);
_sizing_eval(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- if (wd->ontext) eina_stringshare_del(wd->ontext);
- if (wd->offtext) eina_stringshare_del(wd->offtext);
- if (onlabel) wd->ontext = eina_stringshare_add(onlabel);
- else wd->ontext = NULL;
- if (offlabel) wd->offtext = eina_stringshare_add(offlabel);
- else wd->offtext = NULL;
+ eina_stringshare_replace(&wd->ontext, onlabel);
+ eina_stringshare_replace(&wd->offtext, offlabel);
edje_object_part_text_set(wd->tgl, "elm.ontext", onlabel);
edje_object_part_text_set(wd->tgl, "elm.offtext", offlabel);
_sizing_eval(obj);
Evas_Coord mw = -1, mh = -1;
if (!item) return;
- eina_stringshare_del(item->label);
- item->label = eina_stringshare_add(label);
+ eina_stringshare_replace(&item->label, label);
edje_object_part_text_set(item->base, "elm.text", item->label);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
EAPI void
elm_widget_style_set(Evas_Object *obj, const char *style)
{
- const char *old;
API_ENTRY return;
- old = sd->style;
- sd->style = eina_stringshare_add(style);
- if (old) eina_stringshare_del(old);
- if (old != sd->style) elm_widget_theme(obj);
+ if (eina_stringshare_replace(&sd->style, style))
+ elm_widget_theme(obj);
}
EAPI const char *
EAPI void
elm_widget_type_set(Evas_Object *obj, const char *type)
{
- const char *old;
API_ENTRY return;
- old = sd->type;
- sd->type = eina_stringshare_add(type);
- if (old) eina_stringshare_del(old);
+ eina_stringshare_replace(&sd->type, type);
}
EAPI const char *