forked from enlightenment/enlightenment
e/notification: do not use null_strings_replace()
It would be very weird and error-prone on clients to have code like this: E_Notification_Notify n; memset(n, 0, sizeof(*n)); n.app_name = "bla"; e_notification_client_send(...); eina_stringshare_del(n.icon.icon); eina_stringshare_del(...); ... Instead of doing this, replace NULL by "" in the only place it's not allowed: while sending the D-Bus message. SVN revision: 82120
This commit is contained in:
parent
84550effc5
commit
2aca12cc2e
|
@ -311,10 +311,11 @@ notification_cliend_dbus_send(E_Notification_Notify *notify, E_Notification_Clie
|
||||||
//build message
|
//build message
|
||||||
main_iter = edbus_message_iter_get(msg);
|
main_iter = edbus_message_iter_get(msg);
|
||||||
if (!edbus_message_iter_arguments_append(main_iter, "susssas",
|
if (!edbus_message_iter_arguments_append(main_iter, "susssas",
|
||||||
notify->app_name,
|
notify->app_name ?: "",
|
||||||
notify->replaces_id,
|
notify->replaces_id,
|
||||||
notify->icon.icon,
|
notify->icon.icon ?: "",
|
||||||
notify->sumary, notify->body,
|
notify->sumary ?: "",
|
||||||
|
notify->body ?: "",
|
||||||
&actions))
|
&actions))
|
||||||
goto error;
|
goto error;
|
||||||
edbus_message_iter_container_close(main_iter, actions);
|
edbus_message_iter_container_close(main_iter, actions);
|
||||||
|
@ -376,21 +377,9 @@ error:
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
null_strings_replace(const char *text)
|
|
||||||
{
|
|
||||||
if (!text)
|
|
||||||
return eina_stringshare_add("");
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
normalize_notify(E_Notification_Notify *notify)
|
normalize_notify(E_Notification_Notify *notify)
|
||||||
{
|
{
|
||||||
notify->app_name = null_strings_replace(notify->app_name);
|
|
||||||
notify->body = null_strings_replace(notify->body);
|
|
||||||
notify->sumary = null_strings_replace(notify->sumary);
|
|
||||||
notify->icon.icon = null_strings_replace(notify->icon.icon);
|
|
||||||
if (!notify->timeout)
|
if (!notify->timeout)
|
||||||
notify->timeout = -1;
|
notify->timeout = -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue