~ubuntu-branches/ubuntu/precise/telepathy-mission-control-5/precise

« back to all changes in this revision

Viewing changes to src/mcd-storage.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonny Lamb
  • Date: 2011-01-17 15:55:24 UTC
  • mto: (0.12.1 upstream) (7.1.4 maverick)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110117155524-l8ex8kr7zhs8nnm6
Tags: upstream-5.7.1
ImportĀ upstreamĀ versionĀ 5.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
}
124
124
 
125
125
/**
 
126
 * mcd_storage_set_strv:
 
127
 * @storage: An object implementing the #McdStorage interface
 
128
 * @account: the unique name of an account
 
129
 * @key: the key (name) of the parameter or setting
 
130
 * @strv: the string vector to be stored (where %NULL is treated as equivalent
 
131
 * to an empty vector)
 
132
 * @secret: whether the value is confidential (might get stored in the
 
133
 * keyring, for example)
 
134
 *
 
135
 * Copies and stores the supplied string vector to the internal cache.
 
136
 *
 
137
 * Returns: a #gboolean indicating whether the cache actually required an
 
138
 * update (so that the caller can decide whether to request a commit to
 
139
 * long term storage or not). %TRUE indicates the cache was updated and
 
140
 * may not be in sync with the store any longer, %FALSE indicates we already
 
141
 * held the value supplied.
 
142
 */
 
143
gboolean
 
144
mcd_storage_set_strv (McdStorage *storage,
 
145
    const gchar *account,
 
146
    const gchar *key,
 
147
    const gchar * const *strv,
 
148
    gboolean secret)
 
149
{
 
150
  McdStorageIface *iface = MCD_STORAGE_GET_IFACE (storage);
 
151
  GValue v = { 0, };
 
152
  static const gchar * const *empty = { NULL };
 
153
  gboolean ret;
 
154
 
 
155
  g_assert (iface != NULL);
 
156
  g_return_val_if_fail (account != NULL, FALSE);
 
157
  g_return_val_if_fail (key != NULL, FALSE);
 
158
  g_return_val_if_fail (iface->set_value != NULL, FALSE);
 
159
 
 
160
  g_value_init (&v, G_TYPE_STRV);
 
161
  g_value_set_static_boxed (&v, strv == NULL ? empty : strv);
 
162
  ret = iface->set_value (storage, account, key, &v, secret);
 
163
  g_value_unset (&v);
 
164
  return ret;
 
165
}
 
166
 
 
167
/**
126
168
 * mcd_storage_commit:
127
169
 * @storage: An object implementing the #McdStorage interface
128
170
 * @account: the unique name of an account