/*
* @return void
- */
+ */
static void* group_func(void *data, xmlNode *xmlObj);
/*
static int __node_walker(PluginNode* context, xmlNode* cur);
-static int __node_finder(PluginNode* context, xmlNode* cur, char* id_str, char* value);
+static int __node_finder(PluginNode* context, xmlNode* cur, char* id_str, char* value, bool* is_end);
static void __drawer_add(const char *type, drawer_fp draw)
#define DBUS_SIGNAL_INTERFACE "org.tizen.setting.signal"
#define DBUS_SIGNAL "test"
-static char* substring(const char* str, size_t begin, size_t len)
-{
- if (str == 0 || strlen(str) == 0 || strlen(str) < begin || strlen(str) < (begin+len))
- return 0;
+static char* substring(const char* str, size_t begin, size_t len)
+{
+ if (str == 0 || strlen(str) == 0 || strlen(str) < begin || strlen(str) < (begin+len))
+ return 0;
- return strndup(str + begin, len);
-}
+ return strndup(str + begin, len);
+}
//------------------------------------------------------
// for client - bus
{
SETTING_TRACE("received key : %s , value : %s", key, value);
//-------------------------------------------------------------
- // received key : checkbox1|N/A , value : INT|1
+ // received key : checkbox1|N/A , value : INT|1
//-------------------------------------------------------------
//char* key = "checkbox1|N/A";
char* ptr = strchr(key, '|');
xmlDocPtr doc = NULL;
if (ptr && key)
- {
+ {
//parsing for : checkbox1|N/A -> checkbox1
char* key_name = substring(key, 0, strlen(key)-strlen(ptr));
char* val_name = strchr(value, '|');
val_name++;
-
+
// ad->plugin_path
// access xml file
doc = xmlParseFile(ad->plugin_path);
// generate xml tree
xmlNode *root = xmlDocGetRootElement(doc);
// find a node
- __node_finder((PluginNode*)ad->plugin_node, root, key_name ,val_name);
- }
+ bool is_end = false;
+ __node_finder((PluginNode*)ad->plugin_node, root, key_name ,val_name, &is_end);
+ }
// update the node
GError *error = NULL;
- /*
+#if 0
if(doc != NULL)
{
xmlSaveFormatFile(ad->plugin_path, doc, 1);
doc = NULL;
SETTING_TRACE("__cfg_file_write successful");
}
- */
+#endif
// update UI
}
if(pd->doc != NULL)
{
xmlSaveFormatFile(pd->cfg_file, pd->doc, 1);
- // TODO: make sure this is right
//xmlFreeDoc(pd->doc);
//pd->doc = NULL;
SETTING_TRACE("__cfg_file_write successful");
Draw_Data *pd = node->pd;
const char *key_str = (char*)xmlGetProp(xmlObj, "id");
- Setting_GenGroupItem_Data * obj =
+ Setting_GenGroupItem_Data * obj =
setting_create_Gendial_field_def(pd->scroller, &(itc_1text),
__link_list_cb,
xmlObj, SWALLOW_Type_INVALID, NULL, NULL,
___click_softkey_back_cb, data, &pd->scroller,
&(pd->navi_bar));
- //return (void*)(pd->ly_main);
return NULL;
};
const char *id = (char*)xmlGetProp(xmlObj, "id");
const char *title = (char*)xmlGetProp(xmlObj, "title");
- SETTING_TRACE(" >>>> id:%s , title:%s", id, title);
+ //SETTING_TRACE(" >>>> id:%s , title:%s", id, title);
__send_int_msg(xmlObj, list_item->chk_status);
__cfg_file_write((Draw_Data *)list_item->belongs_to);
return;
ret_if(!xmlObj);
xmlAttrPtr newattr;
- newattr = xmlSetProp(xmlObj, "string", data_parentItem->sub_desc);
+ //newattr = xmlSetProp(xmlObj, "string", data_parentItem->sub_desc);
+ newattr = xmlSetProp(xmlObj, "value", data_parentItem->sub_desc);
__send_string_msg(xmlObj, data_parentItem->sub_desc);
__cfg_file_write((Draw_Data *)data_parentItem->belongs_to);
Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
Evas_Object *scroller = elm_object_item_widget_get(parentItem);
+
xmlNode *xmlObj = data_parentItem->userdata;
- char *value = (char*)xmlGetProp(xmlObj, "string");
+ //char *value = (char*)xmlGetProp(xmlObj, "string");
+ char *value = (char*)xmlGetProp(xmlObj, "value");
+ SETTING_TRACE(">>> value = %s", value);
int i=0;
Evas_Object *rgd = NULL;
type = (char*)xmlGetProp(cur, "type");
if (0 == safeStrCmp(type, "radio")) {
subitem_title = (char*)xmlGetProp(cur, "title");
- setting_create_Gendial_exp_sub_field(scroller,
- &(itc_1icon_1text_sub),
- __expanditem_func_sel_cb, NULL, parentItem,
- SWALLOW_Type_1RADIO, rgd,
- subitem_index,
- subitem_title, NULL);
+ Setting_GenGroupItem_Data *list_item =
+ setting_create_Gendial_exp_sub_field(scroller,
+ &(itc_1icon_1text_sub),
+ __expanditem_func_sel_cb, NULL, parentItem,
+ SWALLOW_Type_1RADIO, rgd,
+ subitem_index,
+ subitem_title, NULL);
+
+ // SETTING_TRACE(">>> value = %s, subitem_title = %s ", value, subitem_title);
+
if (0 == safeStrCmp(value, subitem_title)) {
sel_idx = subitem_index;
+ SETTING_TRACE("%d is selected in Radio Group", sel_idx);
}
+ data_parentItem->childs = eina_list_append(data_parentItem->childs, list_item);
subitem_index++;
+
} else {
SETTING_TRACE("invalid type[:%s]", type);
}
}
-/////////////
+
static int __node_walker(PluginNode* context, xmlNode* cur)
{
//SETTING_TRACE_BEGIN;
drawer_fp fp = __drawer_find(cur_node->name);
if (fp)
{
- // type check
+ // type check
void* vret = fp(context, cur_node); // draw it
- if (vret)
+ if (vret)
{
Setting_GenGroupItem_Data* genlist_node = (Setting_GenGroupItem_Data* )vret;
//SETTING_TRACE("add node to Eina List name : %s, id : ", cur_node->name, xmlGetProp(cur_node, "id"));
// id, object
// add list
char* key_name = xmlGetProp(cur_node, "id");
- eina_hash_add(context->ui_list, strdup(key_name),(void*)genlist_node);
- //context->ui_list= eina_list_append(context->ui_list, genlist_node);
+ eina_hash_add(context->ui_list, strdup(key_name),(void*)genlist_node);
}
}
}
/**
* @param id_str [in] "id"
* @param value [in] value to be udpated
+ * @see __expanditem_func_sel_cb
*/
-// refer to __expanditem_func_sel_cb
-static int __node_finder(PluginNode* context, xmlNode* cur, char* id_str, char* value)
+static int __node_finder(PluginNode* context, xmlNode* cur, char* id_str, char* value, bool* is_end)
{
- //SETTING_TRACE_BEGIN;
+ SETTING_TRACE_BEGIN;
xmlNode *cur_node = NULL;
+
+ if (*is_end == true) return 0;
+
for (cur_node = cur; cur_node;cur_node = cur_node->next) {
if (cur_node->type == XML_ELEMENT_NODE) {
- //SETTING_TRACE("node type : Element, name=%s id=%s", cur_node->name,xmlGetProp(cur_node, "id"));
char* id_name = (char*)xmlGetProp(cur_node, "id");
if ( id_name && 0 == strcmp(id_str, id_name))
{
if ( 0 == strcmp (cur_node->name, "integer"))
{
SETTING_TRACE(">>>>> UPDATE SLIDER CONTROL %x --- %s ",context->ui_list, id_name);
- Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
+ Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
if (item_to_update)
{
item_to_update->chk_status = atoi(value);
} else {
SETTING_TRACE("item_to_update is NULL");
}
- }
+ }
// case : toggle
if ( 0 == strcmp (cur_node->name, "bool"))
{
SETTING_TRACE(">>>>> UPDATE TOGGLE CONTROL %x --- %s ",context->ui_list, id_name);
- Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
+ Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
if (item_to_update)
{
item_to_update->chk_status = atoi(value);
SETTING_TRACE("item_to_update is NULL");
}
}
- // case : edit control
+ // case : edit control
if ( 0 == strcmp (cur_node->name, "string"))
{
SETTING_TRACE(">>>>> UPDATE EDIT CONTROL CONTROL %x --- %s ",context->ui_list, id_name);
- Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
+ Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
if (item_to_update)
{
char* old_string = item_to_update->sub_desc;
item_to_update->sub_desc = strdup(value);
SETTING_TRACE(">>> o-------------0 STRING VALUE = %s ", value);
-
+
// free old string
elm_object_item_data_set(item_to_update->item, item_to_update);
elm_genlist_item_update(item_to_update->item);
+
} else {
SETTING_TRACE("item_to_update is NULL");
}
if ( 0 == strcmp (cur_node->name, "expandlist"))
{
SETTING_TRACE(">>>>> UPDATE EXPAND LIST CONTROL %x --- %s ",context->ui_list, id_name);
- Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
+ Setting_GenGroupItem_Data* item_to_update = (Setting_GenGroupItem_Data*)eina_hash_find(context->ui_list, id_name);
if (item_to_update)
{
char* old_string = item_to_update->sub_desc;
SETTING_TRACE(">>> o-------------0 EXPAND LIST VALUE = %s ", value);
// free old string
+ // string update
elm_object_item_data_set(item_to_update->item, item_to_update);
elm_genlist_item_update(item_to_update->item);
+
+ // TODO: need to update child elements
+ // item_to_update->childs ---> expanded list
+ if (item_to_update->childs)
+ {
+ Eina_List *li = item_to_update->childs;
+ int radio_index = 0;
+ while(li)
+ {
+ Setting_GenGroupItem_Data* node = eina_list_data_get(li);
+ // do something more
+ // SETTING_TRACE(">>> RADIO LIST STRING VALUE = %s ", node->keyStr);
+ // set position of radio button
+ if (strcmp(node->keyStr, value) == 0)
+ {
+ elm_radio_value_set(node->rgd, radio_index);
+ }
+ elm_object_item_data_set(item_to_update->item, item_to_update);
+ elm_genlist_item_update(item_to_update->item);
+
+ // go next
+ li = eina_list_next(li);
+ radio_index++;
+ }
+
+ }
} else {
SETTING_TRACE("item_to_update is NULL");
}
}
+
+ *is_end = true;
}
}
- __node_finder(context, cur_node->children, id_str, value); /* RECURSIVE */
+ __node_finder(context, cur_node->children, id_str, value, is_end); /* RECURSIVE */
}
return 0;
}
return (int)strlen(key) + 1;
}
-static int _plugin_string_key_cmp(const char* key1, int key1_length,
+static int _plugin_string_key_cmp(const char* key1, int key1_length,
const char* key2, int key2_length)
{
return strcmp(key1, key2);
static void _plugin_entry_free_cb(void* data)
{
-// free(data);
-// data = NULL;
+ Setting_GenGroupItem_Data* node = (Setting_GenGroupItem_Data*) data;
+ if (node->childs)
+ {
+ eina_list_free(node->childs);
+ node->childs = NULL;
+ }
}
//static PluginNode* g_context;
SETTING_TRACE("node->pd is NOT NULL")
if(node->pd->doc != NULL) {
xmlSaveFormatFile(node->plugin_path, node->pd->doc, 1);
- // TODO: make sure this is right
xmlFreeDoc(node->pd->doc);
node->pd->doc = NULL;
SETTING_TRACE("__cfg_file_write successful");
}
- SETTING_TRACE("before freeing node->pd");
free(node->pd);
node->pd = NULL;
- SETTING_TRACE("after freeing node->pd");
}
- SETTING_TRACE("before freeing ui_list");
if (node->ui_list) {
eina_hash_free(node->ui_list);
node->ui_list = NULL;
}
- SETTING_TRACE("after freeing ui_list");
-
- SETTING_TRACE("before freeing node");
free(node);
node = NULL;
- SETTING_TRACE("after freeing node");
}
}
{
Setting_GenGroupItem_Data* node = (Setting_GenGroupItem_Data*) data;
SETTING_TRACE("%s --- %s ", (char*)key, node->keyStr);
-
return EINA_TRUE;
}
void setting_plugin_debug(PluginNode* context)
{
- SETTING_TRACE("HASH TABLE -------------------------------------");
+// SETTING_TRACE("HASH TABLE -------------------------------------");
eina_hash_foreach(context->ui_list,_plugin_foreach_cb, NULL);
- SETTING_TRACE("HASH TABLE -------------------------------------");
+// SETTING_TRACE("HASH TABLE -------------------------------------");
}