slackbuilds_ponce/graphics/dia/patches/0012-Cleanup-check-for-X11-forward-to-XQuartz-homepage-if.patch
Matteo Bernardini bce367d60b graphics/dia: Applied patches from upstream.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
2013-11-28 00:13:12 -06:00

88 lines
3.3 KiB
Diff

From 3651abfeed6a500dde7ce8ed389ff0c954faff99 Mon Sep 17 00:00:00 2001
From: Steffen Macke <sdteffen@sdteffen.de>
Date: Tue, 2 Jul 2013 12:35:44 +0200
Subject: [PATCH 12/24] Cleanup, check for X11, forward to XQuartz homepage, if
necessary.
---
installer/macosx/dia | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/installer/macosx/dia b/installer/macosx/dia
index 2b5be21..5b27386 100755
--- a/installer/macosx/dia
+++ b/installer/macosx/dia
@@ -23,6 +23,17 @@ TOP="`dirname \"$CWD\"`"
# LaTeX distribution for Mac OS X
#export PATH="/usr/texbin:/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH"
+# Check for X11
+if [[ "" == `which startx` ]]; then
+ if [[ ! -e /opt/X11/bin/startx ]]; then
+ osascript -e 'tell app "System Events" to display dialog "X11 (XQuartz) is not installed or not running. Would you like to visit xquartz.macosforge.org now in order to download and install XQuartz?" with icon 0'
+ if [[ $? -eq 0 ]]; then
+ open http://xquartz.macosforge.org
+ exit
+ fi
+ fi
+fi
+
# Setup PYTHONPATH to use python modules shipped with Dia
ARCH=`arch`
PYTHON_VERS=`python -V 2>&1 | cut -c 8-10`
@@ -37,7 +48,8 @@ export DIA_LIB_PATH="$TOP/dia"
export DIA_SHEET_PATH="$TOP/sheets"
export DIA_SHAPE_PATH="$TOP/shapes"
export DIA_XSLT_PATH="$TOP/xslt"
-export DIA_LOCALE_PATH="$TOP/locale"
+export DIA_SHAREDIR="$TOP"
+export DIA_LOCALE_PATH="$TOP/share/locale"
mkdir -p "${HOME}/.dia-etc"
@@ -54,6 +66,42 @@ export XDG_DATA_DIRS="$TOP/share"
# various configuration files.
ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'`
+# Set GTK theme (only if there is no .gtkrc-2.0 in the user's home)
+if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then
+ # Appearance setting
+ aquaStyle=`defaults read "Apple Global Domain" AppleAquaColorVariant 2>/dev/null`
+ # 1 for aqua, 6 for graphite, inexistant if the default color was never changed
+ if [[ "$aquaStyle" == "" ]]; then
+ aquaStyle=1 # set aqua as default
+ fi
+
+ # Highlight Color setting
+ hiliColor=`defaults read "Apple Global Domain" AppleHighlightColor 2>/dev/null`
+ # a RGB value, with components between 0 and 1, also inexistant if it was not changed
+ if [[ "$hiliColor" == "" ]]; then
+ hiliColor="0.709800 0.835300 1.000000" # set blue as default
+ fi
+
+ # Menu items color
+ if [[ aquaStyle -eq 1 ]]; then
+ menuColor="#4a76cd" # blue
+ else
+ menuColor="#7c8da4" # graphite
+ fi
+ # Format highlight color as a GTK rgb value
+ hiliColorFormated=`echo $hiliColor | awk -F " " '{print "\\\{"$1","$2","$3"\\\}"}'`
+
+ # echo $menuColor
+ # echo $hiliColorFormated
+
+ # Modify the gtkrc
+ # - with the correct colors
+ # - to point to the correct scrollbars folder
+ sed 's/OSX_HILI_COLOR_PLACEHOLDER/'$hiliColorFormated'/g' "$DIA_SHAREDIR/themes/CL/gtk-2.0/pre_gtkrc" | sed 's/OSX_MENU_COLOR_PLACEHOLDER/\"'$menuColor'\"/g' | sed 's/AQUASTYLE_PLACEHOLDER/'$aquaStyle'/g' | sed 's|${THEMEDIR}|'"$ESCAPEDTOP/themes/CL/gtk-2.0|g" > "${HOME}/.dia-etc/gtkrc"
+
+ export GTK2_RC_FILES="$HOME/.dia-etc/gtkrc"
+fi
+
# If the AppleCollationOrder preference doesn't exist, we fall back to using
# the AppleLocale preference.
LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null`
--
1.8.4.4