Commit 4bf6f871 authored by Cédric Bellegarde's avatar Cédric Bellegarde

Use new widget in PagesManagerChild

parent 2ec5dae9
......@@ -22,11 +22,12 @@ class MoveToMenu(Gtk.Grid):
Menu allowing to move webviews to a window
"""
def __init__(self, views, current_window):
def __init__(self, views, current_window, back=True):
"""
Init menu
@param views as [Views]
@param current_window as Window
@param back as bool
"""
self.__current_window = current_window
self.__actions = []
......@@ -39,14 +40,15 @@ class MoveToMenu(Gtk.Grid):
self.set_orientation(Gtk.Orientation.VERTICAL)
# Back button
item = Gtk.ModelButton.new()
item.set_hexpand(True)
item.set_property("centered", True)
item.set_property("text", _("Move to"))
item.set_property("inverted", True)
item.set_property("menu-name", "main")
item.show()
self.add(item)
if back:
item = Gtk.ModelButton.new()
item.set_hexpand(True)
item.set_property("centered", True)
item.set_property("text", _("Move to"))
item.set_property("inverted", True)
item.set_property("menu-name", "main")
item.show()
self.add(item)
action = Gio.SimpleAction(name="switch_window")
action = Gio.SimpleAction.new("switch_window",
......
......@@ -10,9 +10,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk, GLib, WebKit2, Pango, Gio
from gettext import gettext as _
from gi.repository import Gtk, GLib, WebKit2, Pango
from eolie.label_indicator import LabelIndicator
from eolie.define import El, ArtSize
......@@ -137,12 +135,13 @@ class PagesManagerChild(Gtk.FlowBoxChild):
return True
elif event.button == 3:
from eolie.menu_move_to import MoveToMenu
moveto_menu = MoveToMenu([self.__view], self.__window)
menu = Gio.Menu()
menu.append_section(_("Move to"), moveto_menu)
popover = Gtk.Popover.new_from_model(eventbox, menu)
moveto_menu = MoveToMenu([self.__view], self.__window, False)
moveto_menu.show()
popover = Gtk.PopoverMenu.new()
popover.set_relative_to(eventbox)
popover.set_position(Gtk.PositionType.BOTTOM)
popover.add(moveto_menu)
popover.forall(self.__update_popover_internals)
popover.connect("closed", self.__on_popover_closed, moveto_menu)
popover.show()
return True
......@@ -240,14 +239,6 @@ class PagesManagerChild(Gtk.FlowBoxChild):
get_snapshot,
self.__on_snapshot)
def __on_popover_closed(self, popover, menu):
"""
Clean model
@param popover as Gtk.Popover
@param menu as Gio.Menu
"""
GLib.idle_add(menu.clean)
def __on_scroll_timeout(self):
"""
Update snapshot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment