mc/gnome/gcmd.c

125 lines
2.6 KiB
C
Raw Normal View History

/*
* Various Menu-invoked Command implementations specific to the GNOME port
*
* Copyright (C) 1998 the Free Software Foundation
*
* Author: Miguel de Icaza (miguel@kernel.org)
*/
1998-03-13 20:28:06 +03:00
#include <config.h>
#include "x.h"
#include <stdio.h>
#include <sys/stat.h>
#include "dir.h"
#include "panel.h"
#include "gscreen.h"
#include "main.h"
#include "gmain.h"
1998-03-13 20:28:06 +03:00
#include "cmd.h"
#include "boxes.h"
#include "panelize.h"
#include "gcmd.h"
#include "dialog.h"
#include "layout.h"
1998-03-13 20:28:06 +03:00
void
gnome_listing_cmd (GtkWidget *widget, WPanel *panel)
{
int view_type, use_msformat;
char *user, *status;
view_type = display_box (panel, &user, &status, &use_msformat, get_current_index ());
if (view_type == -1)
return;
configure_panel_listing (panel, view_type, use_msformat, user, status);
}
void
gnome_compare_panels (void)
{
if (get_other_panel () == NULL){
message (1, MSG_ERROR, _(" There is no other panel to compare contents to "));
1998-03-13 20:28:06 +03:00
return;
}
compare_dirs_cmd ();
}
void
gnome_open_terminal (void)
{
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 ");
1998-03-13 20:28:06 +03:00
}
void
gnome_about_cmd (void)
{
GtkWidget *about;
gchar *authors[] = {
"The Midnight Commander Team",
"http://mc.blackdown.org/mc",
"bug reports: mc-bugs@nuclecu.unam.mx",
NULL
};
about = gnome_about_new (_("GNU Midnight Commander"), VERSION,
"(C) 1994-1998 the Free Software Fundation",
authors,
_("The GNOME edition of the Midnight Commander file manager."),
NULL);
gtk_widget_show (about);
}
void
gnome_quit_cmd (void)
{
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 ();
1998-03-13 20:28:06 +03:00
}
void
gnome_open_panel (GtkWidget *widget, WPanel *panel)
{
new_panel_at (panel->cwd);
}
Ok, most of the "Elliot Lee confidential bug report" has been dealt with with this commit. This also addresses a bunch of the comments from the status.shtml from DrMike. Miguel. 1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx> * screen.c (GT): Assign two spaces for the minimum size of the "type" field for the GNOME edition. This gives some extra space for the icon that gets displayed. * dlg.c (remove_widget): New function: used to remove a widget from an existing Dlg_head; (destroy_widget): Destroy a specific Widget. (add_widgetl): Extended to deal with the fact that a running Dlg_head can become empty. * panelize.c (l_call): Update the input line every time the user selects the entry with the mouse (pretty common in the gnome edition). * hotlist.c (add_new_group_input): Removed an extra field that was causing problems. * find.c (find_parameters): Tree button is gone for gnome until we get the tree function working on gnome. * cmd.c (save_setup_cmd): Per Elliot's suggestion, do not pop up a dialog box to inform the user about the saved setup. 1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx> * gcmd.c (gnome_close_panel): Implement the close-the-panel functionality. * gscreen.c (x_panel_destroy): Implement the gnome mode way of destroying the panel. * gview.c (view_status): Add cacheing of the information status, to avoid excessive flicker. It would be better if GtkLabel did not flicker though. (scrollbar_moved): Scroll correctly. We now use view_move_backward and view_move_forward to adjust the scrollbar contents. This displays the scrollbar correctly. * gwidget.c (x_listbox_select_nth): This may be invoked before the widget has been created, work around this problem. * gscreen.c (show_dir): Set the title bar for the window to the current directoy. Reported by both Mike and Elliot. * layout: Updated to the new hotlist dialog box.
1998-04-16 06:45:53 +04:00
int
gnome_close_panel (GtkWidget *widget, WPanel *panel)
{
Dlg_head *h = panel->widget.parent;
/* Remove the widgets from the dialog head */
remove_widget (h, panel->current_dir);
remove_widget (h, panel->filter_w);
remove_widget (h, panel);
/* Kill them */
destroy_widget (panel->current_dir);
destroy_widget (panel->filter_w);
destroy_widget ((void *)panel);
layout_panel_gone (panel);
Ok, most of the "Elliot Lee confidential bug report" has been dealt with with this commit. This also addresses a bunch of the comments from the status.shtml from DrMike. Miguel. 1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx> * screen.c (GT): Assign two spaces for the minimum size of the "type" field for the GNOME edition. This gives some extra space for the icon that gets displayed. * dlg.c (remove_widget): New function: used to remove a widget from an existing Dlg_head; (destroy_widget): Destroy a specific Widget. (add_widgetl): Extended to deal with the fact that a running Dlg_head can become empty. * panelize.c (l_call): Update the input line every time the user selects the entry with the mouse (pretty common in the gnome edition). * hotlist.c (add_new_group_input): Removed an extra field that was causing problems. * find.c (find_parameters): Tree button is gone for gnome until we get the tree function working on gnome. * cmd.c (save_setup_cmd): Per Elliot's suggestion, do not pop up a dialog box to inform the user about the saved setup. 1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx> * gcmd.c (gnome_close_panel): Implement the close-the-panel functionality. * gscreen.c (x_panel_destroy): Implement the gnome mode way of destroying the panel. * gview.c (view_status): Add cacheing of the information status, to avoid excessive flicker. It would be better if GtkLabel did not flicker though. (scrollbar_moved): Scroll correctly. We now use view_move_backward and view_move_forward to adjust the scrollbar contents. This displays the scrollbar correctly. * gwidget.c (x_listbox_select_nth): This may be invoked before the widget has been created, work around this problem. * gscreen.c (show_dir): Set the title bar for the window to the current directoy. Reported by both Mike and Elliot. * layout: Updated to the new hotlist dialog box.
1998-04-16 06:45:53 +04:00
return TRUE;
}