From: Guillaume Desmottes Date: Mon, 19 Apr 2010 15:28:52 +0000 (+0200) Subject: dispatch-operation: add user-action-time property X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=cdd773bdb91f860c502864bf9d40df45f935aa7c dispatch-operation: add user-action-time property --- diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c index 6120f8e0..6c5fa38d 100644 --- a/libempathy/empathy-dispatch-operation.c +++ b/libempathy/empathy-dispatch-operation.c @@ -70,6 +70,7 @@ enum { PROP_CONTACT, PROP_INCOMING, PROP_STATUS, + PROP_USER_ACTION_TIME, }; /* private structure */ @@ -85,6 +86,7 @@ struct _EmpathyDispatchOperationPriv EmpathyContact *contact; EmpathyDispatchOperationState status; gboolean incoming; + gint64 user_action_time; gboolean approved; gulong invalidated_handler; gulong ready_handler; @@ -132,6 +134,10 @@ empathy_dispatch_operation_set_property (GObject *object, case PROP_INCOMING: priv->incoming = g_value_get_boolean (value); break; + + case PROP_USER_ACTION_TIME: + priv->user_action_time = g_value_get_int64 (value); + break; } } @@ -162,6 +168,9 @@ empathy_dispatch_operation_get_property (GObject *object, case PROP_STATUS: g_value_set_enum (value, priv->status); break; + case PROP_USER_ACTION_TIME: + g_value_set_int64 (value, priv->user_action_time); + break; } } @@ -357,6 +366,13 @@ empathy_dispatch_operation_class_init ( EMPATHY_TYPE_DISPATCH_OPERATION_STATE, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_STATUS, param_spec); + + param_spec = g_param_spec_int64 ("user-action-time", + "user action time", "The user action time of the operation", + G_MININT64, G_MAXINT64, 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_USER_ACTION_TIME, + param_spec); } void @@ -492,8 +508,11 @@ out: } EmpathyDispatchOperation * -empathy_dispatch_operation_new (TpConnection *connection, TpChannel *channel, - EmpathyContact *contact, gboolean incoming) +empathy_dispatch_operation_new (TpConnection *connection, + TpChannel *channel, + EmpathyContact *contact, + gboolean incoming, + gint64 user_action_time) { g_return_val_if_fail (connection != NULL, NULL); g_return_val_if_fail (channel != NULL, NULL); @@ -503,6 +522,7 @@ empathy_dispatch_operation_new (TpConnection *connection, TpChannel *channel, "channel", channel, "contact", contact, "incoming", incoming, + "user-action-time", user_action_time, NULL); } @@ -681,3 +701,15 @@ empathy_dispatch_operation_is_incoming (EmpathyDispatchOperation *operation) return priv->incoming; } + +gint64 +empathy_dispatch_operation_get_user_action_time (EmpathyDispatchOperation *self) +{ + EmpathyDispatchOperationPriv *priv; + + g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (self), FALSE); + + priv = GET_PRIV (self); + + return priv->user_action_time; +} diff --git a/libempathy/empathy-dispatch-operation.h b/libempathy/empathy-dispatch-operation.h index 148adec9..3e7bc92c 100644 --- a/libempathy/empathy-dispatch-operation.h +++ b/libempathy/empathy-dispatch-operation.h @@ -76,11 +76,14 @@ GType empathy_dispatch_operation_get_type (void); EmpathyDispatchOperation *empathy_dispatch_operation_new ( TpConnection *connection, TpChannel *channel, EmpathyContact *contact, - gboolean incoming); + gboolean incoming, + gint64 user_action_time); EmpathyDispatchOperation *empathy_dispatch_operation_new_with_wrapper ( TpConnection *connection, TpChannel *channel, EmpathyContact *contact, - gboolean incoming, GObject *channel_wrapper); + gboolean incoming, + gint64 user_action_time, + GObject *channel_wrapper); /* Start the dispatching process, goes to the APPROVING state for incoming * channels and DISPATCHING for outgoing ones */ @@ -115,6 +118,9 @@ EmpathyDispatchOperationState empathy_dispatch_operation_get_status ( gboolean empathy_dispatch_operation_is_incoming ( EmpathyDispatchOperation *operation); +gint64 empathy_dispatch_operation_get_user_action_time ( + EmpathyDispatchOperation *self); + G_END_DECLS #endif /* #ifndef __EMPATHY_DISPATCH_OPERATION_H__*/ diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 70c56b6a..2141b0b1 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -573,7 +573,8 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self, guint handle, GHashTable *properties, gboolean incoming, - const GPtrArray *requests_satisfied) + const GPtrArray *requests_satisfied, + gint64 timestamp) { EmpathyDispatcherPriv *priv = GET_PRIV (self); TpChannel *channel; @@ -630,7 +631,7 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self, priv->channels = g_list_prepend (priv->channels, channel); operation = empathy_dispatch_operation_new (connection, channel, NULL, - incoming); + incoming, timestamp); g_object_unref (channel); @@ -691,7 +692,8 @@ dispatcher_connection_new_channel_with_properties ( TpConnection *connection, const gchar *object_path, GHashTable *properties, - const GPtrArray *requests_satisfied) + const GPtrArray *requests_satisfied, + gint64 timestamp) { const gchar *channel_type; guint handle_type; @@ -735,7 +737,7 @@ dispatcher_connection_new_channel_with_properties ( dispatcher_connection_new_channel (self, connection, object_path, channel_type, handle_type, handle, properties, !requested, - requests_satisfied); + requests_satisfied, timestamp); } static void @@ -2078,7 +2080,7 @@ empathy_dispatcher_handle_channels (EmpathyHandler *handler, properties = g_value_get_boxed (g_value_array_get_nth (arr, 1)); dispatcher_connection_new_channel_with_properties (self, - connection, object_path, properties, requests_satisfied); + connection, object_path, properties, requests_satisfied, timestamp); } return TRUE;