have_gtk=no
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
if test "x$enable_gtk" != "xno"; then
- PKG_CHECK_MODULES(GTK, [ gtk+-2.0 gio-unix-2.0 ],
+ PKG_CHECK_MODULES(GTK, [ gtk+-2.0 gio-unix-2.0 libnotify ],
[AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
using DBus;
using Linux;
using Posix;
+using Notify;
[CCode (cheader_filename = "time.h")]
extern int clock_gettime(int id, out timespec ts);
public MyStatusIcon() throws GLib.Error {
GLib.Object(icon_name : "dialog-password");
- set_title("System Password Agent");
+ set_title("System Password");
directory = File.new_for_path("/dev/.systemd/ask-password/");
file_monitor = directory.monitor_directory(0);
}
- bool load_password() {
+ bool load_password() throws GLib.Error {
KeyFile key_file = new KeyFile();
set_from_icon_name(icon);
set_visible(true);
+
+ Notification n = new Notification(title, message, icon, null);
+ n.attach_to_status_icon(this);
+ n.set_timeout(5000);
+ n.show();
+
return true;
}
int main(string[] args) {
try {
Gtk.init_with_args(ref args, "[OPTION...]", entries, "systemd-ask-password-agent");
+ Notify.init("Password Agent");
MyStatusIcon i = new MyStatusIcon();
Gtk.main();