diff options
author | Devashish Sharma <sdevashish@novell.com> | 2006-02-01 19:07:17 +0800 |
---|---|---|
committer | Devashish Sharma <dsharma@src.gnome.org> | 2006-02-01 19:07:17 +0800 |
commit | 8a617df4348d86c31bae365e35f38d49ad4721a0 (patch) | |
tree | a7232ba7acc30301797d826bc9d31c2838e0f499 /addressbook | |
parent | 6826f9d01e6680ec6265ce4ece0618c71ed7c070 (diff) | |
download | gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.tar gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.tar.gz gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.tar.bz2 gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.tar.lz gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.tar.xz gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.tar.zst gsoc2013-evolution-8a617df4348d86c31bae365e35f38d49ad4721a0.zip |
File selector shows preview of the image when choosing picture of a
2006-02-01 Devashish Sharma <sdevashish@novell.com>
* gui/contact-editor/e-contact-editor.c: File selector shows preview
of the image when choosing picture of a contact.
svn path=/trunk/; revision=31395
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 6 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 62c9896e23..f3d417f58b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,11 @@ 2006-02-01 Devashish Sharma <sdevashish@novell.com> + * gui/contact-editor/e-contact-editor.c: File selector shows preview + of the image when choosing picture of a contact. + Fixes bug #300884. + +2006-02-01 Devashish Sharma <sdevashish@novell.com> + * gui/widgets/e-minicard.c : (e_minicard_reflow) Fixed a bug which was causing addressbook view by address card getting all messed up. Fixes Bug #329315. diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index fa454cf395..fe56acec5d 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -2730,10 +2730,33 @@ file_selector_deleted (GtkWidget *widget) } static void +update_preview_cb (GtkFileChooser *file_chooser, gpointer data) +{ + GtkWidget *preview; + char *filename; + GdkPixbuf *pixbuf; + gboolean have_preview; + + preview = GTK_WIDGET (data); + filename = gtk_file_chooser_get_preview_filename (file_chooser); + + pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL); + have_preview = (pixbuf != NULL); + g_free (filename); + + gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf); + if (pixbuf) + gdk_pixbuf_unref (pixbuf); + + gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview); +} + +static void image_clicked (GtkWidget *button, EContactEditor *editor) { const gchar *title = _("Please select an image for this contact"); const gchar *no_image = _("No image"); + GtkImage *preview; if (!editor->file_selector) { #ifdef USE_GTKFILECHOOSER @@ -2744,6 +2767,10 @@ image_clicked (GtkWidget *button, EContactEditor *editor) GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, no_image, GTK_RESPONSE_NO, NULL); + preview = GTK_IMAGE (gtk_image_new()); + gtk_file_chooser_set_preview_widget ((GtkFileChooser *)editor->file_selector, GTK_WIDGET (preview)); + g_signal_connect (editor->file_selector, "update-preview", + G_CALLBACK (update_preview_cb), preview); gtk_dialog_set_default_response (GTK_DIALOG (editor->file_selector), GTK_RESPONSE_ACCEPT); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (editor->file_selector), g_get_home_dir ()); |