Use g_file_set_contents instead of a single fwrite to write the ~/.face
2007-04-30 Bastien Nocera <hadess@hadess.net> * gnome-about-me.c: (about_me_update_photo): Use g_file_set_contents instead of a single fwrite to write the ~/.face image, also set the default permission to be 0644, even if the umask is more permissive, otherwise GDM won't show the icon in the chooser (Closes: #433898) svn path=/trunk/; revision=7523
This commit is contained in:
parent
bcbee706e8
commit
06ef162d4f
2 changed files with 21 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2007-04-30 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
* gnome-about-me.c: (about_me_update_photo): Use g_file_set_contents
|
||||||
|
instead of a single fwrite to write the ~/.face image, also set the
|
||||||
|
default permission to be 0644, even if the umask is more permissive,
|
||||||
|
otherwise GDM won't show the icon in the chooser (Closes: #433898)
|
||||||
|
|
||||||
2007-04-27 Rodrigo Moya <rodrigo@gnome-db.org>
|
2007-04-27 Rodrigo Moya <rodrigo@gnome-db.org>
|
||||||
|
|
||||||
* gnome-about-me.desktop.in.in: renamed Bugzilla product.
|
* gnome-about-me.desktop.in.in: renamed Bugzilla product.
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <libgnomevfs/gnome-vfs.h>
|
#include <libgnomevfs/gnome-vfs.h>
|
||||||
|
@ -452,7 +453,7 @@ about_me_update_photo (GnomeAboutMe *me)
|
||||||
GladeXML *dialog;
|
GladeXML *dialog;
|
||||||
EContactPhoto *photo;
|
EContactPhoto *photo;
|
||||||
gchar *file;
|
gchar *file;
|
||||||
FILE *fp;
|
GError *error;
|
||||||
|
|
||||||
guchar *data;
|
guchar *data;
|
||||||
gsize length;
|
gsize length;
|
||||||
|
@ -515,12 +516,19 @@ about_me_update_photo (GnomeAboutMe *me)
|
||||||
|
|
||||||
/* Save the image for GDM */
|
/* Save the image for GDM */
|
||||||
/* FIXME: I would have to read the default used by the gdmgreeter program */
|
/* FIXME: I would have to read the default used by the gdmgreeter program */
|
||||||
file = g_strdup_printf ("%s/.face", g_get_home_dir ());
|
error = NULL;
|
||||||
fp = fopen (file, "wb");
|
file = g_build_filename (g_get_home_dir (), ".face", NULL);
|
||||||
fwrite (photo->data.inlined.data, 1, photo->data.inlined.length, fp);
|
if (g_file_set_contents (file,
|
||||||
fclose (fp);
|
photo->data.inlined.data,
|
||||||
|
photo->data.inlined.length,
|
||||||
|
&error) != FALSE) {
|
||||||
|
g_chmod (file, 0644);
|
||||||
|
} else {
|
||||||
|
g_warning ("Could not create %s: %s", file, error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (file);
|
g_free (file);
|
||||||
|
|
||||||
e_contact_photo_free (photo);
|
e_contact_photo_free (photo);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue