本文整理汇总了C++中egg_warning函数的典型用法代码示例。如果您正苦于以下问题:C++ egg_warning函数的具体用法?C++ egg_warning怎么用?C++ egg_warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了egg_warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gpm_phone_num_batteries_changed
/** Invoked when we get NumberBatteriesChanged
*/
static void
gpm_phone_num_batteries_changed (DBusGProxy *proxy, guint number, GpmPhone *phone)
{
g_return_if_fail (GPM_IS_PHONE (phone));
egg_debug ("got NumberBatteriesChanged %i", number);
if (number > 1) {
egg_warning ("number not 0 or 1, not valid!");
return;
}
/* are we removed? */
if (number == 0) {
phone->priv->present = FALSE;
phone->priv->percentage = 0;
phone->priv->onac = FALSE;
egg_debug ("emitting device-removed : (%i)", 0);
g_signal_emit (phone, signals [DEVICE_REMOVED], 0, 0);
return;
}
if (phone->priv->present) {
egg_warning ("duplicate NumberBatteriesChanged with no change");
return;
}
/* reset to defaults until we get BatteryStateChanged */
phone->priv->present = TRUE;
phone->priv->percentage = 0;
phone->priv->onac = FALSE;
egg_debug ("emitting device-added : (%i)", 0);
g_signal_emit (phone, signals [DEVICE_ADDED], 0, 0);
}
开发者ID:mate-desktop,项目名称:mate-power-manager,代码行数:35,代码来源:gpm-phone.c
示例2: gpk_log_get_old_transactions_cb
/**
* gpk_log_get_old_transactions_cb
**/
static void
gpk_log_get_old_transactions_cb (GObject *object, GAsyncResult *res, gpointer user_data)
{
// PkClient *client = PK_CLIENT (object);
GError *error = NULL;
PkResults *results = NULL;
PkError *error_code = NULL;
/* get the results */
results = pk_client_generic_finish (client, res, &error);
if (results == NULL) {
egg_warning ("failed to get old transactions: %s", error->message);
g_error_free (error);
goto out;
}
/* check error code */
error_code = pk_results_get_error_code (results);
if (error_code != NULL) {
egg_warning ("failed to get old transactions: %s, %s", pk_error_enum_to_text (pk_error_get_code (error_code)), pk_error_get_details (error_code));
goto out;
}
/* get the list */
if (transactions != NULL)
g_ptr_array_unref (transactions);
transactions = pk_results_get_transaction_array (results);
gpk_log_refilter ();
out:
if (error_code != NULL)
g_object_unref (error_code);
if (results != NULL)
g_object_unref (results);
}
开发者ID:meke,项目名称:gnome-packagekit-japanese,代码行数:37,代码来源:gpk-log.c
示例3: gpm_session_is_suspend_inhibited
/**
* gpm_session_is_suspend_inhibited:
**/
static gboolean
gpm_session_is_suspend_inhibited (GpmSession *session)
{
gboolean ret;
gboolean is_inhibited = FALSE;
GError *error = NULL;
/* no mate-session */
if (session->priv->proxy == NULL) {
egg_warning ("no mate-session");
goto out;
}
/* find out if this change altered the inhibited state */
ret = dbus_g_proxy_call (session->priv->proxy, "IsInhibited", &error,
G_TYPE_UINT, GPM_SESSION_INHIBIT_MASK_SUSPEND,
G_TYPE_INVALID,
G_TYPE_BOOLEAN, &is_inhibited,
G_TYPE_INVALID);
if (!ret) {
egg_warning ("failed to get inhibit status: %s", error->message);
g_error_free (error);
is_inhibited = FALSE;
}
out:
return is_inhibited;
}
开发者ID:SukkoPera,项目名称:mate-power-manager,代码行数:30,代码来源:gpm-session.c
示例4: up_devd_init
void
up_devd_init (UpBackend *backend)
{
int event_fd;
struct sockaddr_un addr;
event_fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (event_fd < 0) {
egg_warning("failed to create event socket: '%s'", g_strerror(errno));
up_devd_inited = FALSE;
return;
}
addr.sun_family = AF_UNIX;
strncpy (addr.sun_path, UP_DEVD_SOCK_PATH, sizeof(addr.sun_path));
if (connect (event_fd, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
GIOChannel *channel;
channel = g_io_channel_unix_new (event_fd);
g_io_add_watch (channel, G_IO_IN, up_devd_event_cb, backend);
g_io_channel_unref (channel);
up_devd_inited = TRUE;
} else {
egg_warning ("failed to connect to %s: '%s'", UP_DEVD_SOCK_PATH,
g_strerror(errno));
close (event_fd);
up_devd_inited = FALSE;
}
}
开发者ID:Kalvados,项目名称:upower,代码行数:29,代码来源:up-devd.c
示例5: gpm_networkmanager_wake
/**
* gpm_networkmanager_wake:
*
* Tell NetworkManager to wake up all the network devices
*
* Return value: TRUE if NetworkManager is now awake.
**/
gboolean
gpm_networkmanager_wake (void)
{
DBusGConnection *connection = NULL;
DBusGProxy *nm_proxy = NULL;
GError *error = NULL;
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (error) {
egg_warning ("%s", error->message);
g_error_free (error);
return FALSE;
}
nm_proxy = dbus_g_proxy_new_for_name (connection,
NM_LISTENER_SERVICE,
NM_LISTENER_PATH,
NM_LISTENER_INTERFACE);
if (!nm_proxy) {
egg_warning ("Failed to get name owner");
return FALSE;
}
dbus_g_proxy_call_no_reply (nm_proxy, "wake", G_TYPE_INVALID);
g_object_unref (G_OBJECT (nm_proxy));
return TRUE;
}
开发者ID:dnk,项目名称:mate-power-manager,代码行数:33,代码来源:gpm-networkmanager.c
示例6: gpm_session_is_idle
/**
* gpm_session_is_idle:
**/
static gboolean
gpm_session_is_idle (GpmSession *session)
{
gboolean ret;
gboolean is_idle = FALSE;
GError *error = NULL;
GValue *value;
/* no mate-session */
if (session->priv->proxy_prop == NULL) {
egg_warning ("no mate-session");
goto out;
}
value = g_new0(GValue, 1);
/* find out if this change altered the inhibited state */
ret = dbus_g_proxy_call (session->priv->proxy_prop, "Get", &error,
G_TYPE_STRING, GPM_SESSION_MANAGER_PRESENCE_INTERFACE,
G_TYPE_STRING, "status",
G_TYPE_INVALID,
G_TYPE_VALUE, value,
G_TYPE_INVALID);
if (!ret) {
egg_warning ("failed to get idle status: %s", error->message);
g_error_free (error);
is_idle = FALSE;
goto out;
}
is_idle = (g_value_get_uint (value) == GPM_SESSION_STATUS_ENUM_IDLE);
g_free (value);
out:
return is_idle;
}
开发者ID:SukkoPera,项目名称:mate-power-manager,代码行数:36,代码来源:gpm-session.c
示例7: gpm_inhibit_applet_dbus_connect
/**
* gpm_inhibit_applet_dbus_connect:
**/
gboolean
gpm_inhibit_applet_dbus_connect (GpmInhibitApplet *applet)
{
GError *error = NULL;
if (applet->connection == NULL) {
egg_debug ("get connection\n");
g_clear_error (&error);
applet->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (error != NULL) {
egg_warning ("Could not connect to DBUS daemon: %s", error->message);
g_error_free (error);
applet->connection = NULL;
return FALSE;
}
}
if (applet->proxy == NULL) {
egg_debug ("get proxy\n");
g_clear_error (&error);
applet->proxy = dbus_g_proxy_new_for_name_owner (applet->connection,
GS_DBUS_SERVICE,
GS_DBUS_PATH,
GS_DBUS_INTERFACE,
&error);
if (error != NULL) {
egg_warning ("Cannot connect, maybe the daemon is not running: %s\n", error->message);
g_error_free (error);
applet->proxy = NULL;
return FALSE;
}
}
return TRUE;
}
开发者ID:hamonikr-root,项目名称:mate-power-manager,代码行数:36,代码来源:inhibit-applet.c
示例8: gpm_applet_set_brightness
/**
* gpm_applet_set_brightness:
* Return value: Success value, or zero for failure
**/
static gboolean
gpm_applet_set_brightness (GpmBrightnessApplet *applet)
{
GError *error = NULL;
gboolean ret;
if (applet->proxy == NULL) {
egg_warning ("not connected");
return FALSE;
}
ret = dbus_g_proxy_call (applet->proxy, "SetBrightness", &error,
G_TYPE_UINT, applet->level,
G_TYPE_INVALID,
G_TYPE_INVALID);
if (error) {
egg_debug ("ERROR: %s", error->message);
g_error_free (error);
}
if (!ret) {
/* abort as the DBUS method failed */
egg_warning ("SetBrightness failed!");
}
return ret;
}
开发者ID:hamonikr-root,项目名称:mate-power-manager,代码行数:30,代码来源:brightness-applet.c
示例9: gpm_applet_get_brightness
/**
* gpm_applet_get_brightness:
* Return value: Success value, or zero for failure
**/
static gboolean
gpm_applet_get_brightness (GpmBrightnessApplet *applet)
{
GError *error = NULL;
gboolean ret;
guint policy_brightness;
if (applet->proxy == NULL) {
egg_warning ("not connected\n");
return FALSE;
}
ret = dbus_g_proxy_call (applet->proxy, "GetBrightness", &error,
G_TYPE_INVALID,
G_TYPE_UINT, &policy_brightness,
G_TYPE_INVALID);
if (error) {
egg_debug ("ERROR: %s\n", error->message);
g_error_free (error);
}
if (ret) {
applet->level = policy_brightness;
} else {
/* abort as the DBUS method failed */
egg_warning ("GetBrightness failed!\n");
}
return ret;
}
开发者ID:hamonikr-root,项目名称:mate-power-manager,代码行数:33,代码来源:brightness-applet.c
示例10: gpm_session_end_session_response
/**
* gpm_session_end_session_response:
**/
gboolean
gpm_session_end_session_response (GpmSession *session, gboolean is_okay, const gchar *reason)
{
gboolean ret = FALSE;
GError *error = NULL;
g_return_val_if_fail (GPM_IS_SESSION (session), FALSE);
g_return_val_if_fail (session->priv->proxy_client_private != NULL, FALSE);
/* no mate-session */
if (session->priv->proxy_client_private == NULL) {
egg_warning ("no mate-session proxy");
goto out;
}
/* send response */
ret = dbus_g_proxy_call (session->priv->proxy_client_private, "EndSessionResponse", &error,
G_TYPE_BOOLEAN, is_okay,
G_TYPE_STRING, reason,
G_TYPE_INVALID,
G_TYPE_INVALID);
if (!ret) {
egg_warning ("failed to send session response: %s", error->message);
g_error_free (error);
goto out;
}
out:
return ret;
}
开发者ID:SukkoPera,项目名称:mate-power-manager,代码行数:32,代码来源:gpm-session.c
示例11: gpm_session_register_client
/**
* gpm_session_register_client:
**/
gboolean
gpm_session_register_client (GpmSession *session, const gchar *app_id, const gchar *client_startup_id)
{
gboolean ret = FALSE;
gchar *client_id = NULL;
GError *error = NULL;
DBusGConnection *connection;
g_return_val_if_fail (GPM_IS_SESSION (session), FALSE);
/* no mate-session */
if (session->priv->proxy == NULL) {
egg_warning ("no mate-session");
goto out;
}
/* find out if this change altered the inhibited state */
ret = dbus_g_proxy_call (session->priv->proxy, "RegisterClient", &error,
G_TYPE_STRING, app_id,
G_TYPE_STRING, client_startup_id,
G_TYPE_INVALID,
DBUS_TYPE_G_OBJECT_PATH, &client_id,
G_TYPE_INVALID);
if (!ret) {
egg_warning ("failed to register client '%s': %s", client_startup_id, error->message);
g_error_free (error);
goto out;
}
/* get org.mate.Session.ClientPrivate interface */
connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
session->priv->proxy_client_private = dbus_g_proxy_new_for_name_owner (connection, GPM_SESSION_MANAGER_SERVICE,
client_id, GPM_SESSION_MANAGER_CLIENT_PRIVATE_INTERFACE, &error);
if (session->priv->proxy_client_private == NULL) {
egg_warning ("DBUS error: %s", error->message);
g_error_free (error);
goto out;
}
/* get Stop */
dbus_g_proxy_add_signal (session->priv->proxy_client_private, "Stop", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "Stop", G_CALLBACK (gpm_session_stop_cb), session, NULL);
/* get QueryEndSession */
dbus_g_proxy_add_signal (session->priv->proxy_client_private, "QueryEndSession", G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "QueryEndSession", G_CALLBACK (gpm_session_query_end_session_cb), session, NULL);
/* get EndSession */
dbus_g_proxy_add_signal (session->priv->proxy_client_private, "EndSession", G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "EndSession", G_CALLBACK (gpm_session_end_session_cb), session, NULL);
egg_debug ("registered startup '%s' to client id '%s'", client_startup_id, client_id);
out:
g_free (client_id);
return ret;
}
开发者ID:SukkoPera,项目名称:mate-power-manager,代码行数:59,代码来源:gpm-session.c
示例12: gpm_phone_service_appeared_cb
/**
* gpm_phone_service_appeared_cb:
*/
static void
gpm_phone_service_appeared_cb (GDBusConnection *connection,
const gchar *name, const gchar *name_owner,
GpmPhone *phone)
{
GError *error = NULL;
g_return_if_fail (GPM_IS_PHONE (phone));
if (phone->priv->connection == NULL) {
egg_debug ("get connection");
g_clear_error (&error);
phone->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (error != NULL) {
egg_warning ("Could not connect to DBUS daemon: %s", error->message);
g_error_free (error);
phone->priv->connection = NULL;
return;
}
}
if (phone->priv->proxy == NULL) {
egg_debug ("get proxy");
g_clear_error (&error);
phone->priv->proxy = dbus_g_proxy_new_for_name_owner (phone->priv->connection,
MATE_PHONE_MANAGER_DBUS_SERVICE,
MATE_PHONE_MANAGER_DBUS_PATH,
MATE_PHONE_MANAGER_DBUS_INTERFACE,
&error);
if (error != NULL) {
egg_warning ("Cannot connect, maybe the daemon is not running: %s", error->message);
g_error_free (error);
phone->priv->proxy = NULL;
return;
}
/* complicated type. ick */
dbus_g_object_register_marshaller(gpm_marshal_VOID__UINT_UINT_BOOLEAN,
G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT,
G_TYPE_BOOLEAN, G_TYPE_INVALID);
/* get BatteryStateChanged */
dbus_g_proxy_add_signal (phone->priv->proxy, "BatteryStateChanged",
G_TYPE_UINT, G_TYPE_UINT, G_TYPE_BOOLEAN, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (phone->priv->proxy, "BatteryStateChanged",
G_CALLBACK (gpm_phone_battery_state_changed),
phone, NULL);
/* get NumberBatteriesChanged */
dbus_g_proxy_add_signal (phone->priv->proxy, "NumberBatteriesChanged",
G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (phone->priv->proxy, "NumberBatteriesChanged",
G_CALLBACK (gpm_phone_num_batteries_changed),
phone, NULL);
}
}
开发者ID:mate-desktop,项目名称:mate-power-manager,代码行数:59,代码来源:gpm-phone.c
示例13: mcm_utils_is_package_installed
/**
* mcm_utils_is_package_installed:
**/
gboolean
mcm_utils_is_package_installed (const gchar *package_name)
{
GDBusConnection *connection;
GVariant *args = NULL;
GVariant *response = NULL;
GError *error = NULL;
gboolean installed = TRUE;
g_return_val_if_fail (package_name != NULL, FALSE);
#ifndef MCM_USE_PACKAGEKIT
egg_warning ("cannot query %s: this package was not compiled with --enable-packagekit", package_name);
return TRUE;
#endif
/* get a session bus connection */
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection == NULL) {
/* TRANSLATORS: no DBus session bus */
g_print ("%s %s\n", _("Failed to connect to session bus:"), error->message);
g_error_free (error);
goto out;
}
/* execute sync method */
args = g_variant_new ("(ss)", package_name, "timeout=5");
response = g_dbus_connection_call_sync (connection,
PK_DBUS_SERVICE,
PK_DBUS_PATH,
PK_DBUS_INTERFACE_QUERY,
"IsInstalled",
args,
G_VARIANT_TYPE ("(b)"),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT, NULL, &error);
if (response == NULL) {
/* TRANSLATORS: the DBus method failed */
egg_warning ("%s %s\n", _("The request failed:"), error->message);
g_error_free (error);
goto out;
}
/* get value */
g_variant_get (response, "(b)", &installed);
out:
if (args != NULL)
g_variant_unref (args);
if (response != NULL)
g_variant_unref (response);
return installed;
}
开发者ID:torrid,项目名称:mate-color-manager,代码行数:55,代码来源:mcm-utils.c
示例14: pk_filter_bitfield_from_text
/**
* pk_filter_bitfield_from_text:
* @filters: the enumerated constant value, e.g. "available;~gui"
*
* Converts text representation to its enumerated type bitfield, or 0 for invalid
*
* Return value: The enumerated type values
**/
PkBitfield
pk_filter_bitfield_from_text (const gchar *filters)
{
PkBitfield filters_enum = 0;
gchar **split;
guint length;
guint i;
PkFilterEnum filter;
split = g_strsplit (filters, ";", 0);
if (split == NULL) {
egg_warning ("unable to split");
goto out;
}
length = g_strv_length (split);
for (i=0; i<length; i++) {
filter = pk_filter_enum_from_text (split[i]);
if (filter == PK_FILTER_ENUM_UNKNOWN) {
filters_enum = 0;
break;
}
filters_enum += pk_bitfield_value (filter);
}
out:
g_strfreev (split);
return filters_enum;
}
开发者ID:zodman,项目名称:PackageKit,代码行数:36,代码来源:pk-bitfield.c
示例15: pk_filter_bitfield_to_text
/**
* pk_filter_bitfield_to_text:
* @filters: The enumerated type values
*
* Converts a enumerated type bitfield to its text representation
*
* Return value: the enumerated constant value, e.g. "available;~gui"
**/
gchar *
pk_filter_bitfield_to_text (PkBitfield filters)
{
GString *string;
guint i;
/* shortcut */
if (filters == 0)
return g_strdup (pk_filter_enum_to_text (PK_FILTER_ENUM_NONE));
string = g_string_new ("");
for (i=0; i<PK_FILTER_ENUM_LAST; i++) {
if ((filters & pk_bitfield_value (i)) == 0)
continue;
g_string_append_printf (string, "%s;", pk_filter_enum_to_text (i));
}
/* do we have a 'none' filter? \n */
if (string->len == 0) {
egg_warning ("not valid!");
g_string_append (string, pk_filter_enum_to_text (PK_FILTER_ENUM_NONE));
} else {
/* remove last \n */
g_string_set_size (string, string->len - 1);
}
return g_string_free (string, FALSE);
}
开发者ID:zodman,项目名称:PackageKit,代码行数:34,代码来源:pk-bitfield.c
示例16: pk_role_bitfield_from_text
/**
* pk_role_bitfield_from_text:
* @roles: the enumerated constant value, e.g. "available;~gui"
*
* Converts text representation to its enumerated type bitfield
*
* Return value: The enumerated type values, or 0 for invalid
**/
PkBitfield
pk_role_bitfield_from_text (const gchar *roles)
{
PkBitfield roles_enum = 0;
gchar **split;
guint length;
guint i;
PkRoleEnum role;
split = g_strsplit (roles, ";", 0);
if (split == NULL) {
egg_warning ("unable to split");
goto out;
}
length = g_strv_length (split);
for (i=0; i<length; i++) {
role = pk_role_enum_from_text (split[i]);
if (role == PK_ROLE_ENUM_UNKNOWN) {
roles_enum = 0;
break;
}
roles_enum += pk_bitfield_value (role);
}
out:
g_strfreev (split);
return roles_enum;
}
开发者ID:zodman,项目名称:PackageKit,代码行数:36,代码来源:pk-bitfield.c
示例17: mcm_calibrate_dialog_set_image_filename_private
/**
* mcm_calibrate_dialog_set_image_filename_private:
**/
static void
mcm_calibrate_dialog_set_image_filename_private (McmCalibrateDialog *calibrate_dialog, const gchar *image_filename)
{
GtkWidget *widget;
gchar *filename = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
McmCalibrateDialogPrivate *priv = calibrate_dialog->priv;
/* set the image */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_generic"));
if (image_filename != NULL) {
filename = g_build_filename (MCM_DATA, "icons", image_filename, NULL);
pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 200, 400, &error);
if (pixbuf == NULL) {
egg_warning ("failed to load image: %s", error->message);
g_error_free (error);
gtk_widget_hide (widget);
} else {
gtk_image_set_from_pixbuf (GTK_IMAGE (widget), pixbuf);
gtk_widget_show (widget);
}
g_free (filename);
} else {
gtk_widget_hide (widget);
}
}
开发者ID:Staretta,项目名称:mate-color-manager,代码行数:30,代码来源:mcm-calibrate-dialog.c
示例18: gpm_applet_uninhibit
static gboolean
gpm_applet_uninhibit (GpmInhibitApplet *applet,
guint cookie)
{
GError *error = NULL;
gboolean ret;
if (applet->proxy == NULL) {
egg_warning ("not connected");
return FALSE;
}
ret = dbus_g_proxy_call (applet->proxy, "Uninhibit", &error,
G_TYPE_UINT, cookie,
G_TYPE_INVALID,
G_TYPE_INVALID);
if (error) {
g_debug ("ERROR: %s", error->message);
g_error_free (error);
}
if (!ret) {
/* abort as the DBUS method failed */
g_warning ("Uninhibit failed!");
}
return ret;
}
开发者ID:hamonikr-root,项目名称:mate-power-manager,代码行数:27,代码来源:inhibit-applet.c
示例19: pk_group_bitfield_from_text
/**
* pk_group_bitfield_from_text:
* @groups: the enumerated constant value, e.g. "available;~gui"
*
* Converts text representation to its enumerated type bitfield
*
* Return value: The enumerated type values, or 0 for invalid
**/
PkBitfield
pk_group_bitfield_from_text (const gchar *groups)
{
PkBitfield groups_enum = 0;
gchar **split;
guint length;
guint i;
PkGroupEnum group;
split = g_strsplit (groups, ";", 0);
if (split == NULL) {
egg_warning ("unable to split");
goto out;
}
length = g_strv_length (split);
for (i=0; i<length; i++) {
group = pk_group_enum_from_text (split[i]);
if (group == PK_GROUP_ENUM_UNKNOWN) {
groups_enum = 0;
break;
}
groups_enum += pk_bitfield_value (group);
}
out:
g_strfreev (split);
return groups_enum;
}
开发者ID:zodman,项目名称:PackageKit,代码行数:36,代码来源:pk-bitfield.c
示例20: up_device_coldplug
/**
* up_device_coldplug:
*
* Return %TRUE on success, %FALSE if we failed to get data and should be removed
**/
gboolean
up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native)
{
gboolean ret;
const gchar *native_path;
UpDeviceClass *klass = UP_DEVICE_GET_CLASS (device);
gchar *id = NULL;
g_return_val_if_fail (UP_IS_DEVICE (device), FALSE);
/* save */
device->priv->native = g_object_ref (native);
device->priv->daemon = g_object_ref (daemon);
native_path = up_native_get_native_path (native);
device->priv->native_path = g_strdup (native_path);
/* stop signals and callbacks */
g_object_freeze_notify (G_OBJECT(device));
device->priv->during_coldplug = TRUE;
/* coldplug source */
if (klass->coldplug != NULL) {
ret = klass->coldplug (device);
if (!ret) {
egg_debug ("failed to coldplug %s", device->priv->native_path);
goto out;
}
}
/* only put on the bus if we succeeded */
ret = up_device_register_device (device);
if (!ret) {
egg_warning ("failed to register device %s", device->priv->native_path);
goto out;
}
/* force a refresh, although failure isn't fatal */
ret = up_device_refresh_internal (device);
if (!ret) {
egg_debug ("failed to refresh %s", device->priv->native_path);
/* TODO: refresh should really have seporate
* success _and_ changed parameters */
ret = TRUE;
goto out;
}
/* get the id so we can load the old history */
id = up_device_get_id (device);
if (id != NULL)
up_history_set_id (device->priv->history, id);
out:
/* start signals and callbacks */
g_object_thaw_notify (G_OBJECT(device));
device->priv->during_coldplug = FALSE;
g_free (id);
return ret;
}
开发者ID:Kalvados,项目名称:upower,代码行数:65,代码来源:up-device.c
注:本文中的egg_warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论