<br><br><div class="gmail_quote">On Fri, Jun 17, 2011 at 11:34 AM, Martin Abente <span dir="ltr"><<a href="mailto:martin.abente.lahaye@gmail.com">martin.abente.lahaye@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
It would be useful to do this with the deleted and updated callbacks<br>
too. :) </blockquote><div><br>Was my first idea, but you can't trigger delete or update when you are looking another view <br>(like uodate the journal when you are looking a external device)<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Makes no sense to refresh the ListModel when the object_id<br>
doesn't belong to it.<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br>This is tricky too. Because in external devices, the object_id is the path of the file,<br>and when you change the title in the list view, the file_name is changed,<br>
and the object_id is not synchronized. I was doing tests, but we need change a lot of code.<br>I think is better do it in a separate patch. <br><br>Gonzalo<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div class="h5">
On Fri, Jun 17, 2011 at 10:20 AM, <<a href="mailto:godiard@sugarlabs.org">godiard@sugarlabs.org</a>> wrote:<br>
> From: Gonzalo Odiard <<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>><br>
><br>
> Signed-off-by: Gonzalo Odiard <<a href="mailto:gonzalo@laptop.org">gonzalo@laptop.org</a>><br>
><br>
> Do not rescan if the created item is not part of the currently selected view<br>
> ---<br>
> src/jarabe/journal/listview.py | 10 +++++++++-<br>
> 1 files changed, 9 insertions(+), 1 deletions(-)<br>
><br>
> diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py<br>
> index 0aee1b7..1bc8f8a 100644<br>
> --- a/src/jarabe/journal/listview.py<br>
> +++ b/src/jarabe/journal/listview.py<br>
> @@ -118,7 +118,8 @@ class BaseListView(gtk.Bin):<br>
> model.deleted.connect(self.__model_deleted_cb)<br>
><br>
> def __model_created_cb(self, sender, **kwargs):<br>
> - self._set_dirty()<br>
> + if self._is_new_item_visible(kwargs):<br>
> + self._set_dirty()<br>
><br>
> def __model_updated_cb(self, sender, **kwargs):<br>
> self._set_dirty()<br>
> @@ -126,6 +127,13 @@ class BaseListView(gtk.Bin):<br>
> def __model_deleted_cb(self, sender, **kwargs):<br>
> self._set_dirty()<br>
><br>
> + def _is_new_item_visible(self, kwargs):<br>
> + """Check if the created item is part of the currently selected view"""<br>
> + if self._query['mountpoints'] == ['/']:<br>
> + return not kwargs['object_id'].startswith('/')<br>
> + else:<br>
> + return kwargs['object_id'].startswith(self._query['mountpoints'][0])<br>
> +<br>
> def _add_columns(self):<br>
> cell_favorite = CellRendererFavorite(self.tree_view)<br>
> cell_favorite.connect('clicked', self.__favorite_clicked_cb)<br>
> --<br>
> 1.7.4.4<br>
><br>
</div></div>> _______________________________________________<br>
> Sugar-devel mailing list<br>
> <a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
> <a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
><br>
</blockquote></div><br><br clear="all"><br>-- <br>Gonzalo Odiard<br>SugarLabs Argentina<br><br>