[Pkg-telepathy-commits] [telepathy-mission-control-6] 185/280: McdStorage: remove "owns" method
Simon McVittie
smcv at debian.org
Thu Mar 27 20:07:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.
commit cb5879dda2daedee866f1f516c952c33e4728560
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed Nov 13 20:21:49 2013 +0000
McdStorage: remove "owns" method
We now know whose account it is, without having to do this.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=27727
---
mission-control-plugins/account-storage.c | 45 -------------------------------
mission-control-plugins/account-storage.h | 7 -----
src/mcd-storage.c | 15 +++--------
tests/twisted/dbus-account-plugin.c | 17 ------------
4 files changed, 4 insertions(+), 80 deletions(-)
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c
index b64e998..098e336 100644
--- a/mission-control-plugins/account-storage.c
+++ b/mission-control-plugins/account-storage.c
@@ -65,7 +65,6 @@
* iface->get_additional_info = foo_plugin_get_additional_info;
* iface->get_restrictions = foo_plugin_get_restrictions;
* iface->create = foo_plugin_create;
- * iface->owns = foo_plugin_owns;
* iface->set_attribute = foo_plugin_set_attribute;
* iface->set_parameter = foo_plugin_set_parameter;
* }
@@ -219,19 +218,6 @@ default_set_parameter (McpAccountStorage *storage,
return FALSE;
}
-static gboolean
-default_owns (McpAccountStorage *storage,
- McpAccountManager *am,
- const gchar *account)
-{
- /* This has the side-effect of pushing the "manager" key back into @am,
- * but that should be a no-op in practice: we always call this
- * method in priority order and stop at the first one that says "yes",
- * and @am's idea of what "manager" is should have come from that same
- * plugin anyway. */
- return mcp_account_storage_get (storage, am, account, "manager");
-}
-
static void
class_init (gpointer klass,
gpointer data)
@@ -249,7 +235,6 @@ class_init (gpointer klass,
iface->get_identifier = default_get_identifier;
iface->get_additional_info = default_get_additional_info;
iface->get_restrictions = default_get_restrictions;
- iface->owns = default_owns;
iface->set_attribute = default_set_attribute;
iface->set_parameter = default_set_parameter;
@@ -1086,33 +1071,3 @@ mcp_account_storage_emit_reconnect (McpAccountStorage *storage,
{
g_signal_emit (storage, signals[RECONNECT], 0, account);
}
-
-/**
- * mcp_account_storage_owns:
- * @storage: an #McpAccountStorage instance
- * @am: an #McpAccountManager instance
- * @account: the unique name (object-path tail) of an account
- *
- * Check whether @account is stored in @storage. The highest-priority
- * plugin for which this function returns %TRUE is considered to be
- * responsible for @account.
- *
- * There is a default implementation, which calls mcp_account_storage_get()
- * for the well-known key "manager".
- *
- * Returns: %TRUE if @account is stored in @storage
- *
- * Since: 5.15.0
- */
-gboolean
-mcp_account_storage_owns (McpAccountStorage *storage,
- McpAccountManager *am,
- const gchar *account)
-{
- McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage);
-
- g_return_val_if_fail (iface != NULL, FALSE);
- g_return_val_if_fail (iface->owns != NULL, FALSE);
-
- return iface->owns (storage, am, account);
-}
diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h
index ff3633e..44f7bd6 100644
--- a/mission-control-plugins/account-storage.h
+++ b/mission-control-plugins/account-storage.h
@@ -124,9 +124,6 @@ struct _McpAccountStorageIface
McpAccountStorageCreate create;
/* Since 5.15.0 */
- gboolean (*owns) (McpAccountStorage *storage,
- McpAccountManager *am,
- const gchar *account);
gboolean (*set_attribute) (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
@@ -193,10 +190,6 @@ const gchar *mcp_account_storage_name (const McpAccountStorage *storage);
const gchar *mcp_account_storage_description (const McpAccountStorage *storage);
const gchar *mcp_account_storage_provider (const McpAccountStorage *storage);
-gboolean mcp_account_storage_owns (McpAccountStorage *storage,
- McpAccountManager *am,
- const gchar *account);
-
gboolean mcp_account_storage_set_attribute (McpAccountStorage *storage,
McpAccountManager *am,
const gchar *account,
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index 020c037..92a2eef 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -727,22 +727,15 @@ McpAccountStorage *
mcd_storage_get_plugin (McdStorage *self,
const gchar *account)
{
- GList *store = stores;
- McpAccountManager *ma = MCP_ACCOUNT_MANAGER (self);
- McpAccountStorage *owner = NULL;
+ McdStorageAccount *sa;
g_return_val_if_fail (MCD_IS_STORAGE (self), NULL);
g_return_val_if_fail (account != NULL, NULL);
- for (; store != NULL && owner == NULL; store = g_list_next (store))
- {
- McpAccountStorage *plugin = store->data;
-
- if (mcp_account_storage_owns (plugin, ma, account))
- owner = plugin;
- }
+ sa = lookup_account (self, account);
+ g_return_val_if_fail (account != NULL, NULL);
- return owner;
+ return sa->plugin;
}
/*
diff --git a/tests/twisted/dbus-account-plugin.c b/tests/twisted/dbus-account-plugin.c
index 01410a1..733fbef 100644
--- a/tests/twisted/dbus-account-plugin.c
+++ b/tests/twisted/dbus-account-plugin.c
@@ -1552,22 +1552,6 @@ test_dbus_account_plugin_get_restrictions (const McpAccountStorage *storage,
return account->restrictions;
}
-static gboolean
-test_dbus_account_plugin_owns (McpAccountStorage *storage,
- McpAccountManager *am,
- const gchar *account_name)
-{
- TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage);
- Account *account = lookup_account (self, account_name);
-
- DEBUG ("%s", account_name);
-
- if (!self->active || account == NULL)
- return FALSE;
-
- return TRUE;
-}
-
static void
account_storage_iface_init (McpAccountStorageIface *iface)
{
@@ -1588,5 +1572,4 @@ account_storage_iface_init (McpAccountStorageIface *iface)
iface->get_additional_info = test_dbus_account_plugin_get_additional_info;
iface->get_restrictions = test_dbus_account_plugin_get_restrictions;
iface->create = test_dbus_account_plugin_create;
- iface->owns = test_dbus_account_plugin_owns;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-6.git
More information about the Pkg-telepathy-commits
mailing list