[empathy: 2/9] remove internal approving code



commit 14d38669faa5ed366832dd8f8fc9da7813f8a4af
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue May 18 17:50:21 2010 +0200

    remove internal approving code

 libempathy/empathy-dispatch-operation.c |   50 +----------------------------
 libempathy/empathy-dispatch-operation.h |    4 --
 libempathy/empathy-dispatcher.c         |   53 ++----------------------------
 3 files changed, 5 insertions(+), 102 deletions(-)
---
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 7843812..68777a5 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -51,8 +51,6 @@ enum
 {
     /* Ready for dispatching */
     READY,
-    /* Approved by an approver, can only happens on incoming operations */
-    APPROVED,
     /* Claimed by a handler */
     CLAIMED,
     /* Error, channel went away, inspecting it failed etc */
@@ -87,7 +85,6 @@ struct _EmpathyDispatchOperationPriv
   EmpathyDispatchOperationState status;
   gboolean incoming;
   gint64 user_action_time;
-  gboolean approved;
   gulong invalidated_handler;
   gulong ready_handler;
 };
@@ -295,14 +292,6 @@ empathy_dispatch_operation_class_init (
       g_cclosure_marshal_VOID__VOID,
       G_TYPE_NONE, 0);
 
-  signals[APPROVED] = g_signal_new ("approved",
-    G_OBJECT_CLASS_TYPE(empathy_dispatch_operation_class),
-      G_SIGNAL_RUN_LAST,
-      0,
-      NULL, NULL,
-      g_cclosure_marshal_VOID__VOID,
-      G_TYPE_NONE, 0);
-
   signals[CLAIMED] = g_signal_new ("claimed",
     G_OBJECT_CLASS_TYPE(empathy_dispatch_operation_class),
       G_SIGNAL_RUN_LAST,
@@ -567,47 +556,10 @@ empathy_dispatch_operation_start (EmpathyDispatchOperation *operation)
   g_return_if_fail (
     priv->status == EMPATHY_DISPATCHER_OPERATION_STATE_PENDING);
 
-  if (priv->incoming && !priv->approved)
-    empathy_dispatch_operation_set_status (operation,
-      EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING);
-  else
-    empathy_dispatch_operation_set_status (operation,
+  empathy_dispatch_operation_set_status (operation,
       EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING);
 }
 
-void
-empathy_dispatch_operation_approve (EmpathyDispatchOperation *operation)
-{
-  EmpathyDispatchOperationPriv *priv;
-
-  g_return_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation));
-
-  priv = GET_PRIV (operation);
-
-  if (priv->status == EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING)
-    {
-      DEBUG ("Approving operation %s",
-        empathy_dispatch_operation_get_object_path (operation));
-
-      empathy_dispatch_operation_set_status (operation,
-        EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING);
-
-      g_signal_emit (operation, signals[APPROVED], 0);
-    }
-  else if (priv->status < EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING)
-    {
-      DEBUG ("Pre-approving operation %s",
-        empathy_dispatch_operation_get_object_path (operation));
-      priv->approved = TRUE;
-    }
-  else
-    {
-      DEBUG (
-        "Ignoring approval for %s as it's already past the approval stage",
-        empathy_dispatch_operation_get_object_path (operation));
-    }
-}
-
 /* Returns whether or not the operation was successfully claimed */
 gboolean
 empathy_dispatch_operation_claim (EmpathyDispatchOperation *operation)
