From 340fcc271d23f74c5d53a50e522d345c5817b79c Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 07 Jun 2007 11:07:25 +0000 Subject: set_state() could be called when there are still no formats. --- (limited to 'shell') diff --git a/shell/view/clipboardicon.py b/shell/view/clipboardicon.py index fc609f6..02edb65 100644 --- a/shell/view/clipboardicon.py +++ b/shell/view/clipboardicon.py @@ -91,7 +91,10 @@ class ClipboardIcon(CanvasIcon): def set_state(self, name, percent, icon_name, preview, activity): cb_service = clipboardservice.get_instance() obj = cb_service.get_object(self._object_id) - installable = (obj['FORMATS'][0] == 'application/vnd.olpc-x-sugar') + if obj['FORMATS'] and obj['FORMATS'][0] == 'application/vnd.olpc-x-sugar': + installable = True + else: + installable = False self._name = name self._percent = percent diff --git a/shell/view/frame/clipboardpanelwindow.py b/shell/view/frame/clipboardpanelwindow.py index 0eb8b1d..75e2998 100644 --- a/shell/view/frame/clipboardpanelwindow.py +++ b/shell/view/frame/clipboardpanelwindow.py @@ -46,11 +46,11 @@ class ClipboardPanelWindow(FrameWindow): self.connect("drag_data_get", self._clipboard_box.drag_data_get_cb) def _owner_change_cb(self, clipboard, event): + logging.debug("owner_change_cb") + if self._clipboard_box.owns_clipboard(): return - logging.debug("owner_change_cb") - cb_service = clipboardservice.get_instance() key = cb_service.add_object(name="") cb_service.set_object_percent(key, percent = 100) -- cgit v0.9.1