aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-10-09 17:38:12 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-10-09 17:38:12 +0800
commitbfe4734f01b202ae448616e6c711a46c5d0d7f6e (patch)
treefd965564aa48a93b1897ce0d90d912adf5fe8d46 /libempathy-gtk
parent0d4e81432f5ace47ac86991aa239e4a55686de00 (diff)
downloadgsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.tar
gsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.tar.gz
gsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.tar.bz2
gsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.tar.lz
gsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.tar.xz
gsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.tar.zst
gsoc2013-empathy-bfe4734f01b202ae448616e6c711a46c5d0d7f6e.zip
Makes avatar looks better in information and edit dialogs.
2007-10-09 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-contact-widget.glade: * libempathy-gtk/empathy-contact-widget.c: * libempathy-gtk/empathy-avatar-chooser.c: * libempathy-gtk/empathy-avatar-image.c: Makes avatar looks better in information and edit dialogs. svn path=/trunk/; revision=364
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c38
-rw-r--r--libempathy-gtk/empathy-avatar-image.c2
-rw-r--r--libempathy-gtk/empathy-contact-widget.c12
-rw-r--r--libempathy-gtk/empathy-contact-widget.glade111
4 files changed, 84 insertions, 79 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index 2ef3de429..bc5f07e9b 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -40,13 +40,13 @@
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_AVATAR_CHOOSER_TYPE, EmpathyAvatarChooserPriv))
-#define AVATAR_MAX 96
+#define AVATAR_SIZE_SAVE 96
+#define AVATAR_SIZE_VIEW 64
#define DEFAULT_DIR DATADIR"/pixmaps/faces"
typedef struct {
- GdkPixbuf *pixbuf;
- gchar *image_data;
- gsize image_data_size;
+ gchar *image_data;
+ gsize image_data_size;
} EmpathyAvatarChooserPriv;
static void avatar_chooser_finalize (GObject *object);
@@ -160,9 +160,6 @@ avatar_chooser_finalize (GObject *object)
priv = GET_PRIV (object);
- if (priv->pixbuf) {
- g_object_unref (priv->pixbuf);
- }
g_free (priv->image_data);
G_OBJECT_CLASS (empathy_avatar_chooser_parent_class)->finalize (object);
@@ -174,22 +171,19 @@ avatar_chooser_set_pixbuf (EmpathyAvatarChooser *chooser,
{
EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
GtkWidget *image;
+ GdkPixbuf *pixbuf_view = NULL;
+ GdkPixbuf *pixbuf_save = NULL;
GError *error = NULL;
- if (priv->pixbuf) {
- g_object_unref (priv->pixbuf);
- priv->pixbuf = NULL;
- }
g_free (priv->image_data);
priv->image_data = NULL;
priv->image_data_size = 0;
if (pixbuf) {
- priv->pixbuf = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_MAX);
- }
+ pixbuf_view = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_SIZE_VIEW);
+ pixbuf_save = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_SIZE_SAVE);
- if (priv->pixbuf) {
- if (!gdk_pixbuf_save_to_buffer (priv->pixbuf,
+ if (!gdk_pixbuf_save_to_buffer (pixbuf_save,
&priv->image_data,
&priv->image_data_size,
"png",
@@ -197,16 +191,14 @@ avatar_chooser_set_pixbuf (EmpathyAvatarChooser *chooser,
empathy_debug (DEBUG_DOMAIN, "Failed to save pixbuf: %s",
error ? error->message : "No error given");
g_clear_error (&error);
- g_object_unref (priv->pixbuf);
- priv->pixbuf = NULL;
}
- }
+ image = gtk_image_new_from_pixbuf (pixbuf_view);
- if (!priv->pixbuf) {
+ g_object_unref (pixbuf_save);
+ g_object_unref (pixbuf_view);
+ } else {
image = gtk_image_new_from_icon_name ("stock_person",
GTK_ICON_SIZE_DIALOG);
- } else {
- image = gtk_image_new_from_pixbuf (priv->pixbuf);
}
gtk_button_set_image (GTK_BUTTON (chooser), image);
@@ -399,7 +391,7 @@ avatar_chooser_update_preview_cb (GtkFileChooser *file_chooser,
image = gtk_file_chooser_get_preview_widget (file_chooser);
if (pixbuf) {
- scaled_pixbuf = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_MAX);
+ scaled_pixbuf = empathy_pixbuf_scale_down_if_necessary (pixbuf, AVATAR_SIZE_SAVE);
gtk_image_set_from_pixbuf (GTK_IMAGE (image), scaled_pixbuf);
g_object_unref (scaled_pixbuf);
g_object_unref (pixbuf);
@@ -507,7 +499,7 @@ avatar_chooser_clicked_cb (GtkWidget *button,
/* Setup preview image */
image = gtk_image_new ();
gtk_file_chooser_set_preview_widget (chooser_dialog, image);
- gtk_widget_set_size_request (image, AVATAR_MAX, AVATAR_MAX);
+ gtk_widget_set_size_request (image, AVATAR_SIZE_SAVE, AVATAR_SIZE_SAVE);
gtk_widget_show (image);
gtk_file_chooser_set_use_preview_label (chooser_dialog, FALSE);
g_signal_connect (chooser_dialog, "update-preview",
diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c
index cc4ecbf45..5a5f0aafb 100644
--- a/libempathy-gtk/empathy-avatar-image.c
+++ b/libempathy-gtk/empathy-avatar-image.c
@@ -38,7 +38,7 @@
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_AVATAR_IMAGE, EmpathyAvatarImagePriv))
-#define MAX_SMALL 48
+#define MAX_SMALL 64
#define MAX_LARGE 400
typedef struct {
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index b6fd4937d..2d26f4a4b 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -67,7 +67,7 @@ typedef struct {
GtkWidget *image_state;
GtkWidget *label_status;
GtkWidget *table_contact;
- GtkWidget *hbox_contact;
+ GtkWidget *vbox_avatar;
/* Groups */
GtkWidget *vbox_groups;
@@ -172,7 +172,7 @@ empathy_contact_widget_new (EmpathyContact *contact,
"image_state", &information->image_state,
"label_status", &information->label_status,
"table_contact", &information->table_contact,
- "hbox_contact", &information->hbox_contact,
+ "vbox_avatar", &information->vbox_avatar,
"vbox_groups", &information->vbox_groups,
"entry_group", &information->entry_group,
"button_group", &information->button_group,
@@ -348,10 +348,10 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
} else {
information->widget_avatar = empathy_avatar_image_new ();
}
- gtk_box_pack_end (GTK_BOX (information->hbox_contact),
- information->widget_avatar,
- FALSE, FALSE,
- 6);
+ gtk_box_pack_start (GTK_BOX (information->vbox_avatar),
+ information->widget_avatar,
+ FALSE, FALSE,
+ 6);
gtk_widget_show (information->widget_avatar);
/* Setup account label/chooser */
diff --git a/libempathy-gtk/empathy-contact-widget.glade b/libempathy-gtk/empathy-contact-widget.glade
index 6eb601987..4b204b7b6 100644
--- a/libempathy-gtk/empathy-contact-widget.glade
+++ b/libempathy-gtk/empathy-contact-widget.glade
@@ -25,53 +25,53 @@
<property name="spacing">6</property>
<child>
- <widget class="GtkHBox" id="hbox_contact">
+ <widget class="GtkVBox" id="vbox_contact">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox_contact">
+ <widget class="GtkLabel" id="label654">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
+ <property name="label" translatable="yes">&lt;b&gt;Contact&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="label654">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Contact&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment31">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkAlignment" id="alignment31">
+ <widget class="GtkHBox" id="hbox189">
<property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkVBox" id="vbox225">
@@ -233,25 +233,38 @@
</packing>
</child>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox_avatar">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
-
- <child>
- <placeholder/>
- </child>
</widget>
<packing>
<property name="padding">0</property>