public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sven Eden" <sven.eden@gmx.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ufed:master commit in: /
Date: Tue, 10 Sep 2013 06:36:34 +0000 (UTC)	[thread overview]
Message-ID: <1378738518.b474c18106323db3d7dfe867c7598defe3f2ddd9.yamakuzure@gentoo> (raw)

commit:     b474c18106323db3d7dfe867c7598defe3f2ddd9
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Sep  9 14:55:18 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Sep  9 14:55:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b474c181

Added prefixing of predefined configuration values and added read-only-mode as the first in use. When read-only-mode is set, the interface now changes both header lines to other colors and to show the user that flags are not saved.

---
 ufed-curses-checklist.c | 18 ++++++++++++++++++
 ufed-curses-globals.c   |  2 ++
 ufed-curses-globals.h   |  2 ++
 ufed-curses.c           | 19 +++++++++++++++----
 ufed.pl.in              |  6 +++++-
 5 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 003fc9a..4a12968 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -51,6 +51,24 @@ static char *getline(FILE *fp)
 	if(fgets(lineBuf, size, fp) == NULL)
 		return NULL;
 	else {
+
+		/* See to configuration bytes if not read already */
+		if (!configDone) {
+			/* Byte 1: Whether read-only-mode is set or not */
+			if ( '0' != lineBuf[0] )
+				ro_mode = true;
+
+			configDone = true;
+
+			/* Remove the leading bytes transporting configuration values */
+			char *oldLine = lineBuf;
+			lineBuf = malloc(size);
+			if (NULL == lineBuf)
+				ERROR_EXIT(-1, "Can not allocate %lu bytes for line buffer\n", sizeof(char) * size);
+			memcpy(lineBuf, oldLine + 1, size - 1);
+			free(oldLine);
+		} /* End of having to read configuration bytes */
+
 		char *p = strchr(lineBuf, '\n');
 		if(p != NULL) {
 			*p = '\0';

diff --git a/ufed-curses-globals.c b/ufed-curses-globals.c
index ad9b66d..8c348d0 100644
--- a/ufed-curses-globals.c
+++ b/ufed-curses-globals.c
@@ -8,7 +8,9 @@
 #include "ufed-curses-types.h"
 
 int        bottomline     = 0;
+bool       configDone     = false;
 int        minwidth       = 0;
+int        ro_mode        = false;
 int        topline        = 0;
 eMask      e_mask         = eMask_unmasked;
 eOrder     e_order        = eOrder_left;

diff --git a/ufed-curses-globals.h b/ufed-curses-globals.h
index 514563e..54f2cf2 100644
--- a/ufed-curses-globals.h
+++ b/ufed-curses-globals.h
@@ -11,6 +11,7 @@
 #include "ufed-curses-types.h"
 
 extern int        bottomline;
+extern bool       configDone;
 extern eMask      e_mask;
 extern eOrder     e_order;
 extern eScope     e_scope;
@@ -18,6 +19,7 @@ extern eState     e_state;
 extern char*      fayt;
 extern sListStats listStats;
 extern int        minwidth;
+extern bool       ro_mode;
 extern int        topline;
 extern sWindow    window[wCount];
 

diff --git a/ufed-curses.c b/ufed-curses.c
index 1948f99..6870e66 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -339,8 +339,14 @@ void drawTop(bool withSep)
 	WINDOW* w = win(Top);
 	char buf[COLS + 1];
 
-	wattrset(w, COLOR_PAIR(1) | A_BOLD);
-	sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
+	if (ro_mode) {
+		wattrset(w, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
+		sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top),
+			"(RO) Gentoo USE flags editor " PACKAGE_VERSION " (RO)");
+	} else {
+		wattrset(w, COLOR_PAIR(1) | A_BOLD);
+		sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
+	}
 	mvwaddstr(w, 0, 0, buf);
 
 	/// REMOVEME: Stop wasting space
@@ -352,8 +358,13 @@ void drawTop(bool withSep)
 	mvwaddch(w, 1, wWidth(Top)-1, ACS_URCORNER);
 
 	waddch(w, ACS_VLINE);
-	wattrset(w, COLOR_PAIR(3));
-	sprintf(buf, " %-*.*s ", wWidth(Top)-4, wWidth(Top)-4, subtitle);
+	if (ro_mode) {
+		wattrset(w, COLOR_PAIR(4) | A_REVERSE);
+		sprintf(buf, " READ-ONLY MODE! %-*.*s READ-ONLY MODE! ", wWidth(Top)-36, wWidth(Top)-36, subtitle);
+	} else {
+		wattrset(w, COLOR_PAIR(3));
+		sprintf(buf, " %-*.*s ", wWidth(Top)-4, wWidth(Top)-4, subtitle);
+	}
 	waddstr(w, buf);
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	waddch(w, ACS_VLINE);

diff --git a/ufed.pl.in b/ufed.pl.in
index a922109..17ffd8e 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -119,7 +119,11 @@ sub flags_dialog {
 	# Now let the interface know of the result
 	if (open my $fh, '>&=', $iwrite) {
 		binmode( $fh, ":encoding(ISO-8859-1)" );
-		print $fh $outTxt;
+
+		# Fixed config:
+		# byte 1: Read only 0/1
+		# Rest: The flags configuration
+		print $fh "$Portage::ro_mode$outTxt";
 		close $fh;
 	} else {
 		die "Couldn't let interface know of flags\n";


             reply	other threads:[~2013-09-10  6:36 UTC|newest]

Thread overview: 238+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10  6:36 Sven Eden [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-11-07 14:25 [gentoo-commits] proj/ufed:master commit in: / Sven Eden
2020-05-02  8:38 Ulrich Müller
2019-09-27  6:42 Sven Eden
2019-09-27  6:39 Sven Eden
2019-09-24 17:57 Sven Eden
2019-09-24 17:56 Sven Eden
2019-04-07 15:17 David Seifert
2019-04-07 13:56 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2015-02-12 15:47 Sven Eden
2015-02-11  9:03 Sven Eden
2014-11-10  9:59 Sven Eden
2014-10-28 11:43 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-11  7:09 Sven Eden
2013-09-11  6:31 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-10 12:37 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-07-22  9:34 Sven Eden
2013-07-22  6:09 Sven Eden
2013-07-22  6:09 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-08  7:18 Sven Eden
2013-04-03 13:39 Sven Eden
2013-03-05 16:53 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-02-21 10:02 Sven Eden
2013-02-19 15:16 Sven Eden
2013-02-19 13:34 Sven Eden
2013-02-18  7:22 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-06  9:09 Sven Eden
2013-02-06  9:09 Sven Eden
2013-02-05 18:06 Paul Varner
2013-02-05 13:53 Sven Eden
2013-02-05 13:53 Sven Eden
2013-02-05 11:24 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-02 20:49 Sven Eden
2013-02-02 10:11 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 16:04 Sven Eden
2013-02-01 15:55 Sven Eden
2013-02-01 15:26 Sven Eden
2013-02-01 14:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-23 14:44 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-16 13:43 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-08 11:02 Sven Eden
2013-01-02  8:47 Sven Eden
2013-01-02  8:01 Sven Eden
2013-01-02  8:01 Sven Eden
2012-11-20 17:31 Paul Varner
2012-11-20 17:25 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:01 Paul Varner
2012-10-22 20:42 Paul Varner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378738518.b474c18106323db3d7dfe867c7598defe3f2ddd9.yamakuzure@gentoo \
    --to=sven.eden@gmx.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox