예제 #1
0
QStringList MDConfAgent::listDirs(const QString &key) const
{
    QStringList children;
    gint length = 0;
    QByteArray k = convertKey(priv->prefix + key);
    //qDebug() << "MDConfItem::listDirs" << k;

    gchar **dirs = dconf_client_list(priv->client, k.data(), &length);
    GError *error = NULL;

    for (gint x = 0; x < length; x++) {
      const gchar *dir = g_strdup_printf ("%s%s", k.data(), dirs[x]);
      if (dconf_is_dir(dir, &error)) {
        // We have to mimic how gconf was behaving.
        // so we need to chop off trailing slashes.
        // dconf will also barf if it gets a "path" with 2 slashes.
        QString d = convertKey(dir);
        g_free ((gpointer)dir);
        //qDebug() << "have dir:" << d;
        if (d.endsWith("/")) {
          d.chop(1);
        }
        children.append(d);
      }
    }

    g_strfreev(dirs);

    return children;
}
예제 #2
0
파일: utils.c 프로젝트: Cordia/dawati-shell
gboolean
dconf_recursive_unset (const char *dir,
    GError **error)
{
  DConfClient *client = dconf_client_new (NULL, NULL, NULL, NULL);
  gboolean r;

  g_return_val_if_fail (dconf_is_dir (dir, error), FALSE);

  r = dconf_client_write (client, dir, NULL, NULL, NULL, error);

  g_object_unref (client);

  return r;
}