--- /home/chpe/source/gnome-2/trunk/epiphany/lib//widgets/ephy-spinner.c 2008-02-17 19:43:11.000000000 +0100
+++ e 2008-09-05 15:06:38.000000000 +0200
@@ -1,4 +1,25 @@
/*
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see
+ *
+ *
+ * Authors:
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+/*
* Copyright © 2000 Eazel, Inc.
* Copyright © 2002-2004 Marco Pesenti Gritti
* Copyright © 2004, 2006 Christian Persch
@@ -21,20 +42,22 @@
*
* Ephy port by Marco Pesenti Gritti
*
- * $Id: ephy-spinner.c 6952 2007-03-11 19:42:02Z chpe $
+ * $Id: e-spinner.c 12639 2006-12-12 17:06:55Z chpe $
+ */
+
+/*
+ * From Nautilus ephy-spinner.c
*/
-#ifndef COMPILING_TESTSPINNER
#include "config.h"
-#include "ephy-debug.h"
-#endif
-#include "ephy-spinner.h"
+#include "e-spinner.h"
-#include
-#include
-#include
-#include
+#define LOG(msg, args...)
+#define START_PROFILER(name)
+#define STOP_PROFILER(name)
+
+#include "e-util/e-icon-factory.h"
/* Spinner cache implementation */
@@ -96,6 +119,7 @@
static void ephy_spinner_cache_init (EphySpinnerCache *cache);
static GObjectClass *ephy_spinner_cache_parent_class;
+static gpointer spinner_cache = NULL;
static GType
ephy_spinner_cache_get_type (void)
@@ -216,8 +240,7 @@
if (pw != dw || ph != dh)
{
- result = gdk_pixbuf_scale_simple (pixbuf, dw, dh,
- GDK_INTERP_BILINEAR);
+ result = e_icon_factory_pixbuf_scale (pixbuf, dw, dh);
g_object_unref (pixbuf);
return result;
}
@@ -264,7 +287,10 @@
goto loser;
}
}
- g_assert (icon_info != NULL);
+ if (icon_info == NULL) {
+ g_warning ("icon_info is NULL");
+ goto loser;
+ }
size = gtk_icon_info_get_base_size (icon_info);
icon = gtk_icon_info_get_filename (icon_info);
@@ -304,8 +330,7 @@
g_object_unref (icon_pixbuf);
- if (list == NULL) goto loser;
- g_assert (n > 0);
+ if (list == NULL || n <= 0) goto loser;
if (size > requested_size)
{
@@ -327,10 +352,12 @@
for (l = list; l != NULL; l = l->next)
{
- g_assert (l->data != NULL);
+ if (l->data)
images->animation_pixbufs[--n] = l->data;
}
- g_assert (n == 0);
+ if (n != 0) {
+ g_warning ("n != 0 \n");
+ }
g_slist_free (list);
@@ -475,24 +502,17 @@
g_type_class_add_private (object_class, sizeof (EphySpinnerCachePrivate));
}
-static EphySpinnerCache *spinner_cache = NULL;
-
static EphySpinnerCache *
ephy_spinner_cache_ref (void)
{
- if (spinner_cache == NULL)
+ if (G_UNLIKELY (spinner_cache == NULL))
{
- EphySpinnerCache **cache_ptr;
-
spinner_cache = g_object_new (EPHY_TYPE_SPINNER_CACHE, NULL);
- cache_ptr = &spinner_cache;
- g_object_add_weak_pointer (G_OBJECT (spinner_cache),
- (gpointer *) cache_ptr);
-
- return spinner_cache;
+ g_object_add_weak_pointer (
+ G_OBJECT (spinner_cache), &spinner_cache);
}
- return g_object_ref (spinner_cache);
+ return g_object_ref_sink (spinner_cache);
}
/* Spinner implementation */
@@ -640,14 +660,14 @@
}
/* Otherwise |images| will be NULL anyway */
- g_assert (images->n_animation_pixbufs > 0);
+ g_return_val_if_fail (images->n_animation_pixbufs > 0, FALSE);
- g_assert (details->current_image >= 0 &&
- details->current_image < images->n_animation_pixbufs);
+ g_return_val_if_fail (details->current_image >= 0 &&
+ details->current_image < images->n_animation_pixbufs, FALSE);
pixbuf = images->animation_pixbufs[details->current_image];
- g_assert (pixbuf != NULL);
+ g_return_val_if_fail (pixbuf != NULL, FALSE);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);