From 05790b11515dfdd50cc699d3f3dceb8b53f8a3ac Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 20 Nov 2007 20:22:36 +0000 Subject: [PATCH] Add GetTimeSinceAction client API code --- libpackagekit/pk-client.c | 30 ++++++++++++++++++++++++++++++ libpackagekit/pk-client.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c index e62db2e68..d6bace60d 100644 --- a/libpackagekit/pk-client.c +++ b/libpackagekit/pk-client.c @@ -2176,6 +2176,36 @@ pk_client_get_backend_detail (PkClient *client, gchar **name, gchar **author) return TRUE; } +/** + * pk_client_get_time_since_action: + **/ +gboolean +pk_client_get_time_since_action (PkClient *client, PkRoleEnum role, guint *seconds) +{ + gboolean ret; + GError *error; + const gchar *role_text; + + g_return_val_if_fail (client != NULL, FALSE); + g_return_val_if_fail (PK_IS_CLIENT (client), FALSE); + + error = NULL; + role_text = pk_role_enum_to_text (role); + ret = dbus_g_proxy_call (client->priv->proxy, "GetTimeSinceAction", &error, + G_TYPE_STRING, role_text, + G_TYPE_INVALID, + G_TYPE_UINT, seconds, + G_TYPE_INVALID); + if (ret == FALSE) { + /* abort as the DBUS method failed */ + pk_warning ("GetTimeSinceAction failed :%s", error->message); + g_error_free (error); + return FALSE; + } + + return TRUE; +} + /** * pk_client_is_caller_active: **/ diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h index 844c910ad..1e35bd724 100644 --- a/libpackagekit/pk-client.h +++ b/libpackagekit/pk-client.h @@ -152,6 +152,9 @@ gboolean pk_client_get_old_transactions (PkClient *client, gboolean pk_client_get_backend_detail (PkClient *client, gchar **name, gchar **author); +gboolean pk_client_get_time_since_action (PkClient *client, + PkRoleEnum role, + guint *seconds); gboolean pk_client_is_caller_active (PkClient *client, gboolean *is_active);