Fix native applications handling

This commit is contained in:
Marco Pesenti Gritti 2007-10-14 00:25:53 +02:00
parent e39232a622
commit 29bc0a8a20
4 changed files with 20 additions and 7 deletions

View File

@ -5,3 +5,4 @@
<Alt>n=next <Alt>n=next
<Alt>p=prev <Alt>p=prev
<Alt>c=close <Alt>c=close
<Alt>f=fullscreen

View File

@ -96,14 +96,17 @@ class HomeActivity(gobject.GObject):
def get_title(self): def get_title(self):
"""Retrieve the application's root window's suggested title""" """Retrieve the application's root window's suggested title"""
if self._window:
return self._window.get_name() return self._window.get_name()
else:
return ''
def get_icon_name(self): def get_icon_path(self):
"""Retrieve the activity's icon (file) name""" """Retrieve the activity's icon (file) name"""
if self._activity_info: if self._activity_info:
return self._activity_info.icon return self._activity_info.icon
else: else:
return 'image-missing' return None
def get_icon_color(self): def get_icon_color(self):
"""Retrieve the appropriate icon colour for this activity """Retrieve the appropriate icon colour for this activity

View File

@ -65,7 +65,6 @@ class ActivityIcon(CanvasIcon):
} }
def __init__(self, activity): def __init__(self, activity):
icon_name = activity.get_icon_name()
self._orig_color = activity.get_icon_color() self._orig_color = activity.get_icon_color()
self._icon_colors = self._compute_icon_colors() self._icon_colors = self._compute_icon_colors()
@ -74,8 +73,14 @@ class ActivityIcon(CanvasIcon):
self._level = self._level_max self._level = self._level_max
color = self._icon_colors[self._level] color = self._icon_colors[self._level]
CanvasIcon.__init__(self, file_name=icon_name, xo_color=color, CanvasIcon.__init__(self, xo_color=color, cache=True,
size=style.MEDIUM_ICON_SIZE, cache=True) size=style.MEDIUM_ICON_SIZE)
icon_path = activity.get_icon_path()
if icon_path:
self.props.file_name = icon_path
else:
self.props.icon_name = 'image-missing'
self._activity = activity self._activity = activity
self._pulse_id = 0 self._pulse_id = 0
@ -85,9 +90,9 @@ class ActivityIcon(CanvasIcon):
palette = Palette(_('Starting...')) palette = Palette(_('Starting...'))
self.set_palette(palette) self.set_palette(palette)
activity.connect('notify::launching', self._launching_changed_cb)
if activity.props.launching: if activity.props.launching:
self._start_pulsing() self._start_pulsing()
activity.connect('notify::launching', self._launching_changed_cb)
else: else:
self._setup_palette() self._setup_palette()

View File

@ -261,6 +261,7 @@ class Activity(Window, gtk.Container):
self.connect('realize', self._realize_cb) self.connect('realize', self._realize_cb)
self.connect('delete-event', self._delete_event_cb) self.connect('delete-event', self._delete_event_cb)
self.connect('window-state-event', self._window_state_event_cb)
self._active = False self._active = False
self._activity_id = handle.activity_id self._activity_id = handle.activity_id
@ -344,6 +345,9 @@ class Activity(Window, gtk.Container):
else: else:
logging.debug("Unknown share scope %r" % share_scope) logging.debug("Unknown share scope %r" % share_scope)
def _window_state_event_cb(self, window, event):
logging.info(event.new_window_state)
def do_set_property(self, pspec, value): def do_set_property(self, pspec, value):
if pspec.name == 'active': if pspec.name == 'active':
if self._active != value: if self._active != value: