* gnome/gaction.c (gmc_view): We now have consistant actions

everywhere; every time you invoke a file.
	* src/screen.c (do_enter_on_file_entry): split GNOME version and
	non-gnome version.
	(parse_display_format): listen to the warning.
This commit is contained in:
Rosanna Yuen 1999-04-09 12:58:10 +00:00
parent cca4a69dcf
commit a372e9a375
7 changed files with 119 additions and 21 deletions

View File

@ -1,3 +1,13 @@
1999-04-09 Rosanna Yuen <rwsy@mit.edu>
* gaction.c (gmc_view): We now have consistant actions everywhere;
every time you invoke a file.
1999-04-08 Rosanna Yuen <rwsy@mit.edu>
* gcmd.c (set_cursor_normal): new function to set the watch cursor
on a panel.
1999-04-08 Jonathan Blandford <jrb@redhat.com> 1999-04-08 Jonathan Blandford <jrb@redhat.com>
* gaction.c (gmc_unable_to_execute_dlg): * gaction.c (gmc_unable_to_execute_dlg):

View File

@ -183,7 +183,10 @@ gmc_edit (char *fname)
int on_terminal; 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, 0); if (gmc_check_exec_string (buf))
gmc_execute (fname, buf, 0);
else
gmc_unable_to_execute_dlg (fname, buf, "edit", NULL);
g_free (buf); g_free (buf);
return 1; return 1;
} }
@ -193,7 +196,10 @@ gmc_edit (char *fname)
cmd = gnome_mime_get_value (mime_type, "edit"); cmd = gnome_mime_get_value (mime_type, "edit");
if (cmd){ if (cmd){
gmc_execute (fname, cmd, 0); if (gmc_check_exec_string (cmd))
gmc_execute (fname, cmd, 0);
else
gmc_unable_to_execute_dlg (fname, cmd, "edit", mime_type);
return 1; return 1;
} }
} }
@ -318,11 +324,15 @@ gmc_view_command (gchar *filename)
int int
gmc_view (char *filename, int start_line) gmc_view (char *filename, int start_line)
{ {
char *cmd; gchar *cmd;
const gchar *mime_type;
mime_type = gnome_mime_type_or_default (filename, NULL);
cmd = gmc_view_command (filename); cmd = gmc_view_command (filename);
if (cmd) { if (cmd) {
gmc_run_view (filename, cmd); if (gmc_check_exec_string (cmd))
gmc_run_view (filename, cmd);
else
gmc_unable_to_execute_dlg (filename, cmd, "view", mime_type);
g_free (cmd); g_free (cmd);
return 1; return 1;
} else } else

View File

@ -883,3 +883,30 @@ gnome_select (GtkWidget *widget, WPanel *panel)
paint_panel (panel); paint_panel (panel);
g_free (reg_exp); g_free (reg_exp);
} }
void
set_cursor_busy (WPanel *panel)
{
GdkCursor *cursor;
if (is_a_desktop_panel (panel))
return;
cursor = gdk_cursor_new (GDK_WATCH);
gdk_window_set_cursor (GTK_WIDGET (panel->xwindow)->window, cursor);
gdk_cursor_destroy (cursor);
gdk_flush ();
}
void
set_cursor_normal (WPanel *panel)
{
GdkCursor *cursor;
if (is_a_desktop_panel (panel))
return;
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor (GTK_WIDGET (panel->xwindow)->window, cursor);
gdk_cursor_destroy (cursor);
gdk_flush ();
}

View File

@ -25,5 +25,7 @@ void gnome_mkdir_cmd (GtkWidget *widget, WPanel *panel);
void gnome_new_launcher (GtkWidget *widget, WPanel *panel); void gnome_new_launcher (GtkWidget *widget, WPanel *panel);
void gnome_reverse_selection_cmd_panel (WPanel *panel); void gnome_reverse_selection_cmd_panel (WPanel *panel);
void gnome_select (GtkWidget *widget, WPanel *panel); void gnome_select (GtkWidget *widget, WPanel *panel);
void set_cursor_normal (WPanel *panel);
void set_cursor_busy (WPanel *panel);
#endif /* __GCMD_H */ #endif /* __GCMD_H */

View File

