From e7d2a99200c74c087c251b396cd88a3377cb2948 Mon Sep 17 00:00:00 2001 From: flavio Date: Sat, 22 Dec 2012 15:54:15 +0000 Subject: Corrections in Tray --- diff --git a/button.py b/button.py index 74dc588..6261152 100644 --- a/button.py +++ b/button.py @@ -75,12 +75,13 @@ class RecdButton(TrayButton): img.show() return img - def cleanup(self): + # FIXME: If the widget is destroyed it is not necessary to see "remove_item" in Tray.py + #def cleanup(self): - self._rem_menu_item.disconnect(self._rem_menu_item_handler) + # self._rem_menu_item.disconnect(self._rem_menu_item_handler) - if self._copy_menu_item_handler != None: - self._copy_menu_item.disconnect(self._copy_menu_item_handler) + # if self._copy_menu_item_handler != None: + # self._copy_menu_item.disconnect(self._copy_menu_item_handler) def _remove_clicked(self, widget): self.emit('remove-requested') diff --git a/record.py b/record.py index e0a0fd0..28011f2 100644 --- a/record.py +++ b/record.py @@ -479,8 +479,8 @@ class Record(activity.Activity): button = RecdButton(recd) clicked_handler = button.connect("clicked", self._thumbnail_clicked, recd) - #remove_handler = button.connect("remove-requested", self._remove_recd) - #clipboard_handler = button.connect("copy-clipboard-requested", self._thumbnail_copy_clipboard) + remove_handler = button.connect("remove-requested", self._remove_recd) + clipboard_handler = button.connect("copy-clipboard-requested", self._thumbnail_copy_clipboard) # FIXME: GObject.get_data() and set_data() are deprecated. Use normal Python attributes instead #button.('handler-ids', (clicked_handler, remove_handler, clipboard_handler)) self._thumb_tray.add_item(button) @@ -536,7 +536,7 @@ class Record(activity.Activity): # recdbutton.disconnect(handler) self._thumb_tray.remove_item(recdbutton) - recdbutton.cleanup() + # recdbutton.cleanup() # If the widget is destroyed it is not necessary to see "remove_item" in Tray.py def remove_all_thumbnails(self): diff --git a/tray.py b/tray.py index 7cdb435..9ab3967 100644 --- a/tray.py +++ b/tray.py @@ -48,7 +48,8 @@ class _TrayViewport(Gtk.Viewport): self.add(self.traybar) self.traybar.show() - self.connect('size_allocate', self._size_allocate_cb) + # FIXME: It is necessary to re implement + #self.connect('size_allocate', self._size_allocate_cb) def scroll(self, direction): @@ -92,37 +93,39 @@ class _TrayViewport(Gtk.Viewport): adj = self.get_vadjustment() new_value = adj.get_value() - self.allocation.height adj.set_value(max(adj.get_lower(), new_value)) - - def _size_allocate_cb(self, widget, requisition): + + # FIXME: It is necessary to re implement + #def _size_allocate_cb(self, widget, requisition): - child_requisition = self.get_child().size_request() + # child_requisition = self.get_child().size_request() - if self.orientation == Gtk.Orientation.HORIZONTAL: - requisition.width = 0 - requisition.height = child_requisition.height + # if self.orientation == Gtk.Orientation.HORIZONTAL: + # requisition.width = 0 + # requisition.height = child_requisition.height - else: - requisition.width = child_requisition.width - requisition.height = 0 + # else: + # requisition.width = child_requisition.width + # requisition.height = 0 def do_get_property(self, pspec): if pspec.name == 'can-scroll': return self._can_scroll - - def do_size_allocate(self, allocation): + + # FIXME: It is necessary to re implement + # def do_size_allocate(self, allocation): - bar_requisition = self.traybar.get_child_requisition() + # bar_requisition = self.traybar.get_child_requisition() - if self.orientation == Gtk.Orientation.HORIZONTAL: - can_scroll = bar_requisition.width > allocation.width + # if self.orientation == Gtk.Orientation.HORIZONTAL: + # can_scroll = bar_requisition.width > allocation.width - else: - can_scroll = bar_requisition.height > allocation.height + # else: + # can_scroll = bar_requisition.height > allocation.height - if can_scroll != self._can_scroll: - self._can_scroll = can_scroll - self.notify('can-scroll') + # if can_scroll != self._can_scroll: + # self._can_scroll = can_scroll + # self.notify('can-scroll') class _TrayScrollButton(Gtk.Button): @@ -216,7 +219,8 @@ class HTray(Gtk.Box): def remove_item(self, item): - self._viewport.traybar.remove(item) + # self._viewport.traybar.remove(item) If the widget is destroyed it is not necessary. + item.destroy() def get_item_index(self, item): -- cgit v0.9.1