def __init__(self, toolbar): logging.debug('STARTUP: Loading the home view') Gtk.VBox.__init__(self) self._favorites_views_indicies = [] for i in range(desktop.get_number_of_views()): self._favorites_views_indicies.append(i) self._list_view_index = self._favorites_views_indicies[-1] + 1 self._favorites_boxes = [] for i in range(desktop.get_number_of_views()): self._favorites_boxes.append(favoritesview.FavoritesBox(i)) self._list_view = ActivitiesList() self._desktop_model = desktop.get_model() self._desktop_model.connect('desktop-view-icons-changed', self.__desktop_view_icons_changed_cb) toolbar.connect('query-changed', self.__toolbar_query_changed_cb) toolbar.connect('view-changed', self.__toolbar_view_changed_cb) toolbar.search_entry.connect('icon-press', self.__clear_icon_pressed_cb) self._list_view.connect('clear-clicked', self.__activitylist_clear_clicked_cb, toolbar) self._set_view(self._favorites_views_indicies[0]) self._query = ''
def __init__(self, toolbar): logging.debug('STARTUP: Loading the home view') Gtk.VBox.__init__(self) self._favorites_box = favoritesview.FavoritesBox() self._list_view = ActivitiesList() toolbar.connect('query-changed', self.__toolbar_query_changed_cb) toolbar.connect('view-changed', self.__toolbar_view_changed_cb) toolbar.search_entry.connect('icon-press', self.__clear_icon_pressed_cb) self._list_view.connect('clear-clicked', self.__activitylist_clear_clicked_cb, toolbar) self._set_view(_FAVORITES_VIEW) self._query = ''
def __desktop_view_icons_changed_cb(self, model): number_of_views = desktop.get_number_of_views() if len(self._favorites_views_indicies) < number_of_views: for i in range(number_of_views - len(self._favorites_views_indicies)): self._favorites_views_indicies.append( len(self._favorites_views_indicies) + i) self._favorites_boxes.append( favoritesview.FavoritesBox( len(self._favorites_views_indicies) - 1)) elif number_of_views < len(self._favorites_views_indicies): for i in range( len(self._favorites_views_indicies) - number_of_views): self._favorites_boxes.remove(self._favorites_boxes[-1]) self._favorites_views_indicies.remove( self._favorites_views_indicies[-1]) self._list_view_index = number_of_views logging.debug('homebox: reassigning list view index to %d' % (self._list_view_index))