Small theme fixes, and a way to change directories with typebuf
This commit is contained in:
parent
d92b938d63
commit
86867280b0
@ -46,7 +46,7 @@ group {
|
||||
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: 0 -171;
|
||||
offset: 0 -175;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ group {
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
min: 99999 9;
|
||||
color: 255 255 255 40;
|
||||
color: 0 0 0 20;
|
||||
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "ecdb.h"
|
||||
|
||||
static void ecdb_handle_typebuf(Evas_Object *gui);
|
||||
|
||||
static void
|
||||
ecdb_cb_enter(Ecore_Evas *ee)
|
||||
{
|
||||
@ -72,36 +74,7 @@ _cb_filelist_key_down(void *data, Evas *e __UNUSED__,
|
||||
|
||||
else if (!strcmp(ek->key, "Return"))
|
||||
{
|
||||
Ewl_Widget *fl;
|
||||
Ewl_Filelist_Filter *filter;
|
||||
const char *ext;
|
||||
|
||||
if (!(ext = edje_object_part_text_get(gui,
|
||||
"filelist_overlay_text")))
|
||||
return;
|
||||
|
||||
fl = ewl_widget_name_find("main_filelist");
|
||||
filter = ewl_filelist_filter_get(EWL_FILELIST(fl));
|
||||
if (!filter)
|
||||
filter = calloc(sizeof(Ewl_Filelist_Filter), 1);
|
||||
|
||||
if (filter->extension)
|
||||
{
|
||||
if (strcmp(filter->extension, ext))
|
||||
{
|
||||
FREE(filter->extension);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
filter->extension = strdup(ext);
|
||||
ewl_filelist_filter_set(EWL_FILELIST(fl), filter);
|
||||
ewl_filelist_refresh(EWL_FILELIST(fl));
|
||||
|
||||
edje_object_signal_emit(gui,
|
||||
"ecdb,filelist_overlay,deactivate", "ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
||||
ecdb_handle_typebuf(gui);
|
||||
}
|
||||
|
||||
else if (!strcmp(ek->key, "BackSpace"))
|
||||
@ -172,7 +145,7 @@ _cb_filelist_key_down(void *data, Evas *e __UNUSED__,
|
||||
int
|
||||
ecdb_create_main_gui(void)
|
||||
{
|
||||
Evas_Object *gui, *swallow, *o;
|
||||
Evas_Object *gui, *swallow;
|
||||
Ewl_Widget *embed, *filelist;
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
@ -292,3 +265,87 @@ ecdb_set_main_theme(const char *theme_name, const char *group)
|
||||
ecore_evas_resize(em->main_win_ee, mw, mh);
|
||||
ecore_evas_size_min_set(em->main_win_ee, mw, mh);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_handle_typebuf(Evas_Object *gui)
|
||||
{
|
||||
Ewl_Widget *fl;
|
||||
Ewl_Filelist_Filter *filter;
|
||||
const char *ext;
|
||||
|
||||
if (!(ext = edje_object_part_text_get(gui,
|
||||
"filelist_overlay_text")))
|
||||
return;
|
||||
|
||||
fl = ewl_widget_name_find("main_filelist");
|
||||
|
||||
/* Check for a 'cd' first */
|
||||
if (!ecdb_match_keyword(ext, "cd", 2))
|
||||
{
|
||||
char *dir;
|
||||
|
||||
dir = ecdb_strip_next_argument(ext);
|
||||
|
||||
if ((dir) && (dir[0] == '/'))
|
||||
{
|
||||
if (ecore_file_exists(dir))
|
||||
ewl_filelist_directory_set(EWL_FILELIST(fl),
|
||||
dir);
|
||||
}
|
||||
else if (dir[0] == '~')
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
snprintf(path, PATH_MAX, "%s%s", getenv("HOME"),
|
||||
&dir[1]);
|
||||
|
||||
if (ecore_file_exists(path))
|
||||
ewl_filelist_directory_set(EWL_FILELIST(fl),
|
||||
path);
|
||||
}
|
||||
else if (dir)
|
||||
{
|
||||
/* Try to concate it to our current directory */
|
||||
char path[PATH_MAX];
|
||||
|
||||
snprintf(path, PATH_MAX, "%s/%s",
|
||||
ewl_filelist_directory_get
|
||||
(EWL_FILELIST(fl)), dir);
|
||||
|
||||
if (ecore_file_exists(path))
|
||||
ewl_filelist_directory_set(EWL_FILELIST(fl),
|
||||
path);
|
||||
}
|
||||
|
||||
if (dir)
|
||||
free(dir);
|
||||
|
||||
edje_object_signal_emit(gui, "ecdb,filelist_overlay,"
|
||||
"deactivate", "ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text",
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
filter = ewl_filelist_filter_get(EWL_FILELIST(fl));
|
||||
if (!filter)
|
||||
filter = calloc(sizeof(Ewl_Filelist_Filter), 1);
|
||||
|
||||
if (filter->extension)
|
||||
{
|
||||
if (strcmp(filter->extension, ext))
|
||||
{
|
||||
FREE(filter->extension);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
filter->extension = strdup(ext);
|
||||
ewl_filelist_filter_set(EWL_FILELIST(fl), filter);
|
||||
ewl_filelist_refresh(EWL_FILELIST(fl));
|
||||
edje_object_signal_emit(gui, "ecdb,filelist_overlay,deactivate",
|
||||
"ecdb");
|
||||
edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
|
||||
}
|
||||
|
||||
|
@ -70,3 +70,56 @@ ecdb_image_init(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_match_keyword(const char *chk, const char *key, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (chk[i] != key[i])
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *
|
||||
ecdb_strip_next_argument(const char *strip)
|
||||
{
|
||||
char *t1 = (char *)strip, *t2;
|
||||
char *ret = NULL;
|
||||
int len = 0, space = FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if (*t1 == ' ')
|
||||
space = TRUE;
|
||||
|
||||
if ((*t1 != ' ') && (space == TRUE))
|
||||
{
|
||||
t2 = t1;
|
||||
|
||||
/* Find length of string to copy */
|
||||
while ((*t2) && (*t2 != ' '))
|
||||
{
|
||||
len++;
|
||||
t2++;
|
||||
}
|
||||
|
||||
/* Given no more args */
|
||||
if (!len)
|
||||
return NULL;
|
||||
else
|
||||
len++;
|
||||
|
||||
/* Make a new string and copy everything over */
|
||||
ret = malloc(sizeof(char) * len);
|
||||
memcpy(ret, t1, len);
|
||||
return ret;
|
||||
}
|
||||
} while ((t1) && (t1++));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -10,4 +10,7 @@ int ecdb_shutdown(void *data, int type, void *event);
|
||||
int ecdb_burn_init(void);
|
||||
int ecdb_image_init(void);
|
||||
|
||||
/* This is misc after all */
|
||||
int ecdb_match_keyword(const char *chk, const char *key, int len);
|
||||
char *ecdb_strip_next_argument(const char *strip);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user