void move_transfer_down (gpointer data) { GList * firstentry, * secentry, * lastentry; gftpui_common_curtrans_data * transdata; GtkCTreeNode * node; if (GTK_CLIST (dlwdw)->selection == NULL) { ftp_log (gftp_logging_error, NULL, _("There are no file transfers selected\n")); return; } node = GTK_CLIST (dlwdw)->selection->data; transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node); if (transdata->curfle == NULL) return; g_static_mutex_lock (&transdata->transfer->structmutex); if (transdata->curfle->next != NULL && (!transdata->transfer->started || (transdata->transfer->curfle != transdata->curfle && transdata->transfer->curfle != transdata->curfle->next))) { if (transdata->curfle->prev == NULL) { firstentry = transdata->curfle->next; lastentry = transdata->curfle->next->next; transdata->transfer->files = firstentry; transdata->transfer->files->prev = NULL; transdata->transfer->files->next = transdata->curfle; transdata->curfle->prev = transdata->transfer->files; transdata->curfle->next = lastentry; if (lastentry != NULL) lastentry->prev = transdata->curfle; } else { firstentry = transdata->curfle->prev; secentry = transdata->curfle->next; lastentry = transdata->curfle->next->next; firstentry->next = secentry; secentry->prev = firstentry; secentry->next = transdata->curfle; transdata->curfle->prev = secentry; transdata->curfle->next = lastentry; if (lastentry != NULL) lastentry->prev = transdata->curfle; } gtk_ctree_move (GTK_CTREE (dlwdw), ((gftp_file *) transdata->curfle->data)->user_data, transdata->transfer->user_data, transdata->curfle->next != NULL ? ((gftp_file *) transdata->curfle->next->data)->user_data: NULL); } g_static_mutex_unlock (&transdata->transfer->structmutex); }
/* Move a node in the tree to another location. */ int clip_GTK_CTREEMOVE(ClipMachine * cm) { C_widget *cctree = _fetch_cw_arg(cm); C_object *cnode = _fetch_cobject(cm,_clip_spar(cm,2)); C_object *cnew_parent = _fetch_cobject(cm,_clip_spar(cm,3)); C_object *cnew_sibling = _fetch_cobject(cm,_clip_spar(cm,4)); CHECKCWID(cctree,GTK_IS_CTREE); CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCOBJOPT(cnode,cnode->type==GTK_TYPE_CTREE_NODE); CHECKOPT2(3,MAP_t,NUMERIC_t); CHECKCOBJOPT(cnew_parent,cnew_parent->type==GTK_TYPE_CTREE_NODE); CHECKOPT2(4,MAP_t,NUMERIC_t); CHECKCOBJOPT(cnew_sibling,cnew_sibling->type==GTK_TYPE_CTREE_NODE); gtk_ctree_move(GTK_CTREE(cctree->widget),GTK_CTREE_NODE(cnode->object), GTK_CTREE_NODE(cnew_parent->object), GTK_CTREE_NODE(cnew_sibling->object)); return 0; err: return 1; }