terminology - make wp display more than basic img formats (edj, scale etc.)

This commit is contained in:
Carsten Haitzler 2013-12-29 14:59:57 +09:00
parent bcdfbbadfb
commit 7f92258ee4
4 changed files with 92 additions and 62 deletions

View File

@ -45,7 +45,7 @@ utf8.c utf8.h \
win.c win.h \
utils.c utils.h \
dbus.c dbus.h \
extns.h \
extns.c extns.h \
app_server.c app_server.h \
app_server_eet.c app_server_eet.h
@ -87,7 +87,7 @@ tyq_LDADD =
tycat_SOURCES = \
tycat.c \
extns.h
extns.c extns.h
tycat_CPPFLAGS = -I. \
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \

41
src/bin/extns.c Normal file
View File

@ -0,0 +1,41 @@
#include <stdio.h>
const char *extn_img[] =
{
".png", ".jpg", ".jpeg", ".jpe", ".jfif", ".tif", ".tiff", ".gif", ".thm",
".bmp", ".ico", ".ppm", ".pgm", ".pbm", ".pnm", ".xpm", ".psd", ".wbmp",
".cur", ".xcf", ".xcf.gz", ".arw", ".cr2", ".crw", ".dcr", ".dng", ".k25",
".kdc", ".erf", ".mrw", ".nef", ".nrf", ".nrw", ".orf", ".raw", ".rw2",
".pef", ".raf", ".sr2", ".srf", ".x3f", ".webp", ".ppt", ".pptx", ".odp",
NULL
};
const char *extn_scale[] =
{
".svg", ".svgz", ".svg.gz", ".ps", ".ps.gz", ".pdf",
NULL
};
const char *extn_edj[] =
{
".edj",
NULL
};
const char *extn_mov[] =
{
".asf", ".avi", ".bdm", ".bdmv", ".clpi", ".cpi", ".dv", ".fla", ".flv",
".m1v", ".m2t", ".m2v", ".m4v", ".mkv", ".mov", ".mp2", ".mp2ts", ".mp4",
".mpe", ".mpeg", ".mpg", ".mpl", ".mpls", ".mts", ".mxf", ".nut", ".nuv",
".ogg", ".ogm", ".ogv", ".qt", ".rm", ".rmj", ".rmm", ".rms", ".rmvb",
".rmx", ".rv", ".swf", ".ts", ".weba", ".webm", ".wmv", ".3g2", ".3gp",
".3gp2", ".3gpp", ".3gpp2", ".3p2", ".264",
".mp3", ".aac", ".wav",
NULL
};
const char *extn_aud[] =
{
".mp3", ".aac", ".wav",
NULL
};

View File

@ -1,39 +1,5 @@
static const char *extn_img[] =
{
".png", ".jpg", ".jpeg", ".jpe", ".jfif", ".tif", ".tiff", ".gif", ".thm",
".bmp", ".ico", ".ppm", ".pgm", ".pbm", ".pnm", ".xpm", ".psd", ".wbmp",
".cur", ".xcf", ".xcf.gz", ".arw", ".cr2", ".crw", ".dcr", ".dng", ".k25",
".kdc", ".erf", ".mrw", ".nef", ".nrf", ".nrw", ".orf", ".raw", ".rw2",
".pef", ".raf", ".sr2", ".srf", ".x3f", ".webp", ".ppt", ".pptx", ".odp",
NULL
};
static const char *extn_scale[] =
{
".svg", ".svgz", ".svg.gz", ".ps", ".ps.gz", ".pdf",
NULL
};
static const char *extn_edj[] =
{
".edj",
NULL
};
static const char *extn_mov[] =
{
".asf", ".avi", ".bdm", ".bdmv", ".clpi", ".cpi", ".dv", ".fla", ".flv",
".m1v", ".m2t", ".m2v", ".m4v", ".mkv", ".mov", ".mp2", ".mp2ts", ".mp4",
".mpe", ".mpeg", ".mpg", ".mpl", ".mpls", ".mts", ".mxf", ".nut", ".nuv",
".ogg", ".ogm", ".ogv", ".qt", ".rm", ".rmj", ".rmm", ".rms", ".rmvb",
".rmx", ".rv", ".swf", ".ts", ".weba", ".webm", ".wmv", ".3g2", ".3gp",
".3gp2", ".3gpp", ".3gpp2", ".3p2", ".264",
".mp3", ".aac", ".wav",
NULL
};
static const char *extn_aud[] =
{
".mp3", ".aac", ".wav",
NULL
};
extern const char *extn_img[];
extern const char *extn_scale[];
extern const char *extn_edj[];
extern const char *extn_mov[];
extern const char *extn_aud[];

