[empathy] define constants for handler bus name



commit 04edfb3dbbdf9a2a4ac6cf2ecafcbd88044ee094
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Mar 7 14:54:01 2011 +0100

    define constants for handler bus name
    
    It's more convenient and safe than hardcoding them everywhere.

 libempathy/empathy-ft-factory.c      |    3 ++-
 libempathy/empathy-request-util.h    |    9 +++++++++
 src/empathy-chat-manager.c           |    4 ++--
 src/empathy-streamed-media-factory.c |    3 ++-
 4 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c
index 3984747..5fb238a 100644
--- a/libempathy/empathy-ft-factory.c
+++ b/libempathy/empathy-ft-factory.c
@@ -28,6 +28,7 @@
 #include "empathy-ft-factory.h"
 #include "empathy-ft-handler.h"
 #include "empathy-marshal.h"
+#include "empathy-request-util.h"
 #include "empathy-utils.h"
 
 /**
@@ -219,7 +220,7 @@ empathy_ft_factory_init (EmpathyFTFactory *self)
     }
 
   priv->handler = tp_simple_handler_new (dbus, FALSE, FALSE,
-      "Empathy.FileTransfer", FALSE, handle_channels_cb, self, NULL);
+      EMPATHY_FT_BUS_NAME_SUFFIX, FALSE, handle_channels_cb, self, NULL);
 
   tp_base_client_take_handler_filter (priv->handler, tp_asv_new (
         TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
diff --git a/libempathy/empathy-request-util.h b/libempathy/empathy-request-util.h
index 1073f0d..afb8013 100644
--- a/libempathy/empathy-request-util.h
+++ b/libempathy/empathy-request-util.h
@@ -30,6 +30,15 @@
 
 G_BEGIN_DECLS
 
+#define EMPATHY_CHAT_BUS_NAME_SUFFIX "Empathy.Chat"
+#define EMPATHY_CHAT_BUS_NAME TP_CLIENT_BUS_NAME_BASE EMPATHY_CHAT_BUS_NAME_SUFFIX
+
+#define EMPATHY_AV_BUS_NAME_SUFFIX "Empathy.AudioVideo"
+#define EMPATHY_AV_BUS_NAME TP_CLIENT_BUS_NAME_BASE EMPATHY_AV_BUS_NAME_SUFFIX
+
+#define EMPATHY_FT_BUS_NAME_SUFFIX "Empathy.FileTransfer"
+#define EMPATHY_FT_BUS_NAME TP_CLIENT_BUS_NAME_BASE EMPATHY_FT_BUS_NAME_SUFFIX
+
 /* Requesting 1 to 1 text channels */
 void empathy_chat_with_contact_id (TpAccount *account,
   const gchar *contact_id,
diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c
index c3488dc..ff715fe 100644
--- a/src/empathy-chat-manager.c
+++ b/src/empathy-chat-manager.c
@@ -286,8 +286,8 @@ empathy_chat_manager_init (EmpathyChatManager *self)
   priv->chatroom_mgr = empathy_chatroom_manager_dup_singleton (NULL);
 
   /* Text channels handler */
-  priv->handler = tp_simple_handler_new (dbus, FALSE, FALSE, "Empathy.Chat",
-      FALSE, handle_channels, self, NULL);
+  priv->handler = tp_simple_handler_new (dbus, FALSE, FALSE,
+      EMPATHY_CHAT_BUS_NAME_SUFFIX, FALSE, handle_channels, self, NULL);
 
   /* EmpathyTpChat relies on these features being prepared */
   tp_base_client_add_connection_features_varargs (priv->handler,
diff --git a/src/empathy-streamed-media-factory.c b/src/empathy-streamed-media-factory.c
index 70b2379..e044a1b 100644
--- a/src/empathy-streamed-media-factory.c
+++ b/src/empathy-streamed-media-factory.c
@@ -27,6 +27,7 @@
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/util.h>
 
+#include <libempathy/empathy-request-util.h>
 #include <libempathy/empathy-utils.h>
 
 #include "empathy-streamed-media-factory.h"
@@ -85,7 +86,7 @@ empathy_streamed_media_factory_init (EmpathyStreamedMediaFactory *obj)
     }
 
   priv->handler = tp_simple_handler_new (dbus, FALSE, FALSE,
-      "Empathy.AudioVideo", FALSE, handle_channels_cb, obj, NULL);
+      EMPATHY_AV_BUS_NAME_SUFFIX, FALSE, handle_channels_cb, obj, NULL);
 
   tp_base_client_take_handler_filter (priv->handler, tp_asv_new (
         TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,



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