pe, 2008-06-27 kello 09:34 +0300, Antti Kaijanmäki kirjoitti:
> pe, 2008-06-27 kello 01:42 +0100, Bastien Nocera kirjoitti:
> > On Tue, 2008-06-24 at 15:21 +0300, Antti Kaijanmäki wrote:
> > > Hello list!
> > >
<snip>
> > > 5. add property for selected device name. It's always nice to be able
> > > to show the user a nice name instead of bluetooth address.
> > > - see an attached patch.
> >
> > That's useful, as it allows us to avoid another lookup, although it's
> > close to free as hcid would have cached it.
>
> True, but then yet another API must be used to make the lookup.
>
>
> > FYI, you're leaking a copy of the name though, as gtk_tree_model_get()
> > will make a copy of the value, as well as g_value_set_string(). Use
> > g_value_take_string().
>
> Yes, true. thanks! I thought that g_value_set_string() would not make a
> copy of the string. I just adapted the "device-selected" property so I
> suppose it's also leaking memory.
patch attached.
It's against clean CVS without my other modifications.
> Br,
> Antti
Index: common/bluetooth-device-selection.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/bluetooth-device-selection.c,v
retrieving revision 1.20
diff -u -p -r1.20 bluetooth-device-selection.c
--- common/bluetooth-device-selection.c 12 Mar 2008 21:03:38 -0000 1.20
+++ common/bluetooth-device-selection.c 30 Jun 2008 05:42:40 -0000
@@ -686,7 +686,7 @@ bluetooth_device_selection_get_property
switch (prop_id) {
case PROP_DEVICE_SELECTED:
- g_value_set_string (value, bluetooth_device_selection_get_selected_device (self));
+ g_value_take_string (value, bluetooth_device_selection_get_selected_device (self));
break;
case PROP_SHOW_BONDING:
g_value_set_boolean (value, priv->show_bonded);
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Bluez-devel mailing list
Bluez-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bluez-devel