summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-09 21:20:55 +0200
committerraveit65 <[email protected]>2016-07-25 16:13:41 +0200
commit01c2420b51731687b7dae1481101ec04fa0fc2d2 (patch)
treee762bf555ec3aaa5b4e9c617f800317a28a2773c
parent3902409bb09d5db383e88164bbf2d07811ca7392 (diff)
downloadmate-power-manager-01c2420b51731687b7dae1481101ec04fa0fc2d2.tar.bz2
mate-power-manager-01c2420b51731687b7dae1481101ec04fa0fc2d2.tar.xz
Add a ::devices-changed signal to GpmEngine that helper code may want
taken from: https://git.gnome.org/browse/gnome-power-manager/commit/?id=f706110
-rw-r--r--src/gpm-engine.c10
-rw-r--r--src/gpm-engine.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index 61cdba4..49f39fd 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -72,6 +72,7 @@ enum {
CHARGE_ACTION,
DISCHARGING,
LOW_CAPACITY,
+ DEVICES_CHANGED,
LAST_SIGNAL
};
@@ -536,6 +537,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);
}
/**
@@ -1234,6 +1237,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 43f8956..484b3f2 100644
--- a/src/gpm-engine.h
+++ b/src/gpm-engine.h
@@ -61,6 +61,7 @@ typedef struct
UpDevice *device);
void (* discharging) (GpmEngine *engine,
UpDevice *device);
+ void (* devices_changed) (GpmEngine *engine);
} GpmEngineClass;
GType gpm_engine_get_type (void);