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.
This commit is contained in:
Carsten Haitzler 2013-11-01 15:53:05 +09:00
parent 4b4a51d189
commit a1d1e40559
15 changed files with 58 additions and 55 deletions

View File

@ -98,6 +98,7 @@ void *alloca (size_t);
# endif
# include <setjmp.h>
# include <Elementary.h>
# include <Eina.h>
# include <Eet.h>
# include <Evas.h>
@ -116,6 +117,7 @@ void *alloca (size_t);
# include <Edje.h>
# include <Eldbus.h>
# include <Eio.h>
# include <Emotion.h>
# ifdef HAVE_HAL
# include <E_Hal.h>

View File

@ -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);

View File

@ -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

View File

@ -1,5 +1,4 @@
#include "e.h"
#include <Elementary.h>
EAPI int E_EVENT_INIT_DONE = 0;

View File

@ -1,6 +1,4 @@
#include "e.h"
#include <Elementary.h>
#include <Emotion.h>
#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));

View File

@ -1,5 +1,4 @@
#include "e.h"
#include <Elementary.h>
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);

View File

@ -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;

View File

@ -1,7 +1,6 @@
#include "e.h"
#include "e_fm_device.h"
#include <sys/statvfs.h>
#include <Emotion.h>
#define FILEPREVIEW_TEXT_PREVIEW_SIZE 2048

View File

@ -12,8 +12,6 @@ static void _e_win_cb_state(Ecore_Evas *ee);
/* local subsystem globals */
static Eina_List *wins = NULL;
#include <Elementary.h>
typedef struct _Elm_Win_Trap_Ctx
{
E_Border *border;

View File

@ -1,8 +1,6 @@
#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H
#include <Elementary.h>
#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)

View File

@ -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;
}

View File

@ -1,6 +1,5 @@
#include "e.h"
#include "e_mod_main.h"
#include <Elementary.h>
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

View File

@ -1,6 +1,5 @@
#include "e.h"
#include "e_mod_main.h"
#include <Elementary.h>
typedef struct _Import Import;

View File

@ -1,6 +1,5 @@
#include "e.h"
#include "e_mod_main.h"
#include <Elementary.h>
static const char *cur_theme = NULL;

View File

@ -1,5 +1,4 @@
#include "e_mod_main.h"
#include <Emotion.h>
#define IMAGE_FETCH_TRIES 5