After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 596546 - Add a property to disable the internally created filter on construction
Add a property to disable the internally created filter on construction
Status: RESOLVED FIXED
Product: gnome-bluetooth
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-bluetooth-general-maint@gnome.bugs
gnome-bluetooth-general-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2009-09-27 22:10 UTC by Joshua Lock
Modified: 2009-09-29 11:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a property to disable the internally created filter on construction (7.59 KB, patch)
2009-09-27 22:10 UTC, Joshua Lock
needs-work Details | Review
Add a property to disable the internally created filter on construction (4.38 KB, patch)
2009-09-28 12:12 UTC, Joshua Lock
none Details | Review
Add a property to disable the internally created filter on construction (4.38 KB, patch)
2009-09-29 11:31 UTC, Joshua Lock
committed Details | Review

Description Joshua Lock 2009-09-27 22:10:09 UTC
The "standalone-filter" property disables display and updating of the
internally created filter widget, allowing the chooser to be bound to an
externally created filter widget.
Also adds an extra test case to test-deviceselection to demonstrate this,
by using the "filter" flag.
Comment 1 Joshua Lock 2009-09-27 22:10:11 UTC
Created attachment 144144 [details] [review]
Add a property to disable the internally created filter on construction
Comment 2 Bastien Nocera 2009-09-27 22:40:13 UTC
Comment on attachment 144144 [details] [review]
Add a property to disable the internally created filter on construction

>From 66ceb2ca65dc00ef43434503ec37cc7f1f0e4b1a Mon Sep 17 00:00:00 2001
>From: Joshua Lock <josh@linux.intel.com>
>Date: Sun, 27 Sep 2009 22:39:44 +0100
>Subject: [PATCH] Add a property to disable the internally created filter on construction
>
>The "standalone-filter" property disables display and updating of the
>internally created filter widget, allowing the chooser to be bound to an
>externally created filter widget.

Please reverse the property, so that it's TRUE by default, such as:
has-internal-device-filter

>Also adds an extra test case to test-deviceselection to demonstrate this,
>by using the "filter" flag.

Add another test case (can be reusing the same code), where we have both an internal and an external filter, so we can check on synchronisation bugs.

<snip>
> 	case PROP_SHOW_DEVICE_TYPE:
> 		priv->show_device_type = g_value_get_boolean (value);
>-		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);
>+		if (!priv->standalone_filter) {
>+			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;

Make sure you warn about this with g_warning, it woud be a programming error to have this set/unset with the category being disabled. (Goes for the other properties as well).


Seeing as the filter widget will be made visible through the property API, it should be exported and documented as well.
Comment 3 Joshua Lock 2009-09-28 08:22:54 UTC
(In reply to comment #2)
> <snip>
> > 	case PROP_SHOW_DEVICE_TYPE:
> > 		priv->show_device_type = g_value_get_boolean (value);
> >-		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);
> >+		if (!priv->standalone_filter) {
> >+			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;
> 
> Make sure you warn about this with g_warning, it woud be a programming error to
> have this set/unset with the category being disabled. (Goes for the other
> properties as well).

I don't think we want this as the properties will be set by the bindings, which would trigger the warning as well.
Comment 4 Joshua Lock 2009-09-28 12:12:45 UTC
Created attachment 144169 [details] [review]
Add a property to disable the internally created filter on construction

The "has-internal-filter" property defaults to TRUE. A FALSE value disables
display and updating of the internally created filter widget, allowing the
chooser to be bound to an externally created filter widget.
Comment 5 Joshua Lock 2009-09-29 11:31:32 UTC
Created attachment 144252 [details] [review]
Add a property to disable the internally created filter on construction

The "has-internal-filter" property defaults to TRUE. A FALSE value disables
display and updating of the internally created filter widget, allowing the
chooser to be bound to an externally created filter widget.