+
+/**
+ * g_queue_peek_nth:
+ * @queue: a #GQueue
+ * @n: the position of the element
+ *
+ * Returns the @n'th element of @queue.
+ *
+ * Returns: the data for the @n'th element of @queue,
+ * or %NULL if @n is off the end of @queue
+ *
+ * Since: 2.4
+ */
+gpointer
+g_queue_peek_nth (GQueue *queue,
+ guint n)
+{
+ GList *link;
+
+ g_return_val_if_fail (queue != NULL, NULL);
+
+ link = g_queue_peek_nth_link (queue, n);
+
+ if (link)
+ return link->data;
+
+ return NULL;
+}
+
+/**
+ * g_queue_index:
+ * @queue: a #GQueue
+ * @data: the data to find
+ *
+ * Returns the position of the first element in @queue which contains @data.
+ *
+ * Returns: the position of the first element in @queue which
+ * contains @data, or -1 if no element in @queue contains @data
+ *
+ * Since: 2.4
+ */
+gint
+g_queue_index (GQueue *queue,
+ gconstpointer data)
+{
+ g_return_val_if_fail (queue != NULL, -1);
+
+ return g_list_index (queue->head, data);
+}
+
+/**
+ * g_queue_remove:
+ * @queue: a #GQueue
+ * @data: the data to remove
+ *
+ * Removes the first element in @queue that contains @data.
+ *
+ * Returns: %TRUE if @data was found and removed from @queue
+ *
+ * Since: 2.4
+ */
+gboolean
+g_queue_remove (GQueue *queue,
+ gconstpointer data)
+{
+ GList *link;
+
+ g_return_val_if_fail (queue != NULL, FALSE);
+
+ link = g_list_find (queue->head, data);
+
+ if (link)
+ g_queue_delete_link (queue, link);
+
+ return (link != NULL);
+}
+
+/**
+ * g_queue_remove_all:
+ * @queue: a #GQueue
+ * @data: the data to remove
+ *
+ * Remove all elements whose data equals @data from @queue.
+ *
+ * Returns: the number of elements removed from @queue
+ *
+ * Since: 2.4
+ */
+guint
+g_queue_remove_all (GQueue *queue,
+ gconstpointer data)
+{
+ GList *list;
+ guint old_length;
+
+ g_return_val_if_fail (queue != NULL, 0);
+
+ old_length = queue->length;
+
+ list = queue->head;
+ while (list)
+ {
+ GList *next = list->next;
+
+ if (list->data == data)
+ g_queue_delete_link (queue, list);
+
+ list = next;
+ }
+
+ return (old_length - queue->length);
+}
+
+/**
+ * g_queue_insert_before:
+ * @queue: a #GQueue
+ * @sibling: a #GList link that must 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++;
+}
+
+/**
+ * g_queue_insert_after:
+ * @queue: a #GQueue
+ * @sibling: a #GList link that must be part of @queue
+ * @data: the data to insert
+ *
+ * Inserts @data into @queue after @sibling
+ *
+ * @sibling must be part of @queue
+ *
+ * Since: 2.4
+ */
+void
+g_queue_insert_after (GQueue *queue,
+ GList *sibling,
+ gpointer data)
+{
+ g_return_if_fail (queue != NULL);
+ g_return_if_fail (sibling != NULL);
+
+ if (sibling == queue->tail)
+ g_queue_push_tail (queue, data);
+ else
+ g_queue_insert_before (queue, sibling->next, data);
+}
+
+/**
+ * g_queue_insert_sorted:
+ * @queue: a #GQueue
+ * @data: the data to insert
+ * @func: the #GCompareDataFunc used to compare elements in the queue. It is
+ * called with two elements of the @queue and @user_data. It should
+ * return 0 if the elements are equal, a negative value if the first
+ * element comes before the second, and a positive value if the second
+ * element comes before the first.
+ * @user_data: user data passed to @func
+ *
+ * Inserts @data into @queue using @func to determine the new position.
+ *
+ * Since: 2.4
+ */
+void
+g_queue_insert_sorted (GQueue *queue,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data)
+{
+ GList *list;
+
+ g_return_if_fail (queue != NULL);
+
+ list = queue->head;
+ while (list && func (list->data, data, user_data) < 0)
+ list = list->next;
+
+ if (list)
+ g_queue_insert_before (queue, list, data);
+ else
+ g_queue_push_tail (queue, data);
+}