telepathy-mission-control: mcd_storage_has_value: remove, no longer needed

Simon McVittie smcv at kemper.freedesktop.org
Thu Oct 4 08:19:47 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 76a7c315686a94b7b56c2c5e3cd83de72aed2735
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=76a7c315686a94b7b56c2c5e3cd83de72aed2735

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Sep  7 17:38:32 2012 +0100

mcd_storage_has_value: remove, no longer needed

Now that mcd_storage_dup_value() doesn't make up a value for parameters
that are missing or can't be parsed, we can just rely on dup_value()
raising an error for missing parameters.

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>

---

 src/mcd-account.c |   33 ++++++++++++---------------------
 src/mcd-storage.c |   21 ---------------------
 src/mcd-storage.h |    4 ----
 3 files changed, 12 insertions(+), 46 deletions(-)

diff --git a/src/mcd-account.c b/src/mcd-account.c
index 1693766..0581c9b 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -443,37 +443,28 @@ mcd_account_get_parameter_of_known_type (McdAccount *account,
     const gchar *account_name = mcd_account_get_unique_name (account);
     McdStorage *storage = account->priv->storage;
     gchar key[MAX_KEY_LENGTH];
+    GValue *value;
 
     g_snprintf (key, sizeof (key), "param-%s", name);
 
-    if (mcd_storage_has_value (storage, account_name, key))
+    value = mcd_storage_dup_value (storage, account_name, key,
+        type, error);
+
+    if (value != NULL)
     {
-        GValue *value = mcd_storage_dup_value (storage, account_name, key,
-            type, error);
+        g_assert (G_VALUE_HOLDS (value, type));
 
-        if (value != NULL)
+        if (parameter != NULL)
         {
-            g_assert (G_VALUE_HOLDS (value, type));
-
-            if (parameter != NULL)
-            {
-                g_value_init (parameter, type);
-                g_value_copy (value, parameter);
-            }
-
-            tp_g_value_slice_free (value);
-            return TRUE;
-        }
-        else
-        {
-            return FALSE;
+            g_value_init (parameter, type);
+            g_value_copy (value, parameter);
         }
+
+        tp_g_value_slice_free (value);
+        return TRUE;
     }
     else
     {
-        g_set_error (error, MCD_ACCOUNT_ERROR,
-                     MCD_ACCOUNT_ERROR_GET_PARAMETER,
-                     "Keyfile does not have key %s", key);
         return FALSE;
     }
 }
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index b332bd1..7d02925 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -497,27 +497,6 @@ mcd_storage_dup_string (McdStorage *self,
 }
 
 /*
- * mcd_storage_has_value:
- * @storage: An object implementing the #McdStorage interface
- * @account: unique name of the account
- * @key: name of the setting to be retrieved
- *
- * Returns: a #gboolean: %TRUE if the setting is present in the store,
- * %FALSE otherwise.
- */
-gboolean
-mcd_storage_has_value (McdStorage *self,
-    const gchar *account,
-    const gchar *key)
-{
-  g_return_val_if_fail (MCD_IS_STORAGE (self), FALSE);
-  g_return_val_if_fail (account != NULL, FALSE);
-  g_return_val_if_fail (key != NULL, FALSE);
-
-  return g_key_file_has_key (self->keyfile, account, key, NULL);
-}
-
-/*
  * mcd_storage_dup_value:
  * @storage: An object implementing the #McdStorage interface
  * @account: unique name of the account
diff --git a/src/mcd-storage.h b/src/mcd-storage.h
index c8c031b..30d54ef 100644
--- a/src/mcd-storage.h
+++ b/src/mcd-storage.h
@@ -103,10 +103,6 @@ gchar *mcd_storage_dup_string (McdStorage *storage,
     const gchar *account,
     const gchar *key);
 
-gboolean mcd_storage_has_value (McdStorage *storage,
-    const gchar *account,
-    const gchar *key);
-
 GValue *mcd_storage_dup_value (McdStorage *storage,
     const gchar *account,
     const gchar *key,



More information about the telepathy-commits mailing list