[gnome-bluetooth] properties: Use control-center API to switch panels



commit b0bce9026ceb14d20f50c3a4d431b58bc0bc1b1d
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Sep 16 16:15:11 2011 +0100

    properties: Use control-center API to switch panels

 properties/cc-bluetooth-panel.c   |   28 +++++++++++++++++++++-------
 properties/cut-n-paste/cc-shell.h |    2 ++
 2 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/properties/cc-bluetooth-panel.c b/properties/cc-bluetooth-panel.c
index 55197f9..6b5b968 100644
--- a/properties/cc-bluetooth-panel.c
+++ b/properties/cc-bluetooth-panel.c
@@ -44,10 +44,9 @@ G_DEFINE_DYNAMIC_TYPE (CcBluetoothPanel, cc_bluetooth_panel, CC_TYPE_PANEL)
 
 #define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
 
-#define GNOMECC			"gnome-control-center"
-#define KEYBOARD_PREFS		GNOMECC " keyboard"
-#define MOUSE_PREFS		GNOMECC " mouse"
-#define SOUND_PREFS		GNOMECC " sound"
+#define KEYBOARD_PREFS		"keyboard"
+#define MOUSE_PREFS		"mouse"
+#define SOUND_PREFS		"sound"
 #define WIZARD			"bluetooth-wizard"
 
 struct CcBluetoothPanelPrivate {
@@ -432,24 +431,39 @@ cc_bluetooth_panel_update_power (CcBluetoothPanel *self)
 }
 
 static void
+switch_panel (CcBluetoothPanel *self,
+	      const char       *panel)
+{
+  CcShell *shell;
+  GError *error = NULL;
+
+  shell = cc_panel_get_shell (CC_PANEL (self));
+  if (cc_shell_set_active_panel_from_id (shell, panel, NULL, &error) == FALSE)
+    {
+      g_warning ("Failed to activate Region panel: %s", error->message);
+      g_error_free (error);
+    }
+}
+
+static void
 keyboard_callback (GtkButton        *button,
 		   CcBluetoothPanel *self)
 {
-	launch_command (KEYBOARD_PREFS);
+	switch_panel (self, KEYBOARD_PREFS);
 }
 
 static void
 mouse_callback (GtkButton        *button,
 		CcBluetoothPanel *self)
 {
-	launch_command (MOUSE_PREFS);
+	switch_panel (self, MOUSE_PREFS);
 }
 
 static void
 sound_callback (GtkButton        *button,
 		CcBluetoothPanel *self)
 {
-	launch_command (SOUND_PREFS);
+	switch_panel (self, SOUND_PREFS);
 }
 
 static void
diff --git a/properties/cut-n-paste/cc-shell.h b/properties/cut-n-paste/cc-shell.h
index bc142f1..4fdee73 100644
--- a/properties/cut-n-paste/cc-shell.h
+++ b/properties/cut-n-paste/cc-shell.h
@@ -86,6 +86,7 @@ struct _CcShellClass
   /* vfuncs */
   gboolean    (*set_active_panel_from_id) (CcShell      *shell,
                                            const gchar  *id,
+                                           const gchar **argv,
                                            GError      **error);
   GtkWidget * (*get_toplevel)             (CcShell      *shell);
 };
@@ -97,6 +98,7 @@ void            cc_shell_set_active_panel         (CcShell      *shell,
                                                    CcPanel      *panel);
 gboolean        cc_shell_set_active_panel_from_id (CcShell      *shell,
                                                    const gchar  *id,
+                                                   const gchar **argv,
                                                    GError      **error);
 GtkWidget *     cc_shell_get_toplevel             (CcShell      *shell);
 



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