diff options
author | Darin Adler <darin@src.gnome.org> | 2000-12-19 21:47:03 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-12-19 21:47:03 +0000 |
commit | 4f3cae6a45df9b61d5d940cfb670ba8ae2c1af3e (patch) | |
tree | 47174e036db8fa26b7c0de9c65e325c80783b5f3 | |
parent | 5a596d5f8218901753e3e8ac24c67db9c340bc7f (diff) | |
download | nautilus-4f3cae6a45df9b61d5d940cfb670ba8ae2c1af3e.tar.gz |
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 2233 (proper icon not selected switching views after
rename) by re-sending selection when the selection items change
since they might have changed names.
* src/file-manager/fm-directory-view.c: (done_loading): Moved
more of the done_loading code here for clarity.
(compare_pointers), (sort_and_check_for_intersection): Added
functions that quickly find if there's an intersection in two
GLists of NautilusFile objects.
(display_pending_files): Move some of the done_loading code into a
new function, do it after processing file changes, and add code to
send out the selection if a file change comes in for any items in
the selection (in case the name changed).
(display_selection_info_idle_callback),
(update_menus_idle_callback), (display_pending_idle_callback):
Make all of these more robust by keeping the NautilusView object
in a local variable.
(display_pending_timeout_callback): Do the "ref the NautilusView"
thing in this function too.
* check-POTFILES.pl: Added support for .xml and .cpp files and
also updated special cases for directory environment variables.
* check-THANKS.pl: Added a special case and fixed some things in
the ChangeLog too to make this output fewer false positives.
-rw-r--r-- | ChangeLog | 36 | ||||
-rwxr-xr-x | check-POTFILES.pl | 4 | ||||
-rwxr-xr-x | check-THANKS.pl | 1 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 187 |
4 files changed, 163 insertions, 65 deletions
@@ -1,7 +1,35 @@ +2000-12-19 Darin Adler <darin@eazel.com> + + reviewed by: John Sullivan <sullivan@eazel.com> + + Fixed bug 2233 (proper icon not selected switching views after + rename) by re-sending selection when the selection items change + since they might have changed names. + + * src/file-manager/fm-directory-view.c: (done_loading): Moved + more of the done_loading code here for clarity. + (compare_pointers), (sort_and_check_for_intersection): Added + functions that quickly find if there's an intersection in two + GLists of NautilusFile objects. + (display_pending_files): Move some of the done_loading code into a + new function, do it after processing file changes, and add code to + send out the selection if a file change comes in for any items in + the selection (in case the name changed). + (display_selection_info_idle_callback), + (update_menus_idle_callback), (display_pending_idle_callback): + Make all of these more robust by keeping the NautilusView object + in a local variable. + (display_pending_timeout_callback): Do the "ref the NautilusView" + thing in this function too. + + * check-POTFILES.pl: Added support for .xml and .cpp files and + also updated special cases for directory environment variables. + * check-THANKS.pl: Added a special case and fixed some things in + the ChangeLog too to make this output fewer false positives. + 2000-12-19 Mike Fleming <mfleming@eazel.com> - * components/services/nautilus-dependent-shared/shared-service-widg - ets.c: + * components/services/nautilus-dependent-shared/shared-service-widgets.c: Added fixme * components/mozilla/main.c: (main): @@ -2634,7 +2662,7 @@ More minor cleaning to make the summary view more managable. -2000-12-09 Andy Hertzfeld <and@eazel.com> +2000-12-09 Andy Hertzfeld <andy@eazel.com> * src/file-manager/fm-properties-window.c: (create_basic_page), (create_properties_window), (ensure_uri_is_image), @@ -6202,7 +6230,7 @@ John Fleck <jfleck@inkstain.net> (size_allocate_callback): Scroll to the selected node, if any, on the first size_allocate only. -2000-11-18 John Fleck <jfleck@inkstain.net: +2000-11-18 John Fleck <jfleck@inkstain.net> components/help/converters/gnome-db2html2/gdb3html.c: changing output of % entity to % so Mozilla will diff --git a/check-POTFILES.pl b/check-POTFILES.pl index be0dd4e9b..5024e9330 100755 --- a/check-POTFILES.pl +++ b/check-POTFILES.pl @@ -33,7 +33,9 @@ my @directories = ("."); my %exceptions = ( + '$(APPLETS_SUBDIRS)' => 'applets', '$(AUTHENTICATE_HELPER_SUBDIRS)' => 'authenticate', + '$(INSTALL_SERVICE)' => 'install', '$(MOZILLA_COMPONENT_SUBDIRS)' => 'mozilla', '$(NULL)' => '', '$(RPMVIEW_COMPONENT_SUBDIRS)' => 'rpmview', @@ -86,7 +88,7 @@ while (@directories) die "can't parse SUBDIRS in $directory\n"; } } - while (s/([-_a-zA-Z0-9]+\.[ch])\W//) + while (s/([-_a-zA-Z0-9]+\.(c|h|xml|cpp))\W//) { $files{$prefix . $1} = $1; } diff --git a/check-THANKS.pl b/check-THANKS.pl index 7c3cdc7be..581e25125 100755 --- a/check-THANKS.pl +++ b/check-THANKS.pl @@ -41,6 +41,7 @@ my %name_map = ("Darin as Andy" => "Darin Adler", "Mike Engber" => "Michael Engber", "Pavel Cisler" => "Pavel Císler", "Pavel" => "Pavel Císler", + "Eskil Olsen" => "Eskil Heyn Olsen", "Robin Slomkowski" => "Robin * Slomkowski"); # Map from alternate email addresses of some users to canonical versions diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index aa14677da..af7258c47 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -1399,9 +1399,12 @@ check_for_directory_hard_limit (FMDirectoryView *view) static void done_loading (FMDirectoryView *view) { + GList *uris_selected, *selection; + if (!view->details->loading) { return; } + /* This can be called during destruction, in which case there * is no NautilusView any more. */ @@ -1409,6 +1412,19 @@ done_loading (FMDirectoryView *view) nautilus_view_report_load_complete (view->details->nautilus_view); schedule_update_menus (view); check_for_directory_hard_limit (view); + + uris_selected = view->details->pending_uris_selected; + if (uris_selected != NULL) { + view->details->pending_uris_selected = NULL; + + selection = file_list_from_uri_list (uris_selected); + nautilus_g_list_free_deep (uris_selected); + + fm_directory_view_set_selection (view, selection); + fm_directory_view_reveal_selection (view); + + nautilus_file_list_free (selection); + } } view->details->loading = FALSE; @@ -1635,66 +1651,103 @@ copy_move_done_callback (GHashTable *debuting_uris, gpointer data) } } +static int +compare_pointers (gconstpointer pointer_1, gconstpointer pointer_2) +{ + if ((const char *) pointer_1 < (const char *) pointer_2) { + return -1; + } + if ((const char *) pointer_1 > (const char *) pointer_2) { + return +1; + } + return 0; +} + +static gboolean +sort_and_check_for_intersection (GList **list_1, GList **list_2) +{ + GList *node_1, *node_2; + int compare_result; + + *list_1 = g_list_sort (*list_1, compare_pointers); + *list_2 = g_list_sort (*list_2, compare_pointers); + + node_1 = *list_1; + node_2 = *list_2; + + while (node_1 != NULL && node_2 != NULL) { + compare_result = compare_pointers (node_1->data, node_2->data); + if (compare_result == 0) { + return TRUE; + } + if (compare_result <= 0) { + node_1 = node_1->next; + } + if (compare_result >= 0) { + node_2 = node_2->next; + } + } + + return FALSE; +} + static gboolean display_pending_files (FMDirectoryView *view) { - GList *files_added, *files_changed, *uris_selected, *p; + GList *files_added, *files_changed, *node; NautilusFile *file; GList *selection; + gboolean send_selection_change; - selection = NULL; - - if (view->details->model != NULL - && nautilus_directory_are_all_files_seen (view->details->model)) { - done_loading (view); - } + send_selection_change = FALSE; files_added = view->details->pending_files_added; files_changed = view->details->pending_files_changed; - uris_selected = view->details->pending_uris_selected; - - if (files_added == NULL && files_changed == NULL && uris_selected == NULL) { - return FALSE; - } - view->details->pending_files_added = NULL; - view->details->pending_files_changed = NULL; - - gtk_signal_emit (GTK_OBJECT (view), signals[BEGIN_ADDING_FILES]); - for (p = files_added; p != NULL; p = p->next) { - file = NAUTILUS_FILE (p->data); + if (files_added != NULL || files_changed != NULL) { + view->details->pending_files_added = NULL; + view->details->pending_files_changed = NULL; - if (nautilus_directory_contains_file (view->details->model, file)) { + gtk_signal_emit (GTK_OBJECT (view), signals[BEGIN_ADDING_FILES]); + + for (node = files_added; node != NULL; node = node->next) { + file = NAUTILUS_FILE (node->data); + + if (nautilus_directory_contains_file (view->details->model, file)) { + gtk_signal_emit (GTK_OBJECT (view), + signals[ADD_FILE], + file); + } + } + + for (node = files_changed; node != NULL; node = node->next) { + file = NAUTILUS_FILE (node->data); + gtk_signal_emit (GTK_OBJECT (view), - signals[ADD_FILE], + signals[FILE_CHANGED], file); } - } - - for (p = files_changed; p != NULL; p = p->next) { - file = NAUTILUS_FILE (p->data); - gtk_signal_emit (GTK_OBJECT (view), - signals[FILE_CHANGED], - file); - } - - gtk_signal_emit (GTK_OBJECT (view), signals[DONE_ADDING_FILES]); + gtk_signal_emit (GTK_OBJECT (view), signals[DONE_ADDING_FILES]); - nautilus_file_list_free (files_added); - nautilus_file_list_free (files_changed); + if (files_changed != NULL) { + selection = fm_directory_view_get_selection (view); + send_selection_change = sort_and_check_for_intersection + (&files_changed, &selection); + nautilus_file_list_free (selection); + } - if (nautilus_directory_are_all_files_seen (view->details->model) - && uris_selected != NULL) { - view->details->pending_uris_selected = NULL; - - selection = file_list_from_uri_list (uris_selected); - nautilus_g_list_free_deep (uris_selected); + nautilus_file_list_free (files_added); + nautilus_file_list_free (files_changed); + } - fm_directory_view_set_selection (view, selection); - fm_directory_view_reveal_selection (view); + if (view->details->model != NULL + && nautilus_directory_are_all_files_seen (view->details->model)) { + done_loading (view); + } - nautilus_file_list_free (selection); + if (send_selection_change) { + fm_directory_view_send_selection_change (view); } return TRUE; @@ -1704,19 +1757,21 @@ static gboolean display_selection_info_idle_callback (gpointer data) { FMDirectoryView *view; + BonoboObject *nautilus_view; view = FM_DIRECTORY_VIEW (data); + nautilus_view = BONOBO_OBJECT (view->details->nautilus_view); /* Ref the view so that the widget can't be destroyed during * idle processing. */ - bonobo_object_ref (BONOBO_OBJECT (view->details->nautilus_view)); + bonobo_object_ref (nautilus_view); view->details->display_selection_idle_id = 0; fm_directory_view_display_selection_info (view); fm_directory_view_send_selection_change (view); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); + bonobo_object_unref (nautilus_view); return FALSE; } @@ -1725,18 +1780,20 @@ static gboolean update_menus_idle_callback (gpointer data) { FMDirectoryView *view; + BonoboObject *nautilus_view; view = FM_DIRECTORY_VIEW (data); + nautilus_view = BONOBO_OBJECT (view->details->nautilus_view); /* Ref the view so that the widget can't be destroyed during * idle processing. */ - bonobo_object_ref (BONOBO_OBJECT (view->details->nautilus_view)); + bonobo_object_ref (nautilus_view); view->details->update_menus_idle_id = 0; fm_directory_view_update_menus (view); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); + bonobo_object_unref (nautilus_view); return FALSE; } @@ -1744,21 +1801,23 @@ update_menus_idle_callback (gpointer data) static gboolean display_pending_idle_callback (gpointer data) { - /* Don't do another idle until we receive more files. */ - FMDirectoryView *view; - + BonoboObject *nautilus_view; + view = FM_DIRECTORY_VIEW (data); + nautilus_view = BONOBO_OBJECT (view->details->nautilus_view); /* Ref the view so that the widget can't be destroyed during * idle processing. */ - bonobo_object_ref (BONOBO_OBJECT (view->details->nautilus_view)); + bonobo_object_ref (nautilus_view); view->details->display_pending_idle_id = 0; display_pending_files (view); - bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); + bonobo_object_unref (nautilus_view); + + /* Don't do another idle until we receive more files. */ return FALSE; } @@ -1766,23 +1825,30 @@ display_pending_idle_callback (gpointer data) static gboolean display_pending_timeout_callback (gpointer data) { - /* Do another timeout if we displayed some files. - * Once we get all the files, we'll start using - * idle instead. - */ - FMDirectoryView *view; gboolean displayed_some; + BonoboObject *nautilus_view; view = FM_DIRECTORY_VIEW (data); + nautilus_view = BONOBO_OBJECT (view->details->nautilus_view); + + /* Ref the view so that the widget can't be destroyed during + * idle processing. + */ + bonobo_object_ref (nautilus_view); + + /* Do another timeout if we displayed some files. Once we get + * all the files, we'll start using idle instead. + */ displayed_some = display_pending_files (view); - if (displayed_some) { - return TRUE; + if (!displayed_some) { + view->details->display_pending_timeout_id = 0; } - view->details->display_pending_timeout_id = 0; - return FALSE; + bonobo_object_unref (nautilus_view); + + return displayed_some; } @@ -3242,10 +3308,11 @@ fm_directory_view_notify_selection_changed (FMDirectoryView *view) g_return_if_fail (FM_IS_DIRECTORY_VIEW (view)); /* Schedule a display of the new selection. */ - if (view->details->display_selection_idle_id == 0) + if (view->details->display_selection_idle_id == 0) { view->details->display_selection_idle_id = gtk_idle_add (display_selection_info_idle_callback, view); + } if (view->details->batching_selection_level != 0) { view->details->selection_changed_while_batched = TRUE; |