[gnome-shell] TelepathyClient: remove subscription request notifications
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] TelepathyClient: remove subscription request notifications
- Date: Tue, 3 Mar 2015 22:33:06 +0000 (UTC)
commit 38a2f26e44f4abb9828d486c4a9502eb0843996b
Author: Giovanni Campagna <scampa giovanni gmail com>
Date: Tue Mar 3 00:09:05 2015 -0800
TelepathyClient: remove subscription request notifications
The ones handled by empathy are just fine
https://bugzilla.gnome.org/show_bug.cgi?id=745503
js/ui/components/telepathyClient.js | 145 -----------------------------------
src/shell-tp-client.c | 58 --------------
src/shell-tp-client.h | 14 ----
3 files changed, 0 insertions(+), 217 deletions(-)
---
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 0690fed..d99a969 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -105,15 +105,8 @@ const TelepathyClient = new Lang.Class({
this._tpClient.set_handle_channels_func(
Lang.bind(this, this._handleChannels));
- // Watch subscription requests and connection errors
- this._subscriptionSource = null;
this._accountSource = null;
- // Workaround for gjs not supporting GPtrArray in signals.
- // See BGO bug #653941 for context.
- this._tpClient.set_contact_list_changed_func(
- Lang.bind(this, this._contactListChanged));
-
// Allow other clients (such as Empathy) to pre-empt our channels if
// needed
this._tpClient.set_delegated_channels_callback(
@@ -347,52 +340,6 @@ const TelepathyClient = new Lang.Class({
// See discussion in https://bugzilla.gnome.org/show_bug.cgi?id=654159
account.connect("notify::connection-status",
Lang.bind(this, this._accountConnectionStatusNotifyCb));
-
- account.connect('notify::connection',
- Lang.bind(this, this._connectionChanged));
- this._connectionChanged(account);
- },
-
- _connectionChanged: function(account) {
- let conn = account.get_connection();
- if (conn == null)
- return;
-
- this._tpClient.grab_contact_list_changed(conn);
- if (conn.get_contact_list_state() == Tp.ContactListState.SUCCESS) {
- this._contactListChanged(conn, conn.dup_contact_list(), []);
- }
- },
-
- _contactListChanged: function(conn, added, removed) {
- for (let i = 0; i < added.length; i++) {
- let contact = added[i];
-
- contact.connect('subscription-states-changed',
- Lang.bind(this, this._subscriptionStateChanged));
- this._subscriptionStateChanged(contact);
- }
- },
-
- _subscriptionStateChanged: function(contact) {
- if (contact.get_publish_state() != Tp.SubscriptionState.ASK)
- return;
-
- /* Implicitly accept publish requests if contact is already subscribed */
- if (contact.get_subscribe_state() == Tp.SubscriptionState.YES ||
- contact.get_subscribe_state() == Tp.SubscriptionState.ASK) {
-
- contact.authorize_publication_async(function(src, result) {
- src.authorize_publication_finish(result)});
-
- return;
- }
-
- /* Display notification to ask user to accept/reject request */
- let source = this._ensureAppSource();
-
- let notif = new SubscriptionRequestNotification(source, contact);
- source.notify(notif);
},
_accountConnectionStatusNotifyCb: function(account) {
@@ -1226,98 +1173,6 @@ const FileTransferNotification = new Lang.Class({
}
});
-// Subscription request
-const SubscriptionRequestNotification = new Lang.Class({
- Name: 'SubscriptionRequestNotification',
- Extends: MessageTray.Notification,
-
- _init: function(source, contact) {
- this.parent(source,
- /* To translators: The parameter is the contact's alias */
- _("%s would like permission to see when you are online").format(contact.get_alias()),
- null);
-
- this._contact = contact;
- this._connection = contact.get_connection();
-
- this._changedId = contact.connect('subscription-states-changed',
- Lang.bind(this, this._subscriptionStatesChangedCb));
- this._invalidatedId = this._connection.connect('invalidated',
- Lang.bind(this, this.destroy));
- },
-
- createBanner: function() {
- let banner = new MessageTray.NotificationBanner(this);
-
- let layout = new St.BoxLayout({ vertical: false });
-
- // Display avatar
- let iconBox = new St.Bin({ style_class: 'avatar-box' });
- iconBox._size = 48;
-
- let textureCache = St.TextureCache.get_default();
- let file = this._contact.get_avatar_file();
-
- if (file) {
- let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
- iconBox.child = textureCache.load_file_async(file, iconBox._size, iconBox._size, scaleFactor);
- }
- else {
- iconBox.child = new St.Icon({ icon_name: 'avatar-default',
- icon_size: iconBox._size });
- }
-
- layout.add(iconBox);
-
- // subscription request message
- let label = new St.Label({ style_class: 'subscription-message',
- text: this._contact.get_publish_request() });
-
- layout.add(label);
-
- banner.setExpandedBody(layout);
-
- banner.addAction(_("Decline"), Lang.bind(this, function() {
- this._contact.remove_async(function(src, result) {
- src.remove_finish(result);
- });
- }));
- banner.addAction(_("Accept"), Lang.bind(this, function() {
- // Authorize the contact and request to see his status as well
- this._contact.authorize_publication_async(function(src, result) {
- src.authorize_publication_finish(result);
- });
-
- this._contact.request_subscription_async('', function(src, result) {
- src.request_subscription_finish(result);
- });
- }));
-
- return banner;
- },
-
- destroy: function() {
- if (this._changedId != 0) {
- this._contact.disconnect(this._changedId);
- this._changedId = 0;
- }
-
- if (this._invalidatedId != 0) {
- this._connection.disconnect(this._invalidatedId);
- this._invalidatedId = 0;
- }
-
- this.parent();
- },
-
- _subscriptionStatesChangedCb: function(contact, subscribe, publish, msg) {
- // Destroy the notification if the subscription request has been
- // answered
- if (publish != Tp.SubscriptionState.ASK)
- this.destroy();
- }
-});
-
// Messages from empathy/libempathy/empathy-utils.c
// create_errors_to_message_hash()
diff --git a/src/shell-tp-client.c b/src/shell-tp-client.c
index 400b829..817700e 100644
--- a/src/shell-tp-client.c
+++ b/src/shell-tp-client.c
@@ -21,10 +21,6 @@ struct _ShellTpClientPrivate
ShellTpClientHandleChannelsImpl handle_channels_impl;
gpointer user_data_handle_channels;
GDestroyNotify destroy_handle_channels;
-
- ShellTpClientContactListChangedImpl contact_list_changed_impl;
- gpointer user_data_contact_list_changed;
- GDestroyNotify destroy_contact_list_changed;
};
/**
@@ -83,16 +79,6 @@ struct _ShellTpClientPrivate
* Signature of the implementation of the HandleChannels method.
*/
-/**
- * ShellTpClientContactListChangedImpl:
- * @connection: a #TpConnection having %TP_CONNECTION_FEATURE_CORE prepared
- * if possible
- * @added: (element-type TelepathyGLib.Contact): a #GPtrArray of added #TpContact
- * @removed: (element-type TelepathyGLib.Contact): a #GPtrArray of removed #TpContact
- *
- * Signature of the implementation of the ContactListChanged method.
- */
-
static void
shell_tp_client_init (ShellTpClient *self)
{
@@ -226,13 +212,6 @@ shell_tp_client_dispose (GObject *object)
self->priv->user_data_handle_channels = NULL;
}
- if (self->priv->destroy_contact_list_changed != NULL)
- {
- self->priv->destroy_contact_list_changed (self->priv->user_data_contact_list_changed);
- self->priv->destroy_contact_list_changed = NULL;
- self->priv->user_data_contact_list_changed = NULL;
- }
-
if (dispose != NULL)
dispose (object);
}
@@ -290,40 +269,3 @@ shell_tp_client_set_handle_channels_func (ShellTpClient *self,
self->priv->user_data_handle_channels = user_data;
self->priv->destroy_handle_channels = destroy;
}
-
-void
-shell_tp_client_set_contact_list_changed_func (ShellTpClient *self,
- ShellTpClientContactListChangedImpl contact_list_changed_impl,
- gpointer user_data,
- GDestroyNotify destroy)
-{
- g_assert (self->priv->contact_list_changed_impl == NULL);
-
- self->priv->contact_list_changed_impl = contact_list_changed_impl;
- self->priv->user_data_handle_channels = user_data;
- self->priv->destroy_handle_channels = destroy;
-}
-
-static void
-on_contact_list_changed (TpConnection *conn,
- GPtrArray *added,
- GPtrArray *removed,
- gpointer user_data)
-{
- ShellTpClient *self = (ShellTpClient *) user_data;
-
- g_assert (self->priv->contact_list_changed_impl != NULL);
-
- self->priv->contact_list_changed_impl (conn,
- added, removed,
- self->priv->user_data_contact_list_changed);
-}
-
-void
-shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
- TpConnection *conn)
-{
- g_signal_connect (conn, "contact-list-changed",
- G_CALLBACK (on_contact_list_changed),
- self);
-}
diff --git a/src/shell-tp-client.h b/src/shell-tp-client.h
index 107bcb4..15bcf75 100644
--- a/src/shell-tp-client.h
+++ b/src/shell-tp-client.h
@@ -86,19 +86,5 @@ void shell_tp_client_set_handle_channels_func (ShellTpClient *self,
gpointer user_data,
GDestroyNotify destroy);
-typedef void (*ShellTpClientContactListChangedImpl) (
- TpConnection *connection,
- GPtrArray *added,
- GPtrArray *removed,
- gpointer user_data);
-
-void shell_tp_client_set_contact_list_changed_func (ShellTpClient *self,
- ShellTpClientContactListChangedImpl contact_list_changed_impl,
- gpointer user_data,
- GDestroyNotify destroy);
-
-void shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
- TpConnection *conn);
-
G_END_DECLS
#endif /* __SHELL_TP_CLIENT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]