コード例 #1
0
/**
 * empathy_persona_store_get_individual:
 * @self: an #EmpathyPersonaStore
 *
 * Get the value of #EmpathyPersonaStore:individual.
 *
 * Return value: the individual being displayed by the store, or %NULL
 */
FolksIndividual *
empathy_persona_store_get_individual (EmpathyPersonaStore *self)
{
  g_return_val_if_fail (EMPATHY_IS_PERSONA_STORE (self), NULL);

  return GET_PRIV (self)->individual;
}
コード例 #2
0
/**
 * empathy_persona_store_set_sort_criterion:
 * @self: an #EmpathyPersonaStore
 * @show_avatars: a criterion to be used to sort personas in the store
 *
 * Set #EmpathyPersonaStore:sort-criterion to @sort_criterion.
 */
void
empathy_persona_store_set_sort_criterion (EmpathyPersonaStore *self,
    EmpathyPersonaStoreSort sort_criterion)
{
  EmpathyPersonaStorePriv *priv;

  g_return_if_fail (EMPATHY_IS_PERSONA_STORE (self));

  priv = GET_PRIV (self);
  priv->sort_criterion = sort_criterion;

  switch (sort_criterion)
    {
      case EMPATHY_PERSONA_STORE_SORT_STATE:
        gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self),
            EMPATHY_PERSONA_STORE_COL_STATUS, GTK_SORT_ASCENDING);
        break;
      case EMPATHY_PERSONA_STORE_SORT_NAME:
        gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self),
            EMPATHY_PERSONA_STORE_COL_NAME, GTK_SORT_ASCENDING);
        break;
      default:
        g_assert_not_reached ();
        break;
    }

  g_object_notify (G_OBJECT (self), "sort-criterion");
}
コード例 #3
0
/**
 * empathy_persona_store_get_sort_criterion:
 * @self: an #EmpathyPersonaStore
 *
 * Get the value of #EmpathyPersonaStore:sort-criterion.
 *
 * Return value: the criterion used to sort the personas in the store
 */
EmpathyPersonaStoreSort
empathy_persona_store_get_sort_criterion (EmpathyPersonaStore *self)
{
  g_return_val_if_fail (EMPATHY_IS_PERSONA_STORE (self), 0);

  return GET_PRIV (self)->sort_criterion;
}
コード例 #4
0
/**
 * empathy_persona_store_get_show_protocols:
 * @self: an #EmpathyPersonaStore
 *
 * Get the value of #EmpathyPersonaStore:show-protocols.
 *
 * Return value: %TRUE if protocol images are made available by the store,
 * %FALSE otherwise
 */
gboolean
empathy_persona_store_get_show_protocols (EmpathyPersonaStore *self)
{
  g_return_val_if_fail (EMPATHY_IS_PERSONA_STORE (self), TRUE);

  return GET_PRIV (self)->show_protocols;
}
コード例 #5
0
/**
 * empathy_persona_view_new:
 * @store: an #EmpathyPersonaStore
 * @features: a set of flags specifying the view's functionality, or
 * %EMPATHY_PERSONA_VIEW_FEATURE_NONE
 *
 * Create a new #EmpathyPersonaView displaying the personas in
 * #EmpathyPersonaStore.
 *
 * Return value: a new #EmpathyPersonaView
 */
EmpathyPersonaView *
empathy_persona_view_new (EmpathyPersonaStore *store,
    EmpathyPersonaViewFeatureFlags features)
{
  g_return_val_if_fail (EMPATHY_IS_PERSONA_STORE (store), NULL);

  return g_object_new (EMPATHY_TYPE_PERSONA_VIEW,
      "model", store,
      "features", features,
      NULL);
}
コード例 #6
0
/**
 * empathy_persona_store_set_show_protocols:
 * @self: an #EmpathyPersonaStore
 * @show_protocols: %TRUE to make protocol images available through the store,
 * %FALSE otherwise
 *
 * Set #EmpathyPersonaStore:show-protocols to @show_protocols.
 */
void
empathy_persona_store_set_show_protocols (EmpathyPersonaStore *self,
    gboolean show_protocols)
{
  EmpathyPersonaStorePriv *priv;

  g_return_if_fail (EMPATHY_IS_PERSONA_STORE (self));

  priv = GET_PRIV (self);
  priv->show_protocols = show_protocols;

  gtk_tree_model_foreach (GTK_TREE_MODEL (self),
      (GtkTreeModelForeachFunc) update_list_mode_foreach, self);

  g_object_notify (G_OBJECT (self), "show-protocols");
}
コード例 #7
0
/**
 * empathy_persona_store_set_individual:
 * @self: an #EmpathyPersonaStore
 * @individual: the new individual to display in the store, or %NULL
 *
 * Set #EmpathyPersonaStore:individual to @individual, replacing the personas
 * which were in the store with the personas belonging to @individual, or with
 * nothing if @individual is %NULL.
 */
void
empathy_persona_store_set_individual (EmpathyPersonaStore *self,
    FolksIndividual *individual)
{
  EmpathyPersonaStorePriv *priv;

  g_return_if_fail (EMPATHY_IS_PERSONA_STORE (self));
  g_return_if_fail (individual == NULL || FOLKS_IS_INDIVIDUAL (individual));

  priv = GET_PRIV (self);

  /* Remove the old individual */
  if (priv->individual != NULL)
    {
      GList *personas, *l;

      g_signal_handlers_disconnect_by_func (priv->individual,
          (GCallback) individual_personas_changed_cb, self);

      /* Disconnect from and remove all personas belonging to this individual */
      personas = folks_individual_get_personas (priv->individual);
      for (l = personas; l != NULL; l = l->next)
        remove_persona_and_disconnect (self, FOLKS_PERSONA (l->data));

      g_object_unref (priv->individual);
    }

  priv->individual = individual;

  /* Add the new individual */
  if (individual != NULL)
    {
      GList *personas, *l;

      g_object_ref (individual);

      g_signal_connect (individual, "personas-changed",
          (GCallback) individual_personas_changed_cb, self);

      /* Add pre-existing Personas */
      personas = folks_individual_get_personas (individual);
      for (l = personas; l != NULL; l = l->next)
        add_persona_and_connect (self, FOLKS_PERSONA (l->data));
    }

  g_object_notify (G_OBJECT (self), "individual");
}