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>
|
||||
|
||||
* gnome-about-me.desktop.in.in: renamed Bugzilla product.
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
#include <gnome.h>
|
||||
#include <pwd.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
|
@ -452,7 +453,7 @@ about_me_update_photo (GnomeAboutMe *me)
|
|||
GladeXML *dialog;
|
||||
EContactPhoto *photo;
|
||||
gchar *file;
|
||||
FILE *fp;
|
||||
GError *error;
|
||||
|
||||
guchar *data;
|
||||
gsize length;
|
||||
|
@ -515,10 +516,17 @@ about_me_update_photo (GnomeAboutMe *me)
|
|||
|
||||
/* Save the image for GDM */
|
||||
/* FIXME: I would have to read the default used by the gdmgreeter program */
|
||||
file = g_strdup_printf ("%s/.face", g_get_home_dir ());
|
||||
fp = fopen (file, "wb");
|
||||
fwrite (photo->data.inlined.data, 1, photo->data.inlined.length, fp);
|
||||
fclose (fp);
|
||||
error = NULL;
|
||||
file = g_build_filename (g_get_home_dir (), ".face", NULL);
|
||||
if (g_file_set_contents (file,
|
||||
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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue