Commit 1e8e2367 authored by Richard Hughes's avatar Richard Hughes

trivial: DkpHistory -> UpHistory (no ABI or API break)

parent bc928f7a
......@@ -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);
......
......@@ -48,7 +48,7 @@ struct UpDevicePrivate
DBusGConnection *system_bus_connection;
DBusGProxy *system_bus_proxy;
UpDaemon *daemon;
DkpHistory *history;
UpHistory *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)
dkp_history_set_id (device->priv->history, id);
up_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 = dkp_history_get_profile_data (device->priv->history, TRUE);
array = up_history_get_profile_data (device->priv->history, TRUE);
else if (g_strcmp0 (type, "discharging") == 0)
array = dkp_history_get_profile_data (device->priv->history, FALSE);
array = up_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 DkpHistoryObj *obj;
const UpHistoryObj *obj;
GValue *value;
guint i;
DkpHistoryType type = DKP_HISTORY_TYPE_UNKNOWN;
UpHistoryType type = UP_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 = DKP_HISTORY_TYPE_RATE;
type = UP_HISTORY_TYPE_RATE;
else if (g_strcmp0 (type_string, "charge") == 0)
type = DKP_HISTORY_TYPE_CHARGE;
type = UP_HISTORY_TYPE_CHARGE;
else if (g_strcmp0 (type_string, "time-full") == 0)
type = DKP_HISTORY_TYPE_TIME_FULL;
type = UP_HISTORY_TYPE_TIME_FULL;
else if (g_strcmp0 (type_string, "time-empty") == 0)
type = DKP_HISTORY_TYPE_TIME_EMPTY;
type = UP_HISTORY_TYPE_TIME_EMPTY;
/* something recognised */
if (type != DKP_HISTORY_TYPE_UNKNOWN)
array = dkp_history_get_data (device->priv->history, type, timespan, resolution);
if (type != UP_HISTORY_TYPE_UNKNOWN)
array = up_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 DkpHistoryObj *) g_ptr_array_index (array, i);
obj = (const UpHistoryObj *) 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 */
dkp_history_set_state (device->priv->history, device->priv->state);
dkp_history_set_charge_data (device->priv->history, device->priv->percentage);
dkp_history_set_rate_data (device->priv->history, device->priv->energy_rate);
dkp_history_set_time_full_data (device->priv->history, device->priv->time_to_full);
dkp_history_set_time_empty_data (device->priv->history, device->priv->time_to_empty);
up_history_set_state (device->priv->history, device->priv->state);
up_history_set_charge_data (device->priv->history, device->priv->percentage);
up_history_set_rate_data (device->priv->history, device->priv->energy_rate);
up_history_set_time_full_data (device->priv->history, device->priv->time_to_full);
up_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 = dkp_history_new ();
device->priv->history = up_history_new ();
device->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (device->priv->system_bus_connection == NULL) {
......
This diff is collapsed.
......@@ -19,69 +19,69 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DKP_HISTORY_H
#define __DKP_HISTORY_H
#ifndef __UP_HISTORY_H
#define __UP_HISTORY_H
#include <glib-object.h>
#include <dkp-enum.h>
G_BEGIN_DECLS
#define DKP_TYPE_HISTORY (dkp_history_get_type ())
#define DKP_HISTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_HISTORY, DkpHistory))
#define DKP_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_HISTORY, DkpHistoryClass))
#define DKP_IS_HISTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DKP_TYPE_HISTORY))
#define DKP_IS_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DKP_TYPE_HISTORY))
#define DKP_HISTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_HISTORY, DkpHistoryClass))
#define DKP_HISTORY_ERROR (dkp_history_error_quark ())
#define DKP_HISTORY_TYPE_ERROR (dkp_history_error_get_type ())
#define UP_TYPE_HISTORY (up_history_get_type ())
#define UP_HISTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_HISTORY, UpHistory))
#define UP_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_HISTORY, UpHistoryClass))
#define UP_IS_HISTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_HISTORY))
#define UP_IS_HISTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_HISTORY))
#define UP_HISTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_HISTORY, UpHistoryClass))
#define UP_HISTORY_ERROR (up_history_error_quark ())
#define UP_HISTORY_TYPE_ERROR (up_history_error_get_type ())
typedef struct DkpHistoryPrivate DkpHistoryPrivate;
typedef struct UpHistoryPrivate UpHistoryPrivate;
typedef struct
{
GObject parent;
DkpHistoryPrivate *priv;
} DkpHistory;
UpHistoryPrivate *priv;
} UpHistory;
typedef struct
{
GObjectClass parent_class;
} DkpHistoryClass;
} UpHistoryClass;
typedef enum {
DKP_HISTORY_TYPE_CHARGE,
DKP_HISTORY_TYPE_RATE,
DKP_HISTORY_TYPE_TIME_FULL,
DKP_HISTORY_TYPE_TIME_EMPTY,
DKP_HISTORY_TYPE_UNKNOWN
} DkpHistoryType;
UP_HISTORY_TYPE_CHARGE,
UP_HISTORY_TYPE_RATE,
UP_HISTORY_TYPE_TIME_FULL,
UP_HISTORY_TYPE_TIME_EMPTY,
UP_HISTORY_TYPE_UNKNOWN
} UpHistoryType;
GType dkp_history_get_type (void);
DkpHistory *dkp_history_new (void);
void dkp_history_test (gpointer user_data);
GType up_history_get_type (void);
UpHistory *up_history_new (void);
void up_history_test (gpointer user_data);
GPtrArray *dkp_history_get_data (DkpHistory *history,
DkpHistoryType type,
GPtrArray *up_history_get_data (UpHistory *history,
UpHistoryType type,
guint timespan,
guint resolution);
GPtrArray *dkp_history_get_profile_data (DkpHistory *history,
GPtrArray *up_history_get_profile_data (UpHistory *history,
gboolean charging);
gboolean dkp_history_set_id (DkpHistory *history,
gboolean up_history_set_id (UpHistory *history,
const gchar *id);
gboolean dkp_history_set_state (DkpHistory *history,
gboolean up_history_set_state (UpHistory *history,
UpDeviceState state);
gboolean dkp_history_set_charge_data (DkpHistory *history,
gboolean up_history_set_charge_data (UpHistory *history,
gdouble percentage);
gboolean dkp_history_set_rate_data (DkpHistory *history,
gboolean up_history_set_rate_data (UpHistory *history,
gdouble rate);
gboolean dkp_history_set_time_full_data (DkpHistory *history,
gboolean up_history_set_time_full_data (UpHistory *history,
gint64 time);
gboolean dkp_history_set_time_empty_data (DkpHistory *history,
gboolean up_history_set_time_empty_data (UpHistory *history,
gint64 time);
G_END_DECLS
#endif /* __DKP_HISTORY_H */
#endif /* __UP_HISTORY_H */
......@@ -48,7 +48,7 @@ main (int argc, char **argv)
up_backend_test (test);
up_device_test (test);
up_device_list_test (test);
dkp_history_test (test);
up_history_test (test);
up_native_test (test);
up_polkit_test (test);
dkp_qos_test (test);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment