krb5-auth-dialog r87 - in branches/pkinit: . src
- From: guidog svn gnome org
- To: svn-commits-list gnome org
- Subject: krb5-auth-dialog r87 - in branches/pkinit: . src
- Date: Sun, 4 Jan 2009 16:03:57 +0000 (UTC)
Author: guidog
Date: Sun Jan 4 16:03:57 2009
New Revision: 87
URL: http://svn.gnome.org/viewvc/krb5-auth-dialog?rev=87&view=rev
Log:
don't popup the dialog if we have a tray icon
The user can happily refresh the credentials by left clicking on the
tray icon. When using libnotify we also remind him to do so every
NOTIFY_SECONDS (300).
Modified:
branches/pkinit/ChangeLog
branches/pkinit/src/krb5-auth-applet.c
branches/pkinit/src/krb5-auth-dialog.c
Modified: branches/pkinit/src/krb5-auth-applet.c
==============================================================================
--- branches/pkinit/src/krb5-auth-applet.c (original)
+++ branches/pkinit/src/krb5-auth-applet.c Sun Jan 4 16:03:57 2009
@@ -28,23 +28,26 @@
#include "krb5-auth-notify.h"
#endif
+#define NOTIFY_SECONDS 300
/* update the tray icon's tooltip and icon */
int
ka_update_status(Krb5AuthApplet* applet, krb5_timestamp expiry)
{
gchar* expiry_text;
- int interval = expiry - time (0);
+ int now = time(0);
+ int remaining = expiry - now;
+ static int last_warn = 0;
static gboolean expiry_notified = FALSE;
- if (interval > 0) {
+ if (remaining > 0) {
int hours, minutes;
- if (interval >= 3600) {
- hours = interval / 3600;
- minutes = (interval % 3600) / 60;
+ if (remaining >= 3600) {
+ hours = remaining / 3600;
+ minutes = (remaining % 3600) / 60;
expiry_text = g_strdup_printf (_("Your credentials expire in %.2d:%.2dh"), hours, minutes);
} else {
- minutes = interval / 60;
+ minutes = remaining / 60;
expiry_text = g_strdup_printf (ngettext(
"Your credentials expire in %d minute",
"Your credentials expire in %d minutes",
@@ -57,6 +60,11 @@
_("Network credentials valid"),
_("Your Kerberos credentials have been refreshed."), NULL);
expiry_notified = FALSE;
+ } else if (remaining < applet->pw_prompt_secs && (now - last_warn) > NOTIFY_SECONDS) {
+ ka_send_event_notification (applet, NOTIFY_URGENCY_NORMAL,
+ _("Network credentials expiring"),
+ expiry_text, NULL);
+ last_warn = now;
}
#endif
} else {
@@ -68,6 +76,7 @@
_("Network credentials expired"),
_("Your Kerberos credentails have expired."), NULL);
expiry_notified = TRUE;
+ last_warn = 0;
}
#endif
}
Modified: branches/pkinit/src/krb5-auth-dialog.c
==============================================================================
--- branches/pkinit/src/krb5-auth-dialog.c (original)
+++ branches/pkinit/src/krb5-auth-dialog.c Sun Jan 4 16:03:57 2009
@@ -404,7 +404,7 @@
Krb5AuthApplet* applet = (Krb5AuthApplet*) data;
KA_DEBUG("Checking expiry: %d", applet->pw_prompt_secs);
- if (credentials_expiring_real (applet, &renewable) && is_online) {
+ if (credentials_expiring_real (applet, &renewable) && is_online && !applet->show_trayicon) {
give_up = canceled && (creds_expiry == canceled_creds_expiry);
if (!give_up) {
do {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]