diff --git a/shell/home/FriendsView.py b/shell/home/FriendsView.py index dfa55af1..29418b75 100644 --- a/shell/home/FriendsView.py +++ b/shell/home/FriendsView.py @@ -5,12 +5,12 @@ import goocanvas from sugar.canvas.IconItem import IconItem from sugar.canvas.IconItem import IconColor -from Theme import Theme +import Theme class Model(goocanvas.CanvasModelSimple): def __init__(self, data_model): goocanvas.CanvasModelSimple.__init__(self) - self._theme = Theme() + self._theme = Theme.get_instance() self._theme.connect("theme-changed", self.__theme_changed_cb) root = self.get_root_item() diff --git a/shell/home/HomeView.py b/shell/home/HomeView.py index 08707e39..a84b4f62 100644 --- a/shell/home/HomeView.py +++ b/shell/home/HomeView.py @@ -8,7 +8,7 @@ from sugar.canvas.DonutItem import DonutItem from sugar.canvas.DonutItem import PieceItem from sugar.canvas.DonutItem import PieceIcon -from Theme import Theme +import Theme class TasksItem(DonutItem): def __init__(self, shell): @@ -43,7 +43,7 @@ class TasksItem(DonutItem): class Background(goocanvas.Group): def __init__(self): goocanvas.Group.__init__(self) - self._theme = Theme() + self._theme = Theme.get_instance() self._theme.connect("theme-changed", self.__theme_changed_cb) color = self._theme.get_home_colors()[1] diff --git a/shell/home/Theme.py b/shell/home/Theme.py index 747c1ebc..259d7724 100644 --- a/shell/home/Theme.py +++ b/shell/home/Theme.py @@ -39,3 +39,12 @@ class Theme(gobject.GObject): def get_home_colors(self): return self.__colors[self._cur_theme] + + +# Use this accessor, don't create more than one theme object +_theme = None +def get_instance(): + global _theme + if not _theme: + _theme = Theme() + return _theme