Commit efb3237e authored by Lennart Poettering's avatar Lennart Poettering
Browse files

ask-password: popup notification when we ask for a password

parent ad6ab0af
...@@ -736,6 +736,7 @@ systemd_ask_password_agent_VALAFLAGS = \ ...@@ -736,6 +736,7 @@ systemd_ask_password_agent_VALAFLAGS = \
--pkg=gtk+-2.0 \ --pkg=gtk+-2.0 \
--pkg=linux \ --pkg=linux \
--pkg=gio-unix-2.0 \ --pkg=gio-unix-2.0 \
--pkg=libnotify \
-g -g
systemd_ask_password_agent_LDADD = \ systemd_ask_password_agent_LDADD = \
......
...@@ -226,7 +226,7 @@ AC_SUBST(AUDIT_LIBS) ...@@ -226,7 +226,7 @@ AC_SUBST(AUDIT_LIBS)
have_gtk=no have_gtk=no
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools])) AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
if test "x$enable_gtk" != "xno"; then 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_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS) AC_SUBST(GTK_LIBS)
......
...@@ -22,6 +22,7 @@ using GLib; ...@@ -22,6 +22,7 @@ using GLib;
using DBus; using DBus;
using Linux; using Linux;
using Posix; using Posix;
using Notify;
[CCode (cheader_filename = "time.h")] [CCode (cheader_filename = "time.h")]
extern int clock_gettime(int id, out timespec ts); extern int clock_gettime(int id, out timespec ts);
...@@ -84,7 +85,7 @@ public class MyStatusIcon : StatusIcon { ...@@ -84,7 +85,7 @@ public class MyStatusIcon : StatusIcon {
public MyStatusIcon() throws GLib.Error { public MyStatusIcon() throws GLib.Error {
GLib.Object(icon_name : "dialog-password"); GLib.Object(icon_name : "dialog-password");
set_title("System Password Agent"); set_title("System Password");
directory = File.new_for_path("/dev/.systemd/ask-password/"); directory = File.new_for_path("/dev/.systemd/ask-password/");
file_monitor = directory.monitor_directory(0); file_monitor = directory.monitor_directory(0);
...@@ -138,7 +139,7 @@ public class MyStatusIcon : StatusIcon { ...@@ -138,7 +139,7 @@ public class MyStatusIcon : StatusIcon {
} }
bool load_password() { bool load_password() throws GLib.Error {
KeyFile key_file = new KeyFile(); KeyFile key_file = new KeyFile();
...@@ -179,6 +180,12 @@ public class MyStatusIcon : StatusIcon { ...@@ -179,6 +180,12 @@ public class MyStatusIcon : StatusIcon {
set_from_icon_name(icon); set_from_icon_name(icon);
set_visible(true); 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; return true;
} }
...@@ -236,6 +243,7 @@ void show_error(string e) { ...@@ -236,6 +243,7 @@ void show_error(string e) {
int main(string[] args) { int main(string[] args) {
try { try {
Gtk.init_with_args(ref args, "[OPTION...]", entries, "systemd-ask-password-agent"); Gtk.init_with_args(ref args, "[OPTION...]", entries, "systemd-ask-password-agent");
Notify.init("Password Agent");
MyStatusIcon i = new MyStatusIcon(); MyStatusIcon i = new MyStatusIcon();
Gtk.main(); Gtk.main();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment