GNOME Bugzilla – Bug 596546
Add a property to disable the internally created filter on construction
Last modified: 2009-09-29 11:47:33 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.
Created attachment 144144 [details] [review] Add a property to disable the internally created filter on construction
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.
(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.
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.
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.