Hi there, I've been trying to figure out how to solve two use cases, and I've found a lot of similarities: * Carousel album cover downloaded from internet. * Pdf asynchronous presentation (quite like what I did with opt (bug #410), but asynchronously to save video memory).
In both use cases I want to save video memory as much as possible. I want to write a generic set of classes for this purposes, this is my intial draft: --- * --- == PendingTaskActor === - Used to give feedback about the loading state. - It would be also neat to provide a default one, so the user of the API doesn't need to create it's own thing. I'm thinking in a generic spin or something like that. - It should be possible to ask it not to waste any video memory (whenever the task is done) without destroying it. === Async/LazyActor === - The one that as a loaded/unloaded state and shows the PendingTaskActor until the asynchronous operation is done - It should be possible to set/get the PendingTaskActor. - If the actor is unloaded, then it should waste as less memory as possible. - It should has a "loaded" signal and load/unload members. The load should be asynchronous. - Once the content is loaded, the PendingTaskActor should not waste video memory. === Async/LazyContainer === - This container is responsible to tell the lazy actor whether to load its content into the memory or not. - It should has a list of lazy actors, and the user should set the number of loaded actors - it should have a "current actor", the main one shown (the current album, or the current pdf slide) - it should be possible to say how many actors are loaded before the current actor, and after the currect actor (a shift value between 0.0 and 1.0) - next/prev members are needed. - It also should have one PendingTaskActor that should be used as a pattern for the childs. --- * --- This is the first time that I try to write a GObject API for generic purposes, and I don't know the clutter API very well, so I'll need some help in the design of this, any input is really appreciated, some questions: - What should I do to make an actor not to waste any video memory - Should I implement the Async/LazyActor as an interface? May I implement it as a ClutterContainer to be able to show the PendingTaskActor as well? - How can I make the PendingTaskActor not to waste any video memory once the content is loaded? - Should I split the AsyncActor and the LazyActor as different interfaces? - Am I on crack? I've attached a diagram showing the idea more graphically. PS: I'm going to implement it with Vala (don't worry I'll deal with Vala issues with my friends at #vala). -- Un saludo, Alberto Ruiz
<<attachment: ClutterAsyncLazy.png>>
