From c7a8f4846e42d233b9a661f7efdbdccab60f9e67 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 5 Apr 1999 05:39:26 +0000 Subject: [PATCH] 1999-04-04 Federico Mena Quintero * gscreen.c (file_list_popup_items): Use "New Directory", not "New Folder", to be consistent with the desktop and File menus. Thanks to Kevin Fox for pointing this out. (panel_icon_list_drag_data_received): Update the panels properly. (panel_clist_drag_data_received): Likewise. (panel_tree_drag_data_received): Likewise. * gcmd.c (gnome_close_panel): Doh. Do not access g_free()d memory. * glayout.c (copy_uiinfo_widgets): Return the copied array as a return value, not in an argument. * gcmd.c (set_view_type): Added a sanity check. --- gnome/ChangeLog | 17 +++++++++++++++++ gnome/gcmd.c | 12 ++++++------ gnome/glayout.c | 25 ++++++++++++++----------- gnome/gscreen.c | 22 ++++++++++++++-------- gnome/gscreen.h | 2 +- 5 files changed, 52 insertions(+), 26 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index e3a9017f6..4bcb44701 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,20 @@ +1999-04-04 Federico Mena Quintero + + * gscreen.c (file_list_popup_items): Use "New Directory", not "New + Folder", to be consistent with the desktop and File menus. Thanks + to Kevin Fox for pointing this out. + (panel_icon_list_drag_data_received): Update the panels properly. + (panel_clist_drag_data_received): Likewise. + (panel_tree_drag_data_received): Likewise. + + * gcmd.c (gnome_close_panel): Doh. Do not access g_free()d + memory. + + * glayout.c (copy_uiinfo_widgets): Return the copied array as a + return value, not in an argument. + + * gcmd.c (set_view_type): Added a sanity check. + 1999-04-01 Federico Mena Quintero * gtkdtree.c (scan_subtree): Moved the functionality to scan a diff --git a/gnome/gcmd.c b/gnome/gcmd.c index 038344b29..005b49671 100644 --- a/gnome/gcmd.c +++ b/gnome/gcmd.c @@ -163,16 +163,16 @@ gnome_close_panel (GtkWidget *widget, WPanel *panel) remove_widget (h, panel->filter_w); remove_widget (h, panel); - /* Kill them */ + /* Free our own internal stuff */ + g_free (panel->view_menu_items); + g_free (panel->view_toolbar_items); + + /* Kill the widgets */ destroy_widget (panel->current_dir); destroy_widget (panel->filter_w); destroy_widget ((Widget *)panel); layout_panel_gone (panel); - - g_free (panel->view_menu_items); - g_free (panel->view_toolbar_items); - mc_chdir ("/"); } @@ -209,7 +209,7 @@ set_view_type (GtkWidget *widget, WPanel *panel, enum list_types type) /* Synchronize the widgets */ - for (i = 0; ; i++) + for (i = 0; panel->view_menu_items[i] && panel->view_toolbar_items[i]; i++) if (widget == panel->view_menu_items[i]) { gtk_signal_handler_block_by_data ( GTK_OBJECT (panel->view_toolbar_items[i]), panel); diff --git a/gnome/glayout.c b/gnome/glayout.c index 09f30bef3..c37664df2 100644 --- a/gnome/glayout.c +++ b/gnome/glayout.c @@ -133,7 +133,7 @@ set_current_panel (WPanel *panel) 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; @@ -675,19 +675,20 @@ my_app_create_menus (GnomeApp *app, GnomeUIInfo *uiinfo, void *data) /** * copy_uiinfo_widgets: * @uiinfo: A GnomeUIInfo array - * @dest: The destination array will be placed here * * Allocates an array of widgets and copies the widgets from the uiinfo array to * it. The array will be NULL-terminated. + * + * Returns: The allocated array of widgets. **/ -void -copy_uiinfo_widgets (GnomeUIInfo *uiinfo, gpointer **dest) +gpointer * +copy_uiinfo_widgets (GnomeUIInfo *uiinfo) { + gpointer *dest; int n; int i; - g_return_if_fail (uiinfo != NULL); - g_return_if_fail (dest != NULL); + g_return_val_if_fail (uiinfo != NULL, NULL); /* Count number of items */ @@ -695,12 +696,14 @@ copy_uiinfo_widgets (GnomeUIInfo *uiinfo, gpointer **dest) /* Copy the widgets */ - *dest = g_new (gpointer, n + 1); + dest = g_new (gpointer, n + 1); for (i = 0; i < n; i++) - (*dest)[i] = uiinfo[i].widget; + dest[i] = uiinfo[i].widget; - (*dest)[i] = NULL; + dest[i] = NULL; + + return dest; } WPanel * @@ -747,7 +750,7 @@ create_container (Dlg_head *h, char *name, char *geometry) uiinfo = gnome_panel_menu_with_desktop; my_app_create_menus (GNOME_APP (app), uiinfo, panel); - copy_uiinfo_widgets (panel_view_menu_uiinfo, &panel->view_menu_items); + panel->view_menu_items = copy_uiinfo_widgets (panel_view_menu_uiinfo); create_new_menu (GNOME_APP (app), panel); @@ -794,8 +797,8 @@ new_panel_with_geometry_at (char *dir, char *geometry) mc_chdir (dir); panel = create_container (desktop_dlg, dir, geometry); - add_widget (desktop_dlg, panel); set_current_panel (panel); + add_widget (desktop_dlg, panel); #if 0 x_flush_events (); #endif diff --git a/gnome/gscreen.c b/gnome/gscreen.c index 3c81f662d..41fce677d 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -828,8 +828,8 @@ panel_icon_list_drag_data_received (GtkWidget *widget, file_entry_free (fe); if (reload) { - update_one_panel_widget (panel, 0, UP_KEEPSEL); - panel_update_contents (panel); + update_panels (UP_OPTIMIZE, UP_KEEPSEL); + repaint_screen (); } } @@ -889,8 +889,8 @@ panel_clist_drag_data_received (GtkWidget *widget, file_entry_free (fe); if (reload) { - update_one_panel_widget (panel, 0, UP_KEEPSEL); - panel_update_contents (panel); + update_panels (UP_OPTIMIZE, UP_KEEPSEL); + repaint_screen (); } } @@ -914,6 +914,7 @@ panel_tree_drag_data_received (GtkWidget *widget, int row, col; file_entry *fe; char *path; + int reload; if (!gtk_clist_get_selection_info (GTK_CLIST (dtree), x, y, &row, &col)) return; @@ -928,10 +929,15 @@ panel_tree_drag_data_received (GtkWidget *widget, if (!fe) return; /* eeeek */ - gdnd_perform_drop (context, selection_data, path, fe); + reload = gdnd_perform_drop (context, selection_data, path, fe); file_entry_free (fe); g_free (path); + + if (reload) { + update_panels (UP_OPTIMIZE, UP_KEEPSEL); + repaint_screen (); + } } static void @@ -1469,9 +1475,9 @@ handle_rescan_directory (GtkWidget *widget, gpointer data) /* The popup menu for file panels */ static GnomeUIInfo file_list_popup_items[] = { - GNOMEUIINFO_ITEM_NONE (N_("Rescan Directory"), N_("Reloads the current directory"), + GNOMEUIINFO_ITEM_NONE (N_("_Rescan Directory"), N_("Reloads the current directory"), handle_rescan_directory), - GNOMEUIINFO_ITEM_NONE (N_("New folder"), N_("Creates a new folder here"), + GNOMEUIINFO_ITEM_NONE (N_("New _Directory..."), N_("Creates a new directory here"), gnome_mkdir_cmd), GNOMEUIINFO_END }; @@ -2473,7 +2479,7 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) GNOME_DOCK_ITEM_BEH_EXCLUSIVE, GNOME_DOCK_TOP, 2, 0, 0); - copy_uiinfo_widgets (panel_view_toolbar_uiinfo, &panel->view_toolbar_items); + panel->view_toolbar_items = copy_uiinfo_widgets (panel_view_toolbar_uiinfo); panel->back_b = toolbar[0].widget; panel->up_b = toolbar[1].widget; diff --git a/gnome/gscreen.h b/gnome/gscreen.h index 94cfbeb86..bf4c7ad97 100644 --- a/gnome/gscreen.h +++ b/gnome/gscreen.h @@ -8,7 +8,7 @@ extern GnomeUIInfo panel_view_toolbar_uiinfo[]; WPanel *create_container (Dlg_head *h, char *str, char *geometry); -void copy_uiinfo_widgets (GnomeUIInfo *uiinfo, gpointer **dest); +gpointer *copy_uiinfo_widgets (GnomeUIInfo *uiinfo); typedef struct { int splitted;