[svn-commits] seanbright: trunk r381 - /trunk/menuselect_newt.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Nov 5 10:14:09 CST 2008


Author: seanbright
Date: Wed Sep 10 19:49:31 2008
New Revision: 381

URL: http://svn.digium.com/view/menuselect?view=rev&rev=381
Log:
Add an exit button for those folks having problems with the ESC key or the
function key bindings.

Modified:
    trunk/menuselect_newt.c

Modified: trunk/menuselect_newt.c
URL: http://svn.digium.com/view/menuselect/trunk/menuselect_newt.c?view=diff&rev=381&r1=380&r2=381
==============================================================================
--- trunk/menuselect_newt.c (original)
+++ trunk/menuselect_newt.c Wed Sep 10 19:49:31 2008
@@ -46,6 +46,8 @@
 static newtComponent dependsDataTextbox;
 static newtComponent usesDataTextbox;
 static newtComponent conflictsDataTextbox;
+
+static newtComponent exitButton;
 
 static void build_members_menu(int overlay);
 static void root_menu_callback(newtComponent component, void *data);
@@ -265,12 +267,12 @@
 
 	newtFormSetTimer(form, 200);
 
-	rootOptions = newtListbox(2, 1, y - 16, 0);
+	rootOptions = newtListbox(2, 1, y - 15, 0);
 	newtListboxSetWidth(rootOptions, 29);
 	newtFormAddComponent(form, rootOptions);
 	newtComponentAddCallback(rootOptions, root_menu_callback, NULL);
 
-	subOptions = newtListbox(33, 1, y - 16, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
+	subOptions = newtListbox(33, 1, y - 15, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
 	newtListboxSetWidth(subOptions, x - 42);
 	newtFormAddComponent(form, subOptions);
 	newtComponentAddCallback(subOptions, category_menu_callback, NULL);
@@ -282,6 +284,8 @@
 	dependsDataTextbox   = newtTextbox(18, y - 11, x - 27, 1, 0);
 	usesDataTextbox      = newtTextbox(18, y - 10, x - 27, 1, 0);
 	conflictsDataTextbox = newtTextbox(18, y - 9, x - 27, 1, 0);
+
+	exitButton = newtButton(x - 23, y - 11, "  Exit  ");
 
 	newtFormAddComponents(
 		form,
@@ -292,6 +296,7 @@
 		usesDataTextbox,
 		conflictsLabel,
 		conflictsDataTextbox,
+		exitButton,
 		NULL);
 
 	build_main_menu();
@@ -330,10 +335,25 @@
 				break;
 			}
 
-			if (done)
-				break;
+			if (done) {
+				break;
+			}
 		} else if (es.reason == NEWT_EXIT_COMPONENT) {
-			toggle_selected_option();
+			if (es.u.co == exitButton) {
+				int done = 1;
+
+				if (changes_made) {
+					done = run_confirmation_dialog(&res);
+				} else {
+					res = -1;
+				}
+
+				if (done) {
+					break;
+				}
+			} else if (es.u.co == subOptions) {
+				toggle_selected_option();
+			}
 		}
 	}
 




More information about the svn-commits mailing list