From 380f28333f76937887b86835814a8ab445919a3d Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Fri, 18 Sep 2009 06:33:33 +0000 Subject: [PATCH] everything: - added config for popup position - make 'open term here' action work with other terminal SVN revision: 42554 --- src/modules/everything/e_mod_main.c | 8 ++++ src/modules/everything/evry.c | 8 ++-- src/modules/everything/evry_config.c | 37 +++++++++++++++++-- .../everything/sources/evry_plug_apps.c | 13 ++++--- .../everything/sources/evry_plug_dir_browse.c | 34 ++++++++--------- 5 files changed, 67 insertions(+), 33 deletions(-) diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index 51fdf8bb0..8a40ff536 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -222,6 +222,14 @@ _config_init() evry_conf->cmd_terminal = eina_stringshare_add("/usr/bin/xterm"); evry_conf->cmd_sudo = eina_stringshare_add("/usr/bin/gksudo --preserve-env"); } + + if ((evry_conf->rel_x > 1.0) || + (evry_conf->rel_x < 0.0)) + evry_conf->rel_x = 0.5; + + if ((evry_conf->rel_y > 1.0) || + (evry_conf->rel_y < 0.0)) + evry_conf->rel_y = 0.3; } diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index d6a9a031e..5c9b4025c 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -171,8 +171,8 @@ evry_show(E_Zone *zone, const char *params) (ECORE_X_EVENT_SELECTION_NOTIFY, _evry_cb_selection_notify, win)); - e_popup_move(win->popup, win->popup->x, win->popup->y - list->popup->h/2); - e_popup_move(list->popup, list->popup->x, list->popup->y - list->popup->h/2); + /* e_popup_move(win->popup, win->popup->x, win->popup->y - list->popup->h/2); + * e_popup_move(list->popup, list->popup->x, list->popup->y - list->popup->h/2); */ e_popup_layer_set(list->popup, 255); e_popup_layer_set(win->popup, 255); @@ -583,8 +583,8 @@ _evry_window_new(E_Zone *zone) if (evry_conf->width > mw) mw = evry_conf->width; - x = (zone->w / 2) - (mw / 2); - y = (zone->h / 2) - (mh / 2); + x = (zone->w * evry_conf->rel_x) - (mw / 2); + y = (zone->h * evry_conf->rel_y) - (mh / 2); e_popup_move_resize(popup, x, y, mw, mh); diff --git a/src/modules/everything/evry_config.c b/src/modules/everything/evry_config.c index 3925a345b..797efbc45 100644 --- a/src/modules/everything/evry_config.c +++ b/src/modules/everything/evry_config.c @@ -19,6 +19,7 @@ struct _E_Config_Dialog_Data int quick_nav; int width, height; + double rel_x, rel_y; int scroll_animate; char *cmd_terminal; @@ -68,6 +69,8 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->hide_list = evry_conf->hide_list; cfdata->hide_input = evry_conf->hide_input; cfdata->quick_nav = evry_conf->quick_nav; + cfdata->rel_x = evry_conf->rel_x; + cfdata->rel_y = evry_conf->rel_y; EINA_LIST_FOREACH(evry_conf->plugins, l, p) if (p->type == type_subject) @@ -122,6 +125,9 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) evry_conf->hide_input = cfdata->hide_input; evry_conf->hide_list = cfdata->hide_list; evry_conf->quick_nav = cfdata->quick_nav; + evry_conf->rel_x = cfdata->rel_x; + evry_conf->rel_y = cfdata->rel_y; + evry_conf->plugins = eina_list_sort(evry_conf->plugins, eina_list_count(evry_conf->plugins), _evry_cb_plugin_sort); @@ -205,7 +211,7 @@ _plugin_move_down_cb(void *data, void *data2) } static Evas_Object * -_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata) +_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *of, *ob, *otb; @@ -239,8 +245,11 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial e_widget_list_object_append(o, of, 1, 1, 0.5); + e_widget_toolbook_page_append(otb, NULL, _("General Settings"), + o, 1, 0, 1, 0, 0.5, 0.0); - of = e_widget_framelist_add(evas, _("Size"), 0); + o = e_widget_list_add(evas, 0, 0); + of = e_widget_framelist_add(evas, _("Popup Size"), 0); ob = e_widget_label_add(evas, _("Popup Width")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), @@ -256,14 +265,29 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); + of = e_widget_framelist_add(evas, _("Popup Align"), 0); + ob = e_widget_label_add(evas, _("Vertical")); + 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->rel_y), NULL, 200); + e_widget_framelist_object_append(of, ob); + + ob = e_widget_label_add(evas, _("Horizontal")); + 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->rel_x), NULL, 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); * ob = e_widget_check_add(evas, _("Scroll Animate"), * &(cfdata->scroll_animate)); * e_widget_framelist_object_append(of, ob); * e_widget_list_object_append(o, of, 1, 1, 0.5); */ - - e_widget_toolbook_page_append(otb, NULL, _("General Settings"), + e_widget_toolbook_page_append(otb, NULL, _("Position / Size"), o, 1, 0, 1, 0, 0.5, 0.0); ob = e_widget_list_add(evas, 1, 1); @@ -331,5 +355,10 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial e_widget_toolbook_page_show(otb, 0); + /* e_widget_size_min_set(otb, 350, 350); */ + e_widget_size_min_resize(otb); + + e_dialog_resizable_set(cfd->dia, 1); + return otb; } diff --git a/src/modules/everything/sources/evry_plug_apps.c b/src/modules/everything/sources/evry_plug_apps.c index 9b49d16fd..6e757d297 100644 --- a/src/modules/everything/sources/evry_plug_apps.c +++ b/src/modules/everything/sources/evry_plug_apps.c @@ -513,7 +513,7 @@ _icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) static int _exec_app_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) { - ITEM_APP(app, it); + /* ITEM_APP(app, it); */ /* if (app->desktop) * return 1; */ @@ -538,18 +538,19 @@ _exec_term_action(Evry_Action *act) Evry_Item_App *tmp; char buf[1024]; int ret; - + char *escaped = ecore_file_escape_name(app->file); + tmp = E_NEW(Evry_Item_App, 1); - snprintf(buf, sizeof(buf), "%s%s %s", + snprintf(buf, sizeof(buf), "%s -hold -e %s", evry_conf->cmd_terminal, - (strcmp(evry_conf->cmd_terminal, "/usr/bin/xterm") ? "" : " -hold -e"), - app->file); + (escaped ? escaped : app->file)); tmp->file = buf; ret = evry_util_exec_app(EVRY_ITEM(tmp), NULL); E_FREE(tmp); - + E_FREE(escaped); + return ret; } diff --git a/src/modules/everything/sources/evry_plug_dir_browse.c b/src/modules/everything/sources/evry_plug_dir_browse.c index 2bb9e287f..285774fa7 100644 --- a/src/modules/everything/sources/evry_plug_dir_browse.c +++ b/src/modules/everything/sources/evry_plug_dir_browse.c @@ -1,7 +1,7 @@ -#include "Evry.h" +#include "e_mod_main.h" #define MAX_ITEMS 100 -#define TERM_ACTION_DIR "/usr/bin/xterm -e \'cd %s && /bin/bash\'" +#define TERM_ACTION_DIR "%s" typedef struct _Plugin Plugin; typedef struct _Data Data; @@ -438,33 +438,29 @@ _open_term_action(Evry_Action *act) { ITEM_FILE(file, act->item1); Evry_Item_App *tmp; - char buf[1024]; - char *dir, *path; + char cwd[4096]; + char *dir; int ret = 0; if (act->item1->browseable) - { - path = ecore_file_escape_name(file->uri); - } + dir = strdup(file->uri); else - { - dir = ecore_file_dir_get(file->uri); - if (!dir) return 0; - path = ecore_file_escape_name(dir); + dir = ecore_file_dir_get(file->uri); - free(dir); - } - - if (path) + if (dir) { + getcwd(cwd, sizeof(cwd)); + chdir(dir); + tmp = E_NEW(Evry_Item_App, 1); - snprintf(buf, sizeof(buf), TERM_ACTION_DIR, path); - tmp->file = buf; + tmp->file = evry_conf->cmd_terminal; + ret = evry_util_exec_app(EVRY_ITEM(tmp), NULL); E_FREE(tmp); - free(path); + E_FREE(dir); + chdir(cwd); } - + return ret; }