gnome-bluetooth r378 - trunk/common
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-bluetooth r378 - trunk/common
- Date: Thu, 26 Feb 2009 19:19:50 +0000 (UTC)
Author: hadess
Date: Thu Feb 26 19:19:50 2009
New Revision: 378
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=378&view=rev
Log:
Add Powered column
Will be useful to see whether a device is disabled.
Modified:
trunk/common/bluetooth-client.c
trunk/common/bluetooth-client.h
trunk/common/test-client.c
Modified: trunk/common/bluetooth-client.c
==============================================================================
--- trunk/common/bluetooth-client.c (original)
+++ trunk/common/bluetooth-client.c Thu Feb 26 19:19:50 2009
@@ -500,6 +500,7 @@
BluetoothClient *client = BLUETOOTH_CLIENT(user_data);
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
GtkTreeIter iter;
+ gboolean notify = FALSE;
DBG("client %p property %s", client, property);
@@ -509,7 +510,7 @@
if (g_str_equal (property, "Powered") == TRUE) {
GHashTable *hash;
const gchar *address, *name;
- gboolean discovering;
+ gboolean discovering, powered;
GPtrArray *array;
/* Need to update those properties! */
@@ -524,10 +525,16 @@
value = g_hash_table_lookup(hash, "Discovering");
discovering = value ? g_value_get_boolean(value) : FALSE;
+ value = g_hash_table_lookup(hash, "Powered");
+ powered = value ? g_value_get_boolean(value) : FALSE;
+
gtk_tree_store_set(priv->store, &iter,
BLUETOOTH_COLUMN_ADDRESS, address,
BLUETOOTH_COLUMN_NAME, name,
- BLUETOOTH_COLUMN_DISCOVERING, discovering, -1);
+ BLUETOOTH_COLUMN_DISCOVERING, discovering,
+ BLUETOOTH_COLUMN_POWERED, powered,
+ -1);
+ notify = TRUE;
adapter_list_devices(adapter, &array, NULL);
if (array != NULL) {
@@ -547,10 +554,14 @@
BLUETOOTH_COLUMN_NAME, name, -1);
} else if (g_str_equal(property, "Discovering") == TRUE) {
gboolean discovering = g_value_get_boolean(value);
- GtkTreePath *path;
gtk_tree_store_set(priv->store, &iter,
BLUETOOTH_COLUMN_DISCOVERING, discovering, -1);
+ notify = TRUE;
+ }
+
+ if (notify != FALSE) {
+ GtkTreePath *path;
/* Tell the world */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->store), &iter);
@@ -570,7 +581,7 @@
GHashTable *hash = NULL;
GValue *value;
const gchar *address, *name;
- gboolean discovering;
+ gboolean discovering, powered;
DBG("client %p path %s", client, path);
@@ -587,17 +598,23 @@
value = g_hash_table_lookup(hash, "Discovering");
discovering = value ? g_value_get_boolean(value) : FALSE;
+
+ value = g_hash_table_lookup(hash, "Powered");
+ powered = value ? g_value_get_boolean(value) : FALSE;
} else {
address = NULL;
name = NULL;
discovering = FALSE;
+ powered = FALSE;
}
gtk_tree_store_insert_with_values(priv->store, &iter, NULL, -1,
- BLUETOOTH_COLUMN_PROXY, adapter,
- BLUETOOTH_COLUMN_ADDRESS, address,
- BLUETOOTH_COLUMN_NAME, name,
- BLUETOOTH_COLUMN_DISCOVERING, discovering, -1);
+ BLUETOOTH_COLUMN_PROXY, adapter,
+ BLUETOOTH_COLUMN_ADDRESS, address,
+ BLUETOOTH_COLUMN_NAME, name,
+ BLUETOOTH_COLUMN_DISCOVERING, discovering,
+ BLUETOOTH_COLUMN_POWERED, powered,
+ -1);
dbus_g_proxy_add_signal(adapter, "PropertyChanged",
G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
@@ -756,10 +773,10 @@
DBG("client %p", client);
priv->store = gtk_tree_store_new(_BLUETOOTH_NUM_COLUMNS, G_TYPE_OBJECT,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INT,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INT,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
priv->dbus = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
Modified: trunk/common/bluetooth-client.h
==============================================================================
--- trunk/common/bluetooth-client.h (original)
+++ trunk/common/bluetooth-client.h Thu Feb 26 19:19:50 2009
@@ -44,6 +44,7 @@
BLUETOOTH_COLUMN_TRUSTED,
BLUETOOTH_COLUMN_CONNECTED,
BLUETOOTH_COLUMN_DISCOVERING,
+ BLUETOOTH_COLUMN_POWERED,
_BLUETOOTH_NUM_COLUMNS
};
Modified: trunk/common/test-client.c
==============================================================================
--- trunk/common/test-client.c (original)
+++ trunk/common/test-client.c Thu Feb 26 19:19:50 2009
@@ -186,6 +186,10 @@
"Discovering", gtk_cell_renderer_text_new(),
"text", BLUETOOTH_COLUMN_DISCOVERING, NULL);
+ gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree), -1,
+ "Powered", gtk_cell_renderer_text_new(),
+ "text", BLUETOOTH_COLUMN_POWERED, NULL);
+
model = bluetooth_client_get_model(client);
sorted = gtk_tree_model_sort_new_with_model(model);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(sorted),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]