[gnome-bluetooth] Have the properties correctly initialised by the constructor



commit 5d22cae9919344462fe44f361758cf687174db6c
Author: Joshua Lock <josh linux intel com>
Date:   Fri Sep 25 17:08:35 2009 +0100

    Have the properties correctly initialised by the constructor
    
    Instead of initialising parameters in the init set the G_PARAM_CONSTRUCT
    flag on the property installation and have the constructor set the
    properties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596329

 lib/bluetooth-chooser.c       |   12 ++++--------
 lib/bluetooth-filter-widget.c |   12 ++++--------
 2 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/lib/bluetooth-chooser.c b/lib/bluetooth-chooser.c
index 303243e..80dbc88 100644
--- a/lib/bluetooth-chooser.c
+++ b/lib/bluetooth-chooser.c
@@ -708,10 +708,6 @@ bluetooth_chooser_init(BluetoothChooser *self)
 
 	gtk_widget_push_composite_child ();
 
-	priv->device_type_filter = BLUETOOTH_TYPE_ANY;
-	priv->show_paired = FALSE;
-	priv->show_searching = FALSE;
-
 	priv->client = bluetooth_client_new ();
 
 	/* Setup the widget itself */
@@ -984,18 +980,18 @@ bluetooth_chooser_class_init (BluetoothChooserClass *klass)
 										    FALSE, G_PARAM_READWRITE));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_SHOW_DEVICE_TYPE, g_param_spec_boolean ("show-device-type",
-										      "show-device-type", "Whether to show the device type filter", TRUE, G_PARAM_READWRITE));
+										      "show-device-type", "Whether to show the device type filter", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_SHOW_DEVICE_CATEGORY, g_param_spec_boolean ("show-device-category",
-											  "show-device-category", "Whether to show the device category filter", TRUE, G_PARAM_READWRITE));
+											  "show-device-category", "Whether to show the device category filter", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	for (i = 0, max_filter_val = 0 ; i < _BLUETOOTH_TYPE_NUM_TYPES; i++)
 		max_filter_val += 1 << i;
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_DEVICE_TYPE_FILTER, g_param_spec_int ("device-type-filter",
-					 					    "device-type-filter", "A bitmask of #BluetoothType to show", BLUETOOTH_TYPE_ANY, max_filter_val, 1, G_PARAM_READWRITE));
+										    "device-type-filter", "A bitmask of #BluetoothType to show", BLUETOOTH_TYPE_ANY, max_filter_val, 1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_DEVICE_CATEGORY_FILTER, g_param_spec_enum ("device-category-filter",
-											 "device-category-filter", "The #BluetoothCategory to show", BLUETOOTH_TYPE_CATEGORY, BLUETOOTH_CATEGORY_ALL, G_PARAM_READWRITE));
+											 "device-category-filter", "The #BluetoothCategory to show", BLUETOOTH_TYPE_CATEGORY, BLUETOOTH_CATEGORY_ALL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_DEVICE_SERVICE_FILTER, g_param_spec_string ("device-service-filter",
 											  "device-service-filter", "A string representing the service to filter for", NULL, G_PARAM_WRITABLE));
diff --git a/lib/bluetooth-filter-widget.c b/lib/bluetooth-filter-widget.c
index 65bd45d..2a37a7a 100644
--- a/lib/bluetooth-filter-widget.c
+++ b/lib/bluetooth-filter-widget.c
@@ -207,10 +207,6 @@ bluetooth_filter_widget_init(BluetoothFilterWidget *self)
 
 	gtk_widget_push_composite_child ();
 
-	priv->device_type_filter = BLUETOOTH_TYPE_ANY;
-	priv->show_device_type = TRUE;
-	priv->show_device_category = TRUE;
-
 	gtk_box_set_homogeneous (GTK_BOX (self), FALSE);
 	gtk_box_set_spacing (GTK_BOX (self), 6);
 
@@ -441,18 +437,18 @@ bluetooth_filter_widget_class_init (BluetoothFilterWidgetClass *klass)
 
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_SHOW_DEVICE_TYPE, g_param_spec_boolean ("show-device-type",
-										      "show-device-type", "Whether to show the device type filter", TRUE, G_PARAM_READWRITE));
+										      "show-device-type", "Whether to show the device type filter", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_SHOW_DEVICE_CATEGORY, g_param_spec_boolean ("show-device-category",
-											  "show-device-category", "Whether to show the device category filter", TRUE, G_PARAM_READWRITE));
+											  "show-device-category", "Whether to show the device category filter", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	for (i = 0, max_filter_val = 0 ; i < _BLUETOOTH_TYPE_NUM_TYPES; i++)
 		max_filter_val += 1 << i;
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_DEVICE_TYPE_FILTER, g_param_spec_int ("device-type-filter",
-					 					    "device-type-filter", "A bitmask of #BluetoothType to show", 1, max_filter_val, 1, G_PARAM_READWRITE));
+										    "device-type-filter", "A bitmask of #BluetoothType to show", 1, max_filter_val, 1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_DEVICE_CATEGORY_FILTER, g_param_spec_enum ("device-category-filter",
-											 "device-category-filter", "The #BluetoothCategory to show", BLUETOOTH_TYPE_CATEGORY, BLUETOOTH_CATEGORY_ALL, G_PARAM_READWRITE));
+											 "device-category-filter", "The #BluetoothCategory to show", BLUETOOTH_TYPE_CATEGORY, BLUETOOTH_CATEGORY_ALL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	g_object_class_install_property (G_OBJECT_CLASS(klass),
 					 PROP_DEVICE_SERVICE_FILTER, g_param_spec_string ("device-service-filter",
 											  "device-service-filter", "A string representing the service to filter for", NULL, G_PARAM_WRITABLE));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]