commit 0089f43a4d2b6d786aaf49de2b5cde54650b7154
parent e355625ac5e9cdaa91a259849c4b1d939c71c6c4
Author: Jaromil <jaromil@dyne.org>
Date:   Fri, 25 Feb 2011 00:10:09 +0100
use GTK2_RC_FILES (thanks fgiunchedi)
Diffstat:
4 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/doc/tomb.1 b/doc/tomb.1
@@ -115,7 +115,7 @@ base root of the tomb.
 .IP "bind-hooks"
 This hook file consists of a simple two column list of files or
 directories inside the tomb to be made directly accessible inside the
-current user's home directory. Tomb will use the "mount -o bind"
+current user's home directory. Tomb will use the "mount \-o bind"
 command to bind locations inside the tomb to locations found in $HOME
 so in the first column are indicated paths relative to the tomb and in
 the second column are indicated paths relative to $HOME contents, for
diff --git a/share/Makefile.am b/share/Makefile.am
@@ -25,7 +25,11 @@ install-data-hook:
 	@mkdir -p $(prefix)/lib/mime/packages
 	@echo "application/x-tomb-volume; tomb-open '%s'; priority=8" > $(prefix)/lib/mime/packages/tomb
 	@echo "installing icons";
-	@if ! [ -n `which xdg-icon-resource install` ]; then xdg-icon-resource install --context mimetypes --size 32 ../src/monmort.xpm monmort; xdg-icon-resource install --size 32 ../src/monmort.xpm dyne-monmort; fi
+	@if ! [ -n `which xdg-icon-resource` ]; then \
+		xdg-icon-resource install --context mimetypes --size 32 ../src/monmort.xpm monmort; \
+		xdg-icon-resource install --size 32 ../src/monmort.xpm dyne-monmort; fi
+	mkdir -p $(datadir)/themes/tomb/gtk-2.0-key
+	sed -e 's@\%prefix\%@'"$(datadir)"'@' gtkrc-2.0 > $(datadir)/themes/tomb/gtk-2.0-key/gtkrc
 	@if ! [ -n `which update-desktop-database` ]; then echo update-desktop-database; update-desktop-database; fi
 	@if ! [ -n `which update-menus` ]; then echo update-menus;  update-menus; fi
 	@if ! [ -n `which update-mime` ]; then echo update-mime; update-mime; fi
diff --git a/share/gtkrc-2.0 b/share/gtkrc-2.0
@@ -0,0 +1,3 @@
+pixmap_path "%prefix%/pixmaps"
+style "normal" { stock["gtk-dialog-authentication"] = {{"monmort.xpm"}} }
+widget "*" style "normal"
diff --git a/src/tomb b/src/tomb
@@ -56,32 +56,19 @@ ask_password() {
 
     # pinentry has no custom icon setting
     # so we need to temporary modify the gtk theme
-    if [ -r ~/.gtkrc-2.0 ]; then
-	cp ~/.gtkrc-2.0 ~/.gtkrc-2.0.tomb.bak
-    else
-	touch ~/.gtkrc-2.0
+    if [ -r /usr/local/share/themes/tomb/gtk-2.0-key/gtkrc ]; then
+	GTK2_RC=/usr/local/share/themes/tomb/gtk-2.0-key/gtkrc
+    elif [ -r /usr/share/themes/tomb/gtk-2.0-key/gtkrc ]; then
+	GTK2_RC=/usr/share/themes/tomb/gtk-2.0-key/gtkrc
     fi
 
-    cat <<EOF  >> ~/.gtkrc-2.0
-    pixmap_path "/usr/local/share/pixmaps"
-    style "normal" { stock["gtk-dialog-authentication"] = {{"monmort.xpm"}} }
-    widget "*" style "normal"
-EOF
-
-    cat <<EOF | pinentry | awk '/^D/ { print $2 }'
+    cat <<EOF | GTK2_RC_FILES=${GTK2_RC} pinentry | awk '/^D/ { print $2 }'
 SETTITLE Insert tomb password
 SETDESC Open tomb: $1
 SETPROMPT Password:
 GETPIN
 EOF
 
-    # restore gtk as it was
-    if [ -r ~/.gtkrc-2.0.tomb.bak ]; then
-	cp ~/.gtkrc-2.0.tomb.bak ~/.gtkrc-2.0
-	rm ~/.gtkrc-2.0.tomb.bak
-    else
-	rm -f ~/.gtkrc-2.0
-    fi
 }