mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-05 15:48:08 +02:00
ppd-profile: Write PpdPowerChangedReason as string in debug statements
This commit is contained in:
parent
301af78dce
commit
d41b0f0f81
3 changed files with 13 additions and 1 deletions
|
|
@ -1071,7 +1071,8 @@ upower_battery_set_power_changed_reason (PpdApp *data,
|
|||
return;
|
||||
|
||||
data->power_changed_reason = reason;
|
||||
g_info ("Power Changed because of reason %d", reason);
|
||||
g_info ("Power Changed because of reason %s",
|
||||
ppd_power_changed_reason_to_str (reason));
|
||||
|
||||
for (guint i = 0; i < data->actions->len; i++) {
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
|
|
|||
|
|
@ -38,3 +38,12 @@ ppd_profile_has_single_flag (PpdProfile profile)
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char *
|
||||
ppd_power_changed_reason_to_str (PpdPowerChangedReason reason)
|
||||
{
|
||||
g_autoptr(GEnumClass) klass = g_type_class_ref (PPD_TYPE_POWER_CHANGED_REASON);
|
||||
GEnumValue *value = g_enum_get_value (klass, reason);
|
||||
const gchar *name = value ? value->value_nick : "";
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,3 +67,5 @@ typedef enum{
|
|||
const char *ppd_profile_to_str (PpdProfile profile);
|
||||
PpdProfile ppd_profile_from_str (const char *str);
|
||||
gboolean ppd_profile_has_single_flag (PpdProfile profile);
|
||||
|
||||
const char *ppd_power_changed_reason_to_str (PpdPowerChangedReason reason);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue