2007-10-09 [iwkse] 3.0.2cvs39
* src/addressbook.c * src/addritem.c * src/addritem.h * src/editaddress.c * src/editaddress_other_attributes_ldap.h * src/addrbook.c * src/Makefile.am add a contact's photo to the AddressBook
This commit is contained in:
parent
d54c883a1f
commit
c319948ba6
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-10-09 [iwkse] 3.0.2cvs39
|
||||
|
||||
* src/addressbook.c
|
||||
* src/addritem.c
|
||||
* src/addritem.h
|
||||
* src/editaddress.c
|
||||
* src/editaddress_other_attributes_ldap.h
|
||||
* src/addrbook.c
|
||||
* src/Makefile.am
|
||||
add a contact's photo to the AddressBook
|
||||
|
||||
2007-10-09 [iwkse] 3.0.2cvs39
|
||||
|
||||
* src/addressbook.c
|
||||
|
|
|
@ -2955,3 +2955,4 @@
|
|||
( cvs diff -u -r 1.60.2.100 -r 1.60.2.101 src/addressbook.c; cvs diff -u -r 1.13.2.13 -r 1.13.2.14 src/addritem.c; cvs diff -u -r 1.12.2.11 -r 1.12.2.12 src/addritem.h; cvs diff -u -r 1.14.2.29 -r 1.14.2.30 src/editaddress.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.22.2.17 -r 1.22.2.18 src/addrbook.c; cvs diff -u -r 1.155.2.77 -r 1.155.2.78 src/Makefile.am; ) > 3.0.2cvs40.patchset
|
||||
( cvs diff -u -r 1.60.2.100 -r 1.60.2.101 src/addressbook.c; cvs diff -u -r 1.13.2.13 -r 1.13.2.14 src/addritem.c; cvs diff -u -r 1.12.2.11 -r 1.12.2.12 src/addritem.h; cvs diff -u -r 1.14.2.29 -r 1.14.2.30 src/editaddress.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.22.2.17 -r 1.22.2.18 src/addrbook.c; cvs diff -u -r 1.155.2.77 -r 1.155.2.78 src/Makefile.am; ) > 3.0.2cvs41.patchset
|
||||
( cvs diff -u -r 1.60.2.100 -r 1.60.2.101 src/addressbook.c; cvs diff -u -r 1.13.2.13 -r 1.13.2.14 src/addritem.c; cvs diff -u -r 1.12.2.11 -r 1.12.2.12 src/addritem.h; cvs diff -u -r 1.14.2.29 -r 1.14.2.30 src/editaddress.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.22.2.17 -r 1.22.2.18 src/addrbook.c; cvs diff -u -r 1.155.2.77 -r 1.155.2.78 src/Makefile.am; ) > 3.0.2cvs39.patchset
|
||||
( cvs diff -u -r 1.60.2.100 -r 1.60.2.101 src/addressbook.c; cvs diff -u -r 1.13.2.13 -r 1.13.2.14 src/addritem.c; cvs diff -u -r 1.12.2.11 -r 1.12.2.12 src/addritem.h; cvs diff -u -r 1.14.2.29 -r 1.14.2.30 src/editaddress.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.22.2.17 -r 1.22.2.18 src/addrbook.c; cvs diff -u -r 1.155.2.77 -r 1.155.2.78 src/Makefile.am; ) > 3.0.2cvs39.patchset
|
||||
|
|
|
@ -491,9 +491,12 @@ claws_mail_LDADD = \
|
|||
$(MAEMO_LIBS) \
|
||||
$(CONIC_LIBS)
|
||||
|
||||
pixmapdir=$(datadir)/icons/hicolor/48x48/apps
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Claws-Mail\" \
|
||||
-DLOCALEDIR=\""$(localedir)"\" \
|
||||
-DPIXMAP_DIR=\""$(pixmapdir)"\" \
|
||||
-DMANUALDIR=\""$(manualdir)"\" \
|
||||
-DFAQDIR=\""$(faqdir)"\" \
|
||||
-DTARGET_ALIAS=\""$(target_triplet)"\" \
|
||||
|
|
|
@ -500,8 +500,10 @@ static void addrbook_parse_person(AddressBookFile *book, XMLFile *file)
|
|||
value = ((XMLAttr *)attr->data)->value;
|
||||
if (!person)
|
||||
person = addritem_create_item_person();
|
||||
if (strcmp(name, AB_ATTAG_UID) == 0)
|
||||
if (strcmp(name, AB_ATTAG_UID) == 0) {
|
||||
ADDRITEM_ID(person) = g_strdup(value);
|
||||
person->picture = g_strdup(value);
|
||||
}
|
||||
else if (strcmp(name, AB_ATTAG_FIRST_NAME) == 0)
|
||||
person->firstName = g_strdup(value);
|
||||
else if (strcmp(name, AB_ATTAG_LAST_NAME) == 0)
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include <gtk/gtkitemfactory.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "addressbook.h"
|
||||
|
@ -3915,8 +3917,60 @@ static gboolean addressbook_convert( AddressIndex *addrIndex ) {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
static gboolean migrate_addrbook(const gchar *origdir, const gchar *destdir)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *d;
|
||||
gboolean failed = FALSE;
|
||||
|
||||
if( ( dp = opendir( origdir ) ) == NULL ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while( ( d = readdir( dp ) ) != NULL ) {
|
||||
if (strncmp(d->d_name, "addrbook-", strlen("addrbook-")))
|
||||
continue;
|
||||
else {
|
||||
gchar *orig_file = g_strconcat(origdir, G_DIR_SEPARATOR_S,
|
||||
d->d_name, NULL);
|
||||
gchar *dest_file = g_strconcat(destdir, G_DIR_SEPARATOR_S,
|
||||
d->d_name, NULL);
|
||||
if (copy_file(orig_file, dest_file, FALSE) < 0) {
|
||||
failed = TRUE;
|
||||
}
|
||||
g_free(orig_file);
|
||||
g_free(dest_file);
|
||||
if (failed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir( dp );
|
||||
if (!failed) {
|
||||
/* all copies succeeded, we can remove source files */
|
||||
if( ( dp = opendir( origdir ) ) == NULL ) {
|
||||
return FALSE;
|
||||
}
|
||||
while( ( d = readdir( dp ) ) != NULL ) {
|
||||
if (strncmp(d->d_name, "addrbook-", strlen("addrbook-")))
|
||||
continue;
|
||||
else {
|
||||
gchar *orig_file = g_strconcat(origdir, G_DIR_SEPARATOR_S,
|
||||
d->d_name, NULL);
|
||||
g_unlink(orig_file);
|
||||
g_free(orig_file);
|
||||
}
|
||||
}
|
||||
closedir( dp );
|
||||
}
|
||||
|
||||
return !failed;
|
||||
}
|
||||
|
||||
void addressbook_read_file( void ) {
|
||||
AddressIndex *addrIndex = NULL;
|
||||
gchar *indexdir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, NULL);
|
||||
|
||||
debug_print( "Reading address index...\n" );
|
||||
if( _addressIndex_ ) {
|
||||
|
@ -3928,7 +3982,24 @@ void addressbook_read_file( void ) {
|
|||
addrindex_initialize();
|
||||
|
||||
/* Use new address book index. */
|
||||
|
||||
if ( !is_dir_exist(indexdir) ) {
|
||||
if ( make_dir(indexdir) < 0 ) {
|
||||
addrindex_set_file_path( addrIndex, get_rc_dir() );
|
||||
g_warning( "couldn't create dir %s\n", indexdir);
|
||||
} else {
|
||||
if (!migrate_addrbook(get_rc_dir(), indexdir)) {
|
||||
remove_dir_recursive(indexdir);
|
||||
addrindex_set_file_path( addrIndex, get_rc_dir() );
|
||||
g_error("couldn't migrate dir %s", indexdir);
|
||||
} else {
|
||||
addrindex_set_file_path( addrIndex, indexdir);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addrindex_set_file_path( addrIndex, indexdir);
|
||||
}
|
||||
g_free(indexdir);
|
||||
addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
|
||||
addrindex_read_data( addrIndex );
|
||||
if( addrIndex->retVal == MGU_NO_FILE ) {
|
||||
|
@ -5350,11 +5421,11 @@ static void addressbook_drag_data_get(GtkWidget *widget,
|
|||
if( ds && ds->interface && ds->interface->readOnly)
|
||||
gtk_selection_data_set(selection_data,
|
||||
selection_data->target, 8,
|
||||
"Dummy_addr_copy", 15);
|
||||
(const guchar *)"Dummy_addr_copy", 15);
|
||||
else
|
||||
gtk_selection_data_set(selection_data,
|
||||
selection_data->target, 8,
|
||||
"Dummy_addr_move", 15);
|
||||
(const guchar *)"Dummy_addr_move", 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,6 +217,7 @@ ItemPerson *addritem_create_item_person( void ) {
|
|||
ADDRITEM_NAME(person) = NULL;
|
||||
ADDRITEM_PARENT(person) = NULL;
|
||||
ADDRITEM_SUBTYPE(person) = 0;
|
||||
person->picture = NULL;
|
||||
person->firstName = NULL;
|
||||
person->lastName = NULL;
|
||||
person->nickName = NULL;
|
||||
|
@ -240,6 +241,7 @@ ItemPerson *addritem_copy_item_person( ItemPerson *item ) {
|
|||
if( item ) {
|
||||
itemNew = addritem_create_item_person();
|
||||
ADDRITEM_NAME(itemNew) = g_strdup( ADDRITEM_NAME(item) );
|
||||
itemNew->picture = g_strdup( item->picture );
|
||||
itemNew->firstName = g_strdup( item->firstName );
|
||||
itemNew->lastName = g_strdup( item->lastName );
|
||||
itemNew->nickName = g_strdup( item->nickName );
|
||||
|
@ -249,6 +251,23 @@ ItemPerson *addritem_copy_item_person( ItemPerson *item ) {
|
|||
return itemNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify picture for person object.
|
||||
* \param person Person object.
|
||||
* \param value Picture.
|
||||
*/
|
||||
void addritem_person_set_picture( ItemPerson *person, const gchar *value ) {
|
||||
if (!value || g_utf8_validate(value, -1, NULL))
|
||||
person->picture = mgu_replace_string( person->picture, value );
|
||||
else {
|
||||
gchar *out = conv_codeset_strdup(value,
|
||||
conv_get_locale_charset_str_no_utf8(),
|
||||
CS_INTERNAL);
|
||||
if (out)
|
||||
person->picture = mgu_replace_string( person->picture, out );
|
||||
g_free(out);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Specify first name for person object.
|
||||
* \param person Person object.
|
||||
|
@ -385,6 +404,7 @@ void addritem_free_item_person( ItemPerson *person ) {
|
|||
/* Free internal stuff */
|
||||
g_free( ADDRITEM_ID(person) );
|
||||
g_free( ADDRITEM_NAME(person) );
|
||||
g_free( person->picture );
|
||||
g_free( person->firstName );
|
||||
g_free( person->lastName );
|
||||
g_free( person->nickName );
|
||||
|
@ -397,6 +417,7 @@ void addritem_free_item_person( ItemPerson *person ) {
|
|||
ADDRITEM_NAME(person) = NULL;
|
||||
ADDRITEM_PARENT(person) = NULL;
|
||||
ADDRITEM_SUBTYPE(person) = 0;
|
||||
person->picture = NULL;
|
||||
person->firstName = NULL;
|
||||
person->lastName = NULL;
|
||||
person->nickName = NULL;
|
||||
|
@ -447,6 +468,7 @@ void addritem_print_item_person( ItemPerson *person, FILE *stream ) {
|
|||
fprintf( stream, "\tt/uid: %d : '%s'\n", ADDRITEM_TYPE(person), ADDRITEM_ID(person) );
|
||||
fprintf( stream, "\tsubty: %d\n", ADDRITEM_SUBTYPE(person) );
|
||||
fprintf( stream, "\tcommn: '%s'\n", ADDRITEM_NAME(person) );
|
||||
fprintf( stream, "\tphoto: '%s'\n", person->picture );
|
||||
fprintf( stream, "\tfirst: '%s'\n", person->firstName );
|
||||
fprintf( stream, "\tlast : '%s'\n", person->lastName );
|
||||
fprintf( stream, "\tnick : '%s'\n", person->nickName );
|
||||
|
|
|
@ -72,6 +72,7 @@ struct _AddrItemObject {
|
|||
typedef struct _ItemPerson ItemPerson;
|
||||
struct _ItemPerson {
|
||||
AddrItemObject obj;
|
||||
gchar *picture;
|
||||
gchar *firstName;
|
||||
gchar *lastName;
|
||||
gchar *nickName;
|
||||
|
@ -135,6 +136,7 @@ void addritem_free_attribute ( UserAttribute *item );
|
|||
|
||||
ItemPerson *addritem_create_item_person ( void );
|
||||
ItemPerson *addritem_copy_item_person ( ItemPerson *item );
|
||||
void addritem_person_set_picture ( ItemPerson *person, const gchar *value );
|
||||
void addritem_person_set_first_name ( ItemPerson *person, const gchar *value );
|
||||
void addritem_person_set_last_name ( ItemPerson *person, const gchar *value );
|
||||
void addritem_person_set_nick_name ( ItemPerson *person, const gchar *value );
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "addrbook.h"
|
||||
#include "manage_window.h"
|
||||
#include "gtkutils.h"
|
||||
#include "filesel.h"
|
||||
#include "codeconv.h"
|
||||
#include "editaddress.h"
|
||||
#include "editaddress_other_attributes_ldap.h"
|
||||
|
@ -437,6 +438,7 @@ static void edit_person_load_attrib( ItemPerson *person ) {
|
|||
UserAttribute *atorig = ( UserAttribute * ) node->data;
|
||||
UserAttribute *attrib = addritem_copy_attribute( atorig );
|
||||
gint row;
|
||||
debug_print("name: %s value: %s\n", attrib->name, attrib->value);
|
||||
text[ ATTRIB_COL_NAME ] = attrib->name;
|
||||
text[ ATTRIB_COL_VALUE ] = attrib->value;
|
||||
|
||||
|
@ -572,7 +574,7 @@ static GtkWidget* addressbook_edit_person_widgets_create( GtkWidget* container,
|
|||
GtkWidget *cancel_btn;
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 4);
|
||||
/* gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH); */
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH);
|
||||
gtk_widget_show(vbox);
|
||||
gtk_container_add(GTK_CONTAINER(container), vbox);
|
||||
|
||||
|
@ -694,10 +696,42 @@ void addressbook_edit_person_widgetset_hide( void )
|
|||
gtk_widget_hide( personeditdlg.container );
|
||||
}
|
||||
|
||||
GtkWidget *picture;
|
||||
|
||||
static void addressbook_edit_person_set_picture(gpointer data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *filename;
|
||||
int width, height, scalewidth, scaleheight;
|
||||
if ( (filename = filesel_select_file_open(_("Choose a picture"), NULL)) ) {
|
||||
personeditdlg.picture = gdk_pixbuf_new_from_file(filename, &error);
|
||||
personeditdlg.picture_set = TRUE;
|
||||
g_free(filename);
|
||||
width = gdk_pixbuf_get_width(personeditdlg.picture);
|
||||
height = gdk_pixbuf_get_height(personeditdlg.picture);
|
||||
|
||||
if ( width > 128 || height > 128 ) {
|
||||
if (width > height) {
|
||||
scaleheight = (height * 128) / width;
|
||||
scalewidth = 128;
|
||||
}
|
||||
else {
|
||||
scalewidth = (width * 128) / height;
|
||||
scaleheight = 128;
|
||||
}
|
||||
personeditdlg.picture = gdk_pixbuf_scale_simple(personeditdlg.picture, scalewidth, scaleheight, GDK_INTERP_BILINEAR);
|
||||
}
|
||||
gtk_image_set_from_pixbuf(GTK_IMAGE(picture), personeditdlg.picture);
|
||||
}
|
||||
}
|
||||
|
||||
static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *ebox_picture;
|
||||
GtkWidget *frame_picture;
|
||||
GtkWidget *entry_name;
|
||||
GtkWidget *entry_fn;
|
||||
GtkWidget *entry_ln;
|
||||
|
@ -705,22 +739,39 @@ static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
|
|||
const gchar *locale;
|
||||
gint top = 0;
|
||||
|
||||
vbox = gtk_vbox_new( FALSE, 8 );
|
||||
vbox = gtk_vbox_new( FALSE, 20 );
|
||||
hbox = gtk_hbox_new( FALSE, 8 );
|
||||
|
||||
gtk_widget_show( vbox );
|
||||
gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
|
||||
|
||||
/* User's picture */
|
||||
ebox_picture = gtk_event_box_new();
|
||||
frame_picture = gtk_frame_new("Photo");
|
||||
|
||||
/* Room for a photo */
|
||||
personeditdlg.picture = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 128, 128);
|
||||
personeditdlg.picture_set = FALSE;
|
||||
picture = gtk_image_new_from_pixbuf(personeditdlg.picture);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(ebox_picture), picture);
|
||||
gtk_container_add(GTK_CONTAINER(frame_picture), ebox_picture);
|
||||
gtk_container_add(GTK_CONTAINER( personeditdlg.notebook ), hbox );
|
||||
gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
|
||||
gtk_container_set_border_width( GTK_CONTAINER (hbox), BORDER_WIDTH );
|
||||
|
||||
label = gtk_label_new_with_mnemonic( pageLbl );
|
||||
gtk_widget_show( label );
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox), frame_picture, TRUE, TRUE, 0);
|
||||
|
||||
gtk_notebook_set_tab_label(
|
||||
GTK_NOTEBOOK( personeditdlg.notebook ),
|
||||
gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label );
|
||||
|
||||
table = gtk_table_new( 4, 3, FALSE);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
|
||||
gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
|
||||
gtk_table_set_row_spacings(GTK_TABLE(table), 8);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
|
||||
g_signal_connect(G_OBJECT(ebox_picture), "button_press_event",
|
||||
G_CALLBACK(addressbook_edit_person_set_picture), NULL);
|
||||
|
||||
table = gtk_table_new( 3, 3, FALSE);
|
||||
|
||||
#define ATTACH_ROW(text, entry) \
|
||||
{ \
|
||||
|
@ -764,9 +815,13 @@ static void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
|
|||
|
||||
#undef ATTACH_ROW
|
||||
#undef ATTACH_HIDDEN_ROW
|
||||
gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
|
||||
gtk_box_pack_end(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
|
||||
gtk_table_set_row_spacings(GTK_TABLE(table), 15);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(table), 8);
|
||||
|
||||
gtk_widget_show_all(vbox);
|
||||
|
||||
personeditdlg.entry_name = entry_name;
|
||||
personeditdlg.entry_first = entry_fn;
|
||||
personeditdlg.entry_last = entry_ln;
|
||||
|
@ -939,6 +994,7 @@ static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
|
|||
buttonMod = gtk_button_new_from_stock(GTK_STOCK_SAVE);
|
||||
buttonAdd = gtk_button_new_from_stock(GTK_STOCK_ADD);
|
||||
|
||||
|
||||
#ifndef MAEMO
|
||||
gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonUp );
|
||||
|
||||
|
@ -1288,6 +1344,7 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
|
|||
{
|
||||
GList *listEMail = NULL;
|
||||
GList *listAttrib = NULL;
|
||||
GError *error;
|
||||
gchar *cn = NULL;
|
||||
|
||||
listEMail = edit_person_build_email_list();
|
||||
|
@ -1342,8 +1399,16 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
|
|||
|
||||
if( ! cancelled ) {
|
||||
/* Set current_person stuff */
|
||||
|
||||
gchar *name;
|
||||
addritem_person_set_common_name( current_person, cn );
|
||||
if (personeditdlg.picture_set) {
|
||||
name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
|
||||
ADDRITEM_ID(current_person), NULL );
|
||||
gdk_pixbuf_save(personeditdlg.picture, name, "png", &error, NULL);
|
||||
addritem_person_set_picture( current_person, ADDRITEM_ID(current_person) ) ;
|
||||
g_free( name );
|
||||
}
|
||||
name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
|
||||
addritem_person_set_first_name( current_person, name );
|
||||
g_free( name );
|
||||
|
@ -1374,13 +1439,13 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
|
|||
* only required for new objects).
|
||||
* person Person to edit, or NULL for a new person object.
|
||||
* pgMail If TRUE, E-Mail page will be activated.
|
||||
* Return: Edited object, or NULL if cancelled.
|
||||
*/
|
||||
* Return: Edited object, or NULL if cancelled.*/
|
||||
ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_folder, ItemPerson *person,
|
||||
gboolean pgMail, GtkWidget *parent_container,
|
||||
void (*post_update_cb) (ItemPerson *person),
|
||||
gboolean get_focus) {
|
||||
static gboolean cancelled;
|
||||
GError *error = NULL;
|
||||
|
||||
/* set transient data */
|
||||
current_abf = abf;
|
||||
|
@ -1388,7 +1453,6 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
|
|||
current_parent_folder = parent_folder;
|
||||
edit_person_close_post_update_cb = post_update_cb;
|
||||
personeditdlg.ldap = (abf && abf->type == ADBOOKTYPE_LDAP)? TRUE : FALSE;
|
||||
|
||||
if( !personeditdlg.container )
|
||||
addressbook_edit_person_create(parent_container, &cancelled);
|
||||
|
||||
|
@ -1420,17 +1484,31 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
|
|||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), "" );
|
||||
|
||||
personeditdlg.editNew = FALSE;
|
||||
if( person ) {
|
||||
if( ADDRITEM_NAME(person) )
|
||||
if( current_person ) {
|
||||
if( ADDRITEM_NAME(current_person) )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), ADDRITEM_NAME(person) );
|
||||
if( person->firstName )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), person->firstName );
|
||||
if( person->lastName )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_last), person->lastName );
|
||||
if( person->nickName )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), person->nickName );
|
||||
edit_person_load_email( person );
|
||||
edit_person_load_attrib( person );
|
||||
else
|
||||
personeditdlg.picture = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 128, 128);
|
||||
if( current_person->picture ) {
|
||||
gchar *filename = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
|
||||
current_person->picture, NULL );
|
||||
personeditdlg.picture = gdk_pixbuf_new_from_file(filename, &error);
|
||||
personeditdlg.picture_set = TRUE;
|
||||
g_free(filename);
|
||||
} else {
|
||||
personeditdlg.picture_set = FALSE;
|
||||
personeditdlg.picture = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 128, 128);
|
||||
}
|
||||
gtk_image_set_from_pixbuf(GTK_IMAGE(picture), personeditdlg.picture);
|
||||
|
||||
if( current_person->firstName )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), current_person->firstName );
|
||||
if( current_person->lastName )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_last), current_person->lastName );
|
||||
if( current_person->nickName )
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), current_person->nickName );
|
||||
edit_person_load_email( current_person );
|
||||
edit_person_load_attrib( current_person );
|
||||
gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_atvalue), "");
|
||||
}
|
||||
else {
|
||||
|
@ -1448,7 +1526,7 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
|
|||
gtk_clist_select_row( GTK_CLIST(personeditdlg.clist_email), 0, 0 );
|
||||
gtk_clist_select_row( GTK_CLIST(personeditdlg.clist_attrib), 0, 0 );
|
||||
edit_person_email_clear( NULL );
|
||||
if (person)
|
||||
if (current_person)
|
||||
edit_person_email_list_selected(GTK_CLIST(personeditdlg.clist_email), 0, 0, NULL, NULL);
|
||||
|
||||
edit_person_attrib_clear( NULL );
|
||||
|
@ -1462,7 +1540,7 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent_fo
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return person;
|
||||
return current_person;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,6 +45,8 @@ struct _PersonEdit_dlg {
|
|||
gint status_cid;
|
||||
|
||||
/* User data tab */
|
||||
GdkPixbuf *picture;
|
||||
gboolean picture_set;
|
||||
GtkWidget *entry_name;
|
||||
GtkWidget *entry_first;
|
||||
GtkWidget *entry_last;
|
||||
|
|
Loading…
Reference in a new issue