[Telepathy-commits] [telepathy-mission-control/master] Rename enums

Alberto Mardegan alberto.mardegan at nokia.com
Tue Dec 9 06:35:08 PST 2008


---
 src/mcd-account-compat.c   |    4 ++--
 src/mcd-account-requests.c |    4 ++--
 src/mcd-channel.c          |   20 ++++++++++----------
 src/mcd-channel.h          |   17 ++++++++++-------
 src/mcd-connection.c       |   14 ++++++++------
 src/mcd-dispatcher.c       |   22 ++++++++++++----------
 6 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/src/mcd-account-compat.c b/src/mcd-account-compat.c
index bacf83a..7e7f9d8 100644
--- a/src/mcd-account-compat.c
+++ b/src/mcd-account-compat.c
@@ -266,7 +266,7 @@ on_channel_status_changed (McdChannel *channel, McdChannelStatus status,
     g_debug ("%s (%u)", G_STRFUNC, status);
     g_return_if_fail (MCD_IS_ACCOUNT (account));
 
-    if (status == MCD_CHANNEL_FAILED &&
+    if (status == MCD_CHANNEL_STATUS_FAILED &&
         (req_data = g_object_get_data ((GObject *)channel, COMPAT_REQ_DATA))
         != NULL)
     {
@@ -281,7 +281,7 @@ on_channel_status_changed (McdChannel *channel, McdChannelStatus status,
                                req_data->requestor_serial,
                                req_data->requestor_client_id, error->code);
     }
-    else if (status == MCD_CHANNEL_DISPATCHED)
+    else if (status == MCD_CHANNEL_STATUS_DISPATCHED)
     {
         /* we don't need the request data anymore */
         g_object_set_data ((GObject *)channel, COMPAT_REQ_DATA, NULL);
diff --git a/src/mcd-account-requests.c b/src/mcd-account-requests.c
index 5b3bfca..b962250 100644
--- a/src/mcd-account-requests.c
+++ b/src/mcd-account-requests.c
@@ -93,7 +93,7 @@ on_channel_status_changed (McdChannel *channel, McdChannelStatus status,
 {
     const GError *error;
 
-    if (status == MCD_CHANNEL_FAILED)
+    if (status == MCD_CHANNEL_STATUS_FAILED)
     {
         const gchar *err_string;
         error = _mcd_channel_get_error (channel);
@@ -107,7 +107,7 @@ on_channel_status_changed (McdChannel *channel, McdChannelStatus status,
 
         g_object_unref (channel);
     }
-    else if (status == MCD_CHANNEL_DISPATCHED)
+    else if (status == MCD_CHANNEL_STATUS_DISPATCHED)
     {
         mc_svc_account_interface_channelrequests_emit_succeeded (account,
             _mcd_channel_get_request_path (channel));
diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index bd6697e..3491ee1 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -600,8 +600,8 @@ mcd_channel_abort (McdMission *mission)
 
     g_debug ("%s: %p", G_STRFUNC, mission);
     /* If this is still a channel request, signal the failure */
-    if (priv->status == MCD_CHANNEL_REQUEST ||
-        priv->status == MCD_CHANNEL_DISPATCHING)
+    if (priv->status == MCD_CHANNEL_STATUS_REQUEST ||
+        priv->status == MCD_CHANNEL_STATUS_DISPATCHING)
     {
         /* this code-path can only happen if the connection is aborted, as in
          * the other cases we handle the error in McdChannel; for this reason,
@@ -666,7 +666,7 @@ mcd_channel_class_init (McdChannelClass * klass)
          g_param_spec_enum ("channel-status",
                             "Channel status",
                             "Channel status",
-                            MCD_TYPE_CHANNEL_STATUS, MCD_CHANNEL_REQUEST,
+                            MCD_TYPE_CHANNEL_STATUS, MCD_CHANNEL_STATUS_REQUEST,
                             G_PARAM_READWRITE));
     g_object_class_install_property
         (object_class, PROP_CHANNEL_TYPE,
@@ -1148,7 +1148,7 @@ _mcd_channel_get_target_id (McdChannel *channel)
  *
  * Sets @error on channel, and takes ownership of it. As a side effect, if
  * @error is not %NULL this method causes the channel status be set to
- * %MCD_CHANNEL_FAILED.
+ * %MCD_CHANNEL_STATUS_FAILED.
  */
 void
 _mcd_channel_set_error (McdChannel *channel, GError *error)
@@ -1157,7 +1157,7 @@ _mcd_channel_set_error (McdChannel *channel, GError *error)
     g_object_set_data_full ((GObject *)channel, CD_ERROR,
                             error, (GDestroyNotify)g_error_free);
     if (error)
-        mcd_channel_set_status (channel, MCD_CHANNEL_FAILED);
+        mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_FAILED);
 }
 
 /*
@@ -1213,7 +1213,7 @@ mcd_channel_new_request (GHashTable *properties, guint64 user_time,
                             NULL);
 
     /* TODO: these data could be freed when the channel status becomes
-     * MCD_CHANNEL_DISPATCHED */
+     * MCD_CHANNEL_STATUS_DISPATCHED */
     crd = g_slice_new (McdChannelRequestData);
     crd->path = g_strdup_printf (REQUEST_OBJ_BASE "%u", last_req_id++);
     crd->properties = g_hash_table_ref (properties);
@@ -1222,7 +1222,7 @@ mcd_channel_new_request (GHashTable *properties, guint64 user_time,
     g_object_set_data_full ((GObject *)channel, CD_REQUEST,
                             crd, (GDestroyNotify)channel_request_data_free);
 
-    mcd_channel_set_status (channel, MCD_CHANNEL_REQUEST);
+    mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_REQUEST);
 
     return channel;
 }
@@ -1378,7 +1378,7 @@ copy_status (McdChannel *source, McdChannel *dest)
     {
         g_debug ("%s: source is %d, dest is %d", G_STRFUNC,
                  src_priv->status, dst_priv->status);
-        if (src_priv->status == MCD_CHANNEL_FAILED)
+        if (src_priv->status == MCD_CHANNEL_STATUS_FAILED)
         {
             const GError *error;
 
@@ -1390,8 +1390,8 @@ copy_status (McdChannel *source, McdChannel *dest)
             mcd_channel_set_status (dest, src_priv->status);
     }
 
-    if (dst_priv->status == MCD_CHANNEL_FAILED ||
-        dst_priv->status == MCD_CHANNEL_DISPATCHED)
+    if (dst_priv->status == MCD_CHANNEL_STATUS_FAILED ||
+        dst_priv->status == MCD_CHANNEL_STATUS_DISPATCHED)
     {
         /* the request is completed, we are not interested in monitor the
          * channel anymore */
diff --git a/src/mcd-channel.h b/src/mcd-channel.h
index b10665a..724bf3c 100644
--- a/src/mcd-channel.h
+++ b/src/mcd-channel.h
@@ -49,13 +49,16 @@ typedef struct _McdChannelClass McdChannelClass;
 
 typedef enum
 {
-    MCD_CHANNEL_UNDISPATCHED, /* used for channels created in the NewChannel
-                                 signal before the connection is ready */
-    MCD_CHANNEL_REQUEST,      /* Telepathy channel is not yet created */
-    MCD_CHANNEL_DISPATCHING, /* Telepathy channel is created and waiting dispatch */
-    MCD_CHANNEL_DISPATCHED,  /* Channel has been dispatched to handler */
-    MCD_CHANNEL_FAILED,      /* Channel creation failed, or channel could not
-                                be dispached to a handler */
+    MCD_CHANNEL_STATUS_UNDISPATCHED, /* used for channels created in the
+                                        NewChannel signal before the connection
+                                        is ready */
+    MCD_CHANNEL_STATUS_REQUEST,      /* Telepathy channel is not yet created */
+    MCD_CHANNEL_STATUS_DISPATCHING,  /* Telepathy channel is created and
+                                        waiting dispatch */
+    MCD_CHANNEL_STATUS_DISPATCHED,   /* Channel has been dispatched to handler
+                                      */
+    MCD_CHANNEL_STATUS_FAILED,       /* Channel creation failed, or channel
+                                        could not be dispached to a handler */
 } McdChannelStatus;
 
 struct _McdChannel
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index 7d76a53..4bfd464 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -452,7 +452,7 @@ on_new_channel (TpConnection *proxy, const gchar *chan_obj_path,
         mcd_dispatcher_send (priv->dispatcher, channel);
     }
     else
-        mcd_channel_set_status (channel, MCD_CHANNEL_UNDISPATCHED);
+        mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_UNDISPATCHED);
 }
 
 static void
@@ -558,7 +558,7 @@ on_capabilities_timeout (McdConnection *connection)
 
 	list_curr = list;
 	list = list->next;
-        if (mcd_channel_get_status (channel) == MCD_CHANNEL_REQUEST &&
+        if (mcd_channel_get_status (channel) == MCD_CHANNEL_STATUS_REQUEST &&
             on_channel_capabilities_timeout (channel, connection))
 	{
             mcd_mission_abort ((McdMission *)channel);
@@ -1142,7 +1142,7 @@ request_unrequested_channels (McdConnection *connection)
     {
 	McdChannel *channel = MCD_CHANNEL (channels->data);
 
-        if (mcd_channel_get_status (channel) == MCD_CHANNEL_REQUEST)
+        if (mcd_channel_get_status (channel) == MCD_CHANNEL_STATUS_REQUEST)
         {
             g_debug ("Requesting channel %p", channel);
             mcd_connection_request_channel (connection, channel);
@@ -1165,7 +1165,7 @@ dispatch_undispatched_channels (McdConnection *connection)
     {
 	McdChannel *channel = MCD_CHANNEL (channels->data);
 
-        if (mcd_channel_get_status (channel) == MCD_CHANNEL_UNDISPATCHED)
+        if (mcd_channel_get_status (channel) == MCD_CHANNEL_STATUS_UNDISPATCHED)
         {
             g_debug ("Dispatching channel %p", channel);
             /* dispatch the channel */
@@ -1320,7 +1320,8 @@ static void get_all_requests_cb (TpProxy *proxy, GHashTable *properties,
             McdChannel *channel = MCD_CHANNEL (list->data);
             const gchar *channel_path;
 
-            if (mcd_channel_get_status (channel) != MCD_CHANNEL_UNDISPATCHED)
+            if (mcd_channel_get_status (channel) !=
+                MCD_CHANNEL_STATUS_UNDISPATCHED)
                 continue;
             channel_path = mcd_channel_get_object_path (channel);
             if (channel_path && strcmp (channel_path, object_path) == 0)
@@ -2194,7 +2195,8 @@ common_request_channel_cb (TpConnection *proxy, gboolean yours,
              * 2) if @existing is already dispatched, we must re-invoke its
              * handler
              */
-            if (mcd_channel_get_status (channel) == MCD_CHANNEL_DISPATCHED)
+            if (mcd_channel_get_status (channel) ==
+                MCD_CHANNEL_STATUS_DISPATCHED)
             {
                 g_debug ("reinvoking handler on channel %p", existing);
                 _mcd_dispatcher_reinvoke_handler (priv->dispatcher, existing);
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index cb955b6..34332cd 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -275,7 +275,7 @@ mcd_dispatcher_context_handler_done (McdDispatcherContext *context)
     {
         McdChannel *channel = MCD_CHANNEL (list->data);
 
-        if (mcd_channel_get_status (channel) == MCD_CHANNEL_DISPATCHING)
+        if (mcd_channel_get_status (channel) == MCD_CHANNEL_STATUS_DISPATCHING)
             channels_left++;
         /* TODO: recognize those channels whose dispatch failed, and
          * re-dispatch them to another handler */
@@ -765,7 +765,7 @@ _mcd_dispatcher_handle_channel_async_cb (DBusGProxy * proxy, GError * error,
 	}
     }
 
-    mcd_channel_set_status (channel, MCD_CHANNEL_DISPATCHED);
+    mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_DISPATCHED);
     g_signal_emit_by_name (context->dispatcher, "dispatched", channel);
     mcd_dispatcher_context_handler_done (context);
 }
@@ -1007,7 +1007,7 @@ match_filters (McdChannel *channel, GList *filters)
     GList *list;
 
     channel_properties =
-        (mcd_channel_get_status (channel) == MCD_CHANNEL_REQUEST) ?
+        (mcd_channel_get_status (channel) == MCD_CHANNEL_STATUS_REQUEST) ?
         _mcd_channel_get_requested_properties (channel) :
         _mcd_channel_get_immutable_properties (channel);
 
@@ -1083,7 +1083,7 @@ handle_channels_cb (TpProxy *proxy, const GError *error, gpointer user_data,
             McdChannel *channel = MCD_CHANNEL (list->data);
 
             /* TODO: abort the channel if the handler dies */
-            mcd_channel_set_status (channel, MCD_CHANNEL_DISPATCHED);
+            mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_DISPATCHED);
             g_signal_emit_by_name (context->dispatcher, "dispatched", channel);
         }
     }
@@ -1547,7 +1547,7 @@ on_operation_finished (McdDispatchOperation *operation,
             McdChannel *channel = MCD_CHANNEL (list->data);
 
             /* TODO: abort the channel if the handler dies */
-            mcd_channel_set_status (channel, MCD_CHANNEL_DISPATCHED);
+            mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_DISPATCHED);
             g_signal_emit_by_name (context->dispatcher, "dispatched", channel);
         }
 
@@ -1663,7 +1663,7 @@ _mcd_dispatcher_send (McdDispatcher * dispatcher, McdChannel * channel)
     g_return_if_fail (MCD_IS_DISPATCHER (dispatcher));
     g_return_if_fail (MCD_IS_CHANNEL (channel));
 
-    mcd_channel_set_status (channel, MCD_CHANNEL_DISPATCHING);
+    mcd_channel_set_status (channel, MCD_CHANNEL_STATUS_DISPATCHING);
     priv = dispatcher->priv;
 
     g_object_get (G_OBJECT (channel),
@@ -2938,11 +2938,12 @@ static void
 on_request_status_changed (McdChannel *channel, McdChannelStatus status,
                            McdRemoveRequestData *rrd)
 {
-    if (status != MCD_CHANNEL_FAILED && status != MCD_CHANNEL_DISPATCHED)
+    if (status != MCD_CHANNEL_STATUS_FAILED &&
+        status != MCD_CHANNEL_STATUS_DISPATCHED)
         return;
 
     g_debug ("%s called, %u", G_STRFUNC, status);
-    if (status == MCD_CHANNEL_FAILED)
+    if (status == MCD_CHANNEL_STATUS_FAILED)
     {
         const GError *error;
         const gchar *err_string;
@@ -2987,7 +2988,8 @@ _mcd_dispatcher_add_request (McdDispatcher *dispatcher, McdAccount *account,
 
     g_return_if_fail (MCD_IS_DISPATCHER (dispatcher));
     g_return_if_fail (MCD_IS_CHANNEL (channel));
-    g_return_if_fail (mcd_channel_get_status (channel) == MCD_CHANNEL_REQUEST);
+    g_return_if_fail (mcd_channel_get_status (channel) ==
+                      MCD_CHANNEL_STATUS_REQUEST);
 
     priv = dispatcher->priv;
 
@@ -3081,7 +3083,7 @@ _mcd_dispatcher_send_channels (McdDispatcher *dispatcher, GList *channels,
 
     for (list = channels; list != NULL; list = list->next)
         mcd_channel_set_status (MCD_CHANNEL (list->data),
-                                MCD_CHANNEL_DISPATCHING);
+                                MCD_CHANNEL_STATUS_DISPATCHING);
 
     _mcd_dispatcher_enter_state_machine (dispatcher, channels, requested);
 }
-- 
1.5.6.5




More information about the Telepathy-commits mailing list