{
const char *str;
dbus_message_iter_get_basic(&arr, &str);
- strings = eina_list_append(strings, strdup(str)); //XXX use eina_stringshare_instance?
+ strings = eina_list_append(strings, eina_stringshare_add(str)); //XXX use eina_stringshare_instance?
dbus_message_iter_next(&arr);
}
return strings;
DBusMessageIter iter, sub;
Eina_List *l;
- if (!n->app_name) n->app_name = strdup("");
- if (!n->app_icon) n->app_icon = strdup("");
- if (!n->summary) n->summary = strdup("");
- if (!n->body) n->body = strdup("");
+ if (!n->app_name) n->app_name = eina_stringshare_add("");
+ if (!n->app_icon) n->app_icon = eina_stringshare_add("");
+ if (!n->summary) n->summary = eina_stringshare_add("");
+ if (!n->body) n->body = eina_stringshare_add("");
msg = e_notification_call_new("Notify");
dbus_message_append_args(msg,
n = e_notification_new();
if (!n) return NULL;
- if (app_name) n->app_name = strdup(app_name);
+ n->app_name = eina_stringshare_add(app_name);
n->replaces_id = replaces_id;
- if (app_icon) n->app_icon = strdup(app_icon);
- if (summary) n->summary = strdup(summary);
- if (body) n->body = strdup(body);
+ n->app_icon = eina_stringshare_add(app_icon);
+ n->summary = eina_stringshare_add(summary);
+ n->body = eina_stringshare_add(body);
n->expire_timeout = expire_timeout;
{
if (!n) return;
- if (n->app_name) free(n->app_name);
- if (n->app_icon) free(n->app_icon);
- if (n->summary) free(n->summary);
- if (n->body) free(n->body);
+ eina_stringshare_del(n->app_name);
+ eina_stringshare_del(n->app_icon);
+ eina_stringshare_del(n->summary);
+ eina_stringshare_del(n->body);
eina_list_free(n->actions);
- if (n->hints.category) free(n->hints.category);
- if (n->hints.desktop) free(n->hints.desktop);
- if (n->hints.sound_file) free(n->hints.sound_file);
+ eina_stringshare_del(n->hints.category);
+ eina_stringshare_del(n->hints.desktop);
+ eina_stringshare_del(n->hints.sound_file);
if (n->hints.image_data) e_notification_image_free(n->hints.image_data);
if (n->hints.icon_data) e_notification_image_free(n->hints.icon_data);
free(n);
EAPI void
e_notification_app_name_set(E_Notification *note, const char *app_name)
{
- if (note->app_name) free(note->app_name);
- if (app_name) note->app_name = strdup(app_name);
+ eina_stringshare_replace(¬e->app_name, app_name);
}
EAPI void
e_notification_app_icon_set(E_Notification *note, const char *app_icon)
{
- if (note->app_icon) free(note->app_icon);
- if (app_icon) note->app_icon = strdup(app_icon);
+ eina_stringshare_replace(¬e->app_icon, app_icon);
}
EAPI void
e_notification_summary_set(E_Notification *note, const char *summary)
{
- if (note->summary) free(note->summary);
- if (summary) note->summary = strdup(summary);
+ eina_stringshare_replace(¬e->summary, summary);
}
EAPI void
e_notification_body_set(E_Notification *note, const char *body)
{
- if (note->body) free(note->body);
- if (body) note->body = strdup(body);
+ eina_stringshare_replace(¬e->body, body);
}
EAPI void
{
E_Notification_Action *act;
act = malloc(sizeof(E_Notification_Action));
- act->id = strdup(id);
- act->name = strdup(name);
+ act->id = eina_stringshare_add(id);
+ act->name = eina_stringshare_add(name);
return act;
}
EAPI void
e_notification_hint_category_set(E_Notification *n, const char *category)
{
- if (n->hints.category) free(n->hints.category);
- n->hints.category = strdup(category);
+ eina_stringshare_replace(&n->hints.category, category);
n->hint_flags |= E_NOTIFICATION_HINT_CATEGORY;
}
EAPI void
e_notification_hint_desktop_set(E_Notification *n, const char *desktop)
{
- if (n->hints.desktop) free(n->hints.desktop);
- n->hints.desktop = strdup(desktop);
+ eina_stringshare_replace(&n->hints.desktop, desktop);
n->hint_flags |= E_NOTIFICATION_HINT_DESKTOP;
}
EAPI void
e_notification_hint_sound_file_set(E_Notification *n, const char *sound_file)
{
- if (n->hints.sound_file) free(n->hints.sound_file);
- n->hints.sound_file = strdup(sound_file);
+ eina_stringshare_replace(&n->hints.sound_file, sound_file);
n->hint_flags |= E_NOTIFICATION_HINT_SOUND_FILE;
}