telepathy-mission-control: Remove the concept of old-style filters altogether

Simon McVittie smcv at kemper.freedesktop.org
Thu May 10 08:15:18 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 76f016bdad63f0ea68bc11e64be54e01b61004b3
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=76f016bdad63f0ea68bc11e64be54e01b61004b3

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue May  8 14:05:04 2012 +0100

Remove the concept of old-style filters altogether

---

 src/Makefile.am              |    1 -
 src/mcd-dispatcher-context.h |   62 ------------------------------------------
 src/mcd-dispatcher.c         |   28 +-----------------
 src/mcd-service.c            |    2 -
 4 files changed, 2 insertions(+), 91 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index f9c8eec..7b8efa9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,6 @@ mc_headers = \
 	mcd-channel.h \
 	mcd-proxy.h \
 	mcd-dispatcher.h \
-	mcd-dispatcher-context.h \
 	mcd-service.h \
 	mcd-transport.h \
 	mcd-storage.h
diff --git a/src/mcd-dispatcher-context.h b/src/mcd-dispatcher-context.h
deleted file mode 100644
index 11f99a6..0000000
--- a/src/mcd-dispatcher-context.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vi: set et sw=4 ts=8 cino=t0,(0: */
-/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007-2009 Nokia Corporation.
- *
- * Contact: Naba Kumar  <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MCD_DISPATCHER_CONTEXT_H__
-#define __MCD_DISPATCHER_CONTEXT_H__
-
-#include "mcd-dispatcher.h"
-#include "mcd-connection.h"
-
-G_BEGIN_DECLS
-
-/* Filter flag definitions */
-#define MCD_FILTER_IN  1<<0
-#define MCD_FILTER_OUT 1<<1
-
-/* The context of the current filter chain execution. Should be kept
- * intact by filter implementation and passed transparently to
- * getters/setters and state machine functions
- */
-typedef struct _McdDispatcherContext McdDispatcherContext;
-
-/* Filter function type */
-typedef void (*McdFilterFunc) (McdDispatcherContext * ctx, gpointer user_data);
-
-/* Filter priorities */
-#define MCD_FILTER_PRIORITY_CRITICAL 10000
-#define MCD_FILTER_PRIORITY_SYSTEM   20000
-#define MCD_FILTER_PRIORITY_USER     30000
-#define MCD_FILTER_PRIORITY_NOTICE   40000
-#define MCD_FILTER_PRIORITY_LOW	     50000
-
-typedef struct filter_t {
-    McdFilterFunc func;
-    guint priority;
-    gpointer user_data;
-} McdFilter;
-
-G_END_DECLS
-
-#endif
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index c944f53..93c62a8 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -53,7 +53,6 @@
 #include "mcd-channel.h"
 #include "mcd-master.h"
 #include "mcd-channel-priv.h"
-#include "mcd-dispatcher-context.h"
 #include "mcd-dispatcher-priv.h"
 #include "mcd-dispatch-operation-priv.h"
 #include "mcd-handler-map-priv.h"
@@ -98,6 +97,8 @@ G_DEFINE_TYPE_WITH_CODE (McdDispatcher, mcd_dispatcher, MCD_TYPE_MISSION,
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES,
                            tp_dbus_properties_mixin_iface_init))
 
+typedef struct _McdDispatcherContext McdDispatcherContext;
+
 struct _McdDispatcherContext
 {
     gint ref_count;
@@ -105,12 +106,6 @@ struct _McdDispatcherContext
     McdDispatcher *dispatcher;
 
     McdDispatchOperation *operation;
-
-    /* State-machine internal data fields: */
-    GList *chain;
-
-    /* Next function in chain */
-    guint next_func_index;
 };
 
 typedef struct
@@ -142,9 +137,6 @@ struct _McdDispatcherPrivate
 
     TpDBusDaemon *dbus_daemon;
 
-    /* list of McdFilter elements */
-    GList *filters;
-
     /* hash table containing clients
      * char *bus_name -> McdClientProxy */
     McdClientRegistry *clients;
@@ -340,7 +332,6 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
     DEBUG ("CTXREF11 on %p", context);
     context->ref_count = 1;
     context->dispatcher = dispatcher;
-    context->chain = NULL;
 
     DEBUG ("new dispatcher context %p for %s channel %p (%s): %s",
            context, requested ? "requested" : "unrequested",
@@ -981,7 +972,6 @@ static void
 mcd_dispatcher_context_proceed (McdDispatcherContext *context)
 {
     GError error = { TP_ERROR, 0, NULL };
-    McdFilter *filter;
 
     if (_mcd_dispatch_operation_get_cancelled (context->operation))
     {
@@ -997,20 +987,6 @@ mcd_dispatcher_context_proceed (McdDispatcherContext *context)
         goto no_more;
     }
 
-    filter = g_list_nth_data (context->chain, context->next_func_index);
-
-    if (filter != NULL)
-    {
-        context->next_func_index++;
-        DEBUG ("Next filter");
-        mcd_dispatcher_context_ref (context, "CTXREF10");
-        filter->func (context, filter->user_data);
-        mcd_dispatcher_context_unref (context, "CTXREF10");
-        /* The state machine goes on... this function will be invoked again
-         * (perhaps recursively, or perhaps later) by filter->func. */
-        return;
-    }
-
 no_more:    /* either no more filters, or no more channels */
     _mcd_dispatch_operation_run_clients (context->operation);
     mcd_dispatcher_context_unref (context, "CTXREF01");
diff --git a/src/mcd-service.c b/src/mcd-service.c
index 46f708e..ea070f7 100644
--- a/src/mcd-service.c
+++ b/src/mcd-service.c
@@ -52,8 +52,6 @@
 #include <dbus/dbus.h>
 #include <telepathy-glib/telepathy-glib.h>
 
-#include "mcd-dispatcher.h"
-#include "mcd-dispatcher-context.h"
 #include "mcd-connection.h"
 #include "mcd-misc.h"
 #include "mcd-service.h"



More information about the telepathy-commits mailing list