From 0dcb0574593540c35eaccf53eac5fbedb6974ba6 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Sat, 24 Jan 2009 21:51:29 +0100 Subject: [PATCH] separated out history section names to history.h --- edit/editcmd.c | 17 +++++++++-------- src/cmd.c | 12 ++++++------ src/ext.c | 2 +- src/history.h | 36 ++++++++++++++++++++++++++++++++++++ src/hotlist.c | 2 +- src/panelize.c | 2 +- src/tree.c | 4 ++-- src/user.c | 2 +- src/view.c | 6 +++--- vfs/ftpfs.c | 2 +- vfs/utilvfs.c | 2 +- 11 files changed, 62 insertions(+), 25 deletions(-) create mode 100644 src/history.h diff --git a/edit/editcmd.c b/edit/editcmd.c index 92f8b30fc..de8cf79f4 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -40,6 +40,7 @@ #include #include "../src/global.h" +#include "../src/history.h" #include "edit.h" #include "editlock.h" @@ -522,8 +523,8 @@ edit_save_as_cmd (WEdit *edit) int save_lock = 0; int different_filename = 0; - exp = input_expand_dialog (_(" Save As "), _(" Enter file name: "), - ":edit_save_as_cmd: Save As ", edit->filename); + exp = input_expand_dialog ( + _(" Save As "), _(" Enter file name: "),MC_HISTORY_EDIT_SAVE_AS, edit->filename); edit_push_action (edit, KEY_PRESS + edit->start_display); if (exp) { @@ -906,7 +907,7 @@ edit_load_cmd (WEdit *edit) } exp = input_expand_dialog (_(" Load "), _(" Enter file name: "), - ":edit_load_cmd: Load ", edit->filename); + MC_HISTORY_EDIT_LOAD, edit->filename); if (exp) { if (*exp) @@ -2337,7 +2338,7 @@ edit_goto_cmd (WEdit *edit) char s[32]; g_snprintf (s, sizeof (s), "%ld", line); - f = input_dialog (_(" Goto line "), _(" Enter line: "), ":edit_goto_cmd: Goto line ", + f = input_dialog (_(" Goto line "), _(" Enter line: "), MC_HISTORY_EDIT_GOTO_LINE, line ? s : ""); if (!f) return; @@ -2373,7 +2374,7 @@ edit_save_block_cmd (WEdit *edit) return 1; exp = input_expand_dialog (_(" Save Block "), _(" Enter file name: "), - ":edit_save_block_cmd: Save Block ", + MC_HISTORY_EDIT_SAVE_BLOCK, catstrs (home_dir, PATH_SEP_STR CLIP_FILE, (char *) NULL)); edit_push_action (edit, KEY_PRESS + edit->start_display); if (exp) { @@ -2403,7 +2404,7 @@ int edit_insert_file_cmd (WEdit *edit) { char *exp = input_expand_dialog (_(" Insert File "), _(" Enter file name: "), - ":edit_insert_file_cmd: Insert File ", + MC_HISTORY_EDIT_INSERT_FILE, catstrs (home_dir, PATH_SEP_STR CLIP_FILE, (char *) NULL)); edit_push_action (edit, KEY_PRESS + edit->start_display); if (exp) { @@ -2443,7 +2444,7 @@ int edit_sort_cmd (WEdit * edit) exp = input_dialog (_(" Run Sort "), _(" Enter sort options (see manpage) separated by whitespace: "), - ":edit_sort_cmd: Run Sort ", (old != NULL) ? old : ""); + MC_HISTORY_EDIT_SORT, (old != NULL) ? old : ""); if (!exp) return 1; @@ -2485,7 +2486,7 @@ edit_ext_cmd (WEdit *edit) exp = input_dialog (_("Paste output of external command"), _("Enter shell command(s):"), - ":edit_ext_cmd: Paste output of ext.cmd ", NULL); + MC_HISTORY_EDIT_PASTE_EXTCMD, NULL); if (!exp) return 1; diff --git a/src/cmd.c b/src/cmd.c index 50069445e..03e333096 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -229,7 +229,7 @@ view_file_cmd (void) filename = input_expand_dialog (_(" View file "), _(" Filename:"), - ":view_file_cmd: View file ", selection (current_panel)->fname); + MC_HISTORY_FM_VIEW_FILE, selection (current_panel)->fname); if (!filename) return; @@ -252,7 +252,7 @@ filtered_view_cmd (void) command = input_dialog (_(" Filtered view "), _(" Filter command and arguments:"), - ":filtered_view_cmd: Filtered view ", + MC_HISTORY_FM_FILTERED_VIEW, selection (current_panel)->fname); if (!command) return; @@ -352,7 +352,7 @@ mkdir_cmd (void) dir = input_expand_dialog (_("Create a new Directory"), _(" Enter directory name:"), - ":mkdir_cmd: Create a new Directory", ""); + MC_HISTORY_FM_MKDIR, ""); if (!dir) return; @@ -424,7 +424,7 @@ set_panel_filter (WPanel *p) reg_exp = input_dialog_help (_(" Filter "), _(" Set expression for filtering filenames"), - "[Filter...]", ":set_panel_filter: Filter ", x); + "[Filter...]", MC_HISTORY_FM_PANEL_FILTER, x); if (!reg_exp) return; set_panel_filter_to (p, reg_exp); @@ -905,7 +905,7 @@ do_link (int symbolic_link, const char *fname) if (!symbolic_link) { src = g_strdup_printf (_("Link %s to:"), name_trunc (fname, 46)); - dest = input_expand_dialog (_(" Link "), src, ":do_link: Link ", ""); + dest = input_expand_dialog (_(" Link "), src, MC_HISTORY_FM_LINK, ""); if (!dest || !*dest) goto cleanup; save_cwds_stat (); @@ -974,7 +974,7 @@ void edit_symlink_cmd (void) i = readlink (p, buffer, MC_MAXPATHLEN - 1); if (i > 0) { buffer [i] = 0; - dest = input_expand_dialog (_(" Edit symlink "), q, ":edit_symlink_cmd: Edit symlink ", buffer); + dest = input_expand_dialog (_(" Edit symlink "), q, MC_HISTORY_FM_EDIT_LINK, buffer); if (dest) { if (*dest && strcmp (buffer, dest)) { save_cwds_stat (); diff --git a/src/ext.c b/src/ext.c index 735856c77..ec992e4dc 100644 --- a/src/ext.c +++ b/src/ext.c @@ -114,7 +114,7 @@ exec_extension (const char *filename, const char *data, int *move_dir, if (*data == '}') { char *parameter; parameter_found = 0; - parameter = input_dialog (_(" Parameter "), prompt, ":exec_extension: Parameter ", ""); + parameter = input_dialog (_(" Parameter "), prompt, MC_HISTORY_EXT_PARAMETER, ""); if (!parameter) { /* User canceled */ fclose (cmd_file); diff --git a/src/history.h b/src/history.h new file mode 100644 index 000000000..efd4e1676 --- /dev/null +++ b/src/history.h @@ -0,0 +1,36 @@ +#ifndef __MC_HISTORY_H +#define __MC_HISTORY_H + +/* history section names */ + +#define MC_HISTORY_EDIT_SAVE_AS "mc.edit.save-as" +#define MC_HISTORY_EDIT_LOAD "mc.edit.load" +#define MC_HISTORY_EDIT_SAVE_BLOCK "mc.edit.save-block" +#define MC_HISTORY_EDIT_INSERT_FILE "mc.edit.insert-file" +#define MC_HISTORY_EDIT_GOTO_LINE "mc.edit.goto-line" +#define MC_HISTORY_EDIT_SORT "mc.edit.sort" +#define MC_HISTORY_EDIT_PASTE_EXTCMD "mc.edit.paste-extcmd" + +#define MC_HISTORY_FM_VIEW_FILE "mc.fm.view-file" +#define MC_HISTORY_FM_MKDIR "mc.fm.mkdir" +#define MC_HISTORY_FM_LINK "mc.fm.link" +#define MC_HISTORY_FM_EDIT_LINK "mc.fm.edit-link" +#define MC_HISTORY_FM_TREE_COPY "mc.fm.tree-copy" +#define MC_HISTORY_FM_TREE_MOVE "mc.fm.tree-move" +#define MC_HISTORY_FM_PANELIZE_ADD "mc.fm.panelize.add" +#define MC_HISTORY_FM_FILTERED_VIEW "mc.fm.filtered-view" +#define MC_HISTORY_FM_PANEL_FILTER "mc.fm.panel-filter" +#define MC_HISTORY_FM_MENU_EXEC_PARAM "mc.fm.menu.exec.parameter" + +#define MC_HISTORY_VIEW_GOTO_LINE "mc.view.goto-line" +#define MC_HISTORY_VIEW_GOTO_ADDR "mc.view.goto-addr" +#define MC_HISTORY_VIEW_SEARCH_REGEX "mc.view.search.regex" + +#define MC_HISTORY_FTPFS_ACCOUNT "mc.vfs.ftp.account" +#define MC_HISTORY_VFS_PASSWORD "mc.vfs.password" + +#define MC_HISTORY_EXT_PARAMETER "mc.ext.parameter" + +#define MC_HISTORY_HOTLIST_ADD "mc.hotlist.add" + +#endif diff --git a/src/hotlist.c b/src/hotlist.c index ff09a4202..1bfa11246 100644 --- a/src/hotlist.c +++ b/src/hotlist.c @@ -1042,7 +1042,7 @@ void add2hotlist_cmd (void) strip_password (label_string, 1); prompt = g_strdup_printf (cp, path_trunc (current_panel->cwd, COLS-2*UX-(l+8))); - label = input_dialog (_(" Add to hotlist "), prompt, ":add2hotlist_cmd: Add to hotlist ", label_string); + label = input_dialog (_(" Add to hotlist "), prompt, MC_HISTORY_HOTLIST_ADD, label_string); g_free (prompt); if (!label || !*label) { diff --git a/src/panelize.c b/src/panelize.c index 10b0abffd..87d279c0c 100644 --- a/src/panelize.c +++ b/src/panelize.c @@ -226,7 +226,7 @@ add2panelize_cmd (void) if (pname->buffer && (*pname->buffer)) { label = input_dialog (_(" Add to external panelize "), _(" Enter command label: "), - ":add2panelize_cmd: Add to external panelize ", + MC_HISTORY_PANELIZE_ADD, ""); if (!label) return; diff --git a/src/tree.c b/src/tree.c index 51a4ea347..cb8459953 100644 --- a/src/tree.c +++ b/src/tree.c @@ -598,7 +598,7 @@ static void tree_copy (WTree *tree, const char *default_dest) return; g_snprintf (cmd_buf, sizeof(cmd_buf), _("Copy \"%s\" directory to:"), name_trunc (tree->selected_ptr->name, 50)); - dest = input_expand_dialog (_(" Copy "), cmd_buf, ":tree_copy: Copy ", default_dest); + dest = input_expand_dialog (_(" Copy "), cmd_buf, MC_HISTORY_FM_TREE_COPY, default_dest); if (!dest) return; @@ -641,7 +641,7 @@ static void tree_move (WTree *tree, const char *default_dest) return; g_snprintf (cmd_buf, sizeof (cmd_buf), _("Move \"%s\" directory to:"), name_trunc (tree->selected_ptr->name, 50)); - dest = input_expand_dialog (_(" Move "), cmd_buf, ":tree_move: Move ", default_dest); + dest = input_expand_dialog (_(" Move "), cmd_buf, MC_HISTORY_FM_TREE_MOVE, default_dest); if (!dest) return; if (!*dest){ diff --git a/src/user.c b/src/user.c index cc94bf264..f80fe3d21 100644 --- a/src/user.c +++ b/src/user.c @@ -604,7 +604,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands) if (*commands == '}'){ char *tmp; *parameter = 0; - parameter = input_dialog (_(" Parameter "), prompt, ":execute_menu_command: Parameter ", ""); + parameter = input_dialog (_(" Parameter "), prompt, MC_HISTORY_FM_EXEC_PARAM, ""); if (!parameter || !*parameter){ /* User canceled */ fclose (cmd_file); diff --git a/src/view.c b/src/view.c index a3555964f..19acc4b36 100644 --- a/src/view.c +++ b/src/view.c @@ -2734,7 +2734,7 @@ view_moveto_line_cmd (WView *view) g_snprintf (prompt, sizeof (prompt), _(" The current line number is %d.\n" " Enter the new line number:"), (int) (line + 1)); - answer = input_dialog (_(" Goto line "), prompt, ":view_moveto_line_cmd: Goto line ", ""); + answer = input_dialog (_(" Goto line "), prompt, MC_HISTORY_VIEW_GOTO_LINE, ""); if (answer != NULL && answer[0] != '\0') { errno = 0; line = strtoul (answer, &answer_end, 10); @@ -2755,7 +2755,7 @@ view_moveto_addr_cmd (WView *view) g_snprintf (prompt, sizeof (prompt), _(" The current address is 0x%lx.\n" " Enter the new address:"), view->hex_cursor); - line = input_dialog (_(" Goto Address "), prompt, ":view_moveto_addr_cmd: Goto Address ", ""); + line = input_dialog (_(" Goto Address "), prompt, MC_HISTORY_VIEW_GOTO_ADDR, ""); if (line != NULL) { if (*line != '\0') { addr = strtoul (line, &error, 0); @@ -2788,7 +2788,7 @@ regexp_search (WView *view, int direction) defval = (last_regexp != NULL ? last_regexp : ""); - regexp = input_dialog (_("Search"), _(" Enter regexp:"), ":regexp_search: Search", defval); + regexp = input_dialog (_("Search"), _(" Enter regexp:"), MC_HISTORY_VIEW_SEARCH_REGEX, defval); if (regexp == NULL || regexp[0] == '\0') { g_free (regexp); return; diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index bb20cad90..11c79c509 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -499,7 +499,7 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, p = g_strdup_printf (_ ("FTP: Account required for user %s"), SUP.user); - op = input_dialog (p, _("Account:"), (char *) NULL, ""); + op = input_dialog (p, _("Account:"), MC_HISTORY_FTPFS_ACCOUNT(char *) NULL, ""); g_free (p); if (op == NULL) ERRNOR (EPERM, 0); diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c index ecbe9f526..7a4880fea 100644 --- a/vfs/utilvfs.c +++ b/vfs/utilvfs.c @@ -839,5 +839,5 @@ vfs_die (const char *m) char * vfs_get_password (const char *msg) { - return input_dialog (msg, _("Password:"), (char *) NULL, INPUT_PASSWORD); + return input_dialog (msg, _("Password:"), MC_HISTORY_VFS_PASSWORD, INPUT_PASSWORD); }