[Xfce4-commits] <postler:master> Add a toplevel monitor for newly created folders
Christian Dywan
noreply at xfce.org
Sun Jul 18 20:38:03 CEST 2010
Updating branch refs/heads/master
to c6d8169c7f32151d96923e7a275c3249d634c7c3 (commit)
from 19406c01840b840ceb69aee5ebb904c1d32b9e0e (commit)
commit c6d8169c7f32151d96923e7a275c3249d634c7c3
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Jul 18 20:30:28 2010 +0200
Add a toplevel monitor for newly created folders
postler/postler-folders.vala | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index cae5245..b574cb0 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -48,16 +48,17 @@ public class Postler.Folders : Gtk.TreeView {
NAME,
LOCATION,
INFO,
+ TOPLEVEL_MONITOR,
FOLDER_MONITOR,
UNREAD_MONITOR,
}
public Folders (Accounts accounts) {
this.accounts = accounts;
- store = new Gtk.TreeStore (6,
+ store = new Gtk.TreeStore (7,
typeof (string), typeof (string), typeof (string),
typeof (AccountInfo),
- typeof (GLib.FileMonitor), typeof (GLib.FileMonitor));
+ typeof (GLib.FileMonitor), typeof (GLib.FileMonitor), typeof (GLib.FileMonitor));
set_model (store);
insert_column_with_attributes (-1, "Icon",
new Gtk.CellRendererPixbuf (), "stock-id", Columns.ICON);
@@ -113,6 +114,8 @@ public class Postler.Folders : Gtk.TreeView {
}
try {
+ var folder_dir = File.new_for_path (account_info.path);
+
Gtk.TreeIter account_iter;
bool existing_iter = false;
if (store.iter_children (out account_iter, null)) {
@@ -134,14 +137,21 @@ public class Postler.Folders : Gtk.TreeView {
while (store.iter_children (out iter, account_iter))
store.remove (iter);
}
- else
+ else {
+ var monitor = folder_dir.monitor_directory (0, null);
+ monitor.changed.connect ((monitor, file, other, event) => {
+ var account_infos = new GLib.List<AccountInfo> ();
+ account_infos.prepend (account_info);
+ populate_accounts (account_infos);
+ });
store.insert_with_values (out account_iter, null, -1,
Columns.ICON, Gtk.STOCK_DIRECTORY,
Columns.NAME, account_info.name,
Columns.LOCATION, null,
- Columns.INFO, account_info);
+ Columns.INFO, account_info,
+ Columns.TOPLEVEL_MONITOR, monitor);
+ }
- var folder_dir = File.new_for_path (account_info.path);
var folder_enumerator = folder_dir.enumerate_children (
FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
FileInfo info;
More information about the Xfce4-commits
mailing list