commit 32619c5cedfd83d798e8815b8731bdd987a507ec
parent 2eea265d97ced652be60391b76cba8579f7341b0
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Wed, 23 Jun 2010 15:20:53 +1000
Use uname to detect the platform
Diffstat:
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -9,6 +9,7 @@ spek_SOURCES = \
INCLUDES = \
-include config.h \
+ -include sys/utsname.h \
$(SPEK_CFLAGS) \
$(IGE_MAC_CFLAGS) \
-DLOCALEDIR=\""$(localedir)"\" \
@@ -16,7 +17,7 @@ INCLUDES = \
-DPKGLIBDIR=\""$(pkglibdir)"\"
VALAFLAGS = \
- --vapidir=$(srcdir)/../vapi --pkg config \
+ --vapidir=$(srcdir)/../vapi --pkg config --pkg sys \
$(IGE_MAC_VALA) \
@SPEK_PACKAGES@
diff --git a/src/spek-spectrogram.vala b/src/spek-spectrogram.vala
@@ -20,6 +20,7 @@ using Cairo;
using Gdk;
using Gtk;
using Pango;
+using Sys;
namespace Spek {
class Spectrogram : DrawingArea {
@@ -40,14 +41,14 @@ namespace Spek {
private const int BPAD = 40;
private const int GAP = 10;
private const int RULER = 10;
- private const double FONT_SCALE =
-#if MAC_INTEGRATION
- 1.5; // Pango/Quartz fonts are smaller than on X.
-#else
- 1.0;
-#endif
+ private double FONT_SCALE;
public Spectrogram () {
+ // Pango/Quartz fonts are smaller than on X.
+ var name = UtsName ();
+ uname (ref name);
+ FONT_SCALE = name.sysname == "Darwin" ? 1.5 : 1.0;
+
// Pre-draw the palette.
palette = new ImageSurface (Format.RGB24, RULER, BANDS);
for (int y = 0; y < BANDS; y++) {
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
@@ -1,5 +1,6 @@
noinst_DATA = \
- config.vapi
+ config.vapi \
+ sys.vapi
EXTRA_DIST = \
$(noinst_DATA)
diff --git a/vapi/sys.vapi b/vapi/sys.vapi
@@ -0,0 +1,14 @@
+[CCode (cheader_filename = "sys/utsname.h")]
+namespace Sys {
+ [CCode (cname = "struct utsname")]
+ public struct UtsName {
+ public weak string sysname;
+ public weak string nodename;
+ public weak string release;
+ public weak string version;
+ public weak string machine;
+ public weak string domainname;
+ }
+ [CCode (cname = "uname")]
+ public int uname (ref UtsName name);
+}
+\ No newline at end of file