* [Bluez-devel] Making library out of bluez-gnome
@ 2008-06-24 12:21 Antti Kaijanmäki
2008-06-27 0:42 ` Bastien Nocera
0 siblings, 1 reply; 8+ messages in thread
From: Antti Kaijanmäki @ 2008-06-24 12:21 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1.1.1: Type: text/plain, Size: 2478 bytes --]
Hello list!
I'm developing a project[1] that needs to provide the user a way to
select[2] a Bluetooth device from a list of discovered devices.
I noticed that gnome-bluez applet has a very nice device selector and
that got me browsing though the code. Unfortunately I discovered that
bluez-gnome creates only a static library libcommon.a that contains the
device selector (common/bluetooth-device-selection.c) for private use.
Now there is two options the way I see it. Either I have a private copy
of bluez-gnome package or bluez-gnome is made to be a shared library.
The first solution would be easiest for everyone because no extra work
would be required. But it's just generally A Bad Idea to have multiple
programs using same code privately and so on..
The second solutions would be optimal. If bluez-gnome provides a shared
library 3rd party software could utilize it in sane way. I'm quite sure
there are many applications that would benefit from common bluetooth
widgets; like CUPS for bluetooth printer setup, Evolution for vCard
sending, <your favorite application that communicates with BT devices>..
Here is the lame part: I'm busy with my project, so someone else should
do all the work :P
OK, maybe not all the work, but I can not promise anything.
What do you think about the idea? Is this something not worth the
trouble and I should just STFU or is this viable?
best regards,
Antti Kaijanmäki
[1] http://live.gnome.org/NetworkManager/MobileBroadband
[2] http://www.kaijanmaki.net/kesakoodi/bt_draft.png
P.S.
Here are some wishes from top of my head regarding the device selector:
1. remove the caption of the list
- let the developer provide a caption best suited for
his application
2. put the filter in GtkExpander
- Filters are not used for by the most of the users, thus it's
convenient to have them hidden by default.
3. make the filter completely hidden
- this combined with the 1. would make the widget appear just
like GtkTreeView
- this is already achievable, but there seems to be a bug. If both of
the filter fields are hidden the caption is still shown.
See an attached patch.
4. have alternative filters in right-click pop-up menu
- very handy for tight places
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.
[-- Attachment #1.1.2: add_selected_device_name_property.patch --]
[-- Type: text/x-patch, Size: 2249 bytes --]
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 24 Jun 2008 11:57:01 -0000
@@ -207,6 +207,22 @@ bluetooth_device_selection_get_selected_
return address;
}
+gchar *
+bluetooth_device_selection_get_selected_device_name (BluetoothDeviceSelection *self)
+{
+ BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+ GtkTreeIter iter;
+ gchar *name;
+ gboolean selected;
+
+ selected = gtk_tree_selection_get_selected (priv->selection, NULL, &iter);
+ if (selected == FALSE)
+ return NULL;
+
+ gtk_tree_model_get (priv->filter, &iter, COLUMN_NAME, &name, -1);
+ return name;
+}
+
static void
search_button_clicked (GtkButton *button, gpointer user_data)
{
@@ -617,6 +633,7 @@ enum {
PROP_0,
PROP_TITLE,
PROP_DEVICE_SELECTED,
+ PROP_DEVICE_SELECTED_NAME,
PROP_SHOW_BONDING,
PROP_SHOW_SEARCH,
PROP_SHOW_DEVICE_TYPE,
@@ -688,6 +705,9 @@ bluetooth_device_selection_get_property
case PROP_DEVICE_SELECTED:
g_value_set_string (value, bluetooth_device_selection_get_selected_device (self));
break;
+ case PROP_DEVICE_SELECTED_NAME:
+ g_value_set_string (value, bluetooth_device_selection_get_selected_device_name (self));
+ break;
case PROP_SHOW_BONDING:
g_value_set_boolean (value, priv->show_bonded);
break;
@@ -738,6 +758,9 @@ bluetooth_device_selection_class_init (B
PROP_DEVICE_SELECTED, g_param_spec_string ("device-selected",
NULL, NULL, NULL, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS(klass),
+ PROP_DEVICE_SELECTED_NAME, g_param_spec_string ("device-selected-name",
+ NULL, NULL, NULL, G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS(klass),
PROP_SHOW_BONDING, g_param_spec_boolean ("show-bonding",
NULL, NULL, FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS(klass),
[-- Attachment #1.1.3: hide_filters_box_when_not_needed.patch --]
[-- Type: text/x-patch, Size: 2679 bytes --]
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 24 Jun 2008 11:50:01 -0000
@@ -62,6 +62,7 @@ struct _BluetoothDeviceSelectionPrivate
GtkWidget *search_button;
GtkWidget *device_type_label, *device_type;
GtkWidget *device_category_label, *device_category;
+ GtkWidget *filters_vbox;
/* Current filter */
int device_type_filter;
@@ -517,7 +534,8 @@ bluetooth_device_selection_init(Bluetoot
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (self), vbox, FALSE, TRUE, 0);
-
+ priv->filters_vbox = vbox;
+
/* The filters */
str = g_strdup_printf ("<b>%s</b>", _("Show Only Bluetooth Devices With..."));
label = gtk_label_new (str);
@@ -596,7 +614,13 @@ bluetooth_device_selection_init(Bluetoot
gtk_widget_show (priv->device_type_label);
gtk_widget_show (priv->device_type);
}
-
+
+ /* if filters are not visible hide the vbox */
+ if (!priv->show_device_type && !priv->show_device_category)
+ {
+ gtk_widget_hide (priv->filters_vbox);
+ }
+
priv->default_adapter_changed_id = g_signal_connect (priv->client, "notify::default-adapter",
G_CALLBACK (default_adapter_changed), self);
}
@@ -657,11 +682,19 @@ bluetooth_device_selection_set_property
priv->show_device_type = g_value_get_boolean (value);
g_object_set (G_OBJECT (priv->device_type_label), "visible", priv->show_device_type, NULL);
g_object_set (G_OBJECT (priv->device_type), "visible", priv->show_device_type, NULL);
+ if (priv->show_device_type || priv->show_device_category)
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", TRUE, NULL);
+ else
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
break;
case PROP_SHOW_DEVICE_CATEGORY:
priv->show_device_category = g_value_get_boolean (value);
g_object_set (G_OBJECT (priv->device_category_label), "visible", priv->show_device_category, NULL);
g_object_set (G_OBJECT (priv->device_category), "visible", priv->show_device_category, NULL);
+ if (priv->show_device_type || priv->show_device_category)
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", TRUE, NULL);
+ else
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
break;
case PROP_DEVICE_TYPE_FILTER:
priv->device_type_filter = g_value_get_int (value);
[-- Attachment #1.2: Digitaalisesti allekirjoitettu viestin osa --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 247 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-24 12:21 [Bluez-devel] Making library out of bluez-gnome Antti Kaijanmäki
@ 2008-06-27 0:42 ` Bastien Nocera
2008-06-27 6:34 ` Antti Kaijanmäki
0 siblings, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2008-06-27 0:42 UTC (permalink / raw)
To: BlueZ development
T24gVHVlLCAyMDA4LTA2LTI0IGF0IDE1OjIxICswMzAwLCBBbnR0aSBLYWlqYW5tw6RraSB3cm90
ZToKPiBIZWxsbyBsaXN0IQo+IAo+IEknbSBkZXZlbG9waW5nIGEgcHJvamVjdFsxXSB0aGF0IG5l
ZWRzIHRvIHByb3ZpZGUgdGhlIHVzZXIgYSB3YXkgdG8KPiBzZWxlY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BsYWNlLgpJdCdzIHRoZSBiZXN0IHBsYWNlIHRvIGJ1eSBv
ciBzZWxsIHNlcnZpY2VzIGZvcgpqdXN0IGFib3V0IGFueXRoaW5nIE9wZW4gU291cmNlLgpodHRw
Oi8vc291cmNlZm9yZ2UubmV0L3NlcnZpY2VzL2J1eS9pbmRleC5waHAKX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KQmx1ZXotZGV2ZWwgbWFpbGluZyBsaXN0
CkJsdWV6LWRldmVsQGxpc3RzLnNvdXJjZWZvcmdlLm5ldApodHRwczovL2xpc3RzLnNvdXJjZWZv
cmdlLm5ldC9saXN0cy9saXN0aW5mby9ibHVlei1kZXZlbAo=
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-27 0:42 ` Bastien Nocera
@ 2008-06-27 6:34 ` Antti Kaijanmäki
2008-06-30 5:47 ` Antti Kaijanmäki
0 siblings, 1 reply; 8+ messages in thread
From: Antti Kaijanmäki @ 2008-06-27 6:34 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1.1: Type: text/plain, Size: 4541 bytes --]
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!
> >
> > I'm developing a project[1] that needs to provide the user a way to
> > select[2] a Bluetooth device from a list of discovered devices.
> >
> > I noticed that gnome-bluez applet has a very nice device selector and
> > that got me browsing though the code. Unfortunately I discovered that
> > bluez-gnome creates only a static library libcommon.a that contains the
> > device selector (common/bluetooth-device-selection.c) for private use.
> >
> > Now there is two options the way I see it. Either I have a private copy
> > of bluez-gnome package or bluez-gnome is made to be a shared library.
> <snip>
>
> The whole problem is making sure the API is good enough for applications
> to use. For example, Marcel wants to allow searching of devices by UUID.
>
> And I'd like to fix up the API to allow adding filters that encompass
> more than a single type of device (eg. input devices would be keyboards,
> mice, joysticks, and other input devices).
I understand all this and as I said the shared library approach is not
the easiest, but it would be the right thing to do. You have done a very
good job and I just wanted to let you know what I'm up to. For now I
will use a private copy of the files and someday when a shared library
is released I will switch to that.
> > Here are some wishes from top of my head regarding the device selector:
> > 1. remove the caption of the list
> > - let the developer provide a caption best suited for
> > his application
>
> That's already possible, you set it when calling
> bluetooth_device_selection_new().
I'm now talking about the "Select a device from the following list:"
caption. And calling bluetooth_device_selection_new(""); will only set
the boldface title to be an empty string that is still getting widget
space allocated to it.
> > 2. put the filter in GtkExpander
> > - Filters are not used for by the most of the users, thus it's
> > convenient to have them hidden by default.
>
> Why?
It was just a thought. GtkExpander lets you hide these "Advanced"
options so that Aunt Tillie does not get confused by them, but it's
clearly visible where they can be found when someone needs them. At
least I got the idea from your blog post[1] that this is truly needed
for a marginal use case.
> > 3. make the filter completely hidden
> > - this combined with the 1. would make the widget appear just
> > like GtkTreeView
> > - this is already achievable, but there seems to be a bug. If both of
> > the filter fields are hidden the caption is still shown.
> > See an attached patch.
>
> I don't see what the problem is here.
You don't see why the widget should appear just like GtkTreeView or you
don't see what's the problem that my patch addresses?
If the widget can be made to look just like an ordinary GtkTreeView then
the application developer could embed it where ever he wants and make it
fit to his GUI design better. Those additional captions and titles can
brake the integrity of the GUI if there is no option to remove them.
By caption I mean the "Show Only Bluetooth Devices With..."
Without my patch this caption is still visible even though there are no
filters visible.
> > 4. have alternative filters in right-click pop-up menu
> > - very handy for tight places
>
> I'm not sure that's useful.
I mean this would be for situations where there is no room for filters
below the treeview, but the pop-up menu would provide the user an access
to them.
> > 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.
Br,
Antti
[1] http://www.hadess.net/2007/11/gnome-bluetooth-kill-kill.html
[-- Attachment #1.2: Digitaalisesti allekirjoitettu viestin osa --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 247 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-27 6:34 ` Antti Kaijanmäki
@ 2008-06-30 5:47 ` Antti Kaijanmäki
2008-06-30 6:18 ` Marcel Holtmann
0 siblings, 1 reply; 8+ messages in thread
From: Antti Kaijanmäki @ 2008-06-30 5:47 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
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
[-- Attachment #2: fix_memory_leak_in_bluetooth_device_selection_get_property.patch --]
[-- Type: text/x-patch, Size: 764 bytes --]
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);
[-- Attachment #3: Type: text/plain, Size: 247 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-30 5:47 ` Antti Kaijanmäki
@ 2008-06-30 6:18 ` Marcel Holtmann
2008-06-30 6:57 ` Antti Kaijanmäki
0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2008-06-30 6:18 UTC (permalink / raw)
To: BlueZ development
Hi Antti,
> > 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.
please resend all patches and make sure that you use the exact same
coding style that is used in the file you modify.
Regards
Marcel
-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-30 6:18 ` Marcel Holtmann
@ 2008-06-30 6:57 ` Antti Kaijanmäki
2008-06-30 8:02 ` Marcel Holtmann
0 siblings, 1 reply; 8+ messages in thread
From: Antti Kaijanmäki @ 2008-06-30 6:57 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 969 bytes --]
ma, 2008-06-30 kello 08:18 +0200, Marcel Holtmann kirjoitti:
> Hi Antti,
>
> > > 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.
>
> please resend all patches and make sure that you use the exact same
> coding style that is used in the file you modify.
done. patches attached.
> Regards
>
> Marcel
>
>
>
> -------------------------------------------------------------------------
> 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@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
[-- Attachment #2: add_selected_device_name_property.patch --]
[-- Type: text/x-patch, Size: 2192 bytes --]
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 06:51:32 -0000
@@ -207,6 +207,22 @@ bluetooth_device_selection_get_selected_
return address;
}
+gchar *
+bluetooth_device_selection_get_selected_device_name (BluetoothDeviceSelection *self)
+{
+ BluetoothDeviceSelectionPrivate *priv = BLUETOOTH_DEVICE_SELECTION_GET_PRIVATE(self);
+ GtkTreeIter iter;
+ gchar *name;
+ gboolean selected;
+
+ selected = gtk_tree_selection_get_selected (priv->selection, NULL, &iter);
+ if (selected == FALSE)
+ return NULL;
+
+ gtk_tree_model_get (priv->filter, &iter, COLUMN_NAME, &name, -1);
+ return name;
+}
+
static void
search_button_clicked (GtkButton *button, gpointer user_data)
{
@@ -617,6 +633,7 @@ enum {
PROP_0,
PROP_TITLE,
PROP_DEVICE_SELECTED,
+ PROP_DEVICE_SELECTED_NAME,
PROP_SHOW_BONDING,
PROP_SHOW_SEARCH,
PROP_SHOW_DEVICE_TYPE,
@@ -688,6 +705,9 @@ bluetooth_device_selection_get_property
case PROP_DEVICE_SELECTED:
g_value_set_string (value, bluetooth_device_selection_get_selected_device (self));
break;
+ case PROP_DEVICE_SELECTED_NAME:
+ g_value_take_string (value, bluetooth_device_selection_get_selected_device_name (self));
+ break;
case PROP_SHOW_BONDING:
g_value_set_boolean (value, priv->show_bonded);
break;
@@ -738,6 +758,9 @@ bluetooth_device_selection_class_init (B
PROP_DEVICE_SELECTED, g_param_spec_string ("device-selected",
NULL, NULL, NULL, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS(klass),
+ PROP_DEVICE_SELECTED_NAME, g_param_spec_string ("device-selected-name",
+ NULL, NULL, NULL, G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS(klass),
PROP_SHOW_BONDING, g_param_spec_boolean ("show-bonding",
NULL, NULL, FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS(klass),
[-- Attachment #3: fix_memory_leak_in_bluetooth_device_selection_get_property.patch --]
[-- Type: text/x-patch, Size: 764 bytes --]
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);
[-- Attachment #4: hide_filters_box_when_not_needed.patch --]
[-- Type: text/x-patch, Size: 2611 bytes --]
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 06:45:17 -0000
@@ -62,6 +62,7 @@ struct _BluetoothDeviceSelectionPrivate
GtkWidget *search_button;
GtkWidget *device_type_label, *device_type;
GtkWidget *device_category_label, *device_category;
+ GtkWidget *filters_vbox;
/* Current filter */
int device_type_filter;
@@ -517,7 +518,8 @@ bluetooth_device_selection_init(Bluetoot
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (self), vbox, FALSE, TRUE, 0);
-
+ priv->filters_vbox = vbox;
+
/* The filters */
str = g_strdup_printf ("<b>%s</b>", _("Show Only Bluetooth Devices With..."));
label = gtk_label_new (str);
@@ -596,7 +598,11 @@ bluetooth_device_selection_init(Bluetoot
gtk_widget_show (priv->device_type_label);
gtk_widget_show (priv->device_type);
}
-
+
+ /* if filters are not visible hide the vbox */
+ if (!priv->show_device_type && !priv->show_device_category)
+ gtk_widget_hide (priv->filters_vbox);
+
priv->default_adapter_changed_id = g_signal_connect (priv->client, "notify::default-adapter",
G_CALLBACK (default_adapter_changed), self);
}
@@ -657,11 +663,19 @@ bluetooth_device_selection_set_property
priv->show_device_type = g_value_get_boolean (value);
g_object_set (G_OBJECT (priv->device_type_label), "visible", priv->show_device_type, NULL);
g_object_set (G_OBJECT (priv->device_type), "visible", priv->show_device_type, NULL);
+ if (priv->show_device_type || priv->show_device_category)
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", TRUE, NULL);
+ else
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
break;
case PROP_SHOW_DEVICE_CATEGORY:
priv->show_device_category = g_value_get_boolean (value);
g_object_set (G_OBJECT (priv->device_category_label), "visible", priv->show_device_category, NULL);
g_object_set (G_OBJECT (priv->device_category), "visible", priv->show_device_category, NULL);
+ if (priv->show_device_type || priv->show_device_category)
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", TRUE, NULL);
+ else
+ g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
break;
case PROP_DEVICE_TYPE_FILTER:
priv->device_type_filter = g_value_get_int (value);
[-- Attachment #5: Type: text/plain, Size: 247 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #6: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-30 6:57 ` Antti Kaijanmäki
@ 2008-06-30 8:02 ` Marcel Holtmann
2008-06-30 8:14 ` Antti Kaijanmäki
0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2008-06-30 8:02 UTC (permalink / raw)
To: BlueZ development
Hi Antti,
> > > > 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.
> >
> > please resend all patches and make sure that you use the exact same
> > coding style that is used in the file you modify.
>
> done. patches attached.
you have to fix your editor. It keeps adding single tabs on empty lines.
Don't do this. I had to fix this manually. Other than that, your patches
are committed to the CVS. Thanks.
Regards
Marcel
-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Bluez-devel] Making library out of bluez-gnome
2008-06-30 8:02 ` Marcel Holtmann
@ 2008-06-30 8:14 ` Antti Kaijanmäki
0 siblings, 0 replies; 8+ messages in thread
From: Antti Kaijanmäki @ 2008-06-30 8:14 UTC (permalink / raw)
To: BlueZ development
ma, 2008-06-30 kello 10:02 +0200, Marcel Holtmann kirjoitti:
> Hi Antti,
>
> > > > > 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.
> > >
> > > please resend all patches and make sure that you use the exact same
> > > coding style that is used in the file you modify.
> >
> > done. patches attached.
>
> you have to fix your editor. It keeps adding single tabs on empty lines.
> Don't do this. I had to fix this manually.
Sorry. I didn't notice that. I'm going back and forth between emacs and
anjuta so this one is all my fault.
> Other than that, your patches
> are committed to the CVS. Thanks.
great!
-- Antti
-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-06-30 8:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 12:21 [Bluez-devel] Making library out of bluez-gnome Antti Kaijanmäki
2008-06-27 0:42 ` Bastien Nocera
2008-06-27 6:34 ` Antti Kaijanmäki
2008-06-30 5:47 ` Antti Kaijanmäki
2008-06-30 6:18 ` Marcel Holtmann
2008-06-30 6:57 ` Antti Kaijanmäki
2008-06-30 8:02 ` Marcel Holtmann
2008-06-30 8:14 ` Antti Kaijanmäki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox