~ubuntu-branches/ubuntu/dapper/newt/dapper

« back to all changes in this revision

Viewing changes to debian/patches/60_defaultitem.patch

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2005-03-22 12:44:37 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050322124437-nuhl0pqjcijjno9z
Tags: 0.51.6-20ubuntu3
Add Xhosa translation (thanks, Adi Attar).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -ruN newt-0.51.6-old/dialogboxes.c newt-0.51.6/dialogboxes.c
 
2
--- newt-0.51.6-old/dialogboxes.c       2004-03-09 12:17:26.000000000 +0000
 
3
+++ newt-0.51.6/dialogboxes.c   2004-03-09 12:17:26.000000000 +0000
 
4
@@ -169,7 +169,7 @@
 
5
 }
 
6
 
 
7
 int listBox(const char * text, int height, int width, poptContext optCon,
 
8
-               int flags, const char ** result) {
 
9
+               int flags, const char *default_item, const char ** result) {
 
10
     newtComponent form, okay, tb, answer, listBox;
 
11
     newtComponent cancel = NULL;
 
12
     const char * arg;
 
13
@@ -182,6 +182,7 @@
 
14
     char buf[MAXBUF], format[MAXFOTMAT];
 
15
     int maxTagWidth = 0;
 
16
     int maxTextWidth = 0;
 
17
+    int defItem = -1;
 
18
     int scrollFlag;
 
19
     struct {
 
20
        const char * text;
 
21
@@ -201,6 +202,9 @@
 
22
        }
 
23
 
 
24
        itemInfo[numItems].tag = arg;
 
25
+       if (default_item && (strcmp(default_item, arg) == 0)) {
 
26
+               defItem = numItems;
 
27
+       }
 
28
        if (!(arg = poptGetArg(optCon))) return DLG_ERROR;
 
29
 
 
30
        if (!(flags & FLAG_NOITEM)) {
 
31
@@ -242,6 +246,9 @@
 
32
        newtListboxAddEntry(listBox, buf, (void *) i);
 
33
     }
 
34
 
 
35
+    if (defItem != -1)
 
36
+       newtListboxSetCurrent (listBox, defItem);
 
37
+
 
38
     newtFormAddComponents(form, tb, listBox, NULL);
 
39
 
 
40
     addButtons(height, width, form, &okay, &cancel, flags);
 
41
@@ -314,11 +321,6 @@
 
42
        numBoxes++;
 
43
     }
 
44
 
 
45
-       
 
46
-    if (flags & FLAG_NOTAGS) {
 
47
-           maxTagWidth = 0;
 
48
-    }
 
49
-
 
50
     form = newtForm(NULL, NULL, 0);
 
51
 
 
52
     tb = textbox(height - 3 - buttonHeight - listHeight, width - 2,
 
53
diff -ruN newt-0.51.6-old/dialogboxes.h newt-0.51.6/dialogboxes.h
 
54
--- newt-0.51.6-old/dialogboxes.h       2004-03-09 12:17:26.000000000 +0000
 
55
+++ newt-0.51.6/dialogboxes.h   2004-03-09 12:17:26.000000000 +0000
 
56
@@ -23,7 +23,7 @@
 
57
 int checkList(const char * text, int height, int width, poptContext optCon,
 
58
                int useRadio, int flags, const char *** selections);
 
59
 int listBox(const char * text, int height, int width, poptContext optCon,
 
60
-               int flags, const char ** result);
 
61
+               int flags, const char *default_item, const char ** result);
 
62
 int inputBox(const char * text, int height, int width, poptContext optCon, 
 
63
                int flags, const char ** result);
 
64
 int gauge(const char * text, int height, int width, poptContext optCon, int fd, 
 
65
diff -ruN newt-0.51.6-old/whiptail.c newt-0.51.6/whiptail.c
 
66
--- newt-0.51.6-old/whiptail.c  2004-03-09 12:17:26.000000000 +0000
 
67
+++ newt-0.51.6/whiptail.c      2004-03-09 12:17:26.000000000 +0000
 
68
@@ -84,6 +84,7 @@
 
69
     const char * result;
 
70
     const char ** selections, ** next;
 
71
     char * title = NULL;
 
72
+    char *default_item = NULL;
 
73
     char * backtitle = NULL;
 
74
     struct poptOption optionsTable[] = {
 
75
            { "backtitle", '\0', POPT_ARG_STRING, &backtitle, 0 },
 
76
@@ -99,6 +100,7 @@
 
77
            { "msgbox", '\0', 0, 0, OPT_MSGBOX },
 
78
            { "nocancel", '\0', 0, &noCancel, 0 },
 
79
            { "noitem", '\0', 0, &noItem, 0 },
 
80
+            { "default-item", '\0', POPT_ARG_STRING, &default_item, 0},
 
81
            { "notags", '\0', 0, &noTags, 0 },
 
82
            { "radiolist", '\0', 0, 0, OPT_RADIOLIST },
 
83
            { "scrolltext", '\0', 0, &scrollText, 0 },
 
84
@@ -250,7 +252,7 @@
 
85
        break;
 
86
 
 
87
       case MODE_MENU:
 
88
-       rc = listBox(text, height, width, optCon, flags, &result);
 
89
+       rc = listBox(text, height, width, optCon, flags, default_item, &result);
 
90
        if (rc == DLG_OKAY) fprintf(output, "%s", result);
 
91
        break;
 
92
 
 
93
diff -ruN newt-0.51.6-old/whiptcl.c newt-0.51.6/whiptcl.c
 
94
--- newt-0.51.6-old/whiptcl.c   2004-03-09 12:17:26.000000000 +0000
 
95
+++ newt-0.51.6/whiptcl.c       2004-03-09 12:17:26.000000000 +0000
 
96
@@ -74,6 +74,7 @@
 
97
     const char * result;
 
98
     const char ** selections, ** next;
 
99
     char * title = NULL;
 
100
+    char *default_item = NULL;
 
101
     struct poptOption optionsTable[] = {
 
102
            { "checklist", '\0', 0, 0, OPT_CHECKLIST },
 
103
            { "defaultno", '\0', 0, &defaultNo, 0 },
 
104
@@ -85,6 +86,7 @@
 
105
            { "radiolist", '\0', 0, 0, OPT_RADIOLIST },
 
106
            { "scrolltext", '\0', 0, &scrollText, 0 },
 
107
            { "title", '\0', POPT_ARG_STRING, &title, 0 },
 
108
+            { "default-item", '\0', POPT_ARG_STRING, &default_item, 0 },
 
109
            { "yesno", '\0', 0, 0, OPT_YESNO },
 
110
            { 0, 0, 0, 0, 0 } 
 
111
     };
 
112
@@ -207,7 +209,7 @@
 
113
        break;
 
114
 
 
115
       case MODE_MENU:
 
116
-       rc = listBox(text, height, width, optCon, flags, &result);
 
117
+       rc = listBox(text, height, width, optCon, flags, default_item, &result);
 
118
        if (rc==DLG_OKAY) {
 
119
            interp->result = strdup(result);
 
120
            interp->freeProc = TCL_DYNAMIC;