[Telepathy-commits] [telepathy-mission-control/master] Remove unused code and APIs

Alberto Mardegan alberto.mardegan at nokia.com
Mon Jan 26 03:58:04 PST 2009


---
 src/mcd-dispatcher.c |  142 +-------------------------------------------------
 src/mcd-dispatcher.h |    4 +-
 2 files changed, 2 insertions(+), 144 deletions(-)

diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 3b01f7d..afc12fe 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -158,10 +158,7 @@ struct _McdDispatcherPrivate
 {
     /* Pending state machine contexts */
     GSList *state_machine_list;
-    
-    /* All active channels */
-    GList *channels;
-    
+
     GData *interface_filters;
     TpDBusDaemon *dbus_daemon;
 
@@ -629,18 +626,6 @@ mcd_dispatcher_get_channel_type_usage (McdDispatcher * dispatcher,
     return usage_counter;
 }
 
-/* The callback is called on channel Closed signal */
-static void
-on_channel_abort_list (McdChannel *channel, McdDispatcher *dispatcher)
-{
-    McdDispatcherPrivate *priv = dispatcher->priv;
-    
-    g_debug ("Abort Channel %p; Removing channel from list", channel);
-    priv->channels = g_list_remove (priv->channels, channel);
-    g_signal_emit_by_name (dispatcher, "channel-removed", channel);
-    g_object_unref (channel);
-}
-
 static void
 on_master_abort (McdMaster *master, McdDispatcherPrivate *priv)
 {
@@ -1719,115 +1704,6 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
     }
 }
 
-static gint
-channel_on_state_machine (McdDispatcherContext *context, McdChannel *channel)
-{
-    return (mcd_dispatcher_context_get_channel (context) == channel) ? 0 : 1;
-}
-
-static void
-_mcd_dispatcher_send (McdDispatcher * dispatcher, McdChannel * channel)
-{
-    McdDispatcherPrivate *priv;
-    gboolean outgoing;
-
-    g_return_if_fail (MCD_IS_DISPATCHER (dispatcher));
-    g_return_if_fail (MCD_IS_CHANNEL (channel));
-
-    mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_DISPATCHING);
-    priv = dispatcher->priv;
-
-    g_object_get (G_OBJECT (channel),
-                  "outgoing", &outgoing,
-                  NULL);
-    g_debug ("channel is %s", outgoing ? "outgoing" : "incoming");
-
-    /* deprecate the "dispatch-failed" and "dispatched" signals; we have the
-     * "dispatch-complete" signal that carries the whole context, so that the
-     * listeners are able to see the status of all the channels involved */
-    if (g_signal_has_handler_pending (dispatcher, signals[DISPATCH_FAILED], 0,
-                                      TRUE) ||
-        g_signal_has_handler_pending (dispatcher, signals[DISPATCHED], 0,
-                                      TRUE))
-        g_warning ("The signals \"dispatch-failed\" and \"dispatched\" are "
-                   "deprecated and will disappear very soon");
-
-    /* it can happen that this function gets called when the same channel has
-     * already entered the state machine or even when it has already been
-     * dispatched; so, check if this channel is already known to the
-     * dispatcher: */
-    if (g_list_find (priv->channels, channel))
-    {
-	McdDispatcherContext *context = NULL;
-	GSList *list;
-	g_debug ("%s: channel is already in dispatcher", G_STRFUNC);
-
-	/* check if channel has already been dispatched (if it's still in the
-	 * state machine list, this means that it hasn't) */
-	list = g_slist_find_custom (priv->state_machine_list, channel,
-				    (GCompareFunc)channel_on_state_machine);
-	if (list) context = list->data;
-	if (context)
-	{
-	    g_debug ("%s: channel found in the state machine (%p)", G_STRFUNC, context);
-	    /* this channel has not been dispatched; we can get to this point if:
-	     * 1) the channel is incoming (i.e. the contacts plugin icon is
-	     *    blinking) but the user didn't realize that and instead
-	     *    requested the same channel again;
-	     * 2) theif channel is outgoing, and it was requested again before
-	     *    it could be created; I'm not sure this can really happen,
-	     *    though. In this case we don't have to do anything, just ignore
-	     *    this second request */
-	    if (!outgoing)
-	    {
-		/* incoming channel: the state machine is probably stucked
-		 * waiting for the user to acknowledge the channel. We bypass
-		 * all that and instead launch the channel handler; this will
-		 * free the context, but we still have to remove it from the
-		 * machine state list ourselves.
-		 * The filters should connect to the "dispatched" signal to
-		 * catch this particular situation and clean-up gracefully. */
-		mcd_dispatcher_run_clients (context);
-		priv->state_machine_list =
-		    g_slist_remove(priv->state_machine_list, context);
-
-	    }
-	}
-	else
-	{
-	    /* The channel was not found in the state machine, hence it must
-	     * have been already dispatched.
-	     * We could get to this point if the UI crashed while this channel
-	     * was open, and now the user is requesting it again. just go straight
-	     * and start the channel handler. */
-	    g_debug ("%s: channel is already dispatched, starting handler", G_STRFUNC);
-	    /* Preparing and filling the context */
-	    context = g_new0 (McdDispatcherContext, 1);
-            context->ref_count = 1;
-	    context->dispatcher = dispatcher;
-	    context->channels = g_list_prepend (NULL, channel);
-
-            /* We must ref() the channel, because
-             * mcd_dispatcher_context_unref() will unref() it */
-	    g_object_ref (channel);
-	    mcd_dispatcher_run_clients (context);
-	}
-	return;
-    }
-    
-    /* Get hold of it in our all channels list */
-    g_object_ref (channel); /* We hold separate refs for channels list */
-    g_signal_connect (channel, "abort", G_CALLBACK (on_channel_abort_list),
-		      dispatcher);
-    priv->channels = g_list_prepend (priv->channels, channel);
-    
-    g_signal_emit_by_name (dispatcher, "channel-added", channel);
-
-    _mcd_dispatcher_enter_state_machine (dispatcher,
-                                         g_list_prepend (NULL, channel),
-                                         outgoing);
-}
-
 static void
 _mcd_dispatcher_set_property (GObject * obj, guint prop_id,
 			      const GValue * val, GParamSpec * pspec)
