gnome-power-manager r3311 - in branches/gnome-2-24: . src



Author: rhughes
Date: Fri Feb 27 16:06:00 2009
New Revision: 3311
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3311&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-24/ChangeLog
   branches/gnome-2-24/src/gpm-button.c

Modified: branches/gnome-2-24/src/gpm-button.c
==============================================================================
--- branches/gnome-2-24/src/gpm-button.c	(original)
+++ branches/gnome-2-24/src/gpm-button.c	Fri Feb 27 16:06:00 2009
@@ -494,6 +494,27 @@
 	}
 }
 
+
+/**
+ * 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) {
+		egg_debug ("Watching %s", udi);
+		watch_add_button (button, udi);
+	}
+	g_object_unref (device);
+}
+
 /**
  * gpm_button_init:
  * @button: This class instance
@@ -543,6 +564,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]