|
|
|
Re: Wizard patch | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Hi, Marcel! On Sat, 2008-06-28 at 00:23 +0200, Marcel Holtmann wrote: > looks nice. However you have to break this up into pieces for. Sent > small patches and I can quickly review and commit them. Here's one such piece of my wizard patch. It simply fixes the "device-type-filter" property to do something reasonable when set (namely, you give it a BLUETOOTH_TYPE and it sets the right index in the combo). More patches coming. -mt
diff -rupN bluez-gnome-0.27.orig/common/bluetooth-device-selection.c bluez-gnome-0.27/common/bluetooth-device-selection.c
--- bluez-gnome-0.27.orig/common/bluetooth-device-selection.c 2008-06-27 14:12:49.000000000 -0400
+++ bluez-gnome-0.27/common/bluetooth-device-selection.c 2008-06-27 14:13:05.000000000 -0400
@@ -90,6 +90,15 @@ bluetooth_device_category_to_string (int
}
}
+static int
+int_log2(int v)
+{
+ unsigned rv = 0;
+ while (v >>= 1)
+ rv++;
+ return rv;
+}
+
static void
name_to_text (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
@@ -591,7 +600,7 @@ bluetooth_device_selection_init(Bluetoot
}
g_signal_connect (G_OBJECT (priv->device_type), "changed",
G_CALLBACK(filter_type_changed_cb), self);
- gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_type), priv->device_type_filter);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_type), int_log2(priv->device_type_filter));
if (priv->show_device_type) {
gtk_widget_show (priv->device_type_label);
gtk_widget_show (priv->device_type);
@@ -665,7 +674,7 @@ bluetooth_device_selection_set_property
break;
case PROP_DEVICE_TYPE_FILTER:
priv->device_type_filter = g_value_get_int (value);
- gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_type), priv->device_type_filter >> 1);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(priv->device_type), int_log2(priv->device_type_filter));
break;
case PROP_DEVICE_CATEGORY_FILTER:
priv->device_category_filter = g_value_get_int (value);
@@ -751,7 +760,7 @@ bluetooth_device_selection_class_init (B
NULL, NULL, TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS(klass),
PROP_DEVICE_TYPE_FILTER, g_param_spec_int ("device-type-filter", NULL, NULL,
- 0, BLUETOOTH_TYPE_NUM_TYPES, 0, G_PARAM_READWRITE));
+ 1, 1 << (BLUETOOTH_TYPE_NUM_TYPES-1), 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS(klass),
PROP_DEVICE_CATEGORY_FILTER, g_param_spec_int ("device-category-filter", NULL, NULL,
0, BLUETOOTH_CATEGORY_NUM_CATEGORIES, 0, G_PARAM_READWRITE));
Attachment:
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- 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
![]() |
![]() |