@@ -1922,12 +1798,6 @@ _mcd_dispatcher_dispose (GObject * object)
 	priv->dbus_daemon = NULL;
     }
 
-    if (priv->channels)
-    {
-	g_list_free (priv->channels);
-	priv->channels = NULL;
-    }
-
     if (priv->interface_filters)
     {
 	g_datalist_clear (&priv->interface_filters);
@@ -1936,15 +1806,6 @@ _mcd_dispatcher_dispose (GObject * object)
     G_OBJECT_CLASS (mcd_dispatcher_parent_class)->dispose (object);
 }
 
-gboolean
-mcd_dispatcher_send (McdDispatcher * dispatcher, McdChannel *channel)
-{
-    g_return_val_if_fail (MCD_IS_DISPATCHER (dispatcher), FALSE);
-    g_return_val_if_fail (MCD_IS_CHANNEL (channel), FALSE);
-    MCD_DISPATCHER_GET_CLASS (dispatcher)->send (dispatcher, channel);
-    return TRUE;
-}
-
 static GHashTable *
 parse_client_filter (GKeyFile *file, const gchar *group)
 {
@@ -2530,7 +2391,6 @@ mcd_dispatcher_class_init (McdDispatcherClass * klass)
     object_class->get_property = _mcd_dispatcher_get_property;
     object_class->finalize = _mcd_dispatcher_finalize;
     object_class->dispose = _mcd_dispatcher_dispose;
-    klass->send = _mcd_dispatcher_send;
 
     tp_proxy_or_subclass_hook_on_interface_add
         (TP_TYPE_PROXY, mc_cli_client_add_signals);
diff --git a/src/mcd-dispatcher.h b/src/mcd-dispatcher.h
index 41fc514..78aa8a1 100644
--- a/src/mcd-dispatcher.h
+++ b/src/mcd-dispatcher.h
@@ -68,7 +68,7 @@ struct _McdDispatcherClass
 				    GError *error);
 
     /* virtual methods */
-    void (*send) (McdDispatcher * dispatcher, McdChannel *channel);
+    void (*_mc_reserved0) (void);
     void (*_mc_reserved1) (void);
     void (*_mc_reserved2) (void);
     void (*_mc_reserved3) (void);
@@ -82,8 +82,6 @@ GType mcd_dispatcher_get_type (void);
 McdDispatcher *mcd_dispatcher_new (TpDBusDaemon *dbus_daemon,
 				   McdMaster * master);
 
-gboolean mcd_dispatcher_send (McdDispatcher * dispatcher, McdChannel *channel);
-
 gint mcd_dispatcher_get_channel_type_usage (McdDispatcher * dispatcher,
 					    GQuark chan_type_quark);
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list