[seahorse/gnome-40] gpgme: Use proper month in expires dialog



commit 493c768f54cb06e2cba57924c7eeb87d742bb061
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Jul 25 12:00:28 2021 +0200

    gpgme: Use proper month in expires dialog
    
    `GDateTime` uses month numbers from 1 to 12.
    `GtkCalender` uses month numbers from 0 to 11.
    
    If you combine both, you need to be careful.
    
    Fixes https://gitlab.gnome.org/GNOME/seahorse/-/issues/327
    Fixes https://gitlab.gnome.org/GNOME/seahorse/-/issues/328

 pgp/seahorse-gpgme-expires-dialog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/pgp/seahorse-gpgme-expires-dialog.c b/pgp/seahorse-gpgme-expires-dialog.c
index 07261e01..a9acebe3 100644
--- a/pgp/seahorse-gpgme-expires-dialog.c
+++ b/pgp/seahorse-gpgme-expires-dialog.c
@@ -63,7 +63,7 @@ seahorse_gpgme_expires_dialog_response (GtkDialog *dialog, int response)
         g_autoptr(GDateTime) now = NULL;
 
         gtk_calendar_get_date (GTK_CALENDAR (self->calendar), &y, &m, &d);
-        expires = g_date_time_new_utc (y, m, d, 0, 0, 0);
+        expires = g_date_time_new_utc (y, m + 1, d, 0, 0, 0);
         now = g_date_time_new_now_utc ();
 
         if (g_date_time_compare (expires, now) <= 0) {
@@ -166,7 +166,7 @@ seahorse_gpgme_expires_dialog_constructed (GObject *obj)
         gtk_widget_set_sensitive (self->calendar, TRUE);
 
         g_date_time_get_ymd (expires, &y, &m, &d);
-        gtk_calendar_select_month (GTK_CALENDAR (self->calendar), m, y);
+        gtk_calendar_select_month (GTK_CALENDAR (self->calendar), m - 1, y);
         gtk_calendar_select_day (GTK_CALENDAR (self->calendar), d);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]