View File

@ -57,7 +57,18 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
{
if (item->path)
{
return media_add(obj, item->path, config, MEDIA_THUMB, TYPE_IMG);
int len0, len = strlen(item->path);
int i, ret = 0;
for (i = 0; extn_edj[i]; i++)
{
len0 = strlen(extn_edj[i]);
if ((len > len0) &&
(!strcasecmp(&(item->path[len - len0]), extn_edj[i])))
return media_add(obj, item->path, config,
MEDIA_BG, &ret);
}
return media_add(obj, item->path, config, MEDIA_THUMB, &ret);
}
else
{
@ -83,7 +94,7 @@ _item_selected(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED
if (!config) return;
if (!item->path)
{
//no background
// no background
eina_stringshare_del(config->background);
config->background = NULL;
config_save(config, NULL);
@ -272,8 +283,8 @@ static Eina_List*
_rec_read_directorys(Eina_List *list, char *root_path, Evas_Object *term)
{
Eina_List *childs = ecore_file_ls(root_path);
char *file_name, *ext;
int i;
char *file_name;
int i, j, len, len0;
char path[PATH_MAX];
Background_Item *item;
@ -281,20 +292,32 @@ _rec_read_directorys(Eina_List *list, char *root_path, Evas_Object *term)
EINA_LIST_FREE(childs, file_name)
{
snprintf(path, PATH_MAX, "%s/%s", root_path, file_name);
ext = strchr(file_name, '.');
if ((!ecore_file_is_dir(path)) && (file_name[0] != '.') && (ext))
len = strlen(file_name);
if ((!ecore_file_is_dir(path)) && (file_name[0] != '.'))
{
for (i = 0; extn_img[i]; i++)
const char **extns[5] =
{ extn_img, extn_scale, extn_edj, extn_mov, NULL };
for (j = 0; extns[j]; j++)
{
if (strcasecmp(extn_img[i], ext)) continue;
item = calloc(1, sizeof(Background_Item));
if (item)
const char **ex = extns[j];
for (i = 0; ex[i]; i++)
{
item->path = eina_stringshare_add(path);
item->term = term;
list = eina_list_append(list, item);
len0 = strlen(ex[i]);
if ((len > len0) &&
(!strcasecmp(&(file_name[len - len0]), ex[i])))
{
item = calloc(1, sizeof(Background_Item));
if (item)
{
item->path = eina_stringshare_add(path);
item->term = term;
list = eina_list_append(list, item);
}
break;
}
}
break;
}
}
else
@ -324,22 +347,22 @@ _read_directorys(Evas_Object *term)
free(item);
}
}
//first of all append the None !!
// first of all append the None !!
item = calloc(1, sizeof(Background_Item));
item->path = NULL;
item->term = term;
backgroundlist = eina_list_append(backgroundlist, item);
//append the standart directory
snprintf(path, sizeof(path), "%s/backgrounds/", elm_app_data_dir_get());
// append the standard directory
snprintf(path, sizeof(path), "%s/backgrounds", elm_app_data_dir_get());
backgroundlist = _rec_read_directorys(backgroundlist, path, term);
//append the Home background directory if this directory exists
// append the Home background directory if this directory exists
home_dir = getenv("HOME");
if(home_dir)
if (home_dir)
{
snprintf(path, sizeof(path), "%s/.e/e/backgrounds/", home_dir);
snprintf(path, sizeof(path), "%s/.e/e/backgrounds", home_dir);
backgroundlist = _rec_read_directorys(backgroundlist, path, term);
}
//Now append all the directorys which are stored
// Now append all the directorys which are stored
EINA_LIST_FOREACH(config->wallpaper_paths, node, path_iterate)
{
backgroundlist = _rec_read_directorys(backgroundlist, path_iterate, term);