contacts r464 - in trunk: . src
- From: rbradford svn gnome org
- To: svn-commits-list gnome org
- Subject: contacts r464 - in trunk: . src
- Date: Tue, 21 Oct 2008 16:48:21 +0000 (UTC)
Author: rbradford
Date: Tue Oct 21 16:48:20 2008
New Revision: 464
URL: http://svn.gnome.org/viewvc/contacts?rev=464&view=rev
Log:
2008-10-21 Rob Bradford <rob linux intel com>
* src/contacts-edit-pane.c (contacts_edit_pane_show):
* src/contacts-utils.c (contacts_choose_photo):
Fix the broken behaviour of the photo button. We need to wrap the
GdkPixbuf into an GtkImage in order to set it into the button.
Modified:
trunk/ChangeLog
trunk/src/contacts-edit-pane.c
trunk/src/contacts-utils.c
Modified: trunk/src/contacts-edit-pane.c
==============================================================================
--- trunk/src/contacts-edit-pane.c (original)
+++ trunk/src/contacts-edit-pane.c Tue Oct 21 16:48:20 2008
@@ -1037,6 +1037,8 @@
contacts_edit_pane_show (ContactsData *data, gboolean new)
{
GtkWidget *align, *button, *widget/*, *glabel, *gbutton*/;
+ GdkPixbuf *pixbuf;
+ GtkWidget *image;
EVCardAttribute *groups_attr = NULL;
ContactsGroupChangeData *gdata;
guint row, i;
@@ -1092,8 +1094,13 @@
/* Create contact photo button */
button = gtk_button_new ();
- widget = GTK_WIDGET (contacts_load_photo (contact));
- gtk_container_add (GTK_CONTAINER (button), widget);
+ pixbuf = contacts_load_photo (contact);
+ if (pixbuf)
+ {
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ g_object_unref (pixbuf);
+ }
gtk_widget_show (widget);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (contacts_edit_choose_photo), data);
Modified: trunk/src/contacts-utils.c
==============================================================================
--- trunk/src/contacts-utils.c (original)
+++ trunk/src/contacts-utils.c Tue Oct 21 16:48:20 2008
@@ -467,7 +467,8 @@
void
contacts_choose_photo (GtkWidget *button, EContact *contact)
{
- GtkWidget *filechooser, *photo;
+ GtkWidget *filechooser, *image;
+ GdkPixbuf *pixbuf;
GtkFileFilter *filter;
gint result;
GList *widgets;
@@ -530,17 +531,11 @@
e_contact_set (contact, E_CONTACT_PHOTO,
&new_photo);
g_free (*data);
- /* Re-display contact photo */
- gtk_container_foreach (
- GTK_CONTAINER (button),
- (GtkCallback)gtk_widget_destroy,
- NULL);
- photo = GTK_WIDGET
- (contacts_load_photo (contact));
- gtk_container_add (
- GTK_CONTAINER (button),
- photo);
- gtk_widget_show (photo);
+ pixbuf = contacts_load_photo (contact);
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_button_set_image (GTK_BUTTON (button),
+ image);
+ g_object_unref (pixbuf);
}
}
g_free (filename);
@@ -548,12 +543,7 @@
} else if (result == NO_IMAGE) {
if (contact && E_IS_CONTACT (contact)) {
e_contact_set (contact, E_CONTACT_PHOTO, NULL);
- /* Re-display contact photo */
- gtk_container_foreach (GTK_CONTAINER (button),
- (GtkCallback)gtk_widget_destroy, NULL);
- photo = GTK_WIDGET (contacts_load_photo (contact));
- gtk_container_add (GTK_CONTAINER (button), photo);
- gtk_widget_show (photo);
+ gtk_button_set_image (GTK_BUTTON (button), NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]