diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 039f2ed4e..2b6b94cd6 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,5 +1,31 @@ 1998-04-16 Miguel de Icaza + * glayout.c (assign_other): Keep track of all of the opened + panels. We were never removing them from the containers list. + This fixes a number of problems. + + * gwidget.c (x_dialog_stop): Only call gtk_main_quit if this + dialog did not inlcude the DLG_GNOME_APP flag, as those windows + did not launch a gtk_main event loop. + + * gcmd.c: Try various terminal programs in the PATH before giving + up + + * glayout.c: Unselect command is unselect_cmd, not select_cmd + + * gcmd.c (gnome_quit_cmd): Add quit confirmation. + + * gdesktop.c (perform_drop_manually): Check the type for the + source file (directory/file) and perform the proper operation. + Before this we always did a *_file_file operation. + (perform_drop_manually): Use copy_dir_dir correctly + (desktop_setup_default): Use copy_dir_dir correctly + + * gwidget.c (x_create_label): Remove debugging labels. + + * gscreen.c: Do not show the view/view unfiltered if the + selectioned item is a directory. + * gwidget.c (x_radio_toggle): Never commit non-compilable code. 1998-04-15 Miguel de Icaza diff --git a/gnome/gcmd.c b/gnome/gcmd.c index b53164a8c..8726c565a 100644 --- a/gnome/gcmd.c +++ b/gnome/gcmd.c @@ -1,3 +1,10 @@ +/* + * Various Menu-invoked Command implementations specific to the GNOME port + * + * Copyright (C) 1998 the Free Software Foundation + * + * Author: Miguel de Icaza (miguel@kernel.org) + */ #include #include "x.h" #include @@ -40,7 +47,19 @@ gnome_compare_panels (void) void gnome_open_terminal (void) { - my_system (1, shell, "nxterm"); + char *p; + + if (!(p = gnome_is_program_in_path ("gnome-terminal"))) + if (!(p = gnome_is_program_in_path ("dtterm"))) + if (!(p = gnome_is_program_in_path ("nxterm"))) + if (!(p = gnome_is_program_in_path ("color-xterm"))) + if (!(p = gnome_is_program_in_path ("rxvt"))) + p = gnome_is_program_in_path ("xterm"); + + if (p) + my_system (1, shell, p); + else + message (1, MSG_ERROR, " Could not start a terminal "); } void @@ -65,7 +84,17 @@ gnome_about_cmd (void) void gnome_quit_cmd (void) { - gtk_main_quit (); + int q = 0; + + if (!confirm_exit) + q = 1; + else if (query_dialog (_(" The Midnight Commander "), + _(" Do you really want to quit the Midnight Commander? "), + 0, 2, _("&Yes"), _("&No")) == 0) + q = 1; + + if (q == 1) + gtk_main_quit (); } void @@ -89,5 +118,6 @@ gnome_close_panel (GtkWidget *widget, WPanel *panel) destroy_widget (panel->filter_w); destroy_widget ((void *)panel); + layout_panel_gone (panel); return TRUE; } diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 0454e4b83..df27ec485 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -423,6 +423,7 @@ perform_drop_on_directory (WPanel *source_panel, int operation, char *dest) static void perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *dest) { + struct stat buf; int count = event->data_numbytes; char *p = event->data; int len; @@ -440,6 +441,7 @@ perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *de do { char *tmpf; + int res, v; len = 1 + strlen (event->data); count -= len; @@ -447,15 +449,37 @@ perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *de switch (operation){ case OPER_COPY: tmpf = concat_dir_and_file (dest, x_basename (p)); - copy_file_file (p, tmpf, 1); + do { + res = mc_stat (p, &buf); + if (res != 0){ + v = file_error (" Could not stat %s \n %s ", tmpf); + if (v != FILE_RETRY) + res = 0; + } else { + if (S_ISDIR (buf.st_mode)) + copy_dir_dir (p, tmpf, 1, 0, 0, 0); + else + copy_file_file (p, tmpf, 1); + } + } while (res != 0); free (tmpf); break; case OPER_MOVE: - create_op_win (OP_MOVE, 0); - file_mask_defaults (); tmpf = concat_dir_and_file (dest, x_basename (p)); - move_file_file (p, tmpf); + do { + res = mc_stat (p, &buf); + if (res != 0){ + v = file_error (" Could not stat %s \n %s ", tmpf); + if (v != FILE_RETRY) + res = 0; + } else { + if (S_ISDIR (buf.st_mode)) + move_dir_dir (p, tmpf); + else + move_file_file (p, tmpf); + } + } while (res != 0); free (tmpf); break; } @@ -1255,7 +1279,7 @@ desktop_setup_default (char *desktop_dir) if (exist_file (mc_desktop_dir)){ create_op_win (OP_COPY, 0); file_mask_defaults (); - copy_dir_dir (mc_desktop_dir, desktop_dir); + copy_dir_dir (mc_desktop_dir, desktop_dir, 1, 0, 0, 0); destroy_op_win (); } else mkdir (desktop_dir, 0777); diff --git a/gnome/glayout.c b/gnome/glayout.c index 4a615bf79..2c312b1ba 100644 --- a/gnome/glayout.c +++ b/gnome/glayout.c @@ -13,6 +13,7 @@ #include "panel.h" #include "gscreen.h" #include "main.h" +#include "gmain.h" #include "cmd.h" #include "boxes.h" #include "panelize.h" @@ -35,7 +36,10 @@ PanelContainer *current_panel_ptr, *other_panel_ptr; WPanel * get_current_panel (void) { - return current_panel_ptr->panel; + if (current_panel_ptr) + return current_panel_ptr->panel; + else + return NULL; } WPanel * @@ -91,7 +95,9 @@ set_new_current_panel (WPanel *panel) { GList *p; - other_panel_ptr = current_panel_ptr; + if (g_list_length (containers) > 1) + other_panel_ptr = current_panel_ptr; + for (p = containers; p; p = p->next){ if (((PanelContainer *)p->data)->panel == panel){ current_panel_ptr = p->data; @@ -99,6 +105,81 @@ set_new_current_panel (WPanel *panel) } } +/* + * Tries to assign other_panel (ie, if there is anything to assign to + */ +static void +assign_other (void) +{ + GList *p; + + other_panel_ptr = NULL; + for (p = containers; p; p = p->next) + if (p->data != current_panel_ptr){ + other_panel_ptr = p->data; + printf ("PANEL: Found another other\n"); + break; + } +} + +/* + * This keeps track of the current_panel_ptr and other_panel_ptr as + * well as the list of active containers + */ +void +layout_panel_gone (WPanel *panel) +{ + PanelContainer *pc_holder = 0; + int len = g_list_length (containers); + GList *p; + + for (p = containers; p; p = p->next){ + PanelContainer *pc = p->data; + + if (pc->panel == panel){ + pc_holder = pc; + break; + } + } + + printf ("PANEL: Going away [%d]\n", len); + if (len > 1){ + containers = g_list_remove (containers, pc_holder); + printf ("PANEL: extra panels left\n"); + } + + /* Check if this is not the current panel */ + if (current_panel_ptr->panel == panel){ + printf ("PANEL: was current panel\n"); + if (other_panel_ptr){ + current_panel_ptr = other_panel_ptr; + assign_other (); + printf ("PANEL: setting current to other\n"); + } else { + current_panel_ptr = NULL; + printf ("PANEL: No current panel now\n"); + } + } else if (other_panel_ptr->panel == panel){ + /* Check if it was the other panel */ + printf ("PANEL: was the other panel\n"); + if (len == 1){ + other_panel_ptr = 0; + printf ("PANEL: We are left without other\n"); + } else + assign_other (); + } else { + printf ("PANEL: was some other panel\n"); + } + + if (len == 1){ + g_free (containers->data); + g_list_free (containers); + containers = NULL; + printf ("PANEL: It was the last one\n"); + } else + g_free (pc_holder); +} + void set_hintbar (char *str) { @@ -202,7 +283,7 @@ GnomeUIInfo gnome_panel_file_menu [] = { { GNOME_APP_UI_ITEM, N_("View raw"), N_("View the file without further processing"),panel_action_view_unfiltered}, { GNOME_APP_UI_SEPARATOR }, { GNOME_APP_UI_ITEM, N_("Select group"), N_("Selects a group of files"), select_cmd }, - { GNOME_APP_UI_ITEM, N_("Unselect group"), N_("Un-selects a group of marked files"), select_cmd }, + { GNOME_APP_UI_ITEM, N_("Unselect group"), N_("Un-selects a group of marked files"), unselect_cmd }, { GNOME_APP_UI_ITEM, N_("Reverse selection"), N_("Reverses the list of tagged files"), reverse_selection_cmd }, { GNOME_APP_UI_SEPARATOR }, { GNOME_APP_UI_ITEM, N_("Close"), N_("Close this panel"), gnome_close_panel }, @@ -359,11 +440,10 @@ void new_panel_at (char *dir) { WPanel *panel; - Dlg_head *h = current_panel_ptr->panel->widget.parent; mc_chdir (dir); - panel = create_container (h, dir); - add_widget (h, panel); + panel = create_container (desktop_dlg, dir); + add_widget (desktop_dlg, panel); set_new_current_panel (panel); } diff --git a/gnome/gmain.c b/gnome/gmain.c index 932a3130d..b3839baa4 100644 --- a/gnome/gmain.c +++ b/gnome/gmain.c @@ -41,6 +41,9 @@ char *default_edition_colors = "menuhotsel=cyan,black:" "special=black"; +/* The Dlg_head for the whole desktop */ +Dlg_head *desktop_dlg; + void init_pair (int index, GdkColor *fore, GdkColor *back) { @@ -381,7 +384,6 @@ dialog_panel_callback (struct Dlg_head *h, int id, int msg) void create_panels (void) { - Dlg_head *h; WPanel *panel; start_desktop (); @@ -390,13 +392,13 @@ create_panels (void) gnome_init_panels (); - h = create_dlg (0, 0, 24, 80, 0, dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED); + desktop_dlg = create_dlg (0, 0, 24, 80, 0, dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED); - panel = create_container (h, "My Panel"); - add_widget (h, panel); + panel = create_container (desktop_dlg, "My Panel"); + add_widget (desktop_dlg, panel); set_current_panel (0); - run_dlg (h); + run_dlg (desktop_dlg); /* shutdown gnome specific bits of midnight commander */ stop_desktop (); diff --git a/gnome/gmain.h b/gnome/gmain.h index aa6228fe8..3c6bab899 100644 --- a/gnome/gmain.h +++ b/gnome/gmain.h @@ -7,25 +7,25 @@ int xtoolkit_init (int *argc, char *argv []); int xtoolkit_end (void); +extern Dlg_head *desktop_dlg; + /* Required by the standard code */ -widget_data xtoolkit_create_dialog (Dlg_head *h, int with_grid); +widget_data xtoolkit_create_dialog (Dlg_head *h, int with_grid); widget_data xtoolkit_get_main_dialog (Dlg_head *h); -void x_dlg_set_window (Dlg_head *h, GtkWidget *win); +void x_dlg_set_window (Dlg_head *h, GtkWidget *win); widget_data x_create_panel_container (int which); -void x_panel_container_show (widget_data wdata); - -void x_destroy_cmd (void *); - -int x_create_radio (Dlg_head *h, widget_data parent, WRadio *r); -int x_create_check (Dlg_head *h, widget_data parent, WCheck *c); -int x_create_label (Dlg_head *h, widget_data parent, WLabel *l); -int x_create_input (Dlg_head *h, widget_data parent, WInput *in); -int x_create_listbox (Dlg_head *h, widget_data parent, WListbox *l); -int x_create_buttonbar (Dlg_head *h, widget_data parent, WButtonBar *bb); -void x_filter_changed (WPanel *panel); -void x_list_insert (WListbox *l, WLEntry *p, WLEntry *e); -void x_redefine_label (WButtonBar *bb, int idx); -void x_add_widget (Dlg_head *h, Widget_Item *w); +void x_panel_container_show (widget_data wdata); +void x_destroy_cmd (void *); +int x_create_radio (Dlg_head *h, widget_data parent, WRadio *r); +int x_create_check (Dlg_head *h, widget_data parent, WCheck *c); +int x_create_label (Dlg_head *h, widget_data parent, WLabel *l); +int x_create_input (Dlg_head *h, widget_data parent, WInput *in); +int x_create_listbox (Dlg_head *h, widget_data parent, WListbox *l); +int x_create_buttonbar (Dlg_head *h, widget_data parent, WButtonBar *bb); +void x_filter_changed (WPanel *panel); +void x_list_insert (WListbox *l, WLEntry *p, WLEntry *e); +void x_redefine_label (WButtonBar *bb, int idx); +void x_add_widget (Dlg_head *h, Widget_Item *w); struct gmc_color_pairs_s { GdkColor *fore, *back; diff --git a/gnome/gnome.TODO b/gnome/gnome.TODO index 6c2bcd14c..607031ca7 100644 --- a/gnome/gnome.TODO +++ b/gnome/gnome.TODO @@ -3,20 +3,24 @@ IMPORTANTE: >>>>> properties change on desktop object dont lead to refresh <<<<< - -drags onto desktop dont seem to be refreshed when link complete Also, -panel drag originated in is trashed by shaped window moving around in it during drag event +>>>>> When something is dragged, the panel is not being refreshed <<<< file actions dont cause panels to be refreshed automatically All: -- It leaks objects. - Session management -Desktop: + +EXTENSIONS: - Add special destkop entries ("Network neighborhood") +- In the find-file results, it would be nice if 'chdir' popped up a new + panel instead of changing the directory of the present one (optionally). +- (Cool but low priority) it would be nice if 'Arrange icons' + were configurable to allow stacking the icons along a particular edge + OR if gmc could automatically find areas of free screen (i.e. no windows + on them) and then place icons there. Panels: @@ -42,20 +46,6 @@ DND: - Get sopwith to fix the random motion of his dnd icons. - Check the purify stuff. -Observations from Dr Mike: - -From msf@redhat.com Wed Apr 1 15:12:58 1998 -Return-Path: -To: Miguel de Icaza -cc: msf@redhat.com, marc@redhat.com -Subject: gmc observations -Mime-Version: 1.0 -Content-Type: text/plain; charset=us-ascii -Date: Wed, 01 Apr 1998 16:14:50 -0500 -From: Michael Fulbright - -Ok you asked for it... - General Comments ---------------- @@ -109,24 +99,13 @@ Panel comments - I didnt get an error message when I tried to change the file modes on a file I didnt own. - - double clicking on a file object seemed to try to push an artificial drag - sometimes, I thought it would try to open it or something. - - - when selecting 'Copy' from the right click menu, it would be nice to - have a browsable tree to select the destination from. - - - i couldnt seem to drag things onto the root window - - Configure Options ----------------- - need some sort of help for all these options, they aren't too intuitive. We can't assume people are going to read the man page. - - 'Find File' dialog - the Tree button needs a pixmap - - Also, during a find, the dialog violently resizes as it lists the + - Also, during a find, the dialog violently resizes as it lists the directories it is searching through. Seems like the label showing the currently searched dir needs to be a separate container or something. It looks like its in the first column of the table of buttons below it. @@ -140,4 +119,25 @@ VFS Options of feedback while grabbing a ls listing from a ftp server would be cool. +NEW BUG LIST: +- In the properties dialog, permissions tab, the user & group drop-downs + list the same users/groups multiple times. +- Why use a GnomeEntry *everywhere* when a lot of the places don't need + the history that it provides? Only when the user changes an entry + box often and needs a history should GnomeEntry be used...? +- Find file is pretty cool, but you might want to force-set a maximum size + during the search (and then unset it after the search is done) to stop + it from dancing around while it displays all the files that it's + checking in that label below the GtkCList. +- Hidden directories don't have the right-mouse-button 'Start XTerm + here'/'Make a tarball' menu options. + +OPEN ISSUES: +- Selection of multiple files is somewhat confusing in general + +- Also if you have multi-file selection, is there a way to get a popup + menu of the operations that are applicable to all those files, instead + of an empty one? +- The text in a lot of text entries disappears as soon as I start typing + in them. diff --git a/gnome/gscreen.c b/gnome/gscreen.c index ca29f054d..2ace9bd95 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -63,6 +63,7 @@ typedef void (*context_menu_callback)(GtkWidget *, WPanel *); #define F_REGULAR 2 #define F_SYMLINK 4 #define F_SINGLE 8 +#define F_NOTDIR 16 void repaint_file (WPanel *panel, int file_index, int move, int attr, int isstatus) @@ -361,8 +362,8 @@ static struct { { "", F_SINGLE, NULL }, { N_("Open"), F_ALL, panel_action_open }, { N_("Open with"), F_ALL, panel_action_open_with }, - { N_("View"), F_ALL, panel_action_view }, - { N_("View unfiltered"), F_ALL, panel_action_view_unfiltered }, + { N_("View"), F_NOTDIR, panel_action_view }, + { N_("View unfiltered"), F_NOTDIR, panel_action_view_unfiltered }, { "", 0, NULL }, { N_("Link..."), F_REGULAR | F_SINGLE, (context_menu_callback) link_cmd }, { N_("Symlink..."), F_SINGLE, (context_menu_callback) symlink_cmd }, @@ -405,6 +406,17 @@ create_popup_submenu (WPanel *panel, int row, char *filename) break; } + /* Items with F_NOTDIR requiere that the selection is not a directory */ + if (file_actions [i].flags & F_NOTDIR){ + struct stat *s = &panel->dir.list [row].buf; + + if (panel->dir.list [row].f.link_to_dir) + break; + + if (S_ISDIR (s->st_mode)) + break; + } + /* Items with F_REGULAR do not accept any strange file types */ if (file_actions [i].flags & F_REGULAR){ struct stat *s = &panel->dir.list [row].buf; @@ -983,15 +995,6 @@ panel_create_cwd (Dlg_head *h, WPanel *panel, void **entry) return GTK_WIDGET (in->widget.wdata); } -static void -panel_change_filter (GtkWidget *entry, WPanel *panel) -{ - char *reg_exp; - - reg_exp = ((WInput *)panel->filter_w)->buffer; - set_panel_filter_to (panel, strdup (reg_exp)); -} - /* FIXME: for now, this list is hardcoded. We want a way to let the user configure it. */ static struct filter_item { @@ -1276,8 +1279,8 @@ void x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) { GtkWidget *status_line, *filter, *vbox; - GtkWidget *frame, *cwd, *back, *home, *fwd, *back_p, *fwd_p; - GtkWidget *very_top, *display; + GtkWidget *frame, *cwd, *back_p, *fwd_p; + GtkWidget *display; panel->xwindow = gtk_widget_get_toplevel (GTK_WIDGET (panel->widget.wdata)); diff --git a/gnome/gtools.c b/gnome/gtools.c index ab8d30ff3..b31fdf638 100644 --- a/gnome/gtools.c +++ b/gnome/gtools.c @@ -17,6 +17,7 @@ #include "wtools.h" #include "dialog.h" #include "color.h" +#include "gmain.h" Dlg_head *last_query_dlg; static int sel_pos; diff --git a/gnome/gutil.c b/gnome/gutil.c index 379ce36d6..ecb4017d0 100644 --- a/gnome/gutil.c +++ b/gnome/gutil.c @@ -48,10 +48,9 @@ #include #include -int my_system (int as_shell_command, const char *shell, const char *command) +int my_system_get_child_pid (int as_shell_command, const char *shell, const char *command, pid_t *pid) { struct sigaction ignore, save_intr, save_quit, save_stop; - pid_t pid; int status = 0, i; ignore.sa_handler = SIG_IGN; @@ -61,11 +60,11 @@ int my_system (int as_shell_command, const char *shell, const char *command) sigaction (SIGINT, &ignore, &save_intr); sigaction (SIGQUIT, &ignore, &save_quit); - if ((pid = fork ()) < 0){ + if ((*pid = fork ()) < 0){ fprintf (stderr, "\n\nfork () = -1\n"); return -1; } - if (pid == 0){ + if (*pid == 0){ const int top = max_open_files (); sigaction (SIGINT, &save_intr, NULL); sigaction (SIGQUIT, &save_quit, NULL); @@ -91,6 +90,13 @@ int my_system (int as_shell_command, const char *shell, const char *command) return WEXITSTATUS(status); } +int my_system (int as_shell_command, const char *shell, const char *command) +{ + pid_t pid; + + return my_system_get_child_pid (as_shell_command, shell, command, &pid); +} + int exec_direct (char *path, char *argv []) { diff --git a/gnome/gview.c b/gnome/gview.c index 4c014a927..d7ad335b0 100644 --- a/gnome/gview.c +++ b/gnome/gview.c @@ -80,7 +80,7 @@ scrollbar_moved (GtkAdjustment *adj, WView *view) } void -view_percent (WView *view, int p) +view_percent (WView *view, int p, int w) { int percent; char buffer [40]; @@ -127,9 +127,9 @@ view_status (WView *view) gtk_label_set (GTK_LABEL (view->gtk_bytes), buffer); if (view->hex_mode) - view_percent (view, view->edit_cursor - view->first); + view_percent (view, view->edit_cursor - view->first, 0); else - view_percent (view, view->start_display - view->first); + view_percent (view, view->start_display - view->first, 0); } void @@ -323,6 +323,13 @@ GnomeUIInfo gview_top_menu [] = { { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; +static int +quit_view (GtkWidget *widget, GdkEvent *event, WView *view) +{ + gview_quit (widget, view); + return TRUE; +} + int view (char *_command, char *_file, int *move_dir_p, int start_line) { @@ -378,6 +385,9 @@ view (char *_command, char *_file, int *move_dir_p, int start_line) scrollbar = gtk_vscrollbar_new (wview->sadj); gtk_signal_connect (GTK_OBJECT (wview->sadj), "value_changed", GTK_SIGNAL_FUNC(scrollbar_moved), wview); + + gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event", + GTK_SIGNAL_FUNC (quit_view), wview); hbox = gtk_hbox_new (0, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, 1, 1, 0); diff --git a/gnome/gwidget.c b/gnome/gwidget.c index 9905f2f3f..3c8b0f015 100644 --- a/gnome/gwidget.c +++ b/gnome/gwidget.c @@ -30,6 +30,8 @@ get_gtk_widget (Widget_Item *p) void x_dialog_stop (Dlg_head *h) { + if (h->grided & DLG_GNOME_APP) + return; gtk_main_quit (); } @@ -456,9 +458,12 @@ x_create_label (Dlg_head *g, widget_data parent, WLabel *l) GtkWidget *label; /* Tempo-hack */ - if (*l->text == 0) - label = gtk_label_new (l->widget.tkname); - else + if (*l->text == 0){ + if (0) + label = gtk_label_new (l->widget.tkname); + else + label = gtk_label_new (""); + } else label = gtk_label_new (l->text); gtk_widget_show (label); l->widget.wdata = (widget_data) label; diff --git a/src/ChangeLog b/src/ChangeLog index 9f3d1eab2..3d3b0902a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 1998-04-16 Miguel de Icaza + * file.h: Added prototype for copy_dir_dir. + + * file.c (real_do_file_error): use the proper flags, this is not a + D_INSERT dialog box, for what it is worth. Important bug fix. + + * utilunix.c (get_owner): Declare. + + * widget.h: Added various missing prototypes for the X edition. + * view.h: Added various missing prototypes for the X edition. * widget.c (x_radio_toggle): New per-port variable: PORT_HAS_RADIO_TOGGLE 1998-04-15 Miguel de Icaza diff --git a/src/boxes.c b/src/boxes.c index 5b303c81d..d4903edec 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "global.h" #include "mad.h" /* The great mad */ #include "util.h" /* Required by panel.h */ diff --git a/src/cmd.c b/src/cmd.c index b58131209..c0711a904 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -80,6 +80,7 @@ #include "user.h" #include "setup.h" #include "x.h" +#include "profile.h" #define MIDNIGHT #ifdef USE_INTERNAL_EDIT @@ -1404,7 +1405,11 @@ save_setup_cmd (void) sync_profiles (); str = copy_strings ( _(" Setup saved to ~/"), PROFILE_NAME, NULL); +#ifdef HAVE_GNOME + set_hintbar (str); +#else message (0, _(" Setup "), str); +#endif free (str); } diff --git a/src/dlg.c b/src/dlg.c index abec10886..f0158fafd 100644 --- a/src/dlg.c +++ b/src/dlg.c @@ -345,10 +345,11 @@ int remove_widget (Dlg_head *h, void *what) } h->count--; free (p); - return; + return 1; } p = p->next; } while (p != first); + return 0; } int destroy_widget (Widget *w) @@ -357,6 +358,7 @@ int destroy_widget (Widget *w) if (w->destroy) w->destroy (w); free (w); + return 1; } int add_widget (Dlg_head *where, void *what) diff --git a/src/file.c b/src/file.c index fe33bdebf..47943a507 100644 --- a/src/file.c +++ b/src/file.c @@ -916,7 +916,7 @@ copy_file_file (char *src_path, char *dst_path, int ask_overwrite) retry_dst_stat: if (mc_stat (dst_path, &sb2) == 0){ if (S_ISDIR (sb2.st_mode)){ - return_status = file_error (_(" Cannot overwrite directory \"%s\" "), + return_status = file_error (_(" Cannot overwrite directory \"%s\" \n %s "), dst_path); if (return_status == FILE_RETRY) goto retry_dst_stat; @@ -1334,7 +1334,7 @@ copy_dir_dir (char *s, char *d, int toplevel, int move_over, int delete, } if (!S_ISDIR (cbuf.st_mode)){ - return_status = file_error (_(" Source directory \"%s\" is not a directory "), s); + return_status = file_error (_(" Source directory \"%s\" is not a directory \n %s "), s); if (return_status == FILE_RETRY) goto retry_src_stat; return return_status; @@ -1647,9 +1647,9 @@ move_dir_dir (char *s, char *d) goto oktoret; } else { if (S_ISDIR (destbuf.st_mode)) - return_status = file_error (_(" Cannot overwrite directory \"%s\" "), destdir); + return_status = file_error (_(" Cannot overwrite directory \"%s\" %s "), destdir); else - return_status = file_error (_(" Cannot overwrite file \"%s\" "), destdir); + return_status = file_error (_(" Cannot overwrite file \"%s\" %s "), destdir); if (return_status == FILE_RETRY) goto retry_dst_stat; } @@ -2227,7 +2227,7 @@ panel_operate (void *source_panel, int operation, char *thedefault) retry_many_dst_stat: dst_result = mc_stat (dest, &dst_stat); if (dst_result == 0 && !S_ISDIR (dst_stat.st_mode)){ - if (file_error (_(" Destination \"%s\" must be a directory "), dest) == FILE_RETRY) + if (file_error (_(" Destination \"%s\" must be a directory \n %s "), dest) == FILE_RETRY) goto retry_many_dst_stat; goto clean_up; } @@ -2352,7 +2352,7 @@ real_do_file_error (enum OperationMode mode, char *error) char *msg; msg = mode == Foreground ? MSG_ERROR : _(" Background process error "); - result = query_dialog (msg, error, 3, 3, _("&Skip"), _("&Retry"), _("&Abort")); + result = query_dialog (msg, error, D_ERROR, 3, _("&Skip"), _("&Retry"), _("&Abort")); switch (result){ case 0: diff --git a/src/file.h b/src/file.h index b5e400999..c2730c520 100644 --- a/src/file.h +++ b/src/file.h @@ -7,11 +7,14 @@ enum { FILE_CONT, FILE_RETRY, FILE_SKIP, FILE_ABORT }; extern int verbose; extern int know_not_what_am_i_doing; +struct link; + int copy_file_file (char *s, char *d, int ask_overwrite); int move_file_file (char *s, char *d); int erase_dir (char *s); int erase_dir_iff_empty (char *s); int move_dir_dir (char *s, char *d); +int copy_dir_dir (char *s, char *d, int toplevel, int move_over, int delete, struct link *parent_dirs); void create_op_win (int op, int with_eta); void destroy_op_win (void); diff --git a/src/main.h b/src/main.h index 265dc3a37..20fb8855e 100644 --- a/src/main.h +++ b/src/main.h @@ -148,18 +148,18 @@ enum cd_enum { cd_exact }; -int do_cd (char *new_dir, enum cd_enum cd_type); /* For find.c */ -void change_panel (void); -void init_sigchld (void); /* For subshell.c */ -int load_prompt (int fd, void *unused); +int do_cd (char *new_dir, enum cd_enum cd_type); /* For find.c */ +void change_panel (void); +void init_sigchld (void); /* For subshell.c */ +int load_prompt (int fd, void *unused); void save_cwds_stat (void); void copy_prog_name (void); -int quiet_quit_cmd (void); /* For cmd.c and command.c */ -int quit_cmd (void); +int quiet_quit_cmd (void); /* For cmd.c and command.c */ +int quit_cmd (void); -void untouch_bar (void); -void touch_bar (void); -void load_hint (void); +void untouch_bar (void); +void touch_bar (void); +void load_hint (void); void print_vfs_message(char *msg, ...); @@ -179,6 +179,15 @@ extern WLabel *process_status; extern WMenu *the_menubar; extern Dlg_head *midnight_dlg; + +/* Back hack to define the following routines only if the client code + * has included panel.h + */ +#ifdef __PANEL_H +void directory_history_add (WPanel *panel, char *s); +int do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type); +#endif + #endif #ifdef OS2_NT diff --git a/src/tree.c b/src/tree.c index f5fc482ba..d43a6ff8b 100644 --- a/src/tree.c +++ b/src/tree.c @@ -1103,7 +1103,7 @@ void tree_copy (WTree *tree, char *default_dest) } create_op_win (OP_COPY, 0); file_mask_defaults (); - copy_dir_dir (tree->selected_ptr->name, dest, 1, 0); + copy_dir_dir (tree->selected_ptr->name, dest, 1, 0, 0, 0); destroy_op_win (); free (dest); } diff --git a/src/util.h b/src/util.h index ba4a612c5..7a9fae3e6 100644 --- a/src/util.h +++ b/src/util.h @@ -105,6 +105,7 @@ void close_error_pipe (int error, char *text); /* Process spawning */ void my_putenv (char*, char*); int my_system (int as_shell_command, const char *shell, const char *command); +int my_system_get_child_pid (int as_shell_command, const char *shell, const char *command, pid_t *pid); void save_stop_handler (void); extern struct sigaction startup_handler; diff --git a/src/utilunix.c b/src/utilunix.c index d05c88441..cb3d08121 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -200,7 +200,7 @@ char *get_owner (int uid) struct passwd *pwd; static char ibuf [8]; char *name; - static uid_last; + static int uid_last; if ((name = i_cache_match (uid, uid_cache, UID_CACHE_SIZE)) != NULL) return name; diff --git a/src/view.c b/src/view.c index 222a442ac..23406eb2e 100644 --- a/src/view.c +++ b/src/view.c @@ -670,7 +670,7 @@ view_init (WView *view, char *_command, char *_file, int start_line) /* {{{ Screen update functions */ #ifndef HAVE_X -static void +void view_percent (WView *view, int p, int w) { int percent; @@ -690,7 +690,7 @@ view_percent (WView *view, int p, int w) printw ("%3d%% ", percent); } -static void +void view_status (WView *view) { int w = view->widget.cols - (view->have_frame * 2); diff --git a/src/view.h b/src/view.h index 9ded75b7b..5422bac09 100644 --- a/src/view.h +++ b/src/view.h @@ -117,17 +117,19 @@ int view_init (WView *view, char *_command, char *_file, int start_line); int view_file (char *filename, int normal, int internal); /* Internal view routines */ -void view_update (WView *view); -void view_labels (WView *view); -int view_event (WView *view, Gpm_Event *event,int *result); -void toggle_wrap_mode (WView *); -void toggle_hex_mode (WView *); -void goto_line (WView *); -void regexp_search_cmd (WView *); -void normal_search_cmd (WView *); -void continue_search (WView *); -void change_nroff (WView *view); -void set_monitor (WView *view, int set_on); +void view_status (WView *); +void view_percent (WView *, int, int); +void view_update (WView *view); +void view_labels (WView *view); +int view_event (WView *view, Gpm_Event *event,int *result); +void toggle_wrap_mode (WView *); +void toggle_hex_mode (WView *); +void goto_line (WView *); +void regexp_search_cmd (WView *); +void normal_search_cmd (WView *); +void continue_search (WView *); +void change_nroff (WView *view); +void set_monitor (WView *view, int set_on); #endif /* Command: view a file, if _command != NULL we use popen on _command */ @@ -172,6 +174,11 @@ void view_display_clean (WView *view, int h, int w); void view_move_backward (WView *view, int i); void view_move_forward (WView *view, int i); +void x_destroy_view (WView *); +void x_create_viewer (WView *); +void x_focus_view (WView *); +void x_init_view (WView *); + #ifdef PORT_HAS_VIEW_FREEZE void view_freeze (WView *view); void view_thaw (WView *view); diff --git a/src/widget.h b/src/widget.h index b46ac7198..e480ef048 100644 --- a/src/widget.h +++ b/src/widget.h @@ -217,4 +217,17 @@ void redraw_labels (Dlg_head *h, Widget *paneletc); WButtonBar *find_buttonbar (Dlg_head *h, Widget *paneletc); void buttonbar_hint (WButtonBar *bb, char *s); +#ifdef HAVE_X +int x_create_radio (Dlg_head *h, widget_data parent, WRadio *r); +int x_create_check (Dlg_head *h, widget_data parent, WCheck *c); +int x_create_label (Dlg_head *h, widget_data parent, WLabel *l); +int x_create_input (Dlg_head *h, widget_data parent, WInput *in); +int x_create_listbox (Dlg_head *h, widget_data parent, WListbox *l); +int x_create_buttonbar (Dlg_head *h, widget_data parent, WButtonBar *bb); + +void x_listbox_select_nth (WListbox *, int); +void x_list_insert (WListbox *, WLEntry *, WLEntry *); +void x_redefine_label (WButtonBar *, int); +#endif + #endif /* __WIDGET_H */