1998-04-17 04:21:53 +04:00
|
|
|
/*
|
|
|
|
* 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"
|
1998-04-17 04:59:58 +04:00
|
|
|
#include "gmain.h"
|
1998-03-13 20:28:06 +03:00
|
|
|
#include "cmd.h"
|
|
|
|
#include "boxes.h"
|
1999-01-06 03:33:40 +03:00
|
|
|
#include "profile.h"
|
|
|
|
#include "setup.h"
|
1998-03-13 20:28:06 +03:00
|
|
|
#include "panelize.h"
|
|
|
|
#include "gcmd.h"
|
1998-03-25 08:16:00 +03:00
|
|
|
#include "dialog.h"
|
1998-04-17 04:59:58 +04:00
|
|
|
#include "layout.h"
|
1998-12-11 06:18:41 +03:00
|
|
|
#include "../vfs/vfs.h"
|
1998-03-13 20:28:06 +03:00
|
|
|
|
1999-01-14 04:10:32 +03:00
|
|
|
enum {
|
1998-12-30 03:19:46 +03:00
|
|
|
SORT_NAME,
|
|
|
|
SORT_EXTENSION,
|
|
|
|
SORT_ACCESS,
|
|
|
|
SORT_MODIFY,
|
|
|
|
SORT_CHANGE,
|
|
|
|
SORT_SIZE
|
1999-01-14 04:10:32 +03:00
|
|
|
};
|
|
|
|
|
1999-01-06 03:33:40 +03:00
|
|
|
static char *panelize_section = "Panelize";
|
1998-12-30 03:19:46 +03:00
|
|
|
|
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){
|
1998-03-25 08:16:00 +03:00
|
|
|
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)
|
|
|
|
{
|
1998-04-17 04:21:53 +04:00
|
|
|
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)
|
I improved the movement keys of the internal viewer a little bit.
Now in wrap mode the End key and cursor up key behave much better
(e.g. when viewing binary files with lots of wrapped lines).
It's not perfekt but it's better than it used to be.
Tue Apr 28 06:52:24 1998 Norbert Warmuth <k3190@fh-sw.de>
* gnome/gcmd.c (gnome_open_terminal): Changed my_system(1,...) to
my_system(EXECUTE_AS_SHELL,...)
Tue Apr 28 06:06:03 1998 Norbert Warmuth <k3190@fh-sw.de>
* vfs/extfs.c (extfs_open, extfs_close): Changed my_system(1,...)
to my_system(EXECUTE_AS_SHELL,...), this fixes the broken copyin and
copyout in 4.1.32.
Tue Apr 28 06:11:08 1998 Norbert Warmuth <k3190@fh-sw.de>
* view.c (toggle_wrap_mode, toggle_hex_mode): Force recalculation
of bottom_first (we mustn't use an already calculated and cached
value because it is invalid for the new mode and the End key would
not move to the end of the file).
* configure.in: Renamed the option `--with-our-slang' to
`--with-included-slang' (this one looks better because we also
have an `--with-included-gettext').
Make the option `--with-ext2undel' recognice a given path.
* cmd.c (view_file_at_line): In plain view (F13) set the default
magic flag to zero in order to view the file content unprocessed
(esp. don't uncompress files if they are compressed). The
view_simple_cmd got broken when the default magic flag in view.c
was changed from 0 to 1.
* view.c (do_view_init, goto_line): Set wrap mode temporary off
to make goto line number work, i.e. `line number' now always means
line number in file and not line number on screen (in wrap mode
one long line wrapped once is displayed in two lines on the screen).
That's important when the viewer is invoked from the find file
dialog to display even in wrap mode approxiamtly the part of the
file where we found the content we searched for.
(move_forward2): In wrap mode lines were sometimes counted wrong
causing cursor up to move more than one line.
(move_backward2): Fixed the movement in wrap mode.
(change_viewer): Always re-init viewer when we have a filename,
i. e. if the viewer is invoked with simple_view_cmd then we can switch
with the F8 key between unprocessed file content und uncompressed
file content.
(view_init): re-init view also when magic flag was altered
1998-04-28 18:19:48 +04:00
|
|
|
my_system (EXECUTE_AS_SHELL, shell, p);
|
1998-04-17 04:21:53 +04:00
|
|
|
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;
|
1998-10-20 05:52:16 +04:00
|
|
|
const gchar *authors[] = {
|
1998-03-13 20:28:06 +03:00
|
|
|
"The Midnight Commander Team",
|
1998-09-18 22:21:47 +04:00
|
|
|
"http://www.gnome.org/mc/",
|
1998-03-13 20:28:06 +03:00
|
|
|
"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)
|
|
|
|
{
|
1998-04-17 04:21:53 +04:00
|
|
|
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
|
|
|
}
|
|
|
|
|
1998-03-23 20:49:04 +03:00
|
|
|
void
|
|
|
|
gnome_open_panel (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
new_panel_at (panel->cwd);
|
|
|
|
}
|
1998-04-16 06:45:53 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
gnome_close_panel (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
Dlg_head *h = panel->widget.parent;
|
1999-01-20 05:16:09 +03:00
|
|
|
g_print ("closing the panel\n");
|
1998-12-15 09:35:51 +03:00
|
|
|
if (panel->timer_id){
|
|
|
|
gtk_timeout_remove (panel->timer_id);
|
|
|
|
panel->timer_id = -1;
|
|
|
|
}
|
|
|
|
|
1998-04-16 06:45:53 +04:00
|
|
|
/* 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);
|
|
|
|
|
1998-04-17 04:21:53 +04:00
|
|
|
layout_panel_gone (panel);
|
1998-12-11 05:58:48 +03:00
|
|
|
|
|
|
|
mc_chdir ("/");
|
1998-04-16 06:45:53 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
1998-12-15 09:35:51 +03:00
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
void
|
|
|
|
gnome_icon_view_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
if (panel->list_type == list_icons)
|
|
|
|
return;
|
|
|
|
panel->list_type = list_icons;
|
|
|
|
set_panel_formats (panel);
|
|
|
|
paint_panel (panel);
|
|
|
|
do_refresh ();
|
|
|
|
}
|
|
|
|
void
|
|
|
|
gnome_partial_view_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
if (panel->list_type == list_brief)
|
|
|
|
return;
|
|
|
|
panel->list_type = list_brief;
|
|
|
|
set_panel_formats (panel);
|
|
|
|
paint_panel (panel);
|
|
|
|
do_refresh ();
|
|
|
|
}
|
|
|
|
void
|
|
|
|
gnome_full_view_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
if (panel->list_type == list_full)
|
|
|
|
return;
|
|
|
|
panel->list_type = list_full;
|
|
|
|
set_panel_formats (panel);
|
|
|
|
paint_panel (panel);
|
|
|
|
do_refresh ();
|
|
|
|
}
|
|
|
|
void
|
|
|
|
gnome_custom_view_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
if (panel->list_type == list_user)
|
|
|
|
return;
|
|
|
|
panel->list_type = list_user;
|
|
|
|
set_panel_formats (panel);
|
|
|
|
paint_panel (panel);
|
|
|
|
do_refresh ();
|
|
|
|
}
|
1999-01-03 01:06:00 +03:00
|
|
|
static void
|
|
|
|
sort_callback (GtkWidget *menu_item, GtkWidget *cbox1)
|
|
|
|
{
|
|
|
|
if (gtk_object_get_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE") == SORT_NAME)
|
|
|
|
gtk_widget_set_sensitive (cbox1, TRUE);
|
|
|
|
else
|
|
|
|
gtk_widget_set_sensitive (cbox1, FALSE);
|
|
|
|
}
|
1998-12-30 03:19:46 +03:00
|
|
|
void
|
|
|
|
gnome_sort_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
GtkWidget *sort_box;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *omenu;
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menu_item;
|
1999-01-02 02:08:38 +03:00
|
|
|
GtkWidget *cbox1, *cbox2;
|
1999-01-08 00:40:50 +03:00
|
|
|
sortfn *sfn = NULL;
|
1998-12-30 03:19:46 +03:00
|
|
|
|
1999-01-05 02:45:02 +03:00
|
|
|
sort_box = gnome_dialog_new (_("Sort By"), GNOME_STOCK_BUTTON_OK,
|
1998-12-30 03:19:46 +03:00
|
|
|
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
1999-01-23 23:43:36 +03:00
|
|
|
gmc_window_setup_from_panel (GNOME_DIALOG (sort_box), panel);
|
|
|
|
|
1999-01-03 01:06:00 +03:00
|
|
|
/* we define this up here so we can pass it in to our callback */
|
|
|
|
cbox1 = gtk_check_button_new_with_label (N_("Ignore case sensitivity."));
|
1998-12-30 03:19:46 +03:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new ("Sort files by "), FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
omenu = gtk_option_menu_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), omenu, FALSE, FALSE, 0);
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
menu_item = gtk_menu_item_new_with_label ( _("Name"));
|
1999-01-02 02:08:38 +03:00
|
|
|
/* FIXME: we want to set the option menu to be the correct ordering. */
|
1998-12-30 03:19:46 +03:00
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
1999-01-02 02:08:38 +03:00
|
|
|
gtk_object_set_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE", (gpointer) SORT_NAME);
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
GTK_SIGNAL_FUNC (sort_callback), cbox1);
|
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
menu_item = gtk_menu_item_new_with_label ( _("File Type"));
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
1999-01-02 02:08:38 +03:00
|
|
|
gtk_object_set_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE", (gpointer) SORT_EXTENSION);
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
GTK_SIGNAL_FUNC (sort_callback), cbox1);
|
1999-01-02 02:08:38 +03:00
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
menu_item = gtk_menu_item_new_with_label ( _("Size"));
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
1999-01-02 02:08:38 +03:00
|
|
|
gtk_object_set_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE", (gpointer) SORT_SIZE);
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
GTK_SIGNAL_FUNC (sort_callback), cbox1);
|
1999-01-02 02:08:38 +03:00
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
menu_item = gtk_menu_item_new_with_label ( _("Time Last Accessed"));
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
1999-01-02 02:08:38 +03:00
|
|
|
gtk_object_set_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE", (gpointer) SORT_ACCESS);
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
GTK_SIGNAL_FUNC (sort_callback), cbox1);
|
1999-01-02 02:08:38 +03:00
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
menu_item = gtk_menu_item_new_with_label ( _("Time Last Modified"));
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
1999-01-02 02:08:38 +03:00
|
|
|
gtk_object_set_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE", (gpointer) SORT_MODIFY);
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
GTK_SIGNAL_FUNC (sort_callback), cbox1);
|
1999-01-02 02:08:38 +03:00
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
menu_item = gtk_menu_item_new_with_label ( _("Time Last Changed"));
|
|
|
|
gtk_menu_append (GTK_MENU (menu), menu_item);
|
1999-01-02 02:08:38 +03:00
|
|
|
gtk_object_set_data (GTK_OBJECT (menu_item), "SORT_ORDER_CODE", (gpointer) SORT_CHANGE);
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
|
|
|
GTK_SIGNAL_FUNC (sort_callback), cbox1);
|
1999-01-02 02:08:38 +03:00
|
|
|
|
1998-12-30 03:19:46 +03:00
|
|
|
gtk_widget_show_all (menu);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
|
|
|
|
|
|
|
|
|
1999-01-03 01:06:00 +03:00
|
|
|
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (cbox1), panel->case_sensitive);
|
1998-12-30 03:19:46 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox),
|
1999-01-02 02:08:38 +03:00
|
|
|
cbox1, FALSE, FALSE, 0);
|
1999-01-03 01:06:00 +03:00
|
|
|
|
|
|
|
cbox2 = gtk_check_button_new_with_label (N_("Reverse the order."));
|
|
|
|
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (cbox2), panel->reverse);
|
1998-12-30 03:19:46 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (sort_box)->vbox),
|
1999-01-02 02:08:38 +03:00
|
|
|
cbox2, FALSE, FALSE, 0);
|
1998-12-30 03:19:46 +03:00
|
|
|
/* off to the races */
|
|
|
|
gtk_widget_show_all (GNOME_DIALOG (sort_box)->vbox);
|
1999-01-02 02:08:38 +03:00
|
|
|
switch (gnome_dialog_run (GNOME_DIALOG (sort_box))) {
|
|
|
|
case 0:
|
|
|
|
switch( (gint) gtk_object_get_data (GTK_OBJECT
|
|
|
|
(GTK_OPTION_MENU
|
|
|
|
(omenu)->menu_item),
|
|
|
|
"SORT_ORDER_CODE") ) {
|
|
|
|
case SORT_NAME:
|
1999-01-14 04:10:32 +03:00
|
|
|
sfn = (sortfn *) sort_name;
|
1999-01-02 02:08:38 +03:00
|
|
|
break;
|
|
|
|
case SORT_EXTENSION:
|
1999-01-14 04:10:32 +03:00
|
|
|
sfn = (sortfn *) sort_ext;
|
1999-01-02 02:08:38 +03:00
|
|
|
break;
|
|
|
|
case SORT_ACCESS:
|
1999-01-14 04:10:32 +03:00
|
|
|
sfn = (sortfn *) sort_atime;
|
1999-01-02 02:08:38 +03:00
|
|
|
break;
|
|
|
|
case SORT_MODIFY:
|
1999-01-14 04:10:32 +03:00
|
|
|
sfn = (sortfn *) sort_time;
|
1999-01-02 02:08:38 +03:00
|
|
|
break;
|
|
|
|
case SORT_CHANGE:
|
1999-01-14 04:10:32 +03:00
|
|
|
sfn = (sortfn *) sort_ctime;
|
1999-01-02 02:08:38 +03:00
|
|
|
break;
|
|
|
|
case SORT_SIZE:
|
1999-01-14 04:10:32 +03:00
|
|
|
sfn = (sortfn *) sort_size;
|
1999-01-02 02:08:38 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* case sensitive */
|
1999-01-03 01:06:00 +03:00
|
|
|
panel->case_sensitive = GTK_TOGGLE_BUTTON (cbox1)->active;
|
|
|
|
/* Reverse order */
|
|
|
|
panel->reverse = GTK_TOGGLE_BUTTON (cbox2)->active;
|
|
|
|
|
1999-01-02 02:08:38 +03:00
|
|
|
panel_set_sort_order (panel, sfn);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gtk_widget_destroy (sort_box);
|
1998-12-30 03:19:46 +03:00
|
|
|
}
|
1999-01-06 03:33:40 +03:00
|
|
|
typedef struct ep_dlg_data {
|
|
|
|
GtkWidget *ep_dlg;
|
|
|
|
GtkWidget *clist;
|
|
|
|
GtkWidget *entry;
|
1999-01-06 08:25:59 +03:00
|
|
|
GtkWidget *add_button;
|
1999-01-06 03:33:40 +03:00
|
|
|
GtkWidget *remove_button;
|
|
|
|
gboolean setting_text;
|
|
|
|
gint selected; /* if this is -1 then nothing is selected, otherwise, it's the row selected */
|
|
|
|
} ep_dlg_data;
|
|
|
|
|
1999-01-06 08:25:59 +03:00
|
|
|
static gchar *
|
1999-01-06 23:23:31 +03:00
|
|
|
get_nickname (gchar *text)
|
1999-01-06 08:25:59 +03:00
|
|
|
{
|
|
|
|
GtkWidget *dlg;
|
|
|
|
GtkWidget *entry;
|
|
|
|
GtkWidget *label;
|
|
|
|
gchar *retval = NULL;
|
|
|
|
|
|
|
|
dlg = gnome_dialog_new (_("Enter name."), GNOME_STOCK_BUTTON_OK,
|
|
|
|
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
1999-01-23 23:43:36 +03:00
|
|
|
gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
1999-01-06 08:25:59 +03:00
|
|
|
entry = gtk_entry_new ();
|
1999-01-06 23:23:31 +03:00
|
|
|
if (text)
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
1999-01-06 08:25:59 +03:00
|
|
|
label = gtk_label_new (_("Enter label for command:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
|
|
|
|
label, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
|
|
|
|
entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show_all (GNOME_DIALOG (dlg)->vbox);
|
|
|
|
switch (gnome_dialog_run (GNOME_DIALOG (dlg))) {
|
|
|
|
case 0:
|
|
|
|
retval = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
gtk_widget_destroy (dlg);
|
|
|
|
return retval;
|
|
|
|
}
|
1999-01-06 03:33:40 +03:00
|
|
|
static void
|
|
|
|
ep_add_callback (GtkWidget *widget, ep_dlg_data *data)
|
|
|
|
{
|
1999-01-06 08:25:59 +03:00
|
|
|
gint i;
|
|
|
|
gchar *insert_tab[1];
|
1999-01-06 03:33:40 +03:00
|
|
|
|
1999-01-06 23:23:31 +03:00
|
|
|
insert_tab[0] = get_nickname (NULL);
|
1999-01-06 08:25:59 +03:00
|
|
|
if (insert_tab[0] == NULL)
|
|
|
|
return;
|
|
|
|
i = gtk_clist_append (GTK_CLIST (data->clist), insert_tab);
|
|
|
|
gtk_clist_set_row_data (GTK_CLIST (data->clist), i,
|
|
|
|
g_strdup (gtk_entry_get_text (GTK_ENTRY (data->entry))));
|
|
|
|
g_free (insert_tab [0]);
|
|
|
|
data->selected = -1;
|
|
|
|
gtk_widget_set_sensitive (data->add_button, FALSE);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (data->entry), "");
|
1999-01-06 03:33:40 +03:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
ep_remove_callback (GtkWidget *widget, ep_dlg_data *data)
|
|
|
|
{
|
1999-01-06 08:25:59 +03:00
|
|
|
if (data->selected > -1) {
|
|
|
|
g_free (gtk_clist_get_row_data (GTK_CLIST (data->clist), data->selected));
|
|
|
|
gtk_clist_remove (GTK_CLIST (data->clist), data->selected);
|
|
|
|
data->selected = -1;
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (data->entry), "");
|
|
|
|
}
|
|
|
|
gtk_widget_set_sensitive (data->remove_button, FALSE);
|
1999-01-06 03:33:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ep_select_callback (GtkWidget *widget,
|
|
|
|
gint row,
|
|
|
|
gint column,
|
|
|
|
GdkEventButton *event,
|
|
|
|
ep_dlg_data *data)
|
|
|
|
{
|
1999-01-06 23:23:31 +03:00
|
|
|
if (event && event->type == GDK_2BUTTON_PRESS) {
|
|
|
|
gchar *nick;
|
|
|
|
|
|
|
|
gtk_clist_get_text (GTK_CLIST (widget), row, 0, &nick);
|
|
|
|
/* ugly but correct... (: */
|
|
|
|
nick = get_nickname (nick);
|
|
|
|
gtk_clist_set_text (GTK_CLIST (data->clist), row, 0, nick);
|
|
|
|
gtk_clist_select_row (GTK_CLIST (data->clist), row, 0);
|
|
|
|
} else {
|
|
|
|
data->setting_text = TRUE;
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (data->entry),
|
|
|
|
(gchar *) gtk_clist_get_row_data (GTK_CLIST (widget), row));
|
|
|
|
data->setting_text = FALSE;
|
|
|
|
data->selected = row;
|
|
|
|
gtk_widget_set_sensitive (data->remove_button, TRUE);
|
|
|
|
gtk_widget_set_sensitive (data->add_button, FALSE);
|
|
|
|
}
|
1999-01-06 03:33:40 +03:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
ep_text_changed_callback (GtkWidget *widget, ep_dlg_data *data)
|
|
|
|
{
|
|
|
|
if (data->setting_text)
|
|
|
|
/* we don't want to deselect text if we just clicked on something */
|
|
|
|
return;
|
|
|
|
if (data->selected > -1) {
|
|
|
|
gtk_clist_unselect_row (GTK_CLIST (data->clist), data->selected, 0);
|
|
|
|
data->selected = -1;
|
|
|
|
}
|
1999-01-06 08:25:59 +03:00
|
|
|
gtk_widget_set_sensitive (data->remove_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (data->add_button, TRUE);
|
1999-01-06 03:33:40 +03:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
load_settings (GtkCList *clist)
|
|
|
|
{
|
1999-01-06 08:53:32 +03:00
|
|
|
gchar *insert_tab[1];
|
1999-01-06 03:33:40 +03:00
|
|
|
void *profile_keys;
|
1999-01-06 08:53:32 +03:00
|
|
|
gchar *key, *value;
|
1999-01-06 03:33:40 +03:00
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
profile_keys = profile_init_iterator (panelize_section, profile_name);
|
|
|
|
|
|
|
|
if (!profile_keys){
|
|
|
|
insert_tab[0] = _("Find all core files");
|
1999-01-06 23:23:31 +03:00
|
|
|
i = gtk_clist_insert (clist, i, insert_tab);
|
|
|
|
gtk_clist_set_row_data (clist, i, g_strdup ("find / -name core"));
|
1999-01-06 03:33:40 +03:00
|
|
|
insert_tab[0] = _("Find rejects after patching");
|
1999-01-06 23:23:31 +03:00
|
|
|
i = gtk_clist_insert (clist, i, insert_tab);
|
|
|
|
gtk_clist_set_row_data (clist, i, g_strdup ("find . -name \\*.rej -print"));
|
1999-01-06 03:33:40 +03:00
|
|
|
} else {
|
|
|
|
while (profile_keys) {
|
|
|
|
profile_keys = profile_iterator_next (profile_keys, &key, &value);
|
|
|
|
insert_tab[0] = key;
|
1999-01-06 23:23:31 +03:00
|
|
|
i = gtk_clist_insert (clist, i, insert_tab);
|
|
|
|
gtk_clist_set_row_data (clist, i, g_strdup (value));
|
1999-01-06 03:33:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-01-06 08:53:32 +03:00
|
|
|
static void
|
|
|
|
save_settings (GtkCList *clist)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
profile_clean_section (panelize_section, profile_name);
|
|
|
|
for (i = 0; i < GTK_CLIST (clist)->rows; i++) {
|
|
|
|
gtk_clist_get_text (GTK_CLIST (clist), i, 0, &text);
|
|
|
|
WritePrivateProfileString (panelize_section,
|
|
|
|
text,
|
|
|
|
(gchar *) gtk_clist_get_row_data (GTK_CLIST (clist), i),
|
|
|
|
profile_name);
|
|
|
|
}
|
|
|
|
sync_profiles ();
|
|
|
|
}
|
1999-01-03 01:06:00 +03:00
|
|
|
void
|
|
|
|
gnome_external_panelize (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
1999-01-06 03:33:40 +03:00
|
|
|
ep_dlg_data *data;
|
1999-01-05 02:45:02 +03:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *sw;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
1999-01-06 08:25:59 +03:00
|
|
|
gint i;
|
|
|
|
gchar *row_data;
|
1999-01-06 03:33:40 +03:00
|
|
|
|
|
|
|
data = g_new0 (ep_dlg_data, 1);
|
|
|
|
data->setting_text = FALSE;
|
|
|
|
data->selected = -1;
|
|
|
|
data->ep_dlg = gnome_dialog_new (_("Run Command"), GNOME_STOCK_BUTTON_OK,
|
1999-01-05 02:45:02 +03:00
|
|
|
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
1999-01-23 23:43:36 +03:00
|
|
|
gtk_window_set_position (GTK_WINDOW (data->ep_dlg), GTK_WIN_POS_MOUSE);
|
|
|
|
|
1999-01-05 02:45:02 +03:00
|
|
|
/* Frame 1 */
|
|
|
|
frame = gtk_frame_new (_("Preset Commands"));
|
1999-01-06 03:33:40 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (data->ep_dlg)->vbox),
|
1999-01-05 02:45:02 +03:00
|
|
|
frame, FALSE, FALSE, 0);
|
1999-01-06 03:33:40 +03:00
|
|
|
data->clist = gtk_clist_new (1);
|
|
|
|
load_settings (GTK_CLIST (data->clist));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (data->clist), "select_row", GTK_SIGNAL_FUNC (ep_select_callback), (gpointer) data);
|
1999-01-05 02:45:02 +03:00
|
|
|
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
1999-01-06 23:23:31 +03:00
|
|
|
gtk_clist_columns_autosize (GTK_CLIST (data->clist));
|
|
|
|
gtk_clist_set_auto_sort (GTK_CLIST (data->clist), TRUE);
|
1999-01-05 02:45:02 +03:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
|
1999-01-06 03:33:40 +03:00
|
|
|
sw = gtk_scrolled_window_new (GTK_CLIST (data->clist)->hadjustment, GTK_CLIST (data->clist)->vadjustment);
|
1999-01-05 02:45:02 +03:00
|
|
|
gtk_widget_set_usize (sw, 300, 100);
|
1999-01-06 03:33:40 +03:00
|
|
|
gtk_container_add (GTK_CONTAINER (sw), data->clist);
|
1999-01-05 02:45:02 +03:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
1999-01-06 08:25:59 +03:00
|
|
|
data->add_button = gtk_button_new_with_label (_("Add"));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (data->add_button), "clicked", GTK_SIGNAL_FUNC (ep_add_callback), (gpointer) data);
|
|
|
|
gtk_widget_set_usize (data->add_button, 75, 25);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), data->add_button, FALSE, FALSE, 0);
|
1999-01-06 03:33:40 +03:00
|
|
|
data->remove_button = gtk_button_new_with_label (_("Remove"));
|
|
|
|
gtk_widget_set_sensitive (data->remove_button, FALSE);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (data->remove_button), "clicked", GTK_SIGNAL_FUNC (ep_remove_callback), (gpointer) data);
|
|
|
|
gtk_widget_set_usize (data->remove_button, 75, 25);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), data->remove_button, FALSE, FALSE, 0);
|
1999-01-05 02:45:02 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* Frame 2 */
|
|
|
|
frame = gtk_frame_new (_("Run this Command"));
|
1999-01-06 03:33:40 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (data->ep_dlg)->vbox),
|
1999-01-05 02:45:02 +03:00
|
|
|
frame, FALSE, FALSE, 0);
|
1999-01-06 03:33:40 +03:00
|
|
|
data->entry = gtk_entry_new ();
|
|
|
|
gtk_signal_connect (GTK_OBJECT (data->entry), "changed", GTK_SIGNAL_FUNC (ep_text_changed_callback), (gpointer) data);
|
1999-01-05 02:45:02 +03:00
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("Command: ")), FALSE, FALSE, 0);
|
1999-01-06 03:33:40 +03:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), data->entry, TRUE, TRUE, 0);
|
1999-01-05 02:45:02 +03:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
1999-01-06 03:33:40 +03:00
|
|
|
gtk_widget_show_all (GNOME_DIALOG (data->ep_dlg)->vbox);
|
|
|
|
switch (gnome_dialog_run (GNOME_DIALOG (data->ep_dlg))) {
|
|
|
|
case 0:
|
1999-01-06 09:14:15 +03:00
|
|
|
gtk_widget_hide (data->ep_dlg);
|
|
|
|
while (gtk_events_pending () )
|
|
|
|
gtk_main_iteration ();
|
|
|
|
|
1999-01-06 03:33:40 +03:00
|
|
|
do_external_panelize (gtk_entry_get_text (GTK_ENTRY (data->entry)));
|
1999-01-06 08:53:32 +03:00
|
|
|
save_settings (GTK_CLIST (data->clist));
|
1999-01-06 03:33:40 +03:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
default:
|
|
|
|
}
|
1999-01-06 08:25:59 +03:00
|
|
|
for (i = 0; i < GTK_CLIST (data->clist)->rows; i++) {
|
|
|
|
row_data = gtk_clist_get_row_data (GTK_CLIST (data->clist), i);
|
|
|
|
if (row_data)
|
|
|
|
g_free (row_data);
|
|
|
|
}
|
1999-01-06 03:33:40 +03:00
|
|
|
gtk_widget_destroy (GTK_WIDGET (data->ep_dlg));
|
|
|
|
g_free (data);
|
1999-01-03 01:06:00 +03:00
|
|
|
}
|
|
|
|
void
|
|
|
|
gnome_select_all_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
for (i = 0; i < panel->count; i++){
|
|
|
|
if (!strcmp (panel->dir.list [i].fname, ".."))
|
|
|
|
continue;
|
|
|
|
do_file_mark (panel, i, 1);
|
|
|
|
}
|
|
|
|
paint_panel (panel);
|
|
|
|
do_refresh ();
|
|
|
|
}
|
1999-01-07 09:53:31 +03:00
|
|
|
void
|
|
|
|
gnome_filter_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
GtkWidget *filter_dlg;
|
|
|
|
GtkWidget *entry;
|
1999-01-08 00:40:50 +03:00
|
|
|
GtkWidget *label;
|
1999-01-08 07:19:25 +03:00
|
|
|
gchar *text1, *text2, *text3;
|
1999-01-08 00:40:50 +03:00
|
|
|
|
|
|
|
filter_dlg = gnome_dialog_new (_("Set Filter"), GNOME_STOCK_BUTTON_OK,
|
|
|
|
GNOME_STOCK_BUTTON_CANCEL, NULL);
|
1999-01-23 23:43:36 +03:00
|
|
|
gtk_window_set_position (GTK_WINDOW (filter_dlg), GTK_WIN_POS_MOUSE);
|
1999-01-08 07:19:25 +03:00
|
|
|
if (easy_patterns) {
|
|
|
|
text1 = "mc_filter_globs";
|
|
|
|
text3 = _("Show all files");
|
|
|
|
if (panel->filter && (strcmp (panel->filter, "*")))
|
|
|
|
text2 = panel->filter;
|
|
|
|
else
|
|
|
|
text2 = NULL;
|
|
|
|
} else {
|
|
|
|
text1 = ("mc_filter_regexps");
|
|
|
|
text3 = _(".");
|
|
|
|
if (!panel->filter)
|
|
|
|
text2 = NULL;
|
|
|
|
else
|
|
|
|
text2 = panel->filter;
|
|
|
|
}
|
|
|
|
entry = gnome_entry_new (text1);
|
|
|
|
gnome_entry_load_history (GNOME_ENTRY (entry));
|
|
|
|
|
|
|
|
if (text2) {
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))), text2);
|
|
|
|
gnome_entry_prepend_history (GNOME_ENTRY (entry), FALSE, text3);
|
|
|
|
} else
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))), text3);
|
|
|
|
|
1999-01-08 00:40:50 +03:00
|
|
|
if (easy_patterns)
|
|
|
|
label = gtk_label_new (_("Enter a filter here for files in the panel view.\n\nFor example:\n*.gif will show just gif images"));
|
|
|
|
else
|
|
|
|
label = gtk_label_new (_("Enter a Regular Expression to filter files in the panel view."));
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
1999-01-07 09:53:31 +03:00
|
|
|
|
1999-01-08 00:40:50 +03:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (filter_dlg)->vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (filter_dlg)->vbox), entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show_all (GNOME_DIALOG (filter_dlg)->vbox);
|
|
|
|
switch (gnome_dialog_run (GNOME_DIALOG (filter_dlg))) {
|
|
|
|
case 0:
|
|
|
|
gtk_widget_hide (filter_dlg);
|
|
|
|
if (panel->filter) {
|
|
|
|
g_free (panel->filter);
|
|
|
|
panel->filter = NULL;
|
|
|
|
}
|
1999-01-08 07:19:25 +03:00
|
|
|
panel->filter = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry)))));
|
|
|
|
if (!strcmp (_("Show all files"), panel->filter)) {
|
|
|
|
g_free (panel->filter);
|
|
|
|
panel->filter = NULL;
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))),
|
|
|
|
"");
|
|
|
|
gtk_label_set_text (GTK_LABEL (panel->status), _("Show all files"));
|
|
|
|
} else if (!strcmp ("*", panel->filter)) {
|
1999-01-08 00:40:50 +03:00
|
|
|
g_free (panel->filter);
|
|
|
|
panel->filter = NULL;
|
|
|
|
gtk_label_set_text (GTK_LABEL (panel->status), _("Show all files"));
|
|
|
|
} else
|
|
|
|
gtk_label_set_text (GTK_LABEL (panel->status), panel->filter);
|
1999-01-08 07:19:25 +03:00
|
|
|
|
|
|
|
gnome_entry_save_history (GNOME_ENTRY (entry));
|
1999-01-08 00:40:50 +03:00
|
|
|
reread_cmd ();
|
|
|
|
x_filter_changed (panel);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gtk_widget_destroy (filter_dlg);
|
|
|
|
}
|
1999-01-16 06:01:35 +03:00
|
|
|
|
1999-01-13 00:50:25 +03:00
|
|
|
void
|
|
|
|
gnome_open_files (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
GList *later = NULL;
|
1999-01-14 04:10:32 +03:00
|
|
|
#if 0
|
1999-01-13 00:50:25 +03:00
|
|
|
GList *now;
|
1999-01-14 04:10:32 +03:00
|
|
|
#endif
|
1999-01-13 00:50:25 +03:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* FIXME: this is the easy way to do things. We want the
|
|
|
|
* hard way sometime. */
|
|
|
|
for (i = 0; i < panel->count; i++) {
|
|
|
|
if (panel->dir.list [i].f.marked)
|
|
|
|
if (!do_enter_on_file_entry ((panel->dir.list) + i))
|
|
|
|
later = g_list_prepend (later, panel->dir.list + i);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
/* This is sorta ugly. Should we just skip these? There should be a better way. */
|
|
|
|
for (now = later; now; now = now->next) {
|
|
|
|
gchar *command;
|
|
|
|
command = input_expand_dialog (_(" Open with..."),
|
|
|
|
_("Enter extra arguments:"), (WPanel *) now->data);
|
|
|
|
if (!command)
|
|
|
|
/* we break out. */
|
|
|
|
break;
|
|
|
|
execute (command);
|
|
|
|
free (command);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
g_list_free (later);
|
|
|
|
|
|
|
|
}
|
1999-01-16 06:01:35 +03:00
|
|
|
|
1999-01-14 03:39:03 +03:00
|
|
|
void
|
|
|
|
gnome_run_new (GtkWidget *widget, GnomeDesktopEntry *gde)
|
|
|
|
{
|
|
|
|
gnome_desktop_entry_launch (gde);
|
|
|
|
}
|
1999-01-16 06:01:35 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
gnome_mkdir_cmd (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
mkdir_cmd (panel);
|
|
|
|
}
|
|
|
|
|