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:
Lucas De Marchi 2013-01-03 22:08:15 +00:00
parent 84550effc5
commit 2aca12cc2e
1 changed files with 4 additions and 15 deletions

View File

@ -311,10 +311,11 @@ notification_cliend_dbus_send(E_Notification_Notify *notify, E_Notification_Clie
//build message
main_iter = edbus_message_iter_get(msg);
if (!edbus_message_iter_arguments_append(main_iter, "susssas",
notify->app_name,
notify->app_name ?: "",
notify->replaces_id,
notify->icon.icon,
notify->sumary, notify->body,
notify->icon.icon ?: "",
notify->sumary ?: "",
notify->body ?: "",
&actions))
goto error;
edbus_message_iter_container_close(main_iter, actions);
@ -376,21 +377,9 @@ error:
return EINA_FALSE;
}
static const char *
null_strings_replace(const char *text)
{
if (!text)
return eina_stringshare_add("");
return text;
}
static void
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)
notify->timeout = -1;
}