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:
Miguel de Icaza 1999-02-15 21:19:03 +00:00
parent 39d815d7e9
commit 1370e6c166
14 changed files with 343 additions and 253 deletions

View File

@ -5,7 +5,7 @@ AC_INIT(create_vcs)
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
PACKAGE=mc PACKAGE=mc
VERSION=4.5.14 VERSION=4.5.15
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(VERSION) AC_SUBST(VERSION)

View File

@ -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> 1999-02-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
* mc.keys.in.in: Use "gnome-moz-remote file:%d/%f" for the html * mc.keys.in.in: Use "gnome-moz-remote file:%d/%f" for the html

View File

@ -18,7 +18,7 @@
#include "../vfs/vfs.h" #include "../vfs/vfs.h"
static void static void
gmc_execute (char *fname, char *buf) gmc_execute (const char *fname, const char *buf)
{ {
exec_extension (fname, buf, NULL, NULL, 0); exec_extension (fname, buf, NULL, NULL, 0);
} }
@ -81,6 +81,8 @@ gmc_edit_filename (char *fname)
const char *cmd; const char *cmd;
char *buf; char *buf;
int size; int size;
char *editor, *type;
int on_terminal;
if (gnome_metadata_get (fname, "edit", &size, &buf) == 0){ if (gnome_metadata_get (fname, "edit", &size, &buf) == 0){
gmc_execute (fname, buf); gmc_execute (fname, buf);
@ -89,18 +91,43 @@ gmc_edit_filename (char *fname)
} }
mime_type = gnome_mime_type_or_default (fname, NULL); mime_type = gnome_mime_type_or_default (fname, NULL);
if (!mime_type) if (mime_type){
return 0;
cmd = gnome_mime_get_value (mime_type, "edit"); cmd = gnome_mime_get_value (mime_type, "edit");
if (cmd){ if (cmd){
gmc_execute (fname, cmd); gmc_execute (fname, cmd);
return 1; 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); 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; return 0;
} }
@ -112,7 +139,7 @@ gmc_open (file_entry *fe)
} }
static void 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); exec_extension (filename, buf, NULL, NULL, 0);
} }

View File

