// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- GList* get_theme_list(GString* pSystemPath, GString* pUserPath1, GString* pUserPath2) { // printf("%s(2): entry\n\tspath sent as\n*%s*\n\tupath sent as\n*%s*\n\topath sent as\n*%s*\n", // __func__, pSystemPath->str, pUserPath1->str, pUserPath2->str); GList* pThemeList = NULL; if( pSystemPath ) get_theme_list(pSystemPath, &pThemeList); if( pUserPath1 ) get_theme_list(pUserPath1, &pThemeList); if( pUserPath2 ) get_theme_list(pUserPath2, &pThemeList); if( pThemeList ) { pThemeList = g_list_sort (pThemeList, get_theme_list_sort); pThemeList = g_list_first(pThemeList); } // printf("%s(2): exit\n", __func__); return pThemeList; }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- int get_theme_list(GList*& pThemes) { GList* pThemeList = g_pThemeList; int themeCount = g_themeCount; g_pThemeList = NULL; g_themeCount = 0; int ret = get_theme_list(); pThemes = g_pThemeList; g_pThemeList = pThemeList; g_themeCount = themeCount; return ret; }
void create_buttons() { container_outer = edje_object_add(evas); edje_object_file_set(container_outer, default_theme, "widgets/scrollframe"); evas_object_move(container_outer, 0, 0); edje_object_signal_emit(container_outer, "hbar", "hide"); evas_object_resize(container_outer, barwidth - 19, container_height); evas_object_show(container_outer); edje_object_signal_callback_add(container_outer, "drag*", "vbar_bar", _scrolldrag, NULL); container = esmart_container_new(evas); edje_object_part_swallow(container_outer, "item", container); esmart_container_direction_set(container, CONTAINER_DIRECTION_VERTICAL); get_theme_list(); #define ADD_BUTTON(A, B, C)\ A = edje_object_add(evas);\ edje_object_file_set(A, default_theme, "widgets/button");\ evas_object_resize(A, 120, 24);\ edje_object_part_text_set(A, "label", C);\ evas_object_show(A); ADD_BUTTON(b_default, 40, "Default Theme"); evas_object_move(b_default, 5, container_height + 10); edje_object_signal_callback_add(b_default, "click", "", _preview_theme, NULL); ADD_BUTTON(b_apply, 60, "Apply"); evas_object_move(b_apply, 5, container_height + 40); edje_object_signal_callback_add(b_apply, "click", "", _set_theme, NULL); ADD_BUTTON(b_exit, 80, "Exit"); evas_object_move(b_exit, 5, container_height + 60); edje_object_signal_callback_add(b_exit, "click", "", _ethemes_exit, NULL); #undef ADD_BUTTON }
// ----------------------------------------------------------------------------- int theme_list_get(ThemeList*& tl) { tl = new ThemeList; return tl ? tl->count = get_theme_list(tl->pList) : 0; }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- int get_theme_list() { // printf("%s(1): entry\n", __func__); if( g_pThemeList ) del_theme_list(g_pThemeList); g_pThemeList = NULL; g_themeCount = 0; // read in the names of all of the system installed themes as well as // any from the user's home directory // printf("%s(1): before theme path retrievals\n", __func__); const char* upath = get_user_theme_path(); GString* gsupth = upath ? g_string_new(upath) : NULL; const char* spath = get_system_theme_path(); GString* gsspth = spath ? g_string_new(spath) : NULL; const char* opath = get_user_old_theme_path(); GString* gsopth = opath ? g_string_new(opath) : NULL; // printf("%s(1): after theme path retrievals\n", __func__); // printf("%s(1): upath=%s\n", __func__, upath); // printf("%s(1): spath=%s\n", __func__, spath); // printf("%s(1): opath=%s\n", __func__, opath); // printf("%s(1): before theme list retrieval\n", __func__); // g_pThemeList = upath ? get_theme_list(gsspth, gsupth, gsopth) : NULL; g_pThemeList = get_theme_list(gsspth, gsupth, gsopth); // printf("%s(1): after theme list retrieval\n", __func__); if( gsopth) g_string_free(gsopth, TRUE); if( opath ) delete [] opath; if( gsspth) g_string_free(gsspth, TRUE); // if( spath ) delete [] spath; if( gsupth) g_string_free(gsupth, TRUE); if( upath ) delete [] upath; GList* pThemeActiv = NULL; GList* pThemeEntry = g_list_first(g_pThemeList); while( pThemeEntry ) { pThemeEntry = g_list_next(pThemeEntry); g_themeCount++; } ThemeEntry* pEntry = NULL; if( pEntry = new ThemeEntry ) { pEntry->pPath = g_string_new (INTERNAL_THEME); pEntry->pFile = g_string_new (INTERNAL_THEME); pEntry->pName = g_string_new ("<default>"); pEntry->pAuthor = g_string_new ("pillbug"); pEntry->pVersion = g_string_new ("1.0"); pEntry->pInfo = g_string_new ("Internal fallback theme"); pEntry->pModes = g_string_new ("12/24"); pEntry->pTextColor = g_string_new ("1.0;1.0;1.0"); pEntry->pShdoColor = g_string_new ("0.0;0.0;0.0"); pEntry->pFillColor = g_string_new ("0.5;0.5;0.5"); g_pThemeList = g_list_append(g_pThemeList, (gpointer)pEntry); g_themeCount++; } // printf("%s(1): theme count is %d\n", __func__, g_themeCount); // printf("%s(1): exit\n", __func__); return g_themeCount; }