[gnome-power-manager] Add a ::devices-changed signal to GpmEngine that helper code may want to use



commit f706110d7be289eafb7df39737f4b2ef25382586
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 31 16:13:42 2010 +0100

    Add a ::devices-changed signal to GpmEngine that helper code may want to use

 src/gpm-engine.c |   10 ++++++++++
 src/gpm-engine.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index d292f89..f71dc6e 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -75,6 +75,7 @@ enum {
 	DISCHARGING,
 	LOW_CAPACITY,
 	PERHAPS_RECALL,
+	DEVICES_CHANGED,
 	LAST_SIGNAL
 };
 
@@ -495,6 +496,8 @@ gpm_engine_recalculate_state (GpmEngine *engine)
 
 	gpm_engine_recalculate_state_icon (engine);
 	gpm_engine_recalculate_state_summary (engine);
+
+	g_signal_emit (engine, signals [DEVICES_CHANGED], 0);
 }
 
 /**
@@ -1208,6 +1211,13 @@ gpm_engine_class_init (GpmEngineClass *klass)
 			      G_STRUCT_OFFSET (GpmEngineClass, charge_critical),
 			      NULL, NULL, g_cclosure_marshal_VOID__POINTER,
 			      G_TYPE_NONE, 1, G_TYPE_POINTER);
+	signals [DEVICES_CHANGED] =
+		g_signal_new ("devices-changed",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (GpmEngineClass, devices_changed),
+			      NULL, NULL, g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
 }
 
 /**
diff --git a/src/gpm-engine.h b/src/gpm-engine.h
index be1ccd6..e158283 100644
--- a/src/gpm-engine.h
+++ b/src/gpm-engine.h
@@ -65,6 +65,7 @@ typedef struct
 						 UpDevice	*device);
 	void		(* discharging)		(GpmEngine	*engine,
 						 UpDevice	*device);
+	void		(* devices_changed)	(GpmEngine	*engine);
 } GpmEngineClass;
 
 GType		 gpm_engine_get_type		(void);



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