the exebuf now has access to the exe history via the up arrow.

SVN revision: 26600
devs/princeamd/enlightenment-0.17-elive
Viktor Kojouharov 17 years ago
parent f32a6ec8b0
commit a04fa17a90
  1. 2
      TODO
  2. 2
      src/bin/e_config.c
  3. 1
      src/bin/e_config.h
  4. 130
      src/bin/e_exebuf.c
  5. 37
      src/bin/e_exehist.c
  6. 1
      src/bin/e_exehist.h
  7. 32
      src/bin/e_int_config_exebuf.c

@ -86,8 +86,6 @@ Some of the things (in very short form) that need to be done to E17...
* full fm2 support as an icon fm needs work - beyond fsel needs and for icons
on the desktop etc. etc.
* up arrow in exebuf with empty buf goes into history mode and up/down let u
browse command history
* switch to desktop of a new window if it opens on another desktop than the
current one (optional too)
* emit signal to submenu entries if they have a submenu shown for them or not

@ -447,6 +447,7 @@ e_config_init(void)
E_CONFIG_LIST(D, T, path_append_messages, _e_config_path_append_edd); /**/
E_CONFIG_VAL(D, T, exebuf_max_exe_list, INT);
E_CONFIG_VAL(D, T, exebuf_max_eap_list, INT);
E_CONFIG_VAL(D, T, exebuf_max_hist_list, INT);
E_CONFIG_VAL(D, T, exebuf_scroll_animate, INT);
E_CONFIG_VAL(D, T, exebuf_scroll_speed, DOUBLE);
E_CONFIG_VAL(D, T, exebuf_pos_align_x, DOUBLE);
@ -646,6 +647,7 @@ e_config_init(void)
e_config->input_method = NULL;
e_config->exebuf_max_exe_list = 20;
e_config->exebuf_max_eap_list = 20;
e_config->exebuf_max_hist_list = 20;
e_config->exebuf_scroll_animate = 1;
e_config->exebuf_scroll_speed = 0.1;
e_config->exebuf_pos_align_x = 0.5;

@ -199,6 +199,7 @@ struct _E_Config
int fullscreen_policy; // GUI
int exebuf_max_exe_list; // GUI
int exebuf_max_eap_list; // GUI
int exebuf_max_hist_list; // GUI
int exebuf_scroll_animate; // GUI
double exebuf_scroll_speed; // GUI
double exebuf_pos_align_x; // GUI

