Exemplo n.º 1
0
SkkMapFile* skk_map_file_construct (GType object_type, const gchar* rule, const gchar* type, const gchar* name, GError** error) {
	SkkMapFile * self = NULL;
	GeeHashSet* _tmp0_;
	GeeSet* included;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (rule != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	self = (SkkMapFile*) g_object_new (object_type, NULL);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	included = (GeeSet*) _tmp0_;
	_tmp1_ = rule;
	_tmp2_ = type;
	_tmp3_ = name;
	skk_map_file_load (self, _tmp1_, _tmp2_, _tmp3_, included, &_inner_error_);
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (included);
			_g_object_unref0 (self);
			return NULL;
		} else {
			_g_object_unref0 (included);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	_g_object_unref0 (included);
	return self;
}
Exemplo n.º 2
0
FolksIndividual *
empathy_create_individual_from_tp_contact (TpContact *contact)
{
  GeeSet *personas;
  TpfPersona *persona;
  FolksIndividual *individual;

  persona = tpf_persona_dup_for_contact (contact);
  if (persona == NULL)
    {
      DEBUG ("Failed to get a persona for %s",
          tp_contact_get_identifier (contact));
      return NULL;
    }

  personas = GEE_SET (
      gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
      g_direct_hash, g_direct_equal));

  gee_collection_add (GEE_COLLECTION (personas), persona);

  individual = folks_individual_new (personas);

  g_clear_object (&persona);
  g_clear_object (&personas);

  return individual;
}
GeeHashSet* playlists_menuitem_attributes_format (void) {
	GeeHashSet* result = NULL;
	GeeHashSet* _tmp0_;
	GeeHashSet* attrs;
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	attrs = _tmp0_;
	gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_PLAYLISTS_MENUITEM_TITLE);
	gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_PLAYLISTS_MENUITEM_PLAYLISTS);
	result = attrs;
	return result;
}
GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void) {
	GeeHashSet* result = NULL;
	GeeHashSet* _tmp0_;
	GeeHashSet* attrs;
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	attrs = _tmp0_;
	gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_TITLE);
	gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ARTIST);
	gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ALBUM);
	gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ARTURL);
	result = attrs;
	return result;
}
Exemplo n.º 5
0
static FolksIndividual *
create_individual_from_persona (FolksPersona *persona)
{
  GeeSet *personas;
  FolksIndividual *individual;

  personas = GEE_SET (
      gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
      NULL, NULL, NULL, NULL, NULL, NULL));

  gee_collection_add (GEE_COLLECTION (personas), persona);

  individual = folks_individual_new (personas);

  g_clear_object (&personas);

  return individual;
}
Exemplo n.º 6
0
static void
link_individual (EmpathyIndividualLinker *self,
    FolksIndividual *individual)
{
  EmpathyIndividualLinkerPriv *priv = GET_PRIV (self);
  GeeSet *old_personas, *new_personas;
  GeeHashSet *final_personas;
  gboolean personas_changed;

  /* Add the individual to the link */
  g_hash_table_insert (priv->changed_individuals, individual,
      GUINT_TO_POINTER (TRUE));

  /* Add personas which are in @individual to priv->new_individual, adding them
   * to the set of personas. */
  old_personas = folks_individual_get_personas (individual);
  new_personas = folks_individual_get_personas (priv->new_individual);
  final_personas = gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref,
      g_object_unref, g_direct_hash, g_direct_equal);
  gee_collection_add_all (GEE_COLLECTION (final_personas),
      GEE_COLLECTION (old_personas));
  personas_changed = gee_collection_add_all (GEE_COLLECTION (final_personas),
      GEE_COLLECTION (new_personas));

  /* avoid updating all values in the Individual if the set of personas doesn't
   * actually change */
  if (personas_changed)
    {
      folks_individual_set_personas (priv->new_individual,
          GEE_SET (final_personas));
    }

  g_clear_object (&final_personas);

  /* Update the toggle renderers, so that if this Individual is listed in
   * another group in the EmpathyIndividualView, the toggle button for that
   * group is updated. */
  update_toggle_renderers (self);

  g_object_notify (G_OBJECT (self), "has-changed");
}
Exemplo n.º 7
0
static void
unlink_individual (EmpathyIndividualLinker *self,
    FolksIndividual *individual)
{
  EmpathyIndividualLinkerPriv *priv = GET_PRIV (self);
  GeeSet *removed_personas, *old_personas;
  GeeHashSet *final_personas;
  gboolean personas_changed;

  /* Remove the individual from the link */
  g_hash_table_remove (priv->changed_individuals, individual);

  /* Remove personas which are in @individual from priv->new_individual. */
  old_personas = folks_individual_get_personas (priv->new_individual);
  removed_personas = folks_individual_get_personas (individual);

  final_personas = gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref,
      g_object_unref, g_direct_hash, g_direct_equal);
  gee_collection_add_all (GEE_COLLECTION (final_personas),
      GEE_COLLECTION (old_personas));
  personas_changed = gee_collection_remove_all (GEE_COLLECTION (final_personas),
      GEE_COLLECTION (removed_personas));

  if (personas_changed)
    {
      folks_individual_set_personas (priv->new_individual,
          GEE_SET (final_personas));
    }

  g_clear_object (&final_personas);

  /* Update the toggle renderers, so that if this Individual is listed in
   * another group in the EmpathyIndividualView, the toggle button for that
   * group is updated. */
  update_toggle_renderers (self);

  g_object_notify (G_OBJECT (self), "has-changed");
}