From d51ef4d0a24c26f5e4ca6eeb8233c96f4bf96caa Mon Sep 17 00:00:00 2001
From: Aleksey Lim <alsroot@member.fsf.org>
Date: Thu, 20 Jan 2011 20:15:01 +0000
Subject: [PATCH sugar] Flickering and unknown icons in the window bar #870
---
src/jarabe/desktop/activitieslist.py | 3 ++-
src/jarabe/desktop/favoritesview.py | 1 +
src/jarabe/desktop/meshbox.py | 1 +
src/jarabe/frame/activitiestray.py | 1 +
src/jarabe/journal/misc.py | 4 ++--
src/jarabe/model/shell.py | 9 ++++-----
src/jarabe/view/launcher.py | 9 ++++++---
src/jarabe/view/palettes.py | 1 +
8 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
index c3a0775..cf5c131 100644
a
|
b
|
class ActivitiesTreeView(gtk.TreeView): |
149 | 149 | client = gconf.client_get_default() |
150 | 150 | xo_color = XoColor(client.get_string('/desktop/sugar/user/color')) |
151 | 151 | |
152 | | launcher.add_launcher(activity_id, bundle.get_icon(), xo_color) |
| 152 | launcher.add_launcher(activity_id, |
| 153 | bundle.get_bundle_id(), bundle.get_icon(), xo_color) |
153 | 154 | activityfactory.create(bundle, ActivityHandle(activity_id)) |
154 | 155 | |
155 | 156 | def set_filter(self, query): |
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index c59335a..2219be3 100644
a
|
b
|
class ActivityIcon(CanvasIcon): |
492 | 492 | |
493 | 493 | activity_id = activityfactory.create_activity_id() |
494 | 494 | launcher.add_launcher(activity_id, |
| 495 | self._activity_info.get_bundle_id(), |
495 | 496 | self._activity_info.get_icon(), |
496 | 497 | xo_color) |
497 | 498 | |
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index fb4be4e..621d4b2 100644
a
|
b
|
class ActivityView(hippo.CanvasBox): |
829 | 829 | bundle = bundleregistry.get_registry().get_bundle(bundle_id) |
830 | 830 | |
831 | 831 | launcher.add_launcher(self._model.get_id(), |
| 832 | bundle.get_bundle_id(), |
832 | 833 | bundle.get_icon(), |
833 | 834 | self._model.get_color()) |
834 | 835 | |
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index 370572c..b20ff8e 100644
a
|
b
|
class ActivityInviteButton(BaseInviteButton): |
183 | 183 | bundle = registry.get_bundle(self._bundle_id) |
184 | 184 | |
185 | 185 | launcher.add_launcher(self._activity_model.get_id(), |
| 186 | bundle.get_bundle_id(), |
186 | 187 | bundle.get_icon(), |
187 | 188 | self._activity_model.get_color()) |
188 | 189 | |
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 4a2211f..0ad70e3 100644
a
|
b
|
def resume(metadata, bundle_id=None): |
231 | 231 | object_id = model.copy(metadata, '/') |
232 | 232 | |
233 | 233 | if activity_id: |
234 | | launcher.add_launcher(activity_id, bundle.get_icon(), |
235 | | get_icon_color(metadata)) |
| 234 | launcher.add_launcher(activity_id, bundle.get_bundle_id(), |
| 235 | bundle.get_icon(), get_icon_color(metadata)) |
236 | 236 | handle = ActivityHandle(object_id=object_id, |
237 | 237 | activity_id=activity_id) |
238 | 238 | activityfactory.create(bundle, handle) |
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index b9cb0c2..f99af2d 100644
a
|
b
|
class ShellModel(gobject.GObject): |
601 | 601 | " was not found in the bundle registry." |
602 | 602 | % service_name) |
603 | 603 | home_activity = Activity(activity_info, activity_id) |
604 | | self._add_activity(home_activity) |
605 | | |
606 | | self._set_active_activity(home_activity) |
607 | | |
608 | | self.emit('launch-started', home_activity) |
| 604 | if home_activity is None: |
| 605 | self._add_activity(home_activity) |
| 606 | self._set_active_activity(home_activity) |
| 607 | self.emit('launch-started', home_activity) |
609 | 608 | |
610 | 609 | # FIXME: better learn about finishing processes by receiving a signal. |
611 | 610 | # Now just check whether an activity has a window after ~90sec |
diff --git a/src/jarabe/view/launcher.py b/src/jarabe/view/launcher.py
index 89251e5..1e73549 100644
a
|
b
|
from jarabe.view.pulsingicon import CanvasPulsingIcon |
32 | 32 | |
33 | 33 | class LaunchWindow(gtk.Window): |
34 | 34 | |
35 | | def __init__(self, activity_id, icon_path, icon_color): |
| 35 | def __init__(self, activity_id, bundle_id, icon_path, icon_color): |
36 | 36 | gobject.GObject.__init__(self) |
37 | 37 | |
38 | 38 | self.props.type_hint = gtk.gdk.WINDOW_TYPE_HINT_NORMAL |
… |
… |
class LaunchWindow(gtk.Window): |
51 | 51 | canvas.pack_start(header, expand=False) |
52 | 52 | |
53 | 53 | self._activity_id = activity_id |
| 54 | self._bundle_id = bundle_id |
54 | 55 | self._box = LaunchBox(activity_id, icon_path, icon_color) |
55 | 56 | box = hippo.Canvas() |
56 | 57 | box.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color()) |
… |
… |
class LaunchWindow(gtk.Window): |
88 | 89 | self.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height()) |
89 | 90 | |
90 | 91 | def __realize_cb(self, widget): |
| 92 | wm.set_bundle_id(widget.window, str(self._bundle_id)) |
91 | 93 | wm.set_activity_id(widget.window, str(self._activity_id)) |
92 | 94 | widget.window.property_change('_SUGAR_WINDOW_TYPE', 'STRING', 8, |
93 | 95 | gtk.gdk.PROP_MODE_REPLACE, 'launcher') |
… |
… |
def setup(): |
163 | 165 | model.connect('launch-completed', __launch_completed_cb) |
164 | 166 | |
165 | 167 | |
166 | | def add_launcher(activity_id, icon_path, icon_color): |
| 168 | def add_launcher(activity_id, bundle_id, icon_path, icon_color): |
167 | 169 | model = shell.get_model() |
168 | 170 | |
169 | 171 | if model.get_launcher(activity_id) is not None: |
170 | 172 | return |
171 | 173 | |
172 | | launch_window = LaunchWindow(activity_id, icon_path, icon_color) |
| 174 | launch_window = LaunchWindow(activity_id, bundle_id, icon_path, icon_color) |
173 | 175 | launch_window.show() |
174 | 176 | |
175 | 177 | model.register_launcher(activity_id, launch_window) |
… |
… |
def add_launcher(activity_id, icon_path, icon_color): |
177 | 179 | |
178 | 180 | def __launch_started_cb(home_model, home_activity): |
179 | 181 | add_launcher(home_activity.get_activity_id(), |
| 182 | home_activity.get_bundle_id(), |
180 | 183 | home_activity.get_icon_path(), home_activity.get_icon_color()) |
181 | 184 | |
182 | 185 | |
diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py
index 5994c3d..f93399e 100644
a
|
b
|
class ActivityPalette(Palette): |
154 | 154 | |
155 | 155 | activity_id = activityfactory.create_activity_id() |
156 | 156 | launcher.add_launcher(activity_id, |
| 157 | self._activity_info.get_bundle_id(), |
157 | 158 | self._activity_info.get_icon(), |
158 | 159 | xo_color) |
159 | 160 | |