[gnome-bluetooth] properties: Implement treeview buttons



commit e8122c435377e570564c3b96ec81a34d88f060bb
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 22 02:00:19 2011 +0000

    properties: Implement treeview buttons

 properties/cc-bluetooth-panel.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/properties/cc-bluetooth-panel.c b/properties/cc-bluetooth-panel.c
index 2d3df4b..ee3dc45 100644
--- a/properties/cc-bluetooth-panel.c
+++ b/properties/cc-bluetooth-panel.c
@@ -149,6 +149,7 @@ cc_bluetooth_panel_update_properties (CcBluetoothPanel *self)
 	}
 }
 
+/* Visibility/Discoverable */
 static void
 switch_discoverable_active_changed (GtkSwitch        *button,
 				    GParamSpec       *spec,
@@ -206,6 +207,35 @@ device_selected_changed (BluetoothChooser *chooser,
 	cc_bluetooth_panel_update_properties (self);
 }
 
+/* Treeview buttons */
+static void
+delete_clicked (GtkToolButton    *button,
+		CcBluetoothPanel *self)
+{
+	char *address;
+
+	address = bluetooth_chooser_get_selected_device (BLUETOOTH_CHOOSER (self->priv->chooser));
+	g_assert (address);
+
+	if (bluetooth_chooser_remove_selected_device (BLUETOOTH_CHOOSER (self->priv->chooser)))
+		bluetooth_plugin_manager_device_deleted (address);
+
+	g_free (address);
+}
+
+static void
+setup_clicked (GtkToolButton    *button,
+		CcBluetoothPanel *self)
+{
+	const char *command = "bluetooth-wizard";
+	GError *error = NULL;
+
+	if (!g_spawn_command_line_async(command, &error)) {
+		g_warning ("Couldn't execute command '%s': %s\n", command, error->message);
+		g_error_free (error);
+	}
+}
+
 static void
 cc_bluetooth_panel_init (CcBluetoothPanel *self)
 {
@@ -272,8 +302,12 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
 
 	g_signal_connect (G_OBJECT (self->priv->chooser), "notify::device-selected",
 			  G_CALLBACK (device_selected_changed), self);
+	g_signal_connect (G_OBJECT (WID ("button_delete")), "clicked",
+			  G_CALLBACK (delete_clicked), self);
+	g_signal_connect (G_OBJECT (WID ("button_setup")), "clicked",
+			  G_CALLBACK (setup_clicked), self);
 
-	/* Set the initial state of the dialogue */
+	/* Set the initial state of the properties */
 	cc_bluetooth_panel_update_properties (self);
 	gtk_widget_show_all (GTK_WIDGET (self));
 }



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