gnome-power-manager r3312 - in branches/gnome-2-22: . src



Author: rhughes
Date: Fri Feb 27 16:09:45 2009
New Revision: 3312
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3312&view=rev

Log:
2009-02-27  Richard Hughes  <richard hughsie com>

* src/gpm-button.c: (hal_daemon_new_device_cb), (gpm_button_init):
Add buttons as they appear, as would do on a hibernate with a USB
keyboard. Patch by Arnaud Patard, many thanks.


Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/src/gpm-button.c

Modified: branches/gnome-2-22/src/gpm-button.c
==============================================================================
--- branches/gnome-2-22/src/gpm-button.c	(original)
+++ branches/gnome-2-22/src/gpm-button.c	Fri Feb 27 16:09:45 2009
@@ -481,6 +481,26 @@
 }
 
 /**
+ * hal_daemon_new_device_cb
+ **/
+static void
+hal_daemon_new_device_cb (HalGManager *hal_manager, const gchar *udi, GpmButton *button)
+
+{
+	gboolean is_button;
+	HalGDevice *device;
+
+	device = hal_gdevice_new ();
+	hal_gdevice_set_udi (device, udi);
+	hal_gdevice_query_capability (device, "button", &is_button, NULL);
+	if (is_button == TRUE) {
+		gpm_debug ("Watching %s", udi);
+		watch_add_button (button, udi);
+	}
+	g_object_unref (device);
+}
+
+/**
  * gpm_button_init:
  * @button: This class instance
  **/
@@ -529,6 +549,8 @@
 			  G_CALLBACK (hal_daemon_start_cb), button);
 	g_signal_connect (button->priv->hal_manager, "daemon-stop",
 			  G_CALLBACK (hal_daemon_stop_cb), button);
+	g_signal_connect (button->priv->hal_manager, "device-added",
+			  G_CALLBACK (hal_daemon_new_device_cb), button);
 
 	button->priv->hal_devicestore = hal_gdevicestore_new ();
 



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