mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Notice: release coming in about 90 minutes.
Miguel. 1999-02-15 Miguel de Icaza <miguel@nuclecu.unam.mx> * gcmd.c (gnome_open_terminal_with_cmd): New routine, based on the gnome_open_terminal routine, that will allow the user to specify a command to execute (used internally). * gaction.c (gmc_edit_filename): Support for the GNOME editor environment properties. * gdesktop.c (create_desktop_dir): Support GNOME_DESKTOP_DIR variable to configure the desktop directory.
This commit is contained in:
parent
39d815d7e9
commit
1370e6c166
@ -5,7 +5,7 @@ AC_INIT(create_vcs)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
PACKAGE=mc
|
||||
VERSION=4.5.14
|
||||
VERSION=4.5.15
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
|
||||
AC_SUBST(VERSION)
|
||||
|
@ -1,3 +1,15 @@
|
||||
1999-02-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* gcmd.c (gnome_open_terminal_with_cmd): New routine, based on the
|
||||
gnome_open_terminal routine, that will allow the user to specify a
|
||||
command to execute (used internally).
|
||||
|
||||
* gaction.c (gmc_edit_filename): Support for the GNOME editor
|
||||
environment properties.
|
||||
|
||||
* gdesktop.c (create_desktop_dir): Support GNOME_DESKTOP_DIR
|
||||
variable to configure the desktop directory.
|
||||
|
||||
1999-02-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* mc.keys.in.in: Use "gnome-moz-remote file:%d/%f" for the html
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "../vfs/vfs.h"
|
||||
|
||||
static void
|
||||
gmc_execute (char *fname, char *buf)
|
||||
gmc_execute (const char *fname, const char *buf)
|
||||
{
|
||||
exec_extension (fname, buf, NULL, NULL, 0);
|
||||
}
|
||||
@ -81,6 +81,8 @@ gmc_edit_filename (char *fname)
|
||||
const char *cmd;
|
||||
char *buf;
|
||||
int size;
|
||||
char *editor, *type;
|
||||
int on_terminal;
|
||||
|
||||
if (gnome_metadata_get (fname, "edit", &size, &buf) == 0){
|
||||
gmc_execute (fname, buf);
|
||||
@ -89,18 +91,43 @@ gmc_edit_filename (char *fname)
|
||||
}
|
||||
|
||||
mime_type = gnome_mime_type_or_default (fname, NULL);
|
||||
if (!mime_type)
|
||||
return 0;
|
||||
|
||||
|
||||
if (mime_type){
|
||||
cmd = gnome_mime_get_value (mime_type, "edit");
|
||||
|
||||
if (cmd){
|
||||
gmc_execute (fname, cmd);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
gnome_config_push_prefix( "/editor/Editor/");
|
||||
type = gnome_config_get_string ("EDITOR_TYPE=executable");
|
||||
|
||||
if (strcmp (type, "mc-internal") == 0){
|
||||
g_free (type);
|
||||
do_edit (fname);
|
||||
return 1;
|
||||
}
|
||||
g_free (type);
|
||||
|
||||
editor = gnome_config_get_string ("EDITOR=emacs");
|
||||
on_terminal = gnome_config_get_bool ("NEEDS_TERM=false");
|
||||
|
||||
if (on_terminal){
|
||||
char *quoted = name_quote (fname, 0);
|
||||
char *editor_cmd = g_strconcat (editor, " ", quoted, NULL);
|
||||
|
||||
gnome_open_terminal_with_cmd (editor_cmd);
|
||||
g_free (quoted);
|
||||
g_free (editor_cmd);
|
||||
} else {
|
||||
char *cmd = g_strconcat (editor, " %s", NULL);
|
||||
|
||||
gmc_execute (fname, cmd);
|
||||
g_free (cmd);
|
||||
}
|
||||
|
||||
g_free (editor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -112,7 +139,7 @@ gmc_open (file_entry *fe)
|
||||
}
|
||||
|
||||
static void
|
||||
gmc_run_view (char *filename, char *buf)
|
||||
gmc_run_view (const char *filename, const char *buf)
|
||||
{
|
||||
exec_extension (filename, buf, NULL, NULL, 0);
|
||||
}
|
||||
|
21
gnome/gcmd.c
21
gnome/gcmd.c
@ -60,7 +60,7 @@ gnome_compare_panels (void)
|
||||
}
|
||||
|
||||
void
|
||||
gnome_open_terminal (void)
|
||||
gnome_open_terminal_with_cmd (const char *command)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -71,12 +71,27 @@ gnome_open_terminal (void)
|
||||
if (!(p = gnome_is_program_in_path ("rxvt")))
|
||||
p = gnome_is_program_in_path ("xterm");
|
||||
|
||||
if (p)
|
||||
if (p){
|
||||
if (command){
|
||||
char *q;
|
||||
|
||||
q = g_strconcat (p, " -e ", command, NULL);
|
||||
my_system (EXECUTE_AS_SHELL, shell, q);
|
||||
g_free (q);
|
||||
} else
|
||||
my_system (EXECUTE_AS_SHELL, shell, p);
|
||||
else
|
||||
|
||||
g_free (p);
|
||||
} else
|
||||
message (1, MSG_ERROR, " Could not start a terminal ");
|
||||
}
|
||||
|
||||
void
|
||||
gnome_open_terminal (void)
|
||||
{
|
||||
gnome_open_terminal_with_cmd (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_about_cmd (void)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
void gnome_listing_cmd (GtkWidget *widget, WPanel *panel);
|
||||
void gnome_compare_panels (void);
|
||||
void gnome_open_terminal (void);
|
||||
void gnome_open_terminal_with_cmd (const char *command);
|
||||
void gnome_about_cmd (void);
|
||||
void gnome_quit_cmd (void);
|
||||
void gnome_open_panel (GtkWidget *widget, WPanel *panel);
|
||||
|
@ -1532,6 +1532,9 @@ create_desktop_dir (void)
|
||||
{
|
||||
char *home_link_name;
|
||||
|
||||
if (getenv ("GNOME_DESKTOP_DIR") != NULL)
|
||||
desktop_directory = g_strdup (getenv ("GNOME_DESKTOP_DIR"));
|
||||
else
|
||||
desktop_directory = g_concat_dir_and_file (gnome_user_home_dir, DESKTOP_DIR_NAME);
|
||||
|
||||
if (!g_file_exists (desktop_directory)) {
|
||||
|
@ -52,6 +52,8 @@ int dialog_panel_callback (struct Dlg_head *h, int id, int msg);
|
||||
/* The Dlg_head for the whole desktop */
|
||||
Dlg_head *desktop_dlg;
|
||||
|
||||
int run_desktop = 1;
|
||||
|
||||
/* This is only used by the editor, so we provide a dummy implementation */
|
||||
void
|
||||
try_alloc_color_pair (char *str, char *str2)
|
||||
@ -506,7 +508,9 @@ create_panels (void)
|
||||
{
|
||||
WPanel *panel;
|
||||
|
||||
if (run_desktop)
|
||||
desktop_init ();
|
||||
|
||||
cmdline = command_new (0, 0, 0);
|
||||
the_hint = label_new (0, 0, 0, NULL);
|
||||
|
||||
|
@ -2261,8 +2261,16 @@ void edit_quit_cmd (WEdit * edit)
|
||||
unlink (catstrs (edit->dir, edit->filename, 0));
|
||||
#endif
|
||||
#ifdef MIDNIGHT
|
||||
edit->widget.parent->running = 0;
|
||||
dlg_stop (edit->widget.parent);
|
||||
#else
|
||||
#ifdef GTK
|
||||
{
|
||||
extern char *edit_one_file;
|
||||
|
||||
if (edit_one_file)
|
||||
gtk_main_quit ();
|
||||
}
|
||||
#endif
|
||||
edit->stopped = 1;
|
||||
#endif
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ quote_block (quote_func_t quote_func, char **quoting_block)
|
||||
}
|
||||
|
||||
void
|
||||
exec_extension (char *filename, char *data, char **drops, int *move_dir, int start_line)
|
||||
exec_extension (const char *filename, const char *data, char **drops, int *move_dir, int start_line)
|
||||
{
|
||||
char *file_name;
|
||||
int cmd_file_fd;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __EXT_H
|
||||
|
||||
char *regex_command (char *filename, char *action, char **drops, int *move_dir);
|
||||
void exec_extension (char *filename, char *data, char **drops, int *move_dir, int start_line);
|
||||
void exec_extension (const char *filename, const char *data, char **drops, int *move_dir, int start_line);
|
||||
|
||||
/* Call it after the user has edited the mc.ext file,
|
||||
* to flush the cached mc.ext file
|
||||
|
10
src/main.c
10
src/main.c
@ -349,6 +349,9 @@ char cmd_buf [512];
|
||||
/* Used during argument processing */
|
||||
int finish_program = 0;
|
||||
|
||||
/* If set, then no windows are displayed in the GNOME edition */
|
||||
int nowindows = 0;
|
||||
|
||||
/* Forward declarations */
|
||||
char *get_mc_lib_dir ();
|
||||
int panel_event (Gpm_Event *event, WPanel *panel);
|
||||
@ -2164,8 +2167,14 @@ mc_maybe_editor_or_viewer (void)
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
else {
|
||||
path = prepend_cwd_on_local ("");
|
||||
#ifndef HAVE_GNOME
|
||||
setup_dummy_mc (path);
|
||||
#endif
|
||||
edit (edit_one_file, 1);
|
||||
#ifdef HAVE_GNOME
|
||||
gtk_main ();
|
||||
exit (1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
g_free (path);
|
||||
@ -2608,7 +2617,6 @@ static void parse_an_arg (poptContext state,
|
||||
#endif
|
||||
|
||||
char *cmdline_geometry = NULL;
|
||||
int nowindows = 0;
|
||||
char **directory_list = NULL;
|
||||
int force_activation = 0;
|
||||
|
||||
|
@ -99,6 +99,7 @@ extern int output_starts_shell;
|
||||
extern int midnight_shutdown;
|
||||
extern char search_buffer [256];
|
||||
extern char cmd_buf [512];
|
||||
extern int run_desktop;
|
||||
|
||||
#if HAVE_GNOME
|
||||
#define MENU_PANEL get_current_panel ()
|
||||
|
Loading…
Reference in New Issue
Block a user