@ -45,6 +45,8 @@ static void _e_exebuf_prev(void);
static void _e_exebuf_complete(void);
static void _e_exebuf_backspace(void);
static void _e_exebuf_matches_update(void);
static void _e_exebuf_hist_update(void);
static void _e_exebuf_hist_clear(void);
static void _e_exebuf_cb_eap_item_mouse_in(void *data, Evas *evas,
Evas_Object *obj, void *event_info);
static void _e_exebuf_cb_exe_item_mouse_in(void *data, Evas *evas,
@ -82,6 +84,7 @@ static Evas_List *eaps = NULL;
#define NO_LIST 0
#define EAP_LIST 1
#define EXE_LIST 2
#define HIST_LIST 3
static int which_list = NO_LIST;
static E_Exebuf_Exe *exe_sel = NULL;
static int exe_scroll_to = 0;
@ -609,6 +612,32 @@ _e_exebuf_next(void)
}
}
}
else if (which_list == HIST_LIST)
{
if (exe_sel)
{
for (i = 0, l = eaps; l; l = l->next, i++)
{
if (l->data == exe_sel)
{
_e_exebuf_exe_desel(exe_sel);
if (l->prev)
{
exe_sel = l->prev->data;
_e_exebuf_exe_sel(exe_sel);
_e_exebuf_eap_scroll_to(i - 1);
}
else
{
exe_sel = NULL;
which_list = NO_LIST;
_e_exebuf_hist_clear();
}
break;
}
}
}
}
}
}
@ -630,6 +659,17 @@ _e_exebuf_prev(void)
_e_exebuf_eap_scroll_to(0);
}
}
else
{
_e_exebuf_hist_update();
which_list = HIST_LIST;
exe_sel = eaps->data;
if (exe_sel)
{
_e_exebuf_exe_sel(exe_sel);
_e_exebuf_eap_scroll_to(0);
}
}
}
else
{
@ -678,6 +718,26 @@ _e_exebuf_prev(void)
}
}
}
else if (which_list == HIST_LIST)
{
if (exe_sel)
{
for (i = 0, l = eaps; l; l = l->next, i++)
{
if (l->data == exe_sel)
{
if (l->next)
{
_e_exebuf_exe_desel(exe_sel);
exe_sel = l->next->data;
_e_exebuf_exe_sel(exe_sel);
_e_exebuf_eap_scroll_to(i + 1);
}
break;
}
}
}
}
}
}
@ -687,7 +747,10 @@ _e_exebuf_complete(void)
char common[EXEBUFLEN], *exe = NULL;
Evas_List *l;
int orig_len = 0, common_len = 0, exe_len, next_char, val, pos, matches;
int clear_hist = 0;
if (!(strlen(cmd_buf)))
clear_hist = 1;
if (exe_sel)
{
if (exe_sel->app)
@ -745,6 +808,8 @@ _e_exebuf_complete(void)
strncpy(cmd_buf, exe, common_len);
cmd_buf[common_len] = 0;
}
if (clear_hist)
_e_exebuf_hist_clear();
_e_exebuf_update();
_e_exebuf_matches_update();
}
@ -1017,6 +1082,66 @@ _e_exebuf_matches_update(void)
evas_event_thaw(exebuf->evas);
}
static void
_e_exebuf_hist_update(void)
{
Evas_List *list = NULL, *l = NULL;
edje_object_signal_emit(bg_object, "e,action,show,history", "e");
list = evas_list_reverse(e_exehist_list_get());
for (l = list; l; l = l->next)
{
E_Exebuf_Exe *exe;
Evas_Coord mw, mh;
Evas_Object *o;
exe = calloc(1, sizeof(E_Exebuf_Exe));
exe->file = l->data;
eaps = evas_list_prepend(eaps, exe);
o = edje_object_add(exebuf->evas);
exe->bg_object = o;
e_theme_edje_object_set(o, "base/theme/exebuf",
"e/widgets/exebuf/item");
edje_object_part_text_set(o, "e.text.title", exe->file);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
_e_exebuf_cb_exe_item_mouse_in, exe);
evas_object_show(o);
edje_object_size_min_calc(exe->bg_object, &mw, &mh);
e_box_pack_end(eap_list_object, exe->bg_object);
e_box_pack_options_set(exe->bg_object,
1, 1, /* fill */
1, 0, /* expand */
0.5, 0.5, /* align */
mw, mh, /* min */
9999, mh /* max */
);
}
evas_list_free(list);
}
static void
_e_exebuf_hist_clear(void)
{
edje_object_signal_emit(bg_object, "e,action,hide,history", "e");
evas_event_freeze(exebuf->evas);
e_box_freeze(eap_list_object);
e_box_freeze(exe_list_object);
while (eaps)
{
_e_exebuf_exe_free((E_Exebuf_Exe *)(eaps->data));
eaps = evas_list_remove_list(eaps, eaps);
}
e_box_thaw(exe_list_object);
e_box_thaw(eap_list_object);
evas_event_thaw(exebuf->evas);
e_box_align_set(eap_list_object, 0.5, 0.0);
e_box_align_set(exe_list_object, 0.5, 1.0);
exe_sel = NULL;
which_list = NO_LIST;
}
static void
_e_exebuf_cb_eap_item_mouse_in(void *data, Evas *evas, Evas_Object *obj,
void *event_info)
@ -1033,7 +1158,8 @@ _e_exebuf_cb_exe_item_mouse_in(void *data, Evas *evas, Evas_Object *obj,
{
if (exe_sel) _e_exebuf_exe_desel(exe_sel);
if (!(exe_sel = data)) return;
which_list = EXE_LIST;
if (which_list != HIST_LIST)
which_list = EXE_LIST;
_e_exebuf_exe_sel(exe_sel);
}
@ -1078,6 +1204,8 @@ _e_exebuf_cb_key_down(void *data, int type, void *event)
{
if ((strlen(cmd_buf) < (EXEBUFLEN - strlen(ev->key_compose))))
{
if (!(strlen(cmd_buf)) && exe_sel)
_e_exebuf_hist_clear();
strcat(cmd_buf, ev->key_compose);
_e_exebuf_update();
_e_exebuf_matches_update();

@ -128,6 +128,43 @@ e_exehist_newest_run_get(const char *exe)
return 0.0;
}
EAPI Evas_List *
e_exehist_list_get(void)
{
Evas_List *list = NULL, *l, *m;
int count = 1;
int max;
max = e_config->exebuf_max_hist_list;
if (!max) max = 20;
_e_exehist_load();
for (l = evas_list_last(_e_exehist->history); l; l = l->prev)
{
int bad = 0;
E_Exehist_Item *ei;
ei = l->data;
if (!(ei->exe)) continue;
for (m = list; m; m = m->next)
{
const char *exe;
if (!(exe = m->data)) continue;
if (!strcmp(exe, ei->exe))
{
bad = 1;
break;
}
}
if (!(bad)) {
list = evas_list_append(list, ei->exe);
count++;
}
if (count > max) break;
}
return list;
}
/* local subsystem functions */
static void
_e_exehist_unload_queue(void)

@ -14,6 +14,7 @@ EAPI void e_exehist_add(const char *launch_method, const char *exe);
EAPI void e_exehist_clear(void);
EAPI int e_exehist_popularity_get(const char *exe);
EAPI double e_exehist_newest_run_get(const char *exe);
EAPI Evas_List *e_exehist_list_get(void);
/*
EAPI double e_exehist_last_run_get(const char *exe);
*/

@ -12,6 +12,7 @@ struct _E_Config_Dialog_Data
/* Basic */
int max_exe_list;
int max_eap_list;
int max_hist_list;
int scroll_animate;
/* Advanced */
double scroll_speed;
@ -54,6 +55,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
/* Basic */
cfdata->max_exe_list = e_config->exebuf_max_exe_list;
cfdata->max_eap_list = e_config->exebuf_max_eap_list;
cfdata->max_hist_list = e_config->exebuf_max_hist_list;
cfdata->scroll_animate = e_config->exebuf_scroll_animate;
/* Advanced */
cfdata->scroll_speed = e_config->exebuf_scroll_speed;
@ -91,6 +93,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
e_config->exebuf_max_exe_list = cfdata->max_exe_list;
e_config->exebuf_max_eap_list = cfdata->max_eap_list;
e_config->exebuf_max_hist_list = cfdata->max_hist_list;
e_config->exebuf_scroll_animate = cfdata->scroll_animate;
e_config_save_queue();
return 1;
@ -112,6 +115,10 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL, &(cfdata->max_exe_list), 200);
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Maximum History to List"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 200, 5, 0, NULL, &(cfdata->max_hist_list), 200);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Scroll Settings"), 0);
@ -126,6 +133,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
e_config->exebuf_max_exe_list = cfdata->max_exe_list;
e_config->exebuf_max_eap_list = cfdata->max_eap_list;
e_config->exebuf_max_hist_list = cfdata->max_hist_list;
e_config->exebuf_scroll_animate = cfdata->scroll_animate;
e_config->exebuf_scroll_speed = cfdata->scroll_speed;
e_config->exebuf_pos_align_x = cfdata->pos_align_x;
@ -163,6 +171,10 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL, &(cfdata->max_exe_list), 200);
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Maximum History to List"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 200, 5, 0, NULL, &(cfdata->max_hist_list), 200);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Scroll Settings"), 0);
@ -174,15 +186,11 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Position Settings"), 0);
ob = e_widget_label_add(evas, _("X-Axis Alignment"));
of = e_widget_framelist_add(evas, _("Terminal Settings"), 0);
ob = e_widget_label_add(evas, _("Terminal Command"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, &(cfdata->pos_align_x), NULL, 200);
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Y-Axis Alignment"));
ob = e_widget_entry_add(evas, &(cfdata->term_cmd));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, &(cfdata->pos_align_y), NULL, 200);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 0, 2, 1, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Size Settings"), 0);
@ -204,11 +212,15 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 1, 0, 1, 2, 1, 0, 1, 0);
of = e_widget_framelist_add(evas, _("Terminal Settings"), 0);
ob = e_widget_label_add(evas, _("Terminal Command"));
of = e_widget_framelist_add(evas, _("Position Settings"), 0);
ob = e_widget_label_add(evas, _("X-Axis Alignment"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_entry_add(evas, &(cfdata->term_cmd));
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, &(cfdata->pos_align_x), NULL, 200);
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Y-Axis Alignment"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, &(cfdata->pos_align_y), NULL, 200);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 1, 2, 1, 1, 1, 1, 1, 1);
e_widget_list_object_append(o, ot, 1, 1, 0.5);

Loading…
Cancel
Save