aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcaillon <caillon@517b70f8-ed25-0410-8bf6-f5db08f7b76e>2005-11-03 23:05:10 +0000
committercaillon <caillon@517b70f8-ed25-0410-8bf6-f5db08f7b76e>2005-11-03 23:05:10 +0000
commit286470ef0a8d78b6f4f2151fb197b1041355f89a (patch)
tree357a7d61028732018f25e3058e37c5ef20be0c3f
parentf270acc73e75aec6177cb8beba086c12ecc79a98 (diff)
2005-11-03 Christopher Aillon <caillon@redhat.com>
* src/krb5-auth-dialog.c: Consolidate how we figure out the expiry text git-svn-id: http://svn.gnome.org/svn/krb5-auth-dialog/trunk@47 517b70f8-ed25-0410-8bf6-f5db08f7b76e
-rw-r--r--ChangeLog5
-rw-r--r--src/krb5-auth-dialog.c37
2 files changed, 28 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 820ee56..bdb2f9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-11-03 Christopher Aillon <caillon@redhat.com>
+ * src/krb5-auth-dialog.c: Consolidate how we figure out the
+ expiry text
+
+2005-11-03 Christopher Aillon <caillon@redhat.com>
+
* src/krb5-auth-dialog.c: Use ngettext () where appropriate
2005-11-02 Nalin Dahyabhai <nalin@redhat.com>
diff --git a/src/krb5-auth-dialog.c b/src/krb5-auth-dialog.c
index 2f43210..b02a632 100644
--- a/src/krb5-auth-dialog.c
+++ b/src/krb5-auth-dialog.c
@@ -45,6 +45,26 @@ static gint creds_expiry;
static int renew_credentials ();
static gboolean get_tgt_from_ccache (krb5_context context, krb5_creds *creds);
+static gchar* minutes_to_expiry_text (int minutes)
+{
+ gchar *expiry_text;
+ gchar *tmp;
+
+ if (minutes > 0)
+ expiry_text = g_strdup_printf (ngettext("Your credentials expire in %d minute",
+ "Your credentials expire in %d minutes",
+ minutes),
+ minutes);
+ else
+ {
+ expiry_text = g_strdup (_("Your credentials have expired"));
+ tmp = g_strdup_printf ("<span foreground=\"red\">%s</span>", expiry_text);
+ g_free (expiry_text);
+ expiry_text = tmp;
+ }
+
+ return expiry_text;
+}
static gboolean
krb5_auth_dialog_wrong_label_update_expiry (gpointer data)
@@ -58,13 +78,7 @@ krb5_auth_dialog_wrong_label_update_expiry (gpointer data)
minutes_left = (creds_expiry - time(0)) / 60;
- if (minutes_left > 0)
- expiry_text = g_strdup_printf (ngettext("Your credentials expire in %d minute",
- "Your credentials expire in %d minutes",
- minutes_left),
- minutes_left);
- else
- expiry_text = g_strdup (_("Your credentials have expired"));
+ expiry_text = minutes_to_expiry_text (minutes_left);
expiry_markup = g_strdup_printf ("<span size=\"smaller\" style=\"italic\">%s</span>", expiry_text);
gtk_label_set_markup (GTK_LABEL (label), expiry_markup);
@@ -127,13 +141,8 @@ krb5_auth_dialog_setup (GtkWidget *dialog,
else
{
int minutes_left = (creds_expiry - time(0)) / 60;
- if (minutes_left > 0)
- wrong_text = g_strdup_printf (ngettext("Your credentials expire in %d minute",
- "Your credentials expire in %d minutes",
- minutes_left),
- minutes_left);
- else
- wrong_text = g_strdup (_("Your credentials have expired"));
+
+ wrong_text = minutes_to_expiry_text (minutes_left);
}
}