[gnome-photos] base-item: Thumbnail local items before remote ones
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Thumbnail local items before remote ones
- Date: Mon, 23 Feb 2015 16:05:31 +0000 (UTC)
commit c892f156fb486e541d17849c49adf00fd823f486
Author: Pranav Kant <pranavk src gnome org>
Date: Mon Feb 23 15:34:35 2015 +0100
base-item: Thumbnail local items before remote ones
https://bugzilla.gnome.org/show_bug.cgi?id=740425
src/photos-base-item.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 88547a3..e301e20 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2014 Pranav Kant
+ * Copyright © 2014, 2015 Pranav Kant
* Copyright © 2012, 2013, 2014 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
@@ -41,6 +41,7 @@
#include "photos-delete-item-job.h"
#include "photos-filterable.h"
#include "photos-icons.h"
+#include "photos-local-item.h"
#include "photos-print-notification.h"
#include "photos-print-operation.h"
#include "photos-query.h"
@@ -347,6 +348,27 @@ photos_base_item_create_thumbnail_in_thread_func (gpointer data, gpointer user_d
}
+static gint
+photos_base_item_create_thumbnail_sort_func (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ GTask *task_a = G_TASK (a);
+ GTask *task_b = G_TASK (b);
+ PhotosBaseItem *item_a;
+ PhotosBaseItem *item_b;
+ gint ret_val = 0;
+
+ item_a = PHOTOS_BASE_ITEM (g_task_get_source_object (task_a));
+ item_b = PHOTOS_BASE_ITEM (g_task_get_source_object (task_b));
+
+ if (PHOTOS_IS_LOCAL_ITEM (item_a))
+ ret_val = -1;
+ else if (PHOTOS_IS_LOCAL_ITEM (item_b))
+ ret_val = 1;
+
+ return ret_val;
+}
+
+
static void
photos_base_item_create_thumbnail_async (PhotosBaseItem *self,
GCancellable *cancellable,
@@ -1094,6 +1116,9 @@ photos_base_item_class_init (PhotosBaseItemClass *class)
1,
FALSE,
NULL);
+ g_thread_pool_set_sort_function (create_thumbnail_pool,
+ (GCompareDataFunc) photos_base_item_create_thumbnail_sort_func,
+ NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]