From a1d1e4055924cf2369804239a5b7c212d9257ccd Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 1 Nov 2013 15:53:05 +0900 Subject: [PATCH] elm integration improvement - copy themes over, fix includes and null config provide a config upgrade path to version 13 which nulls/frees out theme config (save memory - but more housekeeping), and that also copeis ofer all files in ~/.e/e/themes to ~/.elementary/themes so you don't lose themes you personally have and deletes the old e theme dir if this succeeds. also remove all #includes of Elementary.h and Emotion.h from single c files as they are requirements now and in e.h also remove theme path vars and code as theme path is no longer used. --- src/bin/e.h | 2 + src/bin/e_config.c | 42 +++++++++++++++++++ src/bin/e_config.h | 4 +- src/bin/e_init.c | 1 - src/bin/e_main.c | 20 --------- src/bin/e_theme.c | 1 - src/bin/e_utils.c | 1 - src/bin/e_widget_filepreview.c | 1 - src/bin/e_win.c | 2 - src/modules/conf2/e_mod_main.h | 2 - src/modules/conf_paths/e_int_config_paths.c | 24 +++++------ src/modules/conf_theme/e_int_config_theme.c | 10 +---- .../conf_theme/e_int_config_theme_import.c | 1 - src/modules/conf_theme/e_mod_main.c | 1 - src/modules/teamwork/e_mod_tw.c | 1 - 15 files changed, 58 insertions(+), 55 deletions(-) diff --git a/src/bin/e.h b/src/bin/e.h index 4ecc03c33..95d0d8aa5 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -98,6 +98,7 @@ void *alloca (size_t); # endif # include +# include # include # include # include @@ -116,6 +117,7 @@ void *alloca (size_t); # include # include # include +# include # ifdef HAVE_HAL # include diff --git a/src/bin/e_config.c b/src/bin/e_config.c index e08fe03ff..3ccd865e2 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -1221,6 +1221,48 @@ e_config_load(void) break; } } + CONFIG_VERSION_CHECK(13) + { + E_Config_Theme *et; + E_Path_Dir *epd; + char buf[PATH_MAX], buf2[PATH_MAX], *f; + Eina_List *files; + Eina_Bool fail = EINA_FALSE; + + CONFIG_VERSION_UPDATE_INFO(13); + // empty out theme elements of config + eina_stringshare_del(e_config->init_default_theme); + e_config->init_default_theme = NULL; + EINA_LIST_FREE(e_config->themes, et) + { + if (et->category) eina_stringshare_del(et->category); + if (et->file) eina_stringshare_del(et->file); + E_FREE(et); + } + EINA_LIST_FREE(e_config->path_append_themes, epd) + { + if (epd->dir) eina_stringshare_del(epd->dir); + E_FREE(epd); + } + // copy all of ~/.e/e/themes/* into ~/.elementary/themes + // and delete original data in ~/.e/e/themes + ecore_file_mkpath(elm_theme_user_dir_get()); + snprintf(buf, sizeof(buf), "%s/themes", e_user_dir_get()); + files = ecore_file_ls(buf); + EINA_LIST_FREE(files, f) + { + snprintf(buf, sizeof(buf), "%s/themes/%s", + e_user_dir_get(), f); + snprintf(buf2, sizeof(buf2), "%s/%s", + elm_theme_user_dir_get(), f); + if (!ecore_file_cp(buf, buf2)) fail = EINA_TRUE; + } + if (!fail) + { + snprintf(buf, sizeof(buf), "%s/themes", e_user_dir_get()); + ecore_file_recursive_rm(buf); + } + } } if (!e_config->remember_internal_fm_windows) e_config->remember_internal_fm_windows = !!(e_config->remember_internal_windows & E_REMEMBER_INTERNAL_FM_WINS); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index b339be4b8..9fb334d8f 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -48,7 +48,7 @@ typedef enum /* increment this whenever a new set of config values are added but the users * config doesn't need to be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 12 +#define E_CONFIG_FILE_GENERATION 13 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION) #define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!! @@ -270,7 +270,7 @@ struct _E_Config */ int desk_flip_animate_mode; // GUI /* types based on theme */ - Eina_Stringshare *desk_flip_animate_type; // GUI + Eina_Stringshare *desk_flip_animate_type; // GUI int desk_flip_animate_interpolation; // GUI const char *wallpaper_import_last_dev; // INTERNAL diff --git a/src/bin/e_init.c b/src/bin/e_init.c index abcd2ba70..fd3a8479b 100644 --- a/src/bin/e_init.c +++ b/src/bin/e_init.c @@ -1,5 +1,4 @@ #include "e.h" -#include EAPI int E_EVENT_INIT_DONE = 0; diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 476e2efc4..b4af65abd 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1,6 +1,4 @@ #include "e.h" -#include -#include #define MAX_LEVEL 80 @@ -1396,19 +1394,6 @@ _e_main_path_init(void) e_path_default_path_append(path_fonts, buf); e_path_user_path_set(path_fonts, &(e_config->path_append_fonts)); - /* setup theme paths */ - path_themes = e_path_new(); - if (!path_themes) - { - e_error_message_show("Cannot allocate path for path_themes\n"); - return 0; - } - e_user_dir_concat_static(buf, "/themes"); - e_path_default_path_append(path_themes, buf); - e_prefix_data_concat_static(buf, "data/themes"); - e_path_default_path_append(path_themes, buf); - e_path_user_path_set(path_themes, &(e_config->path_append_themes)); - /* setup icon paths */ path_icons = e_path_new(); if (!path_icons) @@ -1486,11 +1471,6 @@ _e_main_path_shutdown(void) e_object_del(E_OBJECT(path_fonts)); path_fonts = NULL; } - if (path_themes) - { - e_object_del(E_OBJECT(path_themes)); - path_themes = NULL; - } if (path_icons) { e_object_del(E_OBJECT(path_icons)); diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c index b06be4ff1..e1378a4ef 100644 --- a/src/bin/e_theme.c +++ b/src/bin/e_theme.c @@ -1,5 +1,4 @@ #include "e.h" -#include static void e_theme_handler_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *path); static int e_theme_handler_test(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *path); diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index 7d0c6db6a..78f2d4fbc 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -3,7 +3,6 @@ EAPI E_Path * path_data = NULL; EAPI E_Path * path_images = NULL; EAPI E_Path * path_fonts = NULL; -EAPI E_Path * path_themes = NULL; EAPI E_Path * path_icons = NULL; EAPI E_Path * path_modules = NULL; EAPI E_Path * path_backgrounds = NULL; diff --git a/src/bin/e_widget_filepreview.c b/src/bin/e_widget_filepreview.c index 96a2e9bf4..48c1539b8 100644 --- a/src/bin/e_widget_filepreview.c +++ b/src/bin/e_widget_filepreview.c @@ -1,7 +1,6 @@ #include "e.h" #include "e_fm_device.h" #include -#include #define FILEPREVIEW_TEXT_PREVIEW_SIZE 2048 diff --git a/src/bin/e_win.c b/src/bin/e_win.c index 47ef1ca14..623a949b7 100644 --- a/src/bin/e_win.c +++ b/src/bin/e_win.c @@ -12,8 +12,6 @@ static void _e_win_cb_state(Ecore_Evas *ee); /* local subsystem globals */ static Eina_List *wins = NULL; -#include - typedef struct _Elm_Win_Trap_Ctx { E_Border *border; diff --git a/src/modules/conf2/e_mod_main.h b/src/modules/conf2/e_mod_main.h index 40117c65e..c76b8d88c 100644 --- a/src/modules/conf2/e_mod_main.h +++ b/src/modules/conf2/e_mod_main.h @@ -1,8 +1,6 @@ #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H -#include - #define WEIGHT evas_object_size_hint_weight_set #define ALIGN evas_object_size_hint_align_set #define EXPAND(X) WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND) diff --git a/src/modules/conf_paths/e_int_config_paths.c b/src/modules/conf_paths/e_int_config_paths.c index 4ce24f63b..0ba50bc0e 100644 --- a/src/modules/conf_paths/e_int_config_paths.c +++ b/src/modules/conf_paths/e_int_config_paths.c @@ -65,25 +65,23 @@ e_int_config_paths(E_Container *con, const char *params __UNUSED__) static void _fill_data(E_Config_Dialog_Data *cfdata) { - cfdata->paths_available = E_NEW(E_Path_Pair, 10); + cfdata->paths_available = E_NEW(E_Path_Pair, 8); cfdata->paths_available[0].path = path_data; cfdata->paths_available[0].path_description = _("Data"); cfdata->paths_available[1].path = path_images; cfdata->paths_available[1].path_description = _("Images"); cfdata->paths_available[2].path = path_fonts; cfdata->paths_available[2].path_description = _("Fonts"); - cfdata->paths_available[3].path = path_themes; - cfdata->paths_available[3].path_description = _("Themes"); - cfdata->paths_available[4].path = path_icons; - cfdata->paths_available[4].path_description = _("Icons"); - cfdata->paths_available[5].path = path_modules; - cfdata->paths_available[5].path_description = _("Modules"); - cfdata->paths_available[6].path = path_backgrounds; - cfdata->paths_available[6].path_description = _("Backgrounds"); - cfdata->paths_available[7].path = path_messages; - cfdata->paths_available[7].path_description = _("Messages"); - cfdata->paths_available[8].path = NULL; - cfdata->paths_available[8].path_description = NULL; + cfdata->paths_available[3].path = path_icons; + cfdata->paths_available[3].path_description = _("Icons"); + cfdata->paths_available[4].path = path_modules; + cfdata->paths_available[4].path_description = _("Modules"); + cfdata->paths_available[5].path = path_backgrounds; + cfdata->paths_available[5].path_description = _("Backgrounds"); + cfdata->paths_available[6].path = path_messages; + cfdata->paths_available[6].path_description = _("Messages"); + cfdata->paths_available[7].path = NULL; + cfdata->paths_available[7].path_description = NULL; return; } diff --git a/src/modules/conf_theme/e_int_config_theme.c b/src/modules/conf_theme/e_int_config_theme.c index d606b0239..0be76e4ba 100644 --- a/src/modules/conf_theme/e_int_config_theme.c +++ b/src/modules/conf_theme/e_int_config_theme.c @@ -1,6 +1,5 @@ #include "e.h" #include "e_mod_main.h" -#include static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); @@ -45,14 +44,7 @@ static void _e_int_theme_edje_file_set(Evas_Object *o, const char *file, const char *group) { if (!edje_object_file_set(o, file, group)) - { - file = e_path_find(path_themes, "default.edj"); - if (file) - { - edje_object_file_set(o, file, group); - eina_stringshare_del(file); - } - } + e_theme_edje_object_set(o, NULL, group); } static Eina_Bool diff --git a/src/modules/conf_theme/e_int_config_theme_import.c b/src/modules/conf_theme/e_int_config_theme_import.c index 4f255da68..5a8993574 100644 --- a/src/modules/conf_theme/e_int_config_theme_import.c +++ b/src/modules/conf_theme/e_int_config_theme_import.c @@ -1,6 +1,5 @@ #include "e.h" #include "e_mod_main.h" -#include typedef struct _Import Import; diff --git a/src/modules/conf_theme/e_mod_main.c b/src/modules/conf_theme/e_mod_main.c index 9cf00a9db..168dc4c8f 100644 --- a/src/modules/conf_theme/e_mod_main.c +++ b/src/modules/conf_theme/e_mod_main.c @@ -1,6 +1,5 @@ #include "e.h" #include "e_mod_main.h" -#include static const char *cur_theme = NULL; diff --git a/src/modules/teamwork/e_mod_tw.c b/src/modules/teamwork/e_mod_tw.c index a0b357c90..3b22da4e0 100644 --- a/src/modules/teamwork/e_mod_tw.c +++ b/src/modules/teamwork/e_mod_tw.c @@ -1,5 +1,4 @@ #include "e_mod_main.h" -#include #define IMAGE_FETCH_TRIES 5