Logo Search packages:      
Sourcecode: hal version File versions

dbus_bool_t hal_agent_merge_properties ( LibHalContext ctx,
const char *  target_udi,
const char *  source_udi 
)

Merge properties from one device to another.

Parameters:
ctx The context for the connection to hald
target_udi Unique device id of target device to merge to
source_udi Unique device id of device to merge from
Returns:
TRUE if the properties was merged

Definition at line 1904 of file libhal.c.

References LibHalContext_s::connection.

{
      DBusError error;
      DBusMessage *message;
      DBusMessage *reply;
      DBusMessageIter iter;

      message = dbus_message_new_method_call ("org.freedesktop.Hal",
                                    "/org/freedesktop/Hal/Manager",
                                    "org.freedesktop.Hal.AgentManager",
                                    "MergeProperties");
      if (message == NULL) {
            fprintf (stderr,
                   "%s %d : Couldn't allocate D-BUS message\n",
                   __FILE__, __LINE__);
            return FALSE;
      }

      dbus_message_iter_init (message, &iter);
      dbus_message_iter_append_string (&iter, target_udi);
      dbus_message_iter_append_string (&iter, source_udi);

      dbus_error_init (&error);
      reply = dbus_connection_send_with_reply_and_block (ctx->connection,
                                             message, -1,
                                             &error);
      if (dbus_error_is_set (&error)) {
            if (dbus_error_has_name
                (&error, "org.freedesktop.Hal.NoSuchDevice"))
                  return FALSE;
            fprintf (stderr, "%s %d : Error sending msg: %s\n",
                   __FILE__, __LINE__, error.message);
            dbus_message_unref (message);
            return FALSE;
      }
      if (reply == NULL) {
            dbus_message_unref (message);
            return FALSE;
      }

      dbus_message_unref (message);
      dbus_message_unref (reply);
      return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index