[krb5-auth-dialog] Require libnotify and drop old no tray-icon mode



commit 1b921c629cb7a5a104afb577d3fd6f56d20b5932
Author: Guido Günther <agx sigxcpu org>
Date:   Fri Feb 11 17:06:52 2011 +0100

    Require libnotify and drop old no tray-icon mode
    
    that simply pops up a dialog. Libnotify supports persistent
    notifications for this now.

 configure.ac    |   45 ++++++++++-----------------------------------
 src/ka-applet.c |   16 ----------------
 src/ka-dialog.c |   32 +++++---------------------------
 3 files changed, 15 insertions(+), 78 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 370a1b7..f356f95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,7 @@ PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_REQUIRED)
 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= $GCONF_REQUIRED)
 PKG_CHECK_MODULES(GIO, [gio-2.0, gio-unix-2.0])
 PKG_CHECK_MODULES(GMODULE, gmodule-2.0)
+PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
 
 dnl check for deprecated symbols:
 dnl GNOME_MAINTAINER_MODE_DEFINES
@@ -184,42 +185,16 @@ if test "x$enable_network_manager" = "xyes"; then
 fi
 AM_CONDITIONAL([ENABLE_NETWORK_MANAGER],[test "x$enable_network_manager" = "xyes"])
 
+
 dnl libnotify
-LIBNOTIFY_CFLAGS=
-LIBNOTIFY_LIBS=
-AC_ARG_WITH(libnotify,
-  [  --with-libnotify	use libnotify for status messages],
-  [],
-  [with_libnotify=check])
-
-if test "x$with_libnotify" = "xyes" -o "x$with_libnotify" = "xcheck"; then
-  PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED,
-    [with_libnotify=yes], [
-    if test "x$with_libnotify" = "xcheck" ; then
-       with_libnotify=no
-    else
-       AC_MSG_ERROR(
-         [You must install libnotify >= $LIBNOTIFY_REQUIRED to compile krb5-auth-dialog])
-    fi
-  ])
-  if test "x$with_libnotify" = "xyes" ; then
-    AC_DEFINE_UNQUOTED(HAVE_LIBNOTIFY, 1,
-      [use libnotify for status messages])
-  fi
-fi
-AM_CONDITIONAL(HAVE_LIBNOTIFY, [test "x$with_libnotify" = "xyes"])
-AC_SUBST(LIBNOTIFY_CFLAGS)
-AC_SUBST(LIBNOTIFY_LIBS)
-
-if test "x$with_libnotify" = "xyes" ; then
-    savedCFLAGS="$CFLAGS"
-    CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
-    savedLIBS="$LIBS"
-    LIBS="$LIBNOTIFY_LIBS $LIBS"
-    AC_CHECK_FUNCS([notify_notification_new_with_status_icon])
-    CFLAGS="$savedCFLAGS"
-    LIBS="$savedLIBS"
-fi
+savedCFLAGS="$CFLAGS"
+savedLIBS="$LIBS"
+CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
+LIBS="$LIBNOTIFY_LIBS $LIBS"
+AC_CHECK_FUNCS([notify_notification_new_with_status_icon])
+CFLAGS="$savedCFLAGS"
+LIBS="$savedLIBS"
+
 
 dnl libgnome-control-center
 dnl for the new panel
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 4f05b88..9ed36ee 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -30,9 +30,7 @@
 #include "ka-tickets.h"
 #include "ka-plugin-loader.h"
 #include "ka-closures.h"
-#ifdef HAVE_LIBNOTIFY
 #include <libnotify/notify.h>
-#endif
 
 #define NOTIFY_SECONDS 300
 
@@ -79,9 +77,7 @@ struct _KaAppletPrivate {
     int pw_prompt_secs;         /* when to start prompting for a password */
     KaPluginLoader *loader;     /* Plugin loader */
 
-#ifdef HAVE_LIBNOTIFY
     NotifyNotification *notification;   /* notification messages */
-#endif                          /* HAVE_LIBNOTIFY */
     char *krb_msg;              /* Additional banner delivered by Kerberos */
     const char *notify_gconf_key;       /* disable notification gconf key */
     char *principal;            /* the principal to request */
@@ -402,7 +398,6 @@ ka_applet_select_icon (KaApplet *applet, int remaining)
 }
 
 
-#ifdef HAVE_LIBNOTIFY
 static gboolean
 ka_show_notification (KaApplet *applet)
 {
@@ -518,17 +513,6 @@ ka_send_event_notification (KaApplet *applet,
     }
     ka_show_notification (applet);
 }
-#else
-static void
-ka_send_event_notification (KaApplet *applet G_GNUC_UNUSED,
-                            const char *summary G_GNUC_UNUSED,
-                            const char *message G_GNUC_UNUSED,
-                            const char *icon G_GNUC_UNUSED,
-                            const char *action G_GNUC_UNUSED)
-{
-}
-#endif /* ! HAVE_LIBNOTIFY */
-
 
 /*
  * update the tray icon's tooltip and icon
diff --git a/src/ka-dialog.c b/src/ka-dialog.c
index a59938c..ce86367 100644
--- a/src/ka-dialog.c
+++ b/src/ka-dialog.c
@@ -487,38 +487,17 @@ ka_nm_client_state_changed_cb (NMClient *client,
 static gboolean
 credentials_expiring (gpointer *data)
 {
-	int retval;
-	gboolean give_up;
 	KaApplet* applet = KA_APPLET(data);
 
 	KA_DEBUG("Checking expiry <%ds", ka_applet_get_pw_prompt_secs(applet));
 	if (credentials_expiring_real (applet) && is_online) {
 		KA_DEBUG("Expiry @ %ld", creds_expiry);
 
-		if (!ka_renew_credentials (applet)) {
+		if (!ka_renew_credentials (applet))
 			KA_DEBUG("Credentials renewed");
-			goto out;
-		}
-
-		/* no popup when using a trayicon */
-		if (ka_applet_get_show_trayicon(applet))
-			goto out;
-
-		give_up = canceled && (creds_expiry == canceled_creds_expiry);
-		if (!give_up) {
-			do {
-				retval = grab_credentials (applet);
-				give_up = canceled &&
-					  (creds_expiry == canceled_creds_expiry);
-			} while ((retval != 0) &&
-			         (retval != KRB5_REALM_CANT_RESOLVE) &&
-			         (retval != KRB5_KDC_UNREACH) &&
-				 invalid_auth &&
-			         !give_up);
-		}
 	}
-out:
 	ka_applet_update_status(applet, creds_expiry);
+
 	return TRUE;
 }
 
@@ -1118,10 +1097,9 @@ main (int argc, char *argv[])
 			return 1;
 		ka_nm_init();
 
-		if (credentials_expiring ((gpointer)applet)) {
-			g_timeout_add_seconds (CREDENTIAL_CHECK_INTERVAL, (GSourceFunc)credentials_expiring, applet);
-			monitor = monitor_ccache (applet);
-		}
+		g_timeout_add_seconds (CREDENTIAL_CHECK_INTERVAL, (GSourceFunc)credentials_expiring, applet);
+		monitor = monitor_ccache (applet);
+
 		ka_dbus_service(applet);
 		gtk_main ();
 	}



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