From 60de7053b864b81b7f7a6fa56d38abf10f9e21da Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Thu, 5 Mar 2020 18:10:46 +0000 Subject: [PATCH] editor: Improve non development mode. Add some homage to rage... --- src/bin/edi_filepanel.c | 32 ++++++++++++++++++++++++++++++-- src/bin/edi_main.c | 17 ++++++++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c index 192db24..59958be 100644 --- a/src/bin/edi_filepanel.c +++ b/src/bin/edi_filepanel.c @@ -524,7 +524,7 @@ _item_menu_create(Evas_Object *win, Edi_Dir_Data *sd) static void _item_menu_open_terminal_cb(void *data, Evas_Object *obj EINA_UNUSED, - void *event_info EINA_UNUSED) + void *event_info EINA_UNUSED) { const char *format; char *cmd; @@ -532,11 +532,34 @@ _item_menu_open_terminal_cb(void *data, Evas_Object *obj EINA_UNUSED, Edi_Dir_Data *sd; sd = data; - format = "terminology -d=\"%s\""; if (!sd->isdir) return; + format = "terminology -d=\"%s\""; + + cmdlen = strlen(sd->path) + strlen(format) + 1; + cmd = malloc(sizeof(char) * cmdlen); + snprintf(cmd, cmdlen, format, sd->path); + + ecore_exe_run(cmd, NULL); + free(cmd); +} + +static void +_item_menu_open_rage_cb(void *data, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + const char *format; + Edi_Dir_Data *sd; + char *cmd; + int cmdlen; + + sd = data; + if (!sd->isdir) return; + + format = "rage \"%s\""; + cmdlen = strlen(sd->path) + strlen(format) + 1; cmd = malloc(sizeof(char) * cmdlen); snprintf(cmd, cmdlen, format, sd->path); @@ -620,6 +643,11 @@ _item_menu_dir_create(Evas_Object *win, Edi_Dir_Data *sd) if (ecore_file_dir_is_empty(sd->path)) elm_menu_item_add(menu, menu_it, "edit-delete", _("Remove Directory"), _item_menu_rmdir_cb, sd); } + if (ecore_file_app_installed("rage")) + { + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_add(menu, menu_it, "rage", _("Open with Rage"), _item_menu_open_rage_cb, sd); + } } static void diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index 0a0a724..de497c8 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -590,7 +590,14 @@ edi_content_setup(Evas_Object *win, const char *path) evas_object_show(_edi_panel_tab_for_index(_edi_project_config->gui.bottomtab)); evas_object_smart_callback_add(logpane, "unpress", _edi_panel_dragged_cb, NULL); + if (!edi_project_mode_get()) + { + elm_panes_content_right_size_set(logpane, 0.0); + evas_object_del(tb); + } + evas_object_show(logpane); + _edi_bottompanes = logpane; return logpane; @@ -1303,9 +1310,13 @@ _edi_menu_setup(Evas_Object *win) elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("edit-find-replace"), _("Find & Replace"), _edi_menu_find_cb, NULL); elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("edit-find"), _("Find file"), _edi_menu_findfile_cb, NULL); elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("go-jump"), MENU_ELLIPSIS(_("Goto Line")), _edi_menu_goto_cb, NULL); - elm_menu_item_separator_add(menu, menu_it); - elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("edit-find"), MENU_ELLIPSIS(_("Find in project")), _edi_menu_find_project_cb, NULL); - elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("edit-find-replace"), MENU_ELLIPSIS(_("Replace in project")), _edi_menu_find_replace_project_cb, NULL); + + if (edi_project_mode_get()) + { + elm_menu_item_separator_add(menu, menu_it); + elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("edit-find"), MENU_ELLIPSIS(_("Find in project")), _edi_menu_find_project_cb, NULL); + elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("edit-find-replace"), MENU_ELLIPSIS(_("Replace in project")), _edi_menu_find_replace_project_cb, NULL); + } menu_it = elm_menu_item_add(menu, NULL, NULL, _("View"), NULL, NULL); elm_menu_item_add(menu, menu_it, edi_theme_icon_path_get("window-new"), _("New Window"), _edi_menu_view_open_window_cb, NULL);