[Dextrose] [PATCH sugar] Flickering and unknown icons in the window bar #870

Aleksey Lim alsroot at member.fsf.org
Thu Jan 20 15:15:20 EST 2011


---
 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/src/jarabe/desktop/activitieslist.py
+++ b/src/jarabe/desktop/activitieslist.py
@@ -149,7 +149,8 @@ class ActivitiesTreeView(gtk.TreeView):
         client = gconf.client_get_default()
         xo_color = XoColor(client.get_string('/desktop/sugar/user/color'))
 
-        launcher.add_launcher(activity_id, bundle.get_icon(), xo_color)
+        launcher.add_launcher(activity_id,
+                bundle.get_bundle_id(), bundle.get_icon(), xo_color)
         activityfactory.create(bundle, ActivityHandle(activity_id))
 
     def set_filter(self, query):
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index c59335a..2219be3 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -492,6 +492,7 @@ class ActivityIcon(CanvasIcon):
 
             activity_id = activityfactory.create_activity_id()
             launcher.add_launcher(activity_id,
+                                  self._activity_info.get_bundle_id(),
                                   self._activity_info.get_icon(),
                                   xo_color)
 
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index fb4be4e..621d4b2 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -829,6 +829,7 @@ class ActivityView(hippo.CanvasBox):
         bundle = bundleregistry.get_registry().get_bundle(bundle_id)
 
         launcher.add_launcher(self._model.get_id(),
+                              bundle.get_bundle_id(),
                               bundle.get_icon(),
                               self._model.get_color())
 
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index 370572c..b20ff8e 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -183,6 +183,7 @@ class ActivityInviteButton(BaseInviteButton):
         bundle = registry.get_bundle(self._bundle_id)
 
         launcher.add_launcher(self._activity_model.get_id(),
+                              bundle.get_bundle_id(),
                               bundle.get_icon(),
                               self._activity_model.get_color())
 
diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
index 4a2211f..0ad70e3 100644
--- a/src/jarabe/journal/misc.py
+++ b/src/jarabe/journal/misc.py
@@ -231,8 +231,8 @@ def resume(metadata, bundle_id=None):
             object_id = model.copy(metadata, '/')
 
         if activity_id:
-            launcher.add_launcher(activity_id, bundle.get_icon(),
-                    get_icon_color(metadata))
+            launcher.add_launcher(activity_id, bundle.get_bundle_id(),
+                    bundle.get_icon(), get_icon_color(metadata))
             handle = ActivityHandle(object_id=object_id,
                                     activity_id=activity_id)
             activityfactory.create(bundle, handle)
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index b9cb0c2..f99af2d 100644
--- a/src/jarabe/model/shell.py
+++ b/src/jarabe/model/shell.py
@@ -601,11 +601,10 @@ class ShellModel(gobject.GObject):
                              " was not found in the bundle registry."
                              % service_name)
         home_activity = Activity(activity_info, activity_id)
-        self._add_activity(home_activity)
-
-        self._set_active_activity(home_activity)
-
-        self.emit('launch-started', home_activity)
+        if home_activity is None:
+            self._add_activity(home_activity)
+            self._set_active_activity(home_activity)
+            self.emit('launch-started', home_activity)
 
         # FIXME: better learn about finishing processes by receiving a signal.
         # 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/src/jarabe/view/launcher.py
+++ b/src/jarabe/view/launcher.py
@@ -32,7 +32,7 @@ from jarabe.view.pulsingicon import CanvasPulsingIcon
 
 class LaunchWindow(gtk.Window):
 
-    def __init__(self, activity_id, icon_path, icon_color):
+    def __init__(self, activity_id, bundle_id, icon_path, icon_color):
         gobject.GObject.__init__(self)
 
         self.props.type_hint = gtk.gdk.WINDOW_TYPE_HINT_NORMAL
@@ -51,6 +51,7 @@ class LaunchWindow(gtk.Window):
         canvas.pack_start(header, expand=False)
 
         self._activity_id = activity_id
+        self._bundle_id = bundle_id
         self._box = LaunchBox(activity_id, icon_path, icon_color)
         box = hippo.Canvas()
         box.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color())
@@ -88,6 +89,7 @@ class LaunchWindow(gtk.Window):
         self.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())
 
     def __realize_cb(self, widget):
+        wm.set_bundle_id(widget.window, str(self._bundle_id))
         wm.set_activity_id(widget.window, str(self._activity_id))
         widget.window.property_change('_SUGAR_WINDOW_TYPE', 'STRING', 8,
                                       gtk.gdk.PROP_MODE_REPLACE, 'launcher')
@@ -163,13 +165,13 @@ def setup():
     model.connect('launch-completed', __launch_completed_cb)
 
 
-def add_launcher(activity_id, icon_path, icon_color):
+def add_launcher(activity_id, bundle_id, icon_path, icon_color):
     model = shell.get_model()
 
     if model.get_launcher(activity_id) is not None:
         return
 
-    launch_window = LaunchWindow(activity_id, icon_path, icon_color)
+    launch_window = LaunchWindow(activity_id, bundle_id, icon_path, icon_color)
     launch_window.show()
 
     model.register_launcher(activity_id, launch_window)
@@ -177,6 +179,7 @@ def add_launcher(activity_id, icon_path, icon_color):
 
 def __launch_started_cb(home_model, home_activity):
     add_launcher(home_activity.get_activity_id(),
+            home_activity.get_bundle_id(),
             home_activity.get_icon_path(), home_activity.get_icon_color())
 
 
diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py
index 5994c3d..f93399e 100644
--- a/src/jarabe/view/palettes.py
+++ b/src/jarabe/view/palettes.py
@@ -154,6 +154,7 @@ class ActivityPalette(Palette):
 
         activity_id = activityfactory.create_activity_id()
         launcher.add_launcher(activity_id,
+                              self._activity_info.get_bundle_id(),
                               self._activity_info.get_icon(),
                               xo_color)
 
-- 
1.7.3.4



More information about the Dextrose mailing list