/**
* @param data
+ * ex) name : AppSetting4
+ * ex) pkgname : UBKFwQidax.AppSetting4
*/
static void draw_3rdapp(void* data, char* name, char* pkgname)
{
if (ad)
{
- if (ad->plugin_path)
- {
- free(ad->plugin_path);
- ad->plugin_path = NULL;
- }
- ad->plugin_path = strdup(fullpath);
-
- setting_create_Gendial_field_groupitem(ad->main_genlist,
+ char* plugin_path = strdup(fullpath);
+ Setting_GenGroupItem_Data * plugin_node = setting_create_Gendial_field_groupitem(ad->main_genlist,
&(ad->itc[GENDIAL_Type_1text_1icon_2]),
NULL,
setting_main_click_list_plugin_cb,
ad,
SWALLOW_Type_INVALID,
IMG_DefaultIcon, NULL,
- 0, name, NULL,
+ 0, name, plugin_path, // <<-- refactoring
NULL);
}
SETTING_TRACE_END;
setting_view_main.is_create = 1;
+ setting_drawer_list_init();
return SETTING_RETURN_SUCCESS;
}
evas_object_smart_callback_del(ad->main_genlist, "realized", __gl_realized);
+ setting_dbus_handler_fini();
+ setting_drawer_list_fini();
+
setting_view_main.is_create = 0;
SETTING_TRACE_END;
return SETTING_RETURN_SUCCESS;
retm_if(event_info == NULL, "Invalid argument: event info is NULL");
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
elm_genlist_item_selected_set(item, EINA_FALSE);
+ Setting_GenGroupItem_Data *selected_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
setting_main_appdata *ad = data;
- if (ad->plugin_path)
- {
- PluginNode* plugin_node = setting_plugin_create();
- plugin_node->plugin_path = strdup(ad->plugin_path);
- setting_plugin_load(plugin_node, (const char *)ad->plugin_path);
- ad->plugin_node = (void*)plugin_node;
+ ad->plugin_path = strdup(selected_item->sub_desc);
+ SETTING_TRACE(" >> SELECTED plugin name : %s \n", ad->plugin_path);
- #if 0
- if(ad->plugin_path)
- {
- free(ad->plugin_path);
- ad->plugin_path = NULL;
- }
- #endif
- }
+ setting_dbus_handler_init( ad );
+
+ #if 1
+ PluginNode* plugin_node = setting_plugin_create(ad);
+ plugin_node->plugin_path = strdup(ad->plugin_path);
+ setting_plugin_load(plugin_node, (const char *)plugin_node->plugin_path);
+
+ ad->plugin_node = plugin_node; // the selected plugin name
+ #endif
}
/**
#include <setting-plugin.h>
+extern setting_main_appdata *g_main_ad;
static Setting_GenGroupItem_Data *g_list_item; /*TEST*/
-
-
/*
* UI draw handler table : _g_draw_list
* - contains Object_Drawer typed object.
dbus_error_init(&error);
setting_main_appdata *ad = user_data;
+ char* plugin_path = ad->plugin_path;
+ char* pkg_name = get_app_string(plugin_path);
- char* pkg_name = get_app_string(ad->plugin_path);
+ if (pkg_name == NULL)
+ {
+ SETTING_TRACE("pkg_name is NULL - it's abnormal operation");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
char str_buf[MAX_COMMON_BUFFER_LEN];
snprintf(str_buf, MAX_COMMON_BUFFER_LEN, "Update_%s", pkg_name);
char* val_name = strchr(value, '|');
val_name++;
- // ad->plugin_path
// access xml file
- doc = xmlParseFile(ad->plugin_path);
+ doc = xmlParseFile(plugin_path);
// generate xml tree
xmlNode *root = xmlDocGetRootElement(doc);
// find a node
if (bus == NULL)
return -1;
+ // ex) in gdb --> $15 = 0x43b6eb78 "Update_(null)" -> error codintion
if (s_pkg_name == NULL)
{
SETTING_TRACE("s_pkg_name is NULL - it's abnormal operation");
static void __send_int_msg(xmlNode* xmlObj, int val)
{
+ SETTING_TRACE_BEGIN;
const char *id = (char*)xmlGetProp(xmlObj, "id");
const char *title = (char*)xmlGetProp(xmlObj, "title");
char key[MAX_CONTENT_LEN] = {0,};
char value[MAX_CONTENT_LEN] = {0,};
snprintf(value, sizeof(value), "INT|%d", val);
__send_msg(key, value);
+ SETTING_TRACE_END;
}
{
SETTING_TRACE("already get a bus, need release first.");
setting_dbus_handler_fini();
+// return -1;
}
DBusError error;
memset(&error, 0, sizeof(DBusError));
int setting_dbus_handler_fini(void)
{
+ SETTING_TRACE_BEGIN;
//do safty checking first.
setting_retvm_if(!bus, 0, "!bus");
DBusError error;
char rule[MAX_LOCAL_BUFSIZE + 1] = {0, };
dbus_error_init(&error);
+
+ // why??
+ bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
+
//dbus_connection_remove_filter(bus, __signal_filter, NULL);
+
+
snprintf(rule, MAX_LOCAL_BUFSIZE, "path='%s',type='signal',interface='%s'", DBUS_PATH, DBUS_SIGNAL_INTERFACE);
dbus_bus_remove_match(bus, rule, &error);
SETTING_TRACE("__cfg_file_write successful");
}
+ SETTING_TRACE_END;
return TRUE;
}
snprintf(file, sizeof(file), "%s/%s", PLUGIN_CFG_DIR, link_file);
SETTING_TRACE("file:%s", file);
- PluginNode* plugin_node = setting_plugin_create();
+ PluginNode* plugin_node = setting_plugin_create(file);
setting_plugin_load(plugin_node, (const char *)file);
//setting_plugin_load(NULL, file);
Draw_Data *pd = context->pd;
retv_if(!pd, -1);
+ retv_if(!context->ui_list, -1);
+
xmlNode *cur_node = NULL;
for (cur_node = cur; cur_node;cur_node = cur_node->next) {
if (cur_node->type == XML_ELEMENT_NODE) {
SETTING_TRACE_BEGIN;
xmlNode *cur_node = NULL;
+ if (! context)
+ {
+ SETTING_TRACE("context is NULL - it's error CONDITION ");
+ return -1;
+ }
+
+ retv_if(!context->ui_list, -1);
if (*is_end == true) return 0;
for (cur_node = cur; cur_node;cur_node = cur_node->next) {
}
}
-//static PluginNode* g_context;
-
PluginNode* setting_plugin_create()
{
PluginNode *node = calloc(1, sizeof(PluginNode));
-
setting_retvm_if(!node, -1, "Create PluginNode obj failed");
-
Draw_Data *pd = calloc(1, sizeof(Draw_Data));
+
if (!pd) {
FREE(node);
}
}
free(node);
node = NULL;
+// PLUGIN_FINI;
}
}
void setting_plugin_debug(PluginNode* context)
{
// SETTING_TRACE("HASH TABLE -------------------------------------");
- eina_hash_foreach(context->ui_list,_plugin_foreach_cb, NULL);
+ if (context->ui_list) {
+ eina_hash_foreach(context->ui_list,_plugin_foreach_cb, NULL);
+ }
// SETTING_TRACE("HASH TABLE -------------------------------------");
}
context->pd->cfg_file = cfg_file;
context->pd->win_get = (Evas_Object *) ug_get_window();
- GError *error = NULL;
+ //GError *error = NULL;
context->pd->doc = xmlParseFile(cfg_file);
context->pd->root = xmlDocGetRootElement(context->pd->doc);
+ // signal filter change
+ //setting_dbus_handler_init(g_main_ad);
+ void* user_data = (void*)g_main_ad;
+
+ DBusError error;
+ dbus_error_init(&error);
+ char rule[MAX_LOCAL_BUFSIZE + 1] = {0,};
+ bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
+ if (!bus)
+ {
+ SETTING_TRACE("Fail to connect to the D-BUS daemon: %s", error.message);
+ dbus_error_free(&error);
+ return -1;
+ }
+
+ // remove filter
+ // dbus_connection_remove_filter(bus, __signal_filter, NULL);
+
+ // get rule
+ snprintf(rule, MAX_LOCAL_BUFSIZE, "path='%s',type='signal',interface='%s'", DBUS_PATH, DBUS_SIGNAL_INTERFACE);
+ dbus_bus_add_match(bus, rule, &error);
+ if (dbus_error_is_set(&error))
+ {
+ SETTING_TRACE("Fail to rule set; %s", error.message);
+ dbus_bus_remove_match(bus, rule, &error);
+ dbus_error_free(&error);
+ dbus_connection_close(bus);
+ bus = NULL;
+ return -1;
+ }
+
+ // re-add filter
+ if (dbus_connection_add_filter(bus, __signal_filter, user_data, NULL) == FALSE)
+ {
+ dbus_bus_remove_match(bus, rule, &error);
+ dbus_error_free(&error);
+ dbus_connection_close(bus);
+ bus = NULL;
+ return -1;
+ }
+
+
+
// TODO: error handler here
__node_walker(context, context->pd->root);