File: 16_default_interface.dpatch

package info (click to toggle)
alsaplayer 0.99.76-9%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,752 kB
  • ctags: 2,970
  • sloc: ansic: 16,775; sh: 10,709; cpp: 9,442; makefile: 694
file content (31 lines) | stat: -rw-r--r-- 1,362 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16_default_interface.dpatch by  <hubert@uhoreg.ca>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: use text interface if gtk interface selected, but $DISPLAY not set

@DPATCH@
--- alsaplayer-0.99.76/app/Main.cpp.orig	2006-01-25 21:33:52.344137582 -0700
+++ alsaplayer-0.99.76/app/Main.cpp	2006-01-25 21:37:47.383718469 -0700
@@ -916,13 +916,17 @@
 			goto _fatal_err;
 		}
 	} else {
-		if (!(interface_plugin_info = load_interface(prefs_get_string
-						(ap_prefs, "main", "default_interface", "gtk")))) {
+		char *interface = prefs_get_string
+			(ap_prefs, "main", "default_interface", "gtk");
+		// if we're trying to use the gtk interface, but we have no
+		// $DISPLAY, use the text interface instead
+		if (strcmp (interface, "gtk") == 0 && !getenv("DISPLAY"))
+			interface = "text";
+		if (!(interface_plugin_info = load_interface(interface))) {
 			if (!(interface_plugin_info = load_interface(prefs_get_string
 						 (ap_prefs, "main", "fallback_interface", "text")))) {
 				alsaplayer_error("Failed to load text interface. This is bad (%s,%s,%s)",
-					 prefs_get_string(ap_prefs, "main", "default_interface", "gtk"),
-					 prefs_get_string(ap_prefs, "main", "default_interface", "gtk"),
+					 interface, interface,
 					global_pluginroot);
 				goto _fatal_err;
 			}