Skip to content

Commit

Permalink
GNOME - Clear Publishing Date
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Oct 22, 2023
1 parent be889f5 commit 2e3148f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
34 changes: 24 additions & 10 deletions NickvisionTagger.GNOME/Blueprints/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
}
}
Expand All @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions NickvisionTagger.GNOME/Views/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) =>
Expand Down

0 comments on commit 2e3148f

Please sign in to comment.