GList * mono_varlist_insert_sorted (MonoCompile *cfg, GList *list, MonoMethodVar *mv, int sort_type) { GList *l; if (!list) return g_list_prepend (NULL, mv); for (l = list; l; l = l->next) { MonoMethodVar *v1 = (MonoMethodVar *)l->data; if (sort_type == 2) { if (mv->spill_costs >= v1->spill_costs) { list = g_list_insert_before (list, l, mv); break; } } else if (sort_type == 1) { if (mv->range.last_use.abs_pos <= v1->range.last_use.abs_pos) { list = g_list_insert_before (list, l, mv); break; } } else { if (mv->range.first_use.abs_pos <= v1->range.first_use.abs_pos) { list = g_list_insert_before (list, l, mv); break; } } } if (!l) list = g_list_append (list, mv); return list; }
//*********************my_atk_text_set_run_attributes************************ gboolean my_atk_text_set_run_attributes(AtkEditableText* text, AtkAttributeSet* attrib_set, gint start_offset, gint end_offset) { MyAtkText* self = (MyAtkText*)text; gint len = atk_text_get_character_count((AtkText*)text); if(start_offset < 0 || start_offset >= end_offset || end_offset > len) return FALSE; GList *attributes = self->attributes; GList *tmp = attributes; while(tmp != NULL) { Range *range = (Range*)tmp->data; if(range->start < start_offset) { if(range->end <= end_offset) { if(range->end > start_offset) range->end = start_offset; tmp = tmp->next; continue; } /*range->end > end_offset*/ Range* additional_range = range_new(end_offset, range->end); additional_range->attributeSet = attribute_set_copy(range->attributeSet); range->end = start_offset; attributes = g_list_insert_before(attributes, tmp->next, additional_range); tmp = tmp->next; break; } else/*range->start >= start_offset*/ { if(range->end <= end_offset) { GList *tmp1 = tmp->next; attributes = g_list_remove_link(attributes, tmp); tmp = tmp1; continue; } /*range->end > end_offset*/ if(range->start < end_offset) range->start = end_offset; break; } } Range *new_range = range_new(start_offset, end_offset); new_range->attributeSet = attribute_set_copy(attrib_set); if(tmp == NULL)attributes = g_list_append(attributes, new_range); else attributes = g_list_insert_before(attributes, tmp, new_range); self->attributes = attributes; g_signal_emit_by_name(self, "text_attributes_changed"); return TRUE; }
static void server_position_connection(LassiServer *ls, LassiConnection *lc) { GList *l; LassiConnection *last = NULL; g_assert(ls); g_assert(lc); g_assert(!g_list_find(ls->connections_left, lc)); g_assert(!g_list_find(ls->connections_right, lc)); for (l = ls->order; l; l = l->next) { LassiConnection *k; if (strcmp(l->data, lc->id) == 0) break; if ((k = g_hash_table_lookup(ls->connections_by_id, l->data))) last = k; } if (l) { /* OK, We found a spot to add this */ if (last) { GList *j; /*Ok, this one belongs to the right of 'last' */ if ((j = g_list_find(ls->connections_left, last))) /* This one belongs in the left list */ ls->connections_left = g_list_insert_before(ls->connections_left, j, lc); else { /* This one belongs in the rightlist */ ls->connections_right = g_list_reverse(ls->connections_right); j = g_list_find(ls->connections_right, last); g_assert(j); ls->connections_right = g_list_insert_before(ls->connections_right, j, lc); ls->connections_right = g_list_reverse(ls->connections_right); } } else /* Hmm, this is before the left end */ ls->connections_left = g_list_append(ls->connections_left, lc); } else { ls->order = g_list_append(ls->order, g_strdup(lc->id)); /* No spot found, let's add it to the right end */ ls->connections_right = g_list_append(ls->connections_right, lc); } }
GList * npw_header_list_insert_header (GList *list, NPWHeader *header) { GList *node; GList *template_list; for (node = g_list_first (list); node != NULL; node = g_list_next (node)) { NPWHeader* first; gint res; template_list = (GList *)node->data; first = (NPWHeader *)template_list->data; res = g_ascii_strcasecmp (npw_header_get_category (first), npw_header_get_category (header)); if (res == 0) { node->data = g_list_insert_sorted (template_list, header, (GCompareFunc) compare_header_name); return list; } else if (res > 0) { break; } } template_list = g_list_prepend (NULL, header); return g_list_insert_before (list, node, template_list); }
G_MODULE_EXPORT gboolean display_show(NOTIFICATION_INFO* const ni) { DISPLAY_INFO* const di = get_popup_skelton(ni); if (!di) return FALSE; gint is_differ_pos(gconstpointer p, gconstpointer GOL_UNUSED_ARG(user_data)) { return ((const DISPLAY_INFO*) p)->pos == di->pos++; } GList* const found = g_list_find_custom(notifications, NULL, is_differ_pos); if (found) --di->pos; const gint vert_count = screen_rect.height / 180; const gint cx = di->pos / vert_count; const gint cy = di->pos % vert_count; di->x = screen_rect.x + screen_rect.width - cx * 200 - 180; di->y = screen_rect.y + screen_rect.height - cy * 180 + 20; if (di->x < 0) { free_display_info(di); return FALSE; } notifications = g_list_insert_before(notifications, found, di); box_set_icon_if_has(di); gtk_label_set_text(DISPLAY_TITLE_FIELD(di), di->ni->title); gtk_label_set_text(DISPLAY_TEXT_FIELD(di), di->ni->text); gtk_window_move(GTK_WINDOW(di->widget.popup), di->x, di->y); gtk_widget_show_all(di->widget.popup); g_timeout_add(10, display_animation_func, di); return FALSE; }
static command_trie_t* command_trie_elem_insert (command_trie_t* node, gchar c) { GList *prev, *curr; command_trie_t *t; prev = NULL; curr = (GList *) node->next; while (curr && ((command_trie_t *) curr->data)->c <= c) { prev = curr; curr = curr->next; } if (prev && ((command_trie_t *) prev->data)->c == c) { t = (command_trie_t *) prev->data; } else { t = command_trie_new (c); if (prev == NULL) { /* List empty so far, bootstrap it */ node->next = g_list_prepend (curr, t); } else { /* Insert at the correct position (assign to suppress warning) */ prev = g_list_insert_before (prev, curr, t); } } return t; }
/* Updates a list of files sorted by increasing weighted_size_and_age. */ static GList *insert_name_and_sizes(GList *list, const char *name, double wsa, off_t sz) { struct name_and_size *ns; unsigned list_len = 0; GList *cur = list; while (cur) { ns = cur->data; if (ns->weighted_size_and_age >= wsa) break; list_len++; cur = cur->next; } list_len += g_list_length(cur); if (cur != list || list_len < MAX_VICTIM_LIST_SIZE) { ns = xmalloc(sizeof(*ns) + strlen(name)); ns->weighted_size_and_age = wsa; ns->size = sz; strcpy(ns->name, name); list = g_list_insert_before(list, cur, ns); list_len++; if (list_len > MAX_VICTIM_LIST_SIZE) { free(list->data); list = g_list_delete_link(list, list); } } return list; }
static void mex_column_reorder (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling, gboolean after) { GList *l, *sibling_link; MexColumnPrivate *priv = MEX_COLUMN (container)->priv; l = g_list_find (priv->children, actor); sibling_link = g_list_find (priv->children, sibling); if (!l || !sibling_link) { g_warning (G_STRLOC ": Children not found in internal child list"); return; } if (after) sibling_link = g_list_next (sibling_link); if (l == sibling_link) return; priv->children = g_list_delete_link (priv->children, l); priv->children = g_list_insert_before (priv->children, sibling_link, actor); clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); }
unsigned long add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const void *before) { Widget *wh = WIDGET (h); Widget *widget; GList *new_current; /* Don't accept 0 widgets */ if (w == NULL) abort (); widget = WIDGET (w); if ((pos_flags & WPOS_CENTER_HORZ) != 0) widget->x = (wh->cols - widget->cols) / 2; widget->x += wh->x; if ((pos_flags & WPOS_CENTER_VERT) != 0) widget->y = (wh->lines - widget->lines) / 2; widget->y += wh->y; widget->owner = h; widget->pos_flags = pos_flags; widget->id = h->widget_id++; if (h->widgets == NULL || before == NULL) { h->widgets = g_list_append (h->widgets, widget); new_current = g_list_last (h->widgets); } else { GList *b; b = g_list_find (h->widgets, before); /* don't accept widget not from dialog. This shouldn't happen */ if (b == NULL) abort (); b = g_list_next (b); h->widgets = g_list_insert_before (h->widgets, b, widget); if (b != NULL) new_current = g_list_previous (b); else new_current = g_list_last (h->widgets); } /* widget has been added at runtime */ if (widget_get_state (wh, WST_ACTIVE)) { send_message (widget, NULL, MSG_INIT, 0, NULL); widget_select (widget); } else h->current = new_current; return widget->id; }
/*! \brief Get a list of symbols used. * \par Function Description * * Scan a #TOPLEVEL structure's object list looking for symbols, and * return them in a list. * * \warning The #CLibSymbol instances in the \b GList returned belong * to the component library, and should be considered constants; they * should not be manipulated or free()'d. On the other hand, the \b * GList returned must be freed with \b g_list_free() when no longer * needed. Note that the values returned will be invalidated by a * call to s_clib_free() or s_clib_refresh(). * * \bug Only includes components which are not embedded, but they * should (probably) also appear in the list. * * \param toplevel #TOPLEVEL structure to scan. * \return GList of symbols. */ GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel) { GList *result = NULL; GList *iter = NULL; OBJECT *o = NULL; PAGE *page; GList *symlist = NULL; CLibSymbol *sym = NULL; const GList *p_iter; const GList *o_iter; g_return_val_if_fail ((toplevel != NULL), NULL); for ( p_iter = geda_list_get_glist( toplevel->pages ); p_iter != NULL; p_iter = g_list_next( p_iter )) { page = (PAGE *)p_iter->data; for (o_iter = s_page_objects (page); o_iter != NULL; o_iter = g_list_next (o_iter)) { o = (OBJECT *)o_iter->data; if (o->type != OBJ_COMPLEX) continue; if (o->complex_basename == NULL) continue; /* Since we're not looking at embedded symbols, the first * component with the given name will be the one we need. * N.b. we don't use s_clib_get_symbol_by_name() because it's * spammeh. */ symlist = s_clib_search (o->complex_basename, CLIB_EXACT); if (symlist == NULL) continue; sym = (CLibSymbol *) symlist->data; g_list_free (symlist); /* We do the list insertion by evilly comparing pointers. This * is okay, because we always take the first symbol with the * given name, and symbol pointers don't change while this * function is running (we hope). Note that this creates a * sorted list.*/ for (iter = result; iter != NULL; iter = g_list_next(iter)) { if (iter->data == sym) { break; /* Already in list */ } if (compare_symbol_name (iter->data, sym) > 0) { /* not in list yet, and gone past point where it should go */ result = g_list_insert_before (result, iter, sym); break; } } if (iter == NULL) { /* not in list yet, and at end of list */ result = g_list_append (result, sym); } } } return result; }
/* * * Function: RoundRobin * * Purpose: Implements the Round Robin algorithm for dipatching and * then prints the Average Waiting Time (AWS) of the processess * in the list * * Parameters: * input A pointer to the start of the list and the quantum of * which is intented to use * * output Prints the average waiting time for the process list * */ void RoundRobin(GList *processList, int quantum){ int acumulatedTime = 0; float timeSummation = 0; float numberProcess = 0; float average; GList *list = g_list_copy(processList),*i,*j; InitializeList(list); process *temp = list->data, *tempNext; acumulatedTime = temp->arrival_time; int reins; for (i= list; i != NULL; i=i->next) { temp = i->data; if (temp->timeleft > 0){ // Is the process finished? if (temp->timeleft > quantum) { // Is the process going to finish before the quantum expires? reins =0; temp->timeleft = temp->timeleft - quantum; acumulatedTime = acumulatedTime + quantum; // This section checks where the process should be reinserted (In case not all the process have arrived) for (j=i; j !=NULL; j = j->next) { tempNext= j->data; if ((tempNext->arrival_time > acumulatedTime)&& (reins==0) ) { i = g_list_insert_before(i,j->prev,temp); reins++; break; } } if (reins==0) { i = g_list_append(i,temp); } // End of section } else { // Calculates the operations to obtain the data for the formula temp->last_runned = acumulatedTime; timeSummation = timeSummation + (temp->last_runned - temp->arrival_time - (temp->cpu_burst - temp->timeleft)); #ifdef DEBUG PrintProcess(temp, acumulatedTime); #endif acumulatedTime = acumulatedTime + temp->timeleft; temp->timeleft = 0; numberProcess++; } } } average = timeSummation/numberProcess; // Destroy the copy of the original list and the iterators g_list_free(list); g_list_free(i); g_list_free(j); printf("\nRound Robin\n"); printf("Average time = %2f\n",average); #ifdef DEBUG printf("%f %f\n",timeSummation,numberProcess); #endif }
static void reorder_child (GdStack *stack, GtkWidget *child, gint position) { GdStackPrivate *priv; GList *l; GList *old_link = NULL; GList *new_link = NULL; GdStackChildInfo *child_info; gint num = 0; priv = stack->priv; l = priv->children; /* Loop to find the old position and link of child, new link of child and * total number of children. new_link will be NULL if the child should be * moved to the end (in case of position being < 0 || >= num) */ while (l && (new_link == NULL || old_link == NULL)) { /* Record the new position if found */ if (position == num) new_link = l; if (old_link == NULL) { GdStackChildInfo *info; info = l->data; /* Keep trying to find the current position and link location of the child */ if (info->widget == child) { old_link = l; child_info = info; } } l = g_list_next (l); num++; } g_return_if_fail (old_link != NULL); if (old_link == new_link || (g_list_next (old_link) == NULL && new_link == NULL)) return; priv->children = g_list_delete_link (priv->children, old_link); priv->children = g_list_insert_before (priv->children, new_link, child_info); gtk_widget_child_notify (child, "position"); }
/** * g_queue_insert_before: * @queue: a #GQueue * @sibling: a #GList link that <emphasis>must</emphasis> be part of @queue * @data: the data to insert * * Inserts @data into @queue before @sibling. * * @sibling must be part of @queue. * * Since: 2.4 **/ void g_queue_insert_before (GQueue *queue, GList *sibling, gpointer data) { g_return_if_fail (queue != NULL); g_return_if_fail (sibling != NULL); queue->head = g_list_insert_before (queue->head, sibling, data); queue->length++; }
static void _fill_apps_from_dir(MenuMenu *menu, GList *lptr, GString *prefix, gboolean is_legacy) { const char *dir = lptr->data; GDir *gd; const char *name; char *filename, *id; gsize prefix_len = prefix->len; MenuApp *app; GKeyFile *kf; if (g_slist_find(loaded_dirs, dir) == NULL) loaded_dirs = g_slist_prepend(loaded_dirs, (gpointer)dir); /* the directory might be scanned with different prefix already */ else if (prefix->str[0] == '\0') return; gd = g_dir_open(dir, 0, NULL); if (gd == NULL) return; kf = g_key_file_new(); DBG("fill apps from dir [%s]%s", prefix->str, dir); /* Scan the directory with subdirs, ignore not .desktop files, ignore already present files that are allocated */ while ((name = g_dir_read_name(gd)) != NULL) { filename = g_build_filename(dir, name, NULL); if (g_file_test(filename, G_FILE_TEST_IS_DIR)) { /* recursion */ if (is_legacy) { MenuMenu *submenu = g_slice_new0(MenuMenu); MenuMerge def_files = { .type = MENU_CACHE_TYPE_NONE, .merge_type = MERGE_FILES }; MenuMerge def_menus = { .type = MENU_CACHE_TYPE_NONE, .merge_type = MERGE_MENUS }; submenu->layout = menu->layout; /* copy all */ submenu->layout.items = g_list_prepend(g_list_prepend(NULL, &def_files), &def_menus); submenu->layout.inline_limit_is_set = TRUE; /* marker */ submenu->name = g_strdup(name); submenu->dir = g_intern_string(filename); menu->children = g_list_append(menu->children, submenu); } else { g_string_append(prefix, name); g_string_append_c(prefix, '-'); name = g_intern_string(filename); /* a little trick here - we insert new node after this one */ lptr = g_list_insert_before(lptr, lptr->next, (gpointer)name); _fill_apps_from_dir(menu, lptr->next, prefix, FALSE); g_string_truncate(prefix, prefix_len); } } else if (!g_str_has_suffix(name, ".desktop") ||
static void gst_disk_cache_op_chunk(GList** clist, DiskChunk* dchk, gint64 chunk_offset, glong size, gboolean use) { GList* theone; DiskChunk* newchk; theone = g_list_find(*clist, dchk); if (!theone) return ; g_assert(dchk->in_use == !use); if( chunk_offset > 0 ) { newchk = g_slice_alloc0(sizeof(DiskChunk)); newchk->start_pos = dchk->start_pos; newchk->size_in_bytes = chunk_offset; newchk->in_use = !use; *clist = g_list_insert_before(*clist, theone,newchk); dchk->start_pos += chunk_offset; dchk->size_in_bytes -= chunk_offset; } dchk->in_use = use; if( dchk->size_in_bytes > size ) { newchk = g_slice_alloc0(sizeof(DiskChunk)); newchk->start_pos = dchk->start_pos+size; newchk->size_in_bytes = dchk->size_in_bytes-size; newchk->in_use = !use; *clist = g_list_insert_before(*clist, theone->next, newchk); } dchk->size_in_bytes = size; gst_disk_cache_merge_chunk(clist); }
/** * gst_buffer_list_iterator_add: * @it: a #GstBufferListIterator * @buffer: a #GstBuffer * * Inserts @buffer into the #GstBufferList iterated with @it. The buffer is * inserted into the current group, immediately before the buffer that would be * returned by gst_buffer_list_iterator_next(). The buffer is inserted before * the implicit cursor, a subsequent call to gst_buffer_list_iterator_next() * will return the buffer after the inserted buffer, if any. * * This function takes ownership of @buffer. * * Since: 0.10.24 */ void gst_buffer_list_iterator_add (GstBufferListIterator * it, GstBuffer * buffer) { g_return_if_fail (it != NULL); g_return_if_fail (buffer != NULL); /* adding before the first group start is not allowed */ g_return_if_fail (it->next != it->list->buffers); /* cheap insert into the GList */ it->list->buffers = g_list_insert_before (it->list->buffers, it->next, buffer); }
static __inline__ NmpNetPackInfo * nmp_net_packet_enqueue(NmpPacketFrags *frags, NmpNetPackInfo *np) { NmpNetPackInfo *np_copy, *np_ret; GList *next; np_copy = nmp_net_packet_copy_npi(np); if (G_UNLIKELY(!np_copy)) { nmp_warning( "copy npi failed while enqueue packet!" ); return np; /* return the original one */ } if (!frags->eat) { frags->packets = g_list_prepend( frags->packets, np_copy ); } else { next = g_list_find_custom( frags->packets, (gpointer)np->packet_no, nmp_net_packet_find_next_one ); frags->packets = g_list_insert_before( frags->packets, next, np_copy ); } ++frags->eat; frags->total_size += np->size; if (frags->eat >= frags->total) { np_ret = nmp_net_packet_linearize(frags); if (!np_ret) np_ret = np; return np_ret; } return NULL; }
/** * gst_buffer_list_iterator_add_group: * @it: a #GstBufferListIterator * * Inserts a new, empty group into the #GstBufferList iterated with @it. The * group is inserted immediately before the group that would be returned by * gst_buffer_list_iterator_next_group(). A subsequent call to * gst_buffer_list_iterator_next_group() will advance the iterator to the group * after the inserted group, if any. * * Since: 0.10.24 */ void gst_buffer_list_iterator_add_group (GstBufferListIterator * it) { g_return_if_fail (it != NULL); /* advance iterator to next group start */ while (it->next != NULL && it->next->data != GROUP_START) { it->next = g_list_next (it->next); } /* cheap insert of a group start into the GList */ it->list->buffers = g_list_insert_before (it->list->buffers, it->next, GROUP_START); }
/** * _gdk_event_queue_insert_after: * @display: a #GdkDisplay * @sibling: Append after this event. * @event: Event to append. * * Appends an event before the specified event, or if it isn't in * the queue, onto the tail of the event queue. * * Returns: the newly appended list node. * * Since: 2.16 */ GList* _gdk_event_queue_insert_before (GdkDisplay *display, GdkEvent *sibling, GdkEvent *event) { GList *next = g_list_find (display->queued_events, sibling); if (next) { display->queued_events = g_list_insert_before (display->queued_events, next, event); return next->prev; } else return _gdk_event_queue_append (display, event); }
void agregar_organismo (organismo* cel) { assert(cel->size); REC_cel_creada(cel->size); GList *lpadre = NULL; pthread_mutex_lock(&add_f); lpadre = g_list_find(slicer_list, cel->padre); if (lpadre==NULL) { slicer_list= g_list_append(slicer_list,cel); } else slicer_list=g_list_insert_before(slicer_list, lpadre ,cel); reaper_list= g_slist_append(reaper_list,cel); pthread_mutex_unlock(&add_f); }
void _p2tr_point_insert_edge (P2trPoint *self, P2trEdge *e) { GList *iter = self->outgoing_edges; /* Remember: Edges are sorted in ASCENDING angle! */ while (iter != NULL && ((P2trEdge*)iter->data)->angle < e->angle) iter = iter->next; self->outgoing_edges = g_list_insert_before (self->outgoing_edges, iter, e); p2tr_edge_ref (e); }
void UndoRedoHandler::addUndoActionBefore(UndoAction * action, UndoAction * before) { XOJ_CHECK_TYPE(UndoRedoHandler); GList * data = g_list_find(this->undoList, before); if (!data) { addUndoAction(action); return; } this->undoList = g_list_insert_before(this->undoList, data, action); clearRedo(); fireUpdateUndoRedoButtons(action->getPages()); PRINTCONTENTS(); }
/** * _gdk_event_queue_insert_after: * @display: a #GdkDisplay * @sibling: Append after this event. * @event: Event to append. * * Appends an event after the specified event, or if it isn't in * the queue, onto the tail of the event queue. * * Returns: the newly appended list node. * * Since: 2.16 */ GList* _gdk_event_queue_insert_after (GdkDisplay *display, GdkEvent *sibling, GdkEvent *event) { GList *prev = g_list_find (display->queued_events, sibling); if (prev && prev->next) { display->queued_events = g_list_insert_before (display->queued_events, prev->next, event); return prev->next; } else return _gdk_event_queue_append (display, event); }
static GList * list_insert_local_ca (GList *list, CodecAssociation *ca) { if (codec_association_is_valid_for_sending (ca, TRUE)) { GList *item; for (item = list; item; item = item->next) if (!codec_association_is_valid_for_sending (item->data, TRUE)) break; if (item) return g_list_insert_before (list, item, ca); } return g_list_append (list, ca); }
/* Returns the newly-created provider node */ static GList * create_provider_info (GtkSourceCompletionModel *model, GtkSourceCompletionProvider *provider) { ProviderInfo *info; gint priority; GList *l; GList *provider_node; /* Create the structure */ info = g_slice_new0 (ProviderInfo); info->model = model; info->completion_provider = g_object_ref (provider); info->proposals = g_queue_new (); info->visible = is_provider_visible (model, provider); /* Insert the ProviderInfo in the list */ priority = gtk_source_completion_provider_get_priority (provider); for (l = model->priv->providers; l != NULL; l = l->next) { ProviderInfo *cur_info = l->data; gint cur_priority = gtk_source_completion_provider_get_priority (cur_info->completion_provider); if (cur_priority < priority) { break; } } model->priv->providers = g_list_insert_before (model->priv->providers, l, info); provider_node = g_list_find (model->priv->providers, info); /* Insert the header if needed */ if (model->priv->show_headers) { add_header (provider_node); } return provider_node; }
static GomNode * gom_noodle_insert_before (GomNode *node, GomNode *new_child, GomNode *ref_child, GError **error) { GomNoodlePrivate *priv = PRIV (node); GList *li; li = find_node (node, ref_child, error); if (li) { priv->children = g_list_insert_before (priv->children, li, g_object_ref (new_child)); priv->dirty_children = 1; if (GOM_IS_NODE_INTERNAL (new_child)) { gom_node_internal_set_parent (GOM_NODE_INTERNAL (new_child), node); } } return ref_child; }
static void gst_disk_cache_add_data_chunk(GList ** clist, DiskChunk* dchk) { GList* tmp; DiskChunk* dc ; tmp = *clist; while(tmp) { dc = (DiskChunk*)(tmp->data); if( dc->start_pos > dchk->start_pos ) break; tmp = g_list_next(tmp); } *clist = g_list_insert_before(*clist, tmp, dchk); gst_disk_cache_merge_chunk(clist); }
void ptk_file_list_file_created( VFSDir* dir, VFSFileInfo* file, PtkFileList* list ) { GList* l; GtkTreeIter it; GtkTreePath* path; VFSFileInfo* file2; if( ! list->show_hidden && vfs_file_info_get_name(file)[0] == '.' ) return; for( l = list->files; l; l = l->next ) { file2 = (VFSFileInfo*)l->data; if( G_UNLIKELY( file == file2 || ptk_file_list_compare( file2, file, list ) == 0 ) ) { /* The file is already in the list */ return; } if( ptk_file_list_compare( file2, file, list ) > 0 ) { break; } } list->files = g_list_insert_before( list->files, l, vfs_file_info_ref( file ) ); ++list->n_files; if( l ) l = l->prev; else l = g_list_last( list->files ); it.stamp = list->stamp; it.user_data = l; it.user_data2 = file; path = gtk_tree_path_new_from_indices( g_list_index(list->files, l->data), -1 ); gtk_tree_model_row_inserted( GTK_TREE_MODEL(list), path, &it ); gtk_tree_path_free( path ); }
static void recreate_hits (GtkWidget* widget, gpointer user_data) { GdkEventMotion* event; gpointer container; GList **hits; gdouble x; gdouble y; gint x_i; gint y_i; hits = user_data; event = (*hits)->data; x = event->x; y = event->y; gdk_window_get_user_data (event->window, &container); gtk_widget_translate_coordinates (container, widget, x - GTK_WIDGET (container)->allocation.x, y - GTK_WIDGET (container)->allocation.y, &x_i, &y_i); event->x = x_i + widget->allocation.x; event->y = y_i + widget->allocation.y; if (progress_shaped_test_hit (PROGRESS_SHAPED (widget), event)) { if (G_UNLIKELY ((*hits)->next)) { *hits = g_list_insert_before (*hits, (*hits)->next, g_object_ref (widget)); } else { *hits = g_list_append (*hits, g_object_ref (widget)); } } event->x = x; event->y = y; }
static void create_notebook_page_accessible (GailNotebook *gail_notebook, GtkNotebook *notebook, gint index, gboolean insert_before, GList *list) { AtkObject *obj; obj = gail_notebook_page_new (notebook, index); g_object_ref (obj); if (insert_before) gail_notebook->page_cache = g_list_insert_before (gail_notebook->page_cache, list, obj); else gail_notebook->page_cache = g_list_append (gail_notebook->page_cache, obj); g_signal_connect (gtk_notebook_get_nth_page (notebook, index), "parent_set", G_CALLBACK (gail_notebook_child_parent_set), obj); }