telepathy-mission-control: McpAccountStorage: add functions to emit interface' signals
Xavier Claessens
xclaesse at kemper.freedesktop.org
Wed Sep 5 03:57:33 PDT 2012
Module: telepathy-mission-control
Branch: master
Commit: 23b91753f3460a0e4b52a1b9c4cec98603ff9c5c
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=23b91753f3460a0e4b52a1b9c4cec98603ff9c5c
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Wed Sep 5 12:02:20 2012 +0200
McpAccountStorage: add functions to emit interface' signals
---
mission-control-plugins/account-storage.c | 81 +++++++++++++++++++++++++++--
mission-control-plugins/account-storage.h | 13 +++++
src/mcd-account-manager-sso.c | 12 ++--
3 files changed, 96 insertions(+), 10 deletions(-)
diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c
index ca7bbe2..1673cf2 100644
--- a/mission-control-plugins/account-storage.c
+++ b/mission-control-plugins/account-storage.c
@@ -132,7 +132,7 @@ class_init (gpointer klass,
/**
* McpAccountStorage::altered
- * @account: the unique name of the created account
+ * @account: the unique name of the altered account
*
* emitted if an external entity alters an account
* in the backend the emitting plugin handles
@@ -149,7 +149,7 @@ class_init (gpointer klass,
/**
* McpAccountStorage::altered-one
- * @account: the unique name of the created account
+ * @account: the unique name of the altered account
* @name: the name of the altered property (its key)
*
* emitted if an external entity alters an account
@@ -168,7 +168,7 @@ class_init (gpointer klass,
/**
* McpAccountStorage::deleted
- * @account: the unique name of the created account
+ * @account: the unique name of the deleted account
*
* emitted if an external entity deletes an account
* in the backend the emitting plugin handles
@@ -183,7 +183,7 @@ class_init (gpointer klass,
/**
* McpAccountStorage::toggled
- * @account: the unique name of the created account
+ * @account: the unique name of the toggled account
* @enabled: #gboolean indicating whether the account is enabled
*
* emitted if an external entity enables/disables an account
@@ -792,3 +792,76 @@ mcp_account_storage_provider (const McpAccountStorage *storage)
return iface->provider != NULL ? iface->provider : "";
}
+
+/**
+ * mcp_account_storage_emit_create:
+ * @storage: an #McpAccountStorage instance
+ * @account: the unique name of the created account
+ *
+ * Emits ::created signal
+ */
+void
+mcp_account_storage_emit_created (McpAccountStorage *storage,
+ const gchar *account)
+{
+ g_signal_emit (storage, signals[CREATED], 0, account);
+}
+
+/**
+ * mcp_account_storage_emit_altered:
+ * @storage: an #McpAccountStorage instance
+ * @account: the unique name of the altered account
+ *
+ * Emits ::altered signal
+ */
+void
+mcp_account_storage_emit_altered (McpAccountStorage *storage,
+ const gchar *account)
+{
+ g_signal_emit (storage, signals[ALTERED], 0, account);
+}
+
+/**
+ * mcp_account_storage_emit_altered_one:
+ * @storage: an #McpAccountStorage instance
+ * @account: the unique name of the altered account
+ * @key: the key of the altered property
+ *
+ * Emits ::created-one signal
+ */
+void
+mcp_account_storage_emit_altered_one (McpAccountStorage *storage,
+ const gchar *account,
+ const gchar *key)
+{
+ g_signal_emit (storage, signals[ALTERED_ONE], 0, account, key);
+}
+
+/**
+ * mcp_account_storage_emit_deleted:
+ * @storage: an #McpAccountStorage instance
+ * @account: the unique name of the deleted account
+ *
+ * Emits ::deleted signal
+ */
+void
+mcp_account_storage_emit_deleted (McpAccountStorage *storage,
+ const gchar *account)
+{
+ g_signal_emit (storage, signals[DELETED], 0, account);
+}
+
+/**
+ * mcp_account_storage_emit_toggled:
+ * @storage: an #McpAccountStorage instance
+ * @account: the unique name of the account
+ *
+ * Emits ::toggled signal
+ */
+void
+mcp_account_storage_emit_toggled (McpAccountStorage *storage,
+ const gchar *account,
+ gboolean enabled)
+{
+ g_signal_emit (storage, signals[TOGGLED], 0, account, enabled);
+}
diff --git a/mission-control-plugins/account-storage.h b/mission-control-plugins/account-storage.h
index 460a71f..68469c6 100644
--- a/mission-control-plugins/account-storage.h
+++ b/mission-control-plugins/account-storage.h
@@ -220,6 +220,19 @@ 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);
+void mcp_account_storage_emit_created (McpAccountStorage *storage,
+ const gchar *account);
+void mcp_account_storage_emit_altered (McpAccountStorage *storage,
+ const gchar *account);
+void mcp_account_storage_emit_altered_one (McpAccountStorage *storage,
+ const gchar *account,
+ const gchar *key);
+void mcp_account_storage_emit_deleted (McpAccountStorage *storage,
+ const gchar *account);
+void mcp_account_storage_emit_toggled (McpAccountStorage *storage,
+ const gchar *account,
+ gboolean enabled);
+
G_END_DECLS
#endif
diff --git a/src/mcd-account-manager-sso.c b/src/mcd-account-manager-sso.c
index a562a2a..3be991e 100644
--- a/src/mcd-account-manager-sso.c
+++ b/src/mcd-account-manager-sso.c
@@ -489,7 +489,7 @@ static void _sso_updated (AgAccount *account,
if (g_str_has_prefix (mc_key, MCPP))
params_updated = TRUE;
else
- g_signal_emit_by_name (mcpa, "altered-one", name, mc_key);
+ mcp_account_storage_emit_altered_one (mcpa, name, mc_key);
}
}
@@ -518,14 +518,14 @@ static void _sso_updated (AgAccount *account,
if (g_str_has_prefix (deleted_key, MCPP))
params_updated = TRUE;
else
- g_signal_emit_by_name (mcpa, "altered-one", name, deleted_key);
+ mcp_account_storage_emit_altered_one (mcpa, name, deleted_key);
}
g_hash_table_unref (unseen);
g_strfreev (keys);
if (params_updated)
- g_signal_emit_by_name (mcpa, "altered-one", name, "Parameters");
+ mcp_account_storage_emit_altered_one (mcpa, name, "Parameters");
/* put the selected service back the way it was when we found it */
ag_account_select_service (account, service);
@@ -590,7 +590,7 @@ static void _sso_toggled (GObject *object,
McpAccountManager *am = sso->manager_interface;
mcp_account_manager_set_value (am, name, "Enabled", value);
- g_signal_emit_by_name (mcpa, "toggled", name, on);
+ mcp_account_storage_emit_toggled (mcpa, name, on);
}
else
{
@@ -623,7 +623,7 @@ static void _sso_deleted (GObject *object,
/* stop watching for updates */
unwatch_account_keys (sso, id);
- g_signal_emit_by_name (mcpa, "deleted", signalled_name);
+ mcp_account_storage_emit_deleted (mcpa, signalled_name);
g_free (signalled_name);
}
@@ -742,7 +742,7 @@ static void _sso_created (GObject *object,
ag_account_store (account, _ag_account_stored_cb, sso);
- g_signal_emit_by_name (mcpa, "created", name);
+ mcp_account_storage_emit_created (mcpa, name);
clear_setting_data (setting);
}
More information about the telepathy-commits
mailing list