FAM (and xffm)

Jens Luedicke jens at irs-net.com
Sat Feb 15 22:09:49 CET 2003


On Sat, 2003-02-15 at 01:13, Jens Luedicke wrote:

> If its ok, and wanted, I will dig myself into the xffm 
> code to look for possible uses. 

Ok, I messed a little around and wrote two new
functions in monitor.c

I replaced local_monitor() calls with fam_monitor()
calls. 

Comments?

<code>

gint fam_pending(FAMConnection fc)
{
	if (FAMPending(&fc) == 1) {
		printf("xffm: fam event!\n");		
	}

	return TRUE;
}

gint fam_monitor(GtkTreeView *treeview)
{
	FAMConnection fc;
	FAMRequest fr;
	tree_details_t *tree_details;
	tree_entry_t *en;
	GtkTreeIter iter;

	if (FAMOpen(&fc) == -1) {
		printf("xffm: fam open failed!\n");
		FAMClose(&fc);
		return FALSE;
	} else {
		printf("xffm: fam open success!\n");
	}

	tree_details = get_tree_details (treeview);

	if (!tree_details) {
		FAMClose(&fc);
		return FALSE;
	}

	get_local_root (treeview, &iter, &en);

	if (FAMMonitorDirectory(&fc, en->path, &fr, NULL) == -1) {
		printf("xffm: fam monitor failed: %s\n", en->path);
		FAMClose(&fc);
		return FALSE;
	} else {
		printf("xffm: fam monitor success: %s\n", en->path);
	}

	if (!tree_details->timer) {
		tree_details->timer = gtk_timeout_add (TIMERVAL,(GtkFunction)
fam_pending, &fc);
	}

	return TRUE;
}

</code>

-- 
Jens Luedicke <jens at irs-net.com>

"Never offend people with style when you can offend them with
substance."
--Sam Brown






More information about the Xfce4-dev mailing list