~comcloudway/melon

35c94b4828a8c1e9089f48c7941f42dfdd9ede18 — Jakob Meier a month ago c73c9a6
Use Adw.AlertDialog for delete confirmation
6 files changed, 180 insertions(+), 212 deletions(-)

M melon/playlist/__init__.py
M melon/widgets/preferencerow.py
M po/de.po
M po/fa.po
M po/melon.pot
M po/nl.po
M melon/playlist/__init__.py => melon/playlist/__init__.py +20 -42
@@ 286,50 286,28 @@ class LocalPlaylistScreen(Adw.NavigationPage):
        # close edit dialog
        self.edit_diag.hide()
        # show delete confirmation dialog
        self.dlt_diag = SimpleDialog()
        self.dlt_diag.set_title(_("Delete Playlist"))

        info = Adw.PreferencesGroup()
        info.set_title(_("Do you really want to delete this playlist?"))
        info.set_description(_("This cannot be undone"))
        self.dlt_diag.set_widget(info)

        bottom_bar = Gtk.Box()
        btn_cancel = IconButton(
            _("Cancel"),
            "process-stop-symbolic",
            tooltip=_("Do not delete the playlist"),
        self.dlt_diag = Adw.AlertDialog.new(
            _("Delete Playlist?"),
            _("Do you really want to delete this playlist? This can not be undone."),
        )
        btn_confirm = IconButton(
            _("Delete"), "list-add-symbolic", tooltip=_("Delete this playlist")
        self.dlt_diag.add_response("cancel", _("Cancel"))
        self.dlt_diag.set_response_appearance("cancel", Adw.ResponseAppearance.DEFAULT)
        self.dlt_diag.add_response("delete", _("Delete"))
        self.dlt_diag.set_response_appearance(
            "delete", Adw.ResponseAppearance.DESTRUCTIVE
        )
        btn_confirm.connect("clicked", lambda _: self.delete())
        btn_cancel.connect("clicked", lambda _: self.dlt_diag.hide())

        padding = 12
        btn_confirm.set_vexpand(True)
        btn_confirm.set_hexpand(True)
        btn_confirm.set_margin_end(padding)
        btn_confirm.set_margin_start(padding / 2)
        btn_confirm.set_margin_top(padding)
        btn_confirm.set_margin_bottom(padding)
        btn_cancel.set_vexpand(True)
        btn_cancel.set_hexpand(True)
        btn_cancel.set_margin_start(padding)
        btn_cancel.set_margin_end(padding / 2)
        btn_cancel.set_margin_top(padding)
        btn_cancel.set_margin_bottom(padding)
        bottom_bar.append(btn_cancel)
        bottom_bar.append(btn_confirm)
        self.dlt_diag.toolbar_view.add_bottom_bar(bottom_bar)
        self.dlt_diag.set_default_response("cancel")
        self.dlt_diag.set_close_response("cancel")

        self.dlt_diag.show(self)
        self.dlt_diag.connect("response", self.on_delete_action)
        self.dlt_diag.present(self)

    def delete(self):
        # make sure that this widget does not receive an update notification
        self.unregister()
        # go home and delete afterwards
        # so that the reload/callback doesn't trigger
        self.activate_action("win.home", None)
        ensure_delete_local_playlist(self.playlist.id)
        self.dlt_diag.hide()
    def on_delete_action(self, w, action):
        if action == "delete":
            # make sure that this widget does not receive an update notification
            self.unregister()
            # go home and delete afterwards
            # so that the reload/callback doesn't trigger
            self.activate_action("win.home", None)
            ensure_delete_local_playlist(self.playlist.id)

M melon/widgets/preferencerow.py => melon/widgets/preferencerow.py +22 -38
@@ 210,46 210,30 @@ class MultiRow(Adw.PreferencesRow):
        diag.show(self)

    def confirm_delete(self, w, item: str, counter: int):
        diag = SimpleDialog()
        diag.set_title(_("Delete"))
        # preview prferences group
        preview = Adw.PreferencesGroup()
        preview.set_title(_("Do you really want to delete this item?"))
        preview.set_description(_("You won't be able to restore it afterwards"))
        row = Adw.ActionRow()
        row.set_title(item)
        preview.add(row)
        diag.set_widget(preview)
        # place button bar in toolbar
        bottom_bar = Gtk.Box()
        btn_cancel = IconButton(
            _("Cancel"), "process-stop-symbolic", tooltip=_("Do not remove item")
        )
        btn_confirm = IconButton(
            _("Delete"), "list-add-symbolic", tooltip=_("Remove item from list")
        # show delete confirmation dialog
        self.dlt_diag = Adw.AlertDialog.new(
            _("Delete Item?"),
            _(
                "Do you really want to delete this item? You won't be able to restore it afterwards"
            ),
        )
        btn_confirm.connect(
            "clicked",
            lambda _: many(self.values.pop(counter), self.notify(), diag.hide()),
        self.dlt_diag.add_response("cancel", _("Cancel"))
        self.dlt_diag.set_response_appearance("cancel", Adw.ResponseAppearance.DEFAULT)
        self.dlt_diag.add_response("delete", _("Delete"))
        self.dlt_diag.set_response_appearance(
            "delete", Adw.ResponseAppearance.DESTRUCTIVE
        )
        btn_cancel.connect("clicked", lambda x: diag.hide())
        padding = 12
        btn_confirm.set_vexpand(True)
        btn_confirm.set_hexpand(True)
        btn_confirm.set_margin_end(padding)
        btn_confirm.set_margin_start(padding / 2)
        btn_confirm.set_margin_top(padding)
        btn_confirm.set_margin_bottom(padding)
        btn_cancel.set_vexpand(True)
        btn_cancel.set_hexpand(True)
        btn_cancel.set_margin_start(padding)
        btn_cancel.set_margin_end(padding / 2)
        btn_cancel.set_margin_top(padding)
        btn_cancel.set_margin_bottom(padding)
        bottom_bar.append(btn_cancel)
        bottom_bar.append(btn_confirm)
        diag.toolbar_view.add_bottom_bar(bottom_bar)
        diag.show(self)

        self.dlt_diag.set_default_response("cancel")
        self.dlt_diag.set_close_response("cancel")

        self.dlt_diag.connect("response", pass_me(self.on_delete_action, counter))
        self.dlt_diag.present(self)

    def on_delete_action(self, w, action, counter):
        if action == "delete":
            self.values.pop(counter)
            self.notify()

    def move_up(self, _, item: str, counter: int):
        val = self.values.pop(counter)

M po/de.po => po/de.po +43 -34
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 09:53+0200\n"
"POT-Creation-Date: 2024-08-15 12:29+0200\n"
"PO-Revision-Date: 2024-04-20 14:18+0000\n"
"Last-Translator: hurzelchen <hurzelchen@users.noreply.translate.codeberg."
"org>\n"


@@ 482,7 482,7 @@ msgid "Change playlist title and description. (Closes the dialog)"
msgstr ""
"Titel und Beschreibung der Wiedergabeliste ändern. (Schließt den Dialog)"

#: ../melon/playlist/__init__.py:244 ../melon/playlist/__init__.py:290
#: ../melon/playlist/__init__.py:244
msgid "Delete Playlist"
msgstr "Wiedergabeliste löschen"



@@ 500,34 500,25 @@ msgstr "Schließen"
msgid "Close without changing anything"
msgstr ""

#: ../melon/playlist/__init__.py:293
msgid "Do you really want to delete this playlist?"
msgstr "Möchtest du diese Wiedergabeliste wirklich löschen?"
#: ../melon/playlist/__init__.py:290
msgid "Delete Playlist?"
msgstr ""

#: ../melon/playlist/__init__.py:294
msgid "This cannot be undone"
msgstr "Dies kann nicht rückgängig gemacht werden"
#: ../melon/playlist/__init__.py:291
msgid "Do you really want to delete this playlist? This can not be undone."
msgstr ""

#: ../melon/playlist/__init__.py:299 ../melon/playlist/create.py:54
#: ../melon/playlist/__init__.py:293 ../melon/playlist/create.py:54
#: ../melon/playlist/create.py:109 ../melon/playlist/pick.py:88
#: ../melon/playlist/pick.py:126 ../melon/widgets/preferencerow.py:181
#: ../melon/widgets/preferencerow.py:226
#: ../melon/widgets/preferencerow.py:220
msgid "Cancel"
msgstr "Abbruch"

#: ../melon/playlist/__init__.py:301
msgid "Do not delete the playlist"
msgstr "Wiedergabeliste nicht löschen"

#: ../melon/playlist/__init__.py:304 ../melon/widgets/preferencerow.py:214
#: ../melon/widgets/preferencerow.py:229
#: ../melon/playlist/__init__.py:295 ../melon/widgets/preferencerow.py:222
msgid "Delete"
msgstr "Löschen"

#: ../melon/playlist/__init__.py:304
msgid "Delete this playlist"
msgstr "Diese Wiedergabeliste löschen"

#: ../melon/playlist/create.py:25 ../melon/playlist/pick.py:35
msgid "Video"
msgstr "Video"


@@ 846,25 837,43 @@ msgstr "Gibt den neuen Wert hier ein"
msgid "Value"
msgstr "Wert"

#: ../melon/widgets/preferencerow.py:215
msgid "Delete Item?"
msgstr ""

#: ../melon/widgets/preferencerow.py:217
msgid "Do you really want to delete this item?"
msgstr "Möchtest du den Eintrag wirklich löschen?"
msgid ""
"Do you really want to delete this item? You won't be able to restore it "
"afterwards"
msgstr ""

#: ../melon/widgets/preferencerow.py:218
msgid "You won't be able to restore it afterwards"
msgstr "Eine Wiederherstellung ist nicht möglich"
#: ../melon/window.py:93
msgid "Stream videos on the go"
msgstr "Videos unterwegs streamen"

#: ../melon/widgets/preferencerow.py:226
msgid "Do not remove item"
msgstr "Eintrag nicht entfernen"
#~ msgid "Do you really want to delete this playlist?"
#~ msgstr "Möchtest du diese Wiedergabeliste wirklich löschen?"

#: ../melon/widgets/preferencerow.py:229
msgid "Remove item from list"
msgstr "Eintrag von der Liste entfernen"
#~ msgid "This cannot be undone"
#~ msgstr "Dies kann nicht rückgängig gemacht werden"

#: ../melon/window.py:94
msgid "Stream videos on the go"
msgstr "Videos unterwegs streamen"
#~ msgid "Do not delete the playlist"
#~ msgstr "Wiedergabeliste nicht löschen"

#~ msgid "Delete this playlist"
#~ msgstr "Diese Wiedergabeliste löschen"

#~ msgid "Do you really want to delete this item?"
#~ msgstr "Möchtest du den Eintrag wirklich löschen?"

#~ msgid "You won't be able to restore it afterwards"
#~ msgstr "Eine Wiederherstellung ist nicht möglich"

#~ msgid "Do not remove item"
#~ msgstr "Eintrag nicht entfernen"

#~ msgid "Remove item from list"
#~ msgstr "Eintrag von der Liste entfernen"

#~ msgid ".m3u8 Player"
#~ msgstr ".m3u8 Wiedergabeservice"

M po/fa.po => po/fa.po +36 -33
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.1.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 09:53+0200\n"
"POT-Creation-Date: 2024-08-15 12:29+0200\n"
"PO-Revision-Date: 2024-05-30 09:18+0000\n"
"Last-Translator: sohrabbehdani <sohrabbehdani@users.noreply.translate."
"codeberg.org>\n"


@@ 481,7 481,7 @@ msgstr "ذخیره جزئیات"
msgid "Change playlist title and description. (Closes the dialog)"
msgstr "تغییر عنوان و توضیحات لیست پخش (این پنجره بسته می شود)"

#: ../melon/playlist/__init__.py:244 ../melon/playlist/__init__.py:290
#: ../melon/playlist/__init__.py:244
msgid "Delete Playlist"
msgstr "حذف لیست پخش"



@@ 497,34 497,25 @@ msgstr "بستن"
msgid "Close without changing anything"
msgstr "بستن بدون تغییر دادن چیزی"

#: ../melon/playlist/__init__.py:293
msgid "Do you really want to delete this playlist?"
msgstr "آیا از حذف این لیست‌پخش اطمینان دارید؟"
#: ../melon/playlist/__init__.py:290
msgid "Delete Playlist?"
msgstr ""

#: ../melon/playlist/__init__.py:294
msgid "This cannot be undone"
#: ../melon/playlist/__init__.py:291
msgid "Do you really want to delete this playlist? This can not be undone."
msgstr ""

#: ../melon/playlist/__init__.py:299 ../melon/playlist/create.py:54
#: ../melon/playlist/__init__.py:293 ../melon/playlist/create.py:54
#: ../melon/playlist/create.py:109 ../melon/playlist/pick.py:88
#: ../melon/playlist/pick.py:126 ../melon/widgets/preferencerow.py:181
#: ../melon/widgets/preferencerow.py:226
#: ../melon/widgets/preferencerow.py:220
msgid "Cancel"
msgstr "لغو"

#: ../melon/playlist/__init__.py:301
msgid "Do not delete the playlist"
msgstr "لیست‌پخش را حذف نکن."

#: ../melon/playlist/__init__.py:304 ../melon/widgets/preferencerow.py:214
#: ../melon/widgets/preferencerow.py:229
#: ../melon/playlist/__init__.py:295 ../melon/widgets/preferencerow.py:222
msgid "Delete"
msgstr "حذف"

#: ../melon/playlist/__init__.py:304
msgid "Delete this playlist"
msgstr "حذف این لیست‌پخش"

#: ../melon/playlist/create.py:25 ../melon/playlist/pick.py:35
msgid "Video"
msgstr "ویدیو"


@@ 834,25 825,37 @@ msgstr "مقادیر را اینجا وارد کنید."
msgid "Value"
msgstr "مقدار"

#: ../melon/widgets/preferencerow.py:217
msgid "Do you really want to delete this item?"
msgstr "آیا از حذف این مورد اطمینان دارید؟"

#: ../melon/widgets/preferencerow.py:218
msgid "You won't be able to restore it afterwards"
#: ../melon/widgets/preferencerow.py:215
msgid "Delete Item?"
msgstr ""

#: ../melon/widgets/preferencerow.py:226
msgid "Do not remove item"
msgstr "این مورد را حذف نکن."

#: ../melon/widgets/preferencerow.py:229
msgid "Remove item from list"
msgstr "حذف این مورد از لیست"
#: ../melon/widgets/preferencerow.py:217
msgid ""
"Do you really want to delete this item? You won't be able to restore it "
"afterwards"
msgstr ""

#: ../melon/window.py:94
#: ../melon/window.py:93
msgid "Stream videos on the go"
msgstr "ویدیو‌هارا استریم کن"

#~ msgid "Do you really want to delete this playlist?"
#~ msgstr "آیا از حذف این لیست‌پخش اطمینان دارید؟"

#~ msgid "Do not delete the playlist"
#~ msgstr "لیست‌پخش را حذف نکن."

#~ msgid "Delete this playlist"
#~ msgstr "حذف این لیست‌پخش"

#~ msgid "Do you really want to delete this item?"
#~ msgstr "آیا از حذف این مورد اطمینان دارید؟"

#~ msgid "Do not remove item"
#~ msgstr "این مورد را حذف نکن."

#~ msgid "Remove item from list"
#~ msgstr "حذف این مورد از لیست"

#~ msgid ".m3u8 Player"
#~ msgstr "پخش کننده .m3u8"

M po/melon.pot => po/melon.pot +16 -31
@@ 8,7 8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 09:53+0200\n"
"POT-Creation-Date: 2024-08-15 12:29+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"


@@ 466,7 466,7 @@ msgstr ""
msgid "Change playlist title and description. (Closes the dialog)"
msgstr ""

#: ../melon/playlist/__init__.py:244 ../melon/playlist/__init__.py:290
#: ../melon/playlist/__init__.py:244
msgid "Delete Playlist"
msgstr ""



@@ 482,34 482,25 @@ msgstr ""
msgid "Close without changing anything"
msgstr ""

#: ../melon/playlist/__init__.py:293
msgid "Do you really want to delete this playlist?"
#: ../melon/playlist/__init__.py:290
msgid "Delete Playlist?"
msgstr ""

#: ../melon/playlist/__init__.py:294
msgid "This cannot be undone"
#: ../melon/playlist/__init__.py:291
msgid "Do you really want to delete this playlist? This can not be undone."
msgstr ""

#: ../melon/playlist/__init__.py:299 ../melon/playlist/create.py:54
#: ../melon/playlist/__init__.py:293 ../melon/playlist/create.py:54
#: ../melon/playlist/create.py:109 ../melon/playlist/pick.py:88
#: ../melon/playlist/pick.py:126 ../melon/widgets/preferencerow.py:181
#: ../melon/widgets/preferencerow.py:226
#: ../melon/widgets/preferencerow.py:220
msgid "Cancel"
msgstr ""

#: ../melon/playlist/__init__.py:301
msgid "Do not delete the playlist"
msgstr ""

#: ../melon/playlist/__init__.py:304 ../melon/widgets/preferencerow.py:214
#: ../melon/widgets/preferencerow.py:229
#: ../melon/playlist/__init__.py:295 ../melon/widgets/preferencerow.py:222
msgid "Delete"
msgstr ""

#: ../melon/playlist/__init__.py:304
msgid "Delete this playlist"
msgstr ""

#: ../melon/playlist/create.py:25 ../melon/playlist/pick.py:35
msgid "Video"
msgstr ""


@@ 806,22 797,16 @@ msgstr ""
msgid "Value"
msgstr ""

#: ../melon/widgets/preferencerow.py:217
msgid "Do you really want to delete this item?"
#: ../melon/widgets/preferencerow.py:215
msgid "Delete Item?"
msgstr ""

#: ../melon/widgets/preferencerow.py:218
msgid "You won't be able to restore it afterwards"
msgstr ""

#: ../melon/widgets/preferencerow.py:226
msgid "Do not remove item"
msgstr ""

#: ../melon/widgets/preferencerow.py:229
msgid "Remove item from list"
#: ../melon/widgets/preferencerow.py:217
msgid ""
"Do you really want to delete this item? You won't be able to restore it "
"afterwards"
msgstr ""

#: ../melon/window.py:94
#: ../melon/window.py:93
msgid "Stream videos on the go"
msgstr ""

M po/nl.po => po/nl.po +43 -34
@@ 7,7 7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Melon 0.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 09:53+0200\n"
"POT-Creation-Date: 2024-08-15 12:29+0200\n"
"PO-Revision-Date: 2024-07-17 09:18+0000\n"
"Last-Translator: Vistaus <Vistaus@users.noreply.translate.codeberg.org>\n"
"Language-Team: Dutch <https://translate.codeberg.org/projects/melon/melon-"


@@ 484,7 484,7 @@ msgid "Change playlist title and description. (Closes the dialog)"
msgstr ""
"Wijzig de afspeellijsttitel en -beschrijving (het venster wordt gesloten)"

#: ../melon/playlist/__init__.py:244 ../melon/playlist/__init__.py:290
#: ../melon/playlist/__init__.py:244
msgid "Delete Playlist"
msgstr "Afspeellijst verwijderen"



@@ 502,34 502,25 @@ msgstr "Sluiten"
msgid "Close without changing anything"
msgstr "Sluiten zonder opslaan"

#: ../melon/playlist/__init__.py:293
msgid "Do you really want to delete this playlist?"
msgstr "Weet u zeker dat u deze afspeellijst wilt verwijderen?"
#: ../melon/playlist/__init__.py:290
msgid "Delete Playlist?"
msgstr ""

#: ../melon/playlist/__init__.py:294
msgid "This cannot be undone"
msgstr "Dit is onomkeerbaar"
#: ../melon/playlist/__init__.py:291
msgid "Do you really want to delete this playlist? This can not be undone."
msgstr ""

#: ../melon/playlist/__init__.py:299 ../melon/playlist/create.py:54
#: ../melon/playlist/__init__.py:293 ../melon/playlist/create.py:54
#: ../melon/playlist/create.py:109 ../melon/playlist/pick.py:88
#: ../melon/playlist/pick.py:126 ../melon/widgets/preferencerow.py:181
#: ../melon/widgets/preferencerow.py:226
#: ../melon/widgets/preferencerow.py:220
msgid "Cancel"
msgstr "Annuleren"

#: ../melon/playlist/__init__.py:301
msgid "Do not delete the playlist"
msgstr "Afspeellijst niet verwijderen"

#: ../melon/playlist/__init__.py:304 ../melon/widgets/preferencerow.py:214
#: ../melon/widgets/preferencerow.py:229
#: ../melon/playlist/__init__.py:295 ../melon/widgets/preferencerow.py:222
msgid "Delete"
msgstr "Verwijderen"

#: ../melon/playlist/__init__.py:304
msgid "Delete this playlist"
msgstr "Afspeellijst verwijderen"

#: ../melon/playlist/create.py:25 ../melon/playlist/pick.py:35
msgid "Video"
msgstr "Video"


@@ 844,25 835,43 @@ msgstr "Voer hier de nieuwe waarde in"
msgid "Value"
msgstr "Waarde"

#: ../melon/widgets/preferencerow.py:215
msgid "Delete Item?"
msgstr ""

#: ../melon/widgets/preferencerow.py:217
msgid "Do you really want to delete this item?"
msgstr "Weet u zeker dat u dit item wilt verwijderen?"
msgid ""
"Do you really want to delete this item? You won't be able to restore it "
"afterwards"
msgstr ""

#: ../melon/widgets/preferencerow.py:218
msgid "You won't be able to restore it afterwards"
msgstr "U kunt nadien geen herstel uitvoeren"
#: ../melon/window.py:93
msgid "Stream videos on the go"
msgstr "Video's onderweg streamen"

#: ../melon/widgets/preferencerow.py:226
msgid "Do not remove item"
msgstr "Item niet verwijderen"
#~ msgid "Do you really want to delete this playlist?"
#~ msgstr "Weet u zeker dat u deze afspeellijst wilt verwijderen?"

#: ../melon/widgets/preferencerow.py:229
msgid "Remove item from list"
msgstr "Item verwijderen van lijst"
#~ msgid "This cannot be undone"
#~ msgstr "Dit is onomkeerbaar"

#: ../melon/window.py:94
msgid "Stream videos on the go"
msgstr "Video's onderweg streamen"
#~ msgid "Do not delete the playlist"
#~ msgstr "Afspeellijst niet verwijderen"

#~ msgid "Delete this playlist"
#~ msgstr "Afspeellijst verwijderen"

#~ msgid "Do you really want to delete this item?"
#~ msgstr "Weet u zeker dat u dit item wilt verwijderen?"

#~ msgid "You won't be able to restore it afterwards"
#~ msgstr "U kunt nadien geen herstel uitvoeren"

#~ msgid "Do not remove item"
#~ msgstr "Item niet verwijderen"

#~ msgid "Remove item from list"
#~ msgstr "Item verwijderen van lijst"

#~ msgid ".m3u8 Player"
#~ msgstr ".m3u8-speler"