static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data) { CollectionData *cd = data; if (!(type & NOTIFY_CHANGE) || !fd->change) return; DEBUG_1("Notify collection: %s %04x", fd->path, type); switch (fd->change->type) { case FILEDATA_CHANGE_MOVE: case FILEDATA_CHANGE_RENAME: collection_rename(cd, fd); break; case FILEDATA_CHANGE_COPY: break; case FILEDATA_CHANGE_DELETE: while (collection_remove(cd, fd)); break; case FILEDATA_CHANGE_UNSPECIFIED: case FILEDATA_CHANGE_WRITE_METADATA: break; } }
static gint collect_manager_process_entry(CollectManagerEntry *entry) { CollectionData *cd; gint success; GList *work; if (!entry->action_list) return FALSE; cd = collection_new(entry->path); success = collection_load_private(cd, entry->path, FALSE, FALSE); work = g_list_last(entry->action_list); while (work) { CollectManagerAction *action; action = work->data; work = work->prev; if (!action->oldpath) { /* add image */ if (collection_list_find(cd->list, action->newpath) == NULL) { collection_add_check(cd, action->newpath, FALSE, FALSE); } } else if (action->newpath) { /* rename image */ while (collection_rename(cd, action->oldpath, action->newpath)); } else { /* remove image */ while (collection_remove(cd, action->oldpath)); } collect_manager_action_unref(action); } if (success && cd->changed) { collection_save_private(cd, entry->path); if (debug) printf("collection manager updated: %s\n", entry->path); } collection_unref(cd); g_list_free(entry->action_list); entry->action_list = NULL; return TRUE; }
void collect_manager_remove(const gchar *path, const gchar *collection) { CollectManagerAction *action; CollectWindow *cw; if (!path || !collection) return; cw = collection_window_find_by_path(collection); if (cw) { while (collection_remove(cw->cd, path)); return; } action = collect_manager_action_new(path, collection, COLLECTION_MANAGER_REMOVE); collect_manager_add_action(action); }
void client_close(struct mux_client *client) { usbmuxd_log(LL_INFO, "Disconnecting client fd %d", client->fd); if(client->state == CLIENT_CONNECTING1 || client->state == CLIENT_CONNECTING2) { usbmuxd_log(LL_INFO, "Client died mid-connect, aborting device %d connection", client->connect_device); client->state = CLIENT_DEAD; device_abort_connect(client->connect_device, client); } close(client->fd); if(client->ob_buf) free(client->ob_buf); if(client->ib_buf) free(client->ib_buf); pthread_mutex_lock(&client_list_mutex); collection_remove(&client_list, client); pthread_mutex_unlock(&client_list_mutex); free(client); }
int array_removeObject(Array * array, void * object){ collection_remove((Collection *)array, object); }