summaryrefslogtreecommitdiff
path: root/src/nautilus-file-queue.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-08-29 18:24:05 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-08-29 18:37:10 +0200
commit52d960542b4d5fdf2bd06735d0dbf7934cf2ec12 (patch)
tree5e000d5ed40b52b003c02b597e51ae0b87ff22ac /src/nautilus-file-queue.c
parent4cafccd82859a4ee0bdfad3e31a310f2d94c0485 (diff)
downloadnautilus-52d960542b4d5fdf2bd06735d0dbf7934cf2ec12.tar.gz
general: run uncrustify
And make the style of Nautilus the same for all files. Hopefully we can fix all the style issues we can find in the next days, so expect a little of movement on this. https://bugzilla.gnome.org/show_bug.cgi?id=770564
Diffstat (limited to 'src/nautilus-file-queue.c')
-rw-r--r--src/nautilus-file-queue.c146
1 files changed, 77 insertions, 69 deletions
diff --git a/src/nautilus-file-queue.c b/src/nautilus-file-queue.c
index 846b1c4df..026ded1d4 100644
--- a/src/nautilus-file-queue.c
+++ b/src/nautilus-file-queue.c
@@ -1,122 +1,130 @@
/*
- Copyright (C) 2001 Maciej Stachowiak
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- Author: Maciej Stachowiak <mjs@noisehavoc.org>
-*/
+ * Copyright (C) 2001 Maciej Stachowiak
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Maciej Stachowiak <mjs@noisehavoc.org>
+ */
#include <config.h>
#include "nautilus-file-queue.h"
#include <glib.h>
-struct NautilusFileQueue {
- GList *head;
- GList *tail;
- GHashTable *item_to_link_map;
+struct NautilusFileQueue
+{
+ GList *head;
+ GList *tail;
+ GHashTable *item_to_link_map;
};
NautilusFileQueue *
nautilus_file_queue_new (void)
{
- NautilusFileQueue *queue;
-
- queue = g_new0 (NautilusFileQueue, 1);
- queue->item_to_link_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+ NautilusFileQueue *queue;
+
+ queue = g_new0 (NautilusFileQueue, 1);
+ queue->item_to_link_map = g_hash_table_new (g_direct_hash, g_direct_equal);
- return queue;
+ return queue;
}
void
nautilus_file_queue_destroy (NautilusFileQueue *queue)
{
- g_hash_table_destroy (queue->item_to_link_map);
- nautilus_file_list_free (queue->head);
- g_free (queue);
+ g_hash_table_destroy (queue->item_to_link_map);
+ nautilus_file_list_free (queue->head);
+ g_free (queue);
}
void
nautilus_file_queue_enqueue (NautilusFileQueue *queue,
- NautilusFile *file)
+ NautilusFile *file)
{
- if (g_hash_table_lookup (queue->item_to_link_map, file) != NULL) {
- /* It's already on the queue. */
- return;
- }
-
- if (queue->tail == NULL) {
- queue->head = g_list_append (NULL, file);
- queue->tail = queue->head;
- } else {
- queue->tail = g_list_append (queue->tail, file);
- queue->tail = queue->tail->next;
- }
-
- nautilus_file_ref (file);
- g_hash_table_insert (queue->item_to_link_map, file, queue->tail);
+ if (g_hash_table_lookup (queue->item_to_link_map, file) != NULL)
+ {
+ /* It's already on the queue. */
+ return;
+ }
+
+ if (queue->tail == NULL)
+ {
+ queue->head = g_list_append (NULL, file);
+ queue->tail = queue->head;
+ }
+ else
+ {
+ queue->tail = g_list_append (queue->tail, file);
+ queue->tail = queue->tail->next;
+ }
+
+ nautilus_file_ref (file);
+ g_hash_table_insert (queue->item_to_link_map, file, queue->tail);
}
NautilusFile *
nautilus_file_queue_dequeue (NautilusFileQueue *queue)
{
- NautilusFile *file;
+ NautilusFile *file;
- file = nautilus_file_queue_head (queue);
- nautilus_file_queue_remove (queue, file);
+ file = nautilus_file_queue_head (queue);
+ nautilus_file_queue_remove (queue, file);
- return file;
+ return file;
}
void
nautilus_file_queue_remove (NautilusFileQueue *queue,
- NautilusFile *file)
+ NautilusFile *file)
{
- GList *link;
+ GList *link;
- link = g_hash_table_lookup (queue->item_to_link_map, file);
+ link = g_hash_table_lookup (queue->item_to_link_map, file);
- if (link == NULL) {
- /* It's not on the queue */
- return;
- }
+ if (link == NULL)
+ {
+ /* It's not on the queue */
+ return;
+ }
- if (link == queue->tail) {
- /* Need to special-case removing the tail. */
- queue->tail = queue->tail->prev;
- }
+ if (link == queue->tail)
+ {
+ /* Need to special-case removing the tail. */
+ queue->tail = queue->tail->prev;
+ }
- queue->head = g_list_remove_link (queue->head, link);
- g_list_free (link);
- g_hash_table_remove (queue->item_to_link_map, file);
+ queue->head = g_list_remove_link (queue->head, link);
+ g_list_free (link);
+ g_hash_table_remove (queue->item_to_link_map, file);
- nautilus_file_unref (file);
+ nautilus_file_unref (file);
}
NautilusFile *
nautilus_file_queue_head (NautilusFileQueue *queue)
{
- if (queue->head == NULL) {
- return NULL;
- }
+ if (queue->head == NULL)
+ {
+ return NULL;
+ }
- return NAUTILUS_FILE (queue->head->data);
+ return NAUTILUS_FILE (queue->head->data);
}
gboolean
nautilus_file_queue_is_empty (NautilusFileQueue *queue)
{
- return (queue->head == NULL);
+ return (queue->head == NULL);
}