예제 #1
0
파일: xml-dir.c 프로젝트: BARGAN/gconf
static Entry*
dir_make_new_entry(Dir* d, const gchar* relative_key)
{
  Entry* e;

  g_return_val_if_fail(d->doc != NULL, NULL);
  g_return_val_if_fail(d->doc->xmlRootNode != NULL, NULL);
  
  e = entry_new(relative_key);

  entry_set_node(e, xmlNewChild(d->doc->xmlRootNode, NULL, (xmlChar *)"entry", NULL));
  
  safe_g_hash_table_insert(d->entry_cache, (gchar*)entry_get_name(e), e);
  
  return e;
}
예제 #2
0
파일: xml-dir.c 프로젝트: BARGAN/gconf
static gboolean
dir_forget_entry_if_useless(Dir* d, Entry* e)
{
  GConfValue* val;
  
  if (entry_get_schema_name(e) != NULL)
    return FALSE;
  
  val = entry_get_value(e, NULL, NULL);
  
  if (val != NULL)
    return FALSE; /* not useless */
      
  g_hash_table_remove(d->entry_cache, entry_get_name(e));

  entry_destroy(e);

  return TRUE;
}
예제 #3
0
파일: xml-dir.c 프로젝트: BARGAN/gconf
static void
dir_fill_cache_from_doc(Dir* d)
{
  xmlNodePtr node;
  
  if (d->doc == NULL ||
      d->doc->xmlRootNode == NULL ||
      d->doc->xmlRootNode->xmlChildrenNode == NULL)
    {
      /* Empty document - just return. */
      return;
    }

  node = d->doc->xmlRootNode->xmlChildrenNode;

  while (node != NULL)
    {
      if (node->type == XML_ELEMENT_NODE && 
          (strcmp((xmlChar *)node->name, "entry") == 0))
        {
          gchar* attr = my_xmlGetProp(node, "name");

          if (attr != NULL)
            {
              if (g_hash_table_lookup(d->entry_cache, attr) != NULL)
                {
                  gconf_log(GCL_WARNING,
                             _("Duplicate entry `%s' in `%s', ignoring"),
                             attr, d->xml_filename);
                }
              else
                {
                  Entry* e;
                  
                  e = entry_new(attr);

                  entry_set_node(e, node);
                  
                  entry_fill_from_node(e);
                  
                  safe_g_hash_table_insert(d->entry_cache,
                                           (gchar*)entry_get_name(e), e);
                }

              free(attr);
            }
          else
            {
              gconf_log(GCL_WARNING,
                         _("Entry with no name in XML file `%s', ignoring"),
                         d->xml_filename);
            }
        }
      else
        {
          if (node->type == XML_ELEMENT_NODE)
            gconf_log(GCL_WARNING,
                      _("A toplevel node in XML file `%s' is <%s> rather than <entry>, ignoring"),
                      d->xml_filename,
                      node->name ? (char*) node->name : "unknown");
        }
      
      node = node->next;
    }
}
예제 #4
0
static void select_long_click_handler(ClickRecognizerRef recognizer, void *context) {
  // refresh
  entry_get_name(symbol, set_symbol_msg);
  text_layer_set_text(symbol_layer, symbol);
  text_layer_set_text(price_layer, "Loading...");
}