GCC Code Coverage Report


Directory: ./
File: src/ppd-action.h
Date: 2025-03-30 20:28:01
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 11 15 73.3%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2020 Bastien Nocera <hadess@hadess.net>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3 as published by
6 * the Free Software Foundation.
7 *
8 */
9
10 #pragma once
11
12 #include <glib-object.h>
13 #include "ppd-profile.h"
14
15 #define PPD_TYPE_ACTION (ppd_action_get_type ())
16
11/15
✓ Branch 0 taken 163 times.
✓ Branch 1 taken 334 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 522 times.
✓ Branch 4 taken 306 times.
✓ Branch 5 taken 474 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 628 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 8749 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 8749 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 8749 times.
✗ Branch 14 not taken.
10708 G_DECLARE_DERIVABLE_TYPE (PpdAction, ppd_action, PPD, ACTION, GObject)
17
18 /**
19 * PpdActionClass:
20 * @parent_class: The parent class.
21 * @probe: Called by the daemon on startup.
22 * @activate_profile: Called by the daemon when the profile changes.
23 * @power_changed: Called by the daemon when the power source changes.
24 * @battery_changed: Called by the daemon when the battery level changes.
25 *
26 * New profile actions should derive from #PpdAction and implement
27 * at least @activate_profile.
28 */
29 struct _PpdActionClass
30 {
31 GObjectClass parent_class;
32
33 PpdProbeResult (* probe) (PpdAction *action);
34 gboolean (* activate_profile) (PpdAction *action,
35 PpdProfile profile,
36 GError **error);
37 gboolean (* power_changed) (PpdAction *action,
38 PpdPowerChangedReason reason,
39 GError **error);
40 gboolean (* battery_changed) (PpdAction *action,
41 gdouble val,
42 GError **error);
43
44 };
45
46 #ifndef __GTK_DOC_IGNORE__
47 PpdProbeResult ppd_action_probe (PpdAction *action);
48 gboolean ppd_action_activate_profile (PpdAction *action, PpdProfile profile, GError **error);
49 gboolean ppd_action_power_changed (PpdAction *action, PpdPowerChangedReason reason, GError **error);
50 gboolean ppd_action_battery_changed (PpdAction *action, gdouble val, GError **error);
51 const char *ppd_action_get_action_name (PpdAction *action);
52 const char *ppd_action_get_action_description (PpdAction *action);
53 void ppd_action_set_active (PpdAction *action,
54 gboolean active);
55 gboolean ppd_action_get_active (PpdAction *action);
56 gboolean ppd_action_get_optin (PpdAction *action);
57 #endif
58