[Evolution-hackers] ESource "changed" signal fix
- From: David Trowbridge <David Trowbridge Colorado edu>
- To: evolution-hackers lists ximian com
- Subject: [Evolution-hackers] ESource "changed" signal fix
- Date: Wed, 29 Dec 2004 08:09:50 -0700
Right now, ESources don't emit a changed signal if the properties
change. This seems to me to be incorrect behavior. This patch fixes it
to emit the signal iff any properties change.
-David
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/ChangeLog,v
retrieving revision 1.205
diff -u -r1.205 ChangeLog
--- ChangeLog 27 Dec 2004 14:30:28 -0000 1.205
+++ ChangeLog 29 Dec 2004 15:03:26 -0000
@@ -1,3 +1,8 @@
+2004-12-29 David Trowbridge <trowbrds cs colorado edu>
+
+ * libedataserver/e-source.c: Add logic for emitting a "changed" signal
+ if any of the properties change
+
2004-12-27 Rodrigo Moya <rodrigo novell com>
* src/server.c (gnome_segv_handler): use the correct binary name (ie,
Index: libedataserver/e-source.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserver/e-source.c,v
retrieving revision 1.16
diff -u -r1.16 e-source.c
--- libedataserver/e-source.c 9 Jul 2004 16:12:35 -0000 1.16
+++ libedataserver/e-source.c 29 Dec 2004 15:03:52 -0000
@@ -278,6 +278,33 @@
}
}
+typedef struct
+{
+ gboolean equal;
+ GHashTable *table2;
+} hash_compare_data;
+
+static void
+compare_str_hash (gpointer key, gpointer value, hash_compare_data *cd)
+{
+ gpointer value2 = g_hash_table_lookup (cd->table2, key);
+ if (value2 == NULL || g_str_equal (value, value2) == FALSE)
+ cd->equal = FALSE;
+}
+
+static gboolean
+compare_str_hashes (GHashTable *table1, GHashTable *table2)
+{
+ hash_compare_data cd;
+
+ if (g_hash_table_size (table1) != g_hash_table_size (table2))
+ return FALSE;
+
+ cd.equal = TRUE;
+ cd.table2 = table2;
+ g_hash_table_foreach (table1, (GHFunc) compare_str_hash, &cd);
+ return cd.equal;
+}
/**
* e_source_update_from_xml_node:
@@ -352,10 +379,13 @@
continue;
if (!strcmp (node->name, "properties")) {
- g_hash_table_destroy (source->priv->properties);
+ GHashTable *temp = source->priv->properties;
source->priv->properties = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
import_properties (source, node);
+ if (!compare_str_hashes (temp, source->priv->properties))
+ changed = TRUE;
+ g_hash_table_destroy (temp);
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]