@ -60,7 +60,7 @@ gnome_compare_panels (void)
} }
void void
gnome_open_terminal (void) gnome_open_terminal_with_cmd (const char *command)
{ {
char *p; char *p;
@ -71,12 +71,27 @@ gnome_open_terminal (void)
if (!(p = gnome_is_program_in_path ("rxvt"))) if (!(p = gnome_is_program_in_path ("rxvt")))
p = gnome_is_program_in_path ("xterm"); 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); my_system (EXECUTE_AS_SHELL, shell, p);
else
g_free (p);
} else
message (1, MSG_ERROR, " Could not start a terminal "); message (1, MSG_ERROR, " Could not start a terminal ");
} }
void
gnome_open_terminal (void)
{
gnome_open_terminal_with_cmd (NULL);
}
void void
gnome_about_cmd (void) gnome_about_cmd (void)
{ {

View File

@ -4,6 +4,7 @@
void gnome_listing_cmd (GtkWidget *widget, WPanel *panel); void gnome_listing_cmd (GtkWidget *widget, WPanel *panel);
void gnome_compare_panels (void); void gnome_compare_panels (void);
void gnome_open_terminal (void); void gnome_open_terminal (void);
void gnome_open_terminal_with_cmd (const char *command);
void gnome_about_cmd (void); void gnome_about_cmd (void);
void gnome_quit_cmd (void); void gnome_quit_cmd (void);
void gnome_open_panel (GtkWidget *widget, WPanel *panel); void gnome_open_panel (GtkWidget *widget, WPanel *panel);

View File

@ -1532,6 +1532,9 @@ create_desktop_dir (void)
{ {
char *home_link_name; 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); desktop_directory = g_concat_dir_and_file (gnome_user_home_dir, DESKTOP_DIR_NAME);
if (!g_file_exists (desktop_directory)) { if (!g_file_exists (desktop_directory)) {

View File

@ -52,6 +52,8 @@ int dialog_panel_callback (struct Dlg_head *h, int id, int msg);
/* The Dlg_head for the whole desktop */ /* The Dlg_head for the whole desktop */
Dlg_head *desktop_dlg; Dlg_head *desktop_dlg;
int run_desktop = 1;
/* This is only used by the editor, so we provide a dummy implementation */ /* This is only used by the editor, so we provide a dummy implementation */
void void
try_alloc_color_pair (char *str, char *str2) try_alloc_color_pair (char *str, char *str2)
@ -506,7 +508,9 @@ create_panels (void)
{ {
WPanel *panel; WPanel *panel;
if (run_desktop)
desktop_init (); desktop_init ();
cmdline = command_new (0, 0, 0); cmdline = command_new (0, 0, 0);
the_hint = label_new (0, 0, 0, NULL); the_hint = label_new (0, 0, 0, NULL);

View File

@ -2261,8 +2261,16 @@ void edit_quit_cmd (WEdit * edit)
unlink (catstrs (edit->dir, edit->filename, 0)); unlink (catstrs (edit->dir, edit->filename, 0));
#endif #endif
#ifdef MIDNIGHT #ifdef MIDNIGHT
edit->widget.parent->running = 0; dlg_stop (edit->widget.parent);
#else #else
#ifdef GTK
{
extern char *edit_one_file;
if (edit_one_file)
gtk_main_quit ();
}
#endif
edit->stopped = 1; edit->stopped = 1;
#endif #endif
} }

434
po/mc.pot

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@ quote_block (quote_func_t quote_func, char **quoting_block)
} }
void 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; char *file_name;
int cmd_file_fd; int cmd_file_fd;

View File

@ -2,7 +2,7 @@
#define __EXT_H #define __EXT_H
char *regex_command (char *filename, char *action, char **drops, int *move_dir); 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, /* Call it after the user has edited the mc.ext file,
* to flush the cached mc.ext file * to flush the cached mc.ext file

View File

@ -349,6 +349,9 @@ char cmd_buf [512];
/* Used during argument processing */ /* Used during argument processing */
int finish_program = 0; int finish_program = 0;
/* If set, then no windows are displayed in the GNOME edition */
int nowindows = 0;
/* Forward declarations */ /* Forward declarations */
char *get_mc_lib_dir (); char *get_mc_lib_dir ();
int panel_event (Gpm_Event *event, WPanel *panel); int panel_event (Gpm_Event *event, WPanel *panel);
@ -2164,8 +2167,14 @@ mc_maybe_editor_or_viewer (void)
#ifdef USE_INTERNAL_EDIT #ifdef USE_INTERNAL_EDIT
else { else {
path = prepend_cwd_on_local (""); path = prepend_cwd_on_local ("");
#ifndef HAVE_GNOME
setup_dummy_mc (path); setup_dummy_mc (path);
#endif
edit (edit_one_file, 1); edit (edit_one_file, 1);
#ifdef HAVE_GNOME
gtk_main ();
exit (1);
#endif
} }
#endif #endif
g_free (path); g_free (path);
@ -2608,7 +2617,6 @@ static void parse_an_arg (poptContext state,
#endif #endif
char *cmdline_geometry = NULL; char *cmdline_geometry = NULL;
int nowindows = 0;
char **directory_list = NULL; char **directory_list = NULL;
int force_activation = 0; int force_activation = 0;

View File

@ -99,6 +99,7 @@ extern int output_starts_shell;
extern int midnight_shutdown; extern int midnight_shutdown;
extern char search_buffer [256]; extern char search_buffer [256];
extern char cmd_buf [512]; extern char cmd_buf [512];
extern int run_desktop;
#if HAVE_GNOME #if HAVE_GNOME
#define MENU_PANEL get_current_panel () #define MENU_PANEL get_current_panel ()

View File

@ -8,6 +8,9 @@
#if !defined(SCO_FLAVOR) || !defined(_SYS_SELECT_H) || defined(IS_AIX) #if !defined(SCO_FLAVOR) || !defined(_SYS_SELECT_H) || defined(IS_AIX)
# include <sys/time.h> /* alex: this redefines struct timeval */ # include <sys/time.h> /* alex: this redefines struct timeval */
# ifdef IS_AIX
# include <time.h>
# endif
#endif /* SCO_FLAVOR */ #endif /* SCO_FLAVOR */
#ifdef HAVE_UTIME_H #ifdef HAVE_UTIME_H