diff --git a/libempathy/empathy-dispatch-operation.h b/libempathy/empathy-dispatch-operation.h
index f199be5..b761423 100644
--- a/libempathy/empathy-dispatch-operation.h
+++ b/libempathy/empathy-dispatch-operation.h
@@ -45,8 +45,6 @@ typedef enum {
     EMPATHY_DISPATCHER_OPERATION_STATE_PREPARING = 0,
     /* Information gathered ready to be dispatched */
     EMPATHY_DISPATCHER_OPERATION_STATE_PENDING,
-    /* Send to approving bits for approval */
-    EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING,
     /* Send to handlers for dispatching */
     EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING,
     /* somebody claimed the channel */
@@ -89,8 +87,6 @@ EmpathyDispatchOperation *empathy_dispatch_operation_new_with_wrapper (
  * channels and DISPATCHING for outgoing ones */
 void empathy_dispatch_operation_start (EmpathyDispatchOperation *operation);
 
-void empathy_dispatch_operation_approve (EmpathyDispatchOperation *operation);
-
 /* Returns whether or not the operation was successfully claimed */
 gboolean empathy_dispatch_operation_claim (EmpathyDispatchOperation *operation);
 
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index c8943c9..ce234e4 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -110,7 +110,6 @@ enum
 enum
 {
   OBSERVE,
-  APPROVE,
   DISPATCH,
   LAST_SIGNAL
 };
@@ -431,16 +430,6 @@ dispatcher_channel_invalidated_cb (TpProxy *proxy,
 }
 
 static void
-dispatch_operation_approved_cb (EmpathyDispatchOperation *operation,
-                                EmpathyDispatcher *self)
-{
-  g_assert (empathy_dispatch_operation_is_incoming (operation));
-  DEBUG ("Send of for dispatching: %s",
-    empathy_dispatch_operation_get_object_path (operation));
-  g_signal_emit (self, signals[DISPATCH], 0, operation);
-}
-
-static void
 dispatch_operation_claimed_cb (EmpathyDispatchOperation *operation,
                                EmpathyDispatcher *self)
 {
@@ -480,9 +469,6 @@ dispatch_operation_ready_cb (EmpathyDispatchOperation *operation,
   ConnectionData *cd;
   EmpathyDispatchOperationState status;
 
-  g_signal_connect (operation, "approved",
-    G_CALLBACK (dispatch_operation_approved_cb), self);
-
   g_signal_connect (operation, "claimed",
     G_CALLBACK (dispatch_operation_claimed_cb), self);
 
@@ -508,19 +494,10 @@ dispatch_operation_ready_cb (EmpathyDispatchOperation *operation,
   if (status == EMPATHY_DISPATCHER_OPERATION_STATE_CLAIMED)
     return;
 
-  if (status == EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING)
-    {
-      DEBUG ("Send to approvers: %s",
-        empathy_dispatch_operation_get_object_path (operation));
-      g_signal_emit (self, signals[APPROVE], 0, operation);
-    }
-  else
-    {
-      g_assert (status == EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING);
-      DEBUG ("Send of for dispatching: %s",
-        empathy_dispatch_operation_get_object_path (operation));
-      g_signal_emit (self, signals[DISPATCH], 0, operation);
-    }
+  g_assert (status == EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING);
+  DEBUG ("Send of for dispatching: %s",
+      empathy_dispatch_operation_get_object_path (operation));
+  g_signal_emit (self, signals[DISPATCH], 0, operation);
 
   g_object_unref (self);
 }
@@ -608,15 +585,6 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self,
   DEBUG ("%s channel of type %s on %s", incoming ? "incoming" : "outgoing",
     channel_type, object_path);
 
-  if ((operation = g_hash_table_lookup (cd->dispatching_channels,
-      object_path)) != NULL)
-    {
-      /* This operation was already being dispatched, assume we got the channel
-       * again because something asked for it and approve it right away */
-      empathy_dispatch_operation_approve (operation);
-      return;
-    }
-
   if (properties == NULL)
     channel = tp_channel_new (connection, object_path, channel_type,
       handle_type, handle, NULL);
@@ -680,9 +648,6 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self,
         }
     }
 
-  if (g_hash_table_lookup (cd->dispatched_channels, object_path) != NULL)
-    empathy_dispatch_operation_approve (operation);
-
   dispatcher_start_dispatching (dispatcher, operation, cd);
 }
 
@@ -1093,16 +1058,6 @@ empathy_dispatcher_class_init (EmpathyDispatcherClass *klass)
       G_TYPE_NONE,
       1, EMPATHY_TYPE_DISPATCH_OPERATION);
 
-  signals[APPROVE] =
-    g_signal_new ("approve",
-      G_TYPE_FROM_CLASS (klass),
-      G_SIGNAL_RUN_LAST,
-      0,
-      NULL, NULL,
-      g_cclosure_marshal_VOID__OBJECT,
-      G_TYPE_NONE,
-      1, EMPATHY_TYPE_DISPATCH_OPERATION);
-
   signals[DISPATCH] =
     g_signal_new ("dispatch",
       G_TYPE_FROM_CLASS (klass),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]