Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
upower
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
75
Issues
75
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
upower
upower
Commits
1e8e2367
Commit
1e8e2367
authored
Jan 18, 2010
by
Richard Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trivial: DkpHistory -> UpHistory (no ABI or API break)
parent
bc928f7a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
218 additions
and
209 deletions
+218
-209
devkit-power-gobject/dkp-history-obj.h
devkit-power-gobject/dkp-history-obj.h
+9
-0
src/up-device.c
src/up-device.c
+19
-19
src/up-history.c
src/up-history.c
+156
-156
src/up-history.h
src/up-history.h
+33
-33
src/up-self-test.c
src/up-self-test.c
+1
-1
No files found.
devkit-power-gobject/dkp-history-obj.h
View file @
1e8e2367
...
...
@@ -37,6 +37,15 @@ typedef struct
DkpDeviceState
state
;
}
DkpHistoryObj
;
/* compat */
typedef
DkpHistoryObj
UpHistoryObj
;
#define up_history_obj_new dkp_history_obj_new
#define up_history_obj_create dkp_history_obj_create
#define up_history_obj_copy dkp_history_obj_copy
#define up_history_obj_free dkp_history_obj_free
#define up_history_obj_from_string dkp_history_obj_from_string
#define up_history_obj_to_string dkp_history_obj_to_string
DkpHistoryObj
*
dkp_history_obj_new
(
void
);
gboolean
dkp_history_obj_clear
(
DkpHistoryObj
*
obj
);
void
dkp_history_obj_free
(
DkpHistoryObj
*
obj
);
...
...
src/up-device.c
View file @
1e8e2367
...
...
@@ -48,7 +48,7 @@ struct UpDevicePrivate
DBusGConnection
*
system_bus_connection
;
DBusGProxy
*
system_bus_proxy
;
UpDaemon
*
daemon
;
Dk
pHistory
*
history
;
U
pHistory
*
history
;
GObject
*
native
;
gboolean
has_ever_refresh
;
gboolean
during_coldplug
;
...
...
@@ -576,7 +576,7 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native)
/* get the id so we can load the old history */
id
=
up_device_get_id
(
device
);
if
(
id
!=
NULL
)
dk
p_history_set_id
(
device
->
priv
->
history
,
id
);
u
p_history_set_id
(
device
->
priv
->
history
,
id
);
out:
/* start signals and callbacks */
...
...
@@ -612,9 +612,9 @@ up_device_get_statistics (UpDevice *device, const gchar *type, DBusGMethodInvoca
/* get the correct data */
if
(
g_strcmp0
(
type
,
"charging"
)
==
0
)
array
=
dk
p_history_get_profile_data
(
device
->
priv
->
history
,
TRUE
);
array
=
u
p_history_get_profile_data
(
device
->
priv
->
history
,
TRUE
);
else
if
(
g_strcmp0
(
type
,
"discharging"
)
==
0
)
array
=
dk
p_history_get_profile_data
(
device
->
priv
->
history
,
FALSE
);
array
=
u
p_history_get_profile_data
(
device
->
priv
->
history
,
FALSE
);
/* maybe the device doesn't support histories */
if
(
array
==
NULL
)
{
...
...
@@ -658,10 +658,10 @@ up_device_get_history (UpDevice *device, const gchar *type_string, guint timespa
GError
*
error
;
GPtrArray
*
array
=
NULL
;
GPtrArray
*
complex
;
const
Dk
pHistoryObj
*
obj
;
const
U
pHistoryObj
*
obj
;
GValue
*
value
;
guint
i
;
DkpHistoryType
type
=
DK
P_HISTORY_TYPE_UNKNOWN
;
UpHistoryType
type
=
U
P_HISTORY_TYPE_UNKNOWN
;
g_return_val_if_fail
(
UP_IS_DEVICE
(
device
),
FALSE
);
g_return_val_if_fail
(
type_string
!=
NULL
,
FALSE
);
...
...
@@ -675,17 +675,17 @@ up_device_get_history (UpDevice *device, const gchar *type_string, guint timespa
/* get the correct data */
if
(
g_strcmp0
(
type_string
,
"rate"
)
==
0
)
type
=
DK
P_HISTORY_TYPE_RATE
;
type
=
U
P_HISTORY_TYPE_RATE
;
else
if
(
g_strcmp0
(
type_string
,
"charge"
)
==
0
)
type
=
DK
P_HISTORY_TYPE_CHARGE
;
type
=
U
P_HISTORY_TYPE_CHARGE
;
else
if
(
g_strcmp0
(
type_string
,
"time-full"
)
==
0
)
type
=
DK
P_HISTORY_TYPE_TIME_FULL
;
type
=
U
P_HISTORY_TYPE_TIME_FULL
;
else
if
(
g_strcmp0
(
type_string
,
"time-empty"
)
==
0
)
type
=
DK
P_HISTORY_TYPE_TIME_EMPTY
;
type
=
U
P_HISTORY_TYPE_TIME_EMPTY
;
/* something recognised */
if
(
type
!=
DK
P_HISTORY_TYPE_UNKNOWN
)
array
=
dk
p_history_get_data
(
device
->
priv
->
history
,
type
,
timespan
,
resolution
);
if
(
type
!=
U
P_HISTORY_TYPE_UNKNOWN
)
array
=
u
p_history_get_data
(
device
->
priv
->
history
,
type
,
timespan
,
resolution
);
/* maybe the device doesn't have any history */
if
(
array
==
NULL
)
{
...
...
@@ -697,7 +697,7 @@ up_device_get_history (UpDevice *device, const gchar *type_string, guint timespa
/* copy data to dbus struct */
complex
=
g_ptr_array_sized_new
(
array
->
len
);
for
(
i
=
0
;
i
<
array
->
len
;
i
++
)
{
obj
=
(
const
Dk
pHistoryObj
*
)
g_ptr_array_index
(
array
,
i
);
obj
=
(
const
U
pHistoryObj
*
)
g_ptr_array_index
(
array
,
i
);
value
=
g_new0
(
GValue
,
1
);
g_value_init
(
value
,
DKP_DBUS_STRUCT_UINT_DOUBLE_UINT
);
g_value_take_boxed
(
value
,
dbus_g_type_specialized_construct
(
DKP_DBUS_STRUCT_UINT_DOUBLE_UINT
));
...
...
@@ -851,11 +851,11 @@ up_device_perhaps_changed_cb (GObject *object, GParamSpec *pspec, UpDevice *devi
return
;
/* save new history */
dk
p_history_set_state
(
device
->
priv
->
history
,
device
->
priv
->
state
);
dk
p_history_set_charge_data
(
device
->
priv
->
history
,
device
->
priv
->
percentage
);
dk
p_history_set_rate_data
(
device
->
priv
->
history
,
device
->
priv
->
energy_rate
);
dk
p_history_set_time_full_data
(
device
->
priv
->
history
,
device
->
priv
->
time_to_full
);
dk
p_history_set_time_empty_data
(
device
->
priv
->
history
,
device
->
priv
->
time_to_empty
);
u
p_history_set_state
(
device
->
priv
->
history
,
device
->
priv
->
state
);
u
p_history_set_charge_data
(
device
->
priv
->
history
,
device
->
priv
->
percentage
);
u
p_history_set_rate_data
(
device
->
priv
->
history
,
device
->
priv
->
energy_rate
);
u
p_history_set_time_full_data
(
device
->
priv
->
history
,
device
->
priv
->
time_to_full
);
u
p_history_set_time_empty_data
(
device
->
priv
->
history
,
device
->
priv
->
time_to_empty
);
/* The order here matters; we want Device::Changed() before
* the DeviceChanged() signal on the main object */
...
...
@@ -879,7 +879,7 @@ up_device_init (UpDevice *device)
device
->
priv
->
native
=
NULL
;
device
->
priv
->
has_ever_refresh
=
FALSE
;
device
->
priv
->
during_coldplug
=
FALSE
;
device
->
priv
->
history
=
dk
p_history_new
();
device
->
priv
->
history
=
u
p_history_new
();
device
->
priv
->
system_bus_connection
=
dbus_g_bus_get
(
DBUS_BUS_SYSTEM
,
&
error
);
if
(
device
->
priv
->
system_bus_connection
==
NULL
)
{
...
...
src/up-history.c
View file @
1e8e2367
This diff is collapsed.
Click to expand it.
src/up-history.h
View file @
1e8e2367
...
...
@@ -19,69 +19,69 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __
DK
P_HISTORY_H
#define __
DK
P_HISTORY_H
#ifndef __
U
P_HISTORY_H
#define __
U
P_HISTORY_H
#include <glib-object.h>
#include <dkp-enum.h>
G_BEGIN_DECLS
#define
DKP_TYPE_HISTORY (dk
p_history_get_type ())
#define
DKP_HISTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_HISTORY, Dk
pHistory))
#define
DKP_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_HISTORY, Dk
pHistoryClass))
#define
DKP_IS_HISTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DK
P_TYPE_HISTORY))
#define
DKP_IS_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DK
P_TYPE_HISTORY))
#define
DKP_HISTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_HISTORY, Dk
pHistoryClass))
#define
DKP_HISTORY_ERROR (dk
p_history_error_quark ())
#define
DKP_HISTORY_TYPE_ERROR (dk
p_history_error_get_type ())
#define
UP_TYPE_HISTORY (u
p_history_get_type ())
#define
UP_HISTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_HISTORY, U
pHistory))
#define
UP_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_HISTORY, U
pHistoryClass))
#define
UP_IS_HISTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), U
P_TYPE_HISTORY))
#define
UP_IS_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), U
P_TYPE_HISTORY))
#define
UP_HISTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_HISTORY, U
pHistoryClass))
#define
UP_HISTORY_ERROR (u
p_history_error_quark ())
#define
UP_HISTORY_TYPE_ERROR (u
p_history_error_get_type ())
typedef
struct
DkpHistoryPrivate
Dk
pHistoryPrivate
;
typedef
struct
UpHistoryPrivate
U
pHistoryPrivate
;
typedef
struct
{
GObject
parent
;
Dk
pHistoryPrivate
*
priv
;
}
Dk
pHistory
;
U
pHistoryPrivate
*
priv
;
}
U
pHistory
;
typedef
struct
{
GObjectClass
parent_class
;
}
Dk
pHistoryClass
;
}
U
pHistoryClass
;
typedef
enum
{
DK
P_HISTORY_TYPE_CHARGE
,
DK
P_HISTORY_TYPE_RATE
,
DK
P_HISTORY_TYPE_TIME_FULL
,
DK
P_HISTORY_TYPE_TIME_EMPTY
,
DK
P_HISTORY_TYPE_UNKNOWN
}
Dk
pHistoryType
;
U
P_HISTORY_TYPE_CHARGE
,
U
P_HISTORY_TYPE_RATE
,
U
P_HISTORY_TYPE_TIME_FULL
,
U
P_HISTORY_TYPE_TIME_EMPTY
,
U
P_HISTORY_TYPE_UNKNOWN
}
U
pHistoryType
;
GType
dk
p_history_get_type
(
void
);
DkpHistory
*
dk
p_history_new
(
void
);
void
dk
p_history_test
(
gpointer
user_data
);
GType
u
p_history_get_type
(
void
);
UpHistory
*
u
p_history_new
(
void
);
void
u
p_history_test
(
gpointer
user_data
);
GPtrArray
*
dkp_history_get_data
(
Dk
pHistory
*
history
,
Dk
pHistoryType
type
,
GPtrArray
*
up_history_get_data
(
U
pHistory
*
history
,
U
pHistoryType
type
,
guint
timespan
,
guint
resolution
);
GPtrArray
*
dkp_history_get_profile_data
(
Dk
pHistory
*
history
,
GPtrArray
*
up_history_get_profile_data
(
U
pHistory
*
history
,
gboolean
charging
);
gboolean
dkp_history_set_id
(
Dk
pHistory
*
history
,
gboolean
up_history_set_id
(
U
pHistory
*
history
,
const
gchar
*
id
);
gboolean
dkp_history_set_state
(
Dk
pHistory
*
history
,
gboolean
up_history_set_state
(
U
pHistory
*
history
,
UpDeviceState
state
);
gboolean
dkp_history_set_charge_data
(
Dk
pHistory
*
history
,
gboolean
up_history_set_charge_data
(
U
pHistory
*
history
,
gdouble
percentage
);
gboolean
dkp_history_set_rate_data
(
Dk
pHistory
*
history
,
gboolean
up_history_set_rate_data
(
U
pHistory
*
history
,
gdouble
rate
);
gboolean
dkp_history_set_time_full_data
(
Dk
pHistory
*
history
,
gboolean
up_history_set_time_full_data
(
U
pHistory
*
history
,
gint64
time
);
gboolean
dkp_history_set_time_empty_data
(
Dk
pHistory
*
history
,
gboolean
up_history_set_time_empty_data
(
U
pHistory
*
history
,
gint64
time
);
G_END_DECLS
#endif
/* __
DK
P_HISTORY_H */
#endif
/* __
U
P_HISTORY_H */
src/up-self-test.c
View file @
1e8e2367
...
...
@@ -48,7 +48,7 @@ main (int argc, char **argv)
up_backend_test
(
test
);
up_device_test
(
test
);
up_device_list_test
(
test
);
dk
p_history_test
(
test
);
u
p_history_test
(
test
);
up_native_test
(
test
);
up_polkit_test
(
test
);
dkp_qos_test
(
test
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment