1998-03-13 06:44:54 +03:00
|
|
|
/*
|
|
|
|
* Layout routines for the GNOME edition of the GNU Midnight Commander
|
|
|
|
*
|
|
|
|
* (C) 1998 the Free Software Foundation
|
|
|
|
*
|
|
|
|
* Author: Miguel de Icaza (miguel@kernel.org)
|
|
|
|
*/
|
1998-03-11 08:55:05 +03:00
|
|
|
#include <config.h>
|
1998-02-27 07:54:42 +03:00
|
|
|
#include "x.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include "dir.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "gscreen.h"
|
1998-03-04 09:28:35 +03:00
|
|
|
#include "main.h"
|
1998-04-17 04:21:53 +04:00
|
|
|
#include "gmain.h"
|
1998-02-27 07:54:42 +03:00
|
|
|
#include "cmd.h"
|
1998-03-11 08:55:05 +03:00
|
|
|
#include "boxes.h"
|
1998-03-13 06:44:54 +03:00
|
|
|
#include "panelize.h"
|
|
|
|
#include "gcmd.h"
|
1998-03-24 08:25:56 +03:00
|
|
|
#include "gcliplabel.h"
|
1998-04-15 07:16:29 +04:00
|
|
|
#include "gdesktop.h"
|
1998-04-17 04:59:58 +04:00
|
|
|
#include "setup.h"
|
|
|
|
#include "../vfs/vfs.h"
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-04 09:28:35 +03:00
|
|
|
#define UNDEFINED_INDEX -1
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-01 04:29:42 +03:00
|
|
|
GList *containers = 0;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
int output_lines = 0;
|
|
|
|
int command_prompt = 1;
|
|
|
|
int keybar_visible = 1;
|
|
|
|
int message_visible = 1;
|
|
|
|
int xterm_hintbar = 0;
|
|
|
|
|
|
|
|
PanelContainer *current_panel_ptr, *other_panel_ptr;
|
|
|
|
|
|
|
|
WPanel *
|
|
|
|
get_current_panel (void)
|
|
|
|
{
|
1998-04-17 04:21:53 +04:00
|
|
|
if (current_panel_ptr)
|
|
|
|
return current_panel_ptr->panel;
|
|
|
|
else
|
|
|
|
return NULL;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WPanel *
|
|
|
|
get_other_panel (void)
|
|
|
|
{
|
|
|
|
if (other_panel_ptr)
|
|
|
|
return other_panel_ptr->panel;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: we probably want to get rid of this code */
|
|
|
|
int
|
|
|
|
get_current_index (void)
|
|
|
|
{
|
|
|
|
GList *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0, p = containers; p; p = p->next, i++){
|
|
|
|
if (p->data == current_panel_ptr)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
printf ("FATAL: current panel is not in the list\n");
|
1998-03-11 00:10:30 +03:00
|
|
|
g_assert_not_reached ();
|
|
|
|
return -1; /* keep -Wall happy */
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
get_other_index (void)
|
|
|
|
{
|
|
|
|
GList *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0, p = containers; p; p = p->next, i++){
|
|
|
|
if (p->data == other_panel_ptr)
|
|
|
|
return i;
|
|
|
|
}
|
1998-03-04 09:28:35 +03:00
|
|
|
return UNDEFINED_INDEX;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
set_current_panel (int index)
|
|
|
|
{
|
|
|
|
GList *p;
|
|
|
|
|
|
|
|
for (p = containers; index; p = p->next)
|
|
|
|
index--;
|
|
|
|
current_panel_ptr = p->data;
|
|
|
|
}
|
|
|
|
|
1998-03-01 04:29:42 +03:00
|
|
|
void
|
|
|
|
set_new_current_panel (WPanel *panel)
|
|
|
|
{
|
|
|
|
GList *p;
|
|
|
|
|
1998-04-17 04:21:53 +04:00
|
|
|
if (g_list_length (containers) > 1)
|
|
|
|
other_panel_ptr = current_panel_ptr;
|
|
|
|
|
1998-03-01 04:29:42 +03:00
|
|
|
for (p = containers; p; p = p->next){
|
|
|
|
if (((PanelContainer *)p->data)->panel == panel){
|
|
|
|
current_panel_ptr = p->data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-04-17 04:21:53 +04:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len > 1){
|
|
|
|
containers = g_list_remove (containers, pc_holder);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if this is not the current panel */
|
|
|
|
if (current_panel_ptr->panel == panel){
|
|
|
|
if (other_panel_ptr){
|
|
|
|
current_panel_ptr = other_panel_ptr;
|
|
|
|
assign_other ();
|
|
|
|
} else {
|
|
|
|
current_panel_ptr = NULL;
|
|
|
|
}
|
|
|
|
} else if (other_panel_ptr->panel == panel){
|
|
|
|
/* Check if it was the other panel */
|
|
|
|
if (len == 1){
|
|
|
|
other_panel_ptr = 0;
|
|
|
|
} else
|
|
|
|
assign_other ();
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len == 1){
|
|
|
|
g_free (containers->data);
|
|
|
|
g_list_free (containers);
|
|
|
|
containers = NULL;
|
|
|
|
} else
|
|
|
|
g_free (pc_holder);
|
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
void
|
1998-03-04 09:28:35 +03:00
|
|
|
set_hintbar (char *str)
|
|
|
|
{
|
1998-03-05 07:53:47 +03:00
|
|
|
gtk_label_set (GTK_LABEL (current_panel_ptr->panel->status), str);
|
1998-05-25 02:21:56 +04:00
|
|
|
x_flush_events ();
|
1998-03-04 09:28:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
print_vfs_message (char *msg, ...)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
1998-03-04 09:28:35 +03:00
|
|
|
va_list ap;
|
|
|
|
char str [256];
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-04 09:28:35 +03:00
|
|
|
va_start(ap, msg);
|
|
|
|
vsprintf(str, msg, ap);
|
|
|
|
va_end(ap);
|
|
|
|
if (midnight_shutdown)
|
|
|
|
return;
|
|
|
|
|
|
|
|
set_hintbar(str);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
rotate_dash (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
get_current_type (void)
|
|
|
|
{
|
1998-03-04 09:28:35 +03:00
|
|
|
return view_listing;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
get_other_type (void)
|
|
|
|
{
|
1998-03-11 08:55:05 +03:00
|
|
|
return other_panel_ptr ? view_listing : view_nothing;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
get_display_type (int index)
|
|
|
|
{
|
|
|
|
GList *p;
|
|
|
|
|
1998-03-04 09:28:35 +03:00
|
|
|
if (index == UNDEFINED_INDEX)
|
|
|
|
return -1;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
p = g_list_nth (containers, index);
|
|
|
|
if (p)
|
|
|
|
return ((PanelContainer *)p->data)->panel->list_type;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
use_dash (int ignore)
|
|
|
|
{
|
|
|
|
/* we dont care in the gnome edition */
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget *
|
|
|
|
get_panel_widget (int index)
|
|
|
|
{
|
|
|
|
GList *p;
|
|
|
|
|
|
|
|
for (p = containers; index; p = p->next)
|
|
|
|
index--;
|
|
|
|
return (Widget *) ((PanelContainer *)p->data)->panel;
|
|
|
|
}
|
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
/* FIXME: This routine is wrong. It should follow what the original save_panel_types
|
|
|
|
* does. I can not remember which problem the original routine was trying to address
|
|
|
|
* when I did the "New {Left|Rigth} Panel" sections.
|
|
|
|
*/
|
1998-04-16 06:45:53 +04:00
|
|
|
void
|
|
|
|
save_panel_types (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
1998-03-13 06:44:54 +03:00
|
|
|
GList *p;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
for (p = containers; p; p = p->next){
|
|
|
|
PanelContainer *pc = p->data;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
panel_save_setup (pc->panel, pc->panel->panel_name);
|
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void configure_box (void);
|
1998-04-16 06:45:53 +04:00
|
|
|
|
1998-04-15 07:16:29 +04:00
|
|
|
GtkCheckMenuItem *gnome_toggle_snap (void);
|
1998-03-07 03:05:06 +03:00
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
GnomeUIInfo gnome_panel_file_menu [] = {
|
1998-05-25 02:21:56 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("New window"), N_("Opens a new window"), gnome_open_panel },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Open Terminal"), N_("Opens a terminal"), gnome_open_terminal },
|
|
|
|
{ GNOME_APP_UI_SEPARATOR },
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Copy..."), N_("Copy files"), copy_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Rename/Move..."), N_("Rename or move files"), ren_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("New directory..."), N_("Creates a new folder"), mkdir_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Delete..."), N_("Delete files from disk"), delete_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_SEPARATOR },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("View"), N_("View file"), panel_action_view },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("View raw"), N_("View the file without further processing"),panel_action_view_unfiltered},
|
|
|
|
{ GNOME_APP_UI_SEPARATOR },
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Select group by pattern..."), N_("Selects a group of files"), select_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Unselect group by pattern..."), N_("Un-selects a group of marked files"), unselect_cmd },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Reverse selection"), N_("Reverses the list of tagged files"), reverse_selection_cmd },
|
1998-04-16 06:45:53 +04:00
|
|
|
{ GNOME_APP_UI_SEPARATOR },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Close"), N_("Close this panel"), gnome_close_panel },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Exit"), N_("Exit program"), gnome_quit_cmd, NULL, NULL,
|
1998-03-13 06:44:54 +03:00
|
|
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT },
|
|
|
|
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
GnomeUIInfo gnome_panel_panel_menu [] = {
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Display mode..."), N_("Set the display mode for the panel"), gnome_listing_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Sort order..."), N_("Changes the sort order of the files"), sort_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Filter..."), N_("Set a filter for the files"), filter_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Rescan"), N_("Rescan the directory contents"), reread_cmd },
|
1998-03-13 06:44:54 +03:00
|
|
|
{ GNOME_APP_UI_SEPARATOR },
|
|
|
|
#ifdef USE_NETCODE
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Network link..."), N_("Connect to a remote machine"), netlink_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("FTP link..."), N_("Connect to a remote machine with FTP"), ftplink_cmd },
|
1998-03-13 06:44:54 +03:00
|
|
|
#endif
|
|
|
|
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
GnomeUIInfo gnome_panel_options_menu [] = {
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Confirmation..."), N_("Confirmation settings"), confirm_box },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Options..."), N_("Global option settings"), configure_box, NULL, NULL,
|
1998-03-13 06:44:54 +03:00
|
|
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP },
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef USE_VFS
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Virtual FS..."), N_("Virtual File System settings"), configure_vfs },
|
1998-03-13 06:44:54 +03:00
|
|
|
#endif
|
|
|
|
{ GNOME_APP_UI_SEPARATOR },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Save setup"), NULL, save_setup_cmd },
|
1998-03-13 06:44:54 +03:00
|
|
|
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
GnomeUIInfo gnome_panel_commands_menu [] = {
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Find..."), N_("Locate files on disk"), find_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Hotlist..."), N_("List of favorite sites"), quick_chdir_cmd },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Compare panels..."), N_("Compare panel contents"), gnome_compare_panels },
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("External panelize..."), NULL, external_panelize },
|
1998-03-13 06:44:54 +03:00
|
|
|
#ifdef USE_VFS
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Active VFS list..."), N_("List of active virtual file systems"), reselect_vfs },
|
1998-03-13 06:44:54 +03:00
|
|
|
#endif
|
|
|
|
#ifdef USE_EXT2FSLIB
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Undelete files (ext2fs only)..."), N_("Recover deleted files"), undelete_cmd },
|
1998-03-13 06:44:54 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WITH_BACKGROUND
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("Background jobs..."), N_("List of background operations"), jobs_cmd },
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
|
|
|
};
|
|
|
|
|
1998-04-15 07:16:29 +04:00
|
|
|
GnomeUIInfo gnome_panel_desktop_menu [] = {
|
|
|
|
{ GNOME_APP_UI_ITEM, N_("Arrange icons"), N_("Arranges the icons on the desktop"), gnome_arrange_icons },
|
|
|
|
/* { GNOME_APP_UI_TOGGLEITEM, N_("Desktop grid"), N_("Use a grid for laying out icons"), gnome_toggle_snap }, */
|
|
|
|
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
|
|
|
};
|
|
|
|
|
1998-03-13 06:44:54 +03:00
|
|
|
GnomeUIInfo gnome_panel_about_menu [] = {
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_ITEM, N_("About"), N_("Information on this program"), gnome_about_cmd, NULL, NULL,
|
1998-03-17 10:58:52 +03:00
|
|
|
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT },
|
1998-03-13 06:44:54 +03:00
|
|
|
GNOMEUIINFO_HELP ("midnight-commander"),
|
|
|
|
GNOMEUIINFO_END
|
|
|
|
};
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
GnomeUIInfo gnome_panel_menu [] = {
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_SUBTREE, N_("File"), NULL, &gnome_panel_file_menu },
|
1998-04-28 08:29:19 +04:00
|
|
|
{ GNOME_APP_UI_SUBTREE, N_("Window"), NULL, &gnome_panel_panel_menu },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_SUBTREE, N_("Commands"), NULL, &gnome_panel_commands_menu },
|
|
|
|
{ GNOME_APP_UI_SUBTREE, N_("Options"), NULL, &gnome_panel_options_menu },
|
1998-04-15 07:16:29 +04:00
|
|
|
{ GNOME_APP_UI_SUBTREE, N_("Desktop"), NULL, &gnome_panel_desktop_menu },
|
1998-03-25 08:16:00 +03:00
|
|
|
{ GNOME_APP_UI_SUBTREE, N_("Help"), NULL, &gnome_panel_about_menu },
|
1998-02-27 07:54:42 +03:00
|
|
|
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
|
|
|
};
|
|
|
|
|
1998-04-15 07:16:29 +04:00
|
|
|
GtkCheckMenuItem *
|
|
|
|
gnome_toggle_snap (void)
|
|
|
|
{
|
|
|
|
return GTK_CHECK_MENU_ITEM (gnome_panel_desktop_menu [1].widget);
|
|
|
|
}
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
void
|
1998-04-17 04:59:58 +04:00
|
|
|
gnome_init_panels (void)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
current_panel_ptr = NULL;
|
|
|
|
other_panel_ptr = NULL;
|
|
|
|
}
|
|
|
|
|
1998-04-16 06:45:53 +04:00
|
|
|
static void
|
|
|
|
gnome_close_panel_event (GtkWidget *widget, GdkEvent *event, WPanel *panel)
|
|
|
|
{
|
|
|
|
gnome_close_panel (widget, panel);
|
|
|
|
}
|
|
|
|
|
1998-03-02 23:27:08 +03:00
|
|
|
static void
|
|
|
|
panel_enter_event (GtkWidget *widget, GdkEvent *event, WPanel *panel)
|
|
|
|
{
|
|
|
|
/* Avoid unnecessary code execution */
|
|
|
|
if (get_current_panel () == panel)
|
|
|
|
return;
|
|
|
|
|
|
|
|
set_new_current_panel (panel);
|
|
|
|
dlg_select_widget (panel->widget.parent, panel);
|
|
|
|
send_message (panel->widget.parent, (Widget *) panel, WIDGET_FOCUS, 0);
|
|
|
|
}
|
|
|
|
|
1998-03-01 04:29:42 +03:00
|
|
|
WPanel *
|
1998-04-30 10:03:17 +04:00
|
|
|
create_container (Dlg_head *h, char *name, char *geometry)
|
1998-02-27 07:54:42 +03:00
|
|
|
{
|
|
|
|
PanelContainer *container = g_new (PanelContainer, 1);
|
|
|
|
WPanel *panel;
|
1998-03-01 04:29:42 +03:00
|
|
|
GtkWidget *app, *vbox;
|
1998-04-30 10:03:17 +04:00
|
|
|
int xpos, ypos, width, height;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-04-30 10:03:17 +04:00
|
|
|
gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height);
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
container->splitted = 0;
|
|
|
|
app = gnome_app_new ("gmc", name);
|
1998-04-22 10:01:38 +04:00
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (app), "gmc", "gmc");
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-04-30 10:03:17 +04:00
|
|
|
/* Geometry configuration */
|
|
|
|
if (width != -1 && height != -1)
|
|
|
|
gtk_widget_set_usize (GTK_WIDGET (app), width, height);
|
|
|
|
else
|
|
|
|
gtk_widget_set_usize (GTK_WIDGET (app), 500, 360);
|
|
|
|
if (xpos != -1 && ypos != -1)
|
|
|
|
gtk_widget_set_uposition (GTK_WIDGET (app), xpos, ypos);
|
|
|
|
|
|
|
|
panel = panel_new (name);
|
1998-02-27 07:54:42 +03:00
|
|
|
vbox = gtk_vbox_new (0, 0);
|
|
|
|
gnome_app_set_contents (GNOME_APP (app), vbox);
|
1998-03-07 03:05:06 +03:00
|
|
|
gnome_app_create_menus_with_data (GNOME_APP (app), gnome_panel_menu, panel);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-03-02 23:27:08 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (app),
|
|
|
|
"enter_notify_event",
|
|
|
|
GTK_SIGNAL_FUNC (panel_enter_event),
|
|
|
|
panel);
|
1998-04-16 06:45:53 +04:00
|
|
|
gtk_signal_connect (GTK_OBJECT (app),
|
|
|
|
"delete_event",
|
|
|
|
GTK_SIGNAL_FUNC (gnome_close_panel_event),
|
|
|
|
panel);
|
1998-03-01 04:29:42 +03:00
|
|
|
/* Ultra nasty hack follows:
|
|
|
|
* I am setting the panel->widget.wdata value here before the
|
|
|
|
* panel X stuff gets created in the INIT message section of the
|
|
|
|
* widget. There I put a pointer to the vbox where the panel
|
|
|
|
* should pack itself
|
|
|
|
*/
|
|
|
|
panel->widget.wdata = (widget_data) vbox;
|
1998-02-27 07:54:42 +03:00
|
|
|
container->panel = panel;
|
1998-03-01 04:29:42 +03:00
|
|
|
if (!containers){
|
|
|
|
containers = g_list_alloc ();
|
|
|
|
containers->data = container;
|
|
|
|
} else
|
|
|
|
containers = g_list_append (containers, container);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
if (!current_panel_ptr){
|
|
|
|
current_panel_ptr = container;
|
|
|
|
} else if (!other_panel_ptr)
|
|
|
|
other_panel_ptr = container;
|
1998-03-01 04:29:42 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
bind_gtk_keys (GTK_WIDGET (app), h);
|
1998-03-01 04:29:42 +03:00
|
|
|
return panel;
|
|
|
|
}
|
|
|
|
|
1998-05-05 00:25:27 +04:00
|
|
|
WPanel *
|
1998-04-30 10:03:17 +04:00
|
|
|
new_panel_with_geometry_at (char *dir, char *geometry)
|
1998-03-01 04:29:42 +03:00
|
|
|
{
|
|
|
|
WPanel *panel;
|
1998-04-30 10:03:17 +04:00
|
|
|
|
1998-03-01 04:29:42 +03:00
|
|
|
mc_chdir (dir);
|
1998-04-30 10:03:17 +04:00
|
|
|
panel = create_container (desktop_dlg, dir, geometry);
|
1998-04-17 04:21:53 +04:00
|
|
|
add_widget (desktop_dlg, panel);
|
1998-03-01 04:29:42 +03:00
|
|
|
set_new_current_panel (panel);
|
1998-04-30 10:03:17 +04:00
|
|
|
x_flush_events ();
|
1998-05-05 00:25:27 +04:00
|
|
|
|
|
|
|
return panel;
|
1998-04-30 10:03:17 +04:00
|
|
|
}
|
|
|
|
|
1998-05-05 00:25:27 +04:00
|
|
|
WPanel *
|
1998-04-30 10:03:17 +04:00
|
|
|
new_panel_at (char *dir)
|
|
|
|
{
|
1998-05-05 00:25:27 +04:00
|
|
|
return new_panel_with_geometry_at (dir, NULL);
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
setup_panels (void)
|
|
|
|
{
|
|
|
|
load_hint ();
|
|
|
|
}
|
|
|
|
|
1998-04-30 07:21:52 +04:00
|
|
|
/*
|
|
|
|
* GNOME's implementation of the update_panels routine
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
update_panels (int force_update, char *current_file)
|
|
|
|
{
|
|
|
|
int reload_others = !(force_update & UP_ONLY_CURRENT);
|
|
|
|
GList *p;
|
1998-05-07 00:04:08 +04:00
|
|
|
|
|
|
|
/* Test if there are panels open */
|
|
|
|
if (!cpanel)
|
|
|
|
return;
|
1998-04-30 07:21:52 +04:00
|
|
|
|
|
|
|
update_one_panel_widget (cpanel, force_update, current_file);
|
|
|
|
|
|
|
|
if (reload_others){
|
|
|
|
for (p = containers; p; p = p->next){
|
|
|
|
PanelContainer *pc = p->data;
|
|
|
|
|
|
|
|
if (p->data == current_panel_ptr)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
update_one_panel_widget (pc->panel, force_update, UP_KEEPSEL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mc_chdir (cpanel->cwd);
|
|
|
|
}
|