+ return cache;
+}
+
+static void
+ev_thumbnails_size_cache_get_size (EvThumbsSizeCache *cache,
+ gint page,
+ gint rotation,
+ gint *width,
+ gint *height)
+{
+ gint w, h;
+
+ if (cache->uniform) {
+ w = cache->uniform_width;
+ h = cache->uniform_height;
+ } else {
+ EvThumbsSize *thumb_size;
+
+ thumb_size = &(cache->sizes[page]);
+
+ w = thumb_size->width;
+ h = thumb_size->height;
+ }
+
+ if (rotation == 0 || rotation == 180) {
+ if (width) *width = w;
+ if (height) *height = h;
+ } else {
+ if (width) *width = h;
+ if (height) *height = w;
+ }
+}
+
+static void
+ev_thumbnails_size_cache_free (EvThumbsSizeCache *cache)
+{
+ if (cache->sizes) {
+ g_free (cache->sizes);
+ cache->sizes = NULL;
+ }
+
+ g_free (cache);
+}
+
+static EvThumbsSizeCache *
+ev_thumbnails_size_cache_get (EvDocument *document)
+{
+ EvThumbsSizeCache *cache;
+
+ cache = g_object_get_data (G_OBJECT (document), EV_THUMBNAILS_SIZE_CACHE_KEY);
+ if (!cache) {
+ cache = ev_thumbnails_size_cache_new (document);
+ g_object_set_data_full (G_OBJECT (document),
+ EV_THUMBNAILS_SIZE_CACHE_KEY,
+ cache,
+ (GDestroyNotify)ev_thumbnails_size_cache_free);
+ }
+
+ return cache;
+}
+
+
+static void
+ev_sidebar_thumbnails_dispose (GObject *object)
+{
+ EvSidebarThumbnails *sidebar_thumbnails = EV_SIDEBAR_THUMBNAILS (object);
+
+ if (sidebar_thumbnails->priv->loading_icons) {
+ g_hash_table_destroy (sidebar_thumbnails->priv->loading_icons);
+ sidebar_thumbnails->priv->loading_icons = NULL;
+ }
+
+ if (sidebar_thumbnails->priv->list_store) {
+ ev_sidebar_thumbnails_clear_model (sidebar_thumbnails);
+ g_object_unref (sidebar_thumbnails->priv->list_store);
+ sidebar_thumbnails->priv->list_store = NULL;
+ }
+
+ G_OBJECT_CLASS (ev_sidebar_thumbnails_parent_class)->dispose (object);
+}
+
+static void
+ev_sidebar_thumbnails_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EvSidebarThumbnails *sidebar = EV_SIDEBAR_THUMBNAILS (object);
+
+ switch (prop_id) {
+ case PROP_WIDGET:
+ if (sidebar->priv->tree_view)
+ g_value_set_object (value, sidebar->priv->tree_view);
+ else
+ g_value_set_object (value, sidebar->priv->icon_view);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+ev_sidebar_thumbnails_map (GtkWidget *widget)
+{
+ EvSidebarThumbnails *sidebar;
+
+ sidebar = EV_SIDEBAR_THUMBNAILS (widget);
+
+ GTK_WIDGET_CLASS (ev_sidebar_thumbnails_parent_class)->map (widget);
+
+ adjustment_changed_cb (sidebar);