2 * Layout routines for the GNOME edition of the GNU Midnight Commander
4 * (C) 1998 the Free Software Foundation
6 * Author: Miguel de Icaza (miguel@kernel.org)
24 #include "gcliplabel.h"
27 #include "../vfs/vfs.h"
30 #include "listing-iconic.xpm"
31 #include "listing-brief-list.xpm"
32 #include "listing-list.xpm"
33 #include "listing-custom.xpm"
36 #define UNDEFINED_INDEX -1
38 /* Keep these two arrays in sync! */
40 GnomeUIInfo panel_view_menu_uiinfo
[] = {
41 GNOMEUIINFO_RADIOITEM (N_("_Icon View"),
42 N_("Switch view to an icon display"),
43 gnome_icon_view_cmd
, NULL
),
44 GNOMEUIINFO_RADIOITEM (N_("_Brief View"),
45 N_("Switch view to show just file name and type"),
46 gnome_brief_view_cmd
, NULL
),
47 GNOMEUIINFO_RADIOITEM (N_("_Detailed View"),
48 N_("Switch view to show detailed file statistics"),
49 gnome_detailed_view_cmd
, NULL
),
50 GNOMEUIINFO_RADIOITEM (N_("_Custom View"),
51 N_("Switch view to show user-defined statistics"),
52 gnome_custom_view_cmd
, NULL
),
56 GnomeUIInfo panel_view_toolbar_uiinfo
[] = {
57 GNOMEUIINFO_RADIOITEM (N_("Icons"),
58 N_("Switch view to an icon display"),
59 gnome_icon_view_cmd
, listing_iconic_xpm
),
60 GNOMEUIINFO_RADIOITEM (N_("Brief"),
61 N_("Switch view to show just file name and type"),
62 gnome_brief_view_cmd
, listing_brief_list_xpm
),
63 GNOMEUIINFO_RADIOITEM (N_("Detailed"),
64 N_("Switch view to show detailed file statistics"),
65 gnome_detailed_view_cmd
, listing_list_xpm
),
66 GNOMEUIINFO_RADIOITEM (N_("Custom"),
67 N_("Switch view to show user-defined statistics"),
68 gnome_custom_view_cmd
, listing_custom_xpm
),
72 GList
*containers
= 0;
75 int command_prompt
= 1;
76 int keybar_visible
= 1;
77 int message_visible
= 1;
78 int xterm_hintbar
= 0;
80 PanelContainer
*current_panel_ptr
, *other_panel_ptr
;
83 get_current_panel (void)
85 if (current_panel_ptr
)
86 return current_panel_ptr
->panel
;
92 get_other_panel (void)
95 return other_panel_ptr
->panel
;
100 /* FIXME: we probably want to get rid of this code */
102 get_current_index (void)
107 for (i
= 0, p
= containers
; p
; p
= p
->next
, i
++){
108 if (p
->data
== current_panel_ptr
)
111 printf ("FATAL: current panel is not in the list\n");
112 g_assert_not_reached ();
113 return -1; /* keep -Wall happy */
117 get_other_index (void)
122 for (i
= 0, p
= containers
; p
; p
= p
->next
, i
++){
123 if (p
->data
== other_panel_ptr
)
126 return UNDEFINED_INDEX
;
130 set_current_panel (WPanel
*panel
)
134 if (g_list_length (containers
) > 1)
135 other_panel_ptr
= current_panel_ptr
;
137 for (p
= containers
; p
; p
= p
->next
){
138 if (((PanelContainer
*)p
->data
)->panel
== panel
){
139 current_panel_ptr
= p
->data
;
146 * Tries to assign other_panel (ie, if there is anything to assign to
153 other_panel_ptr
= NULL
;
154 for (p
= containers
; p
; p
= p
->next
)
155 if (p
->data
!= current_panel_ptr
){
156 other_panel_ptr
= p
->data
;
162 * This keeps track of the current_panel_ptr and other_panel_ptr as
163 * well as the list of active containers
166 layout_panel_gone (WPanel
*panel
)
168 PanelContainer
*pc_holder
= 0;
169 int len
= g_list_length (containers
);
172 for (p
= containers
; p
; p
= p
->next
){
173 PanelContainer
*pc
= p
->data
;
175 if (pc
->panel
== panel
){
182 containers
= g_list_remove (containers
, pc_holder
);
185 /* Check if this is not the current panel */
186 if (current_panel_ptr
->panel
== panel
){
187 if (other_panel_ptr
){
188 current_panel_ptr
= other_panel_ptr
;
191 current_panel_ptr
= NULL
;
193 } else if (other_panel_ptr
->panel
== panel
){
194 /* Check if it was the other panel */
203 g_free (containers
->data
);
204 g_list_free (containers
);
211 set_hintbar (char *str
)
213 /*gtk_label_set (GTK_LABEL (current_panel_ptr->panel->status), str);*/
214 /* x_flush_events (); */
218 print_vfs_message (char *msg
, ...)
224 vsprintf(str
, msg
, ap
);
226 if (midnight_shutdown
)
238 get_current_type (void)
245 get_other_type (void)
247 return other_panel_ptr
? view_listing
: view_nothing
;
251 get_display_type (int index
)
255 if (index
== UNDEFINED_INDEX
)
258 p
= g_list_nth (containers
, index
);
260 return ((PanelContainer
*)p
->data
)->panel
->list_type
;
266 use_dash (int ignore
)
268 /* we dont care in the gnome edition */
272 get_panel_widget (int index
)
276 for (p
= containers
; index
; p
= p
->next
)
278 return (Widget
*) ((PanelContainer
*)p
->data
)->panel
;
281 /* FIXME: This routine is wrong. It should follow what the original save_panel_types
282 * does. I can not remember which problem the original routine was trying to address
283 * when I did the "New {Left|Rigth} Panel" sections.
286 save_panel_types (void)
290 for (p
= containers
; p
; p
= p
->next
){
291 PanelContainer
*pc
= p
->data
;
293 if (!is_a_desktop_panel (pc
->panel
))
294 panel_save_setup (pc
->panel
, pc
->panel
->panel_name
);
302 cmd
= input_dialog (_("Enter command to run"), _("Enter command to run"), "");
304 my_system (EXECUTE_AS_SHELL
, shell
, cmd
);
314 w
= gnome_message_box_new (
315 _("Notice that if you choose to terminate the file manager, you will\n"
316 "also terminate the GNOME desktop handler.\n\n"
317 "Are you sure you want to exit?"),
318 GNOME_MESSAGE_BOX_WARNING
,
319 GNOME_STOCK_BUTTON_YES
,
320 GNOME_STOCK_BUTTON_NO
,
322 v
= gnome_dialog_run (GNOME_DIALOG (w
));
326 w
= gnome_message_box_new (
327 _("The file manager and the desktop handler are now terminating\n\n"
328 "If you want to start up again the desktop handler or the file manager\n"
329 "you can launch it from the Panel, or you can run the UNIX command `gmc'\n\n"
330 "Press OK to terminate the application, or cancel to continue using it."),
331 GNOME_MESSAGE_BOX_INFO
,
332 GNOME_STOCK_BUTTON_OK
,
333 GNOME_STOCK_BUTTON_CANCEL
,
335 v
= gnome_dialog_run (GNOME_DIALOG (w
));
338 * We do not want to be restarted by the session manager now
340 session_set_restart (FALSE
);
346 do_rescan_desktop (void)
348 desktop_reload_icons (FALSE
, 0, 0);
352 gnome_launch_mime_editor (void)
354 my_system (EXECUTE_AS_SHELL
, shell
, "mime-type-capplet");
357 void configure_box (void);
359 GtkCheckMenuItem
*gnome_toggle_snap (void);
361 static GnomeUIInfo gnome_panel_new_menu
[] = {
362 GNOMEUIINFO_ITEM_NONE(N_("_Terminal"),
363 N_("Launch a new terminal in the current directory"), gnome_open_terminal
),
364 /* If this ever changes, make sure you update create_new_menu accordingly. */
365 GNOMEUIINFO_ITEM_NONE(N_("_Directory..."),
366 N_("Creates a new directory"), gnome_mkdir_cmd
),
367 GNOMEUIINFO_ITEM_NONE(N_("_File..."),
368 N_("Creates a new file in this directory"), gnome_newfile_cmd
),
373 GnomeUIInfo gnome_panel_file_menu
[] = {
374 GNOMEUIINFO_MENU_NEW_WINDOW_ITEM(gnome_open_panel
, NULL
),
375 /*GNOMEUIINFO_MENU_NEW_ITEM(N_("New _Window"), N_("Opens a new window"), gnome_open_panel, NULL),*/
377 /* We want to make a new menu entry here... */
382 /* Gnumeric Spreadsheet */
385 GNOMEUIINFO_MENU_NEW_SUBTREE(gnome_panel_new_menu
),
386 GNOMEUIINFO_SEPARATOR
,
387 GNOMEUIINFO_MENU_OPEN_ITEM(gnome_open_files
, NULL
),
388 /* GNOMEUIINFO_ITEM_NONE(N_("Open _FTP site"), N_("Opens an FTP site"), ftplink_cmd },*/
389 GNOMEUIINFO_ITEM_STOCK(N_("_Copy..."), N_("Copy files"), copy_cmd
, GNOME_STOCK_PIXMAP_COPY
),
390 GNOMEUIINFO_ITEM_STOCK(N_("_Delete..."), N_("Delete files"), delete_cmd
, GNOME_STOCK_PIXMAP_TRASH
),
391 GNOMEUIINFO_ITEM_NONE(N_("_Move..."), N_("Rename or move files"), ren_cmd
),
392 GNOMEUIINFO_SEPARATOR
,
393 GNOMEUIINFO_ITEM_NONE(N_("Show directory sizes"), N_("Shows the disk space used by each directory"), dirsizes_cmd
),
394 GNOMEUIINFO_SEPARATOR
,
395 { GNOME_APP_UI_ITEM
, N_("Close window"), N_("Closes this window"),
396 gnome_close_panel
, NULL
, NULL
, GNOME_APP_PIXMAP_STOCK
, GNOME_STOCK_PIXMAP_CLOSE
,
397 'w', GDK_CONTROL_MASK
, NULL
},
401 GnomeUIInfo gnome_panel_edit_menu
[] = {
402 { GNOME_APP_UI_ITEM
, N_("Select _All"), N_("Select all files in the current Panel"), gnome_select_all_cmd
,
403 NULL
, NULL
, 0, NULL
, 'a', GDK_CONTROL_MASK
},
404 GNOMEUIINFO_ITEM_NONE(N_("_Select Files..."), N_("Select a group of files"), gnome_select
),
405 GNOMEUIINFO_ITEM_NONE(N_("_Invert Selection"), N_("Reverses the list of tagged files"),
406 gnome_reverse_selection_cmd_panel
),
407 GNOMEUIINFO_SEPARATOR
,
408 { GNOME_APP_UI_ITEM
, N_("Search"), N_("Search for a file in the current Panel"), gnome_start_search
,
409 NULL
, NULL
, 0, NULL
, 's', GDK_CONTROL_MASK
},
410 GNOMEUIINFO_SEPARATOR
,
411 GNOMEUIINFO_ITEM_NONE(N_("_Rescan Directory"), N_("Rescan the directory contents"), reread_cmd
),
415 GnomeUIInfo gnome_panel_settings_menu
[] = {
416 GNOMEUIINFO_MENU_PREFERENCES_ITEM(gnome_configure_box
, NULL
),
420 GnomeUIInfo gnome_panel_layout_menu
[] = {
421 GNOMEUIINFO_ITEM_NONE(N_("_Sort By..."), N_("Confirmation settings"), gnome_sort_cmd
),
422 GNOMEUIINFO_ITEM_NONE(N_("_Filter View..."), N_("Global option settings"), gnome_filter_cmd
),
423 GNOMEUIINFO_SEPARATOR
,
424 GNOMEUIINFO_RADIOLIST(panel_view_menu_uiinfo
),
428 GnomeUIInfo gnome_panel_commands_menu
[] = {
429 GNOMEUIINFO_ITEM_STOCK(N_("_Find File..."), N_("Locate files on disk"), find_cmd
, GNOME_STOCK_MENU_JUMP_TO
),
431 /* { GNOME_APP_UI_ITEM, N_("_Compare panels..."), N_("Compare two panel contents"), gnome_compare_panels },*/
432 GNOMEUIINFO_ITEM_NONE(N_("_Edit mime types..."), N_("Edits the MIME type bindings"),
433 gnome_launch_mime_editor
),
434 { GNOME_APP_UI_ITEM
, N_("_Run Command..."), N_("Runs a command"), run_cmd
, NULL
,
435 NULL
, GNOME_APP_PIXMAP_STOCK
, GNOME_STOCK_MENU_OPEN
, GDK_F2
, 0 },
436 GNOMEUIINFO_ITEM_NONE(N_("_Run Command in panel..."),N_("Run a command and put the results in a panel"), gnome_external_panelize
),
439 /* GNOMEUIINFO_ITEM_NONE(N_("_Active VFS list..."),N_("List of active virtual file systems"), reselect_vfs), */
442 /*does this do anything?*/
443 /* GNOMEUIINFO_ITEM_NONE(N_("_Undelete files (ext2fs only)..."), N_("Recover deleted files"), undelete_cmd),*/
445 #ifdef WITH_BACKGROUND
446 GNOMEUIINFO_ITEM_NONE(N_("_Background jobs..."), N_("List of background operations"), jobs_cmd
),
448 GNOMEUIINFO_SEPARATOR
,
449 GNOMEUIINFO_ITEM_STOCK (N_("Exit"), N_("Terminates the file manager and the desktop"),
450 gnome_exit
, GNOME_STOCK_PIXMAP_QUIT
),
455 GnomeUIInfo gnome_panel_about_menu
[] = {
456 GNOMEUIINFO_MENU_ABOUT_ITEM(gnome_about_cmd
, NULL
),
457 GNOMEUIINFO_HELP ("gmc"),
461 GnomeUIInfo gnome_panel_desktop_menu
[] = {
462 GNOMEUIINFO_SUBTREE(N_("_Arrange Icons"), desktop_arrange_icons_items
),
463 GNOMEUIINFO_SEPARATOR
,
464 GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop Directory"), NULL
, do_rescan_desktop
),
465 GNOMEUIINFO_ITEM_NONE (N_("Rescan De_vices"), NULL
, desktop_rescan_devices
),
466 GNOMEUIINFO_ITEM_NONE (N_("Recreate Default _Icons"), NULL
, desktop_recreate_default_icons
),
470 GnomeUIInfo gnome_panel_menu_with_desktop
[] = {
471 GNOMEUIINFO_MENU_FILE_TREE(gnome_panel_file_menu
),
472 GNOMEUIINFO_MENU_EDIT_TREE(gnome_panel_edit_menu
),
473 GNOMEUIINFO_SUBTREE(N_("_Settings"),gnome_panel_settings_menu
),
474 GNOMEUIINFO_SUBTREE(N_("_Layout"),gnome_panel_layout_menu
),
475 GNOMEUIINFO_SUBTREE(N_("_Commands"),gnome_panel_commands_menu
),
476 GNOMEUIINFO_SUBTREE(N_("_Desktop"), gnome_panel_desktop_menu
),
477 GNOMEUIINFO_SUBTREE(N_("_Help"), gnome_panel_about_menu
),
481 GnomeUIInfo gnome_panel_menu_without_desktop
[] = {
482 GNOMEUIINFO_MENU_FILE_TREE(gnome_panel_file_menu
),
483 GNOMEUIINFO_MENU_EDIT_TREE(gnome_panel_edit_menu
),
484 GNOMEUIINFO_SUBTREE(N_("_Settings"),gnome_panel_settings_menu
),
485 GNOMEUIINFO_SUBTREE(N_("_Layout"),gnome_panel_layout_menu
),
486 GNOMEUIINFO_SUBTREE(N_("_Commands"),gnome_panel_commands_menu
),
487 GNOMEUIINFO_SUBTREE(N_("_Help"), gnome_panel_about_menu
),
492 gnome_toggle_snap (void)
494 return NULL
; /*GTK_CHECK_MENU_ITEM (gnome_panel_desktop_menu [1].widget);*/
498 gnome_init_panels (void)
500 current_panel_ptr
= NULL
;
501 other_panel_ptr
= NULL
;
505 gnome_close_panel_event (GtkWidget
*widget
, GdkEvent
*event
, WPanel
*panel
)
507 gnome_close_panel (widget
, panel
);
512 panel_enter_event (GtkWidget
*widget
, GdkEvent
*event
, WPanel
*panel
)
514 /* Avoid unnecessary code execution */
515 if (get_current_panel () == panel
)
518 set_current_panel (panel
);
519 dlg_select_widget (panel
->widget
.parent
, panel
);
520 send_message (panel
->widget
.parent
, (Widget
*) panel
, WIDGET_FOCUS
, 0);
524 destroy_gde (GtkWidget
*unused
, void *data
)
526 gnome_desktop_entry_free ((GnomeDesktopEntry
*) (data
));
530 create_new_menu_from (char *file
, GtkWidget
*shell
, gint pos
)
533 struct stat filedata
;
534 gboolean add_separator
= TRUE
;
535 struct dirent
*dirstruc
;
536 GnomeDesktopEntry
*gde
;
540 g_return_val_if_fail (shell
!= NULL
, pos
);
542 dir
= opendir (file
);
551 while ((dirstruc
= readdir (dir
)) != NULL
){
552 if (dirstruc
->d_name
[0] == '.')
555 file2
= g_concat_dir_and_file (file
, dirstruc
->d_name
);
557 if ((stat (file2
, &filedata
) != -1) && (S_ISREG (filedata
.st_mode
))){
560 const int desktoplen
= sizeof (".desktop") - 1;
562 len
= strlen (dirstruc
->d_name
);
563 if (strcmp (dirstruc
->d_name
+ len
- desktoplen
, ".desktop") != 0) {
568 gde
= gnome_desktop_entry_load (file2
);
574 path
= gnome_is_program_in_path (gde
->tryexec
);
577 gnome_desktop_entry_free (gde
);
583 menu
= gtk_menu_item_new ();
584 gtk_widget_show (menu
);
585 gtk_menu_shell_insert (GTK_MENU_SHELL (shell
), menu
, pos
++);
586 add_separator
= !add_separator
;
589 menu
= gtk_menu_item_new_with_label (gde
->name
);
590 gtk_widget_show (menu
);
591 gtk_menu_shell_insert (GTK_MENU_SHELL (shell
), menu
, pos
++);
593 /* This is really bad, but it works. */
594 /* FIXME: it doesn't work if we free the gde below. --
595 * need to do this right sometime -jrb
598 gtk_object_set_data (GTK_OBJECT (menu
),
599 "apphelper_statusbar_hint",
601 gtk_signal_connect (GTK_OBJECT (menu
), "activate",
602 GTK_SIGNAL_FUNC (gnome_run_new
),
604 gtk_signal_connect (GTK_OBJECT (menu
), "destroy",
605 GTK_SIGNAL_FUNC (destroy_gde
),
618 * Creates the child New menu items
621 create_new_menu (GnomeApp
*app
, WPanel
*panel
)
627 shell
= gnome_app_find_menu_pos (app
->menubar
, _("File/New/Directory..."), &pos
);
629 file
= gnome_unconditional_datadir_file ("mc/templates");
630 pos
= create_new_menu_from (file
, shell
, pos
);
632 file2
= gnome_datadir_file ("mc/templates");
634 if (strcmp (file
, file2
) != 0)
635 create_new_menu_from (file2
, shell
, pos
);
643 * This routine is a menu relay.
645 * This is called before the actual command specified in the GnomeUIInfo
646 * structure. This allows me to select the panel (ie, set the global cpanel
647 * variable to which this menu is bound).
649 * This is important, as we can have a menu tearoffed. And the current hack
650 * of setting cpanel on the focus-in event wont work.
654 panel_menu_relay (GtkObject
*object
, WPanel
*panel
)
656 void (*real_func
)(GtkObject
*object
, WPanel
*panel
);
658 real_func
= gtk_object_get_user_data (object
);
659 set_current_panel (panel
);
660 (*real_func
)(object
, panel
);
664 my_menu_signal_connect (GnomeUIInfo
*uiinfo
, gchar
*signal_name
,
665 GnomeUIBuilderData
*uibdata
)
667 gtk_object_set_user_data (GTK_OBJECT (uiinfo
->widget
), uiinfo
->moreinfo
);
668 gtk_signal_connect (GTK_OBJECT (uiinfo
->widget
),
669 signal_name
, panel_menu_relay
, uibdata
->data
?
670 uibdata
->data
: uiinfo
->user_data
);
674 my_app_create_menus (GnomeApp
*app
, GnomeUIInfo
*uiinfo
, void *data
)
676 GnomeUIBuilderData uibdata
;
678 g_return_if_fail (app
!= NULL
);
679 g_return_if_fail (GNOME_IS_APP (app
));
680 g_return_if_fail (uiinfo
!= NULL
);
682 uibdata
.connect_func
= my_menu_signal_connect
;
684 uibdata
.is_interp
= FALSE
;
685 uibdata
.relay_func
= NULL
;
686 uibdata
.destroy_func
= NULL
;
688 gnome_app_create_menus_custom (app
, uiinfo
, &uibdata
);
692 * copy_uiinfo_widgets:
693 * @uiinfo: A GnomeUIInfo array
695 * Allocates an array of widgets and copies the widgets from the uiinfo array to
696 * it. The array will be NULL-terminated.
698 * Returns: The allocated array of widgets.
701 copy_uiinfo_widgets (GnomeUIInfo
*uiinfo
)
707 g_return_val_if_fail (uiinfo
!= NULL
, NULL
);
709 /* Count number of items */
711 for (n
= 0; uiinfo
[n
].type
!= GNOME_APP_UI_ENDOFINFO
; n
++);
713 /* Copy the widgets */
715 dest
= g_new (gpointer
, n
+ 1);
717 for (i
= 0; i
< n
; i
++)
718 dest
[i
] = uiinfo
[i
].widget
;
726 create_container (Dlg_head
*h
, const char *name
, const char *geometry
)
728 PanelContainer
*container
;
730 GtkWidget
*app
, *vbox
;
731 int xpos
, ypos
, width
, height
;
735 container
= g_new (PanelContainer
, 1);
737 gnome_parse_geometry (geometry
, &xpos
, &ypos
, &width
, &height
);
739 container
->splitted
= 0;
740 app
= gnome_app_new ("gmc", name
);
742 /* Geometry configuration */
743 if (width
!= -1 && height
!= -1)
744 gtk_window_set_default_size (GTK_WINDOW (app
), width
, height
);
746 gtk_window_set_default_size (GTK_WINDOW (app
), 540, 360);
748 if (xpos
!= -1 && ypos
!= -1)
749 gtk_widget_set_uposition (GTK_WIDGET (app
), xpos
, ypos
);
751 panel
= panel_new (name
);
753 /* Set the unique name for session management */
755 sprintf (buf
, "%d", panel
->id
);
756 gtk_window_set_wmclass (GTK_WINDOW (app
), "gmc", buf
);
758 /* Create the holder for the contents */
760 vbox
= gtk_vbox_new (FALSE
, 0);
761 gtk_container_set_border_width (GTK_CONTAINER (vbox
), 0);
762 gnome_app_set_contents (GNOME_APP (app
), vbox
);
764 if (desktop_wm_is_gnome_compliant
== 1)
765 uiinfo
= gnome_panel_menu_without_desktop
;
767 uiinfo
= gnome_panel_menu_with_desktop
;
769 my_app_create_menus (GNOME_APP (app
), uiinfo
, panel
);
770 panel
->view_menu_items
= copy_uiinfo_widgets (panel_view_menu_uiinfo
);
772 create_new_menu (GNOME_APP (app
), panel
);
774 panel
->ministatus
= GNOME_APPBAR(gnome_appbar_new(FALSE
, TRUE
, GNOME_PREFERENCES_NEVER
));
775 gnome_app_set_statusbar(GNOME_APP (app
), GTK_WIDGET(panel
->ministatus
));
777 if (desktop_wm_is_gnome_compliant
)
778 gnome_app_install_menu_hints (GNOME_APP (app
), gnome_panel_menu_without_desktop
);
780 gnome_app_install_menu_hints (GNOME_APP (app
), gnome_panel_menu_with_desktop
);
782 gtk_signal_connect (GTK_OBJECT (app
),
783 "enter_notify_event",
784 GTK_SIGNAL_FUNC (panel_enter_event
),
786 gtk_signal_connect (GTK_OBJECT (app
),
788 GTK_SIGNAL_FUNC (gnome_close_panel_event
),
790 /* Ultra nasty hack follows:
791 * I am setting the panel->widget.wdata value here before the
792 * panel X stuff gets created in the INIT message section of the
793 * widget. There I put a pointer to the vbox where the panel
796 panel
->widget
.wdata
= (widget_data
) vbox
;
797 container
->panel
= panel
;
799 containers
= g_list_append (containers
, container
);
801 if (!current_panel_ptr
){
802 current_panel_ptr
= container
;
803 } else if (!other_panel_ptr
)
804 other_panel_ptr
= container
;
806 bind_gtk_keys (GTK_WIDGET (app
), h
);
811 new_panel_with_geometry_at (const char *dir
, const char *geometry
)
815 mc_chdir ((char *) dir
);
816 panel
= create_container (desktop_dlg
, dir
, geometry
);
817 set_current_panel (panel
);
818 add_widget (desktop_dlg
, panel
);
827 new_panel_at (const char *dir
)
829 return new_panel_with_geometry_at (dir
, NULL
);
839 * GNOME's implementation of the update_panels routine
842 update_panels (int force_update
, char *current_file
)
844 int reload_others
= !(force_update
& UP_ONLY_CURRENT
);
847 /* Test if there are panels open */
851 if (!is_a_desktop_panel (cpanel
))
852 update_one_panel_widget (cpanel
, force_update
, current_file
);
855 for (p
= containers
; p
; p
= p
->next
){
856 PanelContainer
*pc
= p
->data
;
858 if (p
->data
== current_panel_ptr
)
861 if (!is_a_desktop_panel (pc
->panel
))
862 update_one_panel_widget (pc
->panel
, force_update
, UP_KEEPSEL
);
865 mc_chdir (cpanel
->cwd
);