[seed] [notify-test] Make notify test only notify on file creation, and show semi-useful information, just
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seed] [notify-test] Make notify test only notify on file creation, and show semi-useful information, just
- Date: Sat, 1 Aug 2009 03:19:29 +0000 (UTC)
commit 9ef3f053e9a81411026b1670e8bba12d3bf08137
Author: Tim Horton <hortont424 gmail com>
Date: Fri Jul 31 23:19:04 2009 -0400
[notify-test] Make notify test only notify on file creation, and show semi-useful information, just for fun
examples/notify-test.js | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/examples/notify-test.js b/examples/notify-test.js
index 282d96e..2cb5e26 100755
--- a/examples/notify-test.js
+++ b/examples/notify-test.js
@@ -1,19 +1,26 @@
#!/usr/bin/env seed
+
Gtk = imports.gi.Gtk;
Gio = imports.gi.Gio;
Notify = imports.gi.Notify;
Gtk.init(Seed.argv);
-function file_changed(monitor, child, other, event){
- var notification =
- new Notify.Notification({summary: "File Notification",
- body : "It's not clear what notification system this file is providing an example of." });
- notification.set_timeout(5000);
+function file_changed(monitor, child, other, event)
+{
+ if(event != Gio.FileMonitorEvent.CREATED)
+ return;
+
+ var notification = new Notify.Notification({
+ summary: "File '" + child.get_basename() + "' Created",
+ body : child.get_path()
+ });
+
+ notification.set_timeout(1000);
notification.show();
}
-print("Monitoring files in current directory");
+print("Monitoring files created in current directory");
Notify.init("Seed Test!");
file = Gio.file_new_for_path(".");
@@ -23,4 +30,3 @@ monitor.signal.changed.connect(file_changed);
Gtk.main();
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]