]> git.0d.be Git - empathy.git/commitdiff
dispatch-operation: add user-action-time property
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 19 Apr 2010 15:28:52 +0000 (17:28 +0200)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Sat, 24 Apr 2010 18:44:09 +0000 (19:44 +0100)
libempathy/empathy-dispatch-operation.c
libempathy/empathy-dispatch-operation.h
libempathy/empathy-dispatcher.c

index 6120f8e05271d435660727c2998dad4b928cb26e..6c5fa38d89f8f19c3f58b60256ad035a612fcbbc 100644 (file)
@@ -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;
+}
index 148adec905e2f5f61f90d4465e2b511460c8b021..3e7bc92c56a95893838b28ab45a6a8ef6d68362b 100644 (file)
@@ -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__*/
index 70c56b6ab98b7891b1f0729f183c162c911d694b..2141b0b15201c682231e21891c0bcbec170217c9 100644 (file)
@@ -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;