From f19bc3b26d9b0fb595c679e899bd06eb94113ff5 Mon Sep 17 00:00:00 2001 From: mrvladus Date: Thu, 10 Oct 2024 12:00:26 +0300 Subject: [PATCH] fix #344 #284 --- data/io.github.mrvladus.List.metainfo.xml.in.in | 12 ++++++++++++ errands/widgets/task.py | 8 ++++++-- errands/widgets/task_list/task_list_sidebar_row.py | 3 +++ errands/widgets/trash/trash_sidebar_row.py | 11 +++++++---- meson.build | 2 +- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/data/io.github.mrvladus.List.metainfo.xml.in.in b/data/io.github.mrvladus.List.metainfo.xml.in.in index 4d00b828..42ca9cad 100644 --- a/data/io.github.mrvladus.List.metainfo.xml.in.in +++ b/data/io.github.mrvladus.List.metainfo.xml.in.in @@ -57,6 +57,18 @@ + + +

Fixes:

+
    +
  • Fixed long-press right-click menu on touch devices
  • +
+

Translations:

+
    +
  • Updated Spanish translation (haggen88)
  • +
+
+

Translations:

diff --git a/errands/widgets/task.py b/errands/widgets/task.py index a16b20ae..49d1581b 100644 --- a/errands/widgets/task.py +++ b/errands/widgets/task.py @@ -4,7 +4,7 @@ from __future__ import annotations from datetime import datetime -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Callable from gi.repository import Adw, Gdk, Gio, GLib, GObject, Gtk # type:ignore @@ -53,7 +53,7 @@ def __add_actions(self) -> None: self.group: Gio.SimpleActionGroup = Gio.SimpleActionGroup() self.insert_action_group(name="task", group=self.group) - def __create_action(name: str, callback: callable) -> None: + def __create_action(name: str, callback: Callable) -> None: action: Gio.SimpleAction = Gio.SimpleAction(name=name) action.connect("activate", callback) self.group.add_action(action) @@ -197,6 +197,10 @@ def __build_ui(self): right_click_ctrl = Gtk.GestureClick(button=3) right_click_ctrl.connect("released", self.__on_right_click) self.title_row.add_controller(right_click_ctrl) + right_click_ctrl_touch = Gtk.GestureLongPress(touch_only=True) + right_click_ctrl_touch.connect("pressed", self.__on_right_click) + self.title_row.add_controller(right_click_ctrl_touch) + self.popover_menu: Gtk.PopoverMenu = Gtk.PopoverMenu( halign=Gtk.Align.START, diff --git a/errands/widgets/task_list/task_list_sidebar_row.py b/errands/widgets/task_list/task_list_sidebar_row.py index 73dd267f..704e5fbc 100644 --- a/errands/widgets/task_list/task_list_sidebar_row.py +++ b/errands/widgets/task_list/task_list_sidebar_row.py @@ -177,6 +177,9 @@ def __build_ui(self) -> None: right_click = Gtk.GestureClick(button=3) right_click.connect("released", self._on_row_pressed) self.add_controller(right_click) + right_click_ctrl_touch = Gtk.GestureLongPress(touch_only=True) + right_click_ctrl_touch.connect("pressed", self._on_row_pressed) + self.add_controller(right_click_ctrl_touch) # Context menu self.popover_menu = Gtk.PopoverMenu( diff --git a/errands/widgets/trash/trash_sidebar_row.py b/errands/widgets/trash/trash_sidebar_row.py index 60ee5fea..68a74304 100644 --- a/errands/widgets/trash/trash_sidebar_row.py +++ b/errands/widgets/trash/trash_sidebar_row.py @@ -54,16 +54,20 @@ def __build_ui(self) -> None: # Gesture click self.gesture_click = Gtk.GestureClick(button=3) self.gesture_click.connect("released", self._on_row_pressed) + self.add_controller(self.gesture_click) + right_click_ctrl_touch = Gtk.GestureLongPress(touch_only=True) + right_click_ctrl_touch.connect("pressed", self._on_row_pressed) + self.add_controller(right_click_ctrl_touch) # Context menu self.popover_menu = Gtk.PopoverMenu( halign=Gtk.Align.START, has_arrow=False, menu_model=ErrandsSimpleMenu( - items=[ + items=( ErrandsMenuItem(_("Clear"), "trash_row.clear"), - ErrandsMenuItem(_("Restore"), "trash_row.restore"), - ] + ErrandsMenuItem(_("Restore"), "trash_row.restore") + ) ), ) @@ -75,7 +79,6 @@ def __build_ui(self) -> None: ) ) - self.add_controller(self.gesture_click) def __add_actions(self) -> None: self.group: Gio.SimpleActionGroup = Gio.SimpleActionGroup() diff --git a/meson.build b/meson.build index 9a51745e..37b11eaa 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project( 'errands', - version: '46.2.5', + version: '46.2.6', meson_version: '>= 0.62.0', )