diff options
author | Darin Adler <darin@src.gnome.org> | 2001-05-11 01:30:33 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-05-11 01:30:33 +0000 |
commit | 0067b899564049b086a978192c262dd84dc2085a (patch) | |
tree | fbf198b4d3e40f8c0b6abf898c5fb12a189d5881 | |
parent | 423ddfd45ed85a05979979bd14ae67c2703107ee (diff) | |
download | nautilus-0067b899564049b086a978192c262dd84dc2085a.tar.gz |
Changed code that uses g_list_append to use g_list_prepend in all the
* components/help/hyperbola-filefmt.c:
(prepend_help_dir_if_exists), (fmt_help_populate_tree):
* components/mozilla/nautilus-mozilla-content-view.c:
(mozilla_view_create_charset_encoding_submenu),
(mozilla_new_window_callback),
(should_uri_navigate_bypass_nautilus),
(should_mozilla_load_uri_directly):
* components/music/fileinfo.c: (mpg123_file_info_box):
* components/music/nautilus-music-view.c:
(nautilus_music_view_update):
* components/notes/nautilus-notes.c: (notes_load_metainfo):
* components/throbber/nautilus-throbber.c:
(nautilus_throbber_load_images):
* components/tree/nautilus-tree-node.c:
(nautilus_tree_node_set_parent):
* libnautilus-private/nautilus-directory-background.c:
(nautilus_connect_background_to_file_metadata):
* libnautilus-private/nautilus-directory.c:
(nautilus_self_check_directory):
* libnautilus-private/nautilus-file-changes-queue.c:
(nautilus_file_changes_consume_changes):
* libnautilus-private/nautilus-file-dnd.c:
(nautilus_drag_file_receive_dropped_keyword):
* libnautilus-private/nautilus-file-operations.c:
(handle_transfer_ok), (nautilus_file_operations_new_folder):
* libnautilus-private/nautilus-file.c: (nautilus_self_check_file):
* libnautilus-private/nautilus-icon-container.c:
(lay_down_icons_tblr):
* libnautilus-private/nautilus-mime-actions.c:
(nautilus_do_component_query):
* libnautilus-private/nautilus-search-uri.c: (tokenize_uri):
* libnautilus-private/nautilus-theme.c: (theme_list_prepend),
(theme_get_themes_for_location), (theme_get_default_themes),
(nautilus_theme_remove_user_theme):
* libnautilus-private/nautilus-thumbnails.c:
(nautilus_get_thumbnail_uri):
* libnautilus-private/nautilus-trash-monitor.c:
(nautilus_trash_monitor_initialize), (add_one_volume_trash):
* libnautilus-private/nautilus-volume-monitor.c:
(get_removable_volumes), (build_volume_list_delta),
(get_mount_list), (get_current_mount_list),
(mount_volume_prepend_filesystem):
* src/file-manager/fm-directory-view.c: (prepend_uri_one),
(fm_directory_view_create_links_for_files),
(fm_directory_view_duplicate_selection):
* src/file-manager/fm-properties-window.c:
(property_button_toggled):
* src/nautilus-window-manage-views.c:
(determined_initial_view_callback):
Changed code that uses g_list_append to use g_list_prepend in all
the cases where it was simple enough.
24 files changed, 190 insertions, 141 deletions
@@ -1,5 +1,59 @@ 2001-05-10 Darin Adler <darin@eazel.com> + * components/help/hyperbola-filefmt.c: + (prepend_help_dir_if_exists), (fmt_help_populate_tree): + * components/mozilla/nautilus-mozilla-content-view.c: + (mozilla_view_create_charset_encoding_submenu), + (mozilla_new_window_callback), + (should_uri_navigate_bypass_nautilus), + (should_mozilla_load_uri_directly): + * components/music/fileinfo.c: (mpg123_file_info_box): + * components/music/nautilus-music-view.c: + (nautilus_music_view_update): + * components/notes/nautilus-notes.c: (notes_load_metainfo): + * components/throbber/nautilus-throbber.c: + (nautilus_throbber_load_images): + * components/tree/nautilus-tree-node.c: + (nautilus_tree_node_set_parent): + * libnautilus-private/nautilus-directory-background.c: + (nautilus_connect_background_to_file_metadata): + * libnautilus-private/nautilus-directory.c: + (nautilus_self_check_directory): + * libnautilus-private/nautilus-file-changes-queue.c: + (nautilus_file_changes_consume_changes): + * libnautilus-private/nautilus-file-dnd.c: + (nautilus_drag_file_receive_dropped_keyword): + * libnautilus-private/nautilus-file-operations.c: + (handle_transfer_ok), (nautilus_file_operations_new_folder): + * libnautilus-private/nautilus-file.c: (nautilus_self_check_file): + * libnautilus-private/nautilus-icon-container.c: + (lay_down_icons_tblr): + * libnautilus-private/nautilus-mime-actions.c: + (nautilus_do_component_query): + * libnautilus-private/nautilus-search-uri.c: (tokenize_uri): + * libnautilus-private/nautilus-theme.c: (theme_list_prepend), + (theme_get_themes_for_location), (theme_get_default_themes), + (nautilus_theme_remove_user_theme): + * libnautilus-private/nautilus-thumbnails.c: + (nautilus_get_thumbnail_uri): + * libnautilus-private/nautilus-trash-monitor.c: + (nautilus_trash_monitor_initialize), (add_one_volume_trash): + * libnautilus-private/nautilus-volume-monitor.c: + (get_removable_volumes), (build_volume_list_delta), + (get_mount_list), (get_current_mount_list), + (mount_volume_prepend_filesystem): + * src/file-manager/fm-directory-view.c: (prepend_uri_one), + (fm_directory_view_create_links_for_files), + (fm_directory_view_duplicate_selection): + * src/file-manager/fm-properties-window.c: + (property_button_toggled): + * src/nautilus-window-manage-views.c: + (determined_initial_view_callback): + Changed code that uses g_list_append to use g_list_prepend in all + the cases where it was simple enough. + +2001-05-10 Darin Adler <darin@eazel.com> + Integrated a patch from peter@ximian.com to move the MOZILLA_FIVE_HOME-setting code from the main Nautilus program (where it does no good) to the Mozilla component (which is a nicer diff --git a/components/help/hyperbola-filefmt.c b/components/help/hyperbola-filefmt.c index 6a0f92ee3..54ebbda8f 100644 --- a/components/help/hyperbola-filefmt.c +++ b/components/help/hyperbola-filefmt.c @@ -837,7 +837,7 @@ fmt_help_populate_tree_from_subdir (HyperbolaDocTree * tree, #ifndef ENABLE_SCROLLKEEPER_SUPPORT static GList * -append_help_dir_if_exists (GList *list, +prepend_help_dir_if_exists (GList *list, char *prefix) { char *help_dir; @@ -845,7 +845,7 @@ append_help_dir_if_exists (GList *list, help_dir = g_concat_dir_and_file (prefix, "share/gnome/help"); if (g_file_test (help_dir, G_FILE_TEST_ISDIR)) { - list = g_list_append (list, help_dir); + list = g_list_prepend (list, help_dir); } else { g_free (help_dir); } @@ -872,10 +872,10 @@ fmt_help_populate_tree (HyperbolaDocTree * tree) dirname = gnome_datadir_file ("gnome/help"); if (dirname != NULL) { - help_directories = g_list_append (help_directories, dirname); + help_directories = g_list_prepend (help_directories, dirname); } - help_directories = append_help_dir_if_exists (help_directories, PREFIX); + help_directories = prepend_help_dir_if_exists (help_directories, PREFIX); gnome_path = g_getenv ("GNOME_PATH"); @@ -883,12 +883,14 @@ fmt_help_populate_tree (HyperbolaDocTree * tree) pathdirs = g_strsplit (gnome_path, ":", INT_MAX); for (i = 0; pathdirs[i] != NULL; i++) { - help_directories = append_help_dir_if_exists (help_directories, + help_directories = prepend_help_dir_if_exists (help_directories, pathdirs[i]); } g_strfreev (pathdirs); } + help_directories = g_list_reverse (help_directories); + for (node = help_directories; node != NULL; node = node->next) { fmt_help_populate_tree_from_subdir (tree, node->data, app_path); } diff --git a/components/mozilla/nautilus-mozilla-content-view.c b/components/mozilla/nautilus-mozilla-content-view.c index 89c39b36d..d56873c4a 100644 --- a/components/mozilla/nautilus-mozilla-content-view.c +++ b/components/mozilla/nautilus-mozilla-content-view.c @@ -29,45 +29,42 @@ * widget to display and munge html. */ -#define nopeDEBUG_ramiro 1 -#define nopeDEBUG_mfleming 1 -#define nopeDEBUG_pepper 1 - -#ifdef DEBUG_mfleming -#define DEBUG_MSG(x) g_print x -#else -#define DEBUG_MSG(x) -#endif - #include <config.h> #include "nautilus-mozilla-content-view.h" +#include "bonobo-extensions.h" #include "gtkmozembed.h" - -#include "mozilla-preferences.h" #include "mozilla-components.h" #include "mozilla-events.h" +#include "mozilla-preferences.h" #include "nautilus-mozilla-embed-extensions.h" -#include "bonobo-extensions.h" - -#include <bonobo/bonobo-ui-util.h> #include <bonobo/bonobo-control.h> +#include <bonobo/bonobo-ui-util.h> +#include <eel/eel-glib-extensions.h> +#include <eel/eel-gtk-extensions.h> +#include <eel/eel-gtk-macros.h> +#include <eel/eel-stock-dialogs.h> #include <gtk/gtksignal.h> #include <libgnome/gnome-i18n.h> +#include <libgnomeui/gnome-dialog-util.h> +#include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-stock.h> #include <libgnomevfs/gnome-vfs.h> #include <stdlib.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> - -#include <eel/eel-stock-dialogs.h> -#include <eel/eel-gtk-macros.h> #ifdef HAVE_AMMONITE #include <libtrilobite/libammonite-gtk.h> #endif -#define NUM_ELEMENTS_IN_ARRAY(_a) (sizeof (_a) / sizeof ((_a)[0])) +#define nopeDEBUG_ramiro 1 +#define nopeDEBUG_mfleming 1 +#define nopeDEBUG_pepper 1 + +#ifdef DEBUG_mfleming +#define DEBUG_MSG(x) g_print x +#else +#define DEBUG_MSG(x) +#endif /* Code-copied from nsGUIEvent.h */ @@ -525,12 +522,13 @@ mozilla_view_create_charset_encoding_submenu (NautilusMozillaContentView *mozill /* Add new encodings to the list only once */ if (encoding_group != NULL) { if (!g_list_find_custom (groups, encoding_group, (GCompareFunc) strcoll)) { - groups = g_list_append (groups, encoding_group); + groups = g_list_prepend (groups, encoding_group); } } g_free (encoding_title); } + groups = g_list_reverse (groups); /* Create the encoding group submenus */ node = groups; @@ -757,32 +755,20 @@ mozilla_title_changed_callback (GtkMozEmbed *mozilla, gpointer user_data) DEBUG_MSG (("-%s\n", __FUNCTION__)); } -static GtkWindow * -mozilla_get_containing_window (GtkMozEmbed *mozilla) -{ - GtkWidget *window; - - window = gtk_widget_get_ancestor (GTK_WIDGET (mozilla), GTK_TYPE_WINDOW); - if (window == NULL) { - return NULL; - } - - return GTK_WINDOW (window); -} - static void mozilla_new_window_callback (GtkMozEmbed *mozilla) { - GnomeDialog *dialog; - -#ifdef DEBUG_pepper - g_warning ("Nautilus does not support JavaScript spawning of new windows!\n"); -#endif - - dialog = eel_show_warning_dialog (_("A JavaScript function (small software program) on this page tried to open a new window, but nautilus does not support the opening of new windows by JavaScript.\n\nTry viewing the page in a different web browser, such as Mozilla or Netscape."), - _("Nautilus Mozilla View Warning"), - mozilla_get_containing_window (mozilla)); - + static GnomeDialog *dialog; + + if (dialog == NULL) { + dialog = eel_show_warning_dialog (_("A JavaScript function (small software program) on this page " + "tried to open a new window, but Nautilus does not support the " + "opening new windows by JavaScript.\n\n" + "Try viewing the page in a different web browser, such as Mozilla."), + _("Nautilus JavaScript Warning"), + NULL); + eel_nullify_when_destroyed (&dialog); + } } static void @@ -1820,7 +1806,7 @@ should_uri_navigate_bypass_nautilus (const char *uri) g_return_val_if_fail (uri != NULL, FALSE); - return string_list_get_index_of_string (handled_by_nautilus, NUM_ELEMENTS_IN_ARRAY (handled_by_nautilus), + return string_list_get_index_of_string (handled_by_nautilus, EEL_N_ELEMENTS (handled_by_nautilus), uri) != STRING_LIST_NOT_FOUND; } @@ -1837,7 +1823,7 @@ should_mozilla_load_uri_directly (const char *uri) "eazel-services" }; - return string_list_get_index_of_string (handled_by_mozilla, NUM_ELEMENTS_IN_ARRAY (handled_by_mozilla), + return string_list_get_index_of_string (handled_by_mozilla, EEL_N_ELEMENTS (handled_by_mozilla), uri) != STRING_LIST_NOT_FOUND; } diff --git a/components/music/fileinfo.c b/components/music/fileinfo.c index 654467ba3..421331c99 100644 --- a/components/music/fileinfo.c +++ b/components/music/fileinfo.c @@ -292,8 +292,8 @@ void mpg123_file_info_box(char *filename) if (!genre_list) { for (i = 0; i < GENRE_MAX; i++) - genre_list = g_list_append(genre_list, (gchar *) mpg123_id3_genres[i]); - genre_list = g_list_append(genre_list, ""); + genre_list = g_list_prepend(genre_list, (gchar *) mpg123_id3_genres[i]); + genre_list = g_list_prepend(genre_list, ""); genre_list = g_list_sort(genre_list, genre_comp_func); } gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list); diff --git a/components/music/nautilus-music-view.c b/components/music/nautilus-music-view.c index e74119fb4..06c902d89 100644 --- a/components/music/nautilus-music-view.c +++ b/components/music/nautilus-music-view.c @@ -1720,7 +1720,7 @@ nautilus_music_view_update (NautilusMusicView *music_view) if (info) { info->path_uri = path_uri; file_index += 1; - song_list = g_list_append (song_list, info); + song_list = g_list_prepend (song_list, info); } else { /* it's not an mp3 file, so see if it's an image */ const char *mime_type = gnome_vfs_file_info_get_mime_type (current_file_info); @@ -1737,6 +1737,8 @@ nautilus_music_view_update (NautilusMusicView *music_view) } gnome_vfs_file_info_list_free (list); + + song_list = g_list_reverse (song_list); /* populate the clist */ gtk_clist_clear (GTK_CLIST (music_view->details->song_list)); diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c index aa9590e41..4bbedda80 100644 --- a/components/notes/nautilus-notes.c +++ b/components/notes/nautilus-notes.c @@ -214,7 +214,7 @@ notes_load_metainfo (Notes *notes) return; } - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); + attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); nautilus_file_monitor_add (notes->file, notes, attributes); if (nautilus_file_check_if_ready (notes->file, attributes)) { diff --git a/components/throbber/nautilus-throbber.c b/components/throbber/nautilus-throbber.c index 24132ac39..4580654d6 100644 --- a/components/throbber/nautilus-throbber.c +++ b/components/throbber/nautilus-throbber.c @@ -563,6 +563,7 @@ nautilus_throbber_load_images (NautilusThrobber *throbber) int index; char *throbber_frame_name, *image_theme, *frames; GdkPixbuf *pixbuf; + GList *image_list; nautilus_throbber_unload_images (throbber); @@ -578,9 +579,9 @@ nautilus_throbber_load_images (NautilusThrobber *throbber) } else { throbber->details->max_frame = 16; } - - index = 1; - while (index <= throbber->details->max_frame) { + + image_list = NULL; + for (index = 1; index <= throbber->details->max_frame; index++) { throbber_frame_name = make_throbber_frame_name (index); pixbuf = load_themed_image (throbber_frame_name, image_theme, throbber->details->small_mode); g_free (throbber_frame_name); @@ -588,9 +589,10 @@ nautilus_throbber_load_images (NautilusThrobber *throbber) throbber->details->max_frame = index - 1; break; } - throbber->details->image_list = g_list_append (throbber->details->image_list, pixbuf); - index += 1; - } + image_list = g_list_prepend (image_list, pixbuf); + } + throbber->details->image_list = g_list_reverse (image_list); + g_free (image_theme); } diff --git a/components/tree/nautilus-tree-node.c b/components/tree/nautilus-tree-node.c index 6f843262a..f2a3a5520 100644 --- a/components/tree/nautilus-tree-node.c +++ b/components/tree/nautilus-tree-node.c @@ -168,7 +168,7 @@ nautilus_tree_node_set_parent (NautilusTreeNode *node, g_return_if_fail (node->details->parent == NULL); node->details->parent = parent; - parent->details->children = g_list_append (parent->details->children, node); + parent->details->children = g_list_prepend (parent->details->children, node); } gboolean diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index 9a28b6fdf..980f5cf19 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -996,7 +996,7 @@ nautilus_connect_background_to_file_metadata (GtkWidget *widget, background); /* arrange to receive file metadata */ - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); + attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); nautilus_file_monitor_add (file, background, attributes); diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index a5ca85168..9d68a2d04 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -1541,7 +1541,7 @@ nautilus_self_check_directory (void) got_metadata_flag = FALSE; - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); + attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); nautilus_directory_call_when_ready (directory, attributes, got_metadata_callback, &data_dummy); g_list_free (attributes); @@ -1592,7 +1592,7 @@ nautilus_self_check_directory (void) directory = nautilus_directory_get ("file:///etc"); got_metadata_flag = FALSE; - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); + attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); nautilus_directory_call_when_ready (directory, attributes, got_metadata_callback, &data_dummy); g_list_free (attributes); diff --git a/libnautilus-private/nautilus-file-changes-queue.c b/libnautilus-private/nautilus-file-changes-queue.c index 6af48e1db..7fd5a9118 100644 --- a/libnautilus-private/nautilus-file-changes-queue.c +++ b/libnautilus-private/nautilus-file-changes-queue.c @@ -430,41 +430,49 @@ nautilus_file_changes_consume_changes (gboolean consume_all) */ if (deletions != NULL) { + deletions = g_list_reverse (deletions); nautilus_directory_notify_files_removed (deletions); eel_g_list_free_deep (deletions); deletions = NULL; } if (moves != NULL) { + moves = g_list_reverse (moves); nautilus_directory_notify_files_moved (moves); pairs_list_free (moves); moves = NULL; } if (additions != NULL) { + additions = g_list_reverse (additions); nautilus_directory_notify_files_added (additions); eel_g_list_free_deep (additions); additions = NULL; } if (changes != NULL) { + changes = g_list_reverse (changes); nautilus_directory_notify_files_changed (changes); eel_g_list_free_deep (changes); changes = NULL; } if (metadata_copy_requests != NULL) { + metadata_copy_requests = g_list_reverse (metadata_copy_requests); nautilus_directory_schedule_metadata_copy (metadata_copy_requests); pairs_list_free (metadata_copy_requests); metadata_copy_requests = NULL; } if (metadata_move_requests != NULL) { + metadata_move_requests = g_list_reverse (metadata_move_requests); nautilus_directory_schedule_metadata_move (metadata_move_requests); pairs_list_free (metadata_move_requests); metadata_move_requests = NULL; } if (metadata_remove_requests != NULL) { + metadata_remove_requests = g_list_reverse (metadata_remove_requests); nautilus_directory_schedule_metadata_remove (metadata_remove_requests); eel_g_list_free_deep (metadata_remove_requests); metadata_remove_requests = NULL; } if (position_set_requests != NULL) { + position_set_requests = g_list_reverse (position_set_requests); nautilus_directory_schedule_position_set (position_set_requests); position_set_list_free (position_set_requests); position_set_requests = NULL; @@ -479,40 +487,40 @@ nautilus_file_changes_consume_changes (gboolean consume_all) /* add the new change to the list */ switch (change->kind) { case CHANGE_FILE_ADDED: - additions = g_list_append (additions, change->from_uri); + additions = g_list_prepend (additions, change->from_uri); break; case CHANGE_FILE_CHANGED: - changes = g_list_append (changes, change->from_uri); + changes = g_list_prepend (changes, change->from_uri); break; case CHANGE_FILE_REMOVED: - deletions = g_list_append (deletions, change->from_uri); + deletions = g_list_prepend (deletions, change->from_uri); break; case CHANGE_FILE_MOVED: pair = g_new (URIPair, 1); pair->from_uri = change->from_uri; pair->to_uri = change->to_uri; - moves = g_list_append (moves, pair); + moves = g_list_prepend (moves, pair); break; case CHANGE_METADATA_COPIED: pair = g_new (URIPair, 1); pair->from_uri = change->from_uri; pair->to_uri = change->to_uri; - metadata_copy_requests = g_list_append (metadata_copy_requests, pair); + metadata_copy_requests = g_list_prepend (metadata_copy_requests, pair); break; case CHANGE_METADATA_MOVED: pair = g_new (URIPair, 1); pair->from_uri = change->from_uri; pair->to_uri = change->to_uri; - metadata_move_requests = g_list_append (metadata_move_requests, pair); + metadata_move_requests = g_list_prepend (metadata_move_requests, pair); break; case CHANGE_METADATA_REMOVED: - metadata_remove_requests = g_list_append (metadata_remove_requests, + metadata_remove_requests = g_list_prepend (metadata_remove_requests, change->from_uri); break; @@ -521,16 +529,16 @@ nautilus_file_changes_consume_changes (gboolean consume_all) position_set->uri = change->from_uri; position_set->set = TRUE; position_set->point = change->point; - position_set_requests = g_list_append (position_set_requests, - position_set); + position_set_requests = g_list_prepend (position_set_requests, + position_set); break; case CHANGE_POSITION_REMOVE: position_set = g_new (NautilusFileChangesQueuePosition, 1); position_set->uri = change->from_uri; position_set->set = FALSE; - position_set_requests = g_list_append (position_set_requests, - position_set); + position_set_requests = g_list_prepend (position_set_requests, + position_set); break; default: diff --git a/libnautilus-private/nautilus-file-dnd.c b/libnautilus-private/nautilus-file-dnd.c index b7c12af26..268b1cb3f 100644 --- a/libnautilus-private/nautilus-file-dnd.c +++ b/libnautilus-private/nautilus-file-dnd.c @@ -96,7 +96,7 @@ nautilus_drag_file_receive_dropped_keyword (NautilusFile *file, char *keyword) keywords = nautilus_file_get_keywords (file); word = g_list_find_custom (keywords, keyword, (GCompareFunc) strcmp); if (word == NULL) { - keywords = g_list_append (keywords, g_strdup (keyword)); + keywords = g_list_prepend (keywords, g_strdup (keyword)); } else { keywords = g_list_remove_link (keywords, word); g_free (word->data); diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 6c7b90c23..5722aaee9 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -453,12 +453,10 @@ handle_transfer_ok (const GnomeVFSXferProgressInfo *progress_info, * around and return. */ if (progress_info->bytes_total != progress_info->bytes_copied) { - GList *delete_me = NULL; - - delete_me = g_list_append (delete_me, progress_info->target_name); + GList *delete_me; + delete_me = g_list_prepend (NULL, progress_info->target_name); nautilus_file_operations_delete (delete_me, transfer_info->parent_view); - g_list_free (delete_me); } @@ -2118,7 +2116,7 @@ nautilus_file_operations_new_folder (GtkWidget *parent_view, parent_uri = gnome_vfs_uri_new (parent_dir); /* localizers: the initial name of a new folder */ uri = gnome_vfs_uri_append_file_name (parent_uri, _("untitled folder")); - target_uri_list = g_list_append (NULL, uri); + target_uri_list = g_list_prepend (NULL, uri); gnome_vfs_async_xfer (&state->handle, NULL, target_uri_list, GNOME_VFS_XFER_NEW_UNIQUE_DIRECTORY, diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index 134f0b597..dfdc26ab9 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -5122,8 +5122,8 @@ nautilus_self_check_file (void) file_2 = nautilus_file_get ("file:///usr"); list = NULL; - list = g_list_append (list, file_1); - list = g_list_append (list, file_2); + list = g_list_prepend (list, file_1); + list = g_list_prepend (list, file_2); nautilus_file_list_ref (list); diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index 630416049..e931bda21 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -1050,13 +1050,15 @@ lay_down_icons_tblr (NautilusIconContainer *container, GList *icons) for (p = container->details->icons; p != NULL; p = p->next) { icon = p->data; if (icon_is_positioned (icon)) { - placed_icons = g_list_append (placed_icons, icon); + placed_icons = g_list_prepend (placed_icons, icon); } else { icon->x = 0; icon->y = 0; - unplaced_icons = g_list_append (unplaced_icons, icon); + unplaced_icons = g_list_prepend (unplaced_icons, icon); } } + placed_icons = g_list_reverse (placed_icons); + unplaced_icons = g_list_reverse (unplaced_icons); /* Allocate grid array */ num_rows = width / CELL_SIZE; diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c index a75c51c72..2c14da236 100644 --- a/libnautilus-private/nautilus-mime-actions.c +++ b/libnautilus-private/nautilus-mime-actions.c @@ -1620,9 +1620,9 @@ nautilus_do_component_query (const char *mime_type, * view is a superset and it's confusing for the user to be presented with both */ if (server->iid != NULL && strcmp (server->iid, "OAFIID:Bonobo_Sample_Text") != 0) { - retval = g_list_append + retval = g_list_prepend (retval, - OAF_ServerInfo_duplicate (server)); + OAF_ServerInfo_duplicate (server)); } } } @@ -1632,7 +1632,7 @@ nautilus_do_component_query (const char *mime_type, CORBA_free (oaf_result); - return retval; + return g_list_reverse (retval); } diff --git a/libnautilus-private/nautilus-search-uri.c b/libnautilus-private/nautilus-search-uri.c index 8f452a685..f3c0872c8 100644 --- a/libnautilus-private/nautilus-search-uri.c +++ b/libnautilus-private/nautilus-search-uri.c @@ -115,20 +115,20 @@ tokenize_uri (const char *string) return NULL; } - criterion_list = NULL; - string = strip_uri_beginning (string); if (string == NULL) { return NULL; } /* make sure we can handle this uri */ - if ( strchr (string , '(') != NULL - || strchr (string, ')') != NULL - || strchr (string, '|') != NULL) { + if (strchr (string , '(') != NULL + || strchr (string, ')') != NULL + || strchr (string, '|') != NULL) { return NULL; } + criterion_list = NULL; + /* split the uri in different criteria */ criteria = g_strsplit (string, " & ", 0); for (i = 0, temp_string = criteria[0]; @@ -143,14 +143,14 @@ tokenize_uri (const char *string) tokens = g_strsplit (temp_string, " ", 2); for (j = 0, token = tokens[0]; token != NULL; j++, token = tokens[j]) { /* g_strstrip does not return a newly allocated string. */ - token_list = g_list_append (token_list, g_strdup (g_strstrip (token))); + token_list = g_list_prepend (token_list, g_strdup (g_strstrip (token))); } - criterion_list = g_list_append (criterion_list, token_list); + criterion_list = g_list_prepend (criterion_list, g_list_reverse (token_list)); g_strfreev (tokens); } g_strfreev (criteria); - return criterion_list; + return g_list_reverse (criterion_list); } typedef struct _value_criterion_item value_criterion_item; diff --git a/libnautilus-private/nautilus-theme.c b/libnautilus-private/nautilus-theme.c index c3aea05ef..16c3824fb 100644 --- a/libnautilus-private/nautilus-theme.c +++ b/libnautilus-private/nautilus-theme.c @@ -562,10 +562,10 @@ theme_get_description_property (const char *themes_location_uri, } static GList * -theme_list_insert (GList *theme_list, - const char *themes_location_uri, - const char *theme_name, - gboolean builtin) +theme_list_prepend (GList *theme_list, + const char *themes_location_uri, + const char *theme_name, + gboolean builtin) { ThemeAttibutes *attributes; GdkPixbuf *unscaled_preview_pixbuf; @@ -588,7 +588,7 @@ theme_list_insert (GList *theme_list, attributes->display_name = theme_get_name_property (themes_location_uri, theme_name); attributes->description = theme_get_description_property (themes_location_uri, theme_name); - return g_list_append (theme_list, attributes); + return g_list_prepend (theme_list, attributes); } static GList * @@ -622,15 +622,15 @@ theme_get_themes_for_location (const char *themes_location_uri, if ((file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) && (file_info->name[0] != '.')) { if (has_image_file (themes_location_uri, file_info->name, "i-directory" )) { - themes = theme_list_insert (themes, - themes_location_uri, - file_info->name, - builtin); + themes = theme_list_prepend (themes, + themes_location_uri, + file_info->name, + builtin); } } } - return themes; + return g_list_reverse (themes); } static GList * @@ -674,10 +674,9 @@ theme_get_default_themes (void) char *pixmap_directory_uri; GList *default_themes; - default_themes = NULL; pixmap_directory = nautilus_get_pixmap_directory (); pixmap_directory_uri = gnome_vfs_get_uri_from_local_path (pixmap_directory); - default_themes = theme_list_insert (default_themes, pixmap_directory_uri, "default", TRUE); + default_themes = theme_list_prepend (NULL, pixmap_directory_uri, "default", TRUE); g_free (pixmap_directory_uri); g_free (pixmap_directory); @@ -784,7 +783,7 @@ nautilus_theme_remove_user_theme (const char *theme_to_remove_name) theme_to_remove_path = nautilus_make_path (user_themes_directory, theme_to_remove_name); g_free (user_themes_directory); - uri_list = g_list_append (NULL, gnome_vfs_uri_new (theme_to_remove_path)); + uri_list = g_list_prepend (NULL, gnome_vfs_uri_new (theme_to_remove_path)); g_free (theme_to_remove_path); result = gnome_vfs_xfer_delete_list (uri_list, GNOME_VFS_XFER_RECURSIVE, diff --git a/libnautilus-private/nautilus-thumbnails.c b/libnautilus-private/nautilus-thumbnails.c index 7ef9e44c1..718098d59 100644 --- a/libnautilus-private/nautilus-thumbnails.c +++ b/libnautilus-private/nautilus-thumbnails.c @@ -370,7 +370,6 @@ nautilus_get_thumbnail_uri (NautilusFile *file, gboolean anti_aliased) /* the thumbnail needs to be created (or recreated), so add an entry to the thumbnail list */ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_FILE_EXISTS) { - g_warning ("error when making thumbnail directory %d, for %s", result, thumbnail_uri); } else { NautilusThumbnailInfo *info = g_new0 (NautilusThumbnailInfo, 1); @@ -378,13 +377,8 @@ nautilus_get_thumbnail_uri (NautilusFile *file, gboolean anti_aliased) info->is_local = local_flag; info->anti_aliased = anti_aliased; - if (thumbnails != NULL) { - if (g_list_find_custom (thumbnails, info, compare_thumbnail_info) == NULL) { - thumbnails = g_list_append (thumbnails, info); - } - } else { - thumbnails = g_list_alloc (); - thumbnails->data = info; + if (g_list_find_custom (thumbnails, info, compare_thumbnail_info) == NULL) { + thumbnails = g_list_append (thumbnails, info); } if (thumbnail_timeout_id == 0) { diff --git a/libnautilus-private/nautilus-trash-monitor.c b/libnautilus-private/nautilus-trash-monitor.c index a392c3d56..f2934f099 100644 --- a/libnautilus-private/nautilus-trash-monitor.c +++ b/libnautilus-private/nautilus-trash-monitor.c @@ -135,7 +135,7 @@ nautilus_trash_monitor_initialize (gpointer object, gpointer klass) trash_monitor->details->trash_directory = trash_directory; trash_monitor->details->empty = TRUE; - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); + attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); /* Make sure we get notified about changes */ nautilus_directory_file_monitor_add @@ -239,7 +239,7 @@ add_one_volume_trash (const NautilusVolume *volume, FALSE, FALSE, 0777) == GNOME_VFS_OK) { /* found trash, put it on the list */ - *result = g_list_append (*result, trash_uri); + *result = g_list_prepend (*result, trash_uri); } gnome_vfs_uri_unref (volume_mount_point_uri); diff --git a/libnautilus-private/nautilus-volume-monitor.c b/libnautilus-private/nautilus-volume-monitor.c index a9a145d31..bcaf59d9b 100644 --- a/libnautilus-private/nautilus-volume-monitor.c +++ b/libnautilus-private/nautilus-volume-monitor.c @@ -185,8 +185,8 @@ static void mount_volume_activate (NautilusVolumeM static void mount_volume_deactivate (NautilusVolumeMonitor *monitor, NautilusVolume *volume); static void load_additional_mount_list_info (GList *volume_list); -static GList * mount_volume_add_filesystem (NautilusVolume *volume, - GList *volume_list); +static GList * mount_volume_prepend_filesystem (GList *volume_list, + NautilusVolume *volume); static NautilusVolume *create_volume (const char *device_path, const char *mount_path, const char *filesystem); @@ -424,7 +424,7 @@ get_removable_volumes (void) volume->filesystem = g_strdup (ent[index].f_fstyename); volume->is_removable = TRUE; volume->is_read_only = ((ent[index].f_flags & MNT_RDONLY) != 0); - volume = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); } } #endif @@ -442,14 +442,14 @@ get_removable_volumes (void) volume = create_volume (ent->mnt_special, ent->mnt_mountp, ent->mnt_fstype); volume->is_removable = TRUE; volume->is_read_only = hasmntopt (ent, MNTOPT_RO) != NULL; - volumes = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); } } #elif defined (HAVE_MNTTENT_H) while ((ent = getmntent (file)) != NULL) { if (has_removable_mntent_options (ent)) { volume = create_volume (ent->mnt_fsname, ent->mnt_dir, ent->mnt_type); - volumes = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); } } #endif @@ -458,7 +458,7 @@ get_removable_volumes (void) #ifdef HAVE_CDDA volume = create_volume (CD_AUDIO_PATH, CD_AUDIO_PATH, CDDA_SCHEME); - volumes = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); #endif load_additional_mount_list_info (volumes); @@ -968,10 +968,10 @@ build_volume_list_delta (GList *list_one, GList *list_two) if (!found_match) { /* No match. Add it to the list to be returned; */ new_volume = copy_volume (volOne); - new_list = g_list_append (new_list, new_volume); + new_list = g_list_prepend (new_list, new_volume); } } - + return new_list; } @@ -998,7 +998,7 @@ get_mount_list (void) volume = create_volume (ent.mnt_special, ent.mnt_mountp, ent.mnt_fstype); volume->is_removable = has_removable_mntent_options (&ent); volume->is_read_only = hasmntopt (&ent, MNTOPT_RO) != NULL; - volumes = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); } fclose (fh); @@ -1062,7 +1062,7 @@ get_mount_list (void) g_free (device_path); g_free (mount_path); g_free (filesystem); - volumes = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); } eel_string_list_free (list); @@ -1089,11 +1089,11 @@ get_current_mount_list (void) if (locate_audio_cd ()) { volume = create_volume (CD_AUDIO_PATH, CD_AUDIO_PATH, CDDA_SCHEME); mount_volume_get_name (volume); - volumes = mount_volume_add_filesystem (volume, volumes); + volumes = mount_volume_prepend_filesystem (volumes, volume); } #endif - return volumes; + return g_list_reverse (volumes); } @@ -1989,7 +1989,7 @@ load_additional_mount_list_info (GList *volume_list) static GList * -mount_volume_add_filesystem (NautilusVolume *volume, GList *volume_list) +mount_volume_prepend_filesystem (GList *volume_list, NautilusVolume *volume) { gboolean added; char *device_name; @@ -2041,7 +2041,7 @@ mount_volume_add_filesystem (NautilusVolume *volume, GList *volume_list) } if (added) { - volume_list = g_list_append (volume_list, volume); + volume_list = g_list_prepend (volume_list, volume); /* Identify device type */ if (eel_str_has_prefix (volume->mount_path, "/mnt/")) { diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 3486b6c8f..1c35243a5 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -2583,7 +2583,7 @@ fm_directory_view_get_model (FMDirectoryView *view) } static void -append_uri_one (gpointer data, gpointer callback_data) +prepend_uri_one (gpointer data, gpointer callback_data) { NautilusFile *file; GList **result; @@ -2593,7 +2593,7 @@ append_uri_one (gpointer data, gpointer callback_data) result = (GList **) callback_data; file = (NautilusFile *) data; - *result = g_list_append (*result, nautilus_file_get_uri (file)); + *result = g_list_prepend (*result, nautilus_file_get_uri (file)); } static void @@ -2626,7 +2626,8 @@ fm_directory_view_create_links_for_files (FMDirectoryView *view, GList *files, /* create a list of URIs */ uris = NULL; - g_list_foreach (files, append_uri_one, &uris); + g_list_foreach (files, prepend_uri_one, &uris); + uris = g_list_reverse (uris); g_assert (g_list_length (uris) == g_list_length (files)); @@ -2657,7 +2658,8 @@ fm_directory_view_duplicate_selection (FMDirectoryView *view, GList *files, /* create a list of URIs */ uris = NULL; - g_list_foreach (files, append_uri_one, &uris); + g_list_foreach (files, prepend_uri_one, &uris); + uris = g_list_reverse (uris); g_assert (g_list_length (uris) == g_list_length (files)); diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index c958feb27..cd4f8c477 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -498,7 +498,7 @@ property_button_toggled (GtkToggleButton *button) word = g_list_find_custom (keywords, name, (GCompareFunc) strcmp); if (gtk_toggle_button_get_active (button)) { if (word == NULL) { - keywords = g_list_append (keywords, g_strdup (name)); + keywords = g_list_prepend (keywords, g_strdup (name)); } } else { if (word != NULL) { diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index 32760f56b..ecc3864ad 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -1184,7 +1184,7 @@ determined_initial_view_callback (NautilusDetermineViewHandle *handle, if (!GTK_WIDGET_VISIBLE (window)) { file = nautilus_file_get (location); - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); + attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); nautilus_file_call_when_ready (file, attributes, position_and_show_window_callback, |