[shotwell: 1/2] EventsPage: fix "Edit Event Comment" when photo selected
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell: 1/2] EventsPage: fix "Edit Event Comment" when photo selected
- Date: Sat, 26 Jun 2021 11:06:17 +0000 (UTC)
commit 107fb14ac85164e469546ee0531738cfef54254f
Author: Eric <eric daigle zaclys net>
Date: Mon Jun 14 17:15:49 2021 -0400
EventsPage: fix "Edit Event Comment" when photo selected
The "Edit Event Comment" button in the event context menu currently triggers the same
on_edit_comment function as the "Edit Comment" button in the photo context menu.
As described in #4929, clicking "Edit Event Comment" with a photo selected thus
edits that photo's comment rather than the event comment.
This MR creates a separate on_edit_event_comment function for "Edit Event Comment"
and changes on_edit_comment to handle only the photo context menu's "Edit Comment."
This allows editing of both photo and event comments to work as expected.
Fixes #4929
data/ui/event.ui | 2 +-
src/events/EventPage.vala | 25 +++++++++++++------------
2 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/data/ui/event.ui b/data/ui/event.ui
index 8c0dcfee..ea2e0c39 100644
--- a/data/ui/event.ui
+++ b/data/ui/event.ui
@@ -401,7 +401,7 @@
</item>
<item>
<attribute name="label" translatable="yes">Edit _Comment…</attribute>
- <attribute name="action">win.EditComment</attribute>
+ <attribute name="action">win.EditEventComment</attribute>
</item>
</section>
</submenu>
diff --git a/src/events/EventPage.vala b/src/events/EventPage.vala
index a482ab88..1375c39f 100644
--- a/src/events/EventPage.vala
+++ b/src/events/EventPage.vala
@@ -50,7 +50,8 @@ public class EventPage : CollectionPage {
private const GLib.ActionEntry[] entries = {
{ "MakePrimary", on_make_primary },
{ "Rename", on_rename },
- { "EditEventComment", on_edit_comment }
+ { "EditComment", on_edit_comment },
+ { "EditEventComment", on_edit_event_comment }
};
protected override void add_actions(GLib.ActionMap map) {
@@ -96,19 +97,19 @@ public class EventPage : CollectionPage {
set_page_name(page_event.get_name());
}
- protected override void on_edit_comment() {
- if (get_view().get_selected_count() == 0) {
- EditCommentDialog edit_comment_dialog = new EditCommentDialog(page_event.get_comment(),
- true);
- string? new_comment = edit_comment_dialog.execute();
- if (new_comment == null)
- return;
-
- EditEventCommentCommand command = new EditEventCommentCommand(page_event, new_comment);
- get_command_manager().execute(command);
+ private void on_edit_event_comment() {
+ EditCommentDialog edit_comment_dialog = new EditCommentDialog(page_event.get_comment(),
+ true);
+ string? new_comment = edit_comment_dialog.execute();
+ if (new_comment == null)
return;
- }
+ EditEventCommentCommand command = new EditEventCommentCommand(page_event, new_comment);
+ get_command_manager().execute(command);
+ return;
+ }
+
+ protected override void on_edit_comment() {
base.on_edit_comment();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]