This allows us to remove setup_idle_id as a protected variable.
https://bugzilla.gnome.org/show_bug.cgi?id=663387
g_ptr_array_unref (members);
}
g_ptr_array_unref (members);
}
+static gboolean
+individual_store_channel_initial_loading (EmpathyIndividualStore *store)
+{
+ EmpathyIndividualStoreChannel *self = EMPATHY_INDIVIDUAL_STORE_CHANNEL (
+ store);
+
+ return !tp_proxy_is_prepared (self->priv->channel,
+ TP_CHANNEL_FEATURE_CONTACTS);
+}
+
static void
empathy_individual_store_channel_class_init (
EmpathyIndividualStoreChannelClass *klass)
static void
empathy_individual_store_channel_class_init (
EmpathyIndividualStoreChannelClass *klass)
object_class->set_property = individual_store_channel_set_property;
store_class->reload_individuals = individual_store_channel_reload_individuals;
object_class->set_property = individual_store_channel_set_property;
store_class->reload_individuals = individual_store_channel_reload_individuals;
+ store_class->initial_loading = individual_store_channel_initial_loading;
g_object_class_install_property (object_class,
PROP_CHANNEL,
g_object_class_install_property (object_class,
PROP_CHANNEL,
struct _EmpathyIndividualStoreManagerPriv
{
EmpathyIndividualManager *manager;
struct _EmpathyIndividualStoreManagerPriv
{
EmpathyIndividualManager *manager;
+ gboolean setup_idle_id;
g_list_free (individuals);
}
g_list_free (individuals);
}
- store->setup_idle_id = 0;
+ self->priv->setup_idle_id = 0;
self->priv->manager = g_object_ref (manager);
/* Let a chance to have all properties set before populating */
self->priv->manager = g_object_ref (manager);
/* Let a chance to have all properties set before populating */
- store->setup_idle_id = g_idle_add (individual_store_manager_manager_setup,
- self);
+ self->priv->setup_idle_id = g_idle_add (
+ individual_store_manager_manager_setup, self);
g_clear_object (&self->priv->manager);
}
g_clear_object (&self->priv->manager);
}
+ if (self->priv->setup_idle_id != 0)
+ {
+ g_source_remove (self->priv->setup_idle_id);
+ self->priv->setup_idle_id = 0;
+ }
+
G_OBJECT_CLASS (empathy_individual_store_manager_parent_class)->dispose (
object);
}
G_OBJECT_CLASS (empathy_individual_store_manager_parent_class)->dispose (
object);
}
g_list_free (contacts);
}
g_list_free (contacts);
}
+static gboolean
+individual_store_manager_initial_loading (EmpathyIndividualStore *store)
+{
+ EmpathyIndividualStoreManager *self = EMPATHY_INDIVIDUAL_STORE_MANAGER (
+ store);
+
+ return self->priv->setup_idle_id != 0;
+}
+
static void
empathy_individual_store_manager_class_init (
EmpathyIndividualStoreManagerClass *klass)
static void
empathy_individual_store_manager_class_init (
EmpathyIndividualStoreManagerClass *klass)
object_class->set_property = individual_store_manager_set_property;
store_class->reload_individuals = individual_store_manager_reload_individuals;
object_class->set_property = individual_store_manager_set_property;
store_class->reload_individuals = individual_store_manager_reload_individuals;
+ store_class->initial_loading = individual_store_manager_initial_loading;
g_object_class_install_property (object_class,
PROP_INDIVIDUAL_MANAGER,
g_object_class_install_property (object_class,
PROP_INDIVIDUAL_MANAGER,
g_source_remove (self->priv->inhibit_active);
}
g_source_remove (self->priv->inhibit_active);
}
- if (self->setup_idle_id != 0)
- {
- g_source_remove (self->setup_idle_id);
- }
-
g_hash_table_unref (self->priv->status_icons);
g_hash_table_unref (self->priv->folks_individual_cache);
g_hash_table_unref (self->priv->empathy_group_cache);
g_hash_table_unref (self->priv->status_icons);
g_hash_table_unref (self->priv->folks_individual_cache);
g_hash_table_unref (self->priv->empathy_group_cache);
empathy_individual_store_set_show_groups (EmpathyIndividualStore *self,
gboolean show_groups)
{
empathy_individual_store_set_show_groups (EmpathyIndividualStore *self,
gboolean show_groups)
{
+ EmpathyIndividualStoreClass *klass;
+
g_return_if_fail (EMPATHY_IS_INDIVIDUAL_STORE (self));
g_return_if_fail (EMPATHY_IS_INDIVIDUAL_STORE (self));
+ klass = EMPATHY_INDIVIDUAL_STORE_GET_CLASS ( self);
+
if (self->priv->show_groups == show_groups)
{
return;
if (self->priv->show_groups == show_groups)
{
return;
self->priv->show_groups = show_groups;
self->priv->show_groups = show_groups;
- if (self->setup_idle_id == 0)
+ if (!klass->initial_loading (self))
{
/* Remove all contacts and add them back, not optimized but
* that's the easy way :)
{
/* Remove all contacts and add them back, not optimized but
* that's the easy way :)
* This is only done if there's not a pending setup idle
* callback, otherwise it will race and the contacts will get
* added twice */
* This is only done if there's not a pending setup idle
* callback, otherwise it will race and the contacts will get
* added twice */
- EmpathyIndividualStoreClass *klass = EMPATHY_INDIVIDUAL_STORE_GET_CLASS (
- self);
gtk_tree_store_clear (GTK_TREE_STORE (self));
/* Also clear the cache */
gtk_tree_store_clear (GTK_TREE_STORE (self));
/* Also clear the cache */
{
GtkTreeStore parent;
EmpathyIndividualStorePriv *priv;
{
GtkTreeStore parent;
EmpathyIndividualStorePriv *priv;
-
- /* protected */
- guint setup_idle_id;
};
struct _EmpathyIndividualStoreClass
};
struct _EmpathyIndividualStoreClass
GtkTreeStoreClass parent_class;
void (*reload_individuals) (EmpathyIndividualStore *self);
GtkTreeStoreClass parent_class;
void (*reload_individuals) (EmpathyIndividualStore *self);
+ gboolean (*initial_loading) (EmpathyIndividualStore *self);