[gnome-control-center] mouse: Make touchpad tab appear when connected
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] mouse: Make touchpad tab appear when connected
- Date: Wed, 16 Mar 2011 13:49:08 +0000 (UTC)
commit 5b259bfe5661121092b5d41a9d8f223e930ddf30
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 16 13:48:08 2011 +0000
mouse: Make touchpad tab appear when connected
On-the-fly!
panels/mouse/gnome-mouse-properties.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index da95b56..978faae 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include <string.h>
+#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gnome-settings-daemon/gsd-enums.h>
#include <math.h>
@@ -55,6 +56,9 @@ enum
static gint double_click_state = DOUBLE_CLICK_TEST_OFF;
static GSettings *mouse_settings = NULL;
static GSettings *touchpad_settings = NULL;
+static GdkDeviceManager *device_manager = NULL;
+static guint device_added_id = 0;
+static guint device_removed_id = 0;
/* Double Click handling */
@@ -354,6 +358,14 @@ dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
*/
}
+static void
+device_changed (GdkDeviceManager *device_manager,
+ GdkDevice *device,
+ GtkBuilder *dialog)
+{
+ gtk_widget_set_visible (WID ("touchpad_vbox"), touchpad_is_present ());
+}
+
GtkWidget *
gnome_mouse_properties_init (GtkBuilder *dialog)
{
@@ -362,6 +374,12 @@ gnome_mouse_properties_init (GtkBuilder *dialog)
mouse_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
touchpad_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.touchpad");
+ device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
+ g_signal_connect (device_manager, "device-added",
+ G_CALLBACK (device_changed), dialog);
+ g_signal_connect (device_manager, "device-removed",
+ G_CALLBACK (device_changed), dialog);
+
create_dialog (dialog);
if (dialog) {
@@ -388,4 +406,11 @@ gnome_mouse_properties_dispose (GtkWidget *widget)
g_object_unref (touchpad_settings);
touchpad_settings = NULL;
}
+ if (device_manager != NULL) {
+ g_signal_handler_disconnect (device_manager, device_added_id);
+ device_added_id = 0;
+ g_signal_handler_disconnect (device_manager, device_removed_id);
+ device_removed_id = 0;
+ device_manager = NULL;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]