From a372e9a37568353b44c5177c6a8bc92a1da81db4 Mon Sep 17 00:00:00 2001 From: Rosanna Yuen Date: Fri, 9 Apr 1999 12:58:10 +0000 Subject: [PATCH] * 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. --- gnome/ChangeLog | 10 +++++++ gnome/gaction.c | 20 +++++++++---- gnome/gcmd.c | 27 ++++++++++++++++++ gnome/gcmd.h | 2 ++ gnome/glayout.c | 1 - src/ChangeLog | 6 ++++ src/screen.c | 74 +++++++++++++++++++++++++++++++++++++++---------- 7 files changed, 119 insertions(+), 21 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index e81e8b8de..a974b3ff9 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,13 @@ +1999-04-09 Rosanna Yuen + + * gaction.c (gmc_view): We now have consistant actions everywhere; + every time you invoke a file. + +1999-04-08 Rosanna Yuen + + * gcmd.c (set_cursor_normal): new function to set the watch cursor + on a panel. + 1999-04-08 Jonathan Blandford * gaction.c (gmc_unable_to_execute_dlg): diff --git a/gnome/gaction.c b/gnome/gaction.c index 64de8ed8d..972d4160c 100644 --- a/gnome/gaction.c +++ b/gnome/gaction.c @@ -183,7 +183,10 @@ gmc_edit (char *fname) int on_terminal; 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); return 1; } @@ -193,7 +196,10 @@ gmc_edit (char *fname) cmd = gnome_mime_get_value (mime_type, "edit"); 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; } } @@ -318,11 +324,15 @@ gmc_view_command (gchar *filename) int 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); 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); return 1; } else diff --git a/gnome/gcmd.c b/gnome/gcmd.c index 4cb0435ee..4a1600887 100644 --- a/gnome/gcmd.c +++ b/gnome/gcmd.c @@ -883,3 +883,30 @@ gnome_select (GtkWidget *widget, WPanel *panel) paint_panel (panel); 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 (); +} diff --git a/gnome/gcmd.h b/gnome/gcmd.h index c9f744de9..931bc4b5c 100644 --- a/gnome/gcmd.h +++ b/gnome/gcmd.h @@ -25,5 +25,7 @@ void gnome_mkdir_cmd (GtkWidget *widget, WPanel *panel); void gnome_new_launcher (GtkWidget *widget, WPanel *panel); void gnome_reverse_selection_cmd_panel (WPanel *panel); void gnome_select (GtkWidget *widget, WPanel *panel); +void set_cursor_normal (WPanel *panel); +void set_cursor_busy (WPanel *panel); #endif /* __GCMD_H */ diff --git a/gnome/glayout.c b/gnome/glayout.c index 9ba0f3eff..273c0ee92 100644 --- a/gnome/glayout.c +++ b/gnome/glayout.c @@ -294,7 +294,6 @@ save_panel_types (void) panel_save_setup (pc->panel, pc->panel->panel_name); } } - static void run_cmd (void) { diff --git a/src/ChangeLog b/src/ChangeLog index 26136334d..3105392a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +1999-04-09 Rosanna Yuen + + * 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 * treestore.c (tree_store_load): Do not load non-local file diff --git a/src/screen.c b/src/screen.c index 37ed23be7..565f76b1c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1259,12 +1259,12 @@ parse_display_format (WPanel *panel, char *format, char **error, int isstatus, i darr->expand = formats [i].expands; darr->just_mode = formats [i].default_just; - if (set_justify) + if (set_justify) { if (IS_FIT(darr->just_mode)) darr->just_mode = MAKE_FIT(justify); else darr->just_mode = justify; - + } found = 1; format = skip_separators (format); @@ -2046,12 +2046,65 @@ start_search (WPanel *panel) 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 +do_enter_on_file_entry (file_entry *fe) +{ + 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 + { + 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) { -#ifdef HAVE_GNOME -#endif if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)) { do_cd (fe->fname, cd_exact); return 1; @@ -2087,14 +2140,6 @@ do_enter_on_file_entry (file_entry *fe) return 1; } else { -#ifdef HAVE_GNOME - if (gmc_open (fe) == 0) { - return gmc_open_with (fe->fname); - } else { - return 0; - } - -#else char *p; p = regex_command (fe->fname, "Open", NULL, 0); @@ -2102,11 +2147,10 @@ do_enter_on_file_entry (file_entry *fe) return 1; else return 0; -#endif } } } - +#endif /* else not HAVE_GNOME */ int do_enter (WPanel *panel) {