[packagekit] [Q] How "GetDepends" connect with "get_depends"
Richard Hughes
hughsient at gmail.com
Wed Sep 17 01:00:54 PDT 2008
On Wed, 2008-09-17 at 14:46 +0800, NZzi wrote:
> i follow your words, and browse pk_transaction_run().
> pk_transaction_set_running() will call corresponding
> backend get_depends call, based on the "PK_ROLE_ENUM_GET_DEPENDS"
> role.
>
> i follow the call-chains, i found it's pk_transaction_get_depends()
> set the "PK_ROLE_ENUM_GET_DEPENDS" roles.
Correct.
> i compile packagekit, i found pk-interface-transaction.h, the
> generated file has pk_transaction_get_depends and "GetDepends",
> but i don't understand how packagekitd know that she should
> call pk_transaction_get_depends() when received "GetDepends"
> requests from dbus?
This bit of code in pk-transaction-list.c:
{{{
item->transaction = pk_transaction_new ();
g_signal_connect_after (item->transaction, "finished",
G_CALLBACK (pk_transaction_list_transaction_finished_cb), tlist);
/* set the TID on the transaction */
ret = pk_transaction_set_tid (item->transaction, item->tid);
if (!ret)
egg_error ("failed to set TID");
/* put on the bus */
dbus_g_object_type_install_info (PK_TYPE_TRANSACTION, &dbus_glib_pk_transaction_object_info);
dbus_g_connection_register_g_object (connection, item->tid, G_OBJECT (item->transaction));
}}}
The last two lines register the PkTransaction object on the bus so that
it accepts the dbus method on that interface. Worthwhile to note is that
the "tid" is also the DBUS path.
> BTW, i browse pk-engine.c, i still don't know where packagekitd
> received dbus messages(requests),and process, and "goto"
> pk-transaction.c?
If you use the default path, /org/freedesktop/PackageKit then you use
the PkEngine interface, but if you use the path of the TID, then the
correct PkTransaction object is used.
Richard.
More information about the PackageKit
mailing list