From ee833a0f946f1eaecc45484041d4034bff9da752 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 12 Nov 2013 19:30:17 +0000 Subject: [PATCH 06/26] Remove unused code [adjusted to apply at a different position in the branch -smcv] --- mission-control-plugins/account.c | 109 ------------------------------- mission-control-plugins/account.h | 19 ------ mission-control-plugins/implementation.h | 16 ----- src/mcd-storage.c | 76 --------------------- 4 files changed, 220 deletions(-) diff --git a/mission-control-plugins/account.c b/mission-control-plugins/account.c index 493a34c..c9859d7 100644 --- a/mission-control-plugins/account.c +++ b/mission-control-plugins/account.c @@ -191,31 +191,6 @@ mcp_account_manager_list_keys (const McpAccountManager *mcpa, } /** - * mcp_account_manager_get_value: - * @mcpa: an #McpAccountManager instance - * @account: the unique name of an account - * @key: the setting whose value we wish to fetch: either an attribute - * like "DisplayName", or "param-" plus a parameter like "account" - * - * Fetch a copy of the current value of an account setting held by - * the account manager. - * - * Returns: (transfer full): the value of @key - */ -gchar * -mcp_account_manager_get_value (const McpAccountManager *mcpa, - const gchar *account, - const gchar *key) -{ - McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa); - - g_return_val_if_fail (iface != NULL, NULL); - g_return_val_if_fail (iface->set_value != NULL, NULL); - - return iface->get_value (mcpa, account, key); -} - -/** * mcp_account_manager_get_unique_name: * @mcpa: an #McpAccountManager instance * @manager: the name of the manager @@ -292,34 +267,6 @@ mcp_account_manager_identify_account_finish (McpAccountManager *mcpa, } /** - * mcp_account_manager_escape_value_from_keyfile: - * @mcpa: a #McpAccountManager - * @value: a value with a supported #GType - * - * Escape @value so it could be passed to g_key_file_set_value(). - * For instance, escaping the boolean value TRUE returns "true", - * and escaping the string value containing one space returns "\s". - * - * It is a programming error to use an unsupported type. - * The supported types are currently %G_TYPE_STRING, %G_TYPE_BOOLEAN, - * %G_TYPE_INT, %G_TYPE_UINT, %G_TYPE_INT64, %G_TYPE_UINT64, %G_TYPE_UCHAR, - * %G_TYPE_STRV, %DBUS_TYPE_G_OBJECT_PATH and %TP_ARRAY_TYPE_OBJECT_PATH_LIST. - * - * Returns: the escaped form of @value - */ -gchar * -mcp_account_manager_escape_value_for_keyfile (const McpAccountManager *mcpa, - const GValue *value) -{ - McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa); - - g_return_val_if_fail (iface != NULL, NULL); - g_return_val_if_fail (iface->escape_value_for_keyfile != NULL, NULL); - - return iface->escape_value_for_keyfile (mcpa, value); -} - -/** * mcp_account_manager_escape_variant_for_keyfile: * @mcpa: a #McpAccountManager * @variant: a #GVariant with a supported #GVariantType @@ -348,59 +295,3 @@ mcp_account_manager_escape_variant_for_keyfile (const McpAccountManager *mcpa, return iface->escape_variant_for_keyfile (mcpa, variant); } - -/** - * mcp_account_manager_unescape_value_from_keyfile: - * @mcpa: a #McpAccountManager - * @escaped: an escaped string as returned by g_key_file_get_value() - * @value: a value to populate, with a supported #GType - * @error: used to raise an error if %FALSE is returned - * - * Attempt to interpret @escaped as a value of @value's type. - * If successful, put it in @value and return %TRUE. - * - * It is a programming error to try to escape an unsupported type. - * The supported types are currently %G_TYPE_STRING, %G_TYPE_BOOLEAN, - * %G_TYPE_INT, %G_TYPE_UINT, %G_TYPE_INT64, %G_TYPE_UINT64, %G_TYPE_UCHAR, - * %G_TYPE_STRV, %DBUS_TYPE_G_OBJECT_PATH and %TP_ARRAY_TYPE_OBJECT_PATH_LIST. - * - * Returns: %TRUE if @value was filled in - */ -gboolean -mcp_account_manager_unescape_value_from_keyfile (const McpAccountManager *mcpa, - const gchar *escaped, - GValue *value, - GError **error) -{ - McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa); - - g_return_val_if_fail (iface != NULL, FALSE); - g_return_val_if_fail (iface->unescape_value_from_keyfile != NULL, FALSE); - - return iface->unescape_value_from_keyfile (mcpa, escaped, value, error); -} - -/** - * mcp_account_manager_init_value_for_attribute: - * @mcpa: a #McpAccountManager - * @value: a zero-filled value to initialize - * @attribute: a supported Mission Control attribute - * - * If @attribute is a known Mission Control attribute, initialize @value - * with an appropriate type for @attribute and return %TRUE. Otherwise, - * return %FALSE. - * - * Returns: %TRUE if @value was initialized - */ -gboolean -mcp_account_manager_init_value_for_attribute (const McpAccountManager *mcpa, - GValue *value, - const gchar *attribute) -{ - McpAccountManagerIface *iface = MCP_ACCOUNT_MANAGER_GET_IFACE (mcpa); - - g_return_val_if_fail (iface != NULL, FALSE); - g_return_val_if_fail (iface->init_value_for_attribute != NULL, FALSE); - - return iface->init_value_for_attribute (mcpa, value, attribute); -} diff --git a/mission-control-plugins/account.h b/mission-control-plugins/account.h index c283ef9..4356b3c 100644 --- a/mission-control-plugins/account.h +++ b/mission-control-plugins/account.h @@ -62,10 +62,6 @@ void mcp_account_manager_set_parameter (const McpAccountManager *mcpa, GVariant *value, McpParameterFlags flags); -gchar * mcp_account_manager_get_value (const McpAccountManager *mcpa, - const gchar *account, - const gchar *key); - gchar * mcp_account_manager_get_unique_name (McpAccountManager *mcpa, const gchar *manager, const gchar *protocol, @@ -74,25 +70,10 @@ gchar * mcp_account_manager_get_unique_name (McpAccountManager *mcpa, GStrv mcp_account_manager_list_keys (const McpAccountManager *mcpa, const gchar *account); -gchar *mcp_account_manager_escape_value_for_keyfile ( - const McpAccountManager *mcpa, - const GValue *value); - gchar *mcp_account_manager_escape_variant_for_keyfile ( const McpAccountManager *mcpa, GVariant *variant); -gboolean mcp_account_manager_unescape_value_from_keyfile ( - const McpAccountManager *mcpa, - const gchar *escaped, - GValue *value, - GError **error); - -gboolean mcp_account_manager_init_value_for_attribute ( - const McpAccountManager *mcpa, - GValue *value, - const gchar *attribute); - void mcp_account_manager_identify_account_async (McpAccountManager *mcpa, const gchar *manager, const gchar *protocol, diff --git a/mission-control-plugins/implementation.h b/mission-control-plugins/implementation.h index 9cc04b4..9d44b3b 100644 --- a/mission-control-plugins/implementation.h +++ b/mission-control-plugins/implementation.h @@ -82,10 +82,6 @@ struct _McpAccountManagerIface { const gchar *key, const gchar *value); - gchar * (*get_value) (const McpAccountManager *ma, - const gchar *acct, - const gchar *key); - gchar * (* unique_name) (const McpAccountManager *ma, const gchar *manager, const gchar *protocol, @@ -94,18 +90,6 @@ struct _McpAccountManagerIface { GStrv (* list_keys) (const McpAccountManager *ma, const gchar *acct); - gchar * (* escape_value_for_keyfile) (const McpAccountManager *mcpa, - const GValue *value); - - gboolean (* unescape_value_from_keyfile) (const McpAccountManager *mcpa, - const gchar *escaped, - GValue *value, - GError **error); - - gboolean (* init_value_for_attribute) (const McpAccountManager *mcpa, - GValue *value, - const gchar *attribute); - gchar * (* escape_variant_for_keyfile) (const McpAccountManager *mcpa, GVariant *variant); diff --git a/src/mcd-storage.c b/src/mcd-storage.c index 5caafbc..47822a8 100644 --- a/src/mcd-storage.c +++ b/src/mcd-storage.c @@ -224,54 +224,6 @@ ensure_account (McdStorage *self, return sa; } -static gchar * -get_value (const McpAccountManager *ma, - const gchar *account, - const gchar *key) -{ - McdStorage *self = MCD_STORAGE (ma); - McdStorageAccount *sa = lookup_account (self, account); - GVariant *variant; - gchar *ret; - - if (sa == NULL) - return NULL; - - if (g_str_has_prefix (key, "param-")) - { - variant = g_hash_table_lookup (sa->parameters, key + 6); - - if (variant != NULL) - { - ret = mcd_keyfile_escape_variant (variant); - g_variant_unref (variant); - return ret; - } - else - { - /* OK, we don't have it as a variant. How about the keyfile-escaped - * version? */ - return g_strdup (g_hash_table_lookup (sa->escaped_parameters, - key + 6)); - } - } - else - { - variant = g_hash_table_lookup (sa->attributes, key); - - if (variant != NULL) - { - ret = mcd_keyfile_escape_variant (variant); - g_variant_unref (variant); - return ret; - } - else - { - return NULL; - } - } -} - static struct { const gchar *type; const gchar *name; @@ -379,14 +331,6 @@ mcd_storage_init_value_for_attribute (GValue *value, return FALSE; } -static gboolean -mcpa_init_value_for_attribute (const McpAccountManager *mcpa, - GValue *value, - const gchar *attribute) -{ - return mcd_storage_init_value_for_attribute (value, attribute); -} - static void mcpa_set_attribute (const McpAccountManager *ma, const gchar *account, @@ -993,15 +937,6 @@ mcd_storage_get_parameter (McdStorage *self, return mcd_keyfile_unescape_value (escaped, value, error); } -static gboolean -mcpa_unescape_value_from_keyfile (const McpAccountManager *unused G_GNUC_UNUSED, - const gchar *escaped, - GValue *value, - GError **error) -{ - return mcd_keyfile_unescape_value (escaped, value, error); -} - /* * @escaped: a keyfile-escaped string * @value: a #GValue initialized with a supported #GType @@ -1709,13 +1644,6 @@ mcd_storage_set_parameter (McdStorage *self, return updated; } -static gchar * -mcpa_escape_value_for_keyfile (const McpAccountManager *unused G_GNUC_UNUSED, - const GValue *value) -{ - return mcd_keyfile_escape_value (value); -} - /* * @value: a populated #GValue of a supported #GType * @@ -2200,7 +2128,6 @@ plugin_iface_init (McpAccountManagerIface *iface, { DEBUG (); - iface->get_value = get_value; iface->set_value = set_value; iface->set_attribute = mcpa_set_attribute; iface->set_parameter = mcpa_set_parameter; @@ -2208,10 +2135,7 @@ plugin_iface_init (McpAccountManagerIface *iface, iface->identify_account_async = identify_account_async; iface->identify_account_finish = identify_account_finish; iface->list_keys = list_keys; - iface->escape_value_for_keyfile = mcpa_escape_value_for_keyfile; iface->escape_variant_for_keyfile = mcpa_escape_variant_for_keyfile; - iface->unescape_value_from_keyfile = mcpa_unescape_value_from_keyfile; - iface->init_value_for_attribute = mcpa_init_value_for_attribute; } gboolean -- 1.8.4.3