diff --git a/capplets/about-me/ChangeLog b/capplets/about-me/ChangeLog index d8b6daeae..42ffb81a4 100644 --- a/capplets/about-me/ChangeLog +++ b/capplets/about-me/ChangeLog @@ -1,3 +1,17 @@ +2005-06-22 Diego Gonzalez + + * Makefile.am: remove cracklib + * gnome-about-me-password.c (passdlg_check_password_timeout_cb): + remove dependencies on cracklib + * cracklib/*: remove it + +2005-06-21 Diego Gonzalez + + * gnome-about-me.c: Improve some error messages + about_me_error: new function + * (about_me_load_info): Avoid crashing when switching to the Address tab + * (about_me_commit): generate a good file_as field, code taken from evolution + 2005-06-15 Diego Gonzalez * gnome-about-me.glade: Change the look of the "change Password" diff --git a/capplets/about-me/Makefile.am b/capplets/about-me/Makefile.am index 87d61958e..1c8fd4ba0 100644 --- a/capplets/about-me/Makefile.am +++ b/capplets/about-me/Makefile.am @@ -1,5 +1,3 @@ -SUBDIRS = cracklib - bin_PROGRAMS = gnome-about-me pixmapdir = $(GNOMECC_PIXMAPS_DIR) @@ -8,7 +6,7 @@ pixmap_DATA = \ gnome-about-me-bulb-on.png \ gnome-about-me-bulb-off.png -gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) -lutil cracklib/libcracklib.a +gnome_about_me_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(LIBEBOOK_LIBS) -lutil gnome_about_me_SOURCES = \ eel-alert-dialog.c \ e-util-marshal.c \ diff --git a/capplets/about-me/gnome-about-me-password.c b/capplets/about-me/gnome-about-me-password.c index fec9403b5..717733975 100644 --- a/capplets/about-me/gnome-about-me-password.c +++ b/capplets/about-me/gnome-about-me-password.c @@ -36,7 +36,6 @@ #include #include #include -#include #include "capplet-util.h" #include "eel-alert-dialog.h" @@ -440,16 +439,8 @@ passdlg_check_password_timeout_cb (PasswordDialog *pdialog) msg = g_strdup ("Please type the password again, it is wrong."); good_password = FALSE; } else { - msgtmp = FascistCheck (password, CRACKLIB_DICTPATH); - - if (msgtmp == NULL) { - msg = g_strdup ("Push on the ok button to change the password"); - good_password = TRUE; - } else { - msg = g_strdup_printf ("%s", msgtmp); - g_free (msgtmp); - good_password = FALSE; - } + msg = g_strdup ("Push on the ok button to change the password"); + good_password = TRUE; } if (good_password && pdialog->good_password == FALSE) { diff --git a/capplets/about-me/gnome-about-me.c b/capplets/about-me/gnome-about-me.c index 53428cce5..afe610e87 100644 --- a/capplets/about-me/gnome-about-me.c +++ b/capplets/about-me/gnome-about-me.c @@ -38,25 +38,27 @@ #include "capplet-util.h" typedef struct { - EContact *contact; - EBook *book; + EContact *contact; + EBook *book; - GladeXML *dialog; + GladeXML *dialog; - GtkWidget *fsel; - GdkScreen *screen; - GtkIconTheme *theme; + GtkWidget *fsel; + GdkScreen *screen; + GtkIconTheme *theme; EContactAddress *addr1; EContactAddress *addr2; - gboolean have_image; - gboolean image_changed; - gboolean create_self; + gboolean have_image; + gboolean image_changed; + gboolean create_self; - gchar *person; + gchar *person; + gchar *login; + gchar *username; - guint commit_timeout_id; + guint commit_timeout_id; } GnomeAboutMe; static GnomeAboutMe *me; @@ -132,15 +134,51 @@ enum static void about_me_set_address_field (EContactAddress *, guint, gchar *); +/*** Utility functions ***/ +static void +about_me_error (GtkWidget *parent, gchar *str) +{ + GtkWidget *warn; + + warn = gtk_message_dialog_new (GTK_WINDOW (parent), + GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, str); + + g_signal_connect (warn, "response", G_CALLBACK (gtk_widget_destroy), NULL); +} + + /********************/ static void about_me_commit (GnomeAboutMe *me) { + EContactName *name; + char *fileas; + char *strings[4], **stringptr; GError *error = NULL; + + if (me->create_self) { - e_contact_set (me->contact, E_CONTACT_FILE_AS, "asdffff"); + if (me->username == NULL) + fileas = g_strdup ("Myself"); + else { + name = e_contact_name_from_string (me->username); + + stringptr = strings; + if (name->family && *name->family) + *(stringptr++) = name->family; + if (name->given && *name->given) + *(stringptr++) = name->given; + *stringptr = NULL; + fileas = g_strjoinv (", ", strings); + } + + e_contact_set (me->contact, E_CONTACT_FILE_AS, fileas); e_contact_set (me->contact, E_CONTACT_NICKNAME, "nickname"); - e_contact_set (me->contact, E_CONTACT_FULL_NAME, "fullname"); + e_contact_set (me->contact, E_CONTACT_FULL_NAME, me->username); + + e_contact_name_free (name); + g_free (fileas); } if (me->create_self) { @@ -157,8 +195,6 @@ about_me_commit (GnomeAboutMe *me) static gboolean about_me_commit_from_timeout (GnomeAboutMe *me) { - g_print ("commit from timeout\n"); - about_me_commit (me); return FALSE; @@ -178,7 +214,6 @@ about_me_focus_out (GtkWidget *widget, GdkEventFocus *event, GnomeAboutMe *me) break; if (ids[i].cid == 0) { - g_warning ("returning at invalid point\n"); return FALSE; } @@ -198,6 +233,7 @@ about_me_focus_out (GtkWidget *widget, GdkEventFocus *event, GnomeAboutMe *me) str = str ? str : ""; + /* FIXME: i'm getting an empty address field in evolution */ if (i >= ADDRESS_HOME && i < ADDRESS_WORK) { about_me_set_address_field (me->addr1, ids[i].cid, str); e_contact_set (me->contact, E_CONTACT_ADDRESS_HOME, me->addr1); @@ -319,6 +355,7 @@ about_me_set_address_field (EContactAddress *addr, guint cid, gchar *str) } /** + * about_me_load_string_field: * * wid: glade widget name * cid: id of the field (EDS id) @@ -366,14 +403,13 @@ about_me_load_string_field (GnomeAboutMe *me, const gchar *wid, guint cid, guint static void about_me_load_photo (GnomeAboutMe *me, EContact *contact) { - GtkWidget *widget; GladeXML *dialog; EContactPhoto *photo; dialog = me->dialog; - widget = WID("image-chooser"); + widget = WID ("image-chooser"); e_image_chooser_set_from_file (E_IMAGE_CHOOSER (widget), me->person); @@ -447,6 +483,9 @@ about_me_load_info (GnomeAboutMe *me) me->addr2 = e_contact_get (me->contact, E_CONTACT_ADDRESS_WORK); if (me->addr2 == NULL) me->addr2 = g_new0 (EContactAddress, 1); + } else { + me->addr1 = g_new0 (EContactAddress, 1); + me->addr2 = g_new0 (EContactAddress, 1); } for (i = 0; ids[i].wid != NULL; i++) { @@ -639,7 +678,7 @@ about_me_setup_dialog (void) g_signal_connect_object (me->theme, "changed", G_CALLBACK (about_me_icon_theme_changed), - GTK_WIDGET (WID("about-me-dialog")), + GTK_WIDGET (WID ("about-me-dialog")), G_CONNECT_SWAPPED); /* Get the self contact */ @@ -656,8 +695,10 @@ about_me_setup_dialog (void) if (me->book == NULL) g_print ("error message: %s\n", error->message); - if (e_book_open (me->book, FALSE, NULL) == FALSE) - g_print ("unable to open book, bailing out\n"); + if (e_book_open (me->book, FALSE, NULL) == FALSE) { + about_me_error (WID ("about-me-dialog"), + _("Unable to open address book")); + } } } @@ -666,7 +707,8 @@ about_me_setup_dialog (void) setpwent (); pwent = getpwnam (user); if (pwent == NULL) { - printf ("error\n"); + about_me_error (WID ("about-me-dialog"), + _("Unknown login ID, the user database might be corrupted")); return ; } gchar **tok; @@ -674,7 +716,11 @@ about_me_setup_dialog (void) /************************************************/ - /* Fill in the blanks */ + me->login = g_strdup (user); + if (tok[0] == NULL || strlen (tok[0]) == 0) + me->username = NULL; + else + me->username = g_strdup (tok[0]); /* Contact Tab */ about_me_load_photo (me, me->contact);