GNOME Bugzilla – Bug 169196
[PATCH] use g_get_home_dir()
Last modified: 2005-03-07 20:38:38 UTC
Please describe the problem: Index: gcalctool/gtk.c =================================================================== RCS file: /cvs/gnome/gcalctool/gcalctool/gtk.c,v retrieving revision 1.159 diff -u -r1.159 gtk.c --- gcalctool/gtk.c 15 Feb 2005 22:20:23 -0000 1.159 +++ gcalctool/gtk.c 4 Mar 2005 14:13:08 -0000 @@ -27,7 +27,6 @@ #include <sys/param.h> #include <sys/stat.h> #include <netdb.h> -#include <pwd.h> #include "calctool.h" #include "extern.h" #include "dsdefs.h" @@ -432,8 +431,6 @@ int main(int argc, char **argv) { - char name[MAXLINE]; /* Full name of users .gcalctoolrc file. */ - struct passwd *entry; GnomeClient *client; v = (Vars) LINT_CAST(calloc(1, sizeof(struct calcVars))); @@ -453,13 +450,10 @@ g_signal_connect(client, "die", G_CALLBACK(die_cb), NULL); gtk_rc_get_default_files(); - if ((v->home = getenv("HOME")) == NULL) { - if ((entry = getpwuid(getuid())) != NULL) { - v->home = entry->pw_dir; - } - } - SPRINTF(name, "%s/%s", v->home, RCNAME); - gtk_rc_parse(name); + + v->home = g_get_home_dir(); + gtk_rc_parse( g_build_path(v->home, RCNAME, NULL )); + X->kbd_accel = gtk_accel_group_new(); X->tips = gtk_tooltips_new(); Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information:
Thanks. I'll look at applying these changes for GNOME 2.11/12.
Changes checked into CVS HEAD. Version number in configure.in bumped to 5.6.0. This change will appear for GNOME 2.11/12.