[gnome-bluetooth] applet: Simplify bluetooth_applet_send_to_address()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] applet: Simplify bluetooth_applet_send_to_address()
- Date: Wed, 29 Jun 2011 14:47:02 +0000 (UTC)
commit ebae02f4e6b8fad0a0c36aa18d6479e85afeebf1
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jun 29 13:29:32 2011 +0100
applet: Simplify bluetooth_applet_send_to_address()
applet/bluetooth-applet.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
---
diff --git a/applet/bluetooth-applet.c b/applet/bluetooth-applet.c
index fbc1a21..4e6485e 100644
--- a/applet/bluetooth-applet.c
+++ b/applet/bluetooth-applet.c
@@ -226,24 +226,16 @@ void bluetooth_applet_send_to_address (BluetoothApplet *applet,
{
GPtrArray *a;
GError *err = NULL;
- guint i;
g_return_if_fail (BLUETOOTH_IS_APPLET (applet));
- a = g_ptr_array_new ();
- g_ptr_array_add (a, "bluetooth-sendto");
- if (address != NULL) {
- char *s;
-
- s = g_strdup_printf ("--device=%s", address);
- g_ptr_array_add (a, s);
- }
- if (address != NULL && alias != NULL) {
- char *s;
+ a = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);
- s = g_strdup_printf ("--name=%s", alias);
- g_ptr_array_add (a, s);
- }
+ g_ptr_array_add (a, g_strdup ("bluetooth-sendto"));
+ if (address != NULL)
+ g_ptr_array_add (a, g_strdup_printf ("--device=%s", address));
+ if (address != NULL && alias != NULL)
+ g_ptr_array_add (a, g_strdup_printf ("--name=%s", alias));
g_ptr_array_add (a, NULL);
if (g_spawn_async(NULL, (char **) a->pdata, NULL,
@@ -252,9 +244,6 @@ void bluetooth_applet_send_to_address (BluetoothApplet *applet,
g_error_free (err);
}
- for (i = 1; a->pdata[i] != NULL; i++)
- g_free (a->pdata[i]);
-
g_ptr_array_free (a, TRUE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]