Esempio n. 1
0
static void
listify_foreach(const gchar* key, Entry* e, ListifyData* ld)
{
  GConfValue* val;
  GConfEntry* entry;
  GError* error = NULL;
  
  val = entry_get_value (e, ld->locales, &error);

  if (error != NULL)
    {
      g_assert (val == NULL);
      g_error_free (error);
      return;
    }
  
  entry = gconf_entry_new_nocopy (g_strdup(key),
                                  val ? gconf_value_copy(val) : NULL);
  
  if (entry_get_schema_name (e))
    {
      gconf_entry_set_schema_name (entry, entry_get_schema_name (e));
    }
  
  ld->list = g_slist_prepend(ld->list, entry);
}
Esempio n. 2
0
/* Get a list of entries from an array. */
GSList *
gconf_dbus_utils_get_entries (DBusMessageIter *iter, const gchar *dir)
{
  GSList *entries;
  DBusMessageIter array_iter;

  entries = NULL;

  dbus_message_iter_recurse (iter, &array_iter);

  /* Loop through while there are structs (entries). */
  while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRUCT)
    {
      gchar      *key;
      GConfValue *value;
      gboolean    is_default;
      gboolean    is_writable;
      gchar      *schema_name;
      GConfEntry *entry;

      if (!utils_get_entry_values_stringified (&array_iter,
					       &key,
					       &value,
					       &is_default,
					       &is_writable,
					       &schema_name))
	break;

      entry = gconf_entry_new_nocopy (gconf_concat_dir_and_key (dir, key), value);

      gconf_entry_set_is_default (entry, is_default);
      gconf_entry_set_is_writable (entry, is_writable);
      
      if (schema_name)
	gconf_entry_set_schema_name (entry, schema_name);
      
      entries = g_slist_prepend (entries, entry);
      
      dbus_message_iter_next (&array_iter);
    }

  return entries;
}