On Thu, 2005-02-03 at 19:31 +0800, Harry Lu wrote:
Rodney, Rodrigo and JP,
I investigated this bug for the whole day and finally found the
reason. One of Evolution's thread was consuming all the CPUs because it
run the idle function without stopping. I think it has no time to draw
the widgets.
this seems wrong to me, since the idle callback thus would be called
only once, and subsequent changes won't be saved, only on exit.
So, here's what I've committed to CVS HEAD, let me know if you still
find any problem.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/ChangeLog,v
retrieving revision 1.226
diff -u -p -r1.226 ChangeLog
--- ChangeLog 1 Feb 2005 21:01:01 -0000 1.226
+++ ChangeLog 3 Feb 2005 12:13:23 -0000
@@ -1,3 +1,13 @@
+2005-02-03 Rodrigo Moya <rodrigo novell com>
+
+ * libedataserver/e-categories.c (idle_saver_cb): changed to return a
+ gboolean and always FALSE to remove the idle callback after saving.
+ (save_config): new function that marks the config as dirty and installs
+ the idle callback.
+ (initialize_categories_config, e_categories_remove, e_categories_add,
+ e_categories_set_color_for, e_categories_set_icon_file_for): call
+ save_config() when saving the categories.
+
2005-02-01 Jeffrey Stedfast <fejj novell com>
* configure.in: Generate the old imap makefile.
Index: libedataserver/e-categories.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserver/e-categories.c,v
retrieving revision 1.9
diff -u -p -r1.9 e-categories.c
--- libedataserver/e-categories.c 28 Jan 2005 15:57:39 -0000 1.9
+++ libedataserver/e-categories.c 3 Feb 2005 12:13:23 -0000
@@ -121,7 +121,7 @@ hash_to_xml_string (gpointer key, gpoint
*str = g_string_append (*str, "/>");
}
-static void
+static gboolean
idle_saver_cb (gpointer user_data)
{
if (conf_is_dirty) {
@@ -135,6 +135,19 @@ idle_saver_cb (gpointer user_data)
conf_is_dirty = FALSE;
}
+
+ idle_id = 0;
+
+ return FALSE;
+}
+
+static void
+save_config (void)
+{
+ conf_is_dirty = TRUE;
+ if (!idle_id) {
+ idle_id = g_idle_add ((GSourceFunc) idle_saver_cb, NULL);
+ }
}
static void
@@ -231,10 +244,9 @@ initialize_categories_config (void)
e_categories_add (_("Time & Expenses"), NULL, E_DATA_SERVER_IMAGESDIR "/category_time-and-expenses_16.png", TRUE);
e_categories_add (_("VIP"), NULL, NULL, TRUE);
e_categories_add (_("Waiting"), NULL, NULL, TRUE);
- }
- /* install idle callback to save the file */
- idle_id = g_idle_add ((GSourceFunc) idle_saver_cb, NULL);
+ save_config ();
+ }
}
static void
@@ -298,7 +310,7 @@ e_categories_add (const char *category,
g_hash_table_insert (categories_table, g_strdup (category), cat_info);
- conf_is_dirty = TRUE;
+ save_config ();
}
/**
@@ -318,7 +330,7 @@ e_categories_remove (const char *categor
if (g_hash_table_lookup (categories_table, category)) {
g_hash_table_remove (categories_table, category);
- conf_is_dirty = TRUE;
+ save_config ();
}
}
@@ -389,7 +401,7 @@ e_categories_set_color_for (const char *
g_free (cat_info->color);
cat_info->color = g_strdup (color);
- conf_is_dirty = TRUE;
+ save_config ();
}
/**
@@ -438,7 +450,7 @@ e_categories_set_icon_file_for (const ch
g_free (cat_info->icon_file);
cat_info->icon_file = g_strdup (icon_file);
- conf_is_dirty = TRUE;
+ save_config ();
}
/**