Index: telepathy-glib/telepathy-glib/connection-manager.c =================================================================== --- telepathy-glib/telepathy-glib/connection-manager.c (revision 844) +++ telepathy-glib/telepathy-glib/connection-manager.c (working copy) @@ -179,6 +179,12 @@ /* absolute path to .manager file */ gchar *manager_file; + /* idle add id for reading the manager file */ + guint manager_file_read_idle_id; + + /* idle add id for introspecting */ + guint introspect_idle_id; + /* TRUE if we're waiting for ListProtocols */ gboolean listing_protocols:1; @@ -445,6 +451,8 @@ NULL); } + self->priv->introspect_idle_id = 0; + return FALSE; } @@ -475,7 +483,10 @@ self->running = TRUE; g_signal_emit (self, signals[SIGNAL_ACTIVATED], 0); - g_idle_add (tp_connection_manager_idle_introspect, self); + /* Add an idle call if not already in queue */ + if (!self->priv->introspect_idle_id) + self->priv->introspect_idle_id = g_idle_add + (tp_connection_manager_idle_introspect, self); } } @@ -809,6 +820,8 @@ && self->priv->manager_file[0] != '\0') tp_connection_manager_read_file (self, self->priv->manager_file); + self->priv->manager_file_read_idle_id = 0; + return FALSE; } @@ -890,7 +903,10 @@ self->priv->manager_file = tp_connection_manager_find_manager_file (self->name); - g_idle_add (tp_connection_manager_idle_read_manager_file, self); + /* Add an idle call if not already in queue */ + if (!self->priv->manager_file_read_idle_id) + self->priv->manager_file_read_idle_id = g_idle_add + (tp_connection_manager_idle_read_manager_file, self); } return (GObject *) self; @@ -922,6 +938,12 @@ g_free (self->priv->manager_file); + if (self->priv->manager_file_read_idle_id) + g_source_remove (self->priv->manager_file_read_idle_id); + + if (self->priv->introspect_idle_id) + g_source_remove (self->priv->introspect_idle_id); + if (self->priv->protocols != NULL) { tp_connection_manager_free_protocols (self->priv->protocols); @@ -1000,7 +1022,10 @@ self->priv->manager_file = g_strdup (tmp); } - g_idle_add (tp_connection_manager_idle_read_manager_file, self); + /* Add an idle call if not already in queue */ + if (!self->priv->manager_file_read_idle_id) + self->priv->manager_file_read_idle_id = g_idle_add + (tp_connection_manager_idle_read_manager_file, self); break; @@ -1015,7 +1040,10 @@ /* It's running, we weren't previously auto-introspecting, * but we are now. Try it when idle */ - g_idle_add (tp_connection_manager_idle_introspect, self); + /* Add an idle call if not already in queue */ + if (!self->priv->introspect_idle_id) + self->priv->introspect_idle_id = g_idle_add + (tp_connection_manager_idle_introspect, self); } } break;