[gnome-bluetooth] Only show the browse/connect actions as appropriate



commit e527f7f681863678df98c80201977d73c5b3cfbc
Author: Joshua Lock <josh linux intel com>
Date:   Wed Oct 14 17:20:47 2009 +0100

    Only show the browse/connect actions as appropriate
    
    Change the cell_data_func callbacks so that browse is only shown if the
    selected device supports OBEXFileTransfer and connect is only shown when
    the device is disconnected.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=598460

 moblin/moblin-panel.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/moblin/moblin-panel.c b/moblin/moblin-panel.c
index a1e049d..884fa08 100644
--- a/moblin/moblin-panel.c
+++ b/moblin/moblin-panel.c
@@ -814,8 +814,10 @@ connect_to_text (GtkTreeViewColumn *column, GtkCellRenderer *cell,
 			BLUETOOTH_COLUMN_CONNECTED, &connected,
 			BLUETOOTH_COLUMN_TRUSTED, &trusted, -1);
 
-	if ((paired || trusted) && !connected) {
+	if ((paired || trusted) && connected == FALSE) {
 		g_object_set (cell, "markup", _("Connect"), NULL);
+	} else {
+		g_object_set (cell, "markup", "", NULL);
 	}
 }
 
@@ -823,15 +825,23 @@ static void
 browse_to_text (GtkTreeViewColumn *column, GtkCellRenderer *cell,
 		GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 {
-	gboolean *connected;
-	guint type;
-	gtk_tree_model_get (model, iter, BLUETOOTH_COLUMN_CONNECTED, &connected,
-			BLUETOOTH_COLUMN_TYPE, &type, -1);
-
-	if (connected &&
-	(type == BLUETOOTH_TYPE_PHONE || type == BLUETOOTH_TYPE_COMPUTER || type == BLUETOOTH_TYPE_CAMERA)) {
-		g_object_set (cell, "markup", _("Browse"), NULL);
+	gboolean found = FALSE;
+	guint i;
+	const char **uuids = NULL;
+
+	gtk_tree_model_get (model, iter, BLUETOOTH_COLUMN_UUIDS, &uuids, -1);
+
+	if (uuids != NULL) {
+		for (i = 0; uuids[i] != NULL; i++)
+			if (g_str_equal (uuids[i], "OBEXFileTransfer")) {
+				g_object_set (cell, "markup", _("Browse"), NULL);
+				found = TRUE;
+				break;
+			}
 	}
+
+	if (found == FALSE)
+		g_object_set (cell, "markup", "", NULL);
 }
 
 static void



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