Exemplo n.º 1
0
static void
contact_dispose (GObject *object)
{
  EmpathyContactPriv *priv = GET_PRIV (object);

  if (priv->tp_contact)
    {
      g_signal_handlers_disconnect_by_func (priv->tp_contact,
          tp_contact_notify_cb, object);
      g_object_unref (priv->tp_contact);
    }
  priv->tp_contact = NULL;

  if (priv->account)
    g_object_unref (priv->account);
  priv->account = NULL;

  if (priv->avatar != NULL)
    {
      empathy_avatar_unref (priv->avatar);
      priv->avatar = NULL;
    }

  if (priv->location != NULL)
    {
      g_hash_table_unref (priv->location);
      priv->location = NULL;
    }

  G_OBJECT_CLASS (empathy_contact_parent_class)->dispose (object);
}
Exemplo n.º 2
0
static void
avatar_chooser_set_image (EmpathyAvatarChooser *chooser,
			  EmpathyAvatar        *avatar,
			  GdkPixbuf            *pixbuf,
			  gboolean              set_locally)
{
	EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
	GdkPixbuf                *pixbuf_view;
	GtkWidget                *image;

	g_assert (avatar != NULL);
	g_assert (pixbuf != NULL);

	if (set_locally) {
		EmpathyAvatar *conv;

		conv = avatar_chooser_maybe_convert_and_scale (chooser,
			pixbuf, avatar);
		empathy_avatar_unref (avatar);

		if (conv == NULL) {
			/* An error occured; don't change the avatar. */
			return;
		}

		avatar = conv;
	}

	if (priv->avatar != NULL) {
		empathy_avatar_unref (priv->avatar);
	}
	priv->avatar = avatar;

	pixbuf_view = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_SIZE_VIEW);
	image = gtk_image_new_from_pixbuf (pixbuf_view);

	gtk_button_set_image (GTK_BUTTON (chooser), image);
	g_signal_emit (chooser, signals[CHANGED], 0);

	g_object_unref (pixbuf_view);
	g_object_unref (pixbuf);
}
Exemplo n.º 3
0
static void
avatar_chooser_clear_image (EmpathyAvatarChooser *chooser)
{
	EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
	GtkWidget *image;

	if (priv->avatar != NULL) {
		empathy_avatar_unref (priv->avatar);
		priv->avatar = NULL;
	}

	image = gtk_image_new_from_icon_name ("stock_person", GTK_ICON_SIZE_DIALOG);
	gtk_button_set_image (GTK_BUTTON (chooser), image);
	g_signal_emit (chooser, signals[CHANGED], 0);
}
Exemplo n.º 4
0
static void
avatar_chooser_finalize (GObject *object)
{
	EmpathyAvatarChooserPriv *priv;

	priv = GET_PRIV (object);

	avatar_chooser_set_connection (EMPATHY_AVATAR_CHOOSER (object), NULL);
	g_assert (priv->connection == NULL);
	g_assert (priv->factory == NULL);

	if (priv->avatar != NULL) {
		empathy_avatar_unref (priv->avatar);
	}

	G_OBJECT_CLASS (empathy_avatar_chooser_parent_class)->finalize (object);
}