public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] X Support for ufed (patch)
@ 2003-08-03 21:42 Ned Ludd
  2003-08-04  3:01 ` [gentoo-dev] " Fred Van Andel
  0 siblings, 1 reply; 2+ messages in thread
From: Ned Ludd @ 2003-08-03 21:42 UTC (permalink / raw
  To: gentoo-dev; +Cc: fava

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]


This patch extends the functionality of ufed (version 0.33/ CVS revision
1.15) to allow us to take advantage of Xdialog when it's installed. The
option can also be overridden using a --no-x option.

Please review and consider for inclusion in the next release of ufed.

--
Ned Ludd <solar@gentoo.org>
Gentoo Linux Developer (Hardened)

[-- Attachment #2: ufed-0.33.diff --]
[-- Type: text/plain, Size: 1602 bytes --]

--- ufed.orig	2003-08-03 17:04:40.000000000 -0400
+++ ufed	2003-08-03 17:13:48.000000000 -0400
@@ -13,7 +13,7 @@
 
 # version number format is x.yy
 # if y<10, you NEED the trailing zero!
-my $version = '0.33';
+my $version = '0.34';
 
 my @make_defaults_flags;
 my @use_defaults_flags;
@@ -29,6 +29,20 @@
 
 my $PortageBase = '/usr/portage';
 
+my $DIALOG = 'dialog';
+
+if (($ENV{'DISPLAY'} ne "") && ($ARGV[0] ne "--no-x")) {
+   if (-x '/usr/bin/Xdialog') {
+      print "Detected Xdialog binary and DISPLAY environment variable. Switching to X-based dialog.\n";
+      print "To prevent this action, unset DISPLAY or pass --no-x to this program.\n";
+      $DIALOG = '/usr/bin/Xdialog';
+   } else {
+      print "Detected DISPLAY environment variable but Xdialog does not appear to be installed.\n";
+      print "If you would like X support you can emerge x11-misc/xdialog. using default dialog now.\n";
+      sleep 2;
+   }
+} 
+
 sub get_flag_from_file
 {
 
@@ -284,7 +298,7 @@
       $items .= '"' . %use_desc_flags->{$flag} . '" ';
    }
 
-   $rc = system('DIALOG_ESC="" dialog 2>'
+   $rc = system('DIALOG_ESC="" '.$DIALOG.' 2>'
                . $tempfile
                . ' --separate-output '
                . '--no-shadow --backtitle "Gentoo Linux USE flags editor '
@@ -449,7 +463,7 @@
 );
    close(FILE);
 
-   system('dialog --exit-label Back --no-shadow --title "What are USE flags?" '
+   system($DIALOG .' --exit-label Back --no-shadow --title "What are USE flags?" '
           . '--backtitle "Gentoo Linux USE flags editor '
           . $version
           . ' - Help" '


[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-04  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-03 21:42 [gentoo-dev] X Support for ufed (patch) Ned Ludd
2003-08-04  3:01 ` [gentoo-dev] " Fred Van Andel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox