[gnome-bluetooth] lib: Rename the treeview when hiding type column



commit 3e7e2718011201e640033d065731719064e06416
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 18 16:35:12 2011 +0100

    lib: Rename the treeview when hiding type column
    
    Showing just "Device" is a bit bizarre if it's the only column.

 lib/bluetooth-chooser.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/lib/bluetooth-chooser.c b/lib/bluetooth-chooser.c
index 89deb77..d34d911 100644
--- a/lib/bluetooth-chooser.c
+++ b/lib/bluetooth-chooser.c
@@ -98,6 +98,11 @@ enum {
 	DEVICE_TYPE_FILTER_NUM_COLS
 };
 
+enum {
+	TREEVIEW_COLUMN_DEVICE = 0,
+	TREEVIEW_COLUMN_TYPE = 1
+};
+
 static void
 bonded_to_icon (GtkTreeViewColumn *column, GtkCellRenderer *cell,
 	      GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
@@ -1029,10 +1034,20 @@ bluetooth_chooser_set_property (GObject *object, guint prop_id,
 				g_object_set (G_OBJECT (priv->filters_vbox), "visible", FALSE, NULL);
 		}
 		break;
-	case PROP_SHOW_DEVICE_TYPE_COLUMN:
-		gtk_tree_view_column_set_visible (gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), 1),
+	case PROP_SHOW_DEVICE_TYPE_COLUMN: {
+		GtkTreeViewColumn *column;
+
+		column = gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), TREEVIEW_COLUMN_TYPE);
+		gtk_tree_view_column_set_visible (column,
 						  g_value_get_boolean (value));
+
+		column = gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), TREEVIEW_COLUMN_DEVICE);
+		if (g_value_get_boolean (value))
+			gtk_tree_view_column_set_title (column, _("Device"));
+		else
+			gtk_tree_view_column_set_title (column, _("Devices"));
 		break;
+		}
 	case PROP_SHOW_DEVICE_CATEGORY:
 		priv->show_device_category = g_value_get_boolean (value);
 		if (priv->internal_filter) {
@@ -1091,7 +1106,7 @@ bluetooth_chooser_get_property (GObject *object, guint prop_id,
 		break;
 	case PROP_SHOW_DEVICE_TYPE_COLUMN:
 		g_value_set_boolean (value,
-				     gtk_tree_view_column_get_visible (gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), 1)));
+				     gtk_tree_view_column_get_visible (gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), TREEVIEW_COLUMN_TYPE)));
 		break;
 	case PROP_SHOW_DEVICE_CATEGORY:
 		g_value_set_boolean (value, priv->show_device_category);



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