After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 169196 - [PATCH] use g_get_home_dir()
[PATCH] use g_get_home_dir()
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2005-03-04 14:15 UTC by Kristof Vansant
Modified: 2005-03-07 20:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kristof Vansant 2005-03-04 14:15:24 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:
Comment 1 Rich Burridge 2005-03-04 15:40:55 UTC
Thanks. I'll look at applying these changes for GNOME 2.11/12.
Comment 2 Rich Burridge 2005-03-07 20:38:38 UTC
Changes checked into CVS HEAD. Version number
in configure.in bumped to 5.6.0. This change
will appear for GNOME 2.11/12.