Revision 2466 src/addressbook.c

addressbook.c (revision 2466)
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2009 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2010 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
1071 1071
		}
1072 1072
		addressbook_list_select_clear();
1073 1073
		addressbook_reopen();
1074
		addressbook_modified();
1074 1075
		return;
1075 1076
	} else if (pobj->type == ADDR_ITEM_GROUP) {
1076 1077
		/* Items inside groups */
......
1991 1992
				if (gtkut_tree_row_reference_equal(addrbook.tree_selected, addrbook.tree_opened)) {
1992 1993
					addressbook_reopen();
1993 1994
				}
1995
				addressbook_modified();
1994 1996
			}
1995 1997
		}
1996 1998
	}
......
2002 2004
			if (gtkut_tree_row_reference_equal(addrbook.tree_selected, addrbook.tree_opened)) {
2003 2005
				addressbook_reopen();
2004 2006
			}
2007
			addressbook_modified();
2005 2008
		}
2006 2009
	}
2007 2010
	else if( pobj->type == ADDR_ITEM_GROUP ) {
......
2309 2312

  
2310 2313
	if (gtkut_tree_row_reference_equal(addrbook.tree_selected, addrbook.tree_opened))
2311 2314
		addressbook_reopen();
2315
	addressbook_modified();
2312 2316
}
2313 2317

  
2314 2318
static void close_cb(gpointer data, guint action, GtkWidget *widget)
......
3437 3441
		if (gtkut_tree_row_reference_equal(addrbook.tree_selected, addrbook.tree_opened)) {
3438 3442
			addressbook_reopen();
3439 3443
		}
3444
		addressbook_modified();
3440 3445
	}
3441 3446
}
3442 3447

  
......
4205 4210

  
4206 4211
static GHashTable *addr_table;
4207 4212

  
4213
#if USE_THREADS
4214
G_LOCK_DEFINE_STATIC(addr_table);
4215
#define S_LOCK(name)	G_LOCK(name)
4216
#define S_UNLOCK(name)	G_UNLOCK(name)
4217
#else
4218
#define S_LOCK(name)
4219
#define S_UNLOCK(name)
4220
#endif
4221

  
4208 4222
static gint load_address(const gchar *name, const gchar *address,
4209 4223
			 const gchar *nickname)
4210 4224
{
......
4225 4239

  
4226 4240
static void addressbook_modified(void)
4227 4241
{
4242
	S_LOCK(addr_table);
4243

  
4228 4244
	if (addr_table) {
4229 4245
		hash_free_strings(addr_table);
4230 4246
		g_hash_table_destroy(addr_table);
4231 4247
		addr_table = NULL;
4232 4248
	}
4233 4249

  
4250
	S_UNLOCK(addr_table);
4251

  
4234 4252
	invalidate_address_completion();
4235 4253
}
4236 4254

  
......
4249 4267
	if (!list)
4250 4268
		return FALSE;
4251 4269

  
4270
	S_LOCK(addr_table);
4271

  
4252 4272
	if (!addr_table) {
4253 4273
		addr_table = g_hash_table_new(g_str_hash, g_str_equal);
4254 4274
		addressbook_load_completion(load_address);
......
4268 4288
		g_free(addr);
4269 4289
	}
4270 4290

  
4291
	S_UNLOCK(addr_table);
4292

  
4271 4293
	slist_free_strings(list);
4272 4294

  
4273 4295
	return found;

Also available in: Unified diff