static void clear (NautilusBookmarkList *bookmarks) { g_list_foreach (bookmarks->list, stop_monitoring_one, bookmarks); eel_g_object_list_free (bookmarks->list); bookmarks->list = NULL; }
void nautilus_customization_data_destroy (NautilusCustomizationData *data) { g_assert (data->public_file_list != NULL || data->private_file_list != NULL); if (data->pattern_frame != NULL) { g_object_unref (data->pattern_frame); } eel_g_object_list_free (data->public_file_list); eel_g_object_list_free (data->private_file_list); if (data->name_map_hash != NULL) { g_hash_table_destroy (data->name_map_hash); } g_free (data->customization_name); g_free (data); }
static void update_history (CajaHistorySidebar *sidebar) { GtkListStore *store; GtkTreeSelection *selection; CajaBookmark *bookmark; GdkPixbuf *pixbuf; GtkTreeIter iter; char *name; GList *l, *history; store = GTK_LIST_STORE (gtk_tree_view_get_model (sidebar->tree_view)); gtk_list_store_clear (store); history = caja_window_info_get_history (sidebar->window); for (l = history; l != NULL; l = l->next) { bookmark = caja_bookmark_copy (l->data); pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU); name = caja_bookmark_get_name (bookmark); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, HISTORY_SIDEBAR_COLUMN_ICON, pixbuf, HISTORY_SIDEBAR_COLUMN_NAME, name, HISTORY_SIDEBAR_COLUMN_BOOKMARK, bookmark, -1); g_object_unref (bookmark); if (pixbuf != NULL) { g_object_unref (pixbuf); } g_free (name); } eel_g_object_list_free (history); selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (sidebar->tree_view)); if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) { gtk_tree_selection_select_iter (selection, &iter); } }
/* go through changes in the change queue, send ones with the same kind * in a list to the different nautilus_directory_notify calls */ void nautilus_file_changes_consume_changes (gboolean consume_all) { NautilusFileChange *change; GList *additions, *changes, *deletions, *moves; GList *metadata_copy_requests, *metadata_move_requests, *metadata_remove_requests; GList *position_set_requests; GFilePair *pair; NautilusFileChangesQueuePosition *position_set; guint chunk_count; NautilusFileChangesQueue *queue; gboolean flush_needed; additions = NULL; changes = NULL; deletions = NULL; moves = NULL; metadata_copy_requests = NULL; metadata_move_requests = NULL; metadata_remove_requests = NULL; position_set_requests = NULL; queue = nautilus_file_changes_queue_get(); /* Consume changes from the queue, stuffing them into one of three lists, * keep doing it while the changes are of the same kind, then send them off. * This is to ensure that the changes get sent off in the same order that they * arrived. */ for (chunk_count = 0; ; chunk_count++) { change = nautilus_file_changes_queue_get_change (queue); /* figure out if we need to flush the pending changes that we collected sofar */ if (change == NULL) { flush_needed = TRUE; /* no changes left, flush everything */ } else { flush_needed = additions != NULL && change->kind != CHANGE_FILE_ADDED && change->kind != CHANGE_METADATA_COPIED && change->kind != CHANGE_POSITION_SET && change->kind != CHANGE_POSITION_REMOVE; flush_needed |= changes != NULL && change->kind != CHANGE_FILE_CHANGED; flush_needed |= moves != NULL && change->kind != CHANGE_FILE_MOVED && change->kind != CHANGE_METADATA_MOVED && change->kind != CHANGE_POSITION_SET && change->kind != CHANGE_POSITION_REMOVE; flush_needed |= deletions != NULL && change->kind != CHANGE_FILE_REMOVED && change->kind != CHANGE_METADATA_REMOVED; flush_needed |= metadata_copy_requests != NULL && change->kind != CHANGE_FILE_ADDED && change->kind != CHANGE_METADATA_COPIED && change->kind != CHANGE_POSITION_SET && change->kind != CHANGE_POSITION_REMOVE; flush_needed |= metadata_move_requests != NULL && change->kind != CHANGE_FILE_MOVED && change->kind != CHANGE_METADATA_MOVED && change->kind != CHANGE_POSITION_SET && change->kind != CHANGE_POSITION_REMOVE; flush_needed |= metadata_remove_requests != NULL && change->kind != CHANGE_FILE_REMOVED && change->kind != CHANGE_METADATA_REMOVED; flush_needed |= position_set_requests != NULL && change->kind != CHANGE_POSITION_SET && change->kind != CHANGE_POSITION_REMOVE && change->kind != CHANGE_FILE_ADDED && change->kind != CHANGE_FILE_MOVED && change->kind != CHANGE_METADATA_COPIED && change->kind != CHANGE_METADATA_MOVED; flush_needed |= !consume_all && chunk_count >= CONSUME_CHANGES_MAX_CHUNK; /* we have reached the chunk maximum */ } if (flush_needed) { /* Send changes we collected off. * At one time we may only have one of the lists * contain changes. */ if (deletions != NULL) { deletions = g_list_reverse (deletions); nautilus_directory_notify_files_removed (deletions); eel_g_object_list_free (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_object_list_free (additions); additions = NULL; } if (changes != NULL) { changes = g_list_reverse (changes); nautilus_directory_notify_files_changed (changes); eel_g_object_list_free (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_object_list_free (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; } } if (change == NULL) { /* we are done */ return; } /* add the new change to the list */ switch (change->kind) { case CHANGE_FILE_ADDED: additions = g_list_prepend (additions, change->from); break; case CHANGE_FILE_CHANGED: changes = g_list_prepend (changes, change->from); break; case CHANGE_FILE_REMOVED: deletions = g_list_prepend (deletions, change->from); break; case CHANGE_FILE_MOVED: pair = g_new (GFilePair, 1); pair->from = change->from; pair->to = change->to; moves = g_list_prepend (moves, pair); break; case CHANGE_METADATA_COPIED: pair = g_new (GFilePair, 1); pair->from = change->from; pair->to = change->to; metadata_copy_requests = g_list_prepend (metadata_copy_requests, pair); break; case CHANGE_METADATA_MOVED: pair = g_new (GFilePair, 1); pair->from = change->from; pair->to = change->to; metadata_move_requests = g_list_prepend (metadata_move_requests, pair); break; case CHANGE_METADATA_REMOVED: metadata_remove_requests = g_list_prepend (metadata_remove_requests, change->from); break; case CHANGE_POSITION_SET: position_set = g_new (NautilusFileChangesQueuePosition, 1); position_set->location = change->from; position_set->set = TRUE; position_set->point = change->point; position_set->screen = change->screen; position_set_requests = g_list_prepend (position_set_requests, position_set); break; case CHANGE_POSITION_REMOVE: position_set = g_new (NautilusFileChangesQueuePosition, 1); position_set->location = change->from; position_set->set = FALSE; position_set_requests = g_list_prepend (position_set_requests, position_set); break; default: g_assert_not_reached (); break; } g_free (change); } }