Commit 9b7ce3de authored by Christian Kellner's avatar Christian Kellner

Replace use of G_TYPE_INSTANCE_GET_PRIVATE

G_TYPE_INSTANCE_GET_PRIVATE has been deprecated since glib version
2.58 and should be replaced with the xxx_get_instance_private (obj)
which is generated by G_ADD_PRIVATE.
parent 8da188b3
Pipeline #20461 passed with stage
in 5 minutes and 43 seconds
......@@ -43,8 +43,6 @@ static void up_client_initable_iface_init (GInitableIface *iface);
static void up_client_init (UpClient *client);
static void up_client_finalize (GObject *object);
#define UP_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_CLIENT, UpClientPrivate))
/**
* UpClientPrivate:
*
......@@ -462,7 +460,7 @@ static gboolean
up_client_initable_init (GInitable *initable, GCancellable *cancellable, GError **error)
{
UpClient *client = UP_CLIENT (initable);
client->priv = UP_CLIENT_GET_PRIVATE (client);
client->priv = up_client_get_instance_private (client);
/* connect to main interface */
client->priv->proxy = up_exported_daemon_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
......
......@@ -44,8 +44,6 @@ static void up_device_class_init (UpDeviceClass *klass);
static void up_device_init (UpDevice *device);
static void up_device_finalize (GObject *object);
#define UP_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE, UpDevicePrivate))
/**
* UpDevicePrivate:
*
......@@ -1217,7 +1215,7 @@ value_free (GValue *value)
static void
up_device_init (UpDevice *device)
{
device->priv = UP_DEVICE_GET_PRIVATE (device);
device->priv = up_device_get_instance_private (device);
device->priv->offline_props = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
......
......@@ -39,8 +39,6 @@ static void up_history_item_class_init (UpHistoryItemClass *klass);
static void up_history_item_init (UpHistoryItem *history_item);
static void up_history_item_finalize (GObject *object);
#define UP_HISTORY_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_HISTORY_ITEM, UpHistoryItemPrivate))
struct UpHistoryItemPrivate
{
gdouble value;
......@@ -329,7 +327,7 @@ up_history_item_class_init (UpHistoryItemClass *klass)
static void
up_history_item_init (UpHistoryItem *history_item)
{
history_item->priv = UP_HISTORY_ITEM_GET_PRIVATE (history_item);
history_item->priv = up_history_item_get_instance_private (history_item);
}
/**
......
......@@ -38,8 +38,6 @@ static void up_stats_item_class_init (UpStatsItemClass *klass);
static void up_stats_item_init (UpStatsItem *stats_item);
static void up_stats_item_finalize (GObject *object);
#define UP_STATS_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_STATS_ITEM, UpStatsItemPrivate))
struct UpStatsItemPrivate
{
gdouble value;
......@@ -202,7 +200,7 @@ up_stats_item_class_init (UpStatsItemClass *klass)
static void
up_stats_item_init (UpStatsItem *stats_item)
{
stats_item->priv = UP_STATS_ITEM_GET_PRIVATE (stats_item);
stats_item->priv = up_stats_item_get_instance_private (stats_item);
}
/**
......
......@@ -38,8 +38,6 @@ static void up_wakeup_item_class_init (UpWakeupItemClass *klass);
static void up_wakeup_item_init (UpWakeupItem *wakeup_item);
static void up_wakeup_item_finalize (GObject *object);
#define UP_WAKEUP_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_WAKEUP_ITEM, UpWakeupItemPrivate))
struct UpWakeupItemPrivate
{
gboolean is_userspace;
......@@ -418,7 +416,7 @@ up_wakeup_item_class_init (UpWakeupItemClass *klass)
static void
up_wakeup_item_init (UpWakeupItem *wakeup_item)
{
wakeup_item->priv = UP_WAKEUP_ITEM_GET_PRIVATE (wakeup_item);
wakeup_item->priv = up_wakeup_item_get_instance_private (wakeup_item);
}
/**
......
......@@ -32,8 +32,6 @@ static void up_wakeups_class_init (UpWakeupsClass *klass);
static void up_wakeups_init (UpWakeups *wakeups);
static void up_wakeups_finalize (GObject *object);
#define UP_WAKEUPS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_WAKEUPS, UpWakeupsPrivate))
struct UpWakeupsPrivate
{
UpExportedWakeups *proxy;
......@@ -243,7 +241,7 @@ up_wakeups_init (UpWakeups *wakeups)
{
GError *error = NULL;
wakeups->priv = UP_WAKEUPS_GET_PRIVATE (wakeups);
wakeups->priv = up_wakeups_get_instance_private (wakeups);
/* connect to main interface */
wakeups->priv->proxy = up_exported_wakeups_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
......
......@@ -35,8 +35,6 @@ static void up_backend_class_init (UpBackendClass *klass);
static void up_backend_init (UpBackend *backend);
static void up_backend_finalize (GObject *object);
#define UP_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_BACKEND, UpBackendPrivate))
struct UpBackendPrivate
{
UpDaemon *daemon;
......@@ -202,7 +200,7 @@ up_backend_class_init (UpBackendClass *klass)
static void
up_backend_init (UpBackend *backend)
{
backend->priv = UP_BACKEND_GET_PRIVATE (backend);
backend->priv = up_backend_get_instance_private (backend);
backend->priv->daemon = NULL;
backend->priv->device_list = NULL;
#ifdef EGG_TEST
......
......@@ -54,8 +54,6 @@ static gboolean up_backend_acpi_devd_notify (UpBackend *backend, const gchar *sy
static gboolean up_backend_create_new_device (UpBackend *backend, UpAcpiNative *native);
static void up_backend_lid_coldplug (UpBackend *backend);
#define UP_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_BACKEND, UpBackendPrivate))
struct UpBackendPrivate
{
UpDaemon *daemon;
......@@ -412,7 +410,7 @@ up_backend_class_init (UpBackendClass *klass)
static void
up_backend_init (UpBackend *backend)
{
backend->priv = UP_BACKEND_GET_PRIVATE (backend);
backend->priv = up_backend_get_instance_private (backend);
backend->priv->handle_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref);
backend->priv->config = up_config_new ();
backend->priv->seat_manager_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
......
......@@ -164,7 +164,6 @@ typedef struct {
} HidppDeviceMap;
G_DEFINE_TYPE_WITH_PRIVATE (HidppDevice, hidpp_device, G_TYPE_OBJECT)
#define HIDPP_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), HIDPP_TYPE_DEVICE, HidppDevicePrivate))
/**
* hidpp_is_error:
......@@ -1033,7 +1032,7 @@ hidpp_device_init (HidppDevice *device)
{
HidppDeviceMap *map;
device->priv = HIDPP_DEVICE_GET_PRIVATE (device);
device->priv = hidpp_device_get_instance_private (device);
device->priv->fd = -1;
device->priv->feature_index = g_ptr_array_new_with_free_func (hidpp_device_free_feature);
device->priv->batt_status = HIDPP_DEVICE_BATT_STATUS_UNKNOWN;
......
......@@ -57,8 +57,6 @@ static void up_backend_finalize (GObject *object);
#define LOGIND_DBUS_PATH "/org/freedesktop/login1"
#define LOGIND_DBUS_INTERFACE "org.freedesktop.login1.Manager"
#define UP_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_BACKEND, UpBackendPrivate))
struct UpBackendPrivate
{
UpDaemon *daemon;
......@@ -813,7 +811,7 @@ up_backend_init (UpBackend *backend)
GDBusConnection *bus;
guint sleep_id;
backend->priv = UP_BACKEND_GET_PRIVATE (backend);
backend->priv = up_backend_get_instance_private (backend);
backend->priv->config = up_config_new ();
backend->priv->managed_devices = up_device_list_new ();
backend->priv->logind_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
......
......@@ -28,7 +28,6 @@
#include "up-device-bluez.h"
G_DEFINE_TYPE (UpDeviceBluez, up_device_bluez, UP_TYPE_DEVICE)
#define UP_DEVICE_BLUEZ_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_BLUEZ, UpDeviceBluezPrivate))
static UpDeviceKind
appearance_to_kind (guint16 appearance)
......
......@@ -61,7 +61,6 @@ struct UpDeviceCsrPrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDeviceCsr, up_device_csr, UP_TYPE_DEVICE)
#define UP_DEVICE_CSR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_CSR, UpDeviceCsrPrivate))
static gboolean up_device_csr_refresh (UpDevice *device);
......@@ -291,7 +290,7 @@ static void
up_device_csr_init (UpDeviceCsr *csr)
{
gint retval;
csr->priv = UP_DEVICE_CSR_GET_PRIVATE (csr);
csr->priv = up_device_csr_get_instance_private (csr);
csr->priv->raw_value = -1;
retval = libusb_init (&csr->priv->ctx);
......
......@@ -91,7 +91,6 @@ struct UpDeviceHidPrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDeviceHid, up_device_hid, UP_TYPE_DEVICE)
#define UP_DEVICE_HID_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_HID, UpDeviceHidPrivate))
static gboolean up_device_hid_refresh (UpDevice *device);
......@@ -470,7 +469,7 @@ up_device_hid_get_on_battery (UpDevice *device, gboolean *on_battery)
static void
up_device_hid_init (UpDeviceHid *hid)
{
hid->priv = UP_DEVICE_HID_GET_PRIVATE (hid);
hid->priv = up_device_hid_get_instance_private (hid);
hid->priv->fd = -1;
hid->priv->poll_timer_id = g_timeout_add_seconds (UP_DEVICE_HID_REFRESH_TIMEOUT,
(GSourceFunc) up_device_hid_poll, hid);
......
......@@ -49,7 +49,6 @@ struct UpDeviceIdevicePrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDeviceIdevice, up_device_idevice, UP_TYPE_DEVICE)
#define UP_DEVICE_IDEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_IDEVICE, UpDeviceIdevicePrivate))
static gboolean up_device_idevice_refresh (UpDevice *device);
......@@ -347,7 +346,7 @@ out:
static void
up_device_idevice_init (UpDeviceIdevice *idevice)
{
idevice->priv = UP_DEVICE_IDEVICE_GET_PRIVATE (idevice);
idevice->priv = up_device_idevice_get_instance_private (idevice);
}
/**
......
......@@ -71,7 +71,6 @@ struct UpDeviceSupplyPrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDeviceSupply, up_device_supply, UP_TYPE_DEVICE)
#define UP_DEVICE_SUPPLY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_SUPPLY, UpDeviceSupplyPrivate))
static gboolean up_device_supply_refresh (UpDevice *device);
static void up_device_supply_setup_unknown_poll (UpDevice *device,
......@@ -1221,7 +1220,7 @@ up_device_supply_init (UpDeviceSupply *supply)
{
UpConfig *config;
supply->priv = UP_DEVICE_SUPPLY_GET_PRIVATE (supply);
supply->priv = up_device_supply_get_instance_private (supply);
/* allocate the stats for the battery charging & discharging */
supply->priv->energy_old = g_new (gdouble, UP_DEVICE_SUPPLY_ENERGY_OLD_LENGTH);
......
......@@ -36,7 +36,6 @@ struct UpDeviceUnifyingPrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDeviceUnifying, up_device_unifying, UP_TYPE_DEVICE)
#define UP_DEVICE_UNIFYING_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_UNIFYING, UpDeviceUnifyingPrivate))
/**
* up_device_unifying_refresh:
......@@ -300,7 +299,7 @@ out:
static void
up_device_unifying_init (UpDeviceUnifying *unifying)
{
unifying->priv = UP_DEVICE_UNIFYING_GET_PRIVATE (unifying);
unifying->priv = up_device_unifying_get_instance_private (unifying);
}
/**
......
......@@ -73,7 +73,6 @@ struct UpDeviceWupPrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDeviceWup, up_device_wup, UP_TYPE_DEVICE)
#define UP_DEVICE_WUP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_WUP, UpDeviceWupPrivate))
static gboolean up_device_wup_refresh (UpDevice *device);
......@@ -420,7 +419,7 @@ out:
static void
up_device_wup_init (UpDeviceWup *wup)
{
wup->priv = UP_DEVICE_WUP_GET_PRIVATE (wup);
wup->priv = up_device_wup_get_instance_private (wup);
wup->priv->fd = -1;
wup->priv->poll_timer_id = g_timeout_add_seconds (UP_DEVICE_WUP_REFRESH_TIMEOUT,
(GSourceFunc) up_device_wup_poll_cb, wup);
......
......@@ -55,7 +55,6 @@ struct UpInputPrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpInput, up_input, G_TYPE_OBJECT)
#define UP_INPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_INPUT, UpInputPrivate))
/* we must use this kernel-compatible implementation */
#define BITS_PER_LONG (sizeof(long) * 8)
......@@ -267,7 +266,7 @@ out:
static void
up_input_init (UpInput *input)
{
input->priv = UP_INPUT_GET_PRIVATE (input);
input->priv = up_input_get_instance_private (input);
input->priv->eventfp = -1;
}
......
......@@ -39,8 +39,6 @@ static gboolean up_apm_device_get_on_battery (UpDevice *device, gboolean *on_ba
static gboolean up_apm_device_get_online (UpDevice *device, gboolean *online);
static gboolean up_apm_device_refresh (UpDevice *device);
#define UP_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_BACKEND, UpBackendPrivate))
struct UpBackendPrivate
{
UpDaemon *daemon;
......@@ -597,7 +595,7 @@ up_backend_init (UpBackend *backend)
UpDeviceClass *device_class;
gint64 current_time;
backend->priv = UP_BACKEND_GET_PRIVATE (backend);
backend->priv = up_backend_get_instance_private (backend);
backend->priv->is_laptop = up_native_is_laptop();
g_debug("is_laptop:%d",backend->priv->is_laptop);
if (backend->priv->is_laptop)
......
......@@ -28,8 +28,6 @@
static void up_config_finalize (GObject *object);
#define UP_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_CONFIG, UpConfigPrivate))
/**
* UpConfigPrivate:
*
......@@ -100,7 +98,7 @@ up_config_init (UpConfig *config)
GError *error = NULL;
gchar *filename;
config->priv = UP_CONFIG_GET_PRIVATE (config);
config->priv = up_config_get_instance_private (config);
config->priv->keyfile = g_key_file_new ();
filename = g_strdup (g_getenv ("UPOWER_CONF_FILE_NAME"));
......
......@@ -78,8 +78,6 @@ static gboolean up_daemon_get_on_ac_local (UpDaemon *daemon);
G_DEFINE_TYPE_WITH_PRIVATE (UpDaemon, up_daemon, UP_TYPE_EXPORTED_DAEMON_SKELETON)
#define UP_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DAEMON, UpDaemonPrivate))
#define UP_DAEMON_ACTION_DELAY 20 /* seconds */
#define UP_INTERFACE_PREFIX "org.freedesktop.UPower."
......@@ -1082,7 +1080,7 @@ policy_config_validate (UpDaemon *daemon)
static void
up_daemon_init (UpDaemon *daemon)
{
daemon->priv = UP_DAEMON_GET_PRIVATE (daemon);
daemon->priv = up_daemon_get_instance_private (daemon);
daemon->priv->config = up_config_new ();
daemon->priv->power_devices = up_device_list_new ();
daemon->priv->display_device = up_device_new ();
......
......@@ -30,8 +30,6 @@
static void up_device_list_finalize (GObject *object);
#define UP_DEVICE_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE_LIST, UpDeviceListPrivate))
struct UpDeviceListPrivate
{
GPtrArray *array;
......@@ -192,7 +190,7 @@ up_device_list_class_init (UpDeviceListClass *klass)
static void
up_device_list_init (UpDeviceList *list)
{
list->priv = UP_DEVICE_LIST_GET_PRIVATE (list);
list->priv = up_device_list_get_instance_private (list);
list->priv->array = g_ptr_array_new_with_free_func (g_object_unref);
list->priv->map_native_path_to_device = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
}
......
......@@ -45,7 +45,6 @@ struct UpDevicePrivate
};
G_DEFINE_TYPE_WITH_PRIVATE (UpDevice, up_device, UP_TYPE_EXPORTED_DEVICE_SKELETON)
#define UP_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE, UpDevicePrivate))
#define UP_DEVICES_DBUS_PATH "/org/freedesktop/UPower/devices"
......@@ -711,7 +710,7 @@ up_device_init (UpDevice *device)
{
UpExportedDevice *skeleton;
device->priv = UP_DEVICE_GET_PRIVATE (device);
device->priv = up_device_get_instance_private (device);
device->priv->history = up_history_new ();
skeleton = UP_EXPORTED_DEVICE (device);
......
......@@ -33,8 +33,6 @@
static void up_history_finalize (GObject *object);
#define UP_HISTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_HISTORY, UpHistoryPrivate))
#define UP_HISTORY_FILE_HEADER "PackageKit Profile"
#define UP_HISTORY_SAVE_INTERVAL (10*60) /* seconds */
#define UP_HISTORY_DEFAULT_MAX_DATA_AGE (7*24*60*60) /* seconds */
......@@ -883,7 +881,7 @@ up_history_class_init (UpHistoryClass *klass)
static void
up_history_init (UpHistory *history)
{
history->priv = UP_HISTORY_GET_PRIVATE (history);
history->priv = up_history_get_instance_private (history);
history->priv->data_rate = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
history->priv->data_charge = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
history->priv->data_time_full = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
......
......@@ -38,8 +38,6 @@
static void up_kbd_backlight_finalize (GObject *object);
#define UP_KBD_BACKLIGHT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_KBD_BACKLIGHT, UpKbdBacklightPrivate))
struct UpKbdBacklightPrivate
{
gint fd;
......@@ -320,7 +318,7 @@ out:
static void
up_kbd_backlight_init (UpKbdBacklight *kbd_backlight)
{
kbd_backlight->priv = UP_KBD_BACKLIGHT_GET_PRIVATE (kbd_backlight);
kbd_backlight->priv = up_kbd_backlight_get_instance_private (kbd_backlight);
g_signal_connect (kbd_backlight, "handle-get-brightness",
G_CALLBACK (up_kbd_backlight_get_brightness), kbd_backlight);
......@@ -342,7 +340,7 @@ up_kbd_backlight_finalize (GObject *object)
g_return_if_fail (UP_IS_KBD_BACKLIGHT (object));
kbd_backlight = UP_KBD_BACKLIGHT (object);
kbd_backlight->priv = UP_KBD_BACKLIGHT_GET_PRIVATE (kbd_backlight);
kbd_backlight->priv = up_kbd_backlight_get_instance_private (kbd_backlight);
if (kbd_backlight->priv->channel_hw_changed) {
g_io_channel_shutdown (kbd_backlight->priv->channel_hw_changed, FALSE, NULL);
......
......@@ -33,8 +33,6 @@
static void up_wakeups_finalize (GObject *object);
static gboolean up_wakeups_timerstats_enable (UpWakeups *wakeups);
#define UP_WAKEUPS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_WAKEUPS, UpWakeupsPrivate))
#define UP_WAKEUPS_POLL_INTERVAL_KERNEL 2 /* seconds */
#define UP_WAKEUPS_POLL_INTERVAL_USERSPACE 2 /* seconds */
#define UP_WAKEUPS_DISABLE_INTERVAL 30 /* seconds */
......@@ -664,7 +662,7 @@ up_wakeups_class_init (UpWakeupsClass *klass)
static void
up_wakeups_init (UpWakeups *wakeups)
{
wakeups->priv = UP_WAKEUPS_GET_PRIVATE (wakeups);
wakeups->priv = up_wakeups_get_instance_private (wakeups);
wakeups->priv->data = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
/* test if we have an interface */
......@@ -691,7 +689,7 @@ up_wakeups_finalize (GObject *object)
g_return_if_fail (UP_IS_WAKEUPS (object));
wakeups = UP_WAKEUPS (object);
wakeups->priv = UP_WAKEUPS_GET_PRIVATE (wakeups);
wakeups->priv = up_wakeups_get_instance_private (wakeups);
/* stop timerstats */
up_wakeups_timerstats_disable (wakeups);
......
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