[sugar] [PATCH] Add indications for empty journal and empty search results
Tomeu Vizoso
tomeu at tomeuvizoso.net
Tue Jun 17 11:06:24 EDT 2008
On Tue, Jun 17, 2008 at 3:18 PM, Eben Eliason <eben.eliason at gmail.com> wrote:
> On Tue, Jun 17, 2008 at 3:36 AM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
>> What about creating the empty_box in a method? We don't really need to
>> hold a reference to it in ListView, right? You could then pass the
>> string as a parameter to that method, thus avoiding multiple repeated
>> instances of translatable strings, that is something quite bad.
>
> We could use a method. I want to keep the door open to allowing other
> changes apart from the string, in the future. For instance, as the
> commit message indicates, the different cases may have buttons with
> different icons/actions in the future. Perhaps I should just make
> separate methods for the two states. What do you think? Perhaps add
> another to clear the message and restore the list as well?
Well, if these views are going to get more complicated, making custom
widgets out of them might make sense.
>> + # Indicate when the Journal is empty
>> + if len(jobjects) == 0:
>> + self._empty_text.props.text = _('Your Journal is empty')
>> + self._canvas.set_root(self._empty_box)
>> + return
>>
>> Why it's not enough to set the box in refresh()?
>
> I played with this for quite a while. As it turns out, refresh never
> gets called when the Journal is initialized. Instead, setting up the
> view causes _vadjustment_value_changed_cb to fire, in turn calling
> _do_scroll directly and populating the view that way. Without these
> extra lines, the Journal wouldn't actually display the "I'm empty"
> message when it is first focused, which is the main reason for that
> particular message anyway.
Ok, some refactoring might be needed in the future.
Thanks,
Tomeu
More information about the Sugar
mailing list