[gnome-bluetooth] Add link to sound preferences in applet



commit 8651069434b50dc2d7fd9c5024d0085881997951
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 10 15:39:16 2009 +0000

    Add link to sound preferences in applet

 applet/main.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/applet/main.c b/applet/main.c
index d719e3e..ee80ade 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -52,6 +52,8 @@ static gboolean show_icon_pref = TRUE;
 
 #define KEYBOARD_PREFS		"gnome-keyboard-properties"
 #define MOUSE_PREFS		"gnome-mouse-properties"
+#define SOUND_PREFS		"gnome-volume-control"
+#define SOUND_PREFS_CMDLINE	SOUND_PREFS " -p hardware"
 
 enum {
 	CONNECTED,
@@ -211,6 +213,14 @@ static void mouse_callback(GObject *widget, gpointer user_data)
 		g_printerr("Couldn't execute command: %s\n", command);
 }
 
+static void sound_callback(GObject *widget, gpointer user_data)
+{
+	const char *command = SOUND_PREFS_CMDLINE;
+
+	if (!g_spawn_command_line_async(command, NULL))
+		g_printerr("Couldn't execute command: %s\n", command);
+}
+
 void wizard_callback(GObject *widget, gpointer user_data)
 {
 	const char *command = "bluetooth-wizard";
@@ -859,6 +869,16 @@ update_device_list (GtkTreeIter *parent)
 					       menu_merge_id,
 					       G_CALLBACK (mouse_callback));
 			}
+			if ((type == BLUETOOTH_TYPE_HEADSET ||
+			     type == BLUETOOTH_TYPE_HEADPHONES ||
+			     type == BLUETOOTH_TYPE_OTHER_AUDIO) && program_available (SOUND_PREFS)) {
+				add_menu_item (address,
+					       "sound",
+					       _("Open Sound Preferences..."),
+					       uimanager,
+					       menu_merge_id,
+					       G_CALLBACK (sound_callback));
+			}
 		} else {
 			gtk_action_set_label (action, name);
 



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