From 2e3148f3ad978f387f041ab1f2441f61b71e1fe8 Mon Sep 17 00:00:00 2001 From: Nick Logozzo Date: Sun, 22 Oct 2023 13:26:09 -0400 Subject: [PATCH] GNOME - Clear Publishing Date --- NickvisionTagger.GNOME/Blueprints/window.blp | 34 ++++++++++++++------ NickvisionTagger.GNOME/Views/MainWindow.cs | 8 +++++ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/NickvisionTagger.GNOME/Blueprints/window.blp b/NickvisionTagger.GNOME/Blueprints/window.blp index a1627aae..61a5d81e 100644 --- a/NickvisionTagger.GNOME/Blueprints/window.blp +++ b/NickvisionTagger.GNOME/Blueprints/window.blp @@ -583,16 +583,30 @@ Adw.ApplicationWindow _root { activatable-widget: _publishingDateButton; [suffix] - Gtk.MenuButton _publishingDateButton { - valign: center; - direction: none; - popover: Gtk.Popover { - Gtk.Calendar _publishingDateCalendar { - name: "calendarPublishingDate"; - } - }; + Gtk.Box { + orientation: horizontal; + spacing: 6; + + Gtk.MenuButton _publishingDateButton { + valign: center; + direction: none; + popover: Gtk.Popover { + Gtk.Calendar _publishingDateCalendar { + name: "calendarPublishingDate"; + } + }; + + styles ["calendar-button"] + } - styles ["calendar-button"] + + Gtk.Button _clearPublishingDateButton { + valign: center; + tooltip-text: _("Clear Publishing Date"); + icon-name: "user-trash-symbolic"; + + styles ["flat"] + } } } } @@ -604,7 +618,7 @@ Adw.ApplicationWindow _root { header-suffix: Gtk.Button _addNewPropertyButton { valign: center; - tooltip-text: "Add New Property"; + tooltip-text: _("Add New Property"); action-name: "win.addCustomProperty"; Adw.ButtonContent { diff --git a/NickvisionTagger.GNOME/Views/MainWindow.cs b/NickvisionTagger.GNOME/Views/MainWindow.cs index 2ffb73cc..bbe979d3 100644 --- a/NickvisionTagger.GNOME/Views/MainWindow.cs +++ b/NickvisionTagger.GNOME/Views/MainWindow.cs @@ -124,6 +124,7 @@ public struct TaggerDateTime [Gtk.Connect] private readonly Adw.EntryRow _publisherRow; [Gtk.Connect] private readonly Gtk.MenuButton _publishingDateButton; [Gtk.Connect] private readonly Gtk.Calendar _publishingDateCalendar; + [Gtk.Connect] private readonly Gtk.Button _clearPublishingDateButton; [Gtk.Connect] private readonly Adw.PreferencesGroup _customPropertiesGroup; [Gtk.Connect] private readonly Gtk.Label _fingerprintLabel; [Gtk.Connect] private readonly Gtk.Button _copyFingerprintButton; @@ -339,6 +340,13 @@ private MainWindow(Gtk.Builder builder, MainWindowController controller, Adw.App } _updatePublishingDate = true; }; + _clearPublishingDateButton.OnClicked += (sender, e) => + { + _updatePublishingDate = false; + _publishingDateButton.SetLabel(_("Pick a date")); + gtk_calendar_select_day(_publishingDateCalendar.Handle, ref g_date_time_new_local(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0)); + TagPropertyChanged(); + }; _fingerprintLabel.SetEllipsize(Pango.EllipsizeMode.End); _copyFingerprintButton.OnClicked += CopyFingerprintToClipboard; OnNotify += (sender, e) =>