[telepathy-gabble/master] SearchChannel: extract closing to a function.

Will Thompson will.thompson at collabora.co.uk
Wed Aug 26 09:21:47 PDT 2009


---
 src/search-channel.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/search-channel.c b/src/search-channel.c
index b7df701..6eae185 100644
--- a/src/search-channel.c
+++ b/src/search-channel.c
@@ -73,6 +73,21 @@ G_DEFINE_TYPE_WITH_CODE (GabbleSearchChannel, gabble_search_channel,
         contact_search_iface_init);
     )
 
+static void
+ensure_closed (GabbleSearchChannel *chan)
+{
+  if (chan->base.closed)
+    {
+      DEBUG ("Already closed, doing nothing");
+    }
+  else
+    {
+      DEBUG ("Emitting Closed");
+      chan->base.closed = TRUE;
+      tp_svc_channel_emit_closed (chan);
+    }
+}
+
 static gboolean
 fake_received_search_fields (gpointer data)
 {
@@ -288,16 +303,7 @@ gabble_search_channel_close (TpSvcChannel *iface,
 {
   GabbleSearchChannel *chan = GABBLE_SEARCH_CHANNEL (iface);
 
-  if (chan->base.closed)
-    {
-      DEBUG ("Already closed, doing nothing");
-    }
-  else
-    {
-      DEBUG ("Emitting Closed");
-      chan->base.closed = TRUE;
-      tp_svc_channel_emit_closed (chan);
-    }
+  ensure_closed (chan);
 
   tp_svc_channel_return_from_close (context);
 }
-- 
1.5.6.5




More information about the telepathy-commits mailing list