[gnome-shell] telepathyClient: Remove some obsolete wrappers



commit addb247c3314f8149b39d2d33b9088a541c726a4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Aug 14 16:21:10 2012 -0300

    telepathyClient: Remove some obsolete wrappers
    
    gjs can handle these cases natively now
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682045

 js/ui/telepathyClient.js |   18 +++++++++++-------
 src/shell-tp-client.c    |   20 --------------------
 src/shell-tp-client.h    |    7 -------
 3 files changed, 11 insertions(+), 34 deletions(-)
---
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index fb9575b..5d66bbe 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -132,7 +132,7 @@ const Client = new Lang.Class({
             let channel = channels[i];
             let [targetHandle, targetHandleType] = channel.get_handle();
 
-            if (Shell.is_channel_invalidated(channel))
+            if (channel.get_invalidated())
               continue;
 
             /* Only observe contact text channels */
@@ -184,7 +184,7 @@ const Client = new Lang.Class({
                 continue;
             }
 
-            if (Shell.is_channel_invalidated(channel))
+            if (channel.get_invalidated())
               continue;
 
             // 'notify' will be true when coming from an actual HandleChannels
@@ -211,13 +211,15 @@ const Client = new Lang.Class({
         // We can only approve the rooms if we have been invited to it
         let selfContact = channel.group_get_self_contact();
         if (selfContact == null) {
-            Shell.decline_dispatch_op(context, 'Not invited to the room');
+            context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+                                        message: 'Not invited to the room' }));
             return;
         }
 
         let [invited, inviter, reason, msg] = channel.group_get_local_pending_contact_info(selfContact);
         if (!invited) {
-            Shell.decline_dispatch_op(context, 'Not invited to the room');
+            context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+                                        message: 'Not invited to the room' }));
             return;
         }
 
@@ -237,8 +239,9 @@ const Client = new Lang.Class({
         let channel = channels[0];
         let chanType = channel.get_channel_type();
 
-        if (Shell.is_channel_invalidated(channel)) {
-            Shell.decline_dispatch_op(context, 'Channel is invalidated');
+        if (channel.get_invalidated()) {
+            context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+                                        message: 'Channel is invalidated' }));
             return;
         }
 
@@ -249,7 +252,8 @@ const Client = new Lang.Class({
         else if (chanType == Tp.IFACE_CHANNEL_TYPE_FILE_TRANSFER)
             this._approveFileTransfer(account, conn, channel, dispatchOp, context);
         else
-            Shell.decline_dispatch_op(context, 'Unsupported channel type');
+            context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+                                        message: 'Unsupported channel type' }));
     },
 
     _approveTextChannel: function(account, conn, channel, dispatchOp, context) {
diff --git a/src/shell-tp-client.c b/src/shell-tp-client.c
index 8dc3492..b6232e5 100644
--- a/src/shell-tp-client.c
+++ b/src/shell-tp-client.c
@@ -327,23 +327,3 @@ shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
                     G_CALLBACK (on_contact_list_changed),
                     self);
 }
-
-/* Telepathy utility functions */
-
-/* gjs doesn't allow us to craft a GError so we need a C wrapper */
-void
-shell_decline_dispatch_op (TpAddDispatchOperationContext *context,
-    const gchar *message)
-{
-  GError *error = g_error_new_literal (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-      message);
-
-  tp_add_dispatch_operation_context_fail (context, error);
-  g_error_free (error);
-}
-
-/* gjs doesn't cope with tp_proxy_get_invalidated() returning a GError */
-gboolean shell_is_channel_invalidated (TpChannel *channel)
-{
-  return tp_proxy_get_invalidated (channel) != NULL;
-}
diff --git a/src/shell-tp-client.h b/src/shell-tp-client.h
index c39c78f..107bcb4 100644
--- a/src/shell-tp-client.h
+++ b/src/shell-tp-client.h
@@ -100,12 +100,5 @@ void shell_tp_client_set_contact_list_changed_func (ShellTpClient *self,
 void shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
     TpConnection *conn);
 
-/* Telepathy utility functions */
-
-void shell_decline_dispatch_op (TpAddDispatchOperationContext *context,
-                                const gchar *message);
-
-gboolean shell_is_channel_invalidated (TpChannel *channel);
-
 G_END_DECLS
 #endif /* __SHELL_TP_CLIENT_H__ */



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