void receive_timeSeries_drag(GtkWidget *src, GdkDragContext *context, int x, int y, const GtkSelectionData *data, unsigned int info, unsigned int event_time, gpointer *udata) { splotd *to = GGOBI_SPLOT(src), *from, *sp; displayd *display; display = to->displayptr; GList *l; gint k; GList *ivars = NULL; gint xvar; from = GGOBI_SPLOT(gtk_drag_get_source_widget(context)); if(from->displayptr != display) { gg_write_to_statusbar("the source and destination of the parallel coordinate plots are not from the same display.\n", display->ggobi); return; } /* Get the x variable */ sp = (splotd *) (display->splots)->data; xvar = sp->xyvars.x; /* Gather a list of indices of the vertically plotted variables */ l = display->splots; while (l) { sp = (splotd *) l->data; ivars = g_list_append(ivars, GINT_TO_POINTER(sp->xyvars.y)); l = l->next; } /* Find the index of the to element */ k = g_list_index(ivars, GINT_TO_POINTER(to->xyvars.y)); /* Remove the from element */ ivars = g_list_remove(ivars, GINT_TO_POINTER(from->xyvars.y)); /* Insert the from element in the position of the to element */ ivars = g_list_insert(ivars, GINT_TO_POINTER(from->xyvars.y), k); /* Assign them to the existing plots */ k = 0; l = display->splots; while (l) { sp = (splotd *) l->data; sp->xyvars.y = GPOINTER_TO_INT(g_list_nth_data(ivars, k)); k++; l = l->next; } g_list_free(ivars); display_tailpipe (display, FULL, display->ggobi); varpanel_refresh (display, display->ggobi); }
GList *command_insert (int fd, GList *queue, const char *filename, int pos, int *playing_mpeg, int max_pos) { GList *q = queue; VTmpeg *mpeg = (VTmpeg *) malloc (sizeof (VTmpeg)); if (pos > max_pos) pos = 0; /* nunca adiciona na posição que está sendo passada */ if (*playing_mpeg == pos) { dprintf (fd, "%c\nPosition busy.\n%c\n", COMMAND_ERROR, COMMAND_DELIM); return NULL; } if (mpeg == NULL) { dprintf (fd, "%c\nNot enough memory, server shutting down.\n%c\n", COMMAND_ERROR, COMMAND_DELIM); exit (1); /* guarda o nome do filename */ } else { memset (mpeg, 0, sizeof (VTmpeg)); strncpy (mpeg->filename, filename, sizeof (mpeg->filename)); } #if 0 /* testa o mpeg, sem audio */ mpeg->mpeg = SMPEG_new (filename, &mpeg->info, 0); if ((error = SMPEG_error (mpeg->mpeg))) { dprintf (fd, "%c\n%s\n%c\n", COMMAND_ERROR, error, COMMAND_DELIM); return NULL; } #endif if (!pos) q = g_list_append (q, mpeg); else { if (*playing_mpeg > pos) *playing_mpeg += 1; q = g_list_insert (q, mpeg, (pos - 1)); } if (q == NULL) { dprintf (fd, "%c\nCannot %s on the list.\n%c\n", COMMAND_ERROR, !pos ? "append" : "insert", COMMAND_DELIM); return NULL; } dprintf (fd, "%c\nFilename %s OK\n%c\n", COMMAND_OK, filename, COMMAND_DELIM); return q; }
/******************************************************************************* * Description : * Argurments : * Return value : * Modify : * warning : *******************************************************************************/ static ListNode* list_insert(ListHandle handle, void *data, int size, int index) { gpointer ptr; if(!handle->link_only) { ptr = g_memdup(data, size); } else { ptr = data; } handle->list = g_list_insert(handle->list, ptr, index); return g_list_nth(handle->list, index); }
void playlist_queue_move(int oldpos, int newpos) { GList *tmp; PL_LOCK(); tmp = g_list_nth(queued_list, oldpos); queued_list = g_list_remove_link (queued_list, tmp); queued_list = g_list_insert(queued_list, tmp->data, newpos); g_list_free_1 (tmp); PL_UNLOCK(); playlistwin_update_list(); }
static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel) { GList *tmp; int inspos; g_return_if_fail(window != NULL); if (settings_get_bool("actlist_moves")) { /* Move the window to the first in the activity list */ if (g_list_find(activity_list, window) != NULL) activity_list = g_list_remove(activity_list, window); if (window->data_level != 0) activity_list = g_list_prepend(activity_list, window); statusbar_items_redraw("act"); return; } if (g_list_find(activity_list, window) != NULL) { /* already in activity list */ if (window->data_level == 0) { /* remove from activity list */ activity_list = g_list_remove(activity_list, window); statusbar_items_redraw("act"); } else if (window->data_level != GPOINTER_TO_INT(oldlevel) || window->hilight_color != 0) { /* different level as last time (or maybe different hilight color?), just redraw it. */ statusbar_items_redraw("act"); } return; } if (window->data_level == 0) return; /* add window to activity list .. */ inspos = 0; for (tmp = activity_list; tmp != NULL; tmp = tmp->next, inspos++) { WINDOW_REC *rec = tmp->data; if (window->refnum < rec->refnum) { activity_list = g_list_insert(activity_list, window, inspos); break; } } if (tmp == NULL) activity_list = g_list_append(activity_list, window); statusbar_items_redraw("act"); }
static GList * prioritize_extension (GstObject * obj, GList * type_list, const gchar * extension) { gint pos = 0; GList *next, *l; if (!extension) return type_list; /* move the typefinders for the extension first in the list. The idea is that * when one of them returns MAX we don't need to search further as there is a * very high chance we got the right type. */ GST_LOG_OBJECT (obj, "sorting typefind for extension %s to head", extension); for (l = type_list; l; l = next) { const gchar *const *ext; GstTypeFindFactory *factory; next = l->next; factory = GST_TYPE_FIND_FACTORY (l->data); ext = gst_type_find_factory_get_extensions (factory); if (ext == NULL) continue; GST_LOG_OBJECT (obj, "testing factory %s for extension %s", GST_OBJECT_NAME (factory), extension); while (*ext != NULL) { if (strcmp (*ext, extension) == 0) { /* found extension, move in front */ GST_LOG_OBJECT (obj, "moving typefind for extension %s to head", extension); /* remove entry from list */ type_list = g_list_delete_link (type_list, l); /* insert at the position */ type_list = g_list_insert (type_list, factory, pos); /* next element will be inserted after this one */ pos++; break; } ++ext; } } return type_list; }
static void gimp_list_reorder (GimpContainer *container, GimpObject *object, gint new_index) { GimpList *list = GIMP_LIST (container); list->list = g_list_remove (list->list, object); if (new_index == -1 || new_index == container->num_children - 1) list->list = g_list_append (list->list, object); else list->list = g_list_insert (list->list, object, new_index); }
void NedDeleteSystemCommand::unexecute(bool adjust /* = false */) { #ifdef UNEXECUTE_DEBUG printf("\tNedDeleteSystemCommand::unexecute\n"); #endif m_page->m_systems = g_list_insert(m_page->m_systems, m_system, m_position); if ((m_systems_pointer = g_list_find(m_page->m_systems, m_system)) == NULL) { NedResource::Abort("NedDeleteSystemCommand::unexecute"); } /* if (adjust) { m_page->placeStaffs(1); } */ }
extern void pitch_cursor_move_after(Score_t *score, Staff_t *staff, Object_t *object) { Object_t *object_data; gint oid; object_data = object_get_pitch_cursor(score, staff); staff->Object_list = g_list_remove(staff->Object_list, object_data); oid = object_get_index(staff, object); staff->Object_list = g_list_insert(staff->Object_list, object_data, oid + 1); }
void add_directory_content(GNode *directory) { GNode *file_ptr, *directory_sibling; int position; directory_sibling = get_next_file_not_deepper(directory); for (position = g_list_position(lines, FILE(directory)->line) + 1, file_ptr = g_node_first_child(directory); file_ptr != NULL && file_ptr != directory_sibling; position++, file_ptr = get_next_file(file_ptr)) { lines = g_list_insert(lines, file_ptr, position); FILE(file_ptr)->line = g_list_nth(lines, position); } }
void NedInsertTiedElementCommand::execute(bool adjust /* = false */) { int pos; #ifdef EXECUTE_DEBUG printf("\tNedInsertTiedElementCommand::execute\n"); #endif if ((pos = g_list_index(m_voice->m_chord_or_rests, m_chord_or_rest)) < 0) { // friend !! NedResource::Abort("NedInsertTiedElementCommand::execute"); } m_voice->m_chord_or_rests = g_list_insert(m_voice->m_chord_or_rests, m_new_chord_or_rest, pos + 1); // friend !! m_chord_or_rest->tieCompleteTo(m_new_chord_or_rest, true); if (adjust) { m_chord_or_rest->getMainWindow()->setVisible(m_chord_or_rest); } }
static void __playlist_ins_with_info(char *filename, long pos, char* title, int len) { PlaylistEntry *entry; entry = g_malloc0(sizeof (PlaylistEntry)); entry->filename = g_strdup(filename); if (title) entry->title = g_strdup(title); entry->length = len; PL_LOCK(); playlist = g_list_insert(playlist, entry, pos); PL_UNLOCK(); playlist_get_info_scan_active = TRUE; }
/** * itdb_photodb_photoalbum_create: * @db: The database to create a new album in * @albumname: the name of the new album * @pos: position where to insert the newly created album (-1 for * append to end). * * Create and add a new photoalbum. * * Return value: the album which was created and added. */ Itdb_PhotoAlbum *itdb_photodb_photoalbum_create (Itdb_PhotoDB *db, const gchar *albumname, gint pos) { Itdb_PhotoAlbum *album; g_return_val_if_fail (db, NULL); g_return_val_if_fail (albumname, NULL); album = g_new0 (Itdb_PhotoAlbum, 1); album->album_type = 2; /* normal album, set to 1 for Photo Library */ album->name = g_strdup(albumname); db->photoalbums = g_list_insert (db->photoalbums, album, pos); return album; }
gboolean ges_simple_timeline_layer_move_object (GESSimpleTimelineLayer * layer, GESTimelineObject * object, gint newposition) { gint idx; GESSimpleTimelineLayerPrivate *priv = layer->priv; GESTimelineLayer *tl_obj_layer; GST_DEBUG ("layer:%p, object:%p, newposition:%d", layer, object, newposition); tl_obj_layer = ges_timeline_object_get_layer (object); if (G_UNLIKELY (tl_obj_layer != (GESTimelineLayer *) layer)) { GST_WARNING ("TimelineObject doesn't belong to this layer"); if (tl_obj_layer != NULL) g_object_unref (tl_obj_layer); return FALSE; } if (tl_obj_layer != NULL) g_object_unref (tl_obj_layer); /* Find it's current position */ idx = g_list_index (priv->objects, object); if (G_UNLIKELY (idx == -1)) { GST_WARNING ("TimelineObject not controlled by this layer"); return FALSE; } GST_DEBUG ("Object was previously at position %d", idx); /* If we don't have to change its position, don't */ if (idx == newposition) return TRUE; /* pop it off the list */ priv->objects = g_list_remove (priv->objects, object); /* re-add it at the proper position */ priv->objects = g_list_insert (priv->objects, object, newposition); /* recalculate positions */ gstl_recalculate (layer); g_signal_emit (layer, gstl_signals[OBJECT_MOVED], 0, object, idx, newposition); return TRUE; }
static void st_container_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { StContainerPrivate *priv = ST_CONTAINER (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Raise at the top */ if (!sibling) { GList *last_item; last_item = g_list_last (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_append (priv->children, actor); } else { gint pos; pos = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, pos); } /* set Z ordering a value below, this will then call sort * as values are equal ordering shouldn't change but Z * values will be correct. * * FIXME: optimise */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } st_container_update_pseudo_classes (ST_CONTAINER (container)); if (CLUTTER_ACTOR_IS_VISIBLE (container)) clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
/* * Move person's email item. * param: person Person. * itemMove Item to move. * itemTarget Target item after which to move item. */ ItemEMail *addritem_move_email_after( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget ) { gint posT, posM; g_return_val_if_fail( person != NULL, NULL ); if( itemTarget == NULL ) return NULL; if( itemMove == NULL ) return NULL; if( itemMove == itemTarget ) return itemMove; posT = g_list_index( person->listEMail, itemTarget ); if( posT < 0 ) return NULL; posM = g_list_index( person->listEMail, itemMove ); if( posM < 0 ) return NULL; person->listEMail = g_list_remove( person->listEMail, itemMove ); person->listEMail = g_list_insert( person->listEMail, itemMove, 1+posT ); return itemMove; }
static void trackersettings_gui_add_font (TrackerSettings *ts, gchar *fontname, int position) { gchar *insertbuf; GtkListStore *list_store; GtkTreeIter iter; trackersettings_fontlist = g_list_insert(trackersettings_fontlist, fontname, position); insertbuf = fontname; list_store = GUI_GET_LIST_STORE(ts->list); gtk_list_store_insert(list_store, &iter, position); gtk_list_store_set(list_store, &iter, 0, insertbuf, -1); }
int main(int argc, char** argv) { GList* list = NULL; list = g_list_append(list, "Austin "); printf("The first item is '%s'\n", list->data); list = g_list_insert(list, "Baltimore ", 1); printf("The second item is '%s'\n", g_list_next(list)->data); list = g_list_remove(list, "Baltimore "); printf("After removal of 'Baltimore', the list length is %d\n", g_list_length(list)); GList* other_list = g_list_append(NULL, "Baltimore "); list = g_list_concat(list, other_list); printf("After concatenation: "); g_list_foreach(list, (GFunc)printf, NULL); list = g_list_reverse(list); printf("\nAfter reversal: "); g_list_foreach(list, (GFunc)printf, NULL); g_list_free(list); return 0; }
void jack_rack_move_plugin_slot (jack_rack_t * jack_rack, plugin_slot_t * plugin_slot, gint up) { gint index; index = g_list_index (jack_rack->slots, plugin_slot); jack_rack->slots = g_list_remove (jack_rack->slots, plugin_slot); if (up) index--; else index++; jack_rack->slots = g_list_insert (jack_rack->slots, plugin_slot, index); gtk_box_reorder_child (GTK_BOX (jack_rack->ui->plugin_box), plugin_slot->main_vbox, index); }
static void clutter_group_real_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Raise at the top */ if (!sibling) { GList *last_item; last_item = g_list_last (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_append (priv->children, actor); } else { gint index_ = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, index_); } /* set Z ordering a value below, this will then call sort * as values are equal ordering shouldn't change but Z * values will be correct. * * FIXME: get rid of this crap; this is so utterly broken and wrong on * so many levels it's not even funny. sadly, we get to keep this until * we can break API and remove Group for good. */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
static void add_node (ChamplainPathLayer *layer, ChamplainLocation *location, gboolean prepend, guint position) { ChamplainPathLayerPrivate *priv = layer->priv; g_signal_connect (G_OBJECT (location), "notify::latitude", G_CALLBACK (position_notify), layer); g_object_ref_sink (location); if (prepend) priv->nodes = g_list_prepend (priv->nodes, location); else priv->nodes = g_list_insert (priv->nodes, location, position); schedule_redraw (layer); }
int ags_machine_popup_reposition_audio_response_callback(GtkWidget *widget, gint response, AgsMachine *machine) { if(response == GTK_RESPONSE_ACCEPT){ AgsAudio *audio; AgsApplicationContext *application_context; GList *children; GList *start_list; gint new_position; application_context = ags_application_context_get_instance(); audio = machine->audio; start_list = ags_sound_provider_get_audio(AGS_SOUND_PROVIDER(application_context)); children = gtk_container_get_children((GtkContainer *) GTK_DIALOG(widget)->vbox); new_position = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(children->data)); start_list = g_list_remove(start_list, audio); start_list = g_list_insert(start_list, audio, new_position); ags_sound_provider_set_audio(AGS_SOUND_PROVIDER(application_context), start_list); g_list_foreach(start_list, (GFunc) g_object_unref, NULL); g_list_free(children); } machine->reposition_audio = NULL; gtk_widget_destroy(widget); return(0); }
/** * glide_document_insert_slide: * @document: A #GlideDocument * @after: The slide index to insert after. * * Creates and inserts a new #GlideSlide in @document, after * the slide at index @after. * * Return value: The newly created #GlideSlide */ GlideSlide * glide_document_insert_slide (GlideDocument *document, gint after) { GlideSlide *s; g_return_val_if_fail (GLIDE_IS_DOCUMENT (document), NULL); g_return_val_if_fail (after < g_list_length (document->priv->slides), NULL); s = glide_slide_new (document); document->priv->slides = g_list_insert (document->priv->slides, s, after+1); glide_slide_set_index (s, after+1); glide_document_update_slide_indices (document); g_signal_emit (document, document_signals[SLIDE_ADDED], 0, s); return s; }
void ss_workspace_reorder_window (SSWorkspace *workspace, SSWindow *window, int new_index) { int n; if (window == NULL) { return; } n = g_list_length (workspace->windows); if (new_index < 0) { new_index = 0; } if (new_index > n) { new_index = n; } workspace->windows = g_list_remove (workspace->windows, window); workspace->windows = g_list_insert (workspace->windows, window, new_index); workspace_remove_window_widgets (workspace); workspace_add_window_widgets (workspace); }
static void st_container_lower (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { StContainerPrivate *priv = ST_CONTAINER (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Push to bottom */ if (!sibling) { GList *last_item; last_item = g_list_first (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_prepend (priv->children, actor); } else { gint pos; pos = g_list_index (priv->children, sibling); priv->children = g_list_insert (priv->children, actor, pos); } /* See comment in st_container_raise() for this */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } st_container_update_pseudo_classes (ST_CONTAINER (container)); if (CLUTTER_ACTOR_IS_VISIBLE (container)) clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
static void clutter_group_real_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Raise at the top */ if (!sibling) { GList *last_item; last_item = g_list_last (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_append (priv->children, actor); } else { gint index_ = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, index_); } /* set Z ordering a value below, this will then call sort * as values are equal ordering shouldn't change but Z * values will be correct. * * FIXME: optimise */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
static void clutter_box_real_lower (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterBoxPrivate *priv = CLUTTER_BOX (container)->priv; priv->children = g_list_remove (priv->children, actor); if (sibling == NULL) priv->children = g_list_prepend (priv->children, actor); else { gint index_ = g_list_index (priv->children, sibling); priv->children = g_list_insert (priv->children, actor, index_); } clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); }
void PdfCache::cache(XojPopplerPage * popplerPage, cairo_surface_t * img) { XOJ_CHECK_TYPE(PdfCache); PdfCacheEntry * ne = new PdfCacheEntry(popplerPage, img); this->data = g_list_insert(this->data, ne, 0); int i = 0; for (GList * l = this->data; l != NULL; i++) { PdfCacheEntry * e = (PdfCacheEntry *) l->data; XOJ_CHECK_TYPE_OBJ(e, PdfCacheEntry); GList * le = l; l = l->next; if (i >= this->size) { delete e; this->data = g_list_delete_link(this->data, le); } } }
static void penge_block_container_lower (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { PengeBlockContainerPrivate *priv = GET_PRIVATE (container); priv->children = g_list_remove (priv->children, actor); if (sibling == NULL) priv->children = g_list_prepend (priv->children, actor); else { gint index_ = g_list_index (priv->children, sibling); priv->children = g_list_insert (priv->children, actor, index_); } clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); }
static void phase_cmd_remove_undo (PlannerCmd *cmd_base) { PhaseCmdRemove *cmd; GList *list; cmd = (PhaseCmdRemove*) cmd_base; g_assert (cmd->phase); g_object_get (cmd->project, "phases", &list, NULL); list = g_list_insert (list, g_strdup (cmd->phase), cmd->position); g_object_set (cmd->project, "phases", list, NULL); mrp_string_list_free (list); if (cmd->is_assigned) { mrp_object_set (cmd->project, "phase", cmd->phase, NULL); } }