aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-01-31 06:52:39 +0800
committerChris Toshok <toshok@src.gnome.org>2004-01-31 06:52:39 +0800
commitde481df1b35a4dfc8b425082a84519e43f92c9e4 (patch)
treeac7af4c967ea08687eec0ab406b6129470d28e03 /addressbook/gui/contact-editor
parentf06004a362ac6bb3bc3248653b5db266d554eb15 (diff)
downloadgsoc2013-evolution-de481df1b35a4dfc8b425082a84519e43f92c9e4.tar.gz
gsoc2013-evolution-de481df1b35a4dfc8b425082a84519e43f92c9e4.tar.zst
gsoc2013-evolution-de481df1b35a4dfc8b425082a84519e43f92c9e4.zip
enable d&d drop photos.
2004-01-30 Chris Toshok <toshok@ximian.com> * gui/contact-editor/e-contact-editor.c: enable d&d drop photos. * gui/contact-editor/contact-editor.glade: use eab_create_image_chooser_widget for the d&d'able image. * gui/contact-list-editor/e-contact-list-editor.c: abstract out all the d&d image support (it's now in widgets/misc/e-image-chooser.[ch]). * gui/contact-list-editor/contact-list-editor.glade: use eab_create_image_chooser_widget for the d&d'able image. * gui/widgets/eab-gui-util.c (eab_create_image_chooser_widget): new function. * gui/widgets/eab-gui-util.h: add prototype for eab_create_image_chooser_widget. svn path=/trunk/; revision=24553
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade6
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c44
2 files changed, 47 insertions, 3 deletions
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index 91e0658ef7..6b0d2fed31 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -1503,14 +1503,14 @@
</child>
<child>
- <widget class="Custom" id="custom1">
+ <widget class="Custom" id="image-chooser">
<property name="visible">True</property>
- <property name="creation_function">e_create_image_widget</property>
+ <property name="creation_function">eab_create_image_chooser_widget</property>
<property name="string1">malehead.png</property>
<property name="string2"></property>
<property name="int1">0</property>
<property name="int2">0</property>
- <property name="last_modification_time">Thu, 18 May 2000 12:19:47 GMT</property>
+ <property name="last_modification_time">Sat, 24 Jan 2004 19:28:18 GMT</property>
</widget>
<packing>
<property name="left_attach">0</property>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 5be1450ca7..0e60e5dea5 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -58,6 +58,7 @@
#include "addressbook/gui/widgets/eab-gui-util.h"
#include "e-util/e-gui-utils.h"
#include "widgets/misc/e-dateedit.h"
+#include "widgets/misc/e-image-chooser.h"
#include "widgets/misc/e-url-entry.h"
#include "widgets/misc/e-source-option-menu.h"
#include "shell/evolution-shell-component-utils.h"
@@ -1329,6 +1330,12 @@ set_entry_changed_signals(EContactEditor *editor)
g_signal_connect (widget, "changed",
G_CALLBACK (widget_changed), editor);
}
+
+ widget = glade_xml_get_widget (editor->gui, "image-chooser");
+ if (widget && E_IS_IMAGE_CHOOSER (widget)) {
+ g_signal_connect (widget, "changed",
+ G_CALLBACK (widget_changed), editor);
+ }
}
static void
@@ -3179,6 +3186,10 @@ set_editable (EContactEditor *editor)
entry = "text-address";
enable_widget (glade_xml_get_widget(editor->gui, entry),
editor->target_editable);
+
+ entry = "image-chooser";
+ enable_widget (glade_xml_get_widget(editor->gui, entry),
+ editor->target_editable);
}
static void
@@ -3190,6 +3201,7 @@ fill_in_info(EContactEditor *editor)
EContactName *name;
EContactDate *anniversary;
EContactDate *bday;
+ EContactPhoto *photo;
int i;
GtkWidget *widget;
gboolean wants_html;
@@ -3200,6 +3212,7 @@ fill_in_info(EContactEditor *editor)
"anniversary", &anniversary,
"birth_date", &bday,
"wants_html", &wants_html,
+ "photo", &photo,
NULL);
for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) {
@@ -3253,8 +3266,15 @@ fill_in_info(EContactEditor *editor)
e_date_edit_set_time (dateedit, -1);
}
+ if (photo) {
+ widget = glade_xml_get_widget(editor->gui, "image-chooser");
+ if (widget && E_IS_IMAGE_CHOOSER(widget))
+ e_image_chooser_set_image_data (E_IMAGE_CHOOSER (widget), photo->data, photo->length);
+ }
+
e_contact_date_free (anniversary);
e_contact_date_free (bday);
+ e_contact_photo_free (photo);
set_fields(editor);
@@ -3346,6 +3366,27 @@ extract_info(EContactEditor *editor)
} else
e_contact_set (contact, E_CONTACT_BIRTH_DATE, NULL);
}
+
+ widget = glade_xml_get_widget (editor->gui, "image-chooser");
+ if (widget && E_IS_IMAGE_CHOOSER (widget)) {
+ char *image_data;
+ gsize image_data_len;
+
+ if (e_image_chooser_get_image_data (E_IMAGE_CHOOSER (widget),
+ &image_data,
+ &image_data_len)) {
+ EContactPhoto photo;
+
+ photo.data = image_data;
+ photo.length = image_data_len;
+
+ e_contact_set (contact, E_CONTACT_PHOTO, &photo);
+ g_free (image_data);
+ }
+ else {
+ e_contact_set (contact, E_CONTACT_PHOTO, NULL);
+ }
+ }
}
}
@@ -3454,6 +3495,9 @@ enable_widget (GtkWidget *widget, gboolean enabled)
else if (E_IS_DATE_EDIT (widget)) {
e_date_edit_set_editable (E_DATE_EDIT (widget), enabled);
}
+ else if (E_IS_IMAGE_CHOOSER (widget)) {
+ e_image_chooser_set_editable (E_IMAGE_CHOOSER (widget), enabled);
+ }
else
gtk_widget_set_sensitive (widget, enabled);
}