@ -294,7 +294,6 @@ save_panel_types (void)
panel_save_setup (pc->panel, pc->panel->panel_name); panel_save_setup (pc->panel, pc->panel->panel_name);
} }
} }
static void static void
run_cmd (void) run_cmd (void)
{ {

View File

@ -1,3 +1,9 @@
1999-04-09 Rosanna Yuen <rwsy@mit.edu>
* screen.c (do_enter_on_file_entry): split GNOME version and
non-gnome version.
(parse_display_format): listen to the warning.
1999-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx> 1999-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* treestore.c (tree_store_load): Do not load non-local file * treestore.c (tree_store_load): Do not load non-local file

View File

@ -1259,12 +1259,12 @@ parse_display_format (WPanel *panel, char *format, char **error, int isstatus, i
darr->expand = formats [i].expands; darr->expand = formats [i].expands;
darr->just_mode = formats [i].default_just; darr->just_mode = formats [i].default_just;
if (set_justify) if (set_justify) {
if (IS_FIT(darr->just_mode)) if (IS_FIT(darr->just_mode))
darr->just_mode = MAKE_FIT(justify); darr->just_mode = MAKE_FIT(justify);
else else
darr->just_mode = justify; darr->just_mode = justify;
}
found = 1; found = 1;
format = skip_separators (format); format = skip_separators (format);
@ -2046,12 +2046,65 @@ start_search (WPanel *panel)
mc_refresh (); mc_refresh ();
} }
} }
/* This procedure was getting really messy with all the rewriting and ifdef's
* so I just splet them out. -jrb */
#ifdef HAVE_GNOME
extern void set_cursor_busy (WPanel *panel);
extern void set_cursor_normal (WPanel *panel);
int int
do_enter_on_file_entry (file_entry *fe) do_enter_on_file_entry (file_entry *fe)
{ {
#ifdef HAVE_GNOME gint retval;
set_cursor_busy (cpanel);
/* Can we change dirs? */
if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)) {
do_cd (fe->fname, cd_exact);
set_cursor_normal (cpanel);
return 1;
}
/* do metadata/mime stuff tell us anything? */
if (gmc_open (fe) != 0) {
set_cursor_normal (cpanel);
return 1;
}
/* can we change dirs? */
if (is_exe (fe->buf.st_mode) && if_link_is_exe (cpanel->cwd, fe)) {
#ifdef USE_VFS
if (vfs_current_is_local ())
#endif #endif
{
char *tmp = name_quote (fe->fname, 0);
char *cmd = g_strconcat (".", PATH_SEP_STR, tmp, NULL);
if (!confirm_execute || (query_dialog (_(" The Midnight Commander "),
_(" Do you really want to execute? "),
0, 2, _("Yes"), _("No")) == 0))
execute (cmd);
g_free (tmp);
g_free (cmd);
}
#ifdef USE_VFS
else {
char *tmp;
tmp = concat_dir_and_file (vfs_get_current_dir(), fe->fname);
if (!mc_setctl (tmp, MCCTL_EXTFS_RUN, NULL))
message (1, _(" Warning "), _(" No action taken "));
g_free (tmp);
}
#endif /* USE_VFS */
set_cursor_normal (cpanel);
return 1;
}
/* looks like we couldn't open it. Let's ask the user */
retval = gmc_open_with (fe->fname);
set_cursor_normal (cpanel);
return retval;
}
#else
int
do_enter_on_file_entry (file_entry *fe)
{
if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)) { if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)) {
do_cd (fe->fname, cd_exact); do_cd (fe->fname, cd_exact);
return 1; return 1;
@ -2087,14 +2140,6 @@ do_enter_on_file_entry (file_entry *fe)
return 1; return 1;
} else { } else {
#ifdef HAVE_GNOME
if (gmc_open (fe) == 0) {
return gmc_open_with (fe->fname);
} else {
return 0;
}
#else
char *p; char *p;
p = regex_command (fe->fname, "Open", NULL, 0); p = regex_command (fe->fname, "Open", NULL, 0);
@ -2102,11 +2147,10 @@ do_enter_on_file_entry (file_entry *fe)
return 1; return 1;
else else
return 0; return 0;
#endif
} }
} }
} }
#endif /* else not HAVE_GNOME */
int int
do_enter (WPanel *panel) do_enter (WPanel *panel)
{ {