aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-11-04 07:23:22 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-11-04 07:23:22 +0800
commit48334a065723ce15f191adf391de444f72ae2efb (patch)
treebb0cc93a6b36e376f2ca8153483291369bc2b9e7 /libempathy-gtk
parentb07f56b36a34bfcd490f3a14c3315f998de425f3 (diff)
downloadgsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.gz
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.bz2
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.lz
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.xz
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.zst
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.zip
Rename empathy_contact_factory_set_name() to _set_alias(). Implements
2007-11-03 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-contact-widget.c: * libempathy-gtk/empathy-avatar-chooser.c: * libempathy-gtk/empathy-avatar-chooser.h: * python/pyempathy/pyempathy.defs: * libempathy/empathy-contact-factory.c: * libempathy/empathy-contact-factory.h: Rename empathy_contact_factory_set_name() to _set_alias(). Implements empathy_contact_factory_set_avatar(). Return the mime_type in empathy_avatar_chooser_get_image_data(). svn path=/trunk/; revision=417
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c8
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.h5
-rw-r--r--libempathy-gtk/empathy-contact-widget.c28
3 files changed, 26 insertions, 15 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index bc5f07e9b..0b3487af7 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -545,8 +545,9 @@ empathy_avatar_chooser_set (EmpathyAvatarChooser *chooser,
void
empathy_avatar_chooser_get_image_data (EmpathyAvatarChooser *chooser,
- gchar **data,
- gsize *data_size)
+ const gchar **data,
+ gsize *data_size,
+ const gchar **mime_type)
{
EmpathyAvatarChooserPriv *priv;
@@ -560,5 +561,8 @@ empathy_avatar_chooser_get_image_data (EmpathyAvatarChooser *chooser,
if (*data_size) {
*data_size = priv->image_data_size;
}
+ if (mime_type) {
+ *mime_type = "png";
+ }
}
diff --git a/libempathy-gtk/empathy-avatar-chooser.h b/libempathy-gtk/empathy-avatar-chooser.h
index b0c08df11..55b804f07 100644
--- a/libempathy-gtk/empathy-avatar-chooser.h
+++ b/libempathy-gtk/empathy-avatar-chooser.h
@@ -53,7 +53,8 @@ GtkWidget *empathy_avatar_chooser_new (void);
void empathy_avatar_chooser_set (EmpathyAvatarChooser *chooser,
EmpathyAvatar *avatar);
void empathy_avatar_chooser_get_image_data (EmpathyAvatarChooser *chooser,
- gchar **data,
- gsize *data_size);
+ const gchar **data,
+ gsize *data_size,
+ const gchar **mime_type);
#endif /* __EMPATHY_AVATAR_CHOOSER_H__ */
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 2fa1b3d9f..51d17bfb7 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -495,14 +495,20 @@ static void
contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
EmpathyContactWidget *information)
{
- McAccount *account;
- gchar *data;
- gsize size;
+ if (information->contact &&
+ empathy_contact_is_user (information->contact)) {
+ McAccount *account;
+ const gchar *data;
+ gsize size;
+ const gchar *mime_type;
- account = empathy_contact_get_account (information->contact);
- empathy_avatar_chooser_get_image_data (EMPATHY_AVATAR_CHOOSER (information->widget_avatar),
- &data, &size);
- mc_account_set_avatar_from_data (account, data, size, "png");
+ account = empathy_contact_get_account (information->contact);
+ empathy_avatar_chooser_get_image_data (EMPATHY_AVATAR_CHOOSER (information->widget_avatar),
+ &data, &size, &mime_type);
+ empathy_contact_factory_set_avatar (information->factory,
+ account,
+ data, size, mime_type);
+ }
}
static void
@@ -527,12 +533,12 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
EmpathyContactWidget *information)
{
if (information->contact) {
- const gchar *name;
+ const gchar *alias;
- name = gtk_entry_get_text (GTK_ENTRY (editable));
- empathy_contact_factory_set_name (information->factory,
+ alias = gtk_entry_get_text (GTK_ENTRY (editable));
+ empathy_contact_factory_set_alias (information->factory,
information->contact,
- name);
+ alias);
}
return FALSE;