def _on_action2_press(self, eventbox, event): """ Add/Remove page to/from bookmarks @param eventbox as Gtk.EventBox @param event as Gdk.Event """ view = self.__window.container.current if self.__action_image2.get_icon_name()[0] == "edit-clear-symbolic": self.__entry.delete_text(0, -1) else: bookmark_id = El().bookmarks.get_id(view.webview.get_uri()) if bookmark_id is None: uri = view.webview.get_uri() if not uri or uri == "about:blank": return title = view.webview.get_title() if not title: title = uri self.__action_image2.set_from_icon_name( "starred-symbolic", Gtk.IconSize.MENU) bookmark_id = El().bookmarks.add(title, uri, None, []) widget = EditBookmarkWidget(bookmark_id, False) widget.show() popover = Gtk.Popover.new() popover.set_relative_to(eventbox) popover.connect("closed", self.__on_popover_closed) popover.connect( "closed", lambda x: self._on_entry_focus_out(self.__entry, None)) popover.add(widget) popover.set_size_request(self.__window.get_size()[0] / 2.5, -1) self.__lock_focus = True popover.show() return True
def __on_row_edited(self, row): """ Edit bookmark associated to row @param row as Row """ from eolie.widget_edit_bookmark import EditBookmarkWidget widget = EditBookmarkWidget(row.item.get_property("id")) widget.show() self.__stack.add(widget) self.__stack.set_visible_child(widget)