| File COPYING added (mode: 100644) (index 0000000..a43ea21) |
|
1 |
|
GNU GENERAL PUBLIC LICENSE |
|
2 |
|
Version 2, June 1991 |
|
3 |
|
|
|
4 |
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
|
5 |
|
675 Mass Ave, Cambridge, MA 02139, USA |
|
6 |
|
Everyone is permitted to copy and distribute verbatim copies |
|
7 |
|
of this license document, but changing it is not allowed. |
|
8 |
|
|
|
9 |
|
Preamble |
|
10 |
|
|
|
11 |
|
The licenses for most software are designed to take away your |
|
12 |
|
freedom to share and change it. By contrast, the GNU General Public |
|
13 |
|
License is intended to guarantee your freedom to share and change free |
|
14 |
|
software--to make sure the software is free for all its users. This |
|
15 |
|
General Public License applies to most of the Free Software |
|
16 |
|
Foundation's software and to any other program whose authors commit to |
|
17 |
|
using it. (Some other Free Software Foundation software is covered by |
|
18 |
|
the GNU Library General Public License instead.) You can apply it to |
|
19 |
|
your programs, too. |
|
20 |
|
|
|
21 |
|
When we speak of free software, we are referring to freedom, not |
|
22 |
|
price. Our General Public Licenses are designed to make sure that you |
|
23 |
|
have the freedom to distribute copies of free software (and charge for |
|
24 |
|
this service if you wish), that you receive source code or can get it |
|
25 |
|
if you want it, that you can change the software or use pieces of it |
|
26 |
|
in new free programs; and that you know you can do these things. |
|
27 |
|
|
|
28 |
|
To protect your rights, we need to make restrictions that forbid |
|
29 |
|
anyone to deny you these rights or to ask you to surrender the rights. |
|
30 |
|
These restrictions translate to certain responsibilities for you if you |
|
31 |
|
distribute copies of the software, or if you modify it. |
|
32 |
|
|
|
33 |
|
For example, if you distribute copies of such a program, whether |
|
34 |
|
gratis or for a fee, you must give the recipients all the rights that |
|
35 |
|
you have. You must make sure that they, too, receive or can get the |
|
36 |
|
source code. And you must show them these terms so they know their |
|
37 |
|
rights. |
|
38 |
|
|
|
39 |
|
We protect your rights with two steps: (1) copyright the software, and |
|
40 |
|
(2) offer you this license which gives you legal permission to copy, |
|
41 |
|
distribute and/or modify the software. |
|
42 |
|
|
|
43 |
|
Also, for each author's protection and ours, we want to make certain |
|
44 |
|
that everyone understands that there is no warranty for this free |
|
45 |
|
software. If the software is modified by someone else and passed on, we |
|
46 |
|
want its recipients to know that what they have is not the original, so |
|
47 |
|
that any problems introduced by others will not reflect on the original |
|
48 |
|
authors' reputations. |
|
49 |
|
|
|
50 |
|
Finally, any free program is threatened constantly by software |
|
51 |
|
patents. We wish to avoid the danger that redistributors of a free |
|
52 |
|
program will individually obtain patent licenses, in effect making the |
|
53 |
|
program proprietary. To prevent this, we have made it clear that any |
|
54 |
|
patent must be licensed for everyone's free use or not licensed at all. |
|
55 |
|
|
|
56 |
|
The precise terms and conditions for copying, distribution and |
|
57 |
|
modification follow. |
|
58 |
|
|
|
59 |
|
GNU GENERAL PUBLIC LICENSE |
|
60 |
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
|
61 |
|
|
|
62 |
|
0. This License applies to any program or other work which contains |
|
63 |
|
a notice placed by the copyright holder saying it may be distributed |
|
64 |
|
under the terms of this General Public License. The "Program", below, |
|
65 |
|
refers to any such program or work, and a "work based on the Program" |
|
66 |
|
means either the Program or any derivative work under copyright law: |
|
67 |
|
that is to say, a work containing the Program or a portion of it, |
|
68 |
|
either verbatim or with modifications and/or translated into another |
|
69 |
|
language. (Hereinafter, translation is included without limitation in |
|
70 |
|
the term "modification".) Each licensee is addressed as "you". |
|
71 |
|
|
|
72 |
|
Activities other than copying, distribution and modification are not |
|
73 |
|
covered by this License; they are outside its scope. The act of |
|
74 |
|
running the Program is not restricted, and the output from the Program |
|
75 |
|
is covered only if its contents constitute a work based on the |
|
76 |
|
Program (independent of having been made by running the Program). |
|
77 |
|
Whether that is true depends on what the Program does. |
|
78 |
|
|
|
79 |
|
1. You may copy and distribute verbatim copies of the Program's |
|
80 |
|
source code as you receive it, in any medium, provided that you |
|
81 |
|
conspicuously and appropriately publish on each copy an appropriate |
|
82 |
|
copyright notice and disclaimer of warranty; keep intact all the |
|
83 |
|
notices that refer to this License and to the absence of any warranty; |
|
84 |
|
and give any other recipients of the Program a copy of this License |
|
85 |
|
along with the Program. |
|
86 |
|
|
|
87 |
|
You may charge a fee for the physical act of transferring a copy, and |
|
88 |
|
you may at your option offer warranty protection in exchange for a fee. |
|
89 |
|
|
|
90 |
|
2. You may modify your copy or copies of the Program or any portion |
|
91 |
|
of it, thus forming a work based on the Program, and copy and |
|
92 |
|
distribute such modifications or work under the terms of Section 1 |
|
93 |
|
above, provided that you also meet all of these conditions: |
|
94 |
|
|
|
95 |
|
a) You must cause the modified files to carry prominent notices |
|
96 |
|
stating that you changed the files and the date of any change. |
|
97 |
|
|
|
98 |
|
b) You must cause any work that you distribute or publish, that in |
|
99 |
|
whole or in part contains or is derived from the Program or any |
|
100 |
|
part thereof, to be licensed as a whole at no charge to all third |
|
101 |
|
parties under the terms of this License. |
|
102 |
|
|
|
103 |
|
c) If the modified program normally reads commands interactively |
|
104 |
|
when run, you must cause it, when started running for such |
|
105 |
|
interactive use in the most ordinary way, to print or display an |
|
106 |
|
announcement including an appropriate copyright notice and a |
|
107 |
|
notice that there is no warranty (or else, saying that you provide |
|
108 |
|
a warranty) and that users may redistribute the program under |
|
109 |
|
these conditions, and telling the user how to view a copy of this |
|
110 |
|
License. (Exception: if the Program itself is interactive but |
|
111 |
|
does not normally print such an announcement, your work based on |
|
112 |
|
the Program is not required to print an announcement.) |
|
113 |
|
|
|
114 |
|
These requirements apply to the modified work as a whole. If |
|
115 |
|
identifiable sections of that work are not derived from the Program, |
|
116 |
|
and can be reasonably considered independent and separate works in |
|
117 |
|
themselves, then this License, and its terms, do not apply to those |
|
118 |
|
sections when you distribute them as separate works. But when you |
|
119 |
|
distribute the same sections as part of a whole which is a work based |
|
120 |
|
on the Program, the distribution of the whole must be on the terms of |
|
121 |
|
this License, whose permissions for other licensees extend to the |
|
122 |
|
entire whole, and thus to each and every part regardless of who wrote it. |
|
123 |
|
|
|
124 |
|
Thus, it is not the intent of this section to claim rights or contest |
|
125 |
|
your rights to work written entirely by you; rather, the intent is to |
|
126 |
|
exercise the right to control the distribution of derivative or |
|
127 |
|
collective works based on the Program. |
|
128 |
|
|
|
129 |
|
In addition, mere aggregation of another work not based on the Program |
|
130 |
|
with the Program (or with a work based on the Program) on a volume of |
|
131 |
|
a storage or distribution medium does not bring the other work under |
|
132 |
|
the scope of this License. |
|
133 |
|
|
|
134 |
|
3. You may copy and distribute the Program (or a work based on it, |
|
135 |
|
under Section 2) in object code or executable form under the terms of |
|
136 |
|
Sections 1 and 2 above provided that you also do one of the following: |
|
137 |
|
|
|
138 |
|
a) Accompany it with the complete corresponding machine-readable |
|
139 |
|
source code, which must be distributed under the terms of Sections |
|
140 |
|
1 and 2 above on a medium customarily used for software interchange; or, |
|
141 |
|
|
|
142 |
|
b) Accompany it with a written offer, valid for at least three |
|
143 |
|
years, to give any third party, for a charge no more than your |
|
144 |
|
cost of physically performing source distribution, a complete |
|
145 |
|
machine-readable copy of the corresponding source code, to be |
|
146 |
|
distributed under the terms of Sections 1 and 2 above on a medium |
|
147 |
|
customarily used for software interchange; or, |
|
148 |
|
|
|
149 |
|
c) Accompany it with the information you received as to the offer |
|
150 |
|
to distribute corresponding source code. (This alternative is |
|
151 |
|
allowed only for noncommercial distribution and only if you |
|
152 |
|
received the program in object code or executable form with such |
|
153 |
|
an offer, in accord with Subsection b above.) |
|
154 |
|
|
|
155 |
|
The source code for a work means the preferred form of the work for |
|
156 |
|
making modifications to it. For an executable work, complete source |
|
157 |
|
code means all the source code for all modules it contains, plus any |
|
158 |
|
associated interface definition files, plus the scripts used to |
|
159 |
|
control compilation and installation of the executable. However, as a |
|
160 |
|
special exception, the source code distributed need not include |
|
161 |
|
anything that is normally distributed (in either source or binary |
|
162 |
|
form) with the major components (compiler, kernel, and so on) of the |
|
163 |
|
operating system on which the executable runs, unless that component |
|
164 |
|
itself accompanies the executable. |
|
165 |
|
|
|
166 |
|
If distribution of executable or object code is made by offering |
|
167 |
|
access to copy from a designated place, then offering equivalent |
|
168 |
|
access to copy the source code from the same place counts as |
|
169 |
|
distribution of the source code, even though third parties are not |
|
170 |
|
compelled to copy the source along with the object code. |
|
171 |
|
|
|
172 |
|
4. You may not copy, modify, sublicense, or distribute the Program |
|
173 |
|
except as expressly provided under this License. Any attempt |
|
174 |
|
otherwise to copy, modify, sublicense or distribute the Program is |
|
175 |
|
void, and will automatically terminate your rights under this License. |
|
176 |
|
However, parties who have received copies, or rights, from you under |
|
177 |
|
this License will not have their licenses terminated so long as such |
|
178 |
|
parties remain in full compliance. |
|
179 |
|
|
|
180 |
|
5. You are not required to accept this License, since you have not |
|
181 |
|
signed it. However, nothing else grants you permission to modify or |
|
182 |
|
distribute the Program or its derivative works. These actions are |
|
183 |
|
prohibited by law if you do not accept this License. Therefore, by |
|
184 |
|
modifying or distributing the Program (or any work based on the |
|
185 |
|
Program), you indicate your acceptance of this License to do so, and |
|
186 |
|
all its terms and conditions for copying, distributing or modifying |
|
187 |
|
the Program or works based on it. |
|
188 |
|
|
|
189 |
|
6. Each time you redistribute the Program (or any work based on the |
|
190 |
|
Program), the recipient automatically receives a license from the |
|
191 |
|
original licensor to copy, distribute or modify the Program subject to |
|
192 |
|
these terms and conditions. You may not impose any further |
|
193 |
|
restrictions on the recipients' exercise of the rights granted herein. |
|
194 |
|
You are not responsible for enforcing compliance by third parties to |
|
195 |
|
this License. |
|
196 |
|
|
|
197 |
|
7. If, as a consequence of a court judgment or allegation of patent |
|
198 |
|
infringement or for any other reason (not limited to patent issues), |
|
199 |
|
conditions are imposed on you (whether by court order, agreement or |
|
200 |
|
otherwise) that contradict the conditions of this License, they do not |
|
201 |
|
excuse you from the conditions of this License. If you cannot |
|
202 |
|
distribute so as to satisfy simultaneously your obligations under this |
|
203 |
|
License and any other pertinent obligations, then as a consequence you |
|
204 |
|
may not distribute the Program at all. For example, if a patent |
|
205 |
|
license would not permit royalty-free redistribution of the Program by |
|
206 |
|
all those who receive copies directly or indirectly through you, then |
|
207 |
|
the only way you could satisfy both it and this License would be to |
|
208 |
|
refrain entirely from distribution of the Program. |
|
209 |
|
|
|
210 |
|
If any portion of this section is held invalid or unenforceable under |
|
211 |
|
any particular circumstance, the balance of the section is intended to |
|
212 |
|
apply and the section as a whole is intended to apply in other |
|
213 |
|
circumstances. |
|
214 |
|
|
|
215 |
|
It is not the purpose of this section to induce you to infringe any |
|
216 |
|
patents or other property right claims or to contest validity of any |
|
217 |
|
such claims; this section has the sole purpose of protecting the |
|
218 |
|
integrity of the free software distribution system, which is |
|
219 |
|
implemented by public license practices. Many people have made |
|
220 |
|
generous contributions to the wide range of software distributed |
|
221 |
|
through that system in reliance on consistent application of that |
|
222 |
|
system; it is up to the author/donor to decide if he or she is willing |
|
223 |
|
to distribute software through any other system and a licensee cannot |
|
224 |
|
impose that choice. |
|
225 |
|
|
|
226 |
|
This section is intended to make thoroughly clear what is believed to |
|
227 |
|
be a consequence of the rest of this License. |
|
228 |
|
|
|
229 |
|
8. If the distribution and/or use of the Program is restricted in |
|
230 |
|
certain countries either by patents or by copyrighted interfaces, the |
|
231 |
|
original copyright holder who places the Program under this License |
|
232 |
|
may add an explicit geographical distribution limitation excluding |
|
233 |
|
those countries, so that distribution is permitted only in or among |
|
234 |
|
countries not thus excluded. In such case, this License incorporates |
|
235 |
|
the limitation as if written in the body of this License. |
|
236 |
|
|
|
237 |
|
9. The Free Software Foundation may publish revised and/or new versions |
|
238 |
|
of the General Public License from time to time. Such new versions will |
|
239 |
|
be similar in spirit to the present version, but may differ in detail to |
|
240 |
|
address new problems or concerns. |
|
241 |
|
|
|
242 |
|
Each version is given a distinguishing version number. If the Program |
|
243 |
|
specifies a version number of this License which applies to it and "any |
|
244 |
|
later version", you have the option of following the terms and conditions |
|
245 |
|
either of that version or of any later version published by the Free |
|
246 |
|
Software Foundation. If the Program does not specify a version number of |
|
247 |
|
this License, you may choose any version ever published by the Free Software |
|
248 |
|
Foundation. |
|
249 |
|
|
|
250 |
|
10. If you wish to incorporate parts of the Program into other free |
|
251 |
|
programs whose distribution conditions are different, write to the author |
|
252 |
|
to ask for permission. For software which is copyrighted by the Free |
|
253 |
|
Software Foundation, write to the Free Software Foundation; we sometimes |
|
254 |
|
make exceptions for this. Our decision will be guided by the two goals |
|
255 |
|
of preserving the free status of all derivatives of our free software and |
|
256 |
|
of promoting the sharing and reuse of software generally. |
|
257 |
|
|
|
258 |
|
NO WARRANTY |
|
259 |
|
|
|
260 |
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
|
261 |
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
|
262 |
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
|
263 |
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
|
264 |
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
265 |
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
|
266 |
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
|
267 |
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
|
268 |
|
REPAIR OR CORRECTION. |
|
269 |
|
|
|
270 |
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
271 |
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
|
272 |
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
|
273 |
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
|
274 |
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
|
275 |
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
|
276 |
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
|
277 |
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
|
278 |
|
POSSIBILITY OF SUCH DAMAGES. |
|
279 |
|
|
|
280 |
|
END OF TERMS AND CONDITIONS |
|
281 |
|
|
|
282 |
|
Appendix: How to Apply These Terms to Your New Programs |
|
283 |
|
|
|
284 |
|
If you develop a new program, and you want it to be of the greatest |
|
285 |
|
possible use to the public, the best way to achieve this is to make it |
|
286 |
|
free software which everyone can redistribute and change under these terms. |
|
287 |
|
|
|
288 |
|
To do so, attach the following notices to the program. It is safest |
|
289 |
|
to attach them to the start of each source file to most effectively |
|
290 |
|
convey the exclusion of warranty; and each file should have at least |
|
291 |
|
the "copyright" line and a pointer to where the full notice is found. |
|
292 |
|
|
|
293 |
|
<one line to give the program's name and a brief idea of what it does.> |
|
294 |
|
Copyright (C) 19yy <name of author> |
|
295 |
|
|
|
296 |
|
This program is free software; you can redistribute it and/or modify |
|
297 |
|
it under the terms of the GNU General Public License as published by |
|
298 |
|
the Free Software Foundation; either version 2 of the License, or |
|
299 |
|
(at your option) any later version. |
|
300 |
|
|
|
301 |
|
This program is distributed in the hope that it will be useful, |
|
302 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
303 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
304 |
|
GNU General Public License for more details. |
|
305 |
|
|
|
306 |
|
You should have received a copy of the GNU General Public License |
|
307 |
|
along with this program; if not, write to the Free Software |
|
308 |
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
309 |
|
|
|
310 |
|
Also add information on how to contact you by electronic and paper mail. |
|
311 |
|
|
|
312 |
|
If the program is interactive, make it output a short notice like this |
|
313 |
|
when it starts in an interactive mode: |
|
314 |
|
|
|
315 |
|
Gnomovision version 69, Copyright (C) 19yy name of author |
|
316 |
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
317 |
|
This is free software, and you are welcome to redistribute it |
|
318 |
|
under certain conditions; type `show c' for details. |
|
319 |
|
|
|
320 |
|
The hypothetical commands `show w' and `show c' should show the appropriate |
|
321 |
|
parts of the General Public License. Of course, the commands you use may |
|
322 |
|
be called something other than `show w' and `show c'; they could even be |
|
323 |
|
mouse-clicks or menu items--whatever suits your program. |
|
324 |
|
|
|
325 |
|
You should also get your employer (if you work as a programmer) or your |
|
326 |
|
school, if any, to sign a "copyright disclaimer" for the program, if |
|
327 |
|
necessary. Here is a sample; alter the names: |
|
328 |
|
|
|
329 |
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
|
330 |
|
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
|
331 |
|
|
|
332 |
|
<signature of Ty Coon>, 1 April 1989 |
|
333 |
|
Ty Coon, President of Vice |
|
334 |
|
|
|
335 |
|
This General Public License does not permit incorporating your program into |
|
336 |
|
proprietary programs. If your program is a subroutine library, you may |
|
337 |
|
consider it more useful to permit linking proprietary applications with the |
|
338 |
|
library. If this is what you want to do, use the GNU Library General |
|
339 |
|
Public License instead of this License. |
| File aclocal.m4 added (mode: 100644) (index 0000000..11a96d1) |
|
1 |
|
dnl aclocal.m4 generated automatically by aclocal 1.4a |
|
2 |
|
|
|
3 |
|
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
|
4 |
|
dnl This file is free software; the Free Software Foundation |
|
5 |
|
dnl gives unlimited permission to copy and/or distribute it, |
|
6 |
|
dnl with or without modifications, as long as this notice is preserved. |
|
7 |
|
|
|
8 |
|
dnl This program is distributed in the hope that it will be useful, |
|
9 |
|
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
|
10 |
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
11 |
|
dnl PARTICULAR PURPOSE. |
|
12 |
|
|
|
13 |
|
# Do all the work for Automake. This macro actually does too much -- |
|
14 |
|
# some checks are only needed if your package does certain things. |
|
15 |
|
# But this isn't really a big deal. |
|
16 |
|
|
|
17 |
|
# serial 1 |
|
18 |
|
|
|
19 |
|
dnl Usage: |
|
20 |
|
dnl AM_INIT_AUTOMAKE(package,version, [no-define]) |
|
21 |
|
|
|
22 |
|
AC_DEFUN(AM_INIT_AUTOMAKE, |
|
23 |
|
[AC_REQUIRE([AC_PROG_INSTALL]) |
|
24 |
|
dnl We require 2.13 because we rely on SHELL being computed by configure. |
|
25 |
|
AC_PREREQ([2.13]) |
|
26 |
|
PACKAGE=[$1] |
|
27 |
|
AC_SUBST(PACKAGE) |
|
28 |
|
VERSION=[$2] |
|
29 |
|
AC_SUBST(VERSION) |
|
30 |
|
dnl test to see if srcdir already configured |
|
31 |
|
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
|
32 |
|
AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) |
|
33 |
|
fi |
|
34 |
|
ifelse([$3],, |
|
35 |
|
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) |
|
36 |
|
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) |
|
37 |
|
AC_REQUIRE([AM_SANITY_CHECK]) |
|
38 |
|
AC_REQUIRE([AC_ARG_PROGRAM]) |
|
39 |
|
dnl FIXME This is truly gross. |
|
40 |
|
missing_dir=`cd $ac_aux_dir && pwd` |
|
41 |
|
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) |
|
42 |
|
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) |
|
43 |
|
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) |
|
44 |
|
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) |
|
45 |
|
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) |
|
46 |
|
AC_REQUIRE([AC_PROG_MAKE_SET])]) |
|
47 |
|
|
|
48 |
|
# |
|
49 |
|
# Check to make sure that the build environment is sane. |
|
50 |
|
# |
|
51 |
|
|
|
52 |
|
AC_DEFUN(AM_SANITY_CHECK, |
|
53 |
|
[AC_MSG_CHECKING([whether build environment is sane]) |
|
54 |
|
# Just in case |
|
55 |
|
sleep 1 |
|
56 |
|
echo timestamp > conftestfile |
|
57 |
|
# Do `set' in a subshell so we don't clobber the current shell's |
|
58 |
|
# arguments. Must try -L first in case configure is actually a |
|
59 |
|
# symlink; some systems play weird games with the mod time of symlinks |
|
60 |
|
# (eg FreeBSD returns the mod time of the symlink's containing |
|
61 |
|
# directory). |
|
62 |
|
if ( |
|
63 |
|
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` |
|
64 |
|
if test "[$]*" = "X"; then |
|
65 |
|
# -L didn't work. |
|
66 |
|
set X `ls -t $srcdir/configure conftestfile` |
|
67 |
|
fi |
|
68 |
|
if test "[$]*" != "X $srcdir/configure conftestfile" \ |
|
69 |
|
&& test "[$]*" != "X conftestfile $srcdir/configure"; then |
|
70 |
|
|
|
71 |
|
# If neither matched, then we have a broken ls. This can happen |
|
72 |
|
# if, for instance, CONFIG_SHELL is bash and it inherits a |
|
73 |
|
# broken ls alias from the environment. This has actually |
|
74 |
|
# happened. Such a system could not be considered "sane". |
|
75 |
|
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken |
|
76 |
|
alias in your environment]) |
|
77 |
|
fi |
|
78 |
|
|
|
79 |
|
test "[$]2" = conftestfile |
|
80 |
|
) |
|
81 |
|
then |
|
82 |
|
# Ok. |
|
83 |
|
: |
|
84 |
|
else |
|
85 |
|
AC_MSG_ERROR([newly created file is older than distributed files! |
|
86 |
|
Check your system clock]) |
|
87 |
|
fi |
|
88 |
|
rm -f conftest* |
|
89 |
|
AC_MSG_RESULT(yes)]) |
|
90 |
|
|
|
91 |
|
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) |
|
92 |
|
dnl The program must properly implement --version. |
|
93 |
|
AC_DEFUN(AM_MISSING_PROG, |
|
94 |
|
[AC_MSG_CHECKING(for working $2) |
|
95 |
|
# Run test in a subshell; some versions of sh will print an error if |
|
96 |
|
# an executable is not found, even if stderr is redirected. |
|
97 |
|
# Redirect stdin to placate older versions of autoconf. Sigh. |
|
98 |
|
if ($2 --version) < /dev/null > /dev/null 2>&1; then |
|
99 |
|
$1=$2 |
|
100 |
|
AC_MSG_RESULT(found) |
|
101 |
|
else |
|
102 |
|
$1="$3/missing $2" |
|
103 |
|
AC_MSG_RESULT(missing) |
|
104 |
|
fi |
|
105 |
|
AC_SUBST($1)]) |
|
106 |
|
|
|
107 |
|
# Like AC_CONFIG_HEADER, but automatically create stamp file. |
|
108 |
|
|
|
109 |
|
AC_DEFUN(AM_CONFIG_HEADER, |
|
110 |
|
[AC_PREREQ([2.12]) |
|
111 |
|
AC_CONFIG_HEADER([$1]) |
|
112 |
|
dnl When config.status generates a header, we must update the stamp-h file. |
|
113 |
|
dnl This file resides in the same directory as the config header |
|
114 |
|
dnl that is generated. We must strip everything past the first ":", |
|
115 |
|
dnl and everything past the last "/". |
|
116 |
|
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl |
|
117 |
|
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, |
|
118 |
|
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, |
|
119 |
|
<<am_indx=1 |
|
120 |
|
for am_file in <<$1>>; do |
|
121 |
|
case " <<$>>CONFIG_HEADERS " in |
|
122 |
|
*" <<$>>am_file "*<<)>> |
|
123 |
|
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx |
|
124 |
|
;; |
|
125 |
|
esac |
|
126 |
|
am_indx=`expr "<<$>>am_indx" + 1` |
|
127 |
|
done<<>>dnl>>) |
|
128 |
|
changequote([,]))]) |
|
129 |
|
|
|
130 |
|
# aclocal-include.m4 |
|
131 |
|
# |
|
132 |
|
# This macro adds the name macrodir to the set of directories |
|
133 |
|
# that `aclocal' searches for macros. |
|
134 |
|
|
|
135 |
|
# serial 1 |
|
136 |
|
|
|
137 |
|
dnl AM_ACLOCAL_INCLUDE(macrodir) |
|
138 |
|
AC_DEFUN([AM_ACLOCAL_INCLUDE], |
|
139 |
|
[ |
|
140 |
|
AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y) |
|
141 |
|
|
|
142 |
|
test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" |
|
143 |
|
|
|
144 |
|
for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done |
|
145 |
|
]) |
|
146 |
|
|
|
147 |
|
# Define a conditional. |
|
148 |
|
|
|
149 |
|
AC_DEFUN(AM_CONDITIONAL, |
|
150 |
|
[AC_SUBST($1_TRUE) |
|
151 |
|
AC_SUBST($1_FALSE) |
|
152 |
|
if $2; then |
|
153 |
|
$1_TRUE= |
|
154 |
|
$1_FALSE='#' |
|
155 |
|
else |
|
156 |
|
$1_TRUE='#' |
|
157 |
|
$1_FALSE= |
|
158 |
|
fi]) |
|
159 |
|
|
|
160 |
|
dnl |
|
161 |
|
dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits]) |
|
162 |
|
dnl |
|
163 |
|
dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh |
|
164 |
|
dnl is not found. |
|
165 |
|
dnl |
|
166 |
|
|
|
167 |
|
AC_DEFUN([GNOME_INIT_HOOK],[ |
|
168 |
|
AC_SUBST(GNOME_LIBS) |
|
169 |
|
AC_SUBST(GNOMEUI_LIBS) |
|
170 |
|
AC_SUBST(GNOMEGNORBA_LIBS) |
|
171 |
|
AC_SUBST(GTKXMHTML_LIBS) |
|
172 |
|
AC_SUBST(ZVT_LIBS) |
|
173 |
|
AC_SUBST(GNOME_LIBDIR) |
|
174 |
|
AC_SUBST(GNOME_INCLUDEDIR) |
|
175 |
|
|
|
176 |
|
AC_ARG_WITH(gnome-includes, |
|
177 |
|
[ --with-gnome-includes Specify location of GNOME headers],[ |
|
178 |
|
CFLAGS="$CFLAGS -I$withval" |
|
179 |
|
]) |
|
180 |
|
|
|
181 |
|
AC_ARG_WITH(gnome-libs, |
|
182 |
|
[ --with-gnome-libs Specify location of GNOME libs],[ |
|
183 |
|
LDFLAGS="$LDFLAGS -L$withval" |
|
184 |
|
gnome_prefix=$withval |
|
185 |
|
]) |
|
186 |
|
|
|
187 |
|
AC_ARG_WITH(gnome, |
|
188 |
|
[ --with-gnome Specify prefix for GNOME files], |
|
189 |
|
if test x$withval = xyes; then |
|
190 |
|
want_gnome=yes |
|
191 |
|
dnl Note that an empty true branch is not |
|
192 |
|
dnl valid sh syntax. |
|
193 |
|
ifelse([$1], [], :, [$1]) |
|
194 |
|
else |
|
195 |
|
if test "x$withval" = xno; then |
|
196 |
|
want_gnome=no |
|
197 |
|
else |
|
198 |
|
want_gnome=yes |
|
199 |
|
LDFLAGS="$LDFLAGS -L$withval/lib" |
|
200 |
|
CFLAGS="$CFLAGS -I$withval/include" |
|
201 |
|
gnome_prefix=$withval/lib |
|
202 |
|
fi |
|
203 |
|
fi, |
|
204 |
|
want_gnome=yes) |
|
205 |
|
|
|
206 |
|
if test "x$want_gnome" = xyes; then |
|
207 |
|
|
|
208 |
|
AC_PATH_PROG(GNOME_CONFIG,gnome-config,no) |
|
209 |
|
if test "$GNOME_CONFIG" = "no"; then |
|
210 |
|
no_gnome_config="yes" |
|
211 |
|
else |
|
212 |
|
AC_MSG_CHECKING(if $GNOME_CONFIG works) |
|
213 |
|
if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then |
|
214 |
|
AC_MSG_RESULT(yes) |
|
215 |
|
GNOME_GNORBA_HOOK([],$2) |
|
216 |
|
GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" |
|
217 |
|
GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" |
|
218 |
|
GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" |
|
219 |
|
GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" |
|
220 |
|
ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" |
|
221 |
|
GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" |
|
222 |
|
GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" |
|
223 |
|
$1 |
|
224 |
|
else |
|
225 |
|
AC_MSG_RESULT(no) |
|
226 |
|
no_gnome_config="yes" |
|
227 |
|
fi |
|
228 |
|
fi |
|
229 |
|
|
|
230 |
|
if test x$exec_prefix = xNONE; then |
|
231 |
|
if test x$prefix = xNONE; then |
|
232 |
|
gnome_prefix=$ac_default_prefix/lib |
|
233 |
|
else |
|
234 |
|
gnome_prefix=$prefix/lib |
|
235 |
|
fi |
|
236 |
|
else |
|
237 |
|
gnome_prefix=`eval echo \`echo $libdir\`` |
|
238 |
|
fi |
|
239 |
|
|
|
240 |
|
if test "$no_gnome_config" = "yes"; then |
|
241 |
|
AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix) |
|
242 |
|
if test -f $gnome_prefix/gnomeConf.sh; then |
|
243 |
|
AC_MSG_RESULT(found) |
|
244 |
|
echo "loading gnome configuration from" \ |
|
245 |
|
"$gnome_prefix/gnomeConf.sh" |
|
246 |
|
. $gnome_prefix/gnomeConf.sh |
|
247 |
|
$1 |
|
248 |
|
else |
|
249 |
|
AC_MSG_RESULT(not found) |
|
250 |
|
if test x$2 = xfail; then |
|
251 |
|
AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install) |
|
252 |
|
fi |
|
253 |
|
fi |
|
254 |
|
fi |
|
255 |
|
fi |
|
256 |
|
|
|
257 |
|
if test -n "$3"; then |
|
258 |
|
n="$3" |
|
259 |
|
for i in $n; do |
|
260 |
|
AC_MSG_CHECKING(extra library \"$i\") |
|
261 |
|
case $i in |
|
262 |
|
applets) |
|
263 |
|
AC_SUBST(GNOME_APPLETS_LIBS) |
|
264 |
|
GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` |
|
265 |
|
AC_MSG_RESULT($GNOME_APPLETS_LIBS);; |
|
266 |
|
docklets) |
|
267 |
|
AC_SUBST(GNOME_DOCKLETS_LIBS) |
|
268 |
|
GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` |
|
269 |
|
AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);; |
|
270 |
|
capplet) |
|
271 |
|
AC_SUBST(GNOME_CAPPLET_LIBS) |
|
272 |
|
GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` |
|
273 |
|
AC_MSG_RESULT($GNOME_CAPPLET_LIBS);; |
|
274 |
|
*) |
|
275 |
|
AC_MSG_RESULT(unknown library) |
|
276 |
|
esac |
|
277 |
|
done |
|
278 |
|
fi |
|
279 |
|
]) |
|
280 |
|
|
|
281 |
|
dnl |
|
282 |
|
dnl GNOME_INIT ([additional-inits]) |
|
283 |
|
dnl |
|
284 |
|
|
|
285 |
|
AC_DEFUN([GNOME_INIT],[ |
|
286 |
|
GNOME_INIT_HOOK([],fail,$1) |
|
287 |
|
]) |
|
288 |
|
|
|
289 |
|
dnl |
|
290 |
|
dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag) |
|
291 |
|
dnl |
|
292 |
|
dnl if failflag is "failure" it aborts if gnorba is not found. |
|
293 |
|
dnl |
|
294 |
|
|
|
295 |
|
AC_DEFUN([GNOME_GNORBA_HOOK],[ |
|
296 |
|
GNOME_ORBIT_HOOK([],$2) |
|
297 |
|
AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[ |
|
298 |
|
gnome_cv_gnorba_found=no |
|
299 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
300 |
|
GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" |
|
301 |
|
GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" |
|
302 |
|
if test -n "$GNORBA_LIBS"; then |
|
303 |
|
gnome_cv_gnorba_found=yes |
|
304 |
|
fi |
|
305 |
|
fi |
|
306 |
|
]) |
|
307 |
|
AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes) |
|
308 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
309 |
|
$1 |
|
310 |
|
GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" |
|
311 |
|
GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" |
|
312 |
|
AC_SUBST(GNORBA_CFLAGS) |
|
313 |
|
AC_SUBST(GNORBA_LIBS) |
|
314 |
|
else |
|
315 |
|
if test x$2 = xfailure; then |
|
316 |
|
AC_MSG_ERROR(gnorba library not installed or installation problem) |
|
317 |
|
fi |
|
318 |
|
fi |
|
319 |
|
]) |
|
320 |
|
|
|
321 |
|
AC_DEFUN([GNOME_GNORBA_CHECK], [ |
|
322 |
|
GNOME_GNORBA_HOOK([],failure) |
|
323 |
|
]) |
|
324 |
|
|
|
325 |
|
dnl |
|
326 |
|
dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag) |
|
327 |
|
dnl |
|
328 |
|
dnl if failflag is "failure" it aborts if orbit is not found. |
|
329 |
|
dnl |
|
330 |
|
|
|
331 |
|
AC_DEFUN([GNOME_ORBIT_HOOK],[ |
|
332 |
|
AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no) |
|
333 |
|
AC_PATH_PROG(ORBIT_IDL,orbit-idl,no) |
|
334 |
|
AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[ |
|
335 |
|
if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then |
|
336 |
|
gnome_cv_orbit_found=no |
|
337 |
|
else |
|
338 |
|
gnome_cv_orbit_found=yes |
|
339 |
|
fi |
|
340 |
|
]) |
|
341 |
|
AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes) |
|
342 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
343 |
|
$1 |
|
344 |
|
ORBIT_CFLAGS=`orbit-config --cflags client server` |
|
345 |
|
ORBIT_LIBS=`orbit-config --use-service=name --libs client server` |
|
346 |
|
AC_SUBST(ORBIT_CFLAGS) |
|
347 |
|
AC_SUBST(ORBIT_LIBS) |
|
348 |
|
else |
|
349 |
|
if test x$2 = xfailure; then |
|
350 |
|
AC_MSG_ERROR(ORBit not installed or installation problem) |
|
351 |
|
fi |
|
352 |
|
fi |
|
353 |
|
]) |
|
354 |
|
|
|
355 |
|
AC_DEFUN([GNOME_ORBIT_CHECK], [ |
|
356 |
|
GNOME_ORBIT_HOOK([],failure) |
|
357 |
|
]) |
|
358 |
|
|
|
359 |
|
|
|
360 |
|
# serial 1 |
|
361 |
|
|
|
362 |
|
# @defmac AC_PROG_CC_STDC |
|
363 |
|
# @maindex PROG_CC_STDC |
|
364 |
|
# @ovindex CC |
|
365 |
|
# If the C compiler in not in ANSI C mode by default, try to add an option |
|
366 |
|
# to output variable @code{CC} to make it so. This macro tries various |
|
367 |
|
# options that select ANSI C on some system or another. It considers the |
|
368 |
|
# compiler to be in ANSI C mode if it handles function prototypes correctly. |
|
369 |
|
# |
|
370 |
|
# If you use this macro, you should check after calling it whether the C |
|
371 |
|
# compiler has been set to accept ANSI C; if not, the shell variable |
|
372 |
|
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source |
|
373 |
|
# code in ANSI C, you can make an un-ANSIfied copy of it by using the |
|
374 |
|
# program @code{ansi2knr}, which comes with Ghostscript. |
|
375 |
|
# @end defmac |
|
376 |
|
|
|
377 |
|
AC_DEFUN(AM_PROG_CC_STDC, |
|
378 |
|
[AC_REQUIRE([AC_PROG_CC]) |
|
379 |
|
AC_BEFORE([$0], [AC_C_INLINE]) |
|
380 |
|
AC_BEFORE([$0], [AC_C_CONST]) |
|
381 |
|
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require |
|
382 |
|
dnl a magic option to avoid problems with ANSI preprocessor commands |
|
383 |
|
dnl like #elif. |
|
384 |
|
dnl FIXME: can't do this because then AC_AIX won't work due to a |
|
385 |
|
dnl circular dependency. |
|
386 |
|
dnl AC_BEFORE([$0], [AC_PROG_CPP]) |
|
387 |
|
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) |
|
388 |
|
AC_CACHE_VAL(am_cv_prog_cc_stdc, |
|
389 |
|
[am_cv_prog_cc_stdc=no |
|
390 |
|
ac_save_CC="$CC" |
|
391 |
|
# Don't try gcc -ansi; that turns off useful extensions and |
|
392 |
|
# breaks some systems' header files. |
|
393 |
|
# AIX -qlanglvl=ansi |
|
394 |
|
# Ultrix and OSF/1 -std1 |
|
395 |
|
# HP-UX -Aa -D_HPUX_SOURCE |
|
396 |
|
# SVR4 -Xc -D__EXTENSIONS__ |
|
397 |
|
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" |
|
398 |
|
do |
|
399 |
|
CC="$ac_save_CC $ac_arg" |
|
400 |
|
AC_TRY_COMPILE( |
|
401 |
|
[#include <stdarg.h> |
|
402 |
|
#include <stdio.h> |
|
403 |
|
#include <sys/types.h> |
|
404 |
|
#include <sys/stat.h> |
|
405 |
|
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ |
|
406 |
|
struct buf { int x; }; |
|
407 |
|
FILE * (*rcsopen) (struct buf *, struct stat *, int); |
|
408 |
|
static char *e (p, i) |
|
409 |
|
char **p; |
|
410 |
|
int i; |
|
411 |
|
{ |
|
412 |
|
return p[i]; |
|
413 |
|
} |
|
414 |
|
static char *f (char * (*g) (char **, int), char **p, ...) |
|
415 |
|
{ |
|
416 |
|
char *s; |
|
417 |
|
va_list v; |
|
418 |
|
va_start (v,p); |
|
419 |
|
s = g (p, va_arg (v,int)); |
|
420 |
|
va_end (v); |
|
421 |
|
return s; |
|
422 |
|
} |
|
423 |
|
int test (int i, double x); |
|
424 |
|
struct s1 {int (*f) (int a);}; |
|
425 |
|
struct s2 {int (*f) (double a);}; |
|
426 |
|
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); |
|
427 |
|
int argc; |
|
428 |
|
char **argv; |
|
429 |
|
], [ |
|
430 |
|
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; |
|
431 |
|
], |
|
432 |
|
[am_cv_prog_cc_stdc="$ac_arg"; break]) |
|
433 |
|
done |
|
434 |
|
CC="$ac_save_CC" |
|
435 |
|
]) |
|
436 |
|
if test -z "$am_cv_prog_cc_stdc"; then |
|
437 |
|
AC_MSG_RESULT([none needed]) |
|
438 |
|
else |
|
439 |
|
AC_MSG_RESULT($am_cv_prog_cc_stdc) |
|
440 |
|
fi |
|
441 |
|
case "x$am_cv_prog_cc_stdc" in |
|
442 |
|
x|xno) ;; |
|
443 |
|
*) CC="$CC $am_cv_prog_cc_stdc" ;; |
|
444 |
|
esac |
|
445 |
|
]) |
|
446 |
|
|
|
447 |
|
dnl GNOME_COMPILE_WARNINGS |
|
448 |
|
dnl Turn on many useful compiler warnings |
|
449 |
|
dnl For now, only works on GCC |
|
450 |
|
AC_DEFUN([GNOME_COMPILE_WARNINGS],[ |
|
451 |
|
AC_ARG_ENABLE(compile-warnings, |
|
452 |
|
[ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum) |
|
453 |
|
|
|
454 |
|
AC_MSG_CHECKING(what warning flags to pass to the C compiler) |
|
455 |
|
warnCFLAGS= |
|
456 |
|
if test "x$GCC" != xyes; then |
|
457 |
|
enable_compile_warnings=no |
|
458 |
|
fi |
|
459 |
|
|
|
460 |
|
if test "x$enable_compile_warnings" != "xno"; then |
|
461 |
|
if test "x$GCC" = "xyes"; then |
|
462 |
|
case " $CFLAGS " in |
|
463 |
|
*[\ \ ]-Wall[\ \ ]*) ;; |
|
464 |
|
*) warnCFLAGS="-Wall -Wunused" ;; |
|
465 |
|
esac |
|
466 |
|
|
|
467 |
|
## -W is not all that useful. And it cannot be controlled |
|
468 |
|
## with individual -Wno-xxx flags, unlike -Wall |
|
469 |
|
if test "x$enable_compile_warnings" = "xyes"; then |
|
470 |
|
warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations" |
|
471 |
|
fi |
|
472 |
|
fi |
|
473 |
|
fi |
|
474 |
|
AC_MSG_RESULT($warnCFLAGS) |
|
475 |
|
|
|
476 |
|
AC_ARG_ENABLE(iso-c, |
|
477 |
|
[ --enable-iso-c Try to warn if code is not ISO C ],, |
|
478 |
|
enable_iso_c=no) |
|
479 |
|
|
|
480 |
|
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) |
|
481 |
|
complCFLAGS= |
|
482 |
|
if test "x$enable_iso_c" != "xno"; then |
|
483 |
|
if test "x$GCC" = "xyes"; then |
|
484 |
|
case " $CFLAGS " in |
|
485 |
|
*[\ \ ]-ansi[\ \ ]*) ;; |
|
486 |
|
*) complCFLAGS="$complCFLAGS -ansi" ;; |
|
487 |
|
esac |
|
488 |
|
|
|
489 |
|
case " $CFLAGS " in |
|
490 |
|
*[\ \ ]-pedantic[\ \ ]*) ;; |
|
491 |
|
*) complCFLAGS="$complCFLAGS -pedantic" ;; |
|
492 |
|
esac |
|
493 |
|
fi |
|
494 |
|
fi |
|
495 |
|
AC_MSG_RESULT($complCFLAGS) |
|
496 |
|
if test "x$cflags_set" != "xyes"; then |
|
497 |
|
CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" |
|
498 |
|
cflags_set=yes |
|
499 |
|
AC_SUBST(cflags_set) |
|
500 |
|
fi |
|
501 |
|
]) |
|
502 |
|
|
|
503 |
|
dnl For C++, do basically the same thing. |
|
504 |
|
|
|
505 |
|
AC_DEFUN([GNOME_CXX_WARNINGS],[ |
|
506 |
|
AC_ARG_ENABLE(cxx-warnings, |
|
507 |
|
[ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum) |
|
508 |
|
|
|
509 |
|
AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) |
|
510 |
|
warnCXXFLAGS= |
|
511 |
|
if test "x$GCC" != xyes; then |
|
512 |
|
enable_compile_warnings=no |
|
513 |
|
fi |
|
514 |
|
if test "x$enable_cxx_warnings" != "xno"; then |
|
515 |
|
if test "x$GCC" = "xyes"; then |
|
516 |
|
case " $CXXFLAGS " in |
|
517 |
|
*[\ \ ]-Wall[\ \ ]*) ;; |
|
518 |
|
*) warnCXXFLAGS="-Wall -Wno-unused" ;; |
|
519 |
|
esac |
|
520 |
|
|
|
521 |
|
## -W is not all that useful. And it cannot be controlled |
|
522 |
|
## with individual -Wno-xxx flags, unlike -Wall |
|
523 |
|
if test "x$enable_cxx_warnings" = "xyes"; then |
|
524 |
|
warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual" |
|
525 |
|
fi |
|
526 |
|
fi |
|
527 |
|
fi |
|
528 |
|
AC_MSG_RESULT($warnCXXFLAGS) |
|
529 |
|
|
|
530 |
|
AC_ARG_ENABLE(iso-cxx, |
|
531 |
|
[ --enable-iso-cxx Try to warn if code is not ISO C++ ],, |
|
532 |
|
enable_iso_cxx=no) |
|
533 |
|
|
|
534 |
|
AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) |
|
535 |
|
complCXXFLAGS= |
|
536 |
|
if test "x$enable_iso_cxx" != "xno"; then |
|
537 |
|
if test "x$GCC" = "xyes"; then |
|
538 |
|
case " $CXXFLAGS " in |
|
539 |
|
*[\ \ ]-ansi[\ \ ]*) ;; |
|
540 |
|
*) complCXXFLAGS="$complCXXFLAGS -ansi" ;; |
|
541 |
|
esac |
|
542 |
|
|
|
543 |
|
case " $CXXFLAGS " in |
|
544 |
|
*[\ \ ]-pedantic[\ \ ]*) ;; |
|
545 |
|
*) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; |
|
546 |
|
esac |
|
547 |
|
fi |
|
548 |
|
fi |
|
549 |
|
AC_MSG_RESULT($complCXXFLAGS) |
|
550 |
|
if test "x$cxxflags_set" != "xyes"; then |
|
551 |
|
CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" |
|
552 |
|
cxxflags_set=yes |
|
553 |
|
AC_SUBST(cxxflags_set) |
|
554 |
|
fi |
|
555 |
|
]) |
|
556 |
|
|
|
557 |
|
dnl GNOME_X_CHECKS |
|
558 |
|
dnl |
|
559 |
|
dnl Basic X11 related checks for X11. At the end, the following will be |
|
560 |
|
dnl defined/changed: |
|
561 |
|
dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK |
|
562 |
|
dnl CPPFLAGS Will include $X_CFLAGS |
|
563 |
|
dnl GNOME_HAVE_SM `true' or `false' depending on whether session |
|
564 |
|
dnl management is available. It is available if |
|
565 |
|
dnl both -lSM and X11/SM/SMlib.h exist. (Some |
|
566 |
|
dnl Solaris boxes have the library but not the header) |
|
567 |
|
dnl XPM_LIBS -lXpm if Xpm library is present, otherwise "" |
|
568 |
|
dnl |
|
569 |
|
dnl The following configure cache variables are defined (but not used): |
|
570 |
|
dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS} |
|
571 |
|
dnl |
|
572 |
|
AC_DEFUN([GNOME_X_CHECKS], |
|
573 |
|
[ |
|
574 |
|
AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path)) |
|
575 |
|
dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could |
|
576 |
|
dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes" |
|
577 |
|
dnl |
|
578 |
|
dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses |
|
579 |
|
dnl CPPFLAGS, not CFLAGS |
|
580 |
|
CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" |
|
581 |
|
|
|
582 |
|
saved_ldflags="$LDFLAGS" |
|
583 |
|
LDFLAGS="$LDFLAGS $GTK_LIBS" |
|
584 |
|
|
|
585 |
|
gnome_cv_passdown_x_libs="$GTK_LIBS" |
|
586 |
|
gnome_cv_passdown_X_LIBS="$GTK_LIBS" |
|
587 |
|
gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" |
|
588 |
|
gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" |
|
589 |
|
|
|
590 |
|
LDFLAGS="$saved_ldflags $GTK_LIBS" |
|
591 |
|
|
|
592 |
|
dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow. |
|
593 |
|
USE_DEVGTK=true |
|
594 |
|
|
|
595 |
|
dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x]) |
|
596 |
|
dnl AC_EGREP_CPP(answer_affirmatively, |
|
597 |
|
dnl [#include <gtk/gtkfeatures.h> |
|
598 |
|
dnl #ifdef GTK_HAVE_FEATURES_1_1_0 |
|
599 |
|
dnl answer_affirmatively |
|
600 |
|
dnl #endif |
|
601 |
|
dnl ], dev_gtk=yes, dev_gtk=no) |
|
602 |
|
dnl if test "$dev_gtk" = "yes"; then |
|
603 |
|
dnl USE_DEVGTK=true |
|
604 |
|
dnl fi |
|
605 |
|
dnl AC_MSG_RESULT("$dev_gtk") |
|
606 |
|
|
|
607 |
|
GNOME_HAVE_SM=true |
|
608 |
|
case "$GTK_LIBS" in |
|
609 |
|
*-lSM*) |
|
610 |
|
dnl Already found it. |
|
611 |
|
;; |
|
612 |
|
*) |
|
613 |
|
dnl Assume that if we have -lSM then we also have -lICE. |
|
614 |
|
AC_CHECK_LIB(SM, SmcSaveYourselfDone, |
|
615 |
|
[GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false, |
|
616 |
|
$x_libs -lICE) |
|
617 |
|
;; |
|
618 |
|
esac |
|
619 |
|
|
|
620 |
|
if test "$GNOME_HAVE_SM" = true; then |
|
621 |
|
AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false) |
|
622 |
|
fi |
|
623 |
|
|
|
624 |
|
if test "$GNOME_HAVE_SM" = true; then |
|
625 |
|
AC_DEFINE(HAVE_LIBSM) |
|
626 |
|
fi |
|
627 |
|
|
|
628 |
|
XPM_LIBS="" |
|
629 |
|
AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs) |
|
630 |
|
AC_SUBST(XPM_LIBS) |
|
631 |
|
|
|
632 |
|
AC_REQUIRE([GNOME_PTHREAD_CHECK]) |
|
633 |
|
LDFLAGS="$saved_ldflags" |
|
634 |
|
|
|
635 |
|
AC_PROVIDE([GNOME_X_CHECKS]) |
|
636 |
|
]) |
|
637 |
|
|
|
638 |
|
# Configure paths for GTK+ |
|
639 |
|
# Owen Taylor 97-11-3 |
|
640 |
|
|
|
641 |
|
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
|
642 |
|
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS |
|
643 |
|
dnl |
|
644 |
|
AC_DEFUN(AM_PATH_GTK, |
|
645 |
|
[dnl |
|
646 |
|
dnl Get the cflags and libraries from the gtk-config script |
|
647 |
|
dnl |
|
648 |
|
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], |
|
649 |
|
gtk_config_prefix="$withval", gtk_config_prefix="") |
|
650 |
|
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], |
|
651 |
|
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") |
|
652 |
|
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], |
|
653 |
|
, enable_gtktest=yes) |
|
654 |
|
|
|
655 |
|
for module in . $4 |
|
656 |
|
do |
|
657 |
|
case "$module" in |
|
658 |
|
gthread) |
|
659 |
|
gtk_config_args="$gtk_config_args gthread" |
|
660 |
|
;; |
|
661 |
|
esac |
|
662 |
|
done |
|
663 |
|
|
|
664 |
|
if test x$gtk_config_exec_prefix != x ; then |
|
665 |
|
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" |
|
666 |
|
if test x${GTK_CONFIG+set} != xset ; then |
|
667 |
|
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config |
|
668 |
|
fi |
|
669 |
|
fi |
|
670 |
|
if test x$gtk_config_prefix != x ; then |
|
671 |
|
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" |
|
672 |
|
if test x${GTK_CONFIG+set} != xset ; then |
|
673 |
|
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config |
|
674 |
|
fi |
|
675 |
|
fi |
|
676 |
|
|
|
677 |
|
AC_PATH_PROG(GTK_CONFIG, gtk-config, no) |
|
678 |
|
min_gtk_version=ifelse([$1], ,0.99.7,$1) |
|
679 |
|
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) |
|
680 |
|
no_gtk="" |
|
681 |
|
if test "$GTK_CONFIG" = "no" ; then |
|
682 |
|
no_gtk=yes |
|
683 |
|
else |
|
684 |
|
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` |
|
685 |
|
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` |
|
686 |
|
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
687 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
|
688 |
|
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
689 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
|
690 |
|
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
691 |
|
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
|
692 |
|
if test "x$enable_gtktest" = "xyes" ; then |
|
693 |
|
ac_save_CFLAGS="$CFLAGS" |
|
694 |
|
ac_save_LIBS="$LIBS" |
|
695 |
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
|
696 |
|
LIBS="$GTK_LIBS $LIBS" |
|
697 |
|
dnl |
|
698 |
|
dnl Now check if the installed GTK is sufficiently new. (Also sanity |
|
699 |
|
dnl checks the results of gtk-config to some extent |
|
700 |
|
dnl |
|
701 |
|
rm -f conf.gtktest |
|
702 |
|
AC_TRY_RUN([ |
|
703 |
|
#include <gtk/gtk.h> |
|
704 |
|
#include <stdio.h> |
|
705 |
|
#include <stdlib.h> |
|
706 |
|
|
|
707 |
|
int |
|
708 |
|
main () |
|
709 |
|
{ |
|
710 |
|
int major, minor, micro; |
|
711 |
|
char *tmp_version; |
|
712 |
|
|
|
713 |
|
system ("touch conf.gtktest"); |
|
714 |
|
|
|
715 |
|
/* HP/UX 9 (%@#!) writes to sscanf strings */ |
|
716 |
|
tmp_version = g_strdup("$min_gtk_version"); |
|
717 |
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
|
718 |
|
printf("%s, bad version string\n", "$min_gtk_version"); |
|
719 |
|
exit(1); |
|
720 |
|
} |
|
721 |
|
|
|
722 |
|
if ((gtk_major_version != $gtk_config_major_version) || |
|
723 |
|
(gtk_minor_version != $gtk_config_minor_version) || |
|
724 |
|
(gtk_micro_version != $gtk_config_micro_version)) |
|
725 |
|
{ |
|
726 |
|
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", |
|
727 |
|
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, |
|
728 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
729 |
|
printf ("*** was found! If gtk-config was correct, then it is best\n"); |
|
730 |
|
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); |
|
731 |
|
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
|
732 |
|
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
|
733 |
|
printf("*** required on your system.\n"); |
|
734 |
|
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); |
|
735 |
|
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); |
|
736 |
|
printf("*** before re-running configure\n"); |
|
737 |
|
} |
|
738 |
|
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) |
|
739 |
|
else if ((gtk_major_version != GTK_MAJOR_VERSION) || |
|
740 |
|
(gtk_minor_version != GTK_MINOR_VERSION) || |
|
741 |
|
(gtk_micro_version != GTK_MICRO_VERSION)) |
|
742 |
|
{ |
|
743 |
|
printf("*** GTK+ header files (version %d.%d.%d) do not match\n", |
|
744 |
|
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); |
|
745 |
|
printf("*** library (version %d.%d.%d)\n", |
|
746 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
747 |
|
} |
|
748 |
|
#endif /* defined (GTK_MAJOR_VERSION) ... */ |
|
749 |
|
else |
|
750 |
|
{ |
|
751 |
|
if ((gtk_major_version > major) || |
|
752 |
|
((gtk_major_version == major) && (gtk_minor_version > minor)) || |
|
753 |
|
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) |
|
754 |
|
{ |
|
755 |
|
return 0; |
|
756 |
|
} |
|
757 |
|
else |
|
758 |
|
{ |
|
759 |
|
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", |
|
760 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
761 |
|
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", |
|
762 |
|
major, minor, micro); |
|
763 |
|
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); |
|
764 |
|
printf("***\n"); |
|
765 |
|
printf("*** If you have already installed a sufficiently new version, this error\n"); |
|
766 |
|
printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); |
|
767 |
|
printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
|
768 |
|
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); |
|
769 |
|
printf("*** correct copy of gtk-config. (In this case, you will have to\n"); |
|
770 |
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
|
771 |
|
printf("*** so that the correct libraries are found at run-time))\n"); |
|
772 |
|
} |
|
773 |
|
} |
|
774 |
|
return 1; |
|
775 |
|
} |
|
776 |
|
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
|
777 |
|
CFLAGS="$ac_save_CFLAGS" |
|
778 |
|
LIBS="$ac_save_LIBS" |
|
779 |
|
fi |
|
780 |
|
fi |
|
781 |
|
if test "x$no_gtk" = x ; then |
|
782 |
|
AC_MSG_RESULT(yes) |
|
783 |
|
ifelse([$2], , :, [$2]) |
|
784 |
|
else |
|
785 |
|
AC_MSG_RESULT(no) |
|
786 |
|
if test "$GTK_CONFIG" = "no" ; then |
|
787 |
|
echo "*** The gtk-config script installed by GTK could not be found" |
|
788 |
|
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" |
|
789 |
|
echo "*** your path, or set the GTK_CONFIG environment variable to the" |
|
790 |
|
echo "*** full path to gtk-config." |
|
791 |
|
else |
|
792 |
|
if test -f conf.gtktest ; then |
|
793 |
|
: |
|
794 |
|
else |
|
795 |
|
echo "*** Could not run GTK test program, checking why..." |
|
796 |
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
|
797 |
|
LIBS="$LIBS $GTK_LIBS" |
|
798 |
|
AC_TRY_LINK([ |
|
799 |
|
#include <gtk/gtk.h> |
|
800 |
|
#include <stdio.h> |
|
801 |
|
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], |
|
802 |
|
[ echo "*** The test program compiled, but did not run. This usually means" |
|
803 |
|
echo "*** that the run-time linker is not finding GTK or finding the wrong" |
|
804 |
|
echo "*** version of GTK. If it is not finding GTK, you'll need to set your" |
|
805 |
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
|
806 |
|
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
|
807 |
|
echo "*** is required on your system" |
|
808 |
|
echo "***" |
|
809 |
|
echo "*** If you have an old version installed, it is best to remove it, although" |
|
810 |
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" |
|
811 |
|
echo "***" |
|
812 |
|
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" |
|
813 |
|
echo "*** came with the system with the command" |
|
814 |
|
echo "***" |
|
815 |
|
echo "*** rpm --erase --nodeps gtk gtk-devel" ], |
|
816 |
|
[ echo "*** The test program failed to compile or link. See the file config.log for the" |
|
817 |
|
echo "*** exact error that occured. This usually means GTK was incorrectly installed" |
|
818 |
|
echo "*** or that you have moved GTK since it was installed. In the latter case, you" |
|
819 |
|
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) |
|
820 |
|
CFLAGS="$ac_save_CFLAGS" |
|
821 |
|
LIBS="$ac_save_LIBS" |
|
822 |
|
fi |
|
823 |
|
fi |
|
824 |
|
GTK_CFLAGS="" |
|
825 |
|
GTK_LIBS="" |
|
826 |
|
ifelse([$3], , :, [$3]) |
|
827 |
|
fi |
|
828 |
|
AC_SUBST(GTK_CFLAGS) |
|
829 |
|
AC_SUBST(GTK_LIBS) |
|
830 |
|
rm -f conf.gtktest |
|
831 |
|
]) |
|
832 |
|
|
|
833 |
|
dnl |
|
834 |
|
dnl And better, use gthreads instead... |
|
835 |
|
dnl |
|
836 |
|
|
|
837 |
|
AC_DEFUN([GNOME_PTHREAD_CHECK],[ |
|
838 |
|
PTHREAD_LIB="" |
|
839 |
|
AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread", |
|
840 |
|
[AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads", |
|
841 |
|
[AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r", |
|
842 |
|
[AC_CHECK_FUNC(pthread_create)] |
|
843 |
|
)] |
|
844 |
|
)] |
|
845 |
|
) |
|
846 |
|
AC_SUBST(PTHREAD_LIB) |
|
847 |
|
AC_PROVIDE([GNOME_PTHREAD_CHECK]) |
|
848 |
|
]) |
|
849 |
|
|
| File configure added (mode: 100755) (index 0000000..336c6c0) |
|
1 |
|
#! /bin/sh |
|
2 |
|
|
|
3 |
|
# Guess values for system-dependent variables and create Makefiles. |
|
4 |
|
# Generated automatically using autoconf version 2.13 |
|
5 |
|
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. |
|
6 |
|
# |
|
7 |
|
# This configure script is free software; the Free Software Foundation |
|
8 |
|
# gives unlimited permission to copy, distribute and modify it. |
|
9 |
|
|
|
10 |
|
# Defaults: |
|
11 |
|
ac_help= |
|
12 |
|
ac_default_prefix=/usr/local |
|
13 |
|
# Any additions from configure.in: |
|
14 |
|
ac_help="$ac_help |
|
15 |
|
--with-gnome-includes Specify location of GNOME headers" |
|
16 |
|
ac_help="$ac_help |
|
17 |
|
--with-gnome-libs Specify location of GNOME libs" |
|
18 |
|
ac_help="$ac_help |
|
19 |
|
--with-gnome Specify prefix for GNOME files" |
|
20 |
|
ac_help="$ac_help |
|
21 |
|
--enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings." |
|
22 |
|
ac_help="$ac_help |
|
23 |
|
--enable-iso-c Try to warn if code is not ISO C " |
|
24 |
|
ac_help="$ac_help |
|
25 |
|
--with-gtk-prefix=PFX Prefix where GTK is installed (optional)" |
|
26 |
|
ac_help="$ac_help |
|
27 |
|
--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)" |
|
28 |
|
ac_help="$ac_help |
|
29 |
|
--disable-gtktest Do not try to compile and run a test GTK program" |
|
30 |
|
ac_help="$ac_help |
|
31 |
|
--with-gtk-prefix=PFX Prefix where GTK is installed (optional)" |
|
32 |
|
ac_help="$ac_help |
|
33 |
|
--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)" |
|
34 |
|
ac_help="$ac_help |
|
35 |
|
--disable-gtktest Do not try to compile and run a test GTK program" |
|
36 |
|
|
|
37 |
|
# Initialize some variables set by options. |
|
38 |
|
# The variables have the same names as the options, with |
|
39 |
|
# dashes changed to underlines. |
|
40 |
|
build=NONE |
|
41 |
|
cache_file=./config.cache |
|
42 |
|
exec_prefix=NONE |
|
43 |
|
host=NONE |
|
44 |
|
no_create= |
|
45 |
|
nonopt=NONE |
|
46 |
|
no_recursion= |
|
47 |
|
prefix=NONE |
|
48 |
|
program_prefix=NONE |
|
49 |
|
program_suffix=NONE |
|
50 |
|
program_transform_name=s,x,x, |
|
51 |
|
silent= |
|
52 |
|
site= |
|
53 |
|
srcdir= |
|
54 |
|
target=NONE |
|
55 |
|
verbose= |
|
56 |
|
x_includes=NONE |
|
57 |
|
x_libraries=NONE |
|
58 |
|
bindir='${exec_prefix}/bin' |
|
59 |
|
sbindir='${exec_prefix}/sbin' |
|
60 |
|
libexecdir='${exec_prefix}/libexec' |
|
61 |
|
datadir='${prefix}/share' |
|
62 |
|
sysconfdir='${prefix}/etc' |
|
63 |
|
sharedstatedir='${prefix}/com' |
|
64 |
|
localstatedir='${prefix}/var' |
|
65 |
|
libdir='${exec_prefix}/lib' |
|
66 |
|
includedir='${prefix}/include' |
|
67 |
|
oldincludedir='/usr/include' |
|
68 |
|
infodir='${prefix}/info' |
|
69 |
|
mandir='${prefix}/man' |
|
70 |
|
|
|
71 |
|
# Initialize some other variables. |
|
72 |
|
subdirs= |
|
73 |
|
MFLAGS= MAKEFLAGS= |
|
74 |
|
SHELL=${CONFIG_SHELL-/bin/sh} |
|
75 |
|
# Maximum number of lines to put in a shell here document. |
|
76 |
|
ac_max_here_lines=12 |
|
77 |
|
|
|
78 |
|
ac_prev= |
|
79 |
|
for ac_option |
|
80 |
|
do |
|
81 |
|
|
|
82 |
|
# If the previous option needs an argument, assign it. |
|
83 |
|
if test -n "$ac_prev"; then |
|
84 |
|
eval "$ac_prev=\$ac_option" |
|
85 |
|
ac_prev= |
|
86 |
|
continue |
|
87 |
|
fi |
|
88 |
|
|
|
89 |
|
case "$ac_option" in |
|
90 |
|
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
|
91 |
|
*) ac_optarg= ;; |
|
92 |
|
esac |
|
93 |
|
|
|
94 |
|
# Accept the important Cygnus configure options, so we can diagnose typos. |
|
95 |
|
|
|
96 |
|
case "$ac_option" in |
|
97 |
|
|
|
98 |
|
-bindir | --bindir | --bindi | --bind | --bin | --bi) |
|
99 |
|
ac_prev=bindir ;; |
|
100 |
|
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) |
|
101 |
|
bindir="$ac_optarg" ;; |
|
102 |
|
|
|
103 |
|
-build | --build | --buil | --bui | --bu) |
|
104 |
|
ac_prev=build ;; |
|
105 |
|
-build=* | --build=* | --buil=* | --bui=* | --bu=*) |
|
106 |
|
build="$ac_optarg" ;; |
|
107 |
|
|
|
108 |
|
-cache-file | --cache-file | --cache-fil | --cache-fi \ |
|
109 |
|
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) |
|
110 |
|
ac_prev=cache_file ;; |
|
111 |
|
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ |
|
112 |
|
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) |
|
113 |
|
cache_file="$ac_optarg" ;; |
|
114 |
|
|
|
115 |
|
-datadir | --datadir | --datadi | --datad | --data | --dat | --da) |
|
116 |
|
ac_prev=datadir ;; |
|
117 |
|
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ |
|
118 |
|
| --da=*) |
|
119 |
|
datadir="$ac_optarg" ;; |
|
120 |
|
|
|
121 |
|
-disable-* | --disable-*) |
|
122 |
|
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` |
|
123 |
|
# Reject names that are not valid shell variable names. |
|
124 |
|
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then |
|
125 |
|
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } |
|
126 |
|
fi |
|
127 |
|
ac_feature=`echo $ac_feature| sed 's/-/_/g'` |
|
128 |
|
eval "enable_${ac_feature}=no" ;; |
|
129 |
|
|
|
130 |
|
-enable-* | --enable-*) |
|
131 |
|
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` |
|
132 |
|
# Reject names that are not valid shell variable names. |
|
133 |
|
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then |
|
134 |
|
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } |
|
135 |
|
fi |
|
136 |
|
ac_feature=`echo $ac_feature| sed 's/-/_/g'` |
|
137 |
|
case "$ac_option" in |
|
138 |
|
*=*) ;; |
|
139 |
|
*) ac_optarg=yes ;; |
|
140 |
|
esac |
|
141 |
|
eval "enable_${ac_feature}='$ac_optarg'" ;; |
|
142 |
|
|
|
143 |
|
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ |
|
144 |
|
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ |
|
145 |
|
| --exec | --exe | --ex) |
|
146 |
|
ac_prev=exec_prefix ;; |
|
147 |
|
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ |
|
148 |
|
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ |
|
149 |
|
| --exec=* | --exe=* | --ex=*) |
|
150 |
|
exec_prefix="$ac_optarg" ;; |
|
151 |
|
|
|
152 |
|
-gas | --gas | --ga | --g) |
|
153 |
|
# Obsolete; use --with-gas. |
|
154 |
|
with_gas=yes ;; |
|
155 |
|
|
|
156 |
|
-help | --help | --hel | --he) |
|
157 |
|
# Omit some internal or obsolete options to make the list less imposing. |
|
158 |
|
# This message is too long to be a string in the A/UX 3.1 sh. |
|
159 |
|
cat << EOF |
|
160 |
|
Usage: configure [options] [host] |
|
161 |
|
Options: [defaults in brackets after descriptions] |
|
162 |
|
Configuration: |
|
163 |
|
--cache-file=FILE cache test results in FILE |
|
164 |
|
--help print this message |
|
165 |
|
--no-create do not create output files |
|
166 |
|
--quiet, --silent do not print \`checking...' messages |
|
167 |
|
--version print the version of autoconf that created configure |
|
168 |
|
Directory and file names: |
|
169 |
|
--prefix=PREFIX install architecture-independent files in PREFIX |
|
170 |
|
[$ac_default_prefix] |
|
171 |
|
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX |
|
172 |
|
[same as prefix] |
|
173 |
|
--bindir=DIR user executables in DIR [EPREFIX/bin] |
|
174 |
|
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin] |
|
175 |
|
--libexecdir=DIR program executables in DIR [EPREFIX/libexec] |
|
176 |
|
--datadir=DIR read-only architecture-independent data in DIR |
|
177 |
|
[PREFIX/share] |
|
178 |
|
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] |
|
179 |
|
--sharedstatedir=DIR modifiable architecture-independent data in DIR |
|
180 |
|
[PREFIX/com] |
|
181 |
|
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] |
|
182 |
|
--libdir=DIR object code libraries in DIR [EPREFIX/lib] |
|
183 |
|
--includedir=DIR C header files in DIR [PREFIX/include] |
|
184 |
|
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] |
|
185 |
|
--infodir=DIR info documentation in DIR [PREFIX/info] |
|
186 |
|
--mandir=DIR man documentation in DIR [PREFIX/man] |
|
187 |
|
--srcdir=DIR find the sources in DIR [configure dir or ..] |
|
188 |
|
--program-prefix=PREFIX prepend PREFIX to installed program names |
|
189 |
|
--program-suffix=SUFFIX append SUFFIX to installed program names |
|
190 |
|
--program-transform-name=PROGRAM |
|
191 |
|
run sed PROGRAM on installed program names |
|
192 |
|
EOF |
|
193 |
|
cat << EOF |
|
194 |
|
Host type: |
|
195 |
|
--build=BUILD configure for building on BUILD [BUILD=HOST] |
|
196 |
|
--host=HOST configure for HOST [guessed] |
|
197 |
|
--target=TARGET configure for TARGET [TARGET=HOST] |
|
198 |
|
Features and packages: |
|
199 |
|
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) |
|
200 |
|
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] |
|
201 |
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
|
202 |
|
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) |
|
203 |
|
--x-includes=DIR X include files are in DIR |
|
204 |
|
--x-libraries=DIR X library files are in DIR |
|
205 |
|
EOF |
|
206 |
|
if test -n "$ac_help"; then |
|
207 |
|
echo "--enable and --with options recognized:$ac_help" |
|
208 |
|
fi |
|
209 |
|
exit 0 ;; |
|
210 |
|
|
|
211 |
|
-host | --host | --hos | --ho) |
|
212 |
|
ac_prev=host ;; |
|
213 |
|
-host=* | --host=* | --hos=* | --ho=*) |
|
214 |
|
host="$ac_optarg" ;; |
|
215 |
|
|
|
216 |
|
-includedir | --includedir | --includedi | --included | --include \ |
|
217 |
|
| --includ | --inclu | --incl | --inc) |
|
218 |
|
ac_prev=includedir ;; |
|
219 |
|
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ |
|
220 |
|
| --includ=* | --inclu=* | --incl=* | --inc=*) |
|
221 |
|
includedir="$ac_optarg" ;; |
|
222 |
|
|
|
223 |
|
-infodir | --infodir | --infodi | --infod | --info | --inf) |
|
224 |
|
ac_prev=infodir ;; |
|
225 |
|
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) |
|
226 |
|
infodir="$ac_optarg" ;; |
|
227 |
|
|
|
228 |
|
-libdir | --libdir | --libdi | --libd) |
|
229 |
|
ac_prev=libdir ;; |
|
230 |
|
-libdir=* | --libdir=* | --libdi=* | --libd=*) |
|
231 |
|
libdir="$ac_optarg" ;; |
|
232 |
|
|
|
233 |
|
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ |
|
234 |
|
| --libexe | --libex | --libe) |
|
235 |
|
ac_prev=libexecdir ;; |
|
236 |
|
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ |
|
237 |
|
| --libexe=* | --libex=* | --libe=*) |
|
238 |
|
libexecdir="$ac_optarg" ;; |
|
239 |
|
|
|
240 |
|
-localstatedir | --localstatedir | --localstatedi | --localstated \ |
|
241 |
|
| --localstate | --localstat | --localsta | --localst \ |
|
242 |
|
| --locals | --local | --loca | --loc | --lo) |
|
243 |
|
ac_prev=localstatedir ;; |
|
244 |
|
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ |
|
245 |
|
| --localstate=* | --localstat=* | --localsta=* | --localst=* \ |
|
246 |
|
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*) |
|
247 |
|
localstatedir="$ac_optarg" ;; |
|
248 |
|
|
|
249 |
|
-mandir | --mandir | --mandi | --mand | --man | --ma | --m) |
|
250 |
|
ac_prev=mandir ;; |
|
251 |
|
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) |
|
252 |
|
mandir="$ac_optarg" ;; |
|
253 |
|
|
|
254 |
|
-nfp | --nfp | --nf) |
|
255 |
|
# Obsolete; use --without-fp. |
|
256 |
|
with_fp=no ;; |
|
257 |
|
|
|
258 |
|
-no-create | --no-create | --no-creat | --no-crea | --no-cre \ |
|
259 |
|
| --no-cr | --no-c) |
|
260 |
|
no_create=yes ;; |
|
261 |
|
|
|
262 |
|
-no-recursion | --no-recursion | --no-recursio | --no-recursi \ |
|
263 |
|
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) |
|
264 |
|
no_recursion=yes ;; |
|
265 |
|
|
|
266 |
|
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ |
|
267 |
|
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ |
|
268 |
|
| --oldin | --oldi | --old | --ol | --o) |
|
269 |
|
ac_prev=oldincludedir ;; |
|
270 |
|
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ |
|
271 |
|
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ |
|
272 |
|
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) |
|
273 |
|
oldincludedir="$ac_optarg" ;; |
|
274 |
|
|
|
275 |
|
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p) |
|
276 |
|
ac_prev=prefix ;; |
|
277 |
|
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) |
|
278 |
|
prefix="$ac_optarg" ;; |
|
279 |
|
|
|
280 |
|
-program-prefix | --program-prefix | --program-prefi | --program-pref \ |
|
281 |
|
| --program-pre | --program-pr | --program-p) |
|
282 |
|
ac_prev=program_prefix ;; |
|
283 |
|
-program-prefix=* | --program-prefix=* | --program-prefi=* \ |
|
284 |
|
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) |
|
285 |
|
program_prefix="$ac_optarg" ;; |
|
286 |
|
|
|
287 |
|
-program-suffix | --program-suffix | --program-suffi | --program-suff \ |
|
288 |
|
| --program-suf | --program-su | --program-s) |
|
289 |
|
ac_prev=program_suffix ;; |
|
290 |
|
-program-suffix=* | --program-suffix=* | --program-suffi=* \ |
|
291 |
|
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) |
|
292 |
|
program_suffix="$ac_optarg" ;; |
|
293 |
|
|
|
294 |
|
-program-transform-name | --program-transform-name \ |
|
295 |
|
| --program-transform-nam | --program-transform-na \ |
|
296 |
|
| --program-transform-n | --program-transform- \ |
|
297 |
|
| --program-transform | --program-transfor \ |
|
298 |
|
| --program-transfo | --program-transf \ |
|
299 |
|
| --program-trans | --program-tran \ |
|
300 |
|
| --progr-tra | --program-tr | --program-t) |
|
301 |
|
ac_prev=program_transform_name ;; |
|
302 |
|
-program-transform-name=* | --program-transform-name=* \ |
|
303 |
|
| --program-transform-nam=* | --program-transform-na=* \ |
|
304 |
|
| --program-transform-n=* | --program-transform-=* \ |
|
305 |
|
| --program-transform=* | --program-transfor=* \ |
|
306 |
|
| --program-transfo=* | --program-transf=* \ |
|
307 |
|
| --program-trans=* | --program-tran=* \ |
|
308 |
|
| --progr-tra=* | --program-tr=* | --program-t=*) |
|
309 |
|
program_transform_name="$ac_optarg" ;; |
|
310 |
|
|
|
311 |
|
-q | -quiet | --quiet | --quie | --qui | --qu | --q \ |
|
312 |
|
| -silent | --silent | --silen | --sile | --sil) |
|
313 |
|
silent=yes ;; |
|
314 |
|
|
|
315 |
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) |
|
316 |
|
ac_prev=sbindir ;; |
|
317 |
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ |
|
318 |
|
| --sbi=* | --sb=*) |
|
319 |
|
sbindir="$ac_optarg" ;; |
|
320 |
|
|
|
321 |
|
-sharedstatedir | --sharedstatedir | --sharedstatedi \ |
|
322 |
|
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \ |
|
323 |
|
| --sharedst | --shareds | --shared | --share | --shar \ |
|
324 |
|
| --sha | --sh) |
|
325 |
|
ac_prev=sharedstatedir ;; |
|
326 |
|
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ |
|
327 |
|
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ |
|
328 |
|
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ |
|
329 |
|
| --sha=* | --sh=*) |
|
330 |
|
sharedstatedir="$ac_optarg" ;; |
|
331 |
|
|
|
332 |
|
-site | --site | --sit) |
|
333 |
|
ac_prev=site ;; |
|
334 |
|
-site=* | --site=* | --sit=*) |
|
335 |
|
site="$ac_optarg" ;; |
|
336 |
|
|
|
337 |
|
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr) |
|
338 |
|
ac_prev=srcdir ;; |
|
339 |
|
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) |
|
340 |
|
srcdir="$ac_optarg" ;; |
|
341 |
|
|
|
342 |
|
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ |
|
343 |
|
| --syscon | --sysco | --sysc | --sys | --sy) |
|
344 |
|
ac_prev=sysconfdir ;; |
|
345 |
|
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ |
|
346 |
|
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) |
|
347 |
|
sysconfdir="$ac_optarg" ;; |
|
348 |
|
|
|
349 |
|
-target | --target | --targe | --targ | --tar | --ta | --t) |
|
350 |
|
ac_prev=target ;; |
|
351 |
|
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) |
|
352 |
|
target="$ac_optarg" ;; |
|
353 |
|
|
|
354 |
|
-v | -verbose | --verbose | --verbos | --verbo | --verb) |
|
355 |
|
verbose=yes ;; |
|
356 |
|
|
|
357 |
|
-version | --version | --versio | --versi | --vers) |
|
358 |
|
echo "configure generated by autoconf version 2.13" |
|
359 |
|
exit 0 ;; |
|
360 |
|
|
|
361 |
|
-with-* | --with-*) |
|
362 |
|
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` |
|
363 |
|
# Reject names that are not valid shell variable names. |
|
364 |
|
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then |
|
365 |
|
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } |
|
366 |
|
fi |
|
367 |
|
ac_package=`echo $ac_package| sed 's/-/_/g'` |
|
368 |
|
case "$ac_option" in |
|
369 |
|
*=*) ;; |
|
370 |
|
*) ac_optarg=yes ;; |
|
371 |
|
esac |
|
372 |
|
eval "with_${ac_package}='$ac_optarg'" ;; |
|
373 |
|
|
|
374 |
|
-without-* | --without-*) |
|
375 |
|
ac_package=`echo $ac_option|sed -e 's/-*without-//'` |
|
376 |
|
# Reject names that are not valid shell variable names. |
|
377 |
|
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then |
|
378 |
|
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } |
|
379 |
|
fi |
|
380 |
|
ac_package=`echo $ac_package| sed 's/-/_/g'` |
|
381 |
|
eval "with_${ac_package}=no" ;; |
|
382 |
|
|
|
383 |
|
--x) |
|
384 |
|
# Obsolete; use --with-x. |
|
385 |
|
with_x=yes ;; |
|
386 |
|
|
|
387 |
|
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ |
|
388 |
|
| --x-incl | --x-inc | --x-in | --x-i) |
|
389 |
|
ac_prev=x_includes ;; |
|
390 |
|
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ |
|
391 |
|
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) |
|
392 |
|
x_includes="$ac_optarg" ;; |
|
393 |
|
|
|
394 |
|
-x-libraries | --x-libraries | --x-librarie | --x-librari \ |
|
395 |
|
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) |
|
396 |
|
ac_prev=x_libraries ;; |
|
397 |
|
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ |
|
398 |
|
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) |
|
399 |
|
x_libraries="$ac_optarg" ;; |
|
400 |
|
|
|
401 |
|
-*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } |
|
402 |
|
;; |
|
403 |
|
|
|
404 |
|
*) |
|
405 |
|
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then |
|
406 |
|
echo "configure: warning: $ac_option: invalid host type" 1>&2 |
|
407 |
|
fi |
|
408 |
|
if test "x$nonopt" != xNONE; then |
|
409 |
|
{ echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } |
|
410 |
|
fi |
|
411 |
|
nonopt="$ac_option" |
|
412 |
|
;; |
|
413 |
|
|
|
414 |
|
esac |
|
415 |
|
done |
|
416 |
|
|
|
417 |
|
if test -n "$ac_prev"; then |
|
418 |
|
{ echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } |
|
419 |
|
fi |
|
420 |
|
|
|
421 |
|
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 |
|
422 |
|
|
|
423 |
|
# File descriptor usage: |
|
424 |
|
# 0 standard input |
|
425 |
|
# 1 file creation |
|
426 |
|
# 2 errors and warnings |
|
427 |
|
# 3 some systems may open it to /dev/tty |
|
428 |
|
# 4 used on the Kubota Titan |
|
429 |
|
# 6 checking for... messages and results |
|
430 |
|
# 5 compiler messages saved in config.log |
|
431 |
|
if test "$silent" = yes; then |
|
432 |
|
exec 6>/dev/null |
|
433 |
|
else |
|
434 |
|
exec 6>&1 |
|
435 |
|
fi |
|
436 |
|
exec 5>./config.log |
|
437 |
|
|
|
438 |
|
echo "\ |
|
439 |
|
This file contains any messages produced by compilers while |
|
440 |
|
running configure, to aid debugging if configure makes a mistake. |
|
441 |
|
" 1>&5 |
|
442 |
|
|
|
443 |
|
# Strip out --no-create and --no-recursion so they do not pile up. |
|
444 |
|
# Also quote any args containing shell metacharacters. |
|
445 |
|
ac_configure_args= |
|
446 |
|
for ac_arg |
|
447 |
|
do |
|
448 |
|
case "$ac_arg" in |
|
449 |
|
-no-create | --no-create | --no-creat | --no-crea | --no-cre \ |
|
450 |
|
| --no-cr | --no-c) ;; |
|
451 |
|
-no-recursion | --no-recursion | --no-recursio | --no-recursi \ |
|
452 |
|
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; |
|
453 |
|
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) |
|
454 |
|
ac_configure_args="$ac_configure_args '$ac_arg'" ;; |
|
455 |
|
*) ac_configure_args="$ac_configure_args $ac_arg" ;; |
|
456 |
|
esac |
|
457 |
|
done |
|
458 |
|
|
|
459 |
|
# NLS nuisances. |
|
460 |
|
# Only set these to C if already set. These must not be set unconditionally |
|
461 |
|
# because not all systems understand e.g. LANG=C (notably SCO). |
|
462 |
|
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! |
|
463 |
|
# Non-C LC_CTYPE values break the ctype check. |
|
464 |
|
if test "${LANG+set}" = set; then LANG=C; export LANG; fi |
|
465 |
|
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi |
|
466 |
|
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi |
|
467 |
|
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi |
|
468 |
|
|
|
469 |
|
# confdefs.h avoids OS command line length limits that DEFS can exceed. |
|
470 |
|
rm -rf conftest* confdefs.h |
|
471 |
|
# AIX cpp loses on an empty file, so make sure it contains at least a newline. |
|
472 |
|
echo > confdefs.h |
|
473 |
|
|
|
474 |
|
# A filename unique to this package, relative to the directory that |
|
475 |
|
# configure is in, which we can look for to find out if srcdir is correct. |
|
476 |
|
ac_unique_file=configure.in |
|
477 |
|
|
|
478 |
|
# Find the source files, if location was not specified. |
|
479 |
|
if test -z "$srcdir"; then |
|
480 |
|
ac_srcdir_defaulted=yes |
|
481 |
|
# Try the directory containing this script, then its parent. |
|
482 |
|
ac_prog=$0 |
|
483 |
|
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` |
|
484 |
|
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. |
|
485 |
|
srcdir=$ac_confdir |
|
486 |
|
if test ! -r $srcdir/$ac_unique_file; then |
|
487 |
|
srcdir=.. |
|
488 |
|
fi |
|
489 |
|
else |
|
490 |
|
ac_srcdir_defaulted=no |
|
491 |
|
fi |
|
492 |
|
if test ! -r $srcdir/$ac_unique_file; then |
|
493 |
|
if test "$ac_srcdir_defaulted" = yes; then |
|
494 |
|
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } |
|
495 |
|
else |
|
496 |
|
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } |
|
497 |
|
fi |
|
498 |
|
fi |
|
499 |
|
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` |
|
500 |
|
|
|
501 |
|
# Prefer explicitly selected file to automatically selected ones. |
|
502 |
|
if test -z "$CONFIG_SITE"; then |
|
503 |
|
if test "x$prefix" != xNONE; then |
|
504 |
|
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" |
|
505 |
|
else |
|
506 |
|
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" |
|
507 |
|
fi |
|
508 |
|
fi |
|
509 |
|
for ac_site_file in $CONFIG_SITE; do |
|
510 |
|
if test -r "$ac_site_file"; then |
|
511 |
|
echo "loading site script $ac_site_file" |
|
512 |
|
. "$ac_site_file" |
|
513 |
|
fi |
|
514 |
|
done |
|
515 |
|
|
|
516 |
|
if test -r "$cache_file"; then |
|
517 |
|
echo "loading cache $cache_file" |
|
518 |
|
. $cache_file |
|
519 |
|
else |
|
520 |
|
echo "creating cache $cache_file" |
|
521 |
|
> $cache_file |
|
522 |
|
fi |
|
523 |
|
|
|
524 |
|
ac_ext=c |
|
525 |
|
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
|
526 |
|
ac_cpp='$CPP $CPPFLAGS' |
|
527 |
|
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
|
528 |
|
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' |
|
529 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
530 |
|
|
|
531 |
|
ac_exeext= |
|
532 |
|
ac_objext=o |
|
533 |
|
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then |
|
534 |
|
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. |
|
535 |
|
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then |
|
536 |
|
ac_n= ac_c=' |
|
537 |
|
' ac_t=' ' |
|
538 |
|
else |
|
539 |
|
ac_n=-n ac_c= ac_t= |
|
540 |
|
fi |
|
541 |
|
else |
|
542 |
|
ac_n= ac_c='\c' ac_t= |
|
543 |
|
fi |
|
544 |
|
|
|
545 |
|
|
|
546 |
|
ac_aux_dir= |
|
547 |
|
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do |
|
548 |
|
if test -f $ac_dir/install-sh; then |
|
549 |
|
ac_aux_dir=$ac_dir |
|
550 |
|
ac_install_sh="$ac_aux_dir/install-sh -c" |
|
551 |
|
break |
|
552 |
|
elif test -f $ac_dir/install.sh; then |
|
553 |
|
ac_aux_dir=$ac_dir |
|
554 |
|
ac_install_sh="$ac_aux_dir/install.sh -c" |
|
555 |
|
break |
|
556 |
|
fi |
|
557 |
|
done |
|
558 |
|
if test -z "$ac_aux_dir"; then |
|
559 |
|
{ echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } |
|
560 |
|
fi |
|
561 |
|
ac_config_guess=$ac_aux_dir/config.guess |
|
562 |
|
ac_config_sub=$ac_aux_dir/config.sub |
|
563 |
|
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. |
|
564 |
|
|
|
565 |
|
# Find a good install program. We prefer a C program (faster), |
|
566 |
|
# so one script is as good as another. But avoid the broken or |
|
567 |
|
# incompatible versions: |
|
568 |
|
# SysV /etc/install, /usr/sbin/install |
|
569 |
|
# SunOS /usr/etc/install |
|
570 |
|
# IRIX /sbin/install |
|
571 |
|
# AIX /bin/install |
|
572 |
|
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag |
|
573 |
|
# AFS /usr/afsws/bin/install, which mishandles nonexistent args |
|
574 |
|
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" |
|
575 |
|
# ./install, which can be erroneously created by make from ./install.sh. |
|
576 |
|
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 |
|
577 |
|
echo "configure:578: checking for a BSD compatible install" >&5 |
|
578 |
|
if test -z "$INSTALL"; then |
|
579 |
|
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then |
|
580 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
581 |
|
else |
|
582 |
|
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" |
|
583 |
|
for ac_dir in $PATH; do |
|
584 |
|
# Account for people who put trailing slashes in PATH elements. |
|
585 |
|
case "$ac_dir/" in |
|
586 |
|
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; |
|
587 |
|
*) |
|
588 |
|
# OSF1 and SCO ODT 3.0 have their own names for install. |
|
589 |
|
# Don't use installbsd from OSF since it installs stuff as root |
|
590 |
|
# by default. |
|
591 |
|
for ac_prog in ginstall scoinst install; do |
|
592 |
|
if test -f $ac_dir/$ac_prog; then |
|
593 |
|
if test $ac_prog = install && |
|
594 |
|
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then |
|
595 |
|
# AIX install. It has an incompatible calling convention. |
|
596 |
|
: |
|
597 |
|
else |
|
598 |
|
ac_cv_path_install="$ac_dir/$ac_prog -c" |
|
599 |
|
break 2 |
|
600 |
|
fi |
|
601 |
|
fi |
|
602 |
|
done |
|
603 |
|
;; |
|
604 |
|
esac |
|
605 |
|
done |
|
606 |
|
IFS="$ac_save_IFS" |
|
607 |
|
|
|
608 |
|
fi |
|
609 |
|
if test "${ac_cv_path_install+set}" = set; then |
|
610 |
|
INSTALL="$ac_cv_path_install" |
|
611 |
|
else |
|
612 |
|
# As a last resort, use the slow shell script. We don't cache a |
|
613 |
|
# path for INSTALL within a source directory, because that will |
|
614 |
|
# break other packages using the cache if that directory is |
|
615 |
|
# removed, or if the path is relative. |
|
616 |
|
INSTALL="$ac_install_sh" |
|
617 |
|
fi |
|
618 |
|
fi |
|
619 |
|
echo "$ac_t""$INSTALL" 1>&6 |
|
620 |
|
|
|
621 |
|
# Use test -z because SunOS4 sh mishandles braces in ${var-val}. |
|
622 |
|
# It thinks the first close brace ends the variable substitution. |
|
623 |
|
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' |
|
624 |
|
|
|
625 |
|
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' |
|
626 |
|
|
|
627 |
|
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' |
|
628 |
|
|
|
629 |
|
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 |
|
630 |
|
echo "configure:631: checking whether build environment is sane" >&5 |
|
631 |
|
# Just in case |
|
632 |
|
sleep 1 |
|
633 |
|
echo timestamp > conftestfile |
|
634 |
|
# Do `set' in a subshell so we don't clobber the current shell's |
|
635 |
|
# arguments. Must try -L first in case configure is actually a |
|
636 |
|
# symlink; some systems play weird games with the mod time of symlinks |
|
637 |
|
# (eg FreeBSD returns the mod time of the symlink's containing |
|
638 |
|
# directory). |
|
639 |
|
if ( |
|
640 |
|
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` |
|
641 |
|
if test "$*" = "X"; then |
|
642 |
|
# -L didn't work. |
|
643 |
|
set X `ls -t $srcdir/configure conftestfile` |
|
644 |
|
fi |
|
645 |
|
if test "$*" != "X $srcdir/configure conftestfile" \ |
|
646 |
|
&& test "$*" != "X conftestfile $srcdir/configure"; then |
|
647 |
|
|
|
648 |
|
# If neither matched, then we have a broken ls. This can happen |
|
649 |
|
# if, for instance, CONFIG_SHELL is bash and it inherits a |
|
650 |
|
# broken ls alias from the environment. This has actually |
|
651 |
|
# happened. Such a system could not be considered "sane". |
|
652 |
|
{ echo "configure: error: ls -t appears to fail. Make sure there is not a broken |
|
653 |
|
alias in your environment" 1>&2; exit 1; } |
|
654 |
|
fi |
|
655 |
|
|
|
656 |
|
test "$2" = conftestfile |
|
657 |
|
) |
|
658 |
|
then |
|
659 |
|
# Ok. |
|
660 |
|
: |
|
661 |
|
else |
|
662 |
|
{ echo "configure: error: newly created file is older than distributed files! |
|
663 |
|
Check your system clock" 1>&2; exit 1; } |
|
664 |
|
fi |
|
665 |
|
rm -f conftest* |
|
666 |
|
echo "$ac_t""yes" 1>&6 |
|
667 |
|
if test "$program_transform_name" = s,x,x,; then |
|
668 |
|
program_transform_name= |
|
669 |
|
else |
|
670 |
|
# Double any \ or $. echo might interpret backslashes. |
|
671 |
|
cat <<\EOF_SED > conftestsed |
|
672 |
|
s,\\,\\\\,g; s,\$,$$,g |
|
673 |
|
EOF_SED |
|
674 |
|
program_transform_name="`echo $program_transform_name|sed -f conftestsed`" |
|
675 |
|
rm -f conftestsed |
|
676 |
|
fi |
|
677 |
|
test "$program_prefix" != NONE && |
|
678 |
|
program_transform_name="s,^,${program_prefix},; $program_transform_name" |
|
679 |
|
# Use a double $ so make ignores it. |
|
680 |
|
test "$program_suffix" != NONE && |
|
681 |
|
program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" |
|
682 |
|
|
|
683 |
|
# sed with no file args requires a program. |
|
684 |
|
test "$program_transform_name" = "" && program_transform_name="s,x,x," |
|
685 |
|
|
|
686 |
|
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 |
|
687 |
|
echo "configure:688: checking whether ${MAKE-make} sets \${MAKE}" >&5 |
|
688 |
|
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` |
|
689 |
|
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then |
|
690 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
691 |
|
else |
|
692 |
|
cat > conftestmake <<\EOF |
|
693 |
|
all: |
|
694 |
|
@echo 'ac_maketemp="${MAKE}"' |
|
695 |
|
EOF |
|
696 |
|
# GNU make sometimes prints "make[1]: Entering...", which would confuse us. |
|
697 |
|
eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` |
|
698 |
|
if test -n "$ac_maketemp"; then |
|
699 |
|
eval ac_cv_prog_make_${ac_make}_set=yes |
|
700 |
|
else |
|
701 |
|
eval ac_cv_prog_make_${ac_make}_set=no |
|
702 |
|
fi |
|
703 |
|
rm -f conftestmake |
|
704 |
|
fi |
|
705 |
|
if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then |
|
706 |
|
echo "$ac_t""yes" 1>&6 |
|
707 |
|
SET_MAKE= |
|
708 |
|
else |
|
709 |
|
echo "$ac_t""no" 1>&6 |
|
710 |
|
SET_MAKE="MAKE=${MAKE-make}" |
|
711 |
|
fi |
|
712 |
|
|
|
713 |
|
|
|
714 |
|
|
|
715 |
|
PACKAGE=vide |
|
716 |
|
|
|
717 |
|
VERSION=0.5.2 |
|
718 |
|
|
|
719 |
|
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
|
720 |
|
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } |
|
721 |
|
fi |
|
722 |
|
cat >> confdefs.h <<EOF |
|
723 |
|
#define PACKAGE "$PACKAGE" |
|
724 |
|
EOF |
|
725 |
|
|
|
726 |
|
cat >> confdefs.h <<EOF |
|
727 |
|
#define VERSION "$VERSION" |
|
728 |
|
EOF |
|
729 |
|
|
|
730 |
|
|
|
731 |
|
|
|
732 |
|
missing_dir=`cd $ac_aux_dir && pwd` |
|
733 |
|
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 |
|
734 |
|
echo "configure:735: checking for working aclocal" >&5 |
|
735 |
|
# Run test in a subshell; some versions of sh will print an error if |
|
736 |
|
# an executable is not found, even if stderr is redirected. |
|
737 |
|
# Redirect stdin to placate older versions of autoconf. Sigh. |
|
738 |
|
if (aclocal --version) < /dev/null > /dev/null 2>&1; then |
|
739 |
|
ACLOCAL=aclocal |
|
740 |
|
echo "$ac_t""found" 1>&6 |
|
741 |
|
else |
|
742 |
|
ACLOCAL="$missing_dir/missing aclocal" |
|
743 |
|
echo "$ac_t""missing" 1>&6 |
|
744 |
|
fi |
|
745 |
|
|
|
746 |
|
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 |
|
747 |
|
echo "configure:748: checking for working autoconf" >&5 |
|
748 |
|
# Run test in a subshell; some versions of sh will print an error if |
|
749 |
|
# an executable is not found, even if stderr is redirected. |
|
750 |
|
# Redirect stdin to placate older versions of autoconf. Sigh. |
|
751 |
|
if (autoconf --version) < /dev/null > /dev/null 2>&1; then |
|
752 |
|
AUTOCONF=autoconf |
|
753 |
|
echo "$ac_t""found" 1>&6 |
|
754 |
|
else |
|
755 |
|
AUTOCONF="$missing_dir/missing autoconf" |
|
756 |
|
echo "$ac_t""missing" 1>&6 |
|
757 |
|
fi |
|
758 |
|
|
|
759 |
|
echo $ac_n "checking for working automake""... $ac_c" 1>&6 |
|
760 |
|
echo "configure:761: checking for working automake" >&5 |
|
761 |
|
# Run test in a subshell; some versions of sh will print an error if |
|
762 |
|
# an executable is not found, even if stderr is redirected. |
|
763 |
|
# Redirect stdin to placate older versions of autoconf. Sigh. |
|
764 |
|
if (automake --version) < /dev/null > /dev/null 2>&1; then |
|
765 |
|
AUTOMAKE=automake |
|
766 |
|
echo "$ac_t""found" 1>&6 |
|
767 |
|
else |
|
768 |
|
AUTOMAKE="$missing_dir/missing automake" |
|
769 |
|
echo "$ac_t""missing" 1>&6 |
|
770 |
|
fi |
|
771 |
|
|
|
772 |
|
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 |
|
773 |
|
echo "configure:774: checking for working autoheader" >&5 |
|
774 |
|
# Run test in a subshell; some versions of sh will print an error if |
|
775 |
|
# an executable is not found, even if stderr is redirected. |
|
776 |
|
# Redirect stdin to placate older versions of autoconf. Sigh. |
|
777 |
|
if (autoheader --version) < /dev/null > /dev/null 2>&1; then |
|
778 |
|
AUTOHEADER=autoheader |
|
779 |
|
echo "$ac_t""found" 1>&6 |
|
780 |
|
else |
|
781 |
|
AUTOHEADER="$missing_dir/missing autoheader" |
|
782 |
|
echo "$ac_t""missing" 1>&6 |
|
783 |
|
fi |
|
784 |
|
|
|
785 |
|
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 |
|
786 |
|
echo "configure:787: checking for working makeinfo" >&5 |
|
787 |
|
# Run test in a subshell; some versions of sh will print an error if |
|
788 |
|
# an executable is not found, even if stderr is redirected. |
|
789 |
|
# Redirect stdin to placate older versions of autoconf. Sigh. |
|
790 |
|
if (makeinfo --version) < /dev/null > /dev/null 2>&1; then |
|
791 |
|
MAKEINFO=makeinfo |
|
792 |
|
echo "$ac_t""found" 1>&6 |
|
793 |
|
else |
|
794 |
|
MAKEINFO="$missing_dir/missing makeinfo" |
|
795 |
|
echo "$ac_t""missing" 1>&6 |
|
796 |
|
fi |
|
797 |
|
|
|
798 |
|
|
|
799 |
|
|
|
800 |
|
|
|
801 |
|
|
|
802 |
|
|
|
803 |
|
|
|
804 |
|
|
|
805 |
|
|
|
806 |
|
if test x = y; then |
|
807 |
|
INSIDE_GNOME_COMMON_TRUE= |
|
808 |
|
INSIDE_GNOME_COMMON_FALSE='#' |
|
809 |
|
else |
|
810 |
|
INSIDE_GNOME_COMMON_TRUE='#' |
|
811 |
|
INSIDE_GNOME_COMMON_FALSE= |
|
812 |
|
fi |
|
813 |
|
|
|
814 |
|
test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" |
|
815 |
|
|
|
816 |
|
for k in macros ; do ACLOCAL="$ACLOCAL -I $k" ; done |
|
817 |
|
|
|
818 |
|
|
|
819 |
|
|
|
820 |
|
|
|
821 |
|
|
|
822 |
|
|
|
823 |
|
|
|
824 |
|
|
|
825 |
|
|
|
826 |
|
|
|
827 |
|
|
|
828 |
|
|
|
829 |
|
# Check whether --with-gnome-includes or --without-gnome-includes was given. |
|
830 |
|
if test "${with_gnome_includes+set}" = set; then |
|
831 |
|
withval="$with_gnome_includes" |
|
832 |
|
|
|
833 |
|
CFLAGS="$CFLAGS -I$withval" |
|
834 |
|
|
|
835 |
|
fi |
|
836 |
|
|
|
837 |
|
|
|
838 |
|
# Check whether --with-gnome-libs or --without-gnome-libs was given. |
|
839 |
|
if test "${with_gnome_libs+set}" = set; then |
|
840 |
|
withval="$with_gnome_libs" |
|
841 |
|
|
|
842 |
|
LDFLAGS="$LDFLAGS -L$withval" |
|
843 |
|
gnome_prefix=$withval |
|
844 |
|
|
|
845 |
|
fi |
|
846 |
|
|
|
847 |
|
|
|
848 |
|
# Check whether --with-gnome or --without-gnome was given. |
|
849 |
|
if test "${with_gnome+set}" = set; then |
|
850 |
|
withval="$with_gnome" |
|
851 |
|
if test x$withval = xyes; then |
|
852 |
|
want_gnome=yes |
|
853 |
|
: |
|
854 |
|
else |
|
855 |
|
if test "x$withval" = xno; then |
|
856 |
|
want_gnome=no |
|
857 |
|
else |
|
858 |
|
want_gnome=yes |
|
859 |
|
LDFLAGS="$LDFLAGS -L$withval/lib" |
|
860 |
|
CFLAGS="$CFLAGS -I$withval/include" |
|
861 |
|
gnome_prefix=$withval/lib |
|
862 |
|
fi |
|
863 |
|
fi |
|
864 |
|
else |
|
865 |
|
want_gnome=yes |
|
866 |
|
fi |
|
867 |
|
|
|
868 |
|
|
|
869 |
|
if test "x$want_gnome" = xyes; then |
|
870 |
|
|
|
871 |
|
# Extract the first word of "gnome-config", so it can be a program name with args. |
|
872 |
|
set dummy gnome-config; ac_word=$2 |
|
873 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
874 |
|
echo "configure:875: checking for $ac_word" >&5 |
|
875 |
|
if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then |
|
876 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
877 |
|
else |
|
878 |
|
case "$GNOME_CONFIG" in |
|
879 |
|
/*) |
|
880 |
|
ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a path. |
|
881 |
|
;; |
|
882 |
|
?:/*) |
|
883 |
|
ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a dos path. |
|
884 |
|
;; |
|
885 |
|
*) |
|
886 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
887 |
|
ac_dummy="$PATH" |
|
888 |
|
for ac_dir in $ac_dummy; do |
|
889 |
|
test -z "$ac_dir" && ac_dir=. |
|
890 |
|
if test -f $ac_dir/$ac_word; then |
|
891 |
|
ac_cv_path_GNOME_CONFIG="$ac_dir/$ac_word" |
|
892 |
|
break |
|
893 |
|
fi |
|
894 |
|
done |
|
895 |
|
IFS="$ac_save_ifs" |
|
896 |
|
test -z "$ac_cv_path_GNOME_CONFIG" && ac_cv_path_GNOME_CONFIG="no" |
|
897 |
|
;; |
|
898 |
|
esac |
|
899 |
|
fi |
|
900 |
|
GNOME_CONFIG="$ac_cv_path_GNOME_CONFIG" |
|
901 |
|
if test -n "$GNOME_CONFIG"; then |
|
902 |
|
echo "$ac_t""$GNOME_CONFIG" 1>&6 |
|
903 |
|
else |
|
904 |
|
echo "$ac_t""no" 1>&6 |
|
905 |
|
fi |
|
906 |
|
|
|
907 |
|
if test "$GNOME_CONFIG" = "no"; then |
|
908 |
|
no_gnome_config="yes" |
|
909 |
|
else |
|
910 |
|
echo $ac_n "checking if $GNOME_CONFIG works""... $ac_c" 1>&6 |
|
911 |
|
echo "configure:912: checking if $GNOME_CONFIG works" >&5 |
|
912 |
|
if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then |
|
913 |
|
echo "$ac_t""yes" 1>&6 |
|
914 |
|
|
|
915 |
|
|
|
916 |
|
# Extract the first word of "orbit-config", so it can be a program name with args. |
|
917 |
|
set dummy orbit-config; ac_word=$2 |
|
918 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
919 |
|
echo "configure:920: checking for $ac_word" >&5 |
|
920 |
|
if eval "test \"`echo '$''{'ac_cv_path_ORBIT_CONFIG'+set}'`\" = set"; then |
|
921 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
922 |
|
else |
|
923 |
|
case "$ORBIT_CONFIG" in |
|
924 |
|
/*) |
|
925 |
|
ac_cv_path_ORBIT_CONFIG="$ORBIT_CONFIG" # Let the user override the test with a path. |
|
926 |
|
;; |
|
927 |
|
?:/*) |
|
928 |
|
ac_cv_path_ORBIT_CONFIG="$ORBIT_CONFIG" # Let the user override the test with a dos path. |
|
929 |
|
;; |
|
930 |
|
*) |
|
931 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
932 |
|
ac_dummy="$PATH" |
|
933 |
|
for ac_dir in $ac_dummy; do |
|
934 |
|
test -z "$ac_dir" && ac_dir=. |
|
935 |
|
if test -f $ac_dir/$ac_word; then |
|
936 |
|
ac_cv_path_ORBIT_CONFIG="$ac_dir/$ac_word" |
|
937 |
|
break |
|
938 |
|
fi |
|
939 |
|
done |
|
940 |
|
IFS="$ac_save_ifs" |
|
941 |
|
test -z "$ac_cv_path_ORBIT_CONFIG" && ac_cv_path_ORBIT_CONFIG="no" |
|
942 |
|
;; |
|
943 |
|
esac |
|
944 |
|
fi |
|
945 |
|
ORBIT_CONFIG="$ac_cv_path_ORBIT_CONFIG" |
|
946 |
|
if test -n "$ORBIT_CONFIG"; then |
|
947 |
|
echo "$ac_t""$ORBIT_CONFIG" 1>&6 |
|
948 |
|
else |
|
949 |
|
echo "$ac_t""no" 1>&6 |
|
950 |
|
fi |
|
951 |
|
|
|
952 |
|
# Extract the first word of "orbit-idl", so it can be a program name with args. |
|
953 |
|
set dummy orbit-idl; ac_word=$2 |
|
954 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
955 |
|
echo "configure:956: checking for $ac_word" >&5 |
|
956 |
|
if eval "test \"`echo '$''{'ac_cv_path_ORBIT_IDL'+set}'`\" = set"; then |
|
957 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
958 |
|
else |
|
959 |
|
case "$ORBIT_IDL" in |
|
960 |
|
/*) |
|
961 |
|
ac_cv_path_ORBIT_IDL="$ORBIT_IDL" # Let the user override the test with a path. |
|
962 |
|
;; |
|
963 |
|
?:/*) |
|
964 |
|
ac_cv_path_ORBIT_IDL="$ORBIT_IDL" # Let the user override the test with a dos path. |
|
965 |
|
;; |
|
966 |
|
*) |
|
967 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
968 |
|
ac_dummy="$PATH" |
|
969 |
|
for ac_dir in $ac_dummy; do |
|
970 |
|
test -z "$ac_dir" && ac_dir=. |
|
971 |
|
if test -f $ac_dir/$ac_word; then |
|
972 |
|
ac_cv_path_ORBIT_IDL="$ac_dir/$ac_word" |
|
973 |
|
break |
|
974 |
|
fi |
|
975 |
|
done |
|
976 |
|
IFS="$ac_save_ifs" |
|
977 |
|
test -z "$ac_cv_path_ORBIT_IDL" && ac_cv_path_ORBIT_IDL="no" |
|
978 |
|
;; |
|
979 |
|
esac |
|
980 |
|
fi |
|
981 |
|
ORBIT_IDL="$ac_cv_path_ORBIT_IDL" |
|
982 |
|
if test -n "$ORBIT_IDL"; then |
|
983 |
|
echo "$ac_t""$ORBIT_IDL" 1>&6 |
|
984 |
|
else |
|
985 |
|
echo "$ac_t""no" 1>&6 |
|
986 |
|
fi |
|
987 |
|
|
|
988 |
|
echo $ac_n "checking for working ORBit environment""... $ac_c" 1>&6 |
|
989 |
|
echo "configure:990: checking for working ORBit environment" >&5 |
|
990 |
|
if eval "test \"`echo '$''{'gnome_cv_orbit_found'+set}'`\" = set"; then |
|
991 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
992 |
|
else |
|
993 |
|
|
|
994 |
|
if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then |
|
995 |
|
gnome_cv_orbit_found=no |
|
996 |
|
else |
|
997 |
|
gnome_cv_orbit_found=yes |
|
998 |
|
fi |
|
999 |
|
|
|
1000 |
|
fi |
|
1001 |
|
|
|
1002 |
|
echo "$ac_t""$gnome_cv_orbit_found" 1>&6 |
|
1003 |
|
|
|
1004 |
|
|
|
1005 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
1006 |
|
HAVE_ORBIT_TRUE= |
|
1007 |
|
HAVE_ORBIT_FALSE='#' |
|
1008 |
|
else |
|
1009 |
|
HAVE_ORBIT_TRUE='#' |
|
1010 |
|
HAVE_ORBIT_FALSE= |
|
1011 |
|
fi |
|
1012 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
1013 |
|
|
|
1014 |
|
ORBIT_CFLAGS=`orbit-config --cflags client server` |
|
1015 |
|
ORBIT_LIBS=`orbit-config --use-service=name --libs client server` |
|
1016 |
|
|
|
1017 |
|
|
|
1018 |
|
else |
|
1019 |
|
if test xfail = xfailure; then |
|
1020 |
|
{ echo "configure: error: ORBit not installed or installation problem" 1>&2; exit 1; } |
|
1021 |
|
fi |
|
1022 |
|
fi |
|
1023 |
|
|
|
1024 |
|
echo $ac_n "checking for gnorba libraries""... $ac_c" 1>&6 |
|
1025 |
|
echo "configure:1026: checking for gnorba libraries" >&5 |
|
1026 |
|
if eval "test \"`echo '$''{'gnome_cv_gnorba_found'+set}'`\" = set"; then |
|
1027 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1028 |
|
else |
|
1029 |
|
|
|
1030 |
|
gnome_cv_gnorba_found=no |
|
1031 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
1032 |
|
GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" |
|
1033 |
|
GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" |
|
1034 |
|
if test -n "$GNORBA_LIBS"; then |
|
1035 |
|
gnome_cv_gnorba_found=yes |
|
1036 |
|
fi |
|
1037 |
|
fi |
|
1038 |
|
|
|
1039 |
|
fi |
|
1040 |
|
|
|
1041 |
|
echo "$ac_t""$gnome_cv_gnorba_found" 1>&6 |
|
1042 |
|
|
|
1043 |
|
|
|
1044 |
|
if test x$gnome_cv_gnorba_found = xyes; then |
|
1045 |
|
HAVE_GNORBA_TRUE= |
|
1046 |
|
HAVE_GNORBA_FALSE='#' |
|
1047 |
|
else |
|
1048 |
|
HAVE_GNORBA_TRUE='#' |
|
1049 |
|
HAVE_GNORBA_FALSE= |
|
1050 |
|
fi |
|
1051 |
|
if test x$gnome_cv_orbit_found = xyes; then |
|
1052 |
|
|
|
1053 |
|
GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`" |
|
1054 |
|
GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`" |
|
1055 |
|
|
|
1056 |
|
|
|
1057 |
|
else |
|
1058 |
|
if test xfail = xfailure; then |
|
1059 |
|
{ echo "configure: error: gnorba library not installed or installation problem" 1>&2; exit 1; } |
|
1060 |
|
fi |
|
1061 |
|
fi |
|
1062 |
|
|
|
1063 |
|
GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`" |
|
1064 |
|
GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`" |
|
1065 |
|
GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`" |
|
1066 |
|
GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`" |
|
1067 |
|
ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`" |
|
1068 |
|
GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`" |
|
1069 |
|
GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`" |
|
1070 |
|
|
|
1071 |
|
else |
|
1072 |
|
echo "$ac_t""no" 1>&6 |
|
1073 |
|
no_gnome_config="yes" |
|
1074 |
|
fi |
|
1075 |
|
fi |
|
1076 |
|
|
|
1077 |
|
if test x$exec_prefix = xNONE; then |
|
1078 |
|
if test x$prefix = xNONE; then |
|
1079 |
|
gnome_prefix=$ac_default_prefix/lib |
|
1080 |
|
else |
|
1081 |
|
gnome_prefix=$prefix/lib |
|
1082 |
|
fi |
|
1083 |
|
else |
|
1084 |
|
gnome_prefix=`eval echo \`echo $libdir\`` |
|
1085 |
|
fi |
|
1086 |
|
|
|
1087 |
|
if test "$no_gnome_config" = "yes"; then |
|
1088 |
|
echo $ac_n "checking for gnomeConf.sh file in $gnome_prefix""... $ac_c" 1>&6 |
|
1089 |
|
echo "configure:1090: checking for gnomeConf.sh file in $gnome_prefix" >&5 |
|
1090 |
|
if test -f $gnome_prefix/gnomeConf.sh; then |
|
1091 |
|
echo "$ac_t""found" 1>&6 |
|
1092 |
|
echo "loading gnome configuration from" \ |
|
1093 |
|
"$gnome_prefix/gnomeConf.sh" |
|
1094 |
|
. $gnome_prefix/gnomeConf.sh |
|
1095 |
|
|
|
1096 |
|
else |
|
1097 |
|
echo "$ac_t""not found" 1>&6 |
|
1098 |
|
if test xfail = xfail; then |
|
1099 |
|
{ echo "configure: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install" 1>&2; exit 1; } |
|
1100 |
|
fi |
|
1101 |
|
fi |
|
1102 |
|
fi |
|
1103 |
|
fi |
|
1104 |
|
|
|
1105 |
|
if test -n ""; then |
|
1106 |
|
n="" |
|
1107 |
|
for i in $n; do |
|
1108 |
|
echo $ac_n "checking extra library \"$i\"""... $ac_c" 1>&6 |
|
1109 |
|
echo "configure:1110: checking extra library \"$i\"" >&5 |
|
1110 |
|
case $i in |
|
1111 |
|
applets) |
|
1112 |
|
|
|
1113 |
|
GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets` |
|
1114 |
|
echo "$ac_t""$GNOME_APPLETS_LIBS" 1>&6;; |
|
1115 |
|
docklets) |
|
1116 |
|
|
|
1117 |
|
GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets` |
|
1118 |
|
echo "$ac_t""$GNOME_DOCKLETS_LIBS" 1>&6;; |
|
1119 |
|
capplet) |
|
1120 |
|
|
|
1121 |
|
GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet` |
|
1122 |
|
echo "$ac_t""$GNOME_CAPPLET_LIBS" 1>&6;; |
|
1123 |
|
*) |
|
1124 |
|
echo "$ac_t""unknown library" 1>&6 |
|
1125 |
|
esac |
|
1126 |
|
done |
|
1127 |
|
fi |
|
1128 |
|
|
|
1129 |
|
|
|
1130 |
|
# Extract the first word of "gcc", so it can be a program name with args. |
|
1131 |
|
set dummy gcc; ac_word=$2 |
|
1132 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
1133 |
|
echo "configure:1134: checking for $ac_word" >&5 |
|
1134 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
|
1135 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1136 |
|
else |
|
1137 |
|
if test -n "$CC"; then |
|
1138 |
|
ac_cv_prog_CC="$CC" # Let the user override the test. |
|
1139 |
|
else |
|
1140 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
1141 |
|
ac_dummy="$PATH" |
|
1142 |
|
for ac_dir in $ac_dummy; do |
|
1143 |
|
test -z "$ac_dir" && ac_dir=. |
|
1144 |
|
if test -f $ac_dir/$ac_word; then |
|
1145 |
|
ac_cv_prog_CC="gcc" |
|
1146 |
|
break |
|
1147 |
|
fi |
|
1148 |
|
done |
|
1149 |
|
IFS="$ac_save_ifs" |
|
1150 |
|
fi |
|
1151 |
|
fi |
|
1152 |
|
CC="$ac_cv_prog_CC" |
|
1153 |
|
if test -n "$CC"; then |
|
1154 |
|
echo "$ac_t""$CC" 1>&6 |
|
1155 |
|
else |
|
1156 |
|
echo "$ac_t""no" 1>&6 |
|
1157 |
|
fi |
|
1158 |
|
|
|
1159 |
|
if test -z "$CC"; then |
|
1160 |
|
# Extract the first word of "cc", so it can be a program name with args. |
|
1161 |
|
set dummy cc; ac_word=$2 |
|
1162 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
1163 |
|
echo "configure:1164: checking for $ac_word" >&5 |
|
1164 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
|
1165 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1166 |
|
else |
|
1167 |
|
if test -n "$CC"; then |
|
1168 |
|
ac_cv_prog_CC="$CC" # Let the user override the test. |
|
1169 |
|
else |
|
1170 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
1171 |
|
ac_prog_rejected=no |
|
1172 |
|
ac_dummy="$PATH" |
|
1173 |
|
for ac_dir in $ac_dummy; do |
|
1174 |
|
test -z "$ac_dir" && ac_dir=. |
|
1175 |
|
if test -f $ac_dir/$ac_word; then |
|
1176 |
|
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then |
|
1177 |
|
ac_prog_rejected=yes |
|
1178 |
|
continue |
|
1179 |
|
fi |
|
1180 |
|
ac_cv_prog_CC="cc" |
|
1181 |
|
break |
|
1182 |
|
fi |
|
1183 |
|
done |
|
1184 |
|
IFS="$ac_save_ifs" |
|
1185 |
|
if test $ac_prog_rejected = yes; then |
|
1186 |
|
# We found a bogon in the path, so make sure we never use it. |
|
1187 |
|
set dummy $ac_cv_prog_CC |
|
1188 |
|
shift |
|
1189 |
|
if test $# -gt 0; then |
|
1190 |
|
# We chose a different compiler from the bogus one. |
|
1191 |
|
# However, it has the same basename, so the bogon will be chosen |
|
1192 |
|
# first if we set CC to just the basename; use the full file name. |
|
1193 |
|
shift |
|
1194 |
|
set dummy "$ac_dir/$ac_word" "$@" |
|
1195 |
|
shift |
|
1196 |
|
ac_cv_prog_CC="$@" |
|
1197 |
|
fi |
|
1198 |
|
fi |
|
1199 |
|
fi |
|
1200 |
|
fi |
|
1201 |
|
CC="$ac_cv_prog_CC" |
|
1202 |
|
if test -n "$CC"; then |
|
1203 |
|
echo "$ac_t""$CC" 1>&6 |
|
1204 |
|
else |
|
1205 |
|
echo "$ac_t""no" 1>&6 |
|
1206 |
|
fi |
|
1207 |
|
|
|
1208 |
|
if test -z "$CC"; then |
|
1209 |
|
case "`uname -s`" in |
|
1210 |
|
*win32* | *WIN32*) |
|
1211 |
|
# Extract the first word of "cl", so it can be a program name with args. |
|
1212 |
|
set dummy cl; ac_word=$2 |
|
1213 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
1214 |
|
echo "configure:1215: checking for $ac_word" >&5 |
|
1215 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
|
1216 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1217 |
|
else |
|
1218 |
|
if test -n "$CC"; then |
|
1219 |
|
ac_cv_prog_CC="$CC" # Let the user override the test. |
|
1220 |
|
else |
|
1221 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
1222 |
|
ac_dummy="$PATH" |
|
1223 |
|
for ac_dir in $ac_dummy; do |
|
1224 |
|
test -z "$ac_dir" && ac_dir=. |
|
1225 |
|
if test -f $ac_dir/$ac_word; then |
|
1226 |
|
ac_cv_prog_CC="cl" |
|
1227 |
|
break |
|
1228 |
|
fi |
|
1229 |
|
done |
|
1230 |
|
IFS="$ac_save_ifs" |
|
1231 |
|
fi |
|
1232 |
|
fi |
|
1233 |
|
CC="$ac_cv_prog_CC" |
|
1234 |
|
if test -n "$CC"; then |
|
1235 |
|
echo "$ac_t""$CC" 1>&6 |
|
1236 |
|
else |
|
1237 |
|
echo "$ac_t""no" 1>&6 |
|
1238 |
|
fi |
|
1239 |
|
;; |
|
1240 |
|
esac |
|
1241 |
|
fi |
|
1242 |
|
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } |
|
1243 |
|
fi |
|
1244 |
|
|
|
1245 |
|
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 |
|
1246 |
|
echo "configure:1247: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 |
|
1247 |
|
|
|
1248 |
|
ac_ext=c |
|
1249 |
|
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
|
1250 |
|
ac_cpp='$CPP $CPPFLAGS' |
|
1251 |
|
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
|
1252 |
|
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' |
|
1253 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
1254 |
|
|
|
1255 |
|
cat > conftest.$ac_ext << EOF |
|
1256 |
|
|
|
1257 |
|
#line 1258 "configure" |
|
1258 |
|
#include "confdefs.h" |
|
1259 |
|
|
|
1260 |
|
main(){return(0);} |
|
1261 |
|
EOF |
|
1262 |
|
if { (eval echo configure:1263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
1263 |
|
ac_cv_prog_cc_works=yes |
|
1264 |
|
# If we can't run a trivial program, we are probably using a cross compiler. |
|
1265 |
|
if (./conftest; exit) 2>/dev/null; then |
|
1266 |
|
ac_cv_prog_cc_cross=no |
|
1267 |
|
else |
|
1268 |
|
ac_cv_prog_cc_cross=yes |
|
1269 |
|
fi |
|
1270 |
|
else |
|
1271 |
|
echo "configure: failed program was:" >&5 |
|
1272 |
|
cat conftest.$ac_ext >&5 |
|
1273 |
|
ac_cv_prog_cc_works=no |
|
1274 |
|
fi |
|
1275 |
|
rm -fr conftest* |
|
1276 |
|
ac_ext=c |
|
1277 |
|
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
|
1278 |
|
ac_cpp='$CPP $CPPFLAGS' |
|
1279 |
|
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
|
1280 |
|
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' |
|
1281 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
1282 |
|
|
|
1283 |
|
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 |
|
1284 |
|
if test $ac_cv_prog_cc_works = no; then |
|
1285 |
|
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } |
|
1286 |
|
fi |
|
1287 |
|
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 |
|
1288 |
|
echo "configure:1289: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 |
|
1289 |
|
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 |
|
1290 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
1291 |
|
|
|
1292 |
|
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 |
|
1293 |
|
echo "configure:1294: checking whether we are using GNU C" >&5 |
|
1294 |
|
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then |
|
1295 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1296 |
|
else |
|
1297 |
|
cat > conftest.c <<EOF |
|
1298 |
|
#ifdef __GNUC__ |
|
1299 |
|
yes; |
|
1300 |
|
#endif |
|
1301 |
|
EOF |
|
1302 |
|
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then |
|
1303 |
|
ac_cv_prog_gcc=yes |
|
1304 |
|
else |
|
1305 |
|
ac_cv_prog_gcc=no |
|
1306 |
|
fi |
|
1307 |
|
fi |
|
1308 |
|
|
|
1309 |
|
echo "$ac_t""$ac_cv_prog_gcc" 1>&6 |
|
1310 |
|
|
|
1311 |
|
if test $ac_cv_prog_gcc = yes; then |
|
1312 |
|
GCC=yes |
|
1313 |
|
else |
|
1314 |
|
GCC= |
|
1315 |
|
fi |
|
1316 |
|
|
|
1317 |
|
ac_test_CFLAGS="${CFLAGS+set}" |
|
1318 |
|
ac_save_CFLAGS="$CFLAGS" |
|
1319 |
|
CFLAGS= |
|
1320 |
|
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 |
|
1321 |
|
echo "configure:1322: checking whether ${CC-cc} accepts -g" >&5 |
|
1322 |
|
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then |
|
1323 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1324 |
|
else |
|
1325 |
|
echo 'void f(){}' > conftest.c |
|
1326 |
|
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then |
|
1327 |
|
ac_cv_prog_cc_g=yes |
|
1328 |
|
else |
|
1329 |
|
ac_cv_prog_cc_g=no |
|
1330 |
|
fi |
|
1331 |
|
rm -f conftest* |
|
1332 |
|
|
|
1333 |
|
fi |
|
1334 |
|
|
|
1335 |
|
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 |
|
1336 |
|
if test "$ac_test_CFLAGS" = set; then |
|
1337 |
|
CFLAGS="$ac_save_CFLAGS" |
|
1338 |
|
elif test $ac_cv_prog_cc_g = yes; then |
|
1339 |
|
if test "$GCC" = yes; then |
|
1340 |
|
CFLAGS="-g -O2" |
|
1341 |
|
else |
|
1342 |
|
CFLAGS="-g" |
|
1343 |
|
fi |
|
1344 |
|
else |
|
1345 |
|
if test "$GCC" = yes; then |
|
1346 |
|
CFLAGS="-O2" |
|
1347 |
|
else |
|
1348 |
|
CFLAGS= |
|
1349 |
|
fi |
|
1350 |
|
fi |
|
1351 |
|
|
|
1352 |
|
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 |
|
1353 |
|
echo "configure:1354: checking for POSIXized ISC" >&5 |
|
1354 |
|
if test -d /etc/conf/kconfig.d && |
|
1355 |
|
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 |
|
1356 |
|
then |
|
1357 |
|
echo "$ac_t""yes" 1>&6 |
|
1358 |
|
ISC=yes # If later tests want to check for ISC. |
|
1359 |
|
cat >> confdefs.h <<\EOF |
|
1360 |
|
#define _POSIX_SOURCE 1 |
|
1361 |
|
EOF |
|
1362 |
|
|
|
1363 |
|
if test "$GCC" = yes; then |
|
1364 |
|
CC="$CC -posix" |
|
1365 |
|
else |
|
1366 |
|
CC="$CC -Xp" |
|
1367 |
|
fi |
|
1368 |
|
else |
|
1369 |
|
echo "$ac_t""no" 1>&6 |
|
1370 |
|
ISC= |
|
1371 |
|
fi |
|
1372 |
|
|
|
1373 |
|
# Extract the first word of "gcc", so it can be a program name with args. |
|
1374 |
|
set dummy gcc; ac_word=$2 |
|
1375 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
1376 |
|
echo "configure:1377: checking for $ac_word" >&5 |
|
1377 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
|
1378 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1379 |
|
else |
|
1380 |
|
if test -n "$CC"; then |
|
1381 |
|
ac_cv_prog_CC="$CC" # Let the user override the test. |
|
1382 |
|
else |
|
1383 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
1384 |
|
ac_dummy="$PATH" |
|
1385 |
|
for ac_dir in $ac_dummy; do |
|
1386 |
|
test -z "$ac_dir" && ac_dir=. |
|
1387 |
|
if test -f $ac_dir/$ac_word; then |
|
1388 |
|
ac_cv_prog_CC="gcc" |
|
1389 |
|
break |
|
1390 |
|
fi |
|
1391 |
|
done |
|
1392 |
|
IFS="$ac_save_ifs" |
|
1393 |
|
fi |
|
1394 |
|
fi |
|
1395 |
|
CC="$ac_cv_prog_CC" |
|
1396 |
|
if test -n "$CC"; then |
|
1397 |
|
echo "$ac_t""$CC" 1>&6 |
|
1398 |
|
else |
|
1399 |
|
echo "$ac_t""no" 1>&6 |
|
1400 |
|
fi |
|
1401 |
|
|
|
1402 |
|
if test -z "$CC"; then |
|
1403 |
|
# Extract the first word of "cc", so it can be a program name with args. |
|
1404 |
|
set dummy cc; ac_word=$2 |
|
1405 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
1406 |
|
echo "configure:1407: checking for $ac_word" >&5 |
|
1407 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
|
1408 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1409 |
|
else |
|
1410 |
|
if test -n "$CC"; then |
|
1411 |
|
ac_cv_prog_CC="$CC" # Let the user override the test. |
|
1412 |
|
else |
|
1413 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
1414 |
|
ac_prog_rejected=no |
|
1415 |
|
ac_dummy="$PATH" |
|
1416 |
|
for ac_dir in $ac_dummy; do |
|
1417 |
|
test -z "$ac_dir" && ac_dir=. |
|
1418 |
|
if test -f $ac_dir/$ac_word; then |
|
1419 |
|
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then |
|
1420 |
|
ac_prog_rejected=yes |
|
1421 |
|
continue |
|
1422 |
|
fi |
|
1423 |
|
ac_cv_prog_CC="cc" |
|
1424 |
|
break |
|
1425 |
|
fi |
|
1426 |
|
done |
|
1427 |
|
IFS="$ac_save_ifs" |
|
1428 |
|
if test $ac_prog_rejected = yes; then |
|
1429 |
|
# We found a bogon in the path, so make sure we never use it. |
|
1430 |
|
set dummy $ac_cv_prog_CC |
|
1431 |
|
shift |
|
1432 |
|
if test $# -gt 0; then |
|
1433 |
|
# We chose a different compiler from the bogus one. |
|
1434 |
|
# However, it has the same basename, so the bogon will be chosen |
|
1435 |
|
# first if we set CC to just the basename; use the full file name. |
|
1436 |
|
shift |
|
1437 |
|
set dummy "$ac_dir/$ac_word" "$@" |
|
1438 |
|
shift |
|
1439 |
|
ac_cv_prog_CC="$@" |
|
1440 |
|
fi |
|
1441 |
|
fi |
|
1442 |
|
fi |
|
1443 |
|
fi |
|
1444 |
|
CC="$ac_cv_prog_CC" |
|
1445 |
|
if test -n "$CC"; then |
|
1446 |
|
echo "$ac_t""$CC" 1>&6 |
|
1447 |
|
else |
|
1448 |
|
echo "$ac_t""no" 1>&6 |
|
1449 |
|
fi |
|
1450 |
|
|
|
1451 |
|
if test -z "$CC"; then |
|
1452 |
|
case "`uname -s`" in |
|
1453 |
|
*win32* | *WIN32*) |
|
1454 |
|
# Extract the first word of "cl", so it can be a program name with args. |
|
1455 |
|
set dummy cl; ac_word=$2 |
|
1456 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
1457 |
|
echo "configure:1458: checking for $ac_word" >&5 |
|
1458 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then |
|
1459 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1460 |
|
else |
|
1461 |
|
if test -n "$CC"; then |
|
1462 |
|
ac_cv_prog_CC="$CC" # Let the user override the test. |
|
1463 |
|
else |
|
1464 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
1465 |
|
ac_dummy="$PATH" |
|
1466 |
|
for ac_dir in $ac_dummy; do |
|
1467 |
|
test -z "$ac_dir" && ac_dir=. |
|
1468 |
|
if test -f $ac_dir/$ac_word; then |
|
1469 |
|
ac_cv_prog_CC="cl" |
|
1470 |
|
break |
|
1471 |
|
fi |
|
1472 |
|
done |
|
1473 |
|
IFS="$ac_save_ifs" |
|
1474 |
|
fi |
|
1475 |
|
fi |
|
1476 |
|
CC="$ac_cv_prog_CC" |
|
1477 |
|
if test -n "$CC"; then |
|
1478 |
|
echo "$ac_t""$CC" 1>&6 |
|
1479 |
|
else |
|
1480 |
|
echo "$ac_t""no" 1>&6 |
|
1481 |
|
fi |
|
1482 |
|
;; |
|
1483 |
|
esac |
|
1484 |
|
fi |
|
1485 |
|
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } |
|
1486 |
|
fi |
|
1487 |
|
|
|
1488 |
|
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 |
|
1489 |
|
echo "configure:1490: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 |
|
1490 |
|
|
|
1491 |
|
ac_ext=c |
|
1492 |
|
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
|
1493 |
|
ac_cpp='$CPP $CPPFLAGS' |
|
1494 |
|
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
|
1495 |
|
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' |
|
1496 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
1497 |
|
|
|
1498 |
|
cat > conftest.$ac_ext << EOF |
|
1499 |
|
|
|
1500 |
|
#line 1501 "configure" |
|
1501 |
|
#include "confdefs.h" |
|
1502 |
|
|
|
1503 |
|
main(){return(0);} |
|
1504 |
|
EOF |
|
1505 |
|
if { (eval echo configure:1506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
1506 |
|
ac_cv_prog_cc_works=yes |
|
1507 |
|
# If we can't run a trivial program, we are probably using a cross compiler. |
|
1508 |
|
if (./conftest; exit) 2>/dev/null; then |
|
1509 |
|
ac_cv_prog_cc_cross=no |
|
1510 |
|
else |
|
1511 |
|
ac_cv_prog_cc_cross=yes |
|
1512 |
|
fi |
|
1513 |
|
else |
|
1514 |
|
echo "configure: failed program was:" >&5 |
|
1515 |
|
cat conftest.$ac_ext >&5 |
|
1516 |
|
ac_cv_prog_cc_works=no |
|
1517 |
|
fi |
|
1518 |
|
rm -fr conftest* |
|
1519 |
|
ac_ext=c |
|
1520 |
|
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. |
|
1521 |
|
ac_cpp='$CPP $CPPFLAGS' |
|
1522 |
|
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' |
|
1523 |
|
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' |
|
1524 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
1525 |
|
|
|
1526 |
|
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 |
|
1527 |
|
if test $ac_cv_prog_cc_works = no; then |
|
1528 |
|
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } |
|
1529 |
|
fi |
|
1530 |
|
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 |
|
1531 |
|
echo "configure:1532: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 |
|
1532 |
|
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 |
|
1533 |
|
cross_compiling=$ac_cv_prog_cc_cross |
|
1534 |
|
|
|
1535 |
|
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 |
|
1536 |
|
echo "configure:1537: checking whether we are using GNU C" >&5 |
|
1537 |
|
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then |
|
1538 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1539 |
|
else |
|
1540 |
|
cat > conftest.c <<EOF |
|
1541 |
|
#ifdef __GNUC__ |
|
1542 |
|
yes; |
|
1543 |
|
#endif |
|
1544 |
|
EOF |
|
1545 |
|
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1546: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then |
|
1546 |
|
ac_cv_prog_gcc=yes |
|
1547 |
|
else |
|
1548 |
|
ac_cv_prog_gcc=no |
|
1549 |
|
fi |
|
1550 |
|
fi |
|
1551 |
|
|
|
1552 |
|
echo "$ac_t""$ac_cv_prog_gcc" 1>&6 |
|
1553 |
|
|
|
1554 |
|
if test $ac_cv_prog_gcc = yes; then |
|
1555 |
|
GCC=yes |
|
1556 |
|
else |
|
1557 |
|
GCC= |
|
1558 |
|
fi |
|
1559 |
|
|
|
1560 |
|
ac_test_CFLAGS="${CFLAGS+set}" |
|
1561 |
|
ac_save_CFLAGS="$CFLAGS" |
|
1562 |
|
CFLAGS= |
|
1563 |
|
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 |
|
1564 |
|
echo "configure:1565: checking whether ${CC-cc} accepts -g" >&5 |
|
1565 |
|
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then |
|
1566 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1567 |
|
else |
|
1568 |
|
echo 'void f(){}' > conftest.c |
|
1569 |
|
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then |
|
1570 |
|
ac_cv_prog_cc_g=yes |
|
1571 |
|
else |
|
1572 |
|
ac_cv_prog_cc_g=no |
|
1573 |
|
fi |
|
1574 |
|
rm -f conftest* |
|
1575 |
|
|
|
1576 |
|
fi |
|
1577 |
|
|
|
1578 |
|
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 |
|
1579 |
|
if test "$ac_test_CFLAGS" = set; then |
|
1580 |
|
CFLAGS="$ac_save_CFLAGS" |
|
1581 |
|
elif test $ac_cv_prog_cc_g = yes; then |
|
1582 |
|
if test "$GCC" = yes; then |
|
1583 |
|
CFLAGS="-g -O2" |
|
1584 |
|
else |
|
1585 |
|
CFLAGS="-g" |
|
1586 |
|
fi |
|
1587 |
|
else |
|
1588 |
|
if test "$GCC" = yes; then |
|
1589 |
|
CFLAGS="-O2" |
|
1590 |
|
else |
|
1591 |
|
CFLAGS= |
|
1592 |
|
fi |
|
1593 |
|
fi |
|
1594 |
|
|
|
1595 |
|
|
|
1596 |
|
|
|
1597 |
|
|
|
1598 |
|
echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 |
|
1599 |
|
echo "configure:1600: checking for ${CC-cc} option to accept ANSI C" >&5 |
|
1600 |
|
if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then |
|
1601 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1602 |
|
else |
|
1603 |
|
am_cv_prog_cc_stdc=no |
|
1604 |
|
ac_save_CC="$CC" |
|
1605 |
|
# Don't try gcc -ansi; that turns off useful extensions and |
|
1606 |
|
# breaks some systems' header files. |
|
1607 |
|
# AIX -qlanglvl=ansi |
|
1608 |
|
# Ultrix and OSF/1 -std1 |
|
1609 |
|
# HP-UX -Aa -D_HPUX_SOURCE |
|
1610 |
|
# SVR4 -Xc -D__EXTENSIONS__ |
|
1611 |
|
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" |
|
1612 |
|
do |
|
1613 |
|
CC="$ac_save_CC $ac_arg" |
|
1614 |
|
cat > conftest.$ac_ext <<EOF |
|
1615 |
|
#line 1616 "configure" |
|
1616 |
|
#include "confdefs.h" |
|
1617 |
|
#include <stdarg.h> |
|
1618 |
|
#include <stdio.h> |
|
1619 |
|
#include <sys/types.h> |
|
1620 |
|
#include <sys/stat.h> |
|
1621 |
|
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ |
|
1622 |
|
struct buf { int x; }; |
|
1623 |
|
FILE * (*rcsopen) (struct buf *, struct stat *, int); |
|
1624 |
|
static char *e (p, i) |
|
1625 |
|
char **p; |
|
1626 |
|
int i; |
|
1627 |
|
{ |
|
1628 |
|
return p[i]; |
|
1629 |
|
} |
|
1630 |
|
static char *f (char * (*g) (char **, int), char **p, ...) |
|
1631 |
|
{ |
|
1632 |
|
char *s; |
|
1633 |
|
va_list v; |
|
1634 |
|
va_start (v,p); |
|
1635 |
|
s = g (p, va_arg (v,int)); |
|
1636 |
|
va_end (v); |
|
1637 |
|
return s; |
|
1638 |
|
} |
|
1639 |
|
int test (int i, double x); |
|
1640 |
|
struct s1 {int (*f) (int a);}; |
|
1641 |
|
struct s2 {int (*f) (double a);}; |
|
1642 |
|
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); |
|
1643 |
|
int argc; |
|
1644 |
|
char **argv; |
|
1645 |
|
|
|
1646 |
|
int main() { |
|
1647 |
|
|
|
1648 |
|
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; |
|
1649 |
|
|
|
1650 |
|
; return 0; } |
|
1651 |
|
EOF |
|
1652 |
|
if { (eval echo configure:1653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then |
|
1653 |
|
rm -rf conftest* |
|
1654 |
|
am_cv_prog_cc_stdc="$ac_arg"; break |
|
1655 |
|
else |
|
1656 |
|
echo "configure: failed program was:" >&5 |
|
1657 |
|
cat conftest.$ac_ext >&5 |
|
1658 |
|
fi |
|
1659 |
|
rm -f conftest* |
|
1660 |
|
done |
|
1661 |
|
CC="$ac_save_CC" |
|
1662 |
|
|
|
1663 |
|
fi |
|
1664 |
|
|
|
1665 |
|
if test -z "$am_cv_prog_cc_stdc"; then |
|
1666 |
|
echo "$ac_t""none needed" 1>&6 |
|
1667 |
|
else |
|
1668 |
|
echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 |
|
1669 |
|
fi |
|
1670 |
|
case "x$am_cv_prog_cc_stdc" in |
|
1671 |
|
x|xno) ;; |
|
1672 |
|
*) CC="$CC $am_cv_prog_cc_stdc" ;; |
|
1673 |
|
esac |
|
1674 |
|
|
|
1675 |
|
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 |
|
1676 |
|
echo "configure:1677: checking how to run the C preprocessor" >&5 |
|
1677 |
|
# On Suns, sometimes $CPP names a directory. |
|
1678 |
|
if test -n "$CPP" && test -d "$CPP"; then |
|
1679 |
|
CPP= |
|
1680 |
|
fi |
|
1681 |
|
if test -z "$CPP"; then |
|
1682 |
|
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then |
|
1683 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1684 |
|
else |
|
1685 |
|
# This must be in double quotes, not single quotes, because CPP may get |
|
1686 |
|
# substituted into the Makefile and "${CC-cc}" will confuse make. |
|
1687 |
|
CPP="${CC-cc} -E" |
|
1688 |
|
# On the NeXT, cc -E runs the code through the compiler's parser, |
|
1689 |
|
# not just through cpp. |
|
1690 |
|
cat > conftest.$ac_ext <<EOF |
|
1691 |
|
#line 1692 "configure" |
|
1692 |
|
#include "confdefs.h" |
|
1693 |
|
#include <assert.h> |
|
1694 |
|
Syntax Error |
|
1695 |
|
EOF |
|
1696 |
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
|
1697 |
|
{ (eval echo configure:1698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
|
1698 |
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
|
1699 |
|
if test -z "$ac_err"; then |
|
1700 |
|
: |
|
1701 |
|
else |
|
1702 |
|
echo "$ac_err" >&5 |
|
1703 |
|
echo "configure: failed program was:" >&5 |
|
1704 |
|
cat conftest.$ac_ext >&5 |
|
1705 |
|
rm -rf conftest* |
|
1706 |
|
CPP="${CC-cc} -E -traditional-cpp" |
|
1707 |
|
cat > conftest.$ac_ext <<EOF |
|
1708 |
|
#line 1709 "configure" |
|
1709 |
|
#include "confdefs.h" |
|
1710 |
|
#include <assert.h> |
|
1711 |
|
Syntax Error |
|
1712 |
|
EOF |
|
1713 |
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
|
1714 |
|
{ (eval echo configure:1715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
|
1715 |
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
|
1716 |
|
if test -z "$ac_err"; then |
|
1717 |
|
: |
|
1718 |
|
else |
|
1719 |
|
echo "$ac_err" >&5 |
|
1720 |
|
echo "configure: failed program was:" >&5 |
|
1721 |
|
cat conftest.$ac_ext >&5 |
|
1722 |
|
rm -rf conftest* |
|
1723 |
|
CPP="${CC-cc} -nologo -E" |
|
1724 |
|
cat > conftest.$ac_ext <<EOF |
|
1725 |
|
#line 1726 "configure" |
|
1726 |
|
#include "confdefs.h" |
|
1727 |
|
#include <assert.h> |
|
1728 |
|
Syntax Error |
|
1729 |
|
EOF |
|
1730 |
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
|
1731 |
|
{ (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
|
1732 |
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
|
1733 |
|
if test -z "$ac_err"; then |
|
1734 |
|
: |
|
1735 |
|
else |
|
1736 |
|
echo "$ac_err" >&5 |
|
1737 |
|
echo "configure: failed program was:" >&5 |
|
1738 |
|
cat conftest.$ac_ext >&5 |
|
1739 |
|
rm -rf conftest* |
|
1740 |
|
CPP=/lib/cpp |
|
1741 |
|
fi |
|
1742 |
|
rm -f conftest* |
|
1743 |
|
fi |
|
1744 |
|
rm -f conftest* |
|
1745 |
|
fi |
|
1746 |
|
rm -f conftest* |
|
1747 |
|
ac_cv_prog_CPP="$CPP" |
|
1748 |
|
fi |
|
1749 |
|
CPP="$ac_cv_prog_CPP" |
|
1750 |
|
else |
|
1751 |
|
ac_cv_prog_CPP="$CPP" |
|
1752 |
|
fi |
|
1753 |
|
echo "$ac_t""$CPP" 1>&6 |
|
1754 |
|
|
|
1755 |
|
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 |
|
1756 |
|
echo "configure:1757: checking for ANSI C header files" >&5 |
|
1757 |
|
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then |
|
1758 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1759 |
|
else |
|
1760 |
|
cat > conftest.$ac_ext <<EOF |
|
1761 |
|
#line 1762 "configure" |
|
1762 |
|
#include "confdefs.h" |
|
1763 |
|
#include <stdlib.h> |
|
1764 |
|
#include <stdarg.h> |
|
1765 |
|
#include <string.h> |
|
1766 |
|
#include <float.h> |
|
1767 |
|
EOF |
|
1768 |
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
|
1769 |
|
{ (eval echo configure:1770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
|
1770 |
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
|
1771 |
|
if test -z "$ac_err"; then |
|
1772 |
|
rm -rf conftest* |
|
1773 |
|
ac_cv_header_stdc=yes |
|
1774 |
|
else |
|
1775 |
|
echo "$ac_err" >&5 |
|
1776 |
|
echo "configure: failed program was:" >&5 |
|
1777 |
|
cat conftest.$ac_ext >&5 |
|
1778 |
|
rm -rf conftest* |
|
1779 |
|
ac_cv_header_stdc=no |
|
1780 |
|
fi |
|
1781 |
|
rm -f conftest* |
|
1782 |
|
|
|
1783 |
|
if test $ac_cv_header_stdc = yes; then |
|
1784 |
|
# SunOS 4.x string.h does not declare mem*, contrary to ANSI. |
|
1785 |
|
cat > conftest.$ac_ext <<EOF |
|
1786 |
|
#line 1787 "configure" |
|
1787 |
|
#include "confdefs.h" |
|
1788 |
|
#include <string.h> |
|
1789 |
|
EOF |
|
1790 |
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | |
|
1791 |
|
egrep "memchr" >/dev/null 2>&1; then |
|
1792 |
|
: |
|
1793 |
|
else |
|
1794 |
|
rm -rf conftest* |
|
1795 |
|
ac_cv_header_stdc=no |
|
1796 |
|
fi |
|
1797 |
|
rm -f conftest* |
|
1798 |
|
|
|
1799 |
|
fi |
|
1800 |
|
|
|
1801 |
|
if test $ac_cv_header_stdc = yes; then |
|
1802 |
|
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. |
|
1803 |
|
cat > conftest.$ac_ext <<EOF |
|
1804 |
|
#line 1805 "configure" |
|
1805 |
|
#include "confdefs.h" |
|
1806 |
|
#include <stdlib.h> |
|
1807 |
|
EOF |
|
1808 |
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | |
|
1809 |
|
egrep "free" >/dev/null 2>&1; then |
|
1810 |
|
: |
|
1811 |
|
else |
|
1812 |
|
rm -rf conftest* |
|
1813 |
|
ac_cv_header_stdc=no |
|
1814 |
|
fi |
|
1815 |
|
rm -f conftest* |
|
1816 |
|
|
|
1817 |
|
fi |
|
1818 |
|
|
|
1819 |
|
if test $ac_cv_header_stdc = yes; then |
|
1820 |
|
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. |
|
1821 |
|
if test "$cross_compiling" = yes; then |
|
1822 |
|
: |
|
1823 |
|
else |
|
1824 |
|
cat > conftest.$ac_ext <<EOF |
|
1825 |
|
#line 1826 "configure" |
|
1826 |
|
#include "confdefs.h" |
|
1827 |
|
#include <ctype.h> |
|
1828 |
|
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') |
|
1829 |
|
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) |
|
1830 |
|
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) |
|
1831 |
|
int main () { int i; for (i = 0; i < 256; i++) |
|
1832 |
|
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); |
|
1833 |
|
exit (0); } |
|
1834 |
|
|
|
1835 |
|
EOF |
|
1836 |
|
if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null |
|
1837 |
|
then |
|
1838 |
|
: |
|
1839 |
|
else |
|
1840 |
|
echo "configure: failed program was:" >&5 |
|
1841 |
|
cat conftest.$ac_ext >&5 |
|
1842 |
|
rm -fr conftest* |
|
1843 |
|
ac_cv_header_stdc=no |
|
1844 |
|
fi |
|
1845 |
|
rm -fr conftest* |
|
1846 |
|
fi |
|
1847 |
|
|
|
1848 |
|
fi |
|
1849 |
|
fi |
|
1850 |
|
|
|
1851 |
|
echo "$ac_t""$ac_cv_header_stdc" 1>&6 |
|
1852 |
|
if test $ac_cv_header_stdc = yes; then |
|
1853 |
|
cat >> confdefs.h <<\EOF |
|
1854 |
|
#define STDC_HEADERS 1 |
|
1855 |
|
EOF |
|
1856 |
|
|
|
1857 |
|
fi |
|
1858 |
|
|
|
1859 |
|
|
|
1860 |
|
|
|
1861 |
|
# Check whether --enable-compile-warnings or --disable-compile-warnings was given. |
|
1862 |
|
if test "${enable_compile_warnings+set}" = set; then |
|
1863 |
|
enableval="$enable_compile_warnings" |
|
1864 |
|
: |
|
1865 |
|
else |
|
1866 |
|
enable_compile_warnings=minimum |
|
1867 |
|
fi |
|
1868 |
|
|
|
1869 |
|
|
|
1870 |
|
echo $ac_n "checking what warning flags to pass to the C compiler""... $ac_c" 1>&6 |
|
1871 |
|
echo "configure:1872: checking what warning flags to pass to the C compiler" >&5 |
|
1872 |
|
warnCFLAGS= |
|
1873 |
|
if test "x$GCC" != xyes; then |
|
1874 |
|
enable_compile_warnings=no |
|
1875 |
|
fi |
|
1876 |
|
|
|
1877 |
|
if test "x$enable_compile_warnings" != "xno"; then |
|
1878 |
|
if test "x$GCC" = "xyes"; then |
|
1879 |
|
case " $CFLAGS " in |
|
1880 |
|
*\ \ -Wall\ \ *) ;; |
|
1881 |
|
*) warnCFLAGS="-Wall -Wunused" ;; |
|
1882 |
|
esac |
|
1883 |
|
|
|
1884 |
|
## -W is not all that useful. And it cannot be controlled |
|
1885 |
|
## with individual -Wno-xxx flags, unlike -Wall |
|
1886 |
|
if test "x$enable_compile_warnings" = "xyes"; then |
|
1887 |
|
warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations" |
|
1888 |
|
fi |
|
1889 |
|
fi |
|
1890 |
|
fi |
|
1891 |
|
echo "$ac_t""$warnCFLAGS" 1>&6 |
|
1892 |
|
|
|
1893 |
|
# Check whether --enable-iso-c or --disable-iso-c was given. |
|
1894 |
|
if test "${enable_iso_c+set}" = set; then |
|
1895 |
|
enableval="$enable_iso_c" |
|
1896 |
|
: |
|
1897 |
|
else |
|
1898 |
|
enable_iso_c=no |
|
1899 |
|
fi |
|
1900 |
|
|
|
1901 |
|
|
|
1902 |
|
echo $ac_n "checking what language compliance flags to pass to the C compiler""... $ac_c" 1>&6 |
|
1903 |
|
echo "configure:1904: checking what language compliance flags to pass to the C compiler" >&5 |
|
1904 |
|
complCFLAGS= |
|
1905 |
|
if test "x$enable_iso_c" != "xno"; then |
|
1906 |
|
if test "x$GCC" = "xyes"; then |
|
1907 |
|
case " $CFLAGS " in |
|
1908 |
|
*\ \ -ansi\ \ *) ;; |
|
1909 |
|
*) complCFLAGS="$complCFLAGS -ansi" ;; |
|
1910 |
|
esac |
|
1911 |
|
|
|
1912 |
|
case " $CFLAGS " in |
|
1913 |
|
*\ \ -pedantic\ \ *) ;; |
|
1914 |
|
*) complCFLAGS="$complCFLAGS -pedantic" ;; |
|
1915 |
|
esac |
|
1916 |
|
fi |
|
1917 |
|
fi |
|
1918 |
|
echo "$ac_t""$complCFLAGS" 1>&6 |
|
1919 |
|
if test "x$cflags_set" != "xyes"; then |
|
1920 |
|
CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" |
|
1921 |
|
cflags_set=yes |
|
1922 |
|
|
|
1923 |
|
fi |
|
1924 |
|
|
|
1925 |
|
|
|
1926 |
|
PTHREAD_LIB="" |
|
1927 |
|
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 |
|
1928 |
|
echo "configure:1929: checking for pthread_create in -lpthread" >&5 |
|
1929 |
|
ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` |
|
1930 |
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
|
1931 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1932 |
|
else |
|
1933 |
|
ac_save_LIBS="$LIBS" |
|
1934 |
|
LIBS="-lpthread $LIBS" |
|
1935 |
|
cat > conftest.$ac_ext <<EOF |
|
1936 |
|
#line 1937 "configure" |
|
1937 |
|
#include "confdefs.h" |
|
1938 |
|
/* Override any gcc2 internal prototype to avoid an error. */ |
|
1939 |
|
/* We use char because int might match the return type of a gcc2 |
|
1940 |
|
builtin and then its argument prototype would still apply. */ |
|
1941 |
|
char pthread_create(); |
|
1942 |
|
|
|
1943 |
|
int main() { |
|
1944 |
|
pthread_create() |
|
1945 |
|
; return 0; } |
|
1946 |
|
EOF |
|
1947 |
|
if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
1948 |
|
rm -rf conftest* |
|
1949 |
|
eval "ac_cv_lib_$ac_lib_var=yes" |
|
1950 |
|
else |
|
1951 |
|
echo "configure: failed program was:" >&5 |
|
1952 |
|
cat conftest.$ac_ext >&5 |
|
1953 |
|
rm -rf conftest* |
|
1954 |
|
eval "ac_cv_lib_$ac_lib_var=no" |
|
1955 |
|
fi |
|
1956 |
|
rm -f conftest* |
|
1957 |
|
LIBS="$ac_save_LIBS" |
|
1958 |
|
|
|
1959 |
|
fi |
|
1960 |
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then |
|
1961 |
|
echo "$ac_t""yes" 1>&6 |
|
1962 |
|
PTHREAD_LIB="-lpthread" |
|
1963 |
|
else |
|
1964 |
|
echo "$ac_t""no" 1>&6 |
|
1965 |
|
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 |
|
1966 |
|
echo "configure:1967: checking for pthread_create in -lpthreads" >&5 |
|
1967 |
|
ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` |
|
1968 |
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
|
1969 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
1970 |
|
else |
|
1971 |
|
ac_save_LIBS="$LIBS" |
|
1972 |
|
LIBS="-lpthreads $LIBS" |
|
1973 |
|
cat > conftest.$ac_ext <<EOF |
|
1974 |
|
#line 1975 "configure" |
|
1975 |
|
#include "confdefs.h" |
|
1976 |
|
/* Override any gcc2 internal prototype to avoid an error. */ |
|
1977 |
|
/* We use char because int might match the return type of a gcc2 |
|
1978 |
|
builtin and then its argument prototype would still apply. */ |
|
1979 |
|
char pthread_create(); |
|
1980 |
|
|
|
1981 |
|
int main() { |
|
1982 |
|
pthread_create() |
|
1983 |
|
; return 0; } |
|
1984 |
|
EOF |
|
1985 |
|
if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
1986 |
|
rm -rf conftest* |
|
1987 |
|
eval "ac_cv_lib_$ac_lib_var=yes" |
|
1988 |
|
else |
|
1989 |
|
echo "configure: failed program was:" >&5 |
|
1990 |
|
cat conftest.$ac_ext >&5 |
|
1991 |
|
rm -rf conftest* |
|
1992 |
|
eval "ac_cv_lib_$ac_lib_var=no" |
|
1993 |
|
fi |
|
1994 |
|
rm -f conftest* |
|
1995 |
|
LIBS="$ac_save_LIBS" |
|
1996 |
|
|
|
1997 |
|
fi |
|
1998 |
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then |
|
1999 |
|
echo "$ac_t""yes" 1>&6 |
|
2000 |
|
PTHREAD_LIB="-lpthreads" |
|
2001 |
|
else |
|
2002 |
|
echo "$ac_t""no" 1>&6 |
|
2003 |
|
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 |
|
2004 |
|
echo "configure:2005: checking for pthread_create in -lc_r" >&5 |
|
2005 |
|
ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` |
|
2006 |
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
|
2007 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2008 |
|
else |
|
2009 |
|
ac_save_LIBS="$LIBS" |
|
2010 |
|
LIBS="-lc_r $LIBS" |
|
2011 |
|
cat > conftest.$ac_ext <<EOF |
|
2012 |
|
#line 2013 "configure" |
|
2013 |
|
#include "confdefs.h" |
|
2014 |
|
/* Override any gcc2 internal prototype to avoid an error. */ |
|
2015 |
|
/* We use char because int might match the return type of a gcc2 |
|
2016 |
|
builtin and then its argument prototype would still apply. */ |
|
2017 |
|
char pthread_create(); |
|
2018 |
|
|
|
2019 |
|
int main() { |
|
2020 |
|
pthread_create() |
|
2021 |
|
; return 0; } |
|
2022 |
|
EOF |
|
2023 |
|
if { (eval echo configure:2024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
2024 |
|
rm -rf conftest* |
|
2025 |
|
eval "ac_cv_lib_$ac_lib_var=yes" |
|
2026 |
|
else |
|
2027 |
|
echo "configure: failed program was:" >&5 |
|
2028 |
|
cat conftest.$ac_ext >&5 |
|
2029 |
|
rm -rf conftest* |
|
2030 |
|
eval "ac_cv_lib_$ac_lib_var=no" |
|
2031 |
|
fi |
|
2032 |
|
rm -f conftest* |
|
2033 |
|
LIBS="$ac_save_LIBS" |
|
2034 |
|
|
|
2035 |
|
fi |
|
2036 |
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then |
|
2037 |
|
echo "$ac_t""yes" 1>&6 |
|
2038 |
|
PTHREAD_LIB="-lc_r" |
|
2039 |
|
else |
|
2040 |
|
echo "$ac_t""no" 1>&6 |
|
2041 |
|
echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 |
|
2042 |
|
echo "configure:2043: checking for pthread_create" >&5 |
|
2043 |
|
if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then |
|
2044 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2045 |
|
else |
|
2046 |
|
cat > conftest.$ac_ext <<EOF |
|
2047 |
|
#line 2048 "configure" |
|
2048 |
|
#include "confdefs.h" |
|
2049 |
|
/* System header to define __stub macros and hopefully few prototypes, |
|
2050 |
|
which can conflict with char pthread_create(); below. */ |
|
2051 |
|
#include <assert.h> |
|
2052 |
|
/* Override any gcc2 internal prototype to avoid an error. */ |
|
2053 |
|
/* We use char because int might match the return type of a gcc2 |
|
2054 |
|
builtin and then its argument prototype would still apply. */ |
|
2055 |
|
char pthread_create(); |
|
2056 |
|
|
|
2057 |
|
int main() { |
|
2058 |
|
|
|
2059 |
|
/* The GNU C library defines this for functions which it implements |
|
2060 |
|
to always fail with ENOSYS. Some functions are actually named |
|
2061 |
|
something starting with __ and the normal name is an alias. */ |
|
2062 |
|
#if defined (__stub_pthread_create) || defined (__stub___pthread_create) |
|
2063 |
|
choke me |
|
2064 |
|
#else |
|
2065 |
|
pthread_create(); |
|
2066 |
|
#endif |
|
2067 |
|
|
|
2068 |
|
; return 0; } |
|
2069 |
|
EOF |
|
2070 |
|
if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
2071 |
|
rm -rf conftest* |
|
2072 |
|
eval "ac_cv_func_pthread_create=yes" |
|
2073 |
|
else |
|
2074 |
|
echo "configure: failed program was:" >&5 |
|
2075 |
|
cat conftest.$ac_ext >&5 |
|
2076 |
|
rm -rf conftest* |
|
2077 |
|
eval "ac_cv_func_pthread_create=no" |
|
2078 |
|
fi |
|
2079 |
|
rm -f conftest* |
|
2080 |
|
fi |
|
2081 |
|
|
|
2082 |
|
if eval "test \"`echo '$ac_cv_func_'pthread_create`\" = yes"; then |
|
2083 |
|
echo "$ac_t""yes" 1>&6 |
|
2084 |
|
: |
|
2085 |
|
else |
|
2086 |
|
echo "$ac_t""no" 1>&6 |
|
2087 |
|
fi |
|
2088 |
|
|
|
2089 |
|
|
|
2090 |
|
fi |
|
2091 |
|
|
|
2092 |
|
|
|
2093 |
|
fi |
|
2094 |
|
|
|
2095 |
|
|
|
2096 |
|
fi |
|
2097 |
|
|
|
2098 |
|
|
|
2099 |
|
|
|
2100 |
|
|
|
2101 |
|
|
|
2102 |
|
# Check whether --with-gtk-prefix or --without-gtk-prefix was given. |
|
2103 |
|
if test "${with_gtk_prefix+set}" = set; then |
|
2104 |
|
withval="$with_gtk_prefix" |
|
2105 |
|
gtk_config_prefix="$withval" |
|
2106 |
|
else |
|
2107 |
|
gtk_config_prefix="" |
|
2108 |
|
fi |
|
2109 |
|
|
|
2110 |
|
# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. |
|
2111 |
|
if test "${with_gtk_exec_prefix+set}" = set; then |
|
2112 |
|
withval="$with_gtk_exec_prefix" |
|
2113 |
|
gtk_config_exec_prefix="$withval" |
|
2114 |
|
else |
|
2115 |
|
gtk_config_exec_prefix="" |
|
2116 |
|
fi |
|
2117 |
|
|
|
2118 |
|
# Check whether --enable-gtktest or --disable-gtktest was given. |
|
2119 |
|
if test "${enable_gtktest+set}" = set; then |
|
2120 |
|
enableval="$enable_gtktest" |
|
2121 |
|
: |
|
2122 |
|
else |
|
2123 |
|
enable_gtktest=yes |
|
2124 |
|
fi |
|
2125 |
|
|
|
2126 |
|
|
|
2127 |
|
for module in . |
|
2128 |
|
do |
|
2129 |
|
case "$module" in |
|
2130 |
|
gthread) |
|
2131 |
|
gtk_config_args="$gtk_config_args gthread" |
|
2132 |
|
;; |
|
2133 |
|
esac |
|
2134 |
|
done |
|
2135 |
|
|
|
2136 |
|
if test x$gtk_config_exec_prefix != x ; then |
|
2137 |
|
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" |
|
2138 |
|
if test x${GTK_CONFIG+set} != xset ; then |
|
2139 |
|
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config |
|
2140 |
|
fi |
|
2141 |
|
fi |
|
2142 |
|
if test x$gtk_config_prefix != x ; then |
|
2143 |
|
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" |
|
2144 |
|
if test x${GTK_CONFIG+set} != xset ; then |
|
2145 |
|
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config |
|
2146 |
|
fi |
|
2147 |
|
fi |
|
2148 |
|
|
|
2149 |
|
# Extract the first word of "gtk-config", so it can be a program name with args. |
|
2150 |
|
set dummy gtk-config; ac_word=$2 |
|
2151 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
2152 |
|
echo "configure:2153: checking for $ac_word" >&5 |
|
2153 |
|
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then |
|
2154 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2155 |
|
else |
|
2156 |
|
case "$GTK_CONFIG" in |
|
2157 |
|
/*) |
|
2158 |
|
ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. |
|
2159 |
|
;; |
|
2160 |
|
?:/*) |
|
2161 |
|
ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path. |
|
2162 |
|
;; |
|
2163 |
|
*) |
|
2164 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
2165 |
|
ac_dummy="$PATH" |
|
2166 |
|
for ac_dir in $ac_dummy; do |
|
2167 |
|
test -z "$ac_dir" && ac_dir=. |
|
2168 |
|
if test -f $ac_dir/$ac_word; then |
|
2169 |
|
ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word" |
|
2170 |
|
break |
|
2171 |
|
fi |
|
2172 |
|
done |
|
2173 |
|
IFS="$ac_save_ifs" |
|
2174 |
|
test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" |
|
2175 |
|
;; |
|
2176 |
|
esac |
|
2177 |
|
fi |
|
2178 |
|
GTK_CONFIG="$ac_cv_path_GTK_CONFIG" |
|
2179 |
|
if test -n "$GTK_CONFIG"; then |
|
2180 |
|
echo "$ac_t""$GTK_CONFIG" 1>&6 |
|
2181 |
|
else |
|
2182 |
|
echo "$ac_t""no" 1>&6 |
|
2183 |
|
fi |
|
2184 |
|
|
|
2185 |
|
min_gtk_version=1.2.0 |
|
2186 |
|
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 |
|
2187 |
|
echo "configure:2188: checking for GTK - version >= $min_gtk_version" >&5 |
|
2188 |
|
no_gtk="" |
|
2189 |
|
if test "$GTK_CONFIG" = "no" ; then |
|
2190 |
|
no_gtk=yes |
|
2191 |
|
else |
|
2192 |
|
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` |
|
2193 |
|
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` |
|
2194 |
|
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
2195 |
|
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` |
|
2196 |
|
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
2197 |
|
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` |
|
2198 |
|
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
2199 |
|
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` |
|
2200 |
|
if test "x$enable_gtktest" = "xyes" ; then |
|
2201 |
|
ac_save_CFLAGS="$CFLAGS" |
|
2202 |
|
ac_save_LIBS="$LIBS" |
|
2203 |
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
|
2204 |
|
LIBS="$GTK_LIBS $LIBS" |
|
2205 |
|
rm -f conf.gtktest |
|
2206 |
|
if test "$cross_compiling" = yes; then |
|
2207 |
|
echo $ac_n "cross compiling; assumed OK... $ac_c" |
|
2208 |
|
else |
|
2209 |
|
cat > conftest.$ac_ext <<EOF |
|
2210 |
|
#line 2211 "configure" |
|
2211 |
|
#include "confdefs.h" |
|
2212 |
|
|
|
2213 |
|
#include <gtk/gtk.h> |
|
2214 |
|
#include <stdio.h> |
|
2215 |
|
#include <stdlib.h> |
|
2216 |
|
|
|
2217 |
|
int |
|
2218 |
|
main () |
|
2219 |
|
{ |
|
2220 |
|
int major, minor, micro; |
|
2221 |
|
char *tmp_version; |
|
2222 |
|
|
|
2223 |
|
system ("touch conf.gtktest"); |
|
2224 |
|
|
|
2225 |
|
/* HP/UX 9 (%@#!) writes to sscanf strings */ |
|
2226 |
|
tmp_version = g_strdup("$min_gtk_version"); |
|
2227 |
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
|
2228 |
|
printf("%s, bad version string\n", "$min_gtk_version"); |
|
2229 |
|
exit(1); |
|
2230 |
|
} |
|
2231 |
|
|
|
2232 |
|
if ((gtk_major_version != $gtk_config_major_version) || |
|
2233 |
|
(gtk_minor_version != $gtk_config_minor_version) || |
|
2234 |
|
(gtk_micro_version != $gtk_config_micro_version)) |
|
2235 |
|
{ |
|
2236 |
|
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", |
|
2237 |
|
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, |
|
2238 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
2239 |
|
printf ("*** was found! If gtk-config was correct, then it is best\n"); |
|
2240 |
|
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); |
|
2241 |
|
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
|
2242 |
|
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
|
2243 |
|
printf("*** required on your system.\n"); |
|
2244 |
|
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); |
|
2245 |
|
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); |
|
2246 |
|
printf("*** before re-running configure\n"); |
|
2247 |
|
} |
|
2248 |
|
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) |
|
2249 |
|
else if ((gtk_major_version != GTK_MAJOR_VERSION) || |
|
2250 |
|
(gtk_minor_version != GTK_MINOR_VERSION) || |
|
2251 |
|
(gtk_micro_version != GTK_MICRO_VERSION)) |
|
2252 |
|
{ |
|
2253 |
|
printf("*** GTK+ header files (version %d.%d.%d) do not match\n", |
|
2254 |
|
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); |
|
2255 |
|
printf("*** library (version %d.%d.%d)\n", |
|
2256 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
2257 |
|
} |
|
2258 |
|
#endif /* defined (GTK_MAJOR_VERSION) ... */ |
|
2259 |
|
else |
|
2260 |
|
{ |
|
2261 |
|
if ((gtk_major_version > major) || |
|
2262 |
|
((gtk_major_version == major) && (gtk_minor_version > minor)) || |
|
2263 |
|
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) |
|
2264 |
|
{ |
|
2265 |
|
return 0; |
|
2266 |
|
} |
|
2267 |
|
else |
|
2268 |
|
{ |
|
2269 |
|
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", |
|
2270 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
2271 |
|
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", |
|
2272 |
|
major, minor, micro); |
|
2273 |
|
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); |
|
2274 |
|
printf("***\n"); |
|
2275 |
|
printf("*** If you have already installed a sufficiently new version, this error\n"); |
|
2276 |
|
printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); |
|
2277 |
|
printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
|
2278 |
|
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); |
|
2279 |
|
printf("*** correct copy of gtk-config. (In this case, you will have to\n"); |
|
2280 |
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
|
2281 |
|
printf("*** so that the correct libraries are found at run-time))\n"); |
|
2282 |
|
} |
|
2283 |
|
} |
|
2284 |
|
return 1; |
|
2285 |
|
} |
|
2286 |
|
|
|
2287 |
|
EOF |
|
2288 |
|
if { (eval echo configure:2289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null |
|
2289 |
|
then |
|
2290 |
|
: |
|
2291 |
|
else |
|
2292 |
|
echo "configure: failed program was:" >&5 |
|
2293 |
|
cat conftest.$ac_ext >&5 |
|
2294 |
|
rm -fr conftest* |
|
2295 |
|
no_gtk=yes |
|
2296 |
|
fi |
|
2297 |
|
rm -fr conftest* |
|
2298 |
|
fi |
|
2299 |
|
|
|
2300 |
|
CFLAGS="$ac_save_CFLAGS" |
|
2301 |
|
LIBS="$ac_save_LIBS" |
|
2302 |
|
fi |
|
2303 |
|
fi |
|
2304 |
|
if test "x$no_gtk" = x ; then |
|
2305 |
|
echo "$ac_t""yes" 1>&6 |
|
2306 |
|
: |
|
2307 |
|
else |
|
2308 |
|
echo "$ac_t""no" 1>&6 |
|
2309 |
|
if test "$GTK_CONFIG" = "no" ; then |
|
2310 |
|
echo "*** The gtk-config script installed by GTK could not be found" |
|
2311 |
|
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" |
|
2312 |
|
echo "*** your path, or set the GTK_CONFIG environment variable to the" |
|
2313 |
|
echo "*** full path to gtk-config." |
|
2314 |
|
else |
|
2315 |
|
if test -f conf.gtktest ; then |
|
2316 |
|
: |
|
2317 |
|
else |
|
2318 |
|
echo "*** Could not run GTK test program, checking why..." |
|
2319 |
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
|
2320 |
|
LIBS="$LIBS $GTK_LIBS" |
|
2321 |
|
cat > conftest.$ac_ext <<EOF |
|
2322 |
|
#line 2323 "configure" |
|
2323 |
|
#include "confdefs.h" |
|
2324 |
|
|
|
2325 |
|
#include <gtk/gtk.h> |
|
2326 |
|
#include <stdio.h> |
|
2327 |
|
|
|
2328 |
|
int main() { |
|
2329 |
|
return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); |
|
2330 |
|
; return 0; } |
|
2331 |
|
EOF |
|
2332 |
|
if { (eval echo configure:2333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
2333 |
|
rm -rf conftest* |
|
2334 |
|
echo "*** The test program compiled, but did not run. This usually means" |
|
2335 |
|
echo "*** that the run-time linker is not finding GTK or finding the wrong" |
|
2336 |
|
echo "*** version of GTK. If it is not finding GTK, you'll need to set your" |
|
2337 |
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
|
2338 |
|
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
|
2339 |
|
echo "*** is required on your system" |
|
2340 |
|
echo "***" |
|
2341 |
|
echo "*** If you have an old version installed, it is best to remove it, although" |
|
2342 |
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" |
|
2343 |
|
echo "***" |
|
2344 |
|
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" |
|
2345 |
|
echo "*** came with the system with the command" |
|
2346 |
|
echo "***" |
|
2347 |
|
echo "*** rpm --erase --nodeps gtk gtk-devel" |
|
2348 |
|
else |
|
2349 |
|
echo "configure: failed program was:" >&5 |
|
2350 |
|
cat conftest.$ac_ext >&5 |
|
2351 |
|
rm -rf conftest* |
|
2352 |
|
echo "*** The test program failed to compile or link. See the file config.log for the" |
|
2353 |
|
echo "*** exact error that occured. This usually means GTK was incorrectly installed" |
|
2354 |
|
echo "*** or that you have moved GTK since it was installed. In the latter case, you" |
|
2355 |
|
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" |
|
2356 |
|
fi |
|
2357 |
|
rm -f conftest* |
|
2358 |
|
CFLAGS="$ac_save_CFLAGS" |
|
2359 |
|
LIBS="$ac_save_LIBS" |
|
2360 |
|
fi |
|
2361 |
|
fi |
|
2362 |
|
GTK_CFLAGS="" |
|
2363 |
|
GTK_LIBS="" |
|
2364 |
|
{ echo "configure: error: GTK not installed" 1>&2; exit 1; } |
|
2365 |
|
fi |
|
2366 |
|
|
|
2367 |
|
|
|
2368 |
|
rm -f conf.gtktest |
|
2369 |
|
|
|
2370 |
|
CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" |
|
2371 |
|
|
|
2372 |
|
saved_ldflags="$LDFLAGS" |
|
2373 |
|
LDFLAGS="$LDFLAGS $GTK_LIBS" |
|
2374 |
|
|
|
2375 |
|
gnome_cv_passdown_x_libs="$GTK_LIBS" |
|
2376 |
|
gnome_cv_passdown_X_LIBS="$GTK_LIBS" |
|
2377 |
|
gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS" |
|
2378 |
|
gnome_cv_passdown_GTK_LIBS="$GTK_LIBS" |
|
2379 |
|
|
|
2380 |
|
LDFLAGS="$saved_ldflags $GTK_LIBS" |
|
2381 |
|
|
|
2382 |
|
USE_DEVGTK=true |
|
2383 |
|
|
|
2384 |
|
|
|
2385 |
|
GNOME_HAVE_SM=true |
|
2386 |
|
case "$GTK_LIBS" in |
|
2387 |
|
*-lSM*) |
|
2388 |
|
;; |
|
2389 |
|
*) |
|
2390 |
|
echo $ac_n "checking for SmcSaveYourselfDone in -lSM""... $ac_c" 1>&6 |
|
2391 |
|
echo "configure:2392: checking for SmcSaveYourselfDone in -lSM" >&5 |
|
2392 |
|
ac_lib_var=`echo SM'_'SmcSaveYourselfDone | sed 'y%./+-%__p_%'` |
|
2393 |
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
|
2394 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2395 |
|
else |
|
2396 |
|
ac_save_LIBS="$LIBS" |
|
2397 |
|
LIBS="-lSM $x_libs -lICE $LIBS" |
|
2398 |
|
cat > conftest.$ac_ext <<EOF |
|
2399 |
|
#line 2400 "configure" |
|
2400 |
|
#include "confdefs.h" |
|
2401 |
|
/* Override any gcc2 internal prototype to avoid an error. */ |
|
2402 |
|
/* We use char because int might match the return type of a gcc2 |
|
2403 |
|
builtin and then its argument prototype would still apply. */ |
|
2404 |
|
char SmcSaveYourselfDone(); |
|
2405 |
|
|
|
2406 |
|
int main() { |
|
2407 |
|
SmcSaveYourselfDone() |
|
2408 |
|
; return 0; } |
|
2409 |
|
EOF |
|
2410 |
|
if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
2411 |
|
rm -rf conftest* |
|
2412 |
|
eval "ac_cv_lib_$ac_lib_var=yes" |
|
2413 |
|
else |
|
2414 |
|
echo "configure: failed program was:" >&5 |
|
2415 |
|
cat conftest.$ac_ext >&5 |
|
2416 |
|
rm -rf conftest* |
|
2417 |
|
eval "ac_cv_lib_$ac_lib_var=no" |
|
2418 |
|
fi |
|
2419 |
|
rm -f conftest* |
|
2420 |
|
LIBS="$ac_save_LIBS" |
|
2421 |
|
|
|
2422 |
|
fi |
|
2423 |
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then |
|
2424 |
|
echo "$ac_t""yes" 1>&6 |
|
2425 |
|
GTK_LIBS="-lSM -lICE $GTK_LIBS" |
|
2426 |
|
else |
|
2427 |
|
echo "$ac_t""no" 1>&6 |
|
2428 |
|
GNOME_HAVE_SM=false |
|
2429 |
|
fi |
|
2430 |
|
|
|
2431 |
|
;; |
|
2432 |
|
esac |
|
2433 |
|
|
|
2434 |
|
if test "$GNOME_HAVE_SM" = true; then |
|
2435 |
|
for ac_hdr in X11/SM/SMlib.h |
|
2436 |
|
do |
|
2437 |
|
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` |
|
2438 |
|
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 |
|
2439 |
|
echo "configure:2440: checking for $ac_hdr" >&5 |
|
2440 |
|
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then |
|
2441 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2442 |
|
else |
|
2443 |
|
cat > conftest.$ac_ext <<EOF |
|
2444 |
|
#line 2445 "configure" |
|
2445 |
|
#include "confdefs.h" |
|
2446 |
|
#include <$ac_hdr> |
|
2447 |
|
EOF |
|
2448 |
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" |
|
2449 |
|
{ (eval echo configure:2450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } |
|
2450 |
|
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` |
|
2451 |
|
if test -z "$ac_err"; then |
|
2452 |
|
rm -rf conftest* |
|
2453 |
|
eval "ac_cv_header_$ac_safe=yes" |
|
2454 |
|
else |
|
2455 |
|
echo "$ac_err" >&5 |
|
2456 |
|
echo "configure: failed program was:" >&5 |
|
2457 |
|
cat conftest.$ac_ext >&5 |
|
2458 |
|
rm -rf conftest* |
|
2459 |
|
eval "ac_cv_header_$ac_safe=no" |
|
2460 |
|
fi |
|
2461 |
|
rm -f conftest* |
|
2462 |
|
fi |
|
2463 |
|
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then |
|
2464 |
|
echo "$ac_t""yes" 1>&6 |
|
2465 |
|
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` |
|
2466 |
|
cat >> confdefs.h <<EOF |
|
2467 |
|
#define $ac_tr_hdr 1 |
|
2468 |
|
EOF |
|
2469 |
|
|
|
2470 |
|
else |
|
2471 |
|
echo "$ac_t""no" 1>&6 |
|
2472 |
|
GNOME_HAVE_SM=false |
|
2473 |
|
fi |
|
2474 |
|
done |
|
2475 |
|
|
|
2476 |
|
fi |
|
2477 |
|
|
|
2478 |
|
if test "$GNOME_HAVE_SM" = true; then |
|
2479 |
|
cat >> confdefs.h <<\EOF |
|
2480 |
|
#define HAVE_LIBSM 1 |
|
2481 |
|
EOF |
|
2482 |
|
|
|
2483 |
|
fi |
|
2484 |
|
|
|
2485 |
|
XPM_LIBS="" |
|
2486 |
|
echo $ac_n "checking for XpmFreeXpmImage in -lXpm""... $ac_c" 1>&6 |
|
2487 |
|
echo "configure:2488: checking for XpmFreeXpmImage in -lXpm" >&5 |
|
2488 |
|
ac_lib_var=`echo Xpm'_'XpmFreeXpmImage | sed 'y%./+-%__p_%'` |
|
2489 |
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then |
|
2490 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2491 |
|
else |
|
2492 |
|
ac_save_LIBS="$LIBS" |
|
2493 |
|
LIBS="-lXpm $x_libs $LIBS" |
|
2494 |
|
cat > conftest.$ac_ext <<EOF |
|
2495 |
|
#line 2496 "configure" |
|
2496 |
|
#include "confdefs.h" |
|
2497 |
|
/* Override any gcc2 internal prototype to avoid an error. */ |
|
2498 |
|
/* We use char because int might match the return type of a gcc2 |
|
2499 |
|
builtin and then its argument prototype would still apply. */ |
|
2500 |
|
char XpmFreeXpmImage(); |
|
2501 |
|
|
|
2502 |
|
int main() { |
|
2503 |
|
XpmFreeXpmImage() |
|
2504 |
|
; return 0; } |
|
2505 |
|
EOF |
|
2506 |
|
if { (eval echo configure:2507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
2507 |
|
rm -rf conftest* |
|
2508 |
|
eval "ac_cv_lib_$ac_lib_var=yes" |
|
2509 |
|
else |
|
2510 |
|
echo "configure: failed program was:" >&5 |
|
2511 |
|
cat conftest.$ac_ext >&5 |
|
2512 |
|
rm -rf conftest* |
|
2513 |
|
eval "ac_cv_lib_$ac_lib_var=no" |
|
2514 |
|
fi |
|
2515 |
|
rm -f conftest* |
|
2516 |
|
LIBS="$ac_save_LIBS" |
|
2517 |
|
|
|
2518 |
|
fi |
|
2519 |
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then |
|
2520 |
|
echo "$ac_t""yes" 1>&6 |
|
2521 |
|
XPM_LIBS="-lXpm" |
|
2522 |
|
else |
|
2523 |
|
echo "$ac_t""no" 1>&6 |
|
2524 |
|
fi |
|
2525 |
|
|
|
2526 |
|
|
|
2527 |
|
|
|
2528 |
|
|
|
2529 |
|
LDFLAGS="$saved_ldflags" |
|
2530 |
|
|
|
2531 |
|
|
|
2532 |
|
|
|
2533 |
|
|
|
2534 |
|
ZVT_LIBS=`$GNOME_CONFIG --libs zvt` |
|
2535 |
|
|
|
2536 |
|
|
|
2537 |
|
# Check whether --with-gtk-prefix or --without-gtk-prefix was given. |
|
2538 |
|
if test "${with_gtk_prefix+set}" = set; then |
|
2539 |
|
withval="$with_gtk_prefix" |
|
2540 |
|
gtk_config_prefix="$withval" |
|
2541 |
|
else |
|
2542 |
|
gtk_config_prefix="" |
|
2543 |
|
fi |
|
2544 |
|
|
|
2545 |
|
# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given. |
|
2546 |
|
if test "${with_gtk_exec_prefix+set}" = set; then |
|
2547 |
|
withval="$with_gtk_exec_prefix" |
|
2548 |
|
gtk_config_exec_prefix="$withval" |
|
2549 |
|
else |
|
2550 |
|
gtk_config_exec_prefix="" |
|
2551 |
|
fi |
|
2552 |
|
|
|
2553 |
|
# Check whether --enable-gtktest or --disable-gtktest was given. |
|
2554 |
|
if test "${enable_gtktest+set}" = set; then |
|
2555 |
|
enableval="$enable_gtktest" |
|
2556 |
|
: |
|
2557 |
|
else |
|
2558 |
|
enable_gtktest=yes |
|
2559 |
|
fi |
|
2560 |
|
|
|
2561 |
|
|
|
2562 |
|
for module in . gthread |
|
2563 |
|
do |
|
2564 |
|
case "$module" in |
|
2565 |
|
gthread) |
|
2566 |
|
gtk_config_args="$gtk_config_args gthread" |
|
2567 |
|
;; |
|
2568 |
|
esac |
|
2569 |
|
done |
|
2570 |
|
|
|
2571 |
|
if test x$gtk_config_exec_prefix != x ; then |
|
2572 |
|
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" |
|
2573 |
|
if test x${GTK_CONFIG+set} != xset ; then |
|
2574 |
|
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config |
|
2575 |
|
fi |
|
2576 |
|
fi |
|
2577 |
|
if test x$gtk_config_prefix != x ; then |
|
2578 |
|
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" |
|
2579 |
|
if test x${GTK_CONFIG+set} != xset ; then |
|
2580 |
|
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config |
|
2581 |
|
fi |
|
2582 |
|
fi |
|
2583 |
|
|
|
2584 |
|
# Extract the first word of "gtk-config", so it can be a program name with args. |
|
2585 |
|
set dummy gtk-config; ac_word=$2 |
|
2586 |
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 |
|
2587 |
|
echo "configure:2588: checking for $ac_word" >&5 |
|
2588 |
|
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then |
|
2589 |
|
echo $ac_n "(cached) $ac_c" 1>&6 |
|
2590 |
|
else |
|
2591 |
|
case "$GTK_CONFIG" in |
|
2592 |
|
/*) |
|
2593 |
|
ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path. |
|
2594 |
|
;; |
|
2595 |
|
?:/*) |
|
2596 |
|
ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path. |
|
2597 |
|
;; |
|
2598 |
|
*) |
|
2599 |
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" |
|
2600 |
|
ac_dummy="$PATH" |
|
2601 |
|
for ac_dir in $ac_dummy; do |
|
2602 |
|
test -z "$ac_dir" && ac_dir=. |
|
2603 |
|
if test -f $ac_dir/$ac_word; then |
|
2604 |
|
ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word" |
|
2605 |
|
break |
|
2606 |
|
fi |
|
2607 |
|
done |
|
2608 |
|
IFS="$ac_save_ifs" |
|
2609 |
|
test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no" |
|
2610 |
|
;; |
|
2611 |
|
esac |
|
2612 |
|
fi |
|
2613 |
|
GTK_CONFIG="$ac_cv_path_GTK_CONFIG" |
|
2614 |
|
if test -n "$GTK_CONFIG"; then |
|
2615 |
|
echo "$ac_t""$GTK_CONFIG" 1>&6 |
|
2616 |
|
else |
|
2617 |
|
echo "$ac_t""no" 1>&6 |
|
2618 |
|
fi |
|
2619 |
|
|
|
2620 |
|
min_gtk_version=1.2.0 |
|
2621 |
|
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 |
|
2622 |
|
echo "configure:2623: checking for GTK - version >= $min_gtk_version" >&5 |
|
2623 |
|
no_gtk="" |
|
2624 |
|
if test "$GTK_CONFIG" = "no" ; then |
|
2625 |
|
no_gtk=yes |
|
2626 |
|
else |
|
2627 |
|
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` |
|
2628 |
|
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` |
|
2629 |
|
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
2630 |
|
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` |
|
2631 |
|
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
2632 |
|
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` |
|
2633 |
|
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ |
|
2634 |
|
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` |
|
2635 |
|
if test "x$enable_gtktest" = "xyes" ; then |
|
2636 |
|
ac_save_CFLAGS="$CFLAGS" |
|
2637 |
|
ac_save_LIBS="$LIBS" |
|
2638 |
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
|
2639 |
|
LIBS="$GTK_LIBS $LIBS" |
|
2640 |
|
rm -f conf.gtktest |
|
2641 |
|
if test "$cross_compiling" = yes; then |
|
2642 |
|
echo $ac_n "cross compiling; assumed OK... $ac_c" |
|
2643 |
|
else |
|
2644 |
|
cat > conftest.$ac_ext <<EOF |
|
2645 |
|
#line 2646 "configure" |
|
2646 |
|
#include "confdefs.h" |
|
2647 |
|
|
|
2648 |
|
#include <gtk/gtk.h> |
|
2649 |
|
#include <stdio.h> |
|
2650 |
|
#include <stdlib.h> |
|
2651 |
|
|
|
2652 |
|
int |
|
2653 |
|
main () |
|
2654 |
|
{ |
|
2655 |
|
int major, minor, micro; |
|
2656 |
|
char *tmp_version; |
|
2657 |
|
|
|
2658 |
|
system ("touch conf.gtktest"); |
|
2659 |
|
|
|
2660 |
|
/* HP/UX 9 (%@#!) writes to sscanf strings */ |
|
2661 |
|
tmp_version = g_strdup("$min_gtk_version"); |
|
2662 |
|
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { |
|
2663 |
|
printf("%s, bad version string\n", "$min_gtk_version"); |
|
2664 |
|
exit(1); |
|
2665 |
|
} |
|
2666 |
|
|
|
2667 |
|
if ((gtk_major_version != $gtk_config_major_version) || |
|
2668 |
|
(gtk_minor_version != $gtk_config_minor_version) || |
|
2669 |
|
(gtk_micro_version != $gtk_config_micro_version)) |
|
2670 |
|
{ |
|
2671 |
|
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", |
|
2672 |
|
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, |
|
2673 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
2674 |
|
printf ("*** was found! If gtk-config was correct, then it is best\n"); |
|
2675 |
|
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); |
|
2676 |
|
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
|
2677 |
|
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
|
2678 |
|
printf("*** required on your system.\n"); |
|
2679 |
|
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); |
|
2680 |
|
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); |
|
2681 |
|
printf("*** before re-running configure\n"); |
|
2682 |
|
} |
|
2683 |
|
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) |
|
2684 |
|
else if ((gtk_major_version != GTK_MAJOR_VERSION) || |
|
2685 |
|
(gtk_minor_version != GTK_MINOR_VERSION) || |
|
2686 |
|
(gtk_micro_version != GTK_MICRO_VERSION)) |
|
2687 |
|
{ |
|
2688 |
|
printf("*** GTK+ header files (version %d.%d.%d) do not match\n", |
|
2689 |
|
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); |
|
2690 |
|
printf("*** library (version %d.%d.%d)\n", |
|
2691 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
2692 |
|
} |
|
2693 |
|
#endif /* defined (GTK_MAJOR_VERSION) ... */ |
|
2694 |
|
else |
|
2695 |
|
{ |
|
2696 |
|
if ((gtk_major_version > major) || |
|
2697 |
|
((gtk_major_version == major) && (gtk_minor_version > minor)) || |
|
2698 |
|
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) |
|
2699 |
|
{ |
|
2700 |
|
return 0; |
|
2701 |
|
} |
|
2702 |
|
else |
|
2703 |
|
{ |
|
2704 |
|
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", |
|
2705 |
|
gtk_major_version, gtk_minor_version, gtk_micro_version); |
|
2706 |
|
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", |
|
2707 |
|
major, minor, micro); |
|
2708 |
|
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); |
|
2709 |
|
printf("***\n"); |
|
2710 |
|
printf("*** If you have already installed a sufficiently new version, this error\n"); |
|
2711 |
|
printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); |
|
2712 |
|
printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
|
2713 |
|
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); |
|
2714 |
|
printf("*** correct copy of gtk-config. (In this case, you will have to\n"); |
|
2715 |
|
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
|
2716 |
|
printf("*** so that the correct libraries are found at run-time))\n"); |
|
2717 |
|
} |
|
2718 |
|
} |
|
2719 |
|
return 1; |
|
2720 |
|
} |
|
2721 |
|
|
|
2722 |
|
EOF |
|
2723 |
|
if { (eval echo configure:2724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null |
|
2724 |
|
then |
|
2725 |
|
: |
|
2726 |
|
else |
|
2727 |
|
echo "configure: failed program was:" >&5 |
|
2728 |
|
cat conftest.$ac_ext >&5 |
|
2729 |
|
rm -fr conftest* |
|
2730 |
|
no_gtk=yes |
|
2731 |
|
fi |
|
2732 |
|
rm -fr conftest* |
|
2733 |
|
fi |
|
2734 |
|
|
|
2735 |
|
CFLAGS="$ac_save_CFLAGS" |
|
2736 |
|
LIBS="$ac_save_LIBS" |
|
2737 |
|
fi |
|
2738 |
|
fi |
|
2739 |
|
if test "x$no_gtk" = x ; then |
|
2740 |
|
echo "$ac_t""yes" 1>&6 |
|
2741 |
|
: |
|
2742 |
|
else |
|
2743 |
|
echo "$ac_t""no" 1>&6 |
|
2744 |
|
if test "$GTK_CONFIG" = "no" ; then |
|
2745 |
|
echo "*** The gtk-config script installed by GTK could not be found" |
|
2746 |
|
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" |
|
2747 |
|
echo "*** your path, or set the GTK_CONFIG environment variable to the" |
|
2748 |
|
echo "*** full path to gtk-config." |
|
2749 |
|
else |
|
2750 |
|
if test -f conf.gtktest ; then |
|
2751 |
|
: |
|
2752 |
|
else |
|
2753 |
|
echo "*** Could not run GTK test program, checking why..." |
|
2754 |
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
|
2755 |
|
LIBS="$LIBS $GTK_LIBS" |
|
2756 |
|
cat > conftest.$ac_ext <<EOF |
|
2757 |
|
#line 2758 "configure" |
|
2758 |
|
#include "confdefs.h" |
|
2759 |
|
|
|
2760 |
|
#include <gtk/gtk.h> |
|
2761 |
|
#include <stdio.h> |
|
2762 |
|
|
|
2763 |
|
int main() { |
|
2764 |
|
return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); |
|
2765 |
|
; return 0; } |
|
2766 |
|
EOF |
|
2767 |
|
if { (eval echo configure:2768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then |
|
2768 |
|
rm -rf conftest* |
|
2769 |
|
echo "*** The test program compiled, but did not run. This usually means" |
|
2770 |
|
echo "*** that the run-time linker is not finding GTK or finding the wrong" |
|
2771 |
|
echo "*** version of GTK. If it is not finding GTK, you'll need to set your" |
|
2772 |
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
|
2773 |
|
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
|
2774 |
|
echo "*** is required on your system" |
|
2775 |
|
echo "***" |
|
2776 |
|
echo "*** If you have an old version installed, it is best to remove it, although" |
|
2777 |
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" |
|
2778 |
|
echo "***" |
|
2779 |
|
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" |
|
2780 |
|
echo "*** came with the system with the command" |
|
2781 |
|
echo "***" |
|
2782 |
|
echo "*** rpm --erase --nodeps gtk gtk-devel" |
|
2783 |
|
else |
|
2784 |
|
echo "configure: failed program was:" >&5 |
|
2785 |
|
cat conftest.$ac_ext >&5 |
|
2786 |
|
rm -rf conftest* |
|
2787 |
|
echo "*** The test program failed to compile or link. See the file config.log for the" |
|
2788 |
|
echo "*** exact error that occured. This usually means GTK was incorrectly installed" |
|
2789 |
|
echo "*** or that you have moved GTK since it was installed. In the latter case, you" |
|
2790 |
|
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" |
|
2791 |
|
fi |
|
2792 |
|
rm -f conftest* |
|
2793 |
|
CFLAGS="$ac_save_CFLAGS" |
|
2794 |
|
LIBS="$ac_save_LIBS" |
|
2795 |
|
fi |
|
2796 |
|
fi |
|
2797 |
|
GTK_CFLAGS="" |
|
2798 |
|
GTK_LIBS="" |
|
2799 |
|
{ echo "configure: error: Cannot find GTK: Is gtk-config in path?" 1>&2; exit 1; } |
|
2800 |
|
fi |
|
2801 |
|
|
|
2802 |
|
|
|
2803 |
|
rm -f conf.gtktest |
|
2804 |
|
|
|
2805 |
|
|
|
2806 |
|
if test "x${datadir}" = 'x${prefix}/share'; then |
|
2807 |
|
if test "x${prefix}" = "xNONE"; then |
|
2808 |
|
cat >> confdefs.h <<EOF |
|
2809 |
|
#define PACKAGE_DATA_DIR "${ac_default_prefix}/share/${PACKAGE}" |
|
2810 |
|
EOF |
|
2811 |
|
|
|
2812 |
|
else |
|
2813 |
|
cat >> confdefs.h <<EOF |
|
2814 |
|
#define PACKAGE_DATA_DIR "${prefix}/share/${PACKAGE}" |
|
2815 |
|
EOF |
|
2816 |
|
|
|
2817 |
|
fi |
|
2818 |
|
else |
|
2819 |
|
cat >> confdefs.h <<EOF |
|
2820 |
|
#define PACKAGE_DATA_DIR "${datadir}/${PACKAGE}" |
|
2821 |
|
EOF |
|
2822 |
|
|
|
2823 |
|
fi |
|
2824 |
|
|
|
2825 |
|
|
|
2826 |
|
packagesrcdir=`cd $srcdir && pwd` |
|
2827 |
|
cat >> confdefs.h <<EOF |
|
2828 |
|
#define PACKAGE_SOURCE_DIR "${packagesrcdir}" |
|
2829 |
|
EOF |
|
2830 |
|
|
|
2831 |
|
|
|
2832 |
|
if test "x$GCC" = "xyes"; then |
|
2833 |
|
case " $CFLAGS " in |
|
2834 |
|
*[\ \ ]-Wall[\ \ ]*) ;; |
|
2835 |
|
*) CFLAGS="$CFLAGS -Wall" ;; |
|
2836 |
|
esac |
|
2837 |
|
fi |
|
2838 |
|
|
|
2839 |
|
trap '' 1 2 15 |
|
2840 |
|
cat > confcache <<\EOF |
|
2841 |
|
# This file is a shell script that caches the results of configure |
|
2842 |
|
# tests run on this system so they can be shared between configure |
|
2843 |
|
# scripts and configure runs. It is not useful on other systems. |
|
2844 |
|
# If it contains results you don't want to keep, you may remove or edit it. |
|
2845 |
|
# |
|
2846 |
|
# By default, configure uses ./config.cache as the cache file, |
|
2847 |
|
# creating it if it does not exist already. You can give configure |
|
2848 |
|
# the --cache-file=FILE option to use a different cache file; that is |
|
2849 |
|
# what configure does when it calls configure scripts in |
|
2850 |
|
# subdirectories, so they share the cache. |
|
2851 |
|
# Giving --cache-file=/dev/null disables caching, for debugging configure. |
|
2852 |
|
# config.status only pays attention to the cache file if you give it the |
|
2853 |
|
# --recheck option to rerun configure. |
|
2854 |
|
# |
|
2855 |
|
EOF |
|
2856 |
|
# The following way of writing the cache mishandles newlines in values, |
|
2857 |
|
# but we know of no workaround that is simple, portable, and efficient. |
|
2858 |
|
# So, don't put newlines in cache variables' values. |
|
2859 |
|
# Ultrix sh set writes to stderr and can't be redirected directly, |
|
2860 |
|
# and sets the high bit in the cache file unless we assign to the vars. |
|
2861 |
|
(set) 2>&1 | |
|
2862 |
|
case `(ac_space=' '; set | grep ac_space) 2>&1` in |
|
2863 |
|
*ac_space=\ *) |
|
2864 |
|
# `set' does not quote correctly, so add quotes (double-quote substitution |
|
2865 |
|
# turns \\\\ into \\, and sed turns \\ into \). |
|
2866 |
|
sed -n \ |
|
2867 |
|
-e "s/'/'\\\\''/g" \ |
|
2868 |
|
-e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" |
|
2869 |
|
;; |
|
2870 |
|
*) |
|
2871 |
|
# `set' quotes correctly as required by POSIX, so do not add quotes. |
|
2872 |
|
sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' |
|
2873 |
|
;; |
|
2874 |
|
esac >> confcache |
|
2875 |
|
if cmp -s $cache_file confcache; then |
|
2876 |
|
: |
|
2877 |
|
else |
|
2878 |
|
if test -w $cache_file; then |
|
2879 |
|
echo "updating cache $cache_file" |
|
2880 |
|
cat confcache > $cache_file |
|
2881 |
|
else |
|
2882 |
|
echo "not updating unwritable cache $cache_file" |
|
2883 |
|
fi |
|
2884 |
|
fi |
|
2885 |
|
rm -f confcache |
|
2886 |
|
|
|
2887 |
|
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 |
|
2888 |
|
|
|
2889 |
|
test "x$prefix" = xNONE && prefix=$ac_default_prefix |
|
2890 |
|
# Let make expand exec_prefix. |
|
2891 |
|
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' |
|
2892 |
|
|
|
2893 |
|
# Any assignment to VPATH causes Sun make to only execute |
|
2894 |
|
# the first set of double-colon rules, so remove it if not needed. |
|
2895 |
|
# If there is a colon in the path, we need to keep it. |
|
2896 |
|
if test "x$srcdir" = x.; then |
|
2897 |
|
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' |
|
2898 |
|
fi |
|
2899 |
|
|
|
2900 |
|
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 |
|
2901 |
|
|
|
2902 |
|
DEFS=-DHAVE_CONFIG_H |
|
2903 |
|
|
|
2904 |
|
# Without the "./", some shells look in PATH for config.status. |
|
2905 |
|
: ${CONFIG_STATUS=./config.status} |
|
2906 |
|
|
|
2907 |
|
echo creating $CONFIG_STATUS |
|
2908 |
|
rm -f $CONFIG_STATUS |
|
2909 |
|
cat > $CONFIG_STATUS <<EOF |
|
2910 |
|
#! /bin/sh |
|
2911 |
|
# Generated automatically by configure. |
|
2912 |
|
# Run this file to recreate the current configuration. |
|
2913 |
|
# This directory was configured as follows, |
|
2914 |
|
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: |
|
2915 |
|
# |
|
2916 |
|
# $0 $ac_configure_args |
|
2917 |
|
# |
|
2918 |
|
# Compiler output produced by configure, useful for debugging |
|
2919 |
|
# configure, is in ./config.log if it exists. |
|
2920 |
|
|
|
2921 |
|
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" |
|
2922 |
|
for ac_option |
|
2923 |
|
do |
|
2924 |
|
case "\$ac_option" in |
|
2925 |
|
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) |
|
2926 |
|
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" |
|
2927 |
|
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; |
|
2928 |
|
-version | --version | --versio | --versi | --vers | --ver | --ve | --v) |
|
2929 |
|
echo "$CONFIG_STATUS generated by autoconf version 2.13" |
|
2930 |
|
exit 0 ;; |
|
2931 |
|
-help | --help | --hel | --he | --h) |
|
2932 |
|
echo "\$ac_cs_usage"; exit 0 ;; |
|
2933 |
|
*) echo "\$ac_cs_usage"; exit 1 ;; |
|
2934 |
|
esac |
|
2935 |
|
done |
|
2936 |
|
|
|
2937 |
|
ac_given_srcdir=$srcdir |
|
2938 |
|
ac_given_INSTALL="$INSTALL" |
|
2939 |
|
|
|
2940 |
|
trap 'rm -fr `echo " |
|
2941 |
|
Makefile |
|
2942 |
|
macros/Makefile |
|
2943 |
|
src/Makefile |
|
2944 |
|
config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 |
|
2945 |
|
EOF |
|
2946 |
|
cat >> $CONFIG_STATUS <<EOF |
|
2947 |
|
|
|
2948 |
|
# Protect against being on the right side of a sed subst in config.status. |
|
2949 |
|
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; |
|
2950 |
|
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF |
|
2951 |
|
$ac_vpsub |
|
2952 |
|
$extrasub |
|
2953 |
|
s%@SHELL@%$SHELL%g |
|
2954 |
|
s%@CFLAGS@%$CFLAGS%g |
|
2955 |
|
s%@CPPFLAGS@%$CPPFLAGS%g |
|
2956 |
|
s%@CXXFLAGS@%$CXXFLAGS%g |
|
2957 |
|
s%@FFLAGS@%$FFLAGS%g |
|
2958 |
|
s%@DEFS@%$DEFS%g |
|
2959 |
|
s%@LDFLAGS@%$LDFLAGS%g |
|
2960 |
|
s%@LIBS@%$LIBS%g |
|
2961 |
|
s%@exec_prefix@%$exec_prefix%g |
|
2962 |
|
s%@prefix@%$prefix%g |
|
2963 |
|
s%@program_transform_name@%$program_transform_name%g |
|
2964 |
|
s%@bindir@%$bindir%g |
|
2965 |
|
s%@sbindir@%$sbindir%g |
|
2966 |
|
s%@libexecdir@%$libexecdir%g |
|
2967 |
|
s%@datadir@%$datadir%g |
|
2968 |
|
s%@sysconfdir@%$sysconfdir%g |
|
2969 |
|
s%@sharedstatedir@%$sharedstatedir%g |
|
2970 |
|
s%@localstatedir@%$localstatedir%g |
|
2971 |
|
s%@libdir@%$libdir%g |
|
2972 |
|
s%@includedir@%$includedir%g |
|
2973 |
|
s%@oldincludedir@%$oldincludedir%g |
|
2974 |
|
s%@infodir@%$infodir%g |
|
2975 |
|
s%@mandir@%$mandir%g |
|
2976 |
|
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g |
|
2977 |
|
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g |
|
2978 |
|
s%@INSTALL_DATA@%$INSTALL_DATA%g |
|
2979 |
|
s%@PACKAGE@%$PACKAGE%g |
|
2980 |
|
s%@VERSION@%$VERSION%g |
|
2981 |
|
s%@ACLOCAL@%$ACLOCAL%g |
|
2982 |
|
s%@AUTOCONF@%$AUTOCONF%g |
|
2983 |
|
s%@AUTOMAKE@%$AUTOMAKE%g |
|
2984 |
|
s%@AUTOHEADER@%$AUTOHEADER%g |
|
2985 |
|
s%@MAKEINFO@%$MAKEINFO%g |
|
2986 |
|
s%@SET_MAKE@%$SET_MAKE%g |
|
2987 |
|
s%@INSIDE_GNOME_COMMON_TRUE@%$INSIDE_GNOME_COMMON_TRUE%g |
|
2988 |
|
s%@INSIDE_GNOME_COMMON_FALSE@%$INSIDE_GNOME_COMMON_FALSE%g |
|
2989 |
|
s%@GNOME_LIBS@%$GNOME_LIBS%g |
|
2990 |
|
s%@GNOMEUI_LIBS@%$GNOMEUI_LIBS%g |
|
2991 |
|
s%@GNOMEGNORBA_LIBS@%$GNOMEGNORBA_LIBS%g |
|
2992 |
|
s%@GTKXMHTML_LIBS@%$GTKXMHTML_LIBS%g |
|
2993 |
|
s%@ZVT_LIBS@%$ZVT_LIBS%g |
|
2994 |
|
s%@GNOME_LIBDIR@%$GNOME_LIBDIR%g |
|
2995 |
|
s%@GNOME_INCLUDEDIR@%$GNOME_INCLUDEDIR%g |
|
2996 |
|
s%@GNOME_CONFIG@%$GNOME_CONFIG%g |
|
2997 |
|
s%@ORBIT_CONFIG@%$ORBIT_CONFIG%g |
|
2998 |
|
s%@ORBIT_IDL@%$ORBIT_IDL%g |
|
2999 |
|
s%@HAVE_ORBIT_TRUE@%$HAVE_ORBIT_TRUE%g |
|
3000 |
|
s%@HAVE_ORBIT_FALSE@%$HAVE_ORBIT_FALSE%g |
|
3001 |
|
s%@ORBIT_CFLAGS@%$ORBIT_CFLAGS%g |
|
3002 |
|
s%@ORBIT_LIBS@%$ORBIT_LIBS%g |
|
3003 |
|
s%@HAVE_GNORBA_TRUE@%$HAVE_GNORBA_TRUE%g |
|
3004 |
|
s%@HAVE_GNORBA_FALSE@%$HAVE_GNORBA_FALSE%g |
|
3005 |
|
s%@GNORBA_CFLAGS@%$GNORBA_CFLAGS%g |
|
3006 |
|
s%@GNORBA_LIBS@%$GNORBA_LIBS%g |
|
3007 |
|
s%@GNOME_APPLETS_LIBS@%$GNOME_APPLETS_LIBS%g |
|
3008 |
|
s%@GNOME_DOCKLETS_LIBS@%$GNOME_DOCKLETS_LIBS%g |
|
3009 |
|
s%@GNOME_CAPPLET_LIBS@%$GNOME_CAPPLET_LIBS%g |
|
3010 |
|
s%@CC@%$CC%g |
|
3011 |
|
s%@CPP@%$CPP%g |
|
3012 |
|
s%@cflags_set@%$cflags_set%g |
|
3013 |
|
s%@GTK_CONFIG@%$GTK_CONFIG%g |
|
3014 |
|
s%@GTK_CFLAGS@%$GTK_CFLAGS%g |
|
3015 |
|
s%@GTK_LIBS@%$GTK_LIBS%g |
|
3016 |
|
s%@XPM_LIBS@%$XPM_LIBS%g |
|
3017 |
|
s%@PTHREAD_LIB@%$PTHREAD_LIB%g |
|
3018 |
|
|
|
3019 |
|
CEOF |
|
3020 |
|
EOF |
|
3021 |
|
|
|
3022 |
|
cat >> $CONFIG_STATUS <<\EOF |
|
3023 |
|
|
|
3024 |
|
# Split the substitutions into bite-sized pieces for seds with |
|
3025 |
|
# small command number limits, like on Digital OSF/1 and HP-UX. |
|
3026 |
|
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. |
|
3027 |
|
ac_file=1 # Number of current file. |
|
3028 |
|
ac_beg=1 # First line for current file. |
|
3029 |
|
ac_end=$ac_max_sed_cmds # Line after last line for current file. |
|
3030 |
|
ac_more_lines=: |
|
3031 |
|
ac_sed_cmds="" |
|
3032 |
|
while $ac_more_lines; do |
|
3033 |
|
if test $ac_beg -gt 1; then |
|
3034 |
|
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file |
|
3035 |
|
else |
|
3036 |
|
sed "${ac_end}q" conftest.subs > conftest.s$ac_file |
|
3037 |
|
fi |
|
3038 |
|
if test ! -s conftest.s$ac_file; then |
|
3039 |
|
ac_more_lines=false |
|
3040 |
|
rm -f conftest.s$ac_file |
|
3041 |
|
else |
|
3042 |
|
if test -z "$ac_sed_cmds"; then |
|
3043 |
|
ac_sed_cmds="sed -f conftest.s$ac_file" |
|
3044 |
|
else |
|
3045 |
|
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" |
|
3046 |
|
fi |
|
3047 |
|
ac_file=`expr $ac_file + 1` |
|
3048 |
|
ac_beg=$ac_end |
|
3049 |
|
ac_end=`expr $ac_end + $ac_max_sed_cmds` |
|
3050 |
|
fi |
|
3051 |
|
done |
|
3052 |
|
if test -z "$ac_sed_cmds"; then |
|
3053 |
|
ac_sed_cmds=cat |
|
3054 |
|
fi |
|
3055 |
|
EOF |
|
3056 |
|
|
|
3057 |
|
cat >> $CONFIG_STATUS <<EOF |
|
3058 |
|
|
|
3059 |
|
CONFIG_FILES=\${CONFIG_FILES-"Makefile |
|
3060 |
|
macros/Makefile |
|
3061 |
|
src/Makefile |
|
3062 |
|
"} |
|
3063 |
|
EOF |
|
3064 |
|
cat >> $CONFIG_STATUS <<\EOF |
|
3065 |
|
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then |
|
3066 |
|
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". |
|
3067 |
|
case "$ac_file" in |
|
3068 |
|
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` |
|
3069 |
|
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; |
|
3070 |
|
*) ac_file_in="${ac_file}.in" ;; |
|
3071 |
|
esac |
|
3072 |
|
|
|
3073 |
|
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. |
|
3074 |
|
|
|
3075 |
|
# Remove last slash and all that follows it. Not all systems have dirname. |
|
3076 |
|
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` |
|
3077 |
|
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then |
|
3078 |
|
# The file is in a subdirectory. |
|
3079 |
|
test ! -d "$ac_dir" && mkdir "$ac_dir" |
|
3080 |
|
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" |
|
3081 |
|
# A "../" for each directory in $ac_dir_suffix. |
|
3082 |
|
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` |
|
3083 |
|
else |
|
3084 |
|
ac_dir_suffix= ac_dots= |
|
3085 |
|
fi |
|
3086 |
|
|
|
3087 |
|
case "$ac_given_srcdir" in |
|
3088 |
|
.) srcdir=. |
|
3089 |
|
if test -z "$ac_dots"; then top_srcdir=. |
|
3090 |
|
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; |
|
3091 |
|
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; |
|
3092 |
|
*) # Relative path. |
|
3093 |
|
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" |
|
3094 |
|
top_srcdir="$ac_dots$ac_given_srcdir" ;; |
|
3095 |
|
esac |
|
3096 |
|
|
|
3097 |
|
case "$ac_given_INSTALL" in |
|
3098 |
|
[/$]*) INSTALL="$ac_given_INSTALL" ;; |
|
3099 |
|
*) INSTALL="$ac_dots$ac_given_INSTALL" ;; |
|
3100 |
|
esac |
|
3101 |
|
|
|
3102 |
|
echo creating "$ac_file" |
|
3103 |
|
rm -f "$ac_file" |
|
3104 |
|
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." |
|
3105 |
|
case "$ac_file" in |
|
3106 |
|
*Makefile*) ac_comsub="1i\\ |
|
3107 |
|
# $configure_input" ;; |
|
3108 |
|
*) ac_comsub= ;; |
|
3109 |
|
esac |
|
3110 |
|
|
|
3111 |
|
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` |
|
3112 |
|
sed -e "$ac_comsub |
|
3113 |
|
s%@configure_input@%$configure_input%g |
|
3114 |
|
s%@srcdir@%$srcdir%g |
|
3115 |
|
s%@top_srcdir@%$top_srcdir%g |
|
3116 |
|
s%@INSTALL@%$INSTALL%g |
|
3117 |
|
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file |
|
3118 |
|
fi; done |
|
3119 |
|
rm -f conftest.s* |
|
3120 |
|
|
|
3121 |
|
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where |
|
3122 |
|
# NAME is the cpp macro being defined and VALUE is the value it is being given. |
|
3123 |
|
# |
|
3124 |
|
# ac_d sets the value in "#define NAME VALUE" lines. |
|
3125 |
|
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' |
|
3126 |
|
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' |
|
3127 |
|
ac_dC='\3' |
|
3128 |
|
ac_dD='%g' |
|
3129 |
|
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". |
|
3130 |
|
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' |
|
3131 |
|
ac_uB='\([ ]\)%\1#\2define\3' |
|
3132 |
|
ac_uC=' ' |
|
3133 |
|
ac_uD='\4%g' |
|
3134 |
|
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". |
|
3135 |
|
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' |
|
3136 |
|
ac_eB='$%\1#\2define\3' |
|
3137 |
|
ac_eC=' ' |
|
3138 |
|
ac_eD='%g' |
|
3139 |
|
|
|
3140 |
|
if test "${CONFIG_HEADERS+set}" != set; then |
|
3141 |
|
EOF |
|
3142 |
|
cat >> $CONFIG_STATUS <<EOF |
|
3143 |
|
CONFIG_HEADERS="config.h" |
|
3144 |
|
EOF |
|
3145 |
|
cat >> $CONFIG_STATUS <<\EOF |
|
3146 |
|
fi |
|
3147 |
|
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then |
|
3148 |
|
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". |
|
3149 |
|
case "$ac_file" in |
|
3150 |
|
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` |
|
3151 |
|
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; |
|
3152 |
|
*) ac_file_in="${ac_file}.in" ;; |
|
3153 |
|
esac |
|
3154 |
|
|
|
3155 |
|
echo creating $ac_file |
|
3156 |
|
|
|
3157 |
|
rm -f conftest.frag conftest.in conftest.out |
|
3158 |
|
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` |
|
3159 |
|
cat $ac_file_inputs > conftest.in |
|
3160 |
|
|
|
3161 |
|
EOF |
|
3162 |
|
|
|
3163 |
|
# Transform confdefs.h into a sed script conftest.vals that substitutes |
|
3164 |
|
# the proper values into config.h.in to produce config.h. And first: |
|
3165 |
|
# Protect against being on the right side of a sed subst in config.status. |
|
3166 |
|
# Protect against being in an unquoted here document in config.status. |
|
3167 |
|
rm -f conftest.vals |
|
3168 |
|
cat > conftest.hdr <<\EOF |
|
3169 |
|
s/[\\&%]/\\&/g |
|
3170 |
|
s%[\\$`]%\\&%g |
|
3171 |
|
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp |
|
3172 |
|
s%ac_d%ac_u%gp |
|
3173 |
|
s%ac_u%ac_e%gp |
|
3174 |
|
EOF |
|
3175 |
|
sed -n -f conftest.hdr confdefs.h > conftest.vals |
|
3176 |
|
rm -f conftest.hdr |
|
3177 |
|
|
|
3178 |
|
# This sed command replaces #undef with comments. This is necessary, for |
|
3179 |
|
# example, in the case of _POSIX_SOURCE, which is predefined and required |
|
3180 |
|
# on some systems where configure will not decide to define it. |
|
3181 |
|
cat >> conftest.vals <<\EOF |
|
3182 |
|
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% |
|
3183 |
|
EOF |
|
3184 |
|
|
|
3185 |
|
# Break up conftest.vals because some shells have a limit on |
|
3186 |
|
# the size of here documents, and old seds have small limits too. |
|
3187 |
|
|
|
3188 |
|
rm -f conftest.tail |
|
3189 |
|
while : |
|
3190 |
|
do |
|
3191 |
|
ac_lines=`grep -c . conftest.vals` |
|
3192 |
|
# grep -c gives empty output for an empty file on some AIX systems. |
|
3193 |
|
if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi |
|
3194 |
|
# Write a limited-size here document to conftest.frag. |
|
3195 |
|
echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS |
|
3196 |
|
sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS |
|
3197 |
|
echo 'CEOF |
|
3198 |
|
sed -f conftest.frag conftest.in > conftest.out |
|
3199 |
|
rm -f conftest.in |
|
3200 |
|
mv conftest.out conftest.in |
|
3201 |
|
' >> $CONFIG_STATUS |
|
3202 |
|
sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail |
|
3203 |
|
rm -f conftest.vals |
|
3204 |
|
mv conftest.tail conftest.vals |
|
3205 |
|
done |
|
3206 |
|
rm -f conftest.vals |
|
3207 |
|
|
|
3208 |
|
cat >> $CONFIG_STATUS <<\EOF |
|
3209 |
|
rm -f conftest.frag conftest.h |
|
3210 |
|
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h |
|
3211 |
|
cat conftest.in >> conftest.h |
|
3212 |
|
rm -f conftest.in |
|
3213 |
|
if cmp -s $ac_file conftest.h 2>/dev/null; then |
|
3214 |
|
echo "$ac_file is unchanged" |
|
3215 |
|
rm -f conftest.h |
|
3216 |
|
else |
|
3217 |
|
# Remove last slash and all that follows it. Not all systems have dirname. |
|
3218 |
|
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` |
|
3219 |
|
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then |
|
3220 |
|
# The file is in a subdirectory. |
|
3221 |
|
test ! -d "$ac_dir" && mkdir "$ac_dir" |
|
3222 |
|
fi |
|
3223 |
|
rm -f $ac_file |
|
3224 |
|
mv conftest.h $ac_file |
|
3225 |
|
fi |
|
3226 |
|
fi; done |
|
3227 |
|
|
|
3228 |
|
EOF |
|
3229 |
|
cat >> $CONFIG_STATUS <<EOF |
|
3230 |
|
|
|
3231 |
|
|
|
3232 |
|
EOF |
|
3233 |
|
cat >> $CONFIG_STATUS <<\EOF |
|
3234 |
|
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h |
|
3235 |
|
|
|
3236 |
|
exit 0 |
|
3237 |
|
EOF |
|
3238 |
|
chmod +x $CONFIG_STATUS |
|
3239 |
|
rm -fr confdefs* $ac_clean_files |
|
3240 |
|
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 |
|
3241 |
|
|
|
3242 |
|
|
| File src/command_mode.c added (mode: 100644) (index 0000000..f8d12a8) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
#include <stdlib.h> |
|
20 |
|
#include <stdio.h> |
|
21 |
|
#include <string.h> |
|
22 |
|
#include <ctype.h> |
|
23 |
|
#include "vide.h" |
|
24 |
|
|
|
25 |
|
|
|
26 |
|
Command com; |
|
27 |
|
|
|
28 |
|
void |
|
29 |
|
add_command(gchar *name, gchar *action) |
|
30 |
|
{ |
|
31 |
|
Command_Mode_Programs cmp; |
|
32 |
|
|
|
33 |
|
strncpy(cmp.name, name, sizeof(cmp.name)); |
|
34 |
|
strncpy(cmp.action, action, sizeof(cmp.action)); |
|
35 |
|
cfg.command_mode_programs = g_list_append(cfg.command_mode_programs, |
|
36 |
|
duplicate (&cmp, sizeof (Command_Mode_Programs))); |
|
37 |
|
} |
|
38 |
|
|
|
39 |
|
static void |
|
40 |
|
reset_signals() |
|
41 |
|
{ |
|
42 |
|
guint new_key_press_signal; |
|
43 |
|
int x; |
|
44 |
|
|
|
45 |
|
com.index = 0; |
|
46 |
|
for(x = 0; x < 1024; x++) |
|
47 |
|
com.buffer[x] = '\0'; |
|
48 |
|
|
|
49 |
|
new_key_press_signal = GPOINTER_TO_INT(gtk_object_get_data( |
|
50 |
|
GTK_OBJECT(curr_view->clist),"signal_key_id")); |
|
51 |
|
gtk_signal_disconnect(GTK_OBJECT(curr_view->clist), new_key_press_signal); |
|
52 |
|
|
|
53 |
|
new_key_press_signal = gtk_signal_connect(GTK_OBJECT(curr_view->clist), |
|
54 |
|
"key_press_event", GTK_SIGNAL_FUNC(file_list_key_press_cb), curr_view); |
|
55 |
|
gtk_object_set_data(GTK_OBJECT(curr_view->clist), "signal_key_id", |
|
56 |
|
GUINT_TO_POINTER(new_key_press_signal)); |
|
57 |
|
|
|
58 |
|
} |
|
59 |
|
|
|
60 |
|
|
|
61 |
|
static void |
|
62 |
|
back_to_normal_mode(FileView *view) |
|
63 |
|
{ |
|
64 |
|
int x; |
|
65 |
|
//gchar status_text[128]; |
|
66 |
|
|
|
67 |
|
com.index = 0; |
|
68 |
|
for(x = 0; x < 1024; x++) |
|
69 |
|
com.buffer[x] = '\0'; |
|
70 |
|
|
|
71 |
|
/* |
|
72 |
|
g_snprintf(status_text, sizeof(status_text), |
|
73 |
|
"%d of %d files selected", |
|
74 |
|
g_list_length(GTK_CLIST(curr_view->clist)->selection), |
|
75 |
|
GTK_CLIST(curr_view->clist)->rows); |
|
76 |
|
gtk_label_set_text(GTK_LABEL(app.status_bar), status_text); |
|
77 |
|
*/ |
|
78 |
|
show_file_properties(); |
|
79 |
|
reset_signals(); |
|
80 |
|
|
|
81 |
|
} |
|
82 |
|
|
|
83 |
|
|
|
84 |
|
void |
|
85 |
|
execute_command(gchar *action) |
|
86 |
|
{ |
|
87 |
|
gchar *command = strdup(action); |
|
88 |
|
gchar *arg1 = NULL; |
|
89 |
|
gchar *arg2 = NULL; |
|
90 |
|
gchar *arg3 = NULL; |
|
91 |
|
gint arguments = 0; |
|
92 |
|
gchar buf[PATH_MAX]; |
|
93 |
|
gchar *file = NULL; |
|
94 |
|
GList *tmp1; |
|
95 |
|
GString *ex_command; |
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
g_snprintf(com.buffer, sizeof(com.buffer), "%s", command); |
|
100 |
|
command++; |
|
101 |
|
|
|
102 |
|
if(!strstr(command, " ")) /* only one argument */ |
|
103 |
|
{ |
|
104 |
|
arg1 = g_strdup(command); |
|
105 |
|
arguments = 1; |
|
106 |
|
} |
|
107 |
|
else /* at least two arguments */ |
|
108 |
|
{ |
|
109 |
|
arg2 = (strchr(command, ' ') +1); |
|
110 |
|
arg1 = g_strndup(command,(strlen(command) - strlen(arg2) -1)); |
|
111 |
|
arguments = 2; |
|
112 |
|
|
|
113 |
|
if(strstr(arg2, " ")) /* three arguments */ |
|
114 |
|
{ |
|
115 |
|
arg3 =(strchr(arg2, ' ') +1); |
|
116 |
|
arg2 = g_strndup(arg2, (strlen(arg2) - strlen(arg3) -1)); |
|
117 |
|
arguments = 3; |
|
118 |
|
} |
|
119 |
|
} |
|
120 |
|
|
|
121 |
|
/* First selected file */ |
|
122 |
|
gtk_clist_get_text(GTK_CLIST(curr_view->clist), curr_view->row, 0, &file); |
|
123 |
|
/* All of the selected files */ |
|
124 |
|
ex_command = expand_macros("%f"); |
|
125 |
|
|
|
126 |
|
/* |
|
127 |
|
* Expand the macros for user defined commands |
|
128 |
|
*/ |
|
129 |
|
|
|
130 |
|
for(tmp1 = cfg.command_mode_programs; tmp1 != NULL; tmp1 = tmp1->next) |
|
131 |
|
{ |
|
132 |
|
|
|
133 |
|
Command_Mode_Programs *program = tmp1->data; |
|
134 |
|
|
|
135 |
|
if(!strcmp(program->name, command)) |
|
136 |
|
{ |
|
137 |
|
GString *tmp_command; |
|
138 |
|
|
|
139 |
|
tmp_command = expand_macros(program->action); |
|
140 |
|
|
|
141 |
|
if(tmp_command != NULL) |
|
142 |
|
{ |
|
143 |
|
g_snprintf(com.buffer, sizeof(com.buffer), ":%s", tmp_command->str); |
|
144 |
|
g_string_free(tmp_command, TRUE); |
|
145 |
|
} |
|
146 |
|
} |
|
147 |
|
} |
|
148 |
|
g_list_free(tmp1); |
|
149 |
|
|
|
150 |
|
|
|
151 |
|
/* :com */ |
|
152 |
|
if(!strcmp(arg1,"com")) |
|
153 |
|
{ |
|
154 |
|
|
|
155 |
|
if(arguments == 3) |
|
156 |
|
{ |
|
157 |
|
GList *tmp = NULL; |
|
158 |
|
Command_Mode_Programs cmp; |
|
159 |
|
gchar *reserved[] = {"com", "delc", "exe", "/", "cd", "0", "!", "sh", |
|
160 |
|
"mark","his", "x", "e", "sb", "sp", "on", "only", "set filter", "set", |
|
161 |
|
"nofil", "nofilter", "in", "invert", "fil", "filter", "vs", "ls", "pw","pwd"}; |
|
162 |
|
int index; |
|
163 |
|
|
|
164 |
|
/* check for commands that should not be redefined */ |
|
165 |
|
|
|
166 |
|
for(index = 0; index < 28; index++) |
|
167 |
|
{ |
|
168 |
|
if(!strcmp(arg2, reserved[index])) |
|
169 |
|
{ |
|
170 |
|
gchar buf[48]; |
|
171 |
|
back_to_normal_mode(curr_view); |
|
172 |
|
g_snprintf(buf, sizeof(buf), "%s is a reserved command name.", |
|
173 |
|
reserved[index]); |
|
174 |
|
create_error_dialog(buf); |
|
175 |
|
return; |
|
176 |
|
} |
|
177 |
|
} |
|
178 |
|
/* check for duplicate command names and remove */ |
|
179 |
|
for(tmp = cfg.command_mode_programs; tmp != NULL; tmp = tmp->next) |
|
180 |
|
{ |
|
181 |
|
Command_Mode_Programs *program = tmp->data; |
|
182 |
|
|
|
183 |
|
if(!strcmp(program->name, arg2)) |
|
184 |
|
{ |
|
185 |
|
cfg.command_mode_programs = g_list_remove_link( |
|
186 |
|
cfg.command_mode_programs, |
|
187 |
|
tmp); |
|
188 |
|
break; |
|
189 |
|
} |
|
190 |
|
} |
|
191 |
|
g_list_free(tmp); |
|
192 |
|
if(arguments == 3) |
|
193 |
|
{ |
|
194 |
|
strncpy(cmp.name, arg2, sizeof(cmp.name)); |
|
195 |
|
|
|
196 |
|
strncpy(cmp.action, arg3, sizeof(cmp.action)); |
|
197 |
|
cfg.command_mode_programs = g_list_append(cfg.command_mode_programs, |
|
198 |
|
duplicate (&cmp, sizeof (Command_Mode_Programs))); |
|
199 |
|
|
|
200 |
|
|
|
201 |
|
write_command_mode_file(); |
|
202 |
|
recreate_main_window(); |
|
203 |
|
} |
|
204 |
|
} |
|
205 |
|
else |
|
206 |
|
{ |
|
207 |
|
create_command_mode_menu(); |
|
208 |
|
gtk_menu_popup(GTK_MENU(app.command_mode_menu), NULL, NULL, |
|
209 |
|
set_menu_position, NULL, 0, 0); |
|
210 |
|
back_to_normal_mode(curr_view); |
|
211 |
|
return; |
|
212 |
|
} |
|
213 |
|
} |
|
214 |
|
|
|
215 |
|
/* need to reparse commands after expansion */ |
|
216 |
|
command = strdup(com.buffer); |
|
217 |
|
command++; |
|
218 |
|
|
|
219 |
|
if(!strstr(command, " ")) |
|
220 |
|
arg1 = g_strdup(command); |
|
221 |
|
else |
|
222 |
|
{ |
|
223 |
|
arg2 = (strchr(command, ' ') +1); |
|
224 |
|
arg1 = g_strndup(command,(strlen(command) - strlen(arg2) -1)); |
|
225 |
|
arguments = 2; |
|
226 |
|
|
|
227 |
|
if(strstr(arg2, " ")) |
|
228 |
|
{ |
|
229 |
|
arg3 =(strchr(arg2, ' ') +1); |
|
230 |
|
arg2 = g_strndup(arg2, (strlen(arg2) - strlen(arg3) -1)); |
|
231 |
|
arguments = 3; |
|
232 |
|
} |
|
233 |
|
} |
|
234 |
|
|
|
235 |
|
/* exe */ |
|
236 |
|
if(!strcmp(arg1, "exe")) |
|
237 |
|
{ |
|
238 |
|
file_exec(g_strdup(command +4)); |
|
239 |
|
back_to_normal_mode(curr_view); |
|
240 |
|
return; |
|
241 |
|
} |
|
242 |
|
|
|
243 |
|
/* grep */ |
|
244 |
|
if(!strcmp(arg1, "grep")) |
|
245 |
|
{ |
|
246 |
|
if(!strcmp(cfg.vi_clone, "vim")) |
|
247 |
|
{ |
|
248 |
|
g_snprintf(buf, sizeof(buf), "%s \"+ grep %s\"", cfg.vi_command, |
|
249 |
|
g_strdup(command +5)); |
|
250 |
|
create_zterm(buf, TRUE); |
|
251 |
|
} |
|
252 |
|
back_to_normal_mode(curr_view); |
|
253 |
|
return; |
|
254 |
|
} |
|
255 |
|
|
|
256 |
|
/* list vi buffers */ |
|
257 |
|
if(!strcmp(arg1, "ls")) |
|
258 |
|
{ |
|
259 |
|
create_buffer_menu(); |
|
260 |
|
gtk_menu_popup(GTK_MENU(app.buffer_menu), NULL, NULL, |
|
261 |
|
set_menu_position, NULL, 0, 0); |
|
262 |
|
back_to_normal_mode(curr_view); |
|
263 |
|
return; |
|
264 |
|
} |
|
265 |
|
|
|
266 |
|
/* split */ |
|
267 |
|
if(!strcmp(arg1, "sb")) |
|
268 |
|
{ |
|
269 |
|
if(arguments > 1) |
|
270 |
|
{ |
|
271 |
|
command+= 3; |
|
272 |
|
if(*command == '/') |
|
273 |
|
{ |
|
274 |
|
change_dir(other_view, command); |
|
275 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
276 |
|
} |
|
277 |
|
else if(*command == '~') |
|
278 |
|
{ |
|
279 |
|
command++; |
|
280 |
|
g_snprintf(buf, sizeof(buf), "%s%s", getenv("HOME"), command); |
|
281 |
|
change_dir(other_view, buf); |
|
282 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
283 |
|
} |
|
284 |
|
else |
|
285 |
|
{ |
|
286 |
|
g_snprintf(buf, sizeof(buf), "%s/%s", curr_view->dir, command); |
|
287 |
|
change_dir(other_view, buf); |
|
288 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
289 |
|
} |
|
290 |
|
} |
|
291 |
|
else |
|
292 |
|
{ |
|
293 |
|
change_dir(other_view, curr_view->dir); |
|
294 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
295 |
|
} |
|
296 |
|
back_to_normal_mode(other_view); |
|
297 |
|
return; |
|
298 |
|
} |
|
299 |
|
|
|
300 |
|
/* change directory */ |
|
301 |
|
if(!strcmp(arg1, "cd")) |
|
302 |
|
{ |
|
303 |
|
if(arguments > 1) |
|
304 |
|
{ |
|
305 |
|
command+=3; |
|
306 |
|
|
|
307 |
|
if(*command == '/') |
|
308 |
|
{ |
|
309 |
|
change_dir(curr_view, command); |
|
310 |
|
} |
|
311 |
|
else if(*command == '~') |
|
312 |
|
{ |
|
313 |
|
command++; |
|
314 |
|
g_snprintf(buf, sizeof(buf), "%s%s", getenv("HOME"), command); |
|
315 |
|
change_dir(curr_view, buf); |
|
316 |
|
} |
|
317 |
|
else |
|
318 |
|
{ |
|
319 |
|
g_snprintf(buf, sizeof(buf), "%s/%s", curr_view->dir, command); |
|
320 |
|
change_dir(curr_view, buf); |
|
321 |
|
} |
|
322 |
|
} |
|
323 |
|
else |
|
324 |
|
{ |
|
325 |
|
change_dir(curr_view, getenv("HOME")); |
|
326 |
|
} |
|
327 |
|
back_to_normal_mode(curr_view); |
|
328 |
|
return; |
|
329 |
|
} |
|
330 |
|
|
|
331 |
|
/* remove user command from menu */ |
|
332 |
|
if(!strcmp(arg1, "delc")) |
|
333 |
|
{ |
|
334 |
|
create_delc_menu(); |
|
335 |
|
gtk_menu_popup(GTK_MENU(app.delc_menu), NULL, NULL, |
|
336 |
|
set_menu_position, NULL, 0, 0); |
|
337 |
|
back_to_normal_mode(curr_view); |
|
338 |
|
return; |
|
339 |
|
} |
|
340 |
|
|
|
341 |
|
/* goto first row :0 */ |
|
342 |
|
if(!strcmp(arg1, "0")) |
|
343 |
|
{ |
|
344 |
|
goto_row(curr_view->clist, 0); |
|
345 |
|
} |
|
346 |
|
|
|
347 |
|
/* quit if no terminals are open */ |
|
348 |
|
if((!strcmp(arg1, "q")) | (!strcmp(arg1, "x"))) |
|
349 |
|
{ |
|
350 |
|
if(!cfg.term_count) |
|
351 |
|
quit_cb(NULL); |
|
352 |
|
} |
|
353 |
|
|
|
354 |
|
/* quit even if there are terminals open */ |
|
355 |
|
if(!strcmp(arg1, "q!")) |
|
356 |
|
quit_cb(NULL); |
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
|
360 |
|
/* help text */ |
|
361 |
|
if(!strcmp(arg1, "h")) |
|
362 |
|
{ |
|
363 |
|
g_snprintf(buf, sizeof(buf), "%s %s/vide%s.txt", |
|
364 |
|
cfg.vi_command, cfg.config_dir, VERSION); |
|
365 |
|
create_zterm(buf, TRUE); |
|
366 |
|
} |
|
367 |
|
|
|
368 |
|
/* delete file */ |
|
369 |
|
if(!strcmp(arg1, "d") || !strcmp(arg1, "delete")) |
|
370 |
|
{ |
|
371 |
|
g_snprintf(buf, sizeof(buf), "mv -f %s %s/", ex_command->str, cfg.trash); |
|
372 |
|
pipe_and_capture_output_threaded(buf); |
|
373 |
|
focus_on_row(curr_view, |
|
374 |
|
curr_view->row < GTK_CLIST(curr_view->clist)->rows |
|
375 |
|
? curr_view->row |
|
376 |
|
: curr_view->row -1 ); |
|
377 |
|
g_string_free(ex_command, TRUE); |
|
378 |
|
} |
|
379 |
|
|
|
380 |
|
/* copy file */ |
|
381 |
|
if(!strcmp(arg1, "co") || !strcmp(arg1, "copy")) |
|
382 |
|
{ |
|
383 |
|
g_snprintf(buf, sizeof(buf), "cp -R %s %s/", ex_command->str, other_view->dir); |
|
384 |
|
pipe_and_capture_output_threaded(buf); |
|
385 |
|
g_string_free(ex_command, TRUE); |
|
386 |
|
} |
|
387 |
|
|
|
388 |
|
/* move file */ |
|
389 |
|
if(!strcmp(arg1, "m") || !strcmp(arg1, "move")) |
|
390 |
|
{ |
|
391 |
|
g_snprintf(buf, sizeof(buf), "mv %s %s/", ex_command->str, |
|
392 |
|
other_view->dir); |
|
393 |
|
pipe_and_capture_output_threaded(buf); |
|
394 |
|
g_string_free(ex_command, TRUE); |
|
395 |
|
if(curr_view->row < GTK_CLIST(curr_view->clist)->rows) |
|
396 |
|
{ |
|
397 |
|
focus_on_row(curr_view, curr_view->row); |
|
398 |
|
} |
|
399 |
|
else |
|
400 |
|
{ |
|
401 |
|
focus_on_row(curr_view, GTK_CLIST(curr_view->clist)->rows -1); |
|
402 |
|
} |
|
403 |
|
} |
|
404 |
|
if(!g_strncasecmp(command, "!!", 2)) |
|
405 |
|
{ |
|
406 |
|
command +=2; |
|
407 |
|
g_snprintf(buf, sizeof(buf), "pauseme %s", command); |
|
408 |
|
create_zterm(buf, TRUE); |
|
409 |
|
back_to_normal_mode(curr_view); |
|
410 |
|
return; |
|
411 |
|
} |
|
412 |
|
|
|
413 |
|
/* shell commands */ |
|
414 |
|
if(*command == '!') |
|
415 |
|
{ |
|
416 |
|
command++; |
|
417 |
|
create_zterm(command, TRUE); |
|
418 |
|
back_to_normal_mode(curr_view); |
|
419 |
|
return; |
|
420 |
|
} |
|
421 |
|
|
|
422 |
|
|
|
423 |
|
/* search / */ |
|
424 |
|
if(*command == '/') |
|
425 |
|
{ |
|
426 |
|
g_snprintf(pat.pattern, sizeof(pat.pattern), "%s", command); |
|
427 |
|
find_pattern(curr_view); |
|
428 |
|
} |
|
429 |
|
|
|
430 |
|
/* open a shell */ |
|
431 |
|
if(!strcmp(arg1, "sh") || !strcmp(arg1, "shell")) |
|
432 |
|
{ |
|
433 |
|
create_zterm("sh", TRUE); |
|
434 |
|
} |
|
435 |
|
|
|
436 |
|
/* show bookmarks */ |
|
437 |
|
if(!strcmp(arg1, "marks")) |
|
438 |
|
{ |
|
439 |
|
gtk_signal_emit_by_name(GTK_OBJECT(app.bookmark_menu_item), |
|
440 |
|
"activate-item"); |
|
441 |
|
} |
|
442 |
|
|
|
443 |
|
/* run vide as root */ |
|
444 |
|
if(!strcmp(arg1, "su")) |
|
445 |
|
{ |
|
446 |
|
/* change to allow su username? */ |
|
447 |
|
gchar root_command[NAME_MAX]; |
|
448 |
|
g_snprintf(root_command, sizeof(root_command), "su root -c vide"); |
|
449 |
|
create_zterm(root_command, TRUE); |
|
450 |
|
} |
|
451 |
|
|
|
452 |
|
/* history */ |
|
453 |
|
if(!strcmp(arg1, "his") || !strcmp(arg1, "history")) |
|
454 |
|
create_history_menu(curr_view); |
|
455 |
|
|
|
456 |
|
/* load file into vi */ |
|
457 |
|
if(!strcmp(arg1, "e")) |
|
458 |
|
{ |
|
459 |
|
g_snprintf(buf, sizeof(buf), "%s %s", cfg.vi_command, ex_command->str); |
|
460 |
|
create_zterm(buf, TRUE); |
|
461 |
|
g_string_free(ex_command, TRUE); |
|
462 |
|
back_to_normal_mode(curr_view); |
|
463 |
|
return; |
|
464 |
|
} |
|
465 |
|
|
|
466 |
|
/* one window */ |
|
467 |
|
if(!strcmp(arg1, "on") || !strcmp(arg1, "only")) |
|
468 |
|
{ |
|
469 |
|
if(GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(app.left_view.clist))) |
|
470 |
|
{ |
|
471 |
|
gtk_widget_hide(GTK_WIDGET(app.right_view_box)); |
|
472 |
|
gtk_widget_hide(GTK_WIDGET(app.sw)); |
|
473 |
|
} |
|
474 |
|
else |
|
475 |
|
{ |
|
476 |
|
gtk_widget_hide(GTK_WIDGET(app.left_view_box)); |
|
477 |
|
gtk_widget_hide(GTK_WIDGET(app.sw)); |
|
478 |
|
} |
|
479 |
|
} |
|
480 |
|
|
|
481 |
|
/* show two filelists */ |
|
482 |
|
if(!strcmp(arg1, "new")) |
|
483 |
|
{ |
|
484 |
|
if(GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(app.left_view.clist))) |
|
485 |
|
{ |
|
486 |
|
gtk_widget_show(GTK_WIDGET(app.right_view_box)); |
|
487 |
|
gtk_widget_show(GTK_WIDGET(app.sw)); |
|
488 |
|
} |
|
489 |
|
else |
|
490 |
|
{ |
|
491 |
|
gtk_widget_show(GTK_WIDGET(app.left_view_box)); |
|
492 |
|
gtk_widget_show(GTK_WIDGET(app.sw)); |
|
493 |
|
} |
|
494 |
|
} |
|
495 |
|
|
|
496 |
|
/*set filter */ |
|
497 |
|
if(!g_strncasecmp(command, "set filter", 10)) |
|
498 |
|
{ |
|
499 |
|
if(!strcmp("invert", g_strndup(command +11, 6))) |
|
500 |
|
{ |
|
501 |
|
command += 18; |
|
502 |
|
strncpy(curr_view->filename_filter.pattern, command, |
|
503 |
|
sizeof(curr_view->filename_filter.pattern)); |
|
504 |
|
curr_view->filename_filter.active = TRUE; |
|
505 |
|
curr_view->filename_filter.invert_mask = TRUE; |
|
506 |
|
} |
|
507 |
|
else |
|
508 |
|
{ |
|
509 |
|
command += 11; |
|
510 |
|
strncpy(curr_view->filename_filter.pattern, command, |
|
511 |
|
sizeof(curr_view->filename_filter.pattern)); |
|
512 |
|
curr_view->filename_filter.active = TRUE; |
|
513 |
|
curr_view->filename_filter.invert_mask = FALSE; |
|
514 |
|
} |
|
515 |
|
|
|
516 |
|
load_dir_list(curr_view); |
|
517 |
|
} |
|
518 |
|
|
|
519 |
|
|
|
520 |
|
|
|
521 |
|
/*filter */ |
|
522 |
|
if(!g_strncasecmp(command, "fil", 3) | |
|
523 |
|
(!g_strncasecmp(command, "filter", 6))) |
|
524 |
|
{ |
|
525 |
|
curr_view->filename_filter.active = TRUE; |
|
526 |
|
load_dir_list(curr_view); |
|
527 |
|
} |
|
528 |
|
|
|
529 |
|
/*nofilter */ |
|
530 |
|
if(!g_strncasecmp(command, "nofil", 5) | |
|
531 |
|
!g_strncasecmp(command, "nofilter", 8)) |
|
532 |
|
{ |
|
533 |
|
curr_view->filename_filter.active = FALSE; |
|
534 |
|
load_dir_list(curr_view); |
|
535 |
|
} |
|
536 |
|
|
|
537 |
|
/*invert*/ |
|
538 |
|
if(!g_strncasecmp(command, "in", 2) || !g_strncasecmp(command, "invert", 6)) |
|
539 |
|
{ |
|
540 |
|
if(curr_view->filename_filter.invert_mask) |
|
541 |
|
curr_view->filename_filter.invert_mask = FALSE; |
|
542 |
|
else |
|
543 |
|
curr_view->filename_filter.invert_mask = TRUE; |
|
544 |
|
|
|
545 |
|
load_dir_list(curr_view); |
|
546 |
|
} |
|
547 |
|
/* shows current working directory on status bar submitted by Sergei Gnezdov */ |
|
548 |
|
if((!strcmp(arg1, "pw")) | (!strcmp(arg1, "pwd"))) |
|
549 |
|
{ |
|
550 |
|
status_bar_message(curr_view->dir); |
|
551 |
|
reset_signals(); |
|
552 |
|
return; |
|
553 |
|
} |
|
554 |
|
|
|
555 |
|
|
|
556 |
|
/* sp b and vs */ |
|
557 |
|
if((!g_strncasecmp(command, "sp", 2)) | (!g_strncasecmp(command,"vs", 2)) |
|
558 |
|
| (!g_strncasecmp(command, "b", 1))) |
|
559 |
|
{ |
|
560 |
|
|
|
561 |
|
ZvtTerm *term; |
|
562 |
|
int sp = 0; |
|
563 |
|
int b = 0; |
|
564 |
|
if(!g_strncasecmp(command, "sp", 2)) |
|
565 |
|
sp = 1; |
|
566 |
|
if(!g_strncasecmp(command, "b", 1)) |
|
567 |
|
b = 1; |
|
568 |
|
|
|
569 |
|
if(b) |
|
570 |
|
command++; |
|
571 |
|
else |
|
572 |
|
command+=2; |
|
573 |
|
|
|
574 |
|
chomp(command); |
|
575 |
|
|
|
576 |
|
while(isspace(*command)) |
|
577 |
|
{ |
|
578 |
|
command++; |
|
579 |
|
} |
|
580 |
|
|
|
581 |
|
if(isalpha(*command)) |
|
582 |
|
{ |
|
583 |
|
back_to_normal_mode(curr_view); |
|
584 |
|
return; |
|
585 |
|
} |
|
586 |
|
|
|
587 |
|
if(isdigit(*command)) |
|
588 |
|
{ |
|
589 |
|
gint number = atoi(command) - 1; |
|
590 |
|
|
|
591 |
|
/* selected the vide notebook page */ |
|
592 |
|
if(number == 0) |
|
593 |
|
{ |
|
594 |
|
back_to_normal_mode(curr_view); |
|
595 |
|
status_bar_message("Page 1 is not an editor"); |
|
596 |
|
return; |
|
597 |
|
} |
|
598 |
|
|
|
599 |
|
if(number < 0) |
|
600 |
|
number = 9; |
|
601 |
|
|
|
602 |
|
if((term = get_focus_zvt(GTK_NOTEBOOK(app.notebook), number))) |
|
603 |
|
{ |
|
604 |
|
|
|
605 |
|
if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(term)))) |
|
606 |
|
{ |
|
607 |
|
g_snprintf(buf, sizeof(buf), "%c\r", GDK_Escape); |
|
608 |
|
write_to_term(term, buf); |
|
609 |
|
if(sp) |
|
610 |
|
{ |
|
611 |
|
/* I don't know how to split a window in nvi */ |
|
612 |
|
if(!strcmp("vi", cfg.vi_clone)) |
|
613 |
|
{ |
|
614 |
|
back_to_normal_mode(curr_view); |
|
615 |
|
return; |
|
616 |
|
} |
|
617 |
|
else if(!strcmp("vile", cfg.vi_clone)) |
|
618 |
|
{ |
|
619 |
|
g_snprintf(buf, sizeof(buf), ":split-current-window\r\n"); |
|
620 |
|
write_to_term(term, buf); |
|
621 |
|
g_snprintf(buf, sizeof(buf), ":e %s/%s\r\n", |
|
622 |
|
curr_view->dir, file); |
|
623 |
|
write_to_term(term, buf); |
|
624 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), number); |
|
625 |
|
gtk_widget_grab_focus(GTK_WIDGET(term)); |
|
626 |
|
back_to_normal_mode(curr_view); |
|
627 |
|
return; |
|
628 |
|
} |
|
629 |
|
else |
|
630 |
|
{ |
|
631 |
|
g_snprintf(buf, sizeof(buf), ":sp %s/%s\r\n", |
|
632 |
|
curr_view->dir, file); |
|
633 |
|
} |
|
634 |
|
} |
|
635 |
|
else if(b) |
|
636 |
|
{ |
|
637 |
|
g_snprintf(buf, sizeof(buf), ":e %s/%s\r\n", |
|
638 |
|
curr_view->dir, file); |
|
639 |
|
} |
|
640 |
|
else |
|
641 |
|
{ |
|
642 |
|
if(!strcmp("vim", cfg.vi_clone)) |
|
643 |
|
{ |
|
644 |
|
g_snprintf(buf, sizeof(buf), ":vs %s/%s\r\n", |
|
645 |
|
curr_view->dir, file); |
|
646 |
|
} |
|
647 |
|
else |
|
648 |
|
{ |
|
649 |
|
back_to_normal_mode(curr_view); |
|
650 |
|
return; |
|
651 |
|
} |
|
652 |
|
} |
|
653 |
|
write_to_term(term, buf); |
|
654 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), number); |
|
655 |
|
gtk_widget_grab_focus(GTK_WIDGET(term)); |
|
656 |
|
} |
|
657 |
|
else |
|
658 |
|
{ |
|
659 |
|
back_to_normal_mode(curr_view); |
|
660 |
|
status_bar_message("That terminal is not an editor"); |
|
661 |
|
return; |
|
662 |
|
} |
|
663 |
|
} |
|
664 |
|
} |
|
665 |
|
else |
|
666 |
|
{ |
|
667 |
|
gint page = 1; |
|
668 |
|
while((term = get_focus_zvt(GTK_NOTEBOOK(app.notebook), page))) |
|
669 |
|
{ |
|
670 |
|
if(term == cfg.current_term) |
|
671 |
|
break; |
|
672 |
|
|
|
673 |
|
page++; |
|
674 |
|
} |
|
675 |
|
if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(term)))) |
|
676 |
|
{ |
|
677 |
|
g_snprintf(buf, sizeof(buf), "%d\r", GDK_Escape); |
|
678 |
|
write_to_term(term, buf); |
|
679 |
|
|
|
680 |
|
if(sp) |
|
681 |
|
{ |
|
682 |
|
if(!strcmp("vi", cfg.vi_clone)) |
|
683 |
|
{ |
|
684 |
|
back_to_normal_mode(curr_view); |
|
685 |
|
return; |
|
686 |
|
} |
|
687 |
|
else if(!strcmp("vile", cfg.vi_clone)) |
|
688 |
|
{ |
|
689 |
|
write_to_term(term, ":split-current-window\r\n"); |
|
690 |
|
g_snprintf(buf, sizeof(buf), ":e %s/%s\r\n", |
|
691 |
|
curr_view->dir, file); |
|
692 |
|
write_to_term(term, buf); |
|
693 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), page); |
|
694 |
|
gtk_widget_grab_focus(GTK_WIDGET(term)); |
|
695 |
|
back_to_normal_mode(curr_view); |
|
696 |
|
return; |
|
697 |
|
} |
|
698 |
|
else |
|
699 |
|
{ |
|
700 |
|
g_snprintf(buf, sizeof(buf), ":sp %s/%s\r", |
|
701 |
|
curr_view->dir, file); |
|
702 |
|
} |
|
703 |
|
} |
|
704 |
|
else if(b) |
|
705 |
|
{ |
|
706 |
|
g_snprintf(buf, sizeof(buf), ":e %s/%s\r", |
|
707 |
|
curr_view->dir, file); |
|
708 |
|
} |
|
709 |
|
else |
|
710 |
|
{ |
|
711 |
|
if(!strcmp("vim", cfg.vi_clone)) |
|
712 |
|
{ |
|
713 |
|
g_snprintf(buf, sizeof(buf), ":vs %s/%s\r", |
|
714 |
|
curr_view->dir, file); |
|
715 |
|
} |
|
716 |
|
else |
|
717 |
|
{ |
|
718 |
|
back_to_normal_mode(curr_view); |
|
719 |
|
return; |
|
720 |
|
} |
|
721 |
|
} |
|
722 |
|
|
|
723 |
|
write_to_term(term, buf); |
|
724 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), page); |
|
725 |
|
gtk_widget_grab_focus(GTK_WIDGET(term)); |
|
726 |
|
} |
|
727 |
|
else |
|
728 |
|
{ |
|
729 |
|
back_to_normal_mode(curr_view); |
|
730 |
|
status_bar_message("That terminal is not an editor"); |
|
731 |
|
return; |
|
732 |
|
} |
|
733 |
|
} |
|
734 |
|
} |
|
735 |
|
|
|
736 |
|
back_to_normal_mode(curr_view); |
|
737 |
|
} |
|
738 |
|
|
|
739 |
|
static void |
|
740 |
|
command_key_cb(GtkWidget *widget, GdkEventKey *event, FileView *view) |
|
741 |
|
{ |
|
742 |
|
if ((event->keyval == 'c') && (event->state & GDK_CONTROL_MASK)) |
|
743 |
|
{ |
|
744 |
|
event->keyval = 0; |
|
745 |
|
back_to_normal_mode(view); |
|
746 |
|
status_bar_message(" "); |
|
747 |
|
return; |
|
748 |
|
} |
|
749 |
|
else if (event->keyval == GDK_Return) |
|
750 |
|
{ |
|
751 |
|
gchar prog[1024]; |
|
752 |
|
com.index = '\0'; |
|
753 |
|
g_snprintf(prog, sizeof(prog), "%s", com.buffer); |
|
754 |
|
event->keyval = 0; |
|
755 |
|
|
|
756 |
|
execute_command(prog); |
|
757 |
|
return; |
|
758 |
|
} |
|
759 |
|
else if (event->keyval == GDK_BackSpace) |
|
760 |
|
{ |
|
761 |
|
if(com.index > 0) |
|
762 |
|
{ |
|
763 |
|
com.index--; |
|
764 |
|
com.buffer[com.index] = '\0'; |
|
765 |
|
status_bar_message(com.buffer); |
|
766 |
|
} |
|
767 |
|
} |
|
768 |
|
else if((event->keyval < 0x100) && (event->state == 0 |
|
769 |
|
|| event->state & GDK_SHIFT_MASK)) |
|
770 |
|
{ |
|
771 |
|
com.buffer[com.index] = event->keyval; |
|
772 |
|
if(com.index < 1024) |
|
773 |
|
com.index++; |
|
774 |
|
status_bar_message(com.buffer); |
|
775 |
|
} |
|
776 |
|
else |
|
777 |
|
event->keyval = 0; |
|
778 |
|
} |
|
779 |
|
|
|
780 |
|
|
|
781 |
|
void |
|
782 |
|
command_mode(FileView *view) |
|
783 |
|
{ |
|
784 |
|
guint key_press_signal; |
|
785 |
|
com.index = 0; |
|
786 |
|
|
|
787 |
|
|
|
788 |
|
key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(view->clist), "signal_key_id")); |
|
789 |
|
gtk_signal_disconnect(GTK_OBJECT(view->clist), key_press_signal); |
|
790 |
|
|
|
791 |
|
key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist), |
|
792 |
|
"key_press_event", GTK_SIGNAL_FUNC(command_key_cb), view); |
|
793 |
|
gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id", |
|
794 |
|
GUINT_TO_POINTER(key_press_signal)); |
|
795 |
|
|
|
796 |
|
} |
| File src/config_dialog.c added (mode: 100644) (index 0000000..562a043) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
#include <stdio.h> |
|
21 |
|
#include <stdlib.h> |
|
22 |
|
#include <string.h> |
|
23 |
|
#include "vide.h" |
|
24 |
|
|
|
25 |
|
static GtkWidget *dialog; |
|
26 |
|
static GtkWidget *colorsel_dialog; |
|
27 |
|
|
|
28 |
|
static struct |
|
29 |
|
{ |
|
30 |
|
GtkWidget *right_startup_dir_entry; |
|
31 |
|
GtkWidget *left_startup_dir_entry; |
|
32 |
|
GtkWidget *start_with_cwd_checkbutton; |
|
33 |
|
GtkWidget *vim; |
|
34 |
|
GtkWidget *vile; |
|
35 |
|
GtkWidget *elvis; |
|
36 |
|
GtkWidget *nvi; |
|
37 |
|
GtkWidget *vi_entry; |
|
38 |
|
} |
|
39 |
|
general_page_1; |
|
40 |
|
|
|
41 |
|
static struct |
|
42 |
|
{ |
|
43 |
|
GtkWidget *dir_history_entry; |
|
44 |
|
GtkWidget *command_history_entry; |
|
45 |
|
GtkWidget *use_scrollbars; |
|
46 |
|
GtkWidget *save_position; |
|
47 |
|
GtkWidget *xterm_entry; |
|
48 |
|
GtkWidget *filter_entry; |
|
49 |
|
GtkWidget *invert_filter_check_button; |
|
50 |
|
} |
|
51 |
|
general_page_2; |
|
52 |
|
|
|
53 |
|
static struct |
|
54 |
|
{ |
|
55 |
|
GtkWidget *clist; |
|
56 |
|
gint row; |
|
57 |
|
} |
|
58 |
|
bookmarks_page; |
|
59 |
|
|
|
60 |
|
static struct |
|
61 |
|
{ |
|
62 |
|
GtkWidget *clist; |
|
63 |
|
GtkWidget *default_program_label; |
|
64 |
|
} |
|
65 |
|
filetypes_page; |
|
66 |
|
|
|
67 |
|
static struct |
|
68 |
|
{ |
|
69 |
|
GtkWidget *clist; |
|
70 |
|
} |
|
71 |
|
user_commands_page; |
|
72 |
|
|
|
73 |
|
static struct |
|
74 |
|
{ |
|
75 |
|
GtkWidget *clist; |
|
76 |
|
} |
|
77 |
|
programs_page; |
|
78 |
|
|
|
79 |
|
static struct |
|
80 |
|
{ |
|
81 |
|
GtkWidget *checks[MAX_COLUMNS]; |
|
82 |
|
} |
|
83 |
|
columns_page; |
|
84 |
|
|
|
85 |
|
static struct |
|
86 |
|
{ |
|
87 |
|
GtkWidget *blinking_cursor; |
|
88 |
|
GtkWidget *term_bell; |
|
89 |
|
GtkWidget *scroll_key; |
|
90 |
|
GtkWidget *scroll_output; |
|
91 |
|
GtkWidget *swap; |
|
92 |
|
GtkWidget *transparent; |
|
93 |
|
/* GtkWidget *shaded; |
|
94 |
|
GtkWidget *pixmap; |
|
95 |
|
GtkWidget *pixmap_entry; |
|
96 |
|
*/ |
|
97 |
|
GtkWidget *scroll_menu; |
|
98 |
|
GtkWidget *tab_menu; |
|
99 |
|
GtkWidget *term_font; |
|
100 |
|
GtkWidget *scheme_menu; |
|
101 |
|
GtkWidget *background_menu; |
|
102 |
|
GtkWidget *tab_button; |
|
103 |
|
GtkObject *adj; |
|
104 |
|
GtkWidget *spin; |
|
105 |
|
GtkWidget *entry; |
|
106 |
|
GtkWidget *popdown; |
|
107 |
|
GtkWidget *color_button[20]; |
|
108 |
|
GtkWidget *program_entry; |
|
109 |
|
}zvt_general; |
|
110 |
|
|
|
111 |
|
static struct |
|
112 |
|
{ |
|
113 |
|
gchar color_scheme[512]; |
|
114 |
|
gchar background[PATH_MAX]; |
|
115 |
|
GtkPositionType tab_position; |
|
116 |
|
gchar font[512]; |
|
117 |
|
gchar pixmap[512]; |
|
118 |
|
gboolean show_tabs; |
|
119 |
|
gint color_change; |
|
120 |
|
gint background_change; |
|
121 |
|
gint tab_change; |
|
122 |
|
gint pixmap_change; |
|
123 |
|
gint font_change; |
|
124 |
|
gint hide_change; |
|
125 |
|
} |
|
126 |
|
tmp_values; |
|
127 |
|
|
|
128 |
|
enum { LINUX, XTERM, RXVT, CUSTOM, |
|
129 |
|
WHITE_ON_BLACK, BLACK_ON_WHITE, GREEN_ON_BLACK, CUSTOM_BACK, |
|
130 |
|
HIDDEN, LEFT, RIGHT, TOP, BOTTOM }; |
|
131 |
|
void |
|
132 |
|
config_key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data) |
|
133 |
|
{ |
|
134 |
|
if ((event->keyval < 0x100) |
|
135 |
|
&& (event->state == 0 || event->state & GDK_SHIFT_MASK |
|
136 |
|
|| event->state & GDK_MOD2_MASK)) |
|
137 |
|
{ |
|
138 |
|
switch (event->keyval) |
|
139 |
|
{ |
|
140 |
|
|
|
141 |
|
case 'j': |
|
142 |
|
event->keyval = GDK_Down; |
|
143 |
|
break; |
|
144 |
|
case 'k': |
|
145 |
|
event->keyval = GDK_Up; |
|
146 |
|
break; |
|
147 |
|
|
|
148 |
|
case 'h': |
|
149 |
|
event->keyval = GDK_Right; |
|
150 |
|
|
|
151 |
|
case 'l': |
|
152 |
|
event->keyval = GDK_Left; |
|
153 |
|
break; |
|
154 |
|
|
|
155 |
|
default: |
|
156 |
|
event->keyval = 0; |
|
157 |
|
break; |
|
158 |
|
} |
|
159 |
|
} |
|
160 |
|
return; |
|
161 |
|
} |
|
162 |
|
|
|
163 |
|
static void |
|
164 |
|
ok_cb (GtkWidget * button) |
|
165 |
|
{ |
|
166 |
|
gint i; |
|
167 |
|
|
|
168 |
|
zvt.scroll_lines = gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON( |
|
169 |
|
zvt_general.spin)); |
|
170 |
|
if(GTK_TOGGLE_BUTTON(general_page_1.vim)->active) |
|
171 |
|
g_snprintf(cfg.vi_clone, sizeof(cfg.vi_clone), "vim"); |
|
172 |
|
if(GTK_TOGGLE_BUTTON(general_page_1.vile)->active) |
|
173 |
|
g_snprintf(cfg.vi_clone, sizeof(cfg.vi_clone), "vile"); |
|
174 |
|
if(GTK_TOGGLE_BUTTON(general_page_1.elvis)->active) |
|
175 |
|
g_snprintf(cfg.vi_clone, sizeof(cfg.vi_clone), "elvis"); |
|
176 |
|
if(GTK_TOGGLE_BUTTON(general_page_1.nvi)->active) |
|
177 |
|
g_snprintf(cfg.vi_clone, sizeof(cfg.vi_clone), "vi"); |
|
178 |
|
strncpy(cfg.vi_command, |
|
179 |
|
gtk_entry_get_text(GTK_ENTRY(general_page_1.vi_entry)), |
|
180 |
|
sizeof(cfg.vi_command)); |
|
181 |
|
|
|
182 |
|
strncpy(cfg.man_program, |
|
183 |
|
gtk_entry_get_text(GTK_ENTRY(zvt_general.program_entry)), |
|
184 |
|
sizeof(cfg.man_program)); |
|
185 |
|
zvt.use_blinking_cursor= |
|
186 |
|
GTK_TOGGLE_BUTTON(zvt_general.blinking_cursor)->active; |
|
187 |
|
zvt.terminal_bell= |
|
188 |
|
GTK_TOGGLE_BUTTON(zvt_general.term_bell)->active; |
|
189 |
|
zvt.scroll_on_keystroke= |
|
190 |
|
GTK_TOGGLE_BUTTON(zvt_general.scroll_key)->active; |
|
191 |
|
zvt.scroll_on_output= |
|
192 |
|
GTK_TOGGLE_BUTTON(zvt_general.scroll_output)->active; |
|
193 |
|
zvt.swap_backspace= |
|
194 |
|
GTK_TOGGLE_BUTTON(zvt_general.swap)->active; |
|
195 |
|
zvt.transparent= |
|
196 |
|
GTK_TOGGLE_BUTTON(zvt_general.transparent)->active; |
|
197 |
|
if(tmp_values.hide_change || tmp_values.tab_change) |
|
198 |
|
zvt.show_tabs = tmp_values.show_tabs; |
|
199 |
|
if(tmp_values.tab_change) |
|
200 |
|
zvt.tab_position = (GtkPositionType)tmp_values.tab_position; |
|
201 |
|
if(tmp_values.color_change) |
|
202 |
|
g_snprintf(zvt.term_color, sizeof(zvt.term_color), tmp_values.color_scheme); |
|
203 |
|
if(tmp_values.background_change) |
|
204 |
|
g_snprintf(zvt.background, sizeof(zvt.background), tmp_values.background); |
|
205 |
|
if(tmp_values.font_change) |
|
206 |
|
g_snprintf(zvt.term_font, sizeof(zvt.term_font), tmp_values.font); |
|
207 |
|
if(tmp_values.pixmap_change) |
|
208 |
|
g_snprintf(zvt.pixmap, sizeof(zvt.pixmap), tmp_values.pixmap); |
|
209 |
|
|
|
210 |
|
cfg.invert_filter= |
|
211 |
|
GTK_TOGGLE_BUTTON(general_page_2.invert_filter_check_button)->active; |
|
212 |
|
strncpy(cfg.start_filter, |
|
213 |
|
gtk_entry_get_text(GTK_ENTRY(general_page_2.filter_entry)), |
|
214 |
|
sizeof(cfg.start_filter)); |
|
215 |
|
cfg.use_scrollbars = |
|
216 |
|
GTK_TOGGLE_BUTTON(general_page_2.use_scrollbars)->active; |
|
217 |
|
cfg.save_position = |
|
218 |
|
GTK_TOGGLE_BUTTON(general_page_2.save_position)->active; |
|
219 |
|
cfg.start_with_cwd = |
|
220 |
|
GTK_TOGGLE_BUTTON(general_page_1.start_with_cwd_checkbutton)->active; |
|
221 |
|
strncpy (cfg.left_startup_dir, |
|
222 |
|
gtk_entry_get_text (GTK_ENTRY |
|
223 |
|
(general_page_1.left_startup_dir_entry)), |
|
224 |
|
sizeof (cfg.left_startup_dir)); |
|
225 |
|
strncpy (cfg.right_startup_dir, |
|
226 |
|
gtk_entry_get_text (GTK_ENTRY |
|
227 |
|
(general_page_1.right_startup_dir_entry)), |
|
228 |
|
sizeof (cfg.right_startup_dir)); |
|
229 |
|
strncpy (cfg.xterm_command, |
|
230 |
|
gtk_entry_get_text (GTK_ENTRY (general_page_2.xterm_entry)), |
|
231 |
|
sizeof (cfg.xterm_command)); |
|
232 |
|
cfg.dir_history_max_length = |
|
233 |
|
atoi (gtk_entry_get_text (GTK_ENTRY (general_page_2.dir_history_entry))); |
|
234 |
|
cfg.command_history_max_length = |
|
235 |
|
atoi (gtk_entry_get_text |
|
236 |
|
(GTK_ENTRY (general_page_2.command_history_entry))); |
|
237 |
|
|
|
238 |
|
g_list_free(cfg.bookmarks); |
|
239 |
|
cfg.bookmarks = NULL; |
|
240 |
|
for (i = 0; i < GTK_CLIST (bookmarks_page.clist)->rows; i++) |
|
241 |
|
{ |
|
242 |
|
Bookmarks *bk; |
|
243 |
|
bk = gtk_clist_get_row_data(GTK_CLIST(bookmarks_page.clist), i); |
|
244 |
|
cfg.bookmarks = g_list_append (cfg.bookmarks, bk); |
|
245 |
|
} |
|
246 |
|
|
|
247 |
|
g_list_free(cfg.filetypes); |
|
248 |
|
cfg.filetypes = NULL; |
|
249 |
|
for (i = 0; i < GTK_CLIST (filetypes_page.clist)->rows; i++) |
|
250 |
|
{ |
|
251 |
|
FileType *ft; |
|
252 |
|
ft = gtk_clist_get_row_data (GTK_CLIST (filetypes_page.clist), i); |
|
253 |
|
cfg.filetypes = g_list_append (cfg.filetypes, ft); |
|
254 |
|
} |
|
255 |
|
|
|
256 |
|
g_list_free(cfg.user_commands); |
|
257 |
|
cfg.user_commands = NULL; |
|
258 |
|
for (i = 0; i < GTK_CLIST (user_commands_page.clist)->rows; i++) |
|
259 |
|
{ |
|
260 |
|
UserCommand *command; |
|
261 |
|
command = |
|
262 |
|
gtk_clist_get_row_data (GTK_CLIST (user_commands_page.clist), i); |
|
263 |
|
cfg.user_commands = g_list_append (cfg.user_commands, command); |
|
264 |
|
} |
|
265 |
|
|
|
266 |
|
for (i = 0; i < MAX_COLUMNS; i++) |
|
267 |
|
{ |
|
268 |
|
all_columns[i].is_visible = |
|
269 |
|
GTK_TOGGLE_BUTTON (columns_page.checks[i])->active; |
|
270 |
|
} |
|
271 |
|
|
|
272 |
|
/* the dialog needs to be destroyed before we refresh the main window */ |
|
273 |
|
gtk_grab_remove (dialog); |
|
274 |
|
gtk_widget_destroy (dialog); |
|
275 |
|
if( 1 < gtk_main_level()) |
|
276 |
|
gtk_main_quit(); |
|
277 |
|
|
|
278 |
|
recreate_main_window (); |
|
279 |
|
|
|
280 |
|
write_filetypes_file (); |
|
281 |
|
write_bookmarks_file (); |
|
282 |
|
write_user_commands_file (); |
|
283 |
|
write_config_file (); |
|
284 |
|
write_term_file(); |
|
285 |
|
} |
|
286 |
|
|
|
287 |
|
static void |
|
288 |
|
cancel_cb (GtkWidget * button) |
|
289 |
|
{ |
|
290 |
|
gtk_grab_remove (dialog); |
|
291 |
|
gtk_widget_destroy (dialog); |
|
292 |
|
if(1 < gtk_main_level()) |
|
293 |
|
gtk_main_quit(); |
|
294 |
|
} |
|
295 |
|
|
|
296 |
|
static void |
|
297 |
|
key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data) |
|
298 |
|
{ |
|
299 |
|
if (event->keyval == GDK_Escape) |
|
300 |
|
cancel_cb (NULL); |
|
301 |
|
} |
|
302 |
|
/* |
|
303 |
|
* General Page Callbacks |
|
304 |
|
*/ |
|
305 |
|
static void |
|
306 |
|
start_with_cwd_cb(GtkWidget *check_button) |
|
307 |
|
{ |
|
308 |
|
gtk_widget_set_sensitive(general_page_1.right_startup_dir_entry, |
|
309 |
|
!GTK_TOGGLE_BUTTON(check_button)->active); |
|
310 |
|
gtk_widget_set_sensitive(general_page_1.left_startup_dir_entry, |
|
311 |
|
!GTK_TOGGLE_BUTTON(check_button)->active); |
|
312 |
|
} |
|
313 |
|
|
|
314 |
|
/* |
|
315 |
|
* Bookmark Page Callbacks |
|
316 |
|
*/ |
|
317 |
|
static void |
|
318 |
|
bookmarks_select_row_cb (GtkWidget * clist, gint row, gint column, |
|
319 |
|
GdkEvent * event) |
|
320 |
|
{ |
|
321 |
|
bookmarks_page.row = row; |
|
322 |
|
} |
|
323 |
|
|
|
324 |
|
static void |
|
325 |
|
bookmark_up_cb (GtkWidget * button, GtkWidget * clist) |
|
326 |
|
{ |
|
327 |
|
if (bookmarks_page.row < 1) |
|
328 |
|
return; |
|
329 |
|
|
|
330 |
|
gtk_clist_swap_rows (GTK_CLIST (clist), bookmarks_page.row, |
|
331 |
|
bookmarks_page.row - 1); |
|
332 |
|
gtk_clist_select_row (GTK_CLIST (clist), bookmarks_page.row - 1, 0); |
|
333 |
|
} |
|
334 |
|
|
|
335 |
|
static void |
|
336 |
|
bookmark_down_cb (GtkWidget * button, GtkWidget * clist) |
|
337 |
|
{ |
|
338 |
|
if (bookmarks_page.row >= (GTK_CLIST (clist)->rows - 1)) |
|
339 |
|
return; |
|
340 |
|
|
|
341 |
|
gtk_clist_swap_rows (GTK_CLIST (clist), bookmarks_page.row, |
|
342 |
|
bookmarks_page.row + 1); |
|
343 |
|
gtk_clist_select_row (GTK_CLIST (clist), bookmarks_page.row + 1, 0); |
|
344 |
|
} |
|
345 |
|
|
|
346 |
|
static void |
|
347 |
|
bookmark_remove_cb (GtkWidget * button, GtkWidget * clist) |
|
348 |
|
{ |
|
349 |
|
gtk_clist_remove (GTK_CLIST (clist), bookmarks_page.row); |
|
350 |
|
} |
|
351 |
|
|
|
352 |
|
/* |
|
353 |
|
* Color Page Callbacks |
|
354 |
|
*/ |
|
355 |
|
static void |
|
356 |
|
color_select_ok_cb (GtkWidget * button, GdkColor * color) |
|
357 |
|
{ |
|
358 |
|
gdouble rgb[3]; |
|
359 |
|
|
|
360 |
|
gtk_color_selection_get_color (GTK_COLOR_SELECTION |
|
361 |
|
(GTK_COLOR_SELECTION_DIALOG |
|
362 |
|
(colorsel_dialog)->colorsel), rgb); |
|
363 |
|
|
|
364 |
|
color->red = rgb[0] * 65535.0; |
|
365 |
|
color->green = rgb[1] * 65535.0; |
|
366 |
|
color->blue = rgb[2] * 65535.0; |
|
367 |
|
|
|
368 |
|
gtk_grab_remove (colorsel_dialog); |
|
369 |
|
gtk_widget_destroy (colorsel_dialog); |
|
370 |
|
if(1 < gtk_main_level()) |
|
371 |
|
gtk_main_quit(); |
|
372 |
|
} |
|
373 |
|
|
|
374 |
|
static void |
|
375 |
|
color_select_cancel_cb (GtkWidget * button) |
|
376 |
|
{ |
|
377 |
|
gtk_grab_remove (colorsel_dialog); |
|
378 |
|
gtk_widget_destroy (colorsel_dialog); |
|
379 |
|
if( 1 < gtk_main_level()) |
|
380 |
|
gtk_main_quit(); |
|
381 |
|
} |
|
382 |
|
|
|
383 |
|
static void |
|
384 |
|
color_changed_cb (GtkWidget * widget, GtkWidget * button) |
|
385 |
|
{ |
|
386 |
|
GdkColor color; |
|
387 |
|
gdouble rgb[3]; |
|
388 |
|
GtkStyle *style = gtk_style_new (); |
|
389 |
|
|
|
390 |
|
gtk_color_selection_get_color (GTK_COLOR_SELECTION (widget), rgb); |
|
391 |
|
|
|
392 |
|
color.red = rgb[0] * 65535.0; |
|
393 |
|
color.green = rgb[1] * 65535.0; |
|
394 |
|
color.blue = rgb[2] * 65535.0; |
|
395 |
|
|
|
396 |
|
style->bg[GTK_STATE_NORMAL] = color; |
|
397 |
|
gtk_widget_set_style (button, style); |
|
398 |
|
} |
|
399 |
|
|
|
400 |
|
static void |
|
401 |
|
color_select_cb (GtkWidget * button, GdkColor * color) |
|
402 |
|
{ |
|
403 |
|
gdouble rgb[3]; |
|
404 |
|
|
|
405 |
|
colorsel_dialog = gtk_color_selection_dialog_new ("Choose Color"); |
|
406 |
|
gtk_widget_destroy (GTK_COLOR_SELECTION_DIALOG (colorsel_dialog)-> |
|
407 |
|
help_button); |
|
408 |
|
|
|
409 |
|
rgb[0] = color->red / 65535.0; |
|
410 |
|
rgb[1] = color->green / 65535.0; |
|
411 |
|
rgb[2] = color->blue / 65535.0; |
|
412 |
|
gtk_color_selection_set_color (GTK_COLOR_SELECTION |
|
413 |
|
(GTK_COLOR_SELECTION_DIALOG |
|
414 |
|
(colorsel_dialog)->colorsel), rgb); |
|
415 |
|
|
|
416 |
|
gtk_signal_connect (GTK_OBJECT |
|
417 |
|
(GTK_COLOR_SELECTION_DIALOG (colorsel_dialog)-> |
|
418 |
|
ok_button), "clicked", |
|
419 |
|
GTK_SIGNAL_FUNC (color_select_ok_cb), color); |
|
420 |
|
gtk_signal_connect (GTK_OBJECT |
|
421 |
|
(GTK_COLOR_SELECTION_DIALOG (colorsel_dialog)-> |
|
422 |
|
cancel_button), "clicked", |
|
423 |
|
GTK_SIGNAL_FUNC (color_select_cancel_cb), NULL); |
|
424 |
|
gtk_signal_connect (GTK_OBJECT |
|
425 |
|
(GTK_COLOR_SELECTION_DIALOG (colorsel_dialog)-> |
|
426 |
|
colorsel), "color_changed", |
|
427 |
|
GTK_SIGNAL_FUNC (color_changed_cb), button); |
|
428 |
|
|
|
429 |
|
gtk_widget_show (colorsel_dialog); |
|
430 |
|
gtk_grab_add (colorsel_dialog); |
|
431 |
|
gtk_window_set_transient_for (GTK_WINDOW (colorsel_dialog), |
|
432 |
|
GTK_WINDOW (app.main_window)); |
|
433 |
|
} |
|
434 |
|
|
|
435 |
|
/* |
|
436 |
|
* FileType Page Callbacks |
|
437 |
|
*/ |
|
438 |
|
static void |
|
439 |
|
filetypes_select_row_cb (GtkWidget * clist, gint row, gint col, |
|
440 |
|
GdkEvent * event) |
|
441 |
|
{ |
|
442 |
|
gchar label_text[NAME_MAX]; |
|
443 |
|
gchar *program, *s; |
|
444 |
|
FileType *ft = gtk_clist_get_row_data (GTK_CLIST (clist), row); |
|
445 |
|
|
|
446 |
|
program = s = strdup (ft->programs); |
|
447 |
|
if ((s = strchr (program, ',')) != NULL) |
|
448 |
|
*s = '\0'; |
|
449 |
|
|
|
450 |
|
g_snprintf (label_text, sizeof (label_text), "Default Action: %s", program); |
|
451 |
|
gtk_label_set_text (GTK_LABEL (filetypes_page.default_program_label), |
|
452 |
|
label_text); |
|
453 |
|
free (program); |
|
454 |
|
} |
|
455 |
|
|
|
456 |
|
static void |
|
457 |
|
add_filetype_cb (GtkWidget * button, GtkWidget * clist) |
|
458 |
|
{ |
|
459 |
|
create_init_filetype_dialog (NULL, clist); |
|
460 |
|
} |
|
461 |
|
|
|
462 |
|
static void |
|
463 |
|
edit_filetype_cb (GtkWidget * button, GtkWidget * clist) |
|
464 |
|
{ |
|
465 |
|
gint selected_row; |
|
466 |
|
FileType *ft; |
|
467 |
|
|
|
468 |
|
if (GTK_CLIST (clist)->selection != NULL) |
|
469 |
|
selected_row = (gint) GTK_CLIST (clist)->selection->data; |
|
470 |
|
else |
|
471 |
|
return; |
|
472 |
|
|
|
473 |
|
ft = gtk_clist_get_row_data (GTK_CLIST (clist), selected_row); |
|
474 |
|
create_filetype_dialog (ft, FALSE); |
|
475 |
|
} |
|
476 |
|
|
|
477 |
|
static void |
|
478 |
|
remove_filetype_cb (GtkWidget * button, GtkWidget * clist) |
|
479 |
|
{ |
|
480 |
|
gint selected_row; |
|
481 |
|
FileType *ft; |
|
482 |
|
|
|
483 |
|
if (GTK_CLIST (clist)->selection != NULL) |
|
484 |
|
selected_row = (gint) GTK_CLIST (clist)->selection->data; |
|
485 |
|
else |
|
486 |
|
return; |
|
487 |
|
|
|
488 |
|
ft = gtk_clist_get_row_data (GTK_CLIST (clist), selected_row); |
|
489 |
|
cfg.filetypes = g_list_remove (cfg.filetypes, ft); |
|
490 |
|
g_free (ft); |
|
491 |
|
|
|
492 |
|
gtk_clist_remove (GTK_CLIST (clist), selected_row); |
|
493 |
|
} |
|
494 |
|
|
|
495 |
|
/* |
|
496 |
|
* User Commands Page Callbacks |
|
497 |
|
*/ |
|
498 |
|
static void |
|
499 |
|
add_user_command_cb (GtkWidget * widget) |
|
500 |
|
{ |
|
501 |
|
UserCommand *command = NULL; |
|
502 |
|
create_user_command_dialog (&command); |
|
503 |
|
gtk_main (); |
|
504 |
|
if (command != NULL) |
|
505 |
|
{ |
|
506 |
|
gchar *buf[1] = { command->name }; |
|
507 |
|
gint row; |
|
508 |
|
row = gtk_clist_append (GTK_CLIST (user_commands_page.clist), buf); |
|
509 |
|
gtk_clist_set_row_data (GTK_CLIST (user_commands_page.clist), row, |
|
510 |
|
command); |
|
511 |
|
} |
|
512 |
|
} |
|
513 |
|
|
|
514 |
|
static void |
|
515 |
|
edit_user_command_cb (GtkWidget * widget) |
|
516 |
|
{ |
|
517 |
|
gint selected_row; |
|
518 |
|
UserCommand *command; |
|
519 |
|
|
|
520 |
|
if (GTK_CLIST (user_commands_page.clist)->selection != NULL) |
|
521 |
|
selected_row = |
|
522 |
|
(gint) GTK_CLIST (user_commands_page.clist)->selection->data; |
|
523 |
|
else |
|
524 |
|
return; |
|
525 |
|
|
|
526 |
|
command = gtk_clist_get_row_data (GTK_CLIST (user_commands_page.clist), |
|
527 |
|
selected_row); |
|
528 |
|
create_user_command_dialog (&command); |
|
529 |
|
gtk_main (); |
|
530 |
|
gtk_clist_set_text (GTK_CLIST (user_commands_page.clist), selected_row, 0, |
|
531 |
|
command->name); |
|
532 |
|
} |
|
533 |
|
|
|
534 |
|
static void |
|
535 |
|
remove_user_command_cb (GtkWidget * widget) |
|
536 |
|
{ |
|
537 |
|
gint selected_row; |
|
538 |
|
UserCommand *command; |
|
539 |
|
|
|
540 |
|
if (GTK_CLIST (user_commands_page.clist)->selection != NULL) |
|
541 |
|
selected_row = |
|
542 |
|
(gint) GTK_CLIST (user_commands_page.clist)->selection->data; |
|
543 |
|
else |
|
544 |
|
return; |
|
545 |
|
|
|
546 |
|
command = gtk_clist_get_row_data (GTK_CLIST (user_commands_page.clist), |
|
547 |
|
selected_row); |
|
548 |
|
cfg.user_commands = g_list_remove (cfg.user_commands, command); |
|
549 |
|
g_free (command); |
|
550 |
|
|
|
551 |
|
gtk_clist_remove (GTK_CLIST (user_commands_page.clist), selected_row); |
|
552 |
|
} |
|
553 |
|
/* |
|
554 |
|
* Programs Page Callbacks |
|
555 |
|
*/ |
|
556 |
|
static void |
|
557 |
|
add_program_cb (GtkWidget * widget) |
|
558 |
|
{ |
|
559 |
|
Programs *program = NULL; |
|
560 |
|
create_programs_dialog (&program); |
|
561 |
|
gtk_main (); |
|
562 |
|
if (program != NULL) |
|
563 |
|
{ |
|
564 |
|
gchar *buf[1] = { program->name }; |
|
565 |
|
gint row; |
|
566 |
|
row = gtk_clist_append (GTK_CLIST (programs_page.clist), buf); |
|
567 |
|
gtk_clist_set_row_data (GTK_CLIST (programs_page.clist), row, |
|
568 |
|
program); |
|
569 |
|
} |
|
570 |
|
} |
|
571 |
|
|
|
572 |
|
static void |
|
573 |
|
edit_programs_cb (GtkWidget * widget) |
|
574 |
|
{ |
|
575 |
|
gint selected_row; |
|
576 |
|
Programs *program; |
|
577 |
|
|
|
578 |
|
if (GTK_CLIST (programs_page.clist)->selection != NULL) |
|
579 |
|
selected_row = |
|
580 |
|
(gint) GTK_CLIST (programs_page.clist)->selection->data; |
|
581 |
|
else |
|
582 |
|
return; |
|
583 |
|
|
|
584 |
|
program = gtk_clist_get_row_data (GTK_CLIST (programs_page.clist), |
|
585 |
|
selected_row); |
|
586 |
|
create_programs_dialog (&program); |
|
587 |
|
gtk_main (); |
|
588 |
|
gtk_clist_set_text (GTK_CLIST (programs_page.clist), selected_row, 0, |
|
589 |
|
program->name); |
|
590 |
|
} |
|
591 |
|
|
|
592 |
|
static void |
|
593 |
|
remove_program_cb (GtkWidget * widget) |
|
594 |
|
{ |
|
595 |
|
gint selected_row; |
|
596 |
|
Programs *program; |
|
597 |
|
|
|
598 |
|
if (GTK_CLIST (programs_page.clist)->selection != NULL) |
|
599 |
|
selected_row = |
|
600 |
|
(gint) GTK_CLIST (programs_page.clist)->selection->data; |
|
601 |
|
else |
|
602 |
|
return; |
|
603 |
|
|
|
604 |
|
program = gtk_clist_get_row_data (GTK_CLIST (programs_page.clist), |
|
605 |
|
selected_row); |
|
606 |
|
cfg.programs = g_list_remove (cfg.programs, program); |
|
607 |
|
g_free (program); |
|
608 |
|
|
|
609 |
|
gtk_clist_remove (GTK_CLIST (programs_page.clist), selected_row); |
|
610 |
|
} |
|
611 |
|
|
|
612 |
|
static void |
|
613 |
|
config_clist_select_row_cb (GtkWidget * clist) |
|
614 |
|
{ |
|
615 |
|
GtkWidget *notebook; |
|
616 |
|
gint page; |
|
617 |
|
|
|
618 |
|
if (GTK_CLIST (clist)->selection != NULL) |
|
619 |
|
page = (gint) GTK_CLIST (clist)->selection->data; |
|
620 |
|
else |
|
621 |
|
return; |
|
622 |
|
|
|
623 |
|
notebook = GTK_WIDGET (gtk_object_get_user_data (GTK_OBJECT (clist))); |
|
624 |
|
gtk_notebook_set_page (GTK_NOTEBOOK (notebook), page); |
|
625 |
|
|
|
626 |
|
if (page == 2) /* bookmarks */ |
|
627 |
|
{ |
|
628 |
|
gtk_signal_connect (GTK_OBJECT (bookmarks_page.clist), |
|
629 |
|
"key_press_event", |
|
630 |
|
GTK_SIGNAL_FUNC (config_key_press_cb), NULL); |
|
631 |
|
gtk_clist_select_row (GTK_CLIST (bookmarks_page.clist), 0, 0); |
|
632 |
|
return; |
|
633 |
|
} |
|
634 |
|
else if (page == 3) /* filetypes */ |
|
635 |
|
{ |
|
636 |
|
gtk_signal_connect (GTK_OBJECT (filetypes_page.clist), |
|
637 |
|
"key_press_event", |
|
638 |
|
GTK_SIGNAL_FUNC (config_key_press_cb), NULL); |
|
639 |
|
gtk_clist_select_row (GTK_CLIST (filetypes_page.clist), 0, 0); |
|
640 |
|
|
|
641 |
|
return; |
|
642 |
|
} |
|
643 |
|
else |
|
644 |
|
{ |
|
645 |
|
return; |
|
646 |
|
} |
|
647 |
|
|
|
648 |
|
} |
|
649 |
|
|
|
650 |
|
/* |
|
651 |
|
* term options callbacks |
|
652 |
|
*/ |
|
653 |
|
|
|
654 |
|
static void |
|
655 |
|
save_font(GtkWidget *widget, GtkFontSelectionDialog *fontsel) |
|
656 |
|
{ |
|
657 |
|
gchar buf[512]; |
|
658 |
|
|
|
659 |
|
if(g_snprintf(buf, sizeof(buf), |
|
660 |
|
gtk_font_selection_dialog_get_font_name(fontsel))) |
|
661 |
|
{ |
|
662 |
|
g_snprintf(tmp_values.font, sizeof(tmp_values.font), buf); |
|
663 |
|
gtk_entry_set_text(GTK_ENTRY(zvt_general.term_font), tmp_values.font); |
|
664 |
|
gtk_editable_set_position(GTK_EDITABLE(zvt_general.term_font), 0); |
|
665 |
|
} |
|
666 |
|
tmp_values.font_change = 1; |
|
667 |
|
|
|
668 |
|
gtk_widget_destroy(GTK_WIDGET(fontsel)); |
|
669 |
|
if( 1 < gtk_main_level()) |
|
670 |
|
gtk_main_quit(); |
|
671 |
|
|
|
672 |
|
} |
|
673 |
|
|
|
674 |
|
static void |
|
675 |
|
font_dialog(GtkWidget *widget, gpointer data) |
|
676 |
|
{ |
|
677 |
|
GtkWidget *font_selector; |
|
678 |
|
gchar *spacings[] = {"c", "m", NULL}; |
|
679 |
|
|
|
680 |
|
|
|
681 |
|
gtk_grab_remove(dialog); |
|
682 |
|
font_selector = gtk_font_selection_dialog_new("Choose Font"); |
|
683 |
|
|
|
684 |
|
gtk_font_selection_dialog_set_filter(GTK_FONT_SELECTION_DIALOG(font_selector), |
|
685 |
|
GTK_FONT_FILTER_BASE, GTK_FONT_ALL, |
|
686 |
|
NULL, NULL, NULL, NULL, spacings, NULL); |
|
687 |
|
gtk_font_selection_dialog_set_font_name( |
|
688 |
|
GTK_FONT_SELECTION_DIALOG(font_selector), zvt.term_font); |
|
689 |
|
|
|
690 |
|
gtk_signal_connect(GTK_OBJECT |
|
691 |
|
(GTK_FONT_SELECTION_DIALOG(font_selector)->ok_button), |
|
692 |
|
"clicked", GTK_SIGNAL_FUNC(save_font), font_selector); |
|
693 |
|
gtk_signal_connect_object(GTK_OBJECT |
|
694 |
|
(GTK_FONT_SELECTION_DIALOG(font_selector)->cancel_button), |
|
695 |
|
"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy), |
|
696 |
|
GTK_OBJECT(font_selector)); |
|
697 |
|
|
|
698 |
|
gtk_signal_connect_object(GTK_OBJECT |
|
699 |
|
(GTK_FONT_SELECTION_DIALOG(font_selector)->cancel_button), |
|
700 |
|
"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), |
|
701 |
|
GTK_OBJECT(font_selector)); |
|
702 |
|
gtk_widget_show(GTK_WIDGET(font_selector)); |
|
703 |
|
|
|
704 |
|
} |
|
705 |
|
/* |
|
706 |
|
static void |
|
707 |
|
file_select_ok_cb(GtkWidget *widget, GtkFileSelection *fileselect) |
|
708 |
|
{ |
|
709 |
|
tmp_values.pixmap_change = 1; |
|
710 |
|
g_snprintf(tmp_values.pixmap, sizeof(tmp_values.pixmap), |
|
711 |
|
gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileselect))); |
|
712 |
|
gtk_entry_set_text(GTK_ENTRY(zvt_general.pixmap_entry), |
|
713 |
|
tmp_values.pixmap); |
|
714 |
|
gtk_editable_set_position(GTK_EDITABLE(zvt_general.pixmap_entry), 0); |
|
715 |
|
|
|
716 |
|
gtk_widget_destroy(GTK_WIDGET(fileselect)); |
|
717 |
|
} |
|
718 |
|
|
|
719 |
|
static void |
|
720 |
|
file_select_cancel(GtkWidget *widget, GtkFileSelection *fileselect) |
|
721 |
|
{ |
|
722 |
|
gtk_widget_destroy(GTK_WIDGET(fileselect)); |
|
723 |
|
} |
|
724 |
|
|
|
725 |
|
static void |
|
726 |
|
file_select_cb(GtkWidget *widget, gpointer data) |
|
727 |
|
{ |
|
728 |
|
GtkWidget *fileselect = gtk_file_selection_new("Choose a Background Image"); |
|
729 |
|
|
|
730 |
|
|
|
731 |
|
gtk_grab_remove(dialog); |
|
732 |
|
gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(fileselect)); |
|
733 |
|
|
|
734 |
|
gtk_signal_connect(GTK_OBJECT(fileselect), "destroy", |
|
735 |
|
GTK_SIGNAL_FUNC(file_select_cancel), fileselect); |
|
736 |
|
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fileselect)->ok_button), |
|
737 |
|
"clicked", GTK_SIGNAL_FUNC(file_select_ok_cb), fileselect); |
|
738 |
|
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fileselect)->cancel_button), |
|
739 |
|
"clicked", GTK_SIGNAL_FUNC(file_select_cancel), fileselect); |
|
740 |
|
gtk_widget_show(fileselect); |
|
741 |
|
} |
|
742 |
|
*/ |
|
743 |
|
|
|
744 |
|
static GtkWidget * |
|
745 |
|
add_page (GtkWidget * notebook, gchar * label_text, GtkWidget * clist) |
|
746 |
|
{ |
|
747 |
|
GtkWidget *frame; |
|
748 |
|
GtkWidget *label; |
|
749 |
|
GtkWidget *vbox; |
|
750 |
|
GtkWidget *vvbox; |
|
751 |
|
gchar *buf[1]; |
|
752 |
|
|
|
753 |
|
buf[0] = label_text; |
|
754 |
|
gtk_clist_append (GTK_CLIST (clist), buf); |
|
755 |
|
|
|
756 |
|
vvbox = gtk_vbox_new (FALSE, 0); |
|
757 |
|
gtk_widget_show (vvbox); |
|
758 |
|
|
|
759 |
|
frame = gtk_frame_new (NULL); |
|
760 |
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); |
|
761 |
|
gtk_box_pack_start (GTK_BOX (vvbox), frame, FALSE, TRUE, 0); |
|
762 |
|
gtk_widget_show (frame); |
|
763 |
|
|
|
764 |
|
label = gtk_label_new (label_text); |
|
765 |
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); |
|
766 |
|
gtk_misc_set_padding (GTK_MISC (label), 2, 1); |
|
767 |
|
gtk_container_add (GTK_CONTAINER (frame), label); |
|
768 |
|
gtk_widget_show (label); |
|
769 |
|
|
|
770 |
|
vbox = gtk_vbox_new (FALSE, 0); |
|
771 |
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); |
|
772 |
|
gtk_container_add (GTK_CONTAINER (vvbox), vbox); |
|
773 |
|
gtk_widget_show (vbox); |
|
774 |
|
|
|
775 |
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vvbox, NULL); |
|
776 |
|
return vbox; |
|
777 |
|
} |
|
778 |
|
|
|
779 |
|
void |
|
780 |
|
option_menu_cb(GtkMenuItem *item, gpointer data) |
|
781 |
|
{ |
|
782 |
|
gint v; |
|
783 |
|
|
|
784 |
|
switch(GPOINTER_TO_INT(data)) |
|
785 |
|
{ |
|
786 |
|
case LINUX: /* Color Scheme */ |
|
787 |
|
{ |
|
788 |
|
for(v = 2; v < 18; v++) |
|
789 |
|
{ |
|
790 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
791 |
|
FALSE); |
|
792 |
|
} |
|
793 |
|
|
|
794 |
|
tmp_values.color_change = 1; |
|
795 |
|
g_snprintf(tmp_values.color_scheme, |
|
796 |
|
sizeof(tmp_values.color_scheme), "Linux"); |
|
797 |
|
} |
|
798 |
|
break; |
|
799 |
|
case XTERM: |
|
800 |
|
{ |
|
801 |
|
for(v = 2; v < 18; v++) |
|
802 |
|
{ |
|
803 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
804 |
|
FALSE); |
|
805 |
|
} |
|
806 |
|
|
|
807 |
|
tmp_values.color_change = 1; |
|
808 |
|
g_snprintf(tmp_values.color_scheme, |
|
809 |
|
sizeof(tmp_values.color_scheme), "Xterm"); |
|
810 |
|
} |
|
811 |
|
break; |
|
812 |
|
case RXVT: |
|
813 |
|
{ |
|
814 |
|
for(v = 2; v < 18; v++) |
|
815 |
|
{ |
|
816 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
817 |
|
FALSE); |
|
818 |
|
} |
|
819 |
|
|
|
820 |
|
tmp_values.color_change = 1; |
|
821 |
|
g_snprintf(tmp_values.color_scheme, |
|
822 |
|
sizeof(tmp_values.color_scheme), "Rxvt"); |
|
823 |
|
} |
|
824 |
|
break; |
|
825 |
|
case CUSTOM: |
|
826 |
|
{ |
|
827 |
|
for(v = 2; v < 18; v++) |
|
828 |
|
{ |
|
829 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
830 |
|
TRUE); |
|
831 |
|
} |
|
832 |
|
|
|
833 |
|
tmp_values.color_change = 1; |
|
834 |
|
g_snprintf(tmp_values.color_scheme, |
|
835 |
|
sizeof(tmp_values.color_scheme), "Custom"); |
|
836 |
|
} |
|
837 |
|
break; |
|
838 |
|
case WHITE_ON_BLACK: /* Background */ |
|
839 |
|
{ |
|
840 |
|
for(v = 0; v < 2; v++) |
|
841 |
|
{ |
|
842 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
843 |
|
FALSE); |
|
844 |
|
} |
|
845 |
|
|
|
846 |
|
tmp_values.background_change = 1; |
|
847 |
|
g_snprintf(tmp_values.background, sizeof(zvt.background), "WhiteOnBlack"); |
|
848 |
|
} |
|
849 |
|
break; |
|
850 |
|
case BLACK_ON_WHITE: |
|
851 |
|
{ |
|
852 |
|
for(v = 0; v < 2; v++) |
|
853 |
|
{ |
|
854 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
855 |
|
FALSE); |
|
856 |
|
} |
|
857 |
|
|
|
858 |
|
tmp_values.background_change = 1; |
|
859 |
|
g_snprintf(tmp_values.background, sizeof(zvt.background), "BlackOnWhite"); |
|
860 |
|
} |
|
861 |
|
break; |
|
862 |
|
case GREEN_ON_BLACK: |
|
863 |
|
{ |
|
864 |
|
for(v = 0; v < 2; v++) |
|
865 |
|
{ |
|
866 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
867 |
|
FALSE); |
|
868 |
|
} |
|
869 |
|
|
|
870 |
|
tmp_values.background_change = 1; |
|
871 |
|
g_snprintf(tmp_values.background, sizeof(zvt.background), "GreenOnBlack"); |
|
872 |
|
} |
|
873 |
|
break; |
|
874 |
|
case CUSTOM_BACK: |
|
875 |
|
{ |
|
876 |
|
for(v = 0; v < 2; v++) |
|
877 |
|
{ |
|
878 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[v]), |
|
879 |
|
TRUE); |
|
880 |
|
} |
|
881 |
|
|
|
882 |
|
tmp_values.background_change = 1; |
|
883 |
|
g_snprintf(tmp_values.background, sizeof(zvt.background), "CustomBack"); |
|
884 |
|
|
|
885 |
|
} |
|
886 |
|
break; |
|
887 |
|
case LEFT: /* notebook tab */ |
|
888 |
|
{ |
|
889 |
|
tmp_values.tab_change = 1; |
|
890 |
|
tmp_values.tab_position = GTK_POS_LEFT; |
|
891 |
|
tmp_values.show_tabs = TRUE; |
|
892 |
|
} |
|
893 |
|
break; |
|
894 |
|
case RIGHT: |
|
895 |
|
{ |
|
896 |
|
tmp_values.tab_change = 1; |
|
897 |
|
tmp_values.tab_position = GTK_POS_RIGHT; |
|
898 |
|
tmp_values.show_tabs = TRUE; |
|
899 |
|
} |
|
900 |
|
break; |
|
901 |
|
case TOP: |
|
902 |
|
{ |
|
903 |
|
tmp_values.tab_change = 1; |
|
904 |
|
tmp_values.tab_position = GTK_POS_TOP; |
|
905 |
|
tmp_values.show_tabs = TRUE; |
|
906 |
|
} |
|
907 |
|
break; |
|
908 |
|
case BOTTOM: |
|
909 |
|
{ |
|
910 |
|
tmp_values.tab_change = 1; |
|
911 |
|
tmp_values.tab_position = GTK_POS_BOTTOM; |
|
912 |
|
tmp_values.show_tabs = TRUE; |
|
913 |
|
} |
|
914 |
|
break; |
|
915 |
|
case HIDDEN: |
|
916 |
|
{ |
|
917 |
|
tmp_values.hide_change = 1; |
|
918 |
|
tmp_values.show_tabs = FALSE; |
|
919 |
|
} |
|
920 |
|
break; |
|
921 |
|
default: |
|
922 |
|
break; |
|
923 |
|
} |
|
924 |
|
} |
|
925 |
|
|
|
926 |
|
void |
|
927 |
|
create_config_dialog (gint page) |
|
928 |
|
{ |
|
929 |
|
GtkWidget *dialog_vbox; |
|
930 |
|
GtkWidget *action_area; |
|
931 |
|
GtkWidget *notebook; |
|
932 |
|
GtkWidget *vbox; |
|
933 |
|
GtkWidget *sub_vbox; |
|
934 |
|
GtkWidget *hbox; |
|
935 |
|
GtkWidget *frame; |
|
936 |
|
GtkWidget *table; |
|
937 |
|
GtkWidget *sw; |
|
938 |
|
GtkWidget *config_clist; |
|
939 |
|
GtkWidget *wid; |
|
940 |
|
GtkWidget *menu; |
|
941 |
|
GtkWidget *menuitem; |
|
942 |
|
GtkStyle *style; |
|
943 |
|
gchar *titles[2]; |
|
944 |
|
gchar *buf[2]; |
|
945 |
|
gchar label_text[MAX_LEN]; |
|
946 |
|
GList *tmp; |
|
947 |
|
int i, z; |
|
948 |
|
gint x; |
|
949 |
|
gint left = 0; |
|
950 |
|
gint right = 1; |
|
951 |
|
gint top = 1; |
|
952 |
|
gint bottom = 2; |
|
953 |
|
gint y = 0; |
|
954 |
|
|
|
955 |
|
GtkWidget *font_button; |
|
956 |
|
tmp_values.color_change = 0; |
|
957 |
|
tmp_values.background_change = 0; |
|
958 |
|
tmp_values.tab_change = 0; |
|
959 |
|
tmp_values.pixmap_change = 0; |
|
960 |
|
tmp_values.font_change = 0; |
|
961 |
|
|
|
962 |
|
dialog = gtk_dialog_new (); |
|
963 |
|
|
|
964 |
|
dialog_vbox = GTK_DIALOG (dialog)->vbox; |
|
965 |
|
action_area = GTK_DIALOG (dialog)->action_area; |
|
966 |
|
gtk_widget_set_usize (dialog, 450, 350); |
|
967 |
|
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5); |
|
968 |
|
gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5); |
|
969 |
|
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); |
|
970 |
|
add_button (action_area, "OK", TRUE, 0, ok_cb, NULL); |
|
971 |
|
add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL); |
|
972 |
|
gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event", |
|
973 |
|
GTK_SIGNAL_FUNC (key_press_cb), NULL); |
|
974 |
|
|
|
975 |
|
/* the main hbox - contains the clist and the frame */ |
|
976 |
|
hbox = add_hbox (dialog_vbox, FALSE, 5, TRUE, 0); |
|
977 |
|
|
|
978 |
|
/* the config clist */ |
|
979 |
|
titles[0] = "Configuration"; |
|
980 |
|
config_clist = gtk_clist_new_with_titles (1, titles); |
|
981 |
|
gtk_signal_connect (GTK_OBJECT (config_clist), "key_press_event", |
|
982 |
|
GTK_SIGNAL_FUNC (config_key_press_cb), NULL); |
|
983 |
|
gtk_clist_set_selection_mode (GTK_CLIST (config_clist), |
|
984 |
|
GTK_SELECTION_BROWSE); |
|
985 |
|
gtk_clist_column_titles_passive (GTK_CLIST (config_clist)); |
|
986 |
|
gtk_signal_connect (GTK_OBJECT (config_clist), "select_row", |
|
987 |
|
GTK_SIGNAL_FUNC (config_clist_select_row_cb), NULL); |
|
988 |
|
gtk_widget_set_usize (config_clist, 120, 0); |
|
989 |
|
gtk_box_pack_start (GTK_BOX (hbox), config_clist, FALSE, FALSE, 0); |
|
990 |
|
gtk_widget_show (config_clist); |
|
991 |
|
|
|
992 |
|
/* the main frame - holds the notebook */ |
|
993 |
|
frame = gtk_frame_new (NULL); |
|
994 |
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); |
|
995 |
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); |
|
996 |
|
gtk_widget_show (frame); |
|
997 |
|
|
|
998 |
|
/* the notebook */ |
|
999 |
|
notebook = gtk_notebook_new (); |
|
1000 |
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); |
|
1001 |
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); |
|
1002 |
|
gtk_container_add (GTK_CONTAINER (frame), notebook); |
|
1003 |
|
gtk_object_set_user_data (GTK_OBJECT (config_clist), notebook); |
|
1004 |
|
gtk_widget_show (notebook); |
|
1005 |
|
|
|
1006 |
|
/* General Tab */ |
|
1007 |
|
vbox = add_page (notebook, "General - Page 1", config_clist); |
|
1008 |
|
|
|
1009 |
|
frame = gtk_frame_new ("Directories"); |
|
1010 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1011 |
|
gtk_widget_show (frame); |
|
1012 |
|
|
|
1013 |
|
table = gtk_table_new (3, 2, FALSE); |
|
1014 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1015 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1016 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1017 |
|
gtk_widget_show (table); |
|
1018 |
|
|
|
1019 |
|
add_label_to_table (table, "Left Startup Dir: ", 0, 0, 1, 0, 1); |
|
1020 |
|
general_page_1.left_startup_dir_entry = add_entry_to_table (table, |
|
1021 |
|
cfg. |
|
1022 |
|
left_startup_dir, |
|
1023 |
|
1, 2, 0, 1); |
|
1024 |
|
add_label_to_table (table, "Right Startup Dir: ", 0, 0, 1, 1, 2); |
|
1025 |
|
general_page_1.right_startup_dir_entry = add_entry_to_table (table, |
|
1026 |
|
cfg. |
|
1027 |
|
right_startup_dir, |
|
1028 |
|
1, 2, 1, 2); |
|
1029 |
|
general_page_1.start_with_cwd_checkbutton = add_check_button_to_table( |
|
1030 |
|
table, "Startup in Current Working Directory", |
|
1031 |
|
cfg.start_with_cwd, start_with_cwd_cb, |
|
1032 |
|
NULL, 0, 2, 2, 3); |
|
1033 |
|
if(GTK_TOGGLE_BUTTON(general_page_1.start_with_cwd_checkbutton)->active) |
|
1034 |
|
{ |
|
1035 |
|
gtk_widget_set_sensitive(general_page_1.left_startup_dir_entry, FALSE); |
|
1036 |
|
gtk_widget_set_sensitive(general_page_1.right_startup_dir_entry, FALSE); |
|
1037 |
|
} |
|
1038 |
|
|
|
1039 |
|
if(GTK_TOGGLE_BUTTON(general_page_1.start_with_cwd_checkbutton)->active) |
|
1040 |
|
{ |
|
1041 |
|
gtk_widget_set_sensitive(general_page_1.left_startup_dir_entry, FALSE); |
|
1042 |
|
gtk_widget_set_sensitive(general_page_1.right_startup_dir_entry, FALSE); |
|
1043 |
|
} |
|
1044 |
|
|
|
1045 |
|
frame = gtk_frame_new ("Choose your favorite vi clone"); |
|
1046 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1047 |
|
gtk_widget_show (frame); |
|
1048 |
|
|
|
1049 |
|
sub_vbox = gtk_vbox_new(FALSE, 0); |
|
1050 |
|
gtk_container_add (GTK_CONTAINER (frame), sub_vbox); |
|
1051 |
|
gtk_widget_show (sub_vbox); |
|
1052 |
|
|
|
1053 |
|
general_page_1.vim = gtk_radio_button_new_with_label(NULL, "Vim"); |
|
1054 |
|
gtk_widget_show(general_page_1.vim); |
|
1055 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), general_page_1.vim, TRUE, TRUE, 0); |
|
1056 |
|
if(!strcmp("vim", cfg.vi_clone)) |
|
1057 |
|
gtk_toggle_button_set_active( |
|
1058 |
|
GTK_TOGGLE_BUTTON(general_page_1.vim), TRUE); |
|
1059 |
|
general_page_1.vile = |
|
1060 |
|
gtk_radio_button_new_with_label_from_widget( |
|
1061 |
|
GTK_RADIO_BUTTON(general_page_1.vim), |
|
1062 |
|
"Vile"); |
|
1063 |
|
gtk_widget_show(general_page_1.vile); |
|
1064 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), general_page_1.vile, |
|
1065 |
|
TRUE, TRUE, 0); |
|
1066 |
|
if(!strcmp("vile", cfg.vi_clone)) |
|
1067 |
|
gtk_toggle_button_set_active( |
|
1068 |
|
GTK_TOGGLE_BUTTON(general_page_1.vile), TRUE); |
|
1069 |
|
general_page_1.elvis = |
|
1070 |
|
gtk_radio_button_new_with_label_from_widget( |
|
1071 |
|
GTK_RADIO_BUTTON(general_page_1.vim), |
|
1072 |
|
"Elvis"); |
|
1073 |
|
gtk_widget_show(general_page_1.elvis); |
|
1074 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), general_page_1.elvis, |
|
1075 |
|
TRUE, TRUE, 0); |
|
1076 |
|
if(!strcmp("elvis", cfg.vi_clone)) |
|
1077 |
|
gtk_toggle_button_set_active( |
|
1078 |
|
GTK_TOGGLE_BUTTON(general_page_1.elvis), TRUE); |
|
1079 |
|
general_page_1.nvi = |
|
1080 |
|
gtk_radio_button_new_with_label_from_widget( |
|
1081 |
|
GTK_RADIO_BUTTON(general_page_1.vim), |
|
1082 |
|
"Nvi"); |
|
1083 |
|
gtk_widget_show(general_page_1.nvi); |
|
1084 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), general_page_1.nvi, |
|
1085 |
|
TRUE, TRUE, 0); |
|
1086 |
|
if(!strcmp("vi", cfg.vi_clone)) |
|
1087 |
|
gtk_toggle_button_set_active( |
|
1088 |
|
GTK_TOGGLE_BUTTON(general_page_1.nvi), TRUE); |
|
1089 |
|
general_page_1.vi_entry = gtk_entry_new(); |
|
1090 |
|
gtk_widget_show(general_page_1.vi_entry); |
|
1091 |
|
wid = gtk_label_new("Actual vi command used"); |
|
1092 |
|
gtk_widget_show(wid); |
|
1093 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), wid, TRUE, TRUE, 0); |
|
1094 |
|
gtk_entry_set_text(GTK_ENTRY(general_page_1.vi_entry), cfg.vi_command); |
|
1095 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), general_page_1.vi_entry, |
|
1096 |
|
TRUE, TRUE, 0); |
|
1097 |
|
|
|
1098 |
|
/* General - Page 2 */ |
|
1099 |
|
vbox = add_page (notebook, "General - Page 2", config_clist); |
|
1100 |
|
|
|
1101 |
|
frame = gtk_frame_new ("Histories"); |
|
1102 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); |
|
1103 |
|
gtk_widget_show (frame); |
|
1104 |
|
|
|
1105 |
|
table = gtk_table_new (2, 2, FALSE); |
|
1106 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1107 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1108 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1109 |
|
gtk_widget_show (table); |
|
1110 |
|
|
|
1111 |
|
add_label_to_table (table, "Directory History Size: ", 0, 0, 1, 0, 1); |
|
1112 |
|
g_snprintf (label_text, sizeof (label_text), "%d", |
|
1113 |
|
cfg.dir_history_max_length); |
|
1114 |
|
general_page_2.dir_history_entry = |
|
1115 |
|
add_entry_to_table (table, label_text, 1, 2, 0, 1); |
|
1116 |
|
add_label_to_table (table, "Command History Size: ", 0, 0, 1, 1, 2); |
|
1117 |
|
g_snprintf (label_text, sizeof (label_text), "%d", |
|
1118 |
|
cfg.command_history_max_length); |
|
1119 |
|
general_page_2.command_history_entry = |
|
1120 |
|
add_entry_to_table (table, label_text, 1, 2, 1, 2); |
|
1121 |
|
|
|
1122 |
|
frame = gtk_frame_new ("Misc"); |
|
1123 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1124 |
|
gtk_widget_show (frame); |
|
1125 |
|
|
|
1126 |
|
table = gtk_table_new (3, 3, FALSE); |
|
1127 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1128 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1129 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1130 |
|
gtk_widget_show (table); |
|
1131 |
|
|
|
1132 |
|
general_page_2.use_scrollbars = add_check_button_to_table(table, |
|
1133 |
|
"Show Scrollbars", cfg.use_scrollbars, NULL, NULL, 0, 1, 0, 1); |
|
1134 |
|
general_page_2.save_position = add_check_button_to_table(table, |
|
1135 |
|
"Save Position", cfg.save_position, NULL, NULL, 0, 1, 1, 2); |
|
1136 |
|
|
|
1137 |
|
add_label_to_table (table, "Xterm Command: ", 0, 0, 1, 2, 3); |
|
1138 |
|
general_page_2.xterm_entry = add_entry_to_table (table, cfg.xterm_command, |
|
1139 |
|
2, 3, 2, 3); |
|
1140 |
|
|
|
1141 |
|
frame = gtk_frame_new("Name Filter"); |
|
1142 |
|
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 5); |
|
1143 |
|
gtk_widget_show(frame); |
|
1144 |
|
|
|
1145 |
|
table = gtk_table_new(3, 2, FALSE); |
|
1146 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1147 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1148 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1149 |
|
gtk_widget_show (table); |
|
1150 |
|
|
|
1151 |
|
add_label_to_table (table, "File Name Pattern: ", 0, 0, 1, 0, 1); |
|
1152 |
|
general_page_2.filter_entry = add_entry_to_table (table, cfg.start_filter, |
|
1153 |
|
1, 2, 0, 1); |
|
1154 |
|
|
|
1155 |
|
general_page_2.invert_filter_check_button = add_check_button_to_table(table, |
|
1156 |
|
"Invert Pattern", cfg.invert_filter, NULL, |
|
1157 |
|
NULL, 0, 1, 1, 2); |
|
1158 |
|
|
|
1159 |
|
|
|
1160 |
|
|
|
1161 |
|
/* Bookmarks Tab */ |
|
1162 |
|
vbox = add_page (notebook, "Bookmarks", config_clist); |
|
1163 |
|
|
|
1164 |
|
sw = add_sw (vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 0); |
|
1165 |
|
|
|
1166 |
|
titles[0] = "Mark "; |
|
1167 |
|
titles[1] = "Directory "; |
|
1168 |
|
titles[2] = "File "; |
|
1169 |
|
|
|
1170 |
|
bookmarks_page.clist = gtk_clist_new_with_titles (3, titles); |
|
1171 |
|
|
|
1172 |
|
gtk_clist_column_titles_passive (GTK_CLIST (bookmarks_page.clist)); |
|
1173 |
|
gtk_clist_set_reorderable (GTK_CLIST (bookmarks_page.clist), TRUE); |
|
1174 |
|
gtk_clist_set_selection_mode (GTK_CLIST (bookmarks_page.clist), |
|
1175 |
|
GTK_SELECTION_EXTENDED); |
|
1176 |
|
gtk_signal_connect (GTK_OBJECT (bookmarks_page.clist), "select_row", |
|
1177 |
|
GTK_SIGNAL_FUNC (bookmarks_select_row_cb), NULL); |
|
1178 |
|
gtk_container_add (GTK_CONTAINER (sw), bookmarks_page.clist); |
|
1179 |
|
for(tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next) |
|
1180 |
|
{ |
|
1181 |
|
Bookmarks *bk = tmp->data; |
|
1182 |
|
|
|
1183 |
|
buf[0] = bk->mark; |
|
1184 |
|
buf[1] = bk->dir; |
|
1185 |
|
buf[2] = bk->file; |
|
1186 |
|
|
|
1187 |
|
i = gtk_clist_append(GTK_CLIST(bookmarks_page.clist), buf); |
|
1188 |
|
gtk_clist_set_row_data(GTK_CLIST(bookmarks_page.clist), i, bk); |
|
1189 |
|
} |
|
1190 |
|
|
|
1191 |
|
gtk_widget_show (bookmarks_page.clist); |
|
1192 |
|
|
|
1193 |
|
hbox = add_hbox (vbox, TRUE, 0, FALSE, 5); |
|
1194 |
|
add_button (hbox, "Up", TRUE, 5, bookmark_up_cb, bookmarks_page.clist); |
|
1195 |
|
add_button (hbox, "Down", TRUE, 5, bookmark_down_cb, bookmarks_page.clist); |
|
1196 |
|
add_button (hbox, "Remove", TRUE, 5, bookmark_remove_cb, |
|
1197 |
|
bookmarks_page.clist); |
|
1198 |
|
|
|
1199 |
|
/* Filetypes Tab */ |
|
1200 |
|
vbox = add_page (notebook, "Filetypes", config_clist); |
|
1201 |
|
|
|
1202 |
|
sw = add_sw (vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 0); |
|
1203 |
|
|
|
1204 |
|
titles[0] = "Extensions"; |
|
1205 |
|
titles[1] = "Description"; |
|
1206 |
|
filetypes_page.clist = gtk_clist_new_with_titles (2, titles); |
|
1207 |
|
gtk_clist_column_titles_passive (GTK_CLIST (filetypes_page.clist)); |
|
1208 |
|
gtk_clist_set_reorderable (GTK_CLIST (filetypes_page.clist), TRUE); |
|
1209 |
|
gtk_clist_set_selection_mode (GTK_CLIST (filetypes_page.clist), |
|
1210 |
|
GTK_SELECTION_EXTENDED); |
|
1211 |
|
gtk_signal_connect (GTK_OBJECT (filetypes_page.clist), "select_row", |
|
1212 |
|
GTK_SIGNAL_FUNC (filetypes_select_row_cb), NULL); |
|
1213 |
|
/**** change selection mode here *****************************/ |
|
1214 |
|
gtk_container_add (GTK_CONTAINER (sw), filetypes_page.clist); |
|
1215 |
|
gtk_widget_show (filetypes_page.clist); |
|
1216 |
|
|
|
1217 |
|
for (tmp = cfg.filetypes; tmp != NULL; tmp = tmp->next) |
|
1218 |
|
{ |
|
1219 |
|
FileType *ft = tmp->data; |
|
1220 |
|
|
|
1221 |
|
buf[0] = ft->extensions; |
|
1222 |
|
buf[1] = ft->description; |
|
1223 |
|
|
|
1224 |
|
i = gtk_clist_append (GTK_CLIST (filetypes_page.clist), buf); |
|
1225 |
|
gtk_clist_set_row_data (GTK_CLIST (filetypes_page.clist), i, ft); |
|
1226 |
|
} |
|
1227 |
|
|
|
1228 |
|
hbox = add_hbox (vbox, FALSE, 0, FALSE, 2); |
|
1229 |
|
filetypes_page.default_program_label = add_label (hbox, "Default Action: ", |
|
1230 |
|
0.01, TRUE, 0); |
|
1231 |
|
|
|
1232 |
|
hbox = add_hbox (vbox, TRUE, 0, FALSE, 5); |
|
1233 |
|
add_button (hbox, "Add", TRUE, 5, add_filetype_cb, filetypes_page.clist); |
|
1234 |
|
add_button (hbox, "Edit", TRUE, 5, edit_filetype_cb, filetypes_page.clist); |
|
1235 |
|
add_button (hbox, "Remove", TRUE, 5, remove_filetype_cb, |
|
1236 |
|
filetypes_page.clist); |
|
1237 |
|
|
|
1238 |
|
/* User Commands Tab */ |
|
1239 |
|
vbox = add_page (notebook, "User Commands", config_clist); |
|
1240 |
|
|
|
1241 |
|
wid = add_label (vbox, "" |
|
1242 |
|
, 0.0, FALSE, 0); |
|
1243 |
|
gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT); |
|
1244 |
|
|
|
1245 |
|
sw = add_sw (vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 0); |
|
1246 |
|
|
|
1247 |
|
titles[0] = "Name"; |
|
1248 |
|
user_commands_page.clist = gtk_clist_new_with_titles (1, titles); |
|
1249 |
|
gtk_clist_column_titles_passive (GTK_CLIST (user_commands_page.clist)); |
|
1250 |
|
gtk_clist_set_reorderable (GTK_CLIST (user_commands_page.clist), TRUE); |
|
1251 |
|
gtk_container_add (GTK_CONTAINER (sw), user_commands_page.clist); |
|
1252 |
|
gtk_widget_show (user_commands_page.clist); |
|
1253 |
|
gtk_signal_connect (GTK_OBJECT (user_commands_page.clist), |
|
1254 |
|
"key_press_event", |
|
1255 |
|
GTK_SIGNAL_FUNC (config_key_press_cb), NULL); |
|
1256 |
|
gtk_clist_set_selection_mode (GTK_CLIST (user_commands_page.clist), |
|
1257 |
|
GTK_SELECTION_BROWSE); |
|
1258 |
|
|
|
1259 |
|
|
|
1260 |
|
for (tmp = cfg.user_commands; tmp != NULL; tmp = tmp->next) |
|
1261 |
|
{ |
|
1262 |
|
UserCommand *command = tmp->data; |
|
1263 |
|
|
|
1264 |
|
buf[0] = command->name; |
|
1265 |
|
|
|
1266 |
|
i = gtk_clist_append (GTK_CLIST (user_commands_page.clist), buf); |
|
1267 |
|
gtk_clist_set_row_data (GTK_CLIST (user_commands_page.clist), i, |
|
1268 |
|
command); |
|
1269 |
|
} |
|
1270 |
|
|
|
1271 |
|
hbox = add_hbox (vbox, TRUE, 0, FALSE, 5); |
|
1272 |
|
add_button (hbox, "Add", TRUE, 5, add_user_command_cb, |
|
1273 |
|
user_commands_page.clist); |
|
1274 |
|
add_button (hbox, "Edit", TRUE, 5, edit_user_command_cb, |
|
1275 |
|
user_commands_page.clist); |
|
1276 |
|
add_button (hbox, "Remove", TRUE, 5, remove_user_command_cb, |
|
1277 |
|
user_commands_page.clist); |
|
1278 |
|
|
|
1279 |
|
/* Columns Tab */ |
|
1280 |
|
vbox = add_page (notebook, "Columns", config_clist); |
|
1281 |
|
|
|
1282 |
|
sw = add_sw (vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 0); |
|
1283 |
|
|
|
1284 |
|
sub_vbox = gtk_vbox_new (FALSE, 0); |
|
1285 |
|
gtk_widget_show (sub_vbox); |
|
1286 |
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), sub_vbox); |
|
1287 |
|
|
|
1288 |
|
for (i = 0; i < MAX_COLUMNS; i++) |
|
1289 |
|
{ |
|
1290 |
|
columns_page.checks[i] = |
|
1291 |
|
add_check_button (sub_vbox, all_columns[i].title, 0, FALSE, 0, NULL, |
|
1292 |
|
NULL); |
|
1293 |
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON |
|
1294 |
|
(columns_page.checks[i]), |
|
1295 |
|
all_columns[i].is_visible); |
|
1296 |
|
} |
|
1297 |
|
gtk_widget_set_sensitive (columns_page.checks[FILENAME], FALSE); |
|
1298 |
|
|
|
1299 |
|
/* Colors Tab */ |
|
1300 |
|
vbox = add_page (notebook, "File Colors", config_clist); |
|
1301 |
|
|
|
1302 |
|
table = add_table (vbox, 7, 2, FALSE, FALSE, 0); |
|
1303 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1304 |
|
|
|
1305 |
|
add_label_to_table (table, "Active List Column Button", 0, 0, 1, 0, 1); |
|
1306 |
|
wid = |
|
1307 |
|
add_button_to_table (table, "", color_select_cb, &COL_COLOR, 1, 2, 0, 1); |
|
1308 |
|
style = gtk_style_new (); |
|
1309 |
|
style->bg[GTK_STATE_NORMAL] = COL_COLOR; |
|
1310 |
|
gtk_widget_set_style (wid, style); |
|
1311 |
|
|
|
1312 |
|
add_label_to_table (table, "Executable", 0, 0, 1, 1, 2); |
|
1313 |
|
wid = |
|
1314 |
|
add_button_to_table (table, "", color_select_cb, &EXE_COLOR, 1, 2, 1, 2); |
|
1315 |
|
style = gtk_style_new (); |
|
1316 |
|
style->bg[GTK_STATE_NORMAL] = EXE_COLOR; |
|
1317 |
|
gtk_widget_set_style (wid, style); |
|
1318 |
|
|
|
1319 |
|
add_label_to_table (table, "Symbolic Link", 0, 0, 1, 2, 3); |
|
1320 |
|
wid = |
|
1321 |
|
add_button_to_table (table, "", color_select_cb, &LNK_COLOR, 1, 2, 2, 3); |
|
1322 |
|
style = gtk_style_new (); |
|
1323 |
|
style->bg[GTK_STATE_NORMAL] = LNK_COLOR; |
|
1324 |
|
gtk_widget_set_style (wid, style); |
|
1325 |
|
|
|
1326 |
|
add_label_to_table (table, "Special Device", 0, 0, 1, 3, 4); |
|
1327 |
|
wid = |
|
1328 |
|
add_button_to_table (table, "", color_select_cb, &DEV_COLOR, 1, 2, 3, 4); |
|
1329 |
|
style = gtk_style_new (); |
|
1330 |
|
style->bg[GTK_STATE_NORMAL] = DEV_COLOR; |
|
1331 |
|
gtk_widget_set_style (wid, style); |
|
1332 |
|
|
|
1333 |
|
add_label_to_table (table, "Socket", 0, 0, 1, 4, 5); |
|
1334 |
|
wid = |
|
1335 |
|
add_button_to_table (table, "", color_select_cb, &SOCK_COLOR, 1, 2, 4, 5); |
|
1336 |
|
style = gtk_style_new (); |
|
1337 |
|
style->bg[GTK_STATE_NORMAL] = SOCK_COLOR; |
|
1338 |
|
gtk_widget_set_style (wid, style); |
|
1339 |
|
|
|
1340 |
|
add_label_to_table (table, "Directory", 0, 0, 1, 5, 6); |
|
1341 |
|
wid = |
|
1342 |
|
add_button_to_table (table, "", color_select_cb, &DIR_COLOR, 1, 2, 5, 6); |
|
1343 |
|
style = gtk_style_new (); |
|
1344 |
|
style->bg[GTK_STATE_NORMAL] = DIR_COLOR; |
|
1345 |
|
gtk_widget_set_style (wid, style); |
|
1346 |
|
|
|
1347 |
|
add_label_to_table (table, "Tagged", 0, 0, 1, 6, 7); |
|
1348 |
|
wid = |
|
1349 |
|
add_button_to_table (table, "", color_select_cb, &TAG_COLOR, 1, 2, 6, 7); |
|
1350 |
|
style = gtk_style_new (); |
|
1351 |
|
style->bg[GTK_STATE_NORMAL] = TAG_COLOR; |
|
1352 |
|
gtk_widget_set_style (wid, style); |
|
1353 |
|
|
|
1354 |
|
gtk_widget_show (table); |
|
1355 |
|
|
|
1356 |
|
|
|
1357 |
|
gtk_clist_select_row (GTK_CLIST (config_clist), page, 0); |
|
1358 |
|
|
|
1359 |
|
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); |
|
1360 |
|
gtk_widget_show (dialog); |
|
1361 |
|
gtk_grab_add (dialog); |
|
1362 |
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), |
|
1363 |
|
GTK_WINDOW (app.main_window)); |
|
1364 |
|
gtk_widget_grab_focus (GTK_WIDGET (config_clist)); |
|
1365 |
|
|
|
1366 |
|
/* Programs Tab */ |
|
1367 |
|
vbox = add_page (notebook, "Programs", config_clist); |
|
1368 |
|
|
|
1369 |
|
wid = add_label (vbox, " Popup menu activated by pressing P \n " |
|
1370 |
|
, 0.0, FALSE, 0); |
|
1371 |
|
gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT); |
|
1372 |
|
|
|
1373 |
|
sw = add_sw (vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 0); |
|
1374 |
|
|
|
1375 |
|
titles[0] = "Name"; |
|
1376 |
|
programs_page.clist = gtk_clist_new_with_titles (1, titles); |
|
1377 |
|
gtk_clist_column_titles_passive (GTK_CLIST (programs_page.clist)); |
|
1378 |
|
gtk_clist_set_reorderable (GTK_CLIST (programs_page.clist), TRUE); |
|
1379 |
|
gtk_container_add (GTK_CONTAINER (sw), programs_page.clist); |
|
1380 |
|
gtk_widget_show (programs_page.clist); |
|
1381 |
|
gtk_signal_connect (GTK_OBJECT (programs_page.clist), |
|
1382 |
|
"key_press_event", |
|
1383 |
|
GTK_SIGNAL_FUNC (config_key_press_cb), NULL); |
|
1384 |
|
gtk_clist_set_selection_mode (GTK_CLIST (programs_page.clist), |
|
1385 |
|
GTK_SELECTION_BROWSE); |
|
1386 |
|
|
|
1387 |
|
|
|
1388 |
|
for (tmp = cfg.programs; tmp != NULL; tmp = tmp->next) |
|
1389 |
|
{ |
|
1390 |
|
Programs *program = tmp->data; |
|
1391 |
|
|
|
1392 |
|
buf[0] = program->name; |
|
1393 |
|
|
|
1394 |
|
i = gtk_clist_append (GTK_CLIST (programs_page.clist), buf); |
|
1395 |
|
gtk_clist_set_row_data (GTK_CLIST (programs_page.clist), i, |
|
1396 |
|
program); |
|
1397 |
|
} |
|
1398 |
|
|
|
1399 |
|
hbox = add_hbox (vbox, TRUE, 0, FALSE, 5); |
|
1400 |
|
add_button (hbox, "Add", TRUE, 5, add_program_cb, |
|
1401 |
|
programs_page.clist); |
|
1402 |
|
add_button (hbox, "Edit", TRUE, 5, edit_programs_cb, |
|
1403 |
|
programs_page.clist); |
|
1404 |
|
add_button (hbox, "Remove", TRUE, 5, remove_program_cb, |
|
1405 |
|
programs_page.clist); |
|
1406 |
|
g_list_free(tmp); |
|
1407 |
|
|
|
1408 |
|
/* Zvt General */ |
|
1409 |
|
vbox = add_page (notebook, "Term Options 1", config_clist); |
|
1410 |
|
sw = add_sw (vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 0); |
|
1411 |
|
|
|
1412 |
|
sub_vbox = gtk_vbox_new (FALSE, 0); |
|
1413 |
|
gtk_widget_show (sub_vbox); |
|
1414 |
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), sub_vbox); |
|
1415 |
|
|
|
1416 |
|
frame = gtk_frame_new ("Terminal Font"); |
|
1417 |
|
gtk_widget_show(frame); |
|
1418 |
|
gtk_container_set_border_width(GTK_CONTAINER(frame), 2); |
|
1419 |
|
gtk_box_pack_start(GTK_BOX(sub_vbox), frame, TRUE, TRUE, 0); |
|
1420 |
|
hbox = gtk_hbox_new(FALSE, TRUE); |
|
1421 |
|
gtk_widget_show(hbox); |
|
1422 |
|
gtk_container_add(GTK_CONTAINER(frame), hbox); |
|
1423 |
|
|
|
1424 |
|
zvt_general.term_font = gtk_entry_new(); |
|
1425 |
|
gtk_entry_set_text(GTK_ENTRY(zvt_general.term_font), zvt.term_font); |
|
1426 |
|
gtk_editable_set_position(GTK_EDITABLE(zvt_general.term_font), 0); |
|
1427 |
|
gtk_widget_show(zvt_general.term_font); |
|
1428 |
|
gtk_box_pack_start(GTK_BOX(hbox), zvt_general.term_font, FALSE, TRUE, 0); |
|
1429 |
|
|
|
1430 |
|
font_button = gtk_button_new_with_label("Browse"); |
|
1431 |
|
gtk_widget_show(font_button); |
|
1432 |
|
gtk_box_pack_start(GTK_BOX(hbox), font_button, TRUE, TRUE, 0); |
|
1433 |
|
gtk_signal_connect_object(GTK_OBJECT(font_button), "clicked", |
|
1434 |
|
GTK_SIGNAL_FUNC(font_dialog), NULL); |
|
1435 |
|
|
|
1436 |
|
frame = gtk_frame_new ("Misc"); |
|
1437 |
|
gtk_container_set_border_width(GTK_CONTAINER(frame), 2); |
|
1438 |
|
gtk_box_pack_start (GTK_BOX (sub_vbox), frame, FALSE, TRUE, 5); |
|
1439 |
|
gtk_widget_show (frame); |
|
1440 |
|
table = gtk_table_new (2, 7, FALSE); |
|
1441 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1442 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 1); |
|
1443 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1444 |
|
gtk_widget_show (table); |
|
1445 |
|
|
|
1446 |
|
add_label_to_table (table, " Notebook Tab Position ", 0, 0, 1, 0, 1); |
|
1447 |
|
zvt_general.tab_menu = gtk_option_menu_new(); |
|
1448 |
|
menu = gtk_menu_new(); |
|
1449 |
|
menuitem = gtk_menu_item_new_with_label("Left"); |
|
1450 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1451 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(LEFT)); |
|
1452 |
|
gtk_widget_show(menuitem); |
|
1453 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1454 |
|
menuitem = gtk_menu_item_new_with_label("Right"); |
|
1455 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1456 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(RIGHT)); |
|
1457 |
|
gtk_widget_show(menuitem); |
|
1458 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1459 |
|
menuitem = gtk_menu_item_new_with_label("Top"); |
|
1460 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1461 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(TOP)); |
|
1462 |
|
gtk_widget_show(menuitem); |
|
1463 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1464 |
|
menuitem = gtk_menu_item_new_with_label("Bottom"); |
|
1465 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1466 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(BOTTOM)); |
|
1467 |
|
gtk_widget_show(menuitem); |
|
1468 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1469 |
|
menuitem = gtk_menu_item_new_with_label("Hidden"); |
|
1470 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1471 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(HIDDEN)); |
|
1472 |
|
gtk_widget_show(menuitem); |
|
1473 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1474 |
|
|
|
1475 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(zvt_general.tab_menu), menu); |
|
1476 |
|
if(!zvt.show_tabs) |
|
1477 |
|
gtk_option_menu_set_history(GTK_OPTION_MENU(zvt_general.tab_menu), 4); |
|
1478 |
|
else |
|
1479 |
|
gtk_option_menu_set_history(GTK_OPTION_MENU(zvt_general.tab_menu), |
|
1480 |
|
zvt.tab_position); |
|
1481 |
|
|
|
1482 |
|
gtk_widget_show(zvt_general.tab_menu); |
|
1483 |
|
gtk_table_attach_defaults(GTK_TABLE(table), zvt_general.tab_menu, 1, 2, 0, 1); |
|
1484 |
|
|
|
1485 |
|
add_label_to_table (table, " Scrollback Lines ", 0, 0, 1, 1, 2); |
|
1486 |
|
|
|
1487 |
|
zvt_general.adj = gtk_adjustment_new(100, 0, 1500, 1, 10, 10); |
|
1488 |
|
zvt_general.spin = gtk_spin_button_new(GTK_ADJUSTMENT(zvt_general.adj), 10, 0); |
|
1489 |
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(zvt_general.spin), |
|
1490 |
|
zvt.scroll_lines); |
|
1491 |
|
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(zvt_general.spin), TRUE); |
|
1492 |
|
gtk_widget_show(zvt_general.spin); |
|
1493 |
|
gtk_table_attach_defaults(GTK_TABLE(table), zvt_general.spin, 1, 2, 1, 2); |
|
1494 |
|
|
|
1495 |
|
zvt_general.blinking_cursor = add_check_button_to_table( |
|
1496 |
|
table, "Use Blinking Cursor", |
|
1497 |
|
zvt.use_blinking_cursor, NULL, |
|
1498 |
|
NULL, 0, 1, 2, 3); |
|
1499 |
|
zvt_general.term_bell = add_check_button_to_table( |
|
1500 |
|
table, "Enable Terminal Bell", |
|
1501 |
|
zvt.terminal_bell, NULL, |
|
1502 |
|
NULL, 0, 1, 3, 4); |
|
1503 |
|
zvt_general.scroll_key = add_check_button_to_table( |
|
1504 |
|
table, "Scroll on Keystroke", |
|
1505 |
|
zvt.scroll_on_keystroke, NULL, |
|
1506 |
|
NULL, 0, 1, 4, 5); |
|
1507 |
|
zvt_general.scroll_output = add_check_button_to_table( |
|
1508 |
|
table, "Scroll on Output", |
|
1509 |
|
zvt.scroll_on_output, NULL, |
|
1510 |
|
NULL, 0, 1, 5, 6); |
|
1511 |
|
zvt_general.swap = add_check_button_to_table( |
|
1512 |
|
table, "Swap Backspace/Delete", |
|
1513 |
|
zvt.swap_backspace, NULL, |
|
1514 |
|
NULL, 0, 1, 6, 7); |
|
1515 |
|
|
|
1516 |
|
/* Term Background */ |
|
1517 |
|
vbox = add_page (notebook, "Term Options 2", config_clist); |
|
1518 |
|
|
|
1519 |
|
/* |
|
1520 |
|
frame = gtk_frame_new ("Background Pixmap"); |
|
1521 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1522 |
|
gtk_widget_show (frame); |
|
1523 |
|
table = gtk_table_new (2, 2, FALSE); |
|
1524 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1525 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1526 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1527 |
|
gtk_widget_show (table); |
|
1528 |
|
zvt_general.pixmap_entry = add_entry_to_table (table, |
|
1529 |
|
zvt.pixmap, |
|
1530 |
|
0, 1, 0, 1); |
|
1531 |
|
add_button_to_table (table, "Browse", file_select_cb, NULL, 1, 2, 0, 1); |
|
1532 |
|
zvt_general.pixmap = add_check_button_to_table( |
|
1533 |
|
table, "Use Background Pixmap", |
|
1534 |
|
zvt.use_pixmap, NULL, |
|
1535 |
|
NULL, 0, 1, 1, 2); |
|
1536 |
|
*/ |
|
1537 |
|
frame = gtk_frame_new ("Transparent Background"); |
|
1538 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1539 |
|
gtk_widget_show (frame); |
|
1540 |
|
table = gtk_table_new (2, 2, FALSE); |
|
1541 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1542 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1543 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1544 |
|
gtk_widget_show (table); |
|
1545 |
|
|
|
1546 |
|
zvt_general.transparent = add_check_button_to_table( |
|
1547 |
|
table, "Transparent", |
|
1548 |
|
zvt.transparent, NULL, |
|
1549 |
|
NULL, 0, 1, 0, 1); |
|
1550 |
|
/* |
|
1551 |
|
zvt_general.shaded = add_check_button_to_table( |
|
1552 |
|
table, "Shaded", |
|
1553 |
|
zvt.shaded, NULL, |
|
1554 |
|
NULL, 0, 1, 1, 2); |
|
1555 |
|
*/ |
|
1556 |
|
|
|
1557 |
|
|
|
1558 |
|
frame = gtk_frame_new ("Notebook Tab Color"); |
|
1559 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1560 |
|
gtk_widget_show (frame); |
|
1561 |
|
table = gtk_table_new (2, 3, FALSE); |
|
1562 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1563 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1564 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1565 |
|
gtk_widget_show (table); |
|
1566 |
|
|
|
1567 |
|
add_label_to_table (table, " Highlighted Tab ", 0, 0, 1, 0, 1); |
|
1568 |
|
zvt_general.tab_button = add_button_to_table(table, " ", |
|
1569 |
|
color_select_cb, &TAB_COLOR, 1, 2, 0, 1); |
|
1570 |
|
style = gtk_style_new(); |
|
1571 |
|
style->bg[GTK_STATE_NORMAL] = TAB_COLOR; |
|
1572 |
|
gtk_widget_set_style(zvt_general.tab_button, style); |
|
1573 |
|
|
|
1574 |
|
frame = gtk_frame_new ("Program to lookup word under term cursor"); |
|
1575 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1576 |
|
gtk_widget_show (frame); |
|
1577 |
|
table = gtk_table_new (2, 3, FALSE); |
|
1578 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2); |
|
1579 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1580 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1581 |
|
gtk_widget_show (table); |
|
1582 |
|
zvt_general.program_entry = add_entry_to_table(table, cfg.man_program, |
|
1583 |
|
1, 2, 0, 1); |
|
1584 |
|
gtk_widget_show(zvt_general.program_entry); |
|
1585 |
|
|
|
1586 |
|
|
|
1587 |
|
/* Term custom colors */ |
|
1588 |
|
vbox = add_page (notebook, "Term Options 3", config_clist); |
|
1589 |
|
frame = gtk_frame_new ("Foreground / Background Colors"); |
|
1590 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1591 |
|
gtk_widget_show (frame); |
|
1592 |
|
table = gtk_table_new (2, 2, FALSE); |
|
1593 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 5); |
|
1594 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 5); |
|
1595 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1596 |
|
gtk_widget_show (table); |
|
1597 |
|
|
|
1598 |
|
zvt_general.background_menu = gtk_option_menu_new(); |
|
1599 |
|
menu = gtk_menu_new(); |
|
1600 |
|
menuitem = gtk_menu_item_new_with_label("White on Black"); |
|
1601 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1602 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(WHITE_ON_BLACK)); |
|
1603 |
|
gtk_widget_show(menuitem); |
|
1604 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1605 |
|
menuitem = gtk_menu_item_new_with_label("Black on White"); |
|
1606 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1607 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(BLACK_ON_WHITE)); |
|
1608 |
|
gtk_widget_show(menuitem); |
|
1609 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1610 |
|
menuitem = gtk_menu_item_new_with_label("Green on Black"); |
|
1611 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1612 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(GREEN_ON_BLACK)); |
|
1613 |
|
gtk_widget_show(menuitem); |
|
1614 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1615 |
|
menuitem = gtk_menu_item_new_with_label("Custom"); |
|
1616 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1617 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(CUSTOM_BACK)); |
|
1618 |
|
gtk_widget_show(menuitem); |
|
1619 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1620 |
|
|
|
1621 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(zvt_general.background_menu), menu); |
|
1622 |
|
gtk_widget_show(zvt_general.background_menu); |
|
1623 |
|
gtk_table_attach_defaults(GTK_TABLE(table), |
|
1624 |
|
zvt_general.background_menu, 0, 2, 0, 1); |
|
1625 |
|
if(!strcmp(zvt.background, "GreenOnBlack")) |
|
1626 |
|
i = 2; |
|
1627 |
|
if(!strcmp(zvt.background, "BlackOnWhite")) |
|
1628 |
|
i = 1; |
|
1629 |
|
if(!strcmp(zvt.background, "WhiteOnBlack")) |
|
1630 |
|
i = 0; |
|
1631 |
|
else |
|
1632 |
|
i = 3; |
|
1633 |
|
|
|
1634 |
|
gtk_option_menu_set_history(GTK_OPTION_MENU(zvt_general.background_menu), i); |
|
1635 |
|
|
|
1636 |
|
zvt_general.color_button[0] = |
|
1637 |
|
add_button_to_table (table, "ForeGround", color_select_cb, |
|
1638 |
|
&zvt.palette[16], 0, 1, 1, 2); |
|
1639 |
|
if(i != 3) |
|
1640 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[0]), FALSE); |
|
1641 |
|
|
|
1642 |
|
style = gtk_style_new (); |
|
1643 |
|
style->bg[GTK_STATE_NORMAL] = zvt.palette[16]; |
|
1644 |
|
gtk_widget_set_style (zvt_general.color_button[0], style); |
|
1645 |
|
|
|
1646 |
|
|
|
1647 |
|
zvt_general.color_button[1] = |
|
1648 |
|
add_button_to_table (table, "Background", color_select_cb, |
|
1649 |
|
&zvt.palette[17], 1, 2, 1, 2); |
|
1650 |
|
if(i != 3) |
|
1651 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[1]), FALSE); |
|
1652 |
|
|
|
1653 |
|
style = gtk_style_new (); |
|
1654 |
|
style->bg[GTK_STATE_NORMAL] = zvt.palette[17]; |
|
1655 |
|
gtk_widget_set_style (zvt_general.color_button[1], style); |
|
1656 |
|
|
|
1657 |
|
frame = gtk_frame_new ("Terminal Colors"); |
|
1658 |
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 5); |
|
1659 |
|
gtk_widget_show (frame); |
|
1660 |
|
table = gtk_table_new (4, 5, FALSE); |
|
1661 |
|
gtk_container_set_border_width (GTK_CONTAINER (table), 5); |
|
1662 |
|
gtk_table_set_row_spacings (GTK_TABLE (table), 1); |
|
1663 |
|
gtk_container_add (GTK_CONTAINER (frame), table); |
|
1664 |
|
gtk_widget_show (table); |
|
1665 |
|
|
|
1666 |
|
zvt_general.scheme_menu = gtk_option_menu_new(); |
|
1667 |
|
menu = gtk_menu_new(); |
|
1668 |
|
menuitem = gtk_menu_item_new_with_label("Linux"); |
|
1669 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1670 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(LINUX)); |
|
1671 |
|
gtk_widget_show(menuitem); |
|
1672 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1673 |
|
menuitem = gtk_menu_item_new_with_label("Xterm"); |
|
1674 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1675 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(XTERM)); |
|
1676 |
|
gtk_widget_show(menuitem); |
|
1677 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1678 |
|
menuitem = gtk_menu_item_new_with_label("Rxvt"); |
|
1679 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1680 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(RXVT)); |
|
1681 |
|
gtk_widget_show(menuitem); |
|
1682 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1683 |
|
menuitem = gtk_menu_item_new_with_label("Custom"); |
|
1684 |
|
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", |
|
1685 |
|
GTK_SIGNAL_FUNC(option_menu_cb), GUINT_TO_POINTER(CUSTOM)); |
|
1686 |
|
gtk_widget_show(menuitem); |
|
1687 |
|
gtk_menu_append(GTK_MENU(menu), menuitem); |
|
1688 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(zvt_general.scheme_menu), menu); |
|
1689 |
|
gtk_widget_show(zvt_general.scheme_menu); |
|
1690 |
|
gtk_table_attach_defaults(GTK_TABLE(table), |
|
1691 |
|
zvt_general.scheme_menu, 0, 4, 0, 1); |
|
1692 |
|
if(!strcmp(zvt.term_color, "Linux")) |
|
1693 |
|
i = 0; |
|
1694 |
|
if(!strcmp(zvt.term_color, "Xterm")) |
|
1695 |
|
i = 1; |
|
1696 |
|
if(!strcmp(zvt.term_color, "Rxvt")) |
|
1697 |
|
i = 2; |
|
1698 |
|
else |
|
1699 |
|
i = 3; |
|
1700 |
|
gtk_option_menu_set_history(GTK_OPTION_MENU(zvt_general.scheme_menu), i); |
|
1701 |
|
|
|
1702 |
|
|
|
1703 |
|
for(z = 0; z < 4; z++) |
|
1704 |
|
{ |
|
1705 |
|
for(x = 0; x < 4; x++) |
|
1706 |
|
{ |
|
1707 |
|
gchar label[4]; |
|
1708 |
|
g_snprintf(label, sizeof(label), "%d", y +1); |
|
1709 |
|
|
|
1710 |
|
zvt_general.color_button[y +2] = |
|
1711 |
|
add_button_to_table (table, label, color_select_cb, &zvt.palette[y], |
|
1712 |
|
left, right, top, bottom); |
|
1713 |
|
if(i != 3) |
|
1714 |
|
gtk_widget_set_sensitive(GTK_WIDGET(zvt_general.color_button[y +2]), |
|
1715 |
|
FALSE); |
|
1716 |
|
|
|
1717 |
|
style = gtk_style_new (); |
|
1718 |
|
style->bg[GTK_STATE_NORMAL] = zvt.palette[y]; |
|
1719 |
|
gtk_widget_set_style (zvt_general.color_button[y +2], style); |
|
1720 |
|
left++; |
|
1721 |
|
right++; |
|
1722 |
|
y++; |
|
1723 |
|
} |
|
1724 |
|
left = 0; |
|
1725 |
|
right = 1; |
|
1726 |
|
top++; |
|
1727 |
|
bottom++; |
|
1728 |
|
} |
|
1729 |
|
} |
| File src/config_files.c added (mode: 100644) (index 0000000..720856b) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
#include<sys/param.h> |
|
21 |
|
#if defined(__FreeBSD_version) |
|
22 |
|
#define CP_HELP "cp %%PREFIX%%//share/vide/vide%s.txt %s" |
|
23 |
|
#else |
|
24 |
|
#define CP_HELP "cp /usr/local/share/vide/vide%s.txt %s" |
|
25 |
|
#endif |
|
26 |
|
|
|
27 |
|
#include <stdlib.h> |
|
28 |
|
#include <stdio.h> |
|
29 |
|
#include <string.h> |
|
30 |
|
#include <unistd.h> |
|
31 |
|
#include <fcntl.h> |
|
32 |
|
#include <sys/stat.h> |
|
33 |
|
#include <sys/types.h> |
|
34 |
|
#include "vide.h" |
|
35 |
|
|
|
36 |
|
/*static void |
|
37 |
|
write_data (gpointer data, gpointer file) |
|
38 |
|
{ |
|
39 |
|
fprintf ((FILE *) file, "%s\n", (gchar *) data); |
|
40 |
|
}*/ |
|
41 |
|
|
|
42 |
|
static void |
|
43 |
|
create_memo_file(gchar *memo_file) |
|
44 |
|
{ |
|
45 |
|
FILE *f; |
|
46 |
|
gchar memo_text[] = {" |
|
47 |
|
This is here as an example. I find it useful. But you can |
|
48 |
|
remove it from the command list, if you find it annoying.\n |
|
49 |
|
"}; |
|
50 |
|
|
|
51 |
|
if((f = fopen(memo_file, "w")) == NULL) |
|
52 |
|
{ |
|
53 |
|
fprintf(stderr, "Unable to create memo file\n"); |
|
54 |
|
return; |
|
55 |
|
} |
|
56 |
|
|
|
57 |
|
fprintf(stderr, "Creating memo file\n"); |
|
58 |
|
fprintf(f, "%s\n", memo_text); |
|
59 |
|
fclose(f); |
|
60 |
|
} |
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
static void |
|
66 |
|
create_help_file(gchar *help_file) |
|
67 |
|
{ |
|
68 |
|
gchar command[PATH_MAX]; |
|
69 |
|
|
|
70 |
|
g_snprintf(command, sizeof(command), CP_HELP, |
|
71 |
|
VERSION, help_file); |
|
72 |
|
file_exec(command); |
|
73 |
|
|
|
74 |
|
} |
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
void |
|
80 |
|
set_config_dir () |
|
81 |
|
{ |
|
82 |
|
FILE *f; |
|
83 |
|
gchar help_file[PATH_MAX]; |
|
84 |
|
gchar memo_file[PATH_MAX]; |
|
85 |
|
gchar *home_dir = getenv ("HOME"); |
|
86 |
|
|
|
87 |
|
if (home_dir) |
|
88 |
|
{ |
|
89 |
|
g_snprintf (cfg.config_dir, sizeof (cfg.config_dir), "%s/.vide", |
|
90 |
|
home_dir); |
|
91 |
|
g_snprintf (cfg.trash, sizeof (cfg.trash), "%s/.vide/Trash", home_dir); |
|
92 |
|
g_snprintf(help_file, sizeof(help_file), "%s/.vide/vide%s.txt", home_dir, |
|
93 |
|
VERSION); |
|
94 |
|
g_snprintf(memo_file, sizeof(memo_file), "%s/.vide/memo", home_dir); |
|
95 |
|
|
|
96 |
|
if (chdir (cfg.config_dir)) |
|
97 |
|
{ |
|
98 |
|
fprintf (stderr, "Creating config dir\n"); |
|
99 |
|
if (mkdir (cfg.config_dir, 0777)) |
|
100 |
|
{ |
|
101 |
|
fprintf (stderr, "Couldn't make the config dir\n"); |
|
102 |
|
return; |
|
103 |
|
} |
|
104 |
|
if ((f = fopen(help_file, "r")) == NULL) |
|
105 |
|
{ |
|
106 |
|
fprintf(stderr, "Unable to open help file\n"); |
|
107 |
|
create_help_file(help_file); |
|
108 |
|
} |
|
109 |
|
if ((f = fopen(memo_file, "r")) == NULL) |
|
110 |
|
create_memo_file(memo_file); |
|
111 |
|
|
|
112 |
|
} |
|
113 |
|
/* Check if help file is current */ |
|
114 |
|
if((f = fopen(help_file, "r")) == NULL) |
|
115 |
|
create_help_file(help_file); |
|
116 |
|
|
|
117 |
|
if (chdir (cfg.trash)) |
|
118 |
|
{ |
|
119 |
|
if (mkdir (cfg.trash, 0777)) |
|
120 |
|
{ |
|
121 |
|
fprintf (stderr, "Couldn't make the trash dir\n"); |
|
122 |
|
return; |
|
123 |
|
} |
|
124 |
|
} |
|
125 |
|
} |
|
126 |
|
else |
|
127 |
|
{ |
|
128 |
|
fprintf (stderr, "HOME environtment variable not set\n"); |
|
129 |
|
return; |
|
130 |
|
} |
|
131 |
|
} |
|
132 |
|
|
|
133 |
|
gboolean |
|
134 |
|
read_term_file() |
|
135 |
|
{ |
|
136 |
|
FILE *f; |
|
137 |
|
gchar term_file[PATH_MAX + 10]; |
|
138 |
|
gchar line[MAX_LEN]; |
|
139 |
|
gchar *value; |
|
140 |
|
|
|
141 |
|
g_snprintf (term_file, sizeof (term_file), "%s/term_options", |
|
142 |
|
cfg.config_dir); |
|
143 |
|
if ((f = fopen (term_file, "r")) == NULL) |
|
144 |
|
{ |
|
145 |
|
fprintf (stderr, "Unable to open term options file for reading\n"); |
|
146 |
|
fprintf(stderr, "Will use default settings\n"); |
|
147 |
|
return FALSE; |
|
148 |
|
} |
|
149 |
|
|
|
150 |
|
while(fgets(line, MAX_LEN, f)) |
|
151 |
|
{ |
|
152 |
|
chomp(line); |
|
153 |
|
|
|
154 |
|
if(strstr(line, "TERMINAL_BELL")) |
|
155 |
|
{ |
|
156 |
|
value = (strchr(line, '=') +1); |
|
157 |
|
zvt.terminal_bell = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
158 |
|
continue; |
|
159 |
|
} |
|
160 |
|
if(strstr(line, "USE_BLINKING_CURSOR")) |
|
161 |
|
{ |
|
162 |
|
value = (strchr(line, '=') +1); |
|
163 |
|
zvt.use_blinking_cursor = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
164 |
|
continue; |
|
165 |
|
} |
|
166 |
|
if(strstr(line, "SCROLL_ON_KEYSTROKE")) |
|
167 |
|
{ |
|
168 |
|
value = (strchr(line, '=') +1); |
|
169 |
|
zvt.scroll_on_keystroke = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
170 |
|
continue; |
|
171 |
|
} |
|
172 |
|
if(strstr(line, "SCROLL_ON_OUTPUT")) |
|
173 |
|
{ |
|
174 |
|
value = (strchr(line, '=') +1); |
|
175 |
|
zvt.scroll_on_output = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
176 |
|
continue; |
|
177 |
|
} |
|
178 |
|
if(strstr(line, "SWAP_BACKSPACE")) |
|
179 |
|
{ |
|
180 |
|
value = (strchr(line, '=') +1); |
|
181 |
|
zvt.swap_backspace = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
182 |
|
continue; |
|
183 |
|
} |
|
184 |
|
if(strstr(line, "TRANSPARENT")) |
|
185 |
|
{ |
|
186 |
|
value = (strchr(line, '=') +1); |
|
187 |
|
zvt.transparent = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
188 |
|
continue; |
|
189 |
|
} |
|
190 |
|
if(strstr(line, "SHADED")) |
|
191 |
|
{ |
|
192 |
|
value = (strchr(line, '=') +1); |
|
193 |
|
zvt.shaded = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
194 |
|
continue; |
|
195 |
|
} |
|
196 |
|
if(strstr(line, "USE_PIXMAP")) |
|
197 |
|
{ |
|
198 |
|
value = (strchr(line, '=') +1); |
|
199 |
|
zvt.use_pixmap = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
200 |
|
continue; |
|
201 |
|
} |
|
202 |
|
if(strstr(line, "PIXMAP")) |
|
203 |
|
{ |
|
204 |
|
value = (strchr(line, '=') +1); |
|
205 |
|
strncpy (zvt.pixmap, value, sizeof (zvt.pixmap)); |
|
206 |
|
continue; |
|
207 |
|
} |
|
208 |
|
if(strstr(line, "SCROLLBAR_POSITION")) |
|
209 |
|
{ |
|
210 |
|
value = (strchr(line, '=') +1); |
|
211 |
|
zvt.scrollbar_position = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
212 |
|
continue; |
|
213 |
|
} |
|
214 |
|
if(strstr(line, "TAB_POSITION")) |
|
215 |
|
{ |
|
216 |
|
value = (strchr(line, '=') +1); |
|
217 |
|
zvt.tab_position = atoi(value); |
|
218 |
|
continue; |
|
219 |
|
} |
|
220 |
|
if(strstr(line, "TERM_COLOR")) |
|
221 |
|
{ |
|
222 |
|
value = (strchr(line, '=') +1); |
|
223 |
|
strncpy(zvt.term_color, value, sizeof(zvt.term_color)); |
|
224 |
|
continue; |
|
225 |
|
} |
|
226 |
|
if(strstr(line, "BACKGROUND")) |
|
227 |
|
{ |
|
228 |
|
value = (strchr(line, '=') +1); |
|
229 |
|
strncpy(zvt.background, value, sizeof(zvt.background)); |
|
230 |
|
continue; |
|
231 |
|
} |
|
232 |
|
if(strstr(line, "SCROLL_LINES")) |
|
233 |
|
{ |
|
234 |
|
value = (strchr(line, '=') +1); |
|
235 |
|
zvt.scroll_lines = atof(value); |
|
236 |
|
continue; |
|
237 |
|
} |
|
238 |
|
if(strstr(line, "TERM_FONT")) |
|
239 |
|
{ |
|
240 |
|
value = (strchr(line, '=') +1); |
|
241 |
|
strncpy(zvt.term_font, value, sizeof(zvt.term_font)); |
|
242 |
|
continue; |
|
243 |
|
} |
|
244 |
|
if(strstr(line, "SHOW_TABS")) |
|
245 |
|
{ |
|
246 |
|
value = (strchr(line, '=') +1); |
|
247 |
|
zvt.show_tabs = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
248 |
|
continue; |
|
249 |
|
} |
|
250 |
|
if(strstr(line, "RED=")) |
|
251 |
|
{ |
|
252 |
|
gint x = 0; |
|
253 |
|
value = (strchr(line, '=') +1); |
|
254 |
|
x = atoi(value); |
|
255 |
|
value++; |
|
256 |
|
value = (strchr(value, '=') +1); |
|
257 |
|
zvt.palette[x].red = atoi(value); |
|
258 |
|
continue; |
|
259 |
|
|
|
260 |
|
} |
|
261 |
|
if(strstr(line, "GREEN=")) |
|
262 |
|
{ |
|
263 |
|
gint x = 0; |
|
264 |
|
value = (strchr(line, '=') +1); |
|
265 |
|
x = atoi(value); |
|
266 |
|
value++; |
|
267 |
|
value = (strchr(value, '=') +1); |
|
268 |
|
zvt.palette[x].green = atoi(value); |
|
269 |
|
continue; |
|
270 |
|
} |
|
271 |
|
if(strstr(line, "BLUE=")) |
|
272 |
|
{ |
|
273 |
|
gint x = 0; |
|
274 |
|
value = (strchr(line, '=') +1); |
|
275 |
|
x = atoi(value); |
|
276 |
|
value++; |
|
277 |
|
value = (strchr(value, '=') +1); |
|
278 |
|
zvt.palette[x].blue = atoi(value); |
|
279 |
|
continue; |
|
280 |
|
} |
|
281 |
|
if(strstr(line, "REDFORE")) |
|
282 |
|
{ |
|
283 |
|
value = (strchr(line, '=') +1); |
|
284 |
|
zvt.foreground[0].red = atoi(value); |
|
285 |
|
continue; |
|
286 |
|
} |
|
287 |
|
if(strstr(line, "GREENFORE")) |
|
288 |
|
{ |
|
289 |
|
value = (strchr(line, '=') +1); |
|
290 |
|
zvt.foreground[0].green = atoi(value); |
|
291 |
|
continue; |
|
292 |
|
} |
|
293 |
|
if(strstr(line, "BLUEFORE")) |
|
294 |
|
{ |
|
295 |
|
value = (strchr(line, '=') +1); |
|
296 |
|
zvt.foreground[0].blue = atoi(value); |
|
297 |
|
continue; |
|
298 |
|
} |
|
299 |
|
if(strstr(line, "REDBACK")) |
|
300 |
|
{ |
|
301 |
|
value = (strchr(line, '=') +1); |
|
302 |
|
zvt.foreground[1].red = atoi(value); |
|
303 |
|
continue; |
|
304 |
|
} |
|
305 |
|
if(strstr(line, "GREENBACK")) |
|
306 |
|
{ |
|
307 |
|
value = (strchr(line, '=') +1); |
|
308 |
|
zvt.foreground[1].green = atoi(value); |
|
309 |
|
continue; |
|
310 |
|
} |
|
311 |
|
if(strstr(line, "BLUEBACK")) |
|
312 |
|
{ |
|
313 |
|
value = (strchr(line, '=') +1); |
|
314 |
|
zvt.foreground[1].blue = atoi(value); |
|
315 |
|
continue; |
|
316 |
|
} |
|
317 |
|
|
|
318 |
|
} |
|
319 |
|
return TRUE; |
|
320 |
|
} |
|
321 |
|
|
|
322 |
|
void |
|
323 |
|
write_term_file() |
|
324 |
|
{ |
|
325 |
|
FILE *f; |
|
326 |
|
gchar term_file[PATH_MAX + 10]; |
|
327 |
|
struct stat stat_buf; |
|
328 |
|
int i; |
|
329 |
|
|
|
330 |
|
g_snprintf (term_file, sizeof (term_file), |
|
331 |
|
"%s/term_options", cfg.config_dir); |
|
332 |
|
|
|
333 |
|
if ((f = fopen (term_file, "w")) == NULL) |
|
334 |
|
{ |
|
335 |
|
fprintf (stderr, "Unable to open term_options file for write\n"); |
|
336 |
|
return; |
|
337 |
|
} |
|
338 |
|
|
|
339 |
|
fprintf(f, "TERMINAL_BELL=%s\n", (zvt.terminal_bell ? "TRUE" : "FALSE")); |
|
340 |
|
fprintf(f, "USE_BLINKING_CURSOR=%s\n", (zvt.use_blinking_cursor ? |
|
341 |
|
"TRUE" : "FALSE")); |
|
342 |
|
fprintf(f, "SCROLL_ON_KEYSTROKE=%s\n", (zvt.scroll_on_keystroke ? "TRUE" : |
|
343 |
|
"FALSE")); |
|
344 |
|
fprintf(f, "SCROLL_ON_OUTPUT=%s\n", (zvt.scroll_on_output ? "TRUE" : |
|
345 |
|
"FALSE")); |
|
346 |
|
fprintf(f, "SWAP_BACKSPACE=%s\n", (zvt.swap_backspace ? "TRUE" : "FALSE")); |
|
347 |
|
fprintf(f, "TRANSPARENT=%s\n", (zvt.transparent ? "TRUE" : "FALSE")); |
|
348 |
|
fprintf(f, "SHADED=%s\n", (zvt.shaded ? "TRUE" : "FALSE")); |
|
349 |
|
fprintf(f, "USE_PIXMAP=%s\n", (zvt.use_pixmap ? "TRUE" : "FALSE")); |
|
350 |
|
fprintf(f, "PIXMAP=%s\n", zvt.pixmap); |
|
351 |
|
fprintf(f, "SCROLLBAR_POSITION=%d\n", zvt.scrollbar_position); |
|
352 |
|
fprintf(f, "TAB_POSITION=%d\n", zvt.tab_position); |
|
353 |
|
fprintf(f, "TERM_COLOR=%s\n", zvt.term_color); |
|
354 |
|
fprintf(f, "BACKGROUND=%s\n", zvt.background); |
|
355 |
|
fprintf(f, "SCROLL_LINES=%f\n", zvt.scroll_lines); |
|
356 |
|
fprintf(f, "TERM_FONT=%s\n", zvt.term_font); |
|
357 |
|
fprintf(f, "SHOW_TABS=%s\n", (zvt.show_tabs ? "TRUE" : "FALSE")); |
|
358 |
|
|
|
359 |
|
for(i = 0; i < 18; i++) |
|
360 |
|
{ |
|
361 |
|
fprintf(f, "RED=%d=%d\n", i, zvt.palette[i].red); |
|
362 |
|
fprintf(f, "GREEN=%d=%d\n", i, zvt.palette[i].green); |
|
363 |
|
fprintf(f, "BLUE=%d=%d\n", i, zvt.palette[i].blue); |
|
364 |
|
} |
|
365 |
|
|
|
366 |
|
fprintf(f, "REDFORE=%d\n", zvt.foreground[0].red); |
|
367 |
|
fprintf(f, "GREENFORE=%d\n", zvt.foreground[0].green); |
|
368 |
|
fprintf(f, "BLUEFORE=%d\n", zvt.foreground[0].blue); |
|
369 |
|
fprintf(f, "REDBACK=%d\n", zvt.foreground[1].red); |
|
370 |
|
fprintf(f, "GREENBACK=%d\n", zvt.foreground[1].green); |
|
371 |
|
fprintf(f, "BLUEBACK=%d\n", zvt.foreground[1].blue); |
|
372 |
|
|
|
373 |
|
fclose (f); |
|
374 |
|
|
|
375 |
|
if (stat (term_file, &stat_buf) != 0) |
|
376 |
|
fprintf (stderr, "Unable to stat term options file.. this is wierd\n"); |
|
377 |
|
else |
|
378 |
|
cfg.term_mtime = stat_buf.st_mtime; |
|
379 |
|
} |
|
380 |
|
|
|
381 |
|
void |
|
382 |
|
write_filetypes_file () |
|
383 |
|
{ |
|
384 |
|
FILE *f; |
|
385 |
|
gchar filetypes_file[PATH_MAX + 10]; |
|
386 |
|
GList *tmp = NULL; |
|
387 |
|
struct stat stat_buf; |
|
388 |
|
|
|
389 |
|
g_snprintf (filetypes_file, sizeof (filetypes_file), |
|
390 |
|
"%s/filetypes", cfg.config_dir); |
|
391 |
|
|
|
392 |
|
if ((f = fopen (filetypes_file, "w")) == NULL) |
|
393 |
|
{ |
|
394 |
|
fprintf (stderr, "Unable to open filetypes file for write\n"); |
|
395 |
|
return; |
|
396 |
|
} |
|
397 |
|
|
|
398 |
|
for (tmp = cfg.filetypes; tmp != NULL; tmp = tmp->next) |
|
399 |
|
{ |
|
400 |
|
FileType *ft = tmp->data; |
|
401 |
|
|
|
402 |
|
fprintf (f, "%s;%s;%s\n", ft->description, ft->extensions, |
|
403 |
|
ft->programs); |
|
404 |
|
} |
|
405 |
|
fclose (f); |
|
406 |
|
|
|
407 |
|
if (stat (filetypes_file, &stat_buf) != 0) |
|
408 |
|
fprintf (stderr, "Unable to stat filetypes file.. this is wierd\n"); |
|
409 |
|
else |
|
410 |
|
cfg.filetypes_mtime = stat_buf.st_mtime; |
|
411 |
|
g_list_free(tmp); |
|
412 |
|
} |
|
413 |
|
|
|
414 |
|
|
|
415 |
|
gboolean read_filetypes_file () |
|
416 |
|
{ |
|
417 |
|
FILE *f; |
|
418 |
|
struct stat stat_buf; |
|
419 |
|
gchar filetypes_file[PATH_MAX + 10]; |
|
420 |
|
gchar line[MAX_LEN]; |
|
421 |
|
gchar *extensions; |
|
422 |
|
gchar *programs; |
|
423 |
|
gchar *description; |
|
424 |
|
gchar *s; |
|
425 |
|
|
|
426 |
|
g_snprintf (filetypes_file, sizeof (filetypes_file), "%s/filetypes", |
|
427 |
|
cfg.config_dir); |
|
428 |
|
if ((f = fopen (filetypes_file, "r")) == NULL) |
|
429 |
|
{ |
|
430 |
|
fprintf (stderr, "Unable to open filetypes file for reading\n"); |
|
431 |
|
fprintf(stderr, "Will use default settings\n"); |
|
432 |
|
return FALSE; |
|
433 |
|
} |
|
434 |
|
|
|
435 |
|
g_list_free(cfg.filetypes); |
|
436 |
|
cfg.filetypes = NULL; |
|
437 |
|
while (fgets (line, MAX_LEN, f)) |
|
438 |
|
{ |
|
439 |
|
if (line[0] == '\n') |
|
440 |
|
continue; |
|
441 |
|
|
|
442 |
|
if ((s = strstr (line, ";")) != NULL) |
|
443 |
|
*s = '\0'; |
|
444 |
|
else |
|
445 |
|
continue; |
|
446 |
|
|
|
447 |
|
description = strdup (line); |
|
448 |
|
s++; |
|
449 |
|
extensions = s; |
|
450 |
|
|
|
451 |
|
if ((s = strstr (extensions, ";")) != NULL) |
|
452 |
|
*s = '\0'; |
|
453 |
|
else |
|
454 |
|
continue; |
|
455 |
|
extensions = strdup (extensions); |
|
456 |
|
s++; |
|
457 |
|
programs = s; |
|
458 |
|
|
|
459 |
|
chomp (programs); |
|
460 |
|
|
|
461 |
|
add_filetype (extensions, programs, description); |
|
462 |
|
|
|
463 |
|
free (description); |
|
464 |
|
free (extensions); |
|
465 |
|
} |
|
466 |
|
fclose (f); |
|
467 |
|
|
|
468 |
|
if (stat (filetypes_file, &stat_buf) != 0) |
|
469 |
|
fprintf (stderr, "Unable to stat filetypes file.. this is wierd\n"); |
|
470 |
|
else |
|
471 |
|
cfg.filetypes_mtime = stat_buf.st_mtime; |
|
472 |
|
|
|
473 |
|
return TRUE; |
|
474 |
|
} |
|
475 |
|
|
|
476 |
|
void |
|
477 |
|
write_bookmarks_file () |
|
478 |
|
{ |
|
479 |
|
FILE *f; |
|
480 |
|
struct stat stat_buf; |
|
481 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
482 |
|
GList *tmp; |
|
483 |
|
|
|
484 |
|
g_snprintf (filename, sizeof (filename), "%s/bookmarks", |
|
485 |
|
cfg.config_dir); |
|
486 |
|
if ((f = fopen (filename, "w")) == NULL) |
|
487 |
|
{ |
|
488 |
|
fprintf (stderr, "Unable to open bookmarks file for writing\n"); |
|
489 |
|
return; |
|
490 |
|
} |
|
491 |
|
|
|
492 |
|
for (tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next) |
|
493 |
|
{ |
|
494 |
|
Bookmarks *bk = tmp->data; |
|
495 |
|
|
|
496 |
|
fprintf (f, "%s=%s=%s\n", bk->mark, bk->dir, bk->file); |
|
497 |
|
} |
|
498 |
|
fclose (f); |
|
499 |
|
|
|
500 |
|
if (stat (filename, &stat_buf) != 0) |
|
501 |
|
fprintf (stderr, "Unable to stat bookmarks file.. this is wierd\n"); |
|
502 |
|
else |
|
503 |
|
cfg.bookmarks_mtime = stat_buf.st_mtime; |
|
504 |
|
g_list_free(tmp); |
|
505 |
|
} |
|
506 |
|
gboolean read_bookmarks_file () |
|
507 |
|
{ |
|
508 |
|
FILE *f; |
|
509 |
|
struct stat stat_buf; |
|
510 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
511 |
|
gchar line[MAX_LEN], *s; |
|
512 |
|
|
|
513 |
|
g_snprintf (filename, sizeof (filename), "%s/bookmarks", |
|
514 |
|
cfg.config_dir); |
|
515 |
|
if ((f = fopen (filename, "r")) == NULL) |
|
516 |
|
{ |
|
517 |
|
fprintf (stderr, "Unable to open bookmarks file for reading\n"); |
|
518 |
|
fprintf(stderr, "Will use default settings\n"); |
|
519 |
|
|
|
520 |
|
return FALSE; |
|
521 |
|
} |
|
522 |
|
|
|
523 |
|
g_list_free(cfg.bookmarks); |
|
524 |
|
cfg.bookmarks = NULL; |
|
525 |
|
while (fgets (line, MAX_LEN, f)) |
|
526 |
|
{ |
|
527 |
|
if (line[0] == '\n') |
|
528 |
|
continue; |
|
529 |
|
|
|
530 |
|
if ((s = strtok (line, "=")) != NULL) |
|
531 |
|
strncpy (bk.mark, s, sizeof (bk.mark)); |
|
532 |
|
if((s = strtok(NULL, "=")) != NULL) |
|
533 |
|
strncpy (bk.dir, s, sizeof (bk.dir)); |
|
534 |
|
if((s = strtok(NULL, "\n")) != NULL) |
|
535 |
|
strncpy (bk.file, s, sizeof(bk.file)); |
|
536 |
|
|
|
537 |
|
cfg.bookmarks = g_list_append (cfg.bookmarks, |
|
538 |
|
duplicate (&bk, |
|
539 |
|
sizeof (Bookmarks))); |
|
540 |
|
} |
|
541 |
|
fclose (f); |
|
542 |
|
|
|
543 |
|
if (stat (filename, &stat_buf) != 0) |
|
544 |
|
fprintf (stderr, "Unable to stat bookmarks file.. this is wierd\n"); |
|
545 |
|
else |
|
546 |
|
cfg.bookmarks_mtime = stat_buf.st_mtime; |
|
547 |
|
|
|
548 |
|
return TRUE; |
|
549 |
|
} |
|
550 |
|
gboolean read_user_commands_file () |
|
551 |
|
{ |
|
552 |
|
FILE *f; |
|
553 |
|
struct stat stat_buf; |
|
554 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
555 |
|
gchar line[MAX_LEN], *s; |
|
556 |
|
UserCommand command; |
|
557 |
|
|
|
558 |
|
g_snprintf (filename, sizeof (filename), "%s/user_commands", |
|
559 |
|
cfg.config_dir); |
|
560 |
|
if ((f = fopen (filename, "r")) == NULL) |
|
561 |
|
{ |
|
562 |
|
fprintf (stderr, "Unable to open user_commands file for reading\n"); |
|
563 |
|
fprintf(stderr, "Will use default settings\n"); |
|
564 |
|
|
|
565 |
|
return FALSE; |
|
566 |
|
} |
|
567 |
|
|
|
568 |
|
g_list_free(cfg.user_commands); |
|
569 |
|
cfg.user_commands = NULL; |
|
570 |
|
while (fgets (line, MAX_LEN, f)) |
|
571 |
|
{ |
|
572 |
|
if (line[0] == '\n') |
|
573 |
|
continue; |
|
574 |
|
|
|
575 |
|
if ((s = strchr (line, '=')) != NULL) |
|
576 |
|
*s++ = '\0'; |
|
577 |
|
else |
|
578 |
|
continue; |
|
579 |
|
|
|
580 |
|
strncpy (command.name, line, sizeof (command.name)); |
|
581 |
|
chomp (s); |
|
582 |
|
strncpy (command.action, s, sizeof (command.action)); |
|
583 |
|
|
|
584 |
|
cfg.user_commands = g_list_append (cfg.user_commands, |
|
585 |
|
duplicate (&command, |
|
586 |
|
sizeof (UserCommand))); |
|
587 |
|
} |
|
588 |
|
fclose (f); |
|
589 |
|
|
|
590 |
|
if (stat (filename, &stat_buf) != 0) |
|
591 |
|
fprintf (stderr, "Unable to stat user_commands file.. this is wierd\n"); |
|
592 |
|
else |
|
593 |
|
cfg.user_commands_mtime = stat_buf.st_mtime; |
|
594 |
|
|
|
595 |
|
return TRUE; |
|
596 |
|
} |
|
597 |
|
|
|
598 |
|
void |
|
599 |
|
write_user_commands_file () |
|
600 |
|
{ |
|
601 |
|
FILE *f; |
|
602 |
|
struct stat stat_buf; |
|
603 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
604 |
|
GList *tmp; |
|
605 |
|
|
|
606 |
|
g_snprintf (filename, sizeof (filename), "%s/user_commands", |
|
607 |
|
cfg.config_dir); |
|
608 |
|
if ((f = fopen (filename, "w")) == NULL) |
|
609 |
|
{ |
|
610 |
|
fprintf (stderr, "Unable to open user_commands file for writing\n"); |
|
611 |
|
return; |
|
612 |
|
} |
|
613 |
|
|
|
614 |
|
for (tmp = cfg.user_commands; tmp != NULL; tmp = tmp->next) |
|
615 |
|
{ |
|
616 |
|
UserCommand *command = tmp->data; |
|
617 |
|
|
|
618 |
|
fprintf (f, "%s=%s\n", command->name, command->action); |
|
619 |
|
} |
|
620 |
|
fclose (f); |
|
621 |
|
|
|
622 |
|
if (stat (filename, &stat_buf) != 0) |
|
623 |
|
fprintf (stderr, "Unable to stat user_commands file.. this is wierd\n"); |
|
624 |
|
else |
|
625 |
|
cfg.user_commands_mtime = stat_buf.st_mtime; |
|
626 |
|
g_list_free(tmp); |
|
627 |
|
} |
|
628 |
|
|
|
629 |
|
/* programs */ |
|
630 |
|
void |
|
631 |
|
write_programs_file () |
|
632 |
|
{ |
|
633 |
|
FILE *f; |
|
634 |
|
struct stat stat_buf; |
|
635 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
636 |
|
GList *tmp; |
|
637 |
|
|
|
638 |
|
g_snprintf (filename, sizeof (filename), "%s/programs", |
|
639 |
|
cfg.config_dir); |
|
640 |
|
if ((f = fopen (filename, "w")) == NULL) |
|
641 |
|
{ |
|
642 |
|
fprintf (stderr, "Unable to open programs file for writing\n"); |
|
643 |
|
fprintf(stderr, "Will use default settings\n"); |
|
644 |
|
|
|
645 |
|
return; |
|
646 |
|
} |
|
647 |
|
|
|
648 |
|
for (tmp = cfg.programs; tmp != NULL; tmp = tmp->next) |
|
649 |
|
{ |
|
650 |
|
Programs *program = tmp->data; |
|
651 |
|
|
|
652 |
|
fprintf (f, "%s=%s\n", program->name, program->action); |
|
653 |
|
} |
|
654 |
|
fclose (f); |
|
655 |
|
|
|
656 |
|
if (stat (filename, &stat_buf) != 0) |
|
657 |
|
fprintf (stderr, "Unable to stat programs file.. this is wierd\n"); |
|
658 |
|
else |
|
659 |
|
cfg.programs_mtime = stat_buf.st_mtime; |
|
660 |
|
g_list_free(tmp); |
|
661 |
|
} |
|
662 |
|
|
|
663 |
|
gboolean read_programs_file () |
|
664 |
|
{ |
|
665 |
|
FILE *f; |
|
666 |
|
struct stat stat_buf; |
|
667 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
668 |
|
gchar line[MAX_LEN], *s; |
|
669 |
|
Programs program; |
|
670 |
|
|
|
671 |
|
g_snprintf (filename, sizeof (filename), "%s/programs", |
|
672 |
|
cfg.config_dir); |
|
673 |
|
if ((f = fopen (filename, "r")) == NULL) |
|
674 |
|
{ |
|
675 |
|
fprintf (stderr, "Unable to open programs file for reading\n"); |
|
676 |
|
fprintf(stderr, "Will use default settings\n"); |
|
677 |
|
|
|
678 |
|
return FALSE; |
|
679 |
|
} |
|
680 |
|
|
|
681 |
|
g_list_free(cfg.programs); |
|
682 |
|
cfg.programs = NULL; |
|
683 |
|
while (fgets (line, MAX_LEN, f)) |
|
684 |
|
{ |
|
685 |
|
if (line[0] == '\n') |
|
686 |
|
continue; |
|
687 |
|
|
|
688 |
|
if ((s = strchr (line, '=')) != NULL) |
|
689 |
|
*s++ = '\0'; |
|
690 |
|
else |
|
691 |
|
continue; |
|
692 |
|
|
|
693 |
|
strncpy (program.name, line, sizeof (program.name)); |
|
694 |
|
chomp (s); |
|
695 |
|
strncpy (program.action, s, sizeof (program.action)); |
|
696 |
|
|
|
697 |
|
cfg.programs = g_list_append (cfg.programs, |
|
698 |
|
duplicate (&program, |
|
699 |
|
sizeof (Programs))); |
|
700 |
|
} |
|
701 |
|
fclose (f); |
|
702 |
|
|
|
703 |
|
if (stat (filename, &stat_buf) != 0) |
|
704 |
|
fprintf (stderr, "Unable to stat programs file.. this is wierd\n"); |
|
705 |
|
else |
|
706 |
|
cfg.programs_mtime = stat_buf.st_mtime; |
|
707 |
|
|
|
708 |
|
return TRUE; |
|
709 |
|
} |
|
710 |
|
|
|
711 |
|
/* command_mode_programs */ |
|
712 |
|
void |
|
713 |
|
write_command_mode_file () |
|
714 |
|
{ |
|
715 |
|
FILE *f; |
|
716 |
|
struct stat stat_buf; |
|
717 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
718 |
|
GList *tmp; |
|
719 |
|
|
|
720 |
|
g_snprintf (filename, sizeof (filename), "%s/command_mode", |
|
721 |
|
cfg.config_dir); |
|
722 |
|
if ((f = fopen (filename, "w")) == NULL) |
|
723 |
|
{ |
|
724 |
|
fprintf (stderr, "Unable to open command_mode file for writing\n"); |
|
725 |
|
fprintf(stderr, "Will use default settings\n"); |
|
726 |
|
|
|
727 |
|
return; |
|
728 |
|
} |
|
729 |
|
|
|
730 |
|
for (tmp = cfg.command_mode_programs; tmp != NULL; tmp = tmp->next) |
|
731 |
|
{ |
|
732 |
|
Command_Mode_Programs *command_mode_programs = tmp->data; |
|
733 |
|
|
|
734 |
|
fprintf (f, "%s=%s\n", command_mode_programs->name, |
|
735 |
|
command_mode_programs->action); |
|
736 |
|
} |
|
737 |
|
fclose (f); |
|
738 |
|
|
|
739 |
|
if (stat (filename, &stat_buf) != 0) |
|
740 |
|
fprintf (stderr, "Unable to stat programs file.. this is wierd\n"); |
|
741 |
|
else |
|
742 |
|
cfg.command_mode_programs_mtime = stat_buf.st_mtime; |
|
743 |
|
g_list_free(tmp); |
|
744 |
|
} |
|
745 |
|
|
|
746 |
|
|
|
747 |
|
gboolean read_command_mode_file() |
|
748 |
|
{ |
|
749 |
|
FILE *f; |
|
750 |
|
struct stat stat_buf; |
|
751 |
|
gchar filename[PATH_MAX + NAME_MAX]; |
|
752 |
|
gchar line[MAX_LEN], *s; |
|
753 |
|
Command_Mode_Programs command_mode_programs; |
|
754 |
|
|
|
755 |
|
g_snprintf (filename, sizeof (filename), "%s/command_mode", |
|
756 |
|
cfg.config_dir); |
|
757 |
|
if ((f = fopen (filename, "r")) == NULL) |
|
758 |
|
{ |
|
759 |
|
fprintf (stderr, "Unable to open command_mode file for reading\n"); |
|
760 |
|
fprintf(stderr, "Will use default settings\n"); |
|
761 |
|
|
|
762 |
|
return FALSE; |
|
763 |
|
} |
|
764 |
|
|
|
765 |
|
g_list_free(cfg.command_mode_programs); |
|
766 |
|
cfg.command_mode_programs = NULL; |
|
767 |
|
while (fgets (line, MAX_LEN, f)) |
|
768 |
|
{ |
|
769 |
|
if (line[0] == '\n') |
|
770 |
|
continue; |
|
771 |
|
|
|
772 |
|
if ((s = strchr (line, '=')) != NULL) |
|
773 |
|
*s++ = '\0'; |
|
774 |
|
else |
|
775 |
|
continue; |
|
776 |
|
|
|
777 |
|
strncpy (command_mode_programs.name, line, sizeof (command_mode_programs.name)); |
|
778 |
|
chomp (s); |
|
779 |
|
strncpy (command_mode_programs.action, s, sizeof (command_mode_programs.action)); |
|
780 |
|
|
|
781 |
|
cfg.command_mode_programs = g_list_append (cfg.command_mode_programs, |
|
782 |
|
duplicate (&command_mode_programs, |
|
783 |
|
sizeof (Command_Mode_Programs))); |
|
784 |
|
} |
|
785 |
|
fclose (f); |
|
786 |
|
|
|
787 |
|
if (stat (filename, &stat_buf) != 0) |
|
788 |
|
fprintf (stderr, "Unable to stat programs file.. this is wierd\n"); |
|
789 |
|
else |
|
790 |
|
cfg.command_mode_programs_mtime = stat_buf.st_mtime; |
|
791 |
|
|
|
792 |
|
return TRUE; |
|
793 |
|
} |
|
794 |
|
void |
|
795 |
|
write_config_file () |
|
796 |
|
{ |
|
797 |
|
FILE *f; |
|
798 |
|
struct stat stat_buf; |
|
799 |
|
gchar config_file[PATH_MAX + 10]; |
|
800 |
|
int i; |
|
801 |
|
|
|
802 |
|
g_snprintf (config_file, sizeof (config_file), "%s/settings", |
|
803 |
|
cfg.config_dir); |
|
804 |
|
if ((f = fopen (config_file, "w")) == NULL) |
|
805 |
|
{ |
|
806 |
|
fprintf (stderr, "Unable to open config file for writing\n"); |
|
807 |
|
return; |
|
808 |
|
} |
|
809 |
|
|
|
810 |
|
fprintf(f, "SAVE_POSITION=%s\n", cfg.save_position ? "TRUE" : "FALSE"); |
|
811 |
|
fprintf(f, "START_FILTER=%s\n", cfg.start_filter); |
|
812 |
|
fprintf(f, "INVERT_FILTER=%s\n", (cfg.invert_filter ? "TRUE" : "FALSE")); |
|
813 |
|
// fprintf (f, "USE_VI_SERVER=%s\n", (cfg.use_vi_server ? "TRUE" : "FALSE")); |
|
814 |
|
// fprintf(f, "USE_VIMCLIENT=%s\n", (cfg.use_vimclient ? "TRUE" : "FALSE")); |
|
815 |
|
fprintf (f, "SHOW_HIDDEN=%s\n", (cfg.show_hidden ? "TRUE" : "FALSE")); |
|
816 |
|
//fprintf (f, "CONFIRM_DELETE=%s\n", (cfg.confirm_delete ? "TRUE" : "FALSE")); |
|
817 |
|
//fprintf (f, "CONFIRM_OVERWRITE=%s\n", (cfg.confirm_overwrite |
|
818 |
|
// ? "TRUE" : "FALSE")); |
|
819 |
|
fprintf (f, "VIEWER_COMMAND=%s\n", cfg.viewer_command); |
|
820 |
|
fprintf (f, "XTERM_COMMAND=%s\n", cfg.xterm_command); |
|
821 |
|
fprintf (f, "LEFT_DIR=%s\n", cfg.left_startup_dir); |
|
822 |
|
fprintf (f, "RIGHT_DIR=%s\n", cfg.right_startup_dir); |
|
823 |
|
fprintf (f, "START_WITH_CWD=%s\n", (cfg.start_with_cwd |
|
824 |
|
? "TRUE" : "FALSE")); |
|
825 |
|
fprintf (f, "USE_SCROLLBARS=%s\n", (cfg.use_scrollbars ? "TRUE" : "FALSE")); |
|
826 |
|
fprintf (f, "VI_CLONE=%s\n", cfg.vi_clone); |
|
827 |
|
fprintf( f, "VI_COMMAND=%s\n", cfg.vi_command); |
|
828 |
|
fprintf (f, "DIR_HISTORY=%d\n", cfg.dir_history_max_length); |
|
829 |
|
fprintf (f, "COMMAND_HISTORY=%d\n", cfg.command_history_max_length); |
|
830 |
|
//fprintf (f, "DIVIDE_POPUP_MENU=%s\n", (cfg.divide_popup_menu |
|
831 |
|
//? "TRUE" : "FALSE")); |
|
832 |
|
fprintf (f, "WINDOW_HEIGHT=%d\n", app.main_window->allocation.height); |
|
833 |
|
fprintf (f, "WINDOW_WIDTH=%d\n", app.main_window->allocation.width); |
|
834 |
|
gdk_window_get_root_origin (app.main_window->window, &cfg.window_xpos, |
|
835 |
|
&cfg.window_ypos); |
|
836 |
|
fprintf (f, "WINDOW_XPOS=%d\n", cfg.window_xpos); |
|
837 |
|
fprintf (f, "WINDOW_YPOS=%d\n", cfg.window_ypos); |
|
838 |
|
//fprintf (f, "OUTPUT_TEXT_HIDDEN=%s\n", (cfg.output_text_hidden |
|
839 |
|
// ? "TRUE" : "FALSE")); |
|
840 |
|
for (i = 0; i < MAX_COLUMNS; i++) |
|
841 |
|
{ |
|
842 |
|
if (all_columns[i].is_visible) |
|
843 |
|
{ |
|
844 |
|
fprintf (f, "COLUMN=%d\n", i); |
|
845 |
|
} |
|
846 |
|
} |
|
847 |
|
|
|
848 |
|
fprintf (f, "COL_COLOR=%04X,%04X,%04X\n", COL_COLOR.red, COL_COLOR.green, |
|
849 |
|
COL_COLOR.blue); |
|
850 |
|
fprintf (f, "DIR_COLOR=%04X,%04X,%04X\n", DIR_COLOR.red, DIR_COLOR.green, |
|
851 |
|
DIR_COLOR.blue); |
|
852 |
|
fprintf (f, "DEV_COLOR=%04X,%04X,%04X\n", DEV_COLOR.red, DEV_COLOR.green, |
|
853 |
|
DEV_COLOR.blue); |
|
854 |
|
fprintf (f, "EXE_COLOR=%04X,%04X,%04X\n", EXE_COLOR.red, EXE_COLOR.green, |
|
855 |
|
EXE_COLOR.blue); |
|
856 |
|
fprintf (f, "LNK_COLOR=%04X,%04X,%04X\n", LNK_COLOR.red, LNK_COLOR.green, |
|
857 |
|
LNK_COLOR.blue); |
|
858 |
|
fprintf (f, "SOCK_COLOR=%04X,%04X,%04X\n", SOCK_COLOR.red, SOCK_COLOR.green, |
|
859 |
|
SOCK_COLOR.blue); |
|
860 |
|
fprintf (f, "TAG_COLOR=%04X,%04X,%04X\n", TAG_COLOR.red, TAG_COLOR.green, |
|
861 |
|
TAG_COLOR.blue); |
|
862 |
|
fprintf (f, "TAB_COLOR=%04X,%04X,%04X\n", TAB_COLOR.red, TAB_COLOR.green, |
|
863 |
|
TAB_COLOR.blue); |
|
864 |
|
for(i = 0; i < 18; i++) |
|
865 |
|
{ |
|
866 |
|
fprintf(f, "ZVT_COLOR=%d,%04X,%04X,%04X\n", i, zvt.palette[i].red, |
|
867 |
|
zvt.palette[i].green, zvt.palette[i].blue); |
|
868 |
|
} |
|
869 |
|
fprintf(f, "MAN_PROGRAM=%s\n", cfg.man_program); |
|
870 |
|
|
|
871 |
|
fclose (f); |
|
872 |
|
|
|
873 |
|
if (stat (config_file, &stat_buf) != 0) |
|
874 |
|
fprintf (stderr, "Unable to stat config file.. this is wierd\n"); |
|
875 |
|
else |
|
876 |
|
cfg.config_mtime = stat_buf.st_mtime; |
|
877 |
|
} |
|
878 |
|
|
|
879 |
|
gboolean read_config_file () |
|
880 |
|
{ |
|
881 |
|
FILE *f; |
|
882 |
|
struct stat stat_buf; |
|
883 |
|
gchar config_file[PATH_MAX + 10]; |
|
884 |
|
gchar line[MAX_LEN]; |
|
885 |
|
gchar *value; |
|
886 |
|
int clear_default_columns = TRUE; |
|
887 |
|
|
|
888 |
|
g_snprintf (config_file, sizeof (config_file), "%s/settings", |
|
889 |
|
cfg.config_dir); |
|
890 |
|
if ((f = fopen (config_file, "r")) == NULL) |
|
891 |
|
{ |
|
892 |
|
fprintf (stderr, "Unable to open config file for reading\n"); |
|
893 |
|
fprintf(stderr, "Will use default settings\n"); |
|
894 |
|
return FALSE; |
|
895 |
|
} |
|
896 |
|
|
|
897 |
|
while (fgets (line, MAX_LEN, f)) |
|
898 |
|
{ |
|
899 |
|
chomp (line); |
|
900 |
|
|
|
901 |
|
if(strstr(line, "SAVE_POSITION")) |
|
902 |
|
{ |
|
903 |
|
value = (strchr(line, '=') +1); |
|
904 |
|
cfg.save_position = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
905 |
|
continue; |
|
906 |
|
} |
|
907 |
|
if(strstr(line, "INVERT_FILTER")) |
|
908 |
|
{ |
|
909 |
|
value = (strchr(line, '=') +1); |
|
910 |
|
cfg.invert_filter = STREQ(value, "TRUE") ? TRUE : FALSE; |
|
911 |
|
continue; |
|
912 |
|
} |
|
913 |
|
if(strstr(line, "START_FILTER")) |
|
914 |
|
{ |
|
915 |
|
value = strchr(line, '=') +1; |
|
916 |
|
g_snprintf(cfg.start_filter, sizeof(cfg.start_filter), "%s", value); |
|
917 |
|
continue; |
|
918 |
|
} |
|
919 |
|
if(strstr (line, "VI_CLONE")) |
|
920 |
|
{ |
|
921 |
|
value = (strchr(line, '=') +1); |
|
922 |
|
strncpy(cfg.vi_clone, value, sizeof(cfg.vi_clone)); |
|
923 |
|
continue; |
|
924 |
|
} |
|
925 |
|
if(strstr(line, "VI_COMMAND")) |
|
926 |
|
{ |
|
927 |
|
value = (strchr(line, '=') +1); |
|
928 |
|
strncpy(cfg.vi_command, value, sizeof(cfg.vi_command)); |
|
929 |
|
continue; |
|
930 |
|
} |
|
931 |
|
if (strstr (line, "SHOW_HIDDEN")) |
|
932 |
|
{ |
|
933 |
|
value = (strchr (line, '=') + 1); |
|
934 |
|
cfg.show_hidden = STREQ (value, "TRUE") ? TRUE : FALSE; |
|
935 |
|
continue; |
|
936 |
|
} |
|
937 |
|
if (strstr (line, "LEFT_DIR")) |
|
938 |
|
{ |
|
939 |
|
value = (strchr (line, '=') + 1); |
|
940 |
|
strncpy (cfg.left_startup_dir, value, |
|
941 |
|
sizeof (cfg.left_startup_dir)); |
|
942 |
|
continue; |
|
943 |
|
} |
|
944 |
|
|
|
945 |
|
if (strstr (line, "RIGHT_DIR")) |
|
946 |
|
{ |
|
947 |
|
value = (strchr (line, '=') + 1); |
|
948 |
|
strncpy (cfg.right_startup_dir, value, |
|
949 |
|
sizeof (cfg.right_startup_dir)); |
|
950 |
|
continue; |
|
951 |
|
} |
|
952 |
|
|
|
953 |
|
if (strstr (line, "START_WITH_CWD")) |
|
954 |
|
{ |
|
955 |
|
value = (strchr (line, '=') + 1); |
|
956 |
|
cfg.start_with_cwd = STREQ (value, "TRUE") ? TRUE : FALSE; |
|
957 |
|
continue; |
|
958 |
|
} |
|
959 |
|
if (strstr (line, "USE_SCROLLBARS")) |
|
960 |
|
{ |
|
961 |
|
value = (strchr (line, '=') + 1); |
|
962 |
|
cfg.use_scrollbars = STREQ (value, "TRUE") ? TRUE : FALSE ; |
|
963 |
|
continue; |
|
964 |
|
} |
|
965 |
|
|
|
966 |
|
if (strstr (line, "DIR_HISTORY")) |
|
967 |
|
{ |
|
968 |
|
value = (strchr (line, '=') + 1); |
|
969 |
|
cfg.dir_history_max_length = atoi (value); |
|
970 |
|
continue; |
|
971 |
|
} |
|
972 |
|
|
|
973 |
|
if (strstr (line, "COMMAND_HISTORY")) |
|
974 |
|
{ |
|
975 |
|
value = (strchr (line, '=') + 1); |
|
976 |
|
cfg.command_history_max_length = atoi (value); |
|
977 |
|
continue; |
|
978 |
|
} |
|
979 |
|
|
|
980 |
|
/* |
|
981 |
|
if (strstr (line, "DIVIDE_POPUP_MENU")) |
|
982 |
|
{ |
|
983 |
|
value = (strchr (line, '=') + 1); |
|
984 |
|
cfg.divide_popup_menu = STREQ (value, "TRUE") ? TRUE : FALSE; |
|
985 |
|
continue; |
|
986 |
|
} |
|
987 |
|
*/ |
|
988 |
|
|
|
989 |
|
|
|
990 |
|
if (strstr (line, "WINDOW_HEIGHT")) |
|
991 |
|
{ |
|
992 |
|
value = (strchr (line, '=') + 1); |
|
993 |
|
cfg.window_height = atoi (value); |
|
994 |
|
continue; |
|
995 |
|
} |
|
996 |
|
|
|
997 |
|
if (strstr (line, "WINDOW_WIDTH")) |
|
998 |
|
{ |
|
999 |
|
value = (strchr (line, '=') + 1); |
|
1000 |
|
cfg.window_width = atoi (value); |
|
1001 |
|
continue; |
|
1002 |
|
} |
|
1003 |
|
|
|
1004 |
|
if (strstr (line, "WINDOW_XPOS")) |
|
1005 |
|
{ |
|
1006 |
|
value = (strchr (line, '=') + 1); |
|
1007 |
|
cfg.window_xpos = atoi (value); |
|
1008 |
|
continue; |
|
1009 |
|
} |
|
1010 |
|
if (strstr (line, "WINDOW_YPOS")) |
|
1011 |
|
{ |
|
1012 |
|
value = (strchr (line, '=') + 1); |
|
1013 |
|
cfg.window_ypos = atoi (value); |
|
1014 |
|
continue; |
|
1015 |
|
} |
|
1016 |
|
if (strstr (line, "VIEWER_COMMAND")) |
|
1017 |
|
{ |
|
1018 |
|
value = (strchr (line, '=') + 1); |
|
1019 |
|
strncpy (cfg.viewer_command, value, sizeof (cfg.viewer_command)); |
|
1020 |
|
continue; |
|
1021 |
|
} |
|
1022 |
|
if (strstr (line, "XTERM_COMMAND")) |
|
1023 |
|
{ |
|
1024 |
|
value = (strchr (line, '=') + 1); |
|
1025 |
|
strncpy (cfg.xterm_command, value, sizeof (cfg.xterm_command)); |
|
1026 |
|
continue; |
|
1027 |
|
} |
|
1028 |
|
|
|
1029 |
|
/* |
|
1030 |
|
if (strstr (line, "OUTPUT_TEXT_HIDDEN")) |
|
1031 |
|
{ |
|
1032 |
|
value = (strchr (line, '=') + 1); |
|
1033 |
|
cfg.output_text_hidden = STREQ (value, "TRUE") ? TRUE : FALSE; |
|
1034 |
|
continue; |
|
1035 |
|
} |
|
1036 |
|
*/ |
|
1037 |
|
|
|
1038 |
|
if (strstr (line, "COLUMN")) |
|
1039 |
|
{ |
|
1040 |
|
int i; |
|
1041 |
|
if (clear_default_columns) |
|
1042 |
|
{ |
|
1043 |
|
for (i = 0; i < MAX_COLUMNS; i++) |
|
1044 |
|
all_columns[i].is_visible = FALSE; |
|
1045 |
|
clear_default_columns = FALSE; |
|
1046 |
|
} |
|
1047 |
|
|
|
1048 |
|
value = (strchr (line, '=') + 1); |
|
1049 |
|
i = atoi (value); |
|
1050 |
|
all_columns[i].is_visible = TRUE; |
|
1051 |
|
} |
|
1052 |
|
|
|
1053 |
|
if (strstr (line, "COL_COLOR")) |
|
1054 |
|
{ |
|
1055 |
|
unsigned int red, green, blue; |
|
1056 |
|
|
|
1057 |
|
value = (strchr (line, '=') + 1); |
|
1058 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1059 |
|
COL_COLOR.red = red; |
|
1060 |
|
COL_COLOR.green = green; |
|
1061 |
|
COL_COLOR.blue = blue; |
|
1062 |
|
} |
|
1063 |
|
|
|
1064 |
|
if (strstr (line, "DIR_COLOR")) |
|
1065 |
|
{ |
|
1066 |
|
unsigned int red, green, blue; |
|
1067 |
|
|
|
1068 |
|
value = (strchr (line, '=') + 1); |
|
1069 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1070 |
|
DIR_COLOR.red = red; |
|
1071 |
|
DIR_COLOR.green = green; |
|
1072 |
|
DIR_COLOR.blue = blue; |
|
1073 |
|
} |
|
1074 |
|
|
|
1075 |
|
if (strstr (line, "DEV_COLOR")) |
|
1076 |
|
{ |
|
1077 |
|
unsigned int red, green, blue; |
|
1078 |
|
|
|
1079 |
|
value = (strchr (line, '=') + 1); |
|
1080 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1081 |
|
DEV_COLOR.red = red; |
|
1082 |
|
DEV_COLOR.green = green; |
|
1083 |
|
DEV_COLOR.blue = blue; |
|
1084 |
|
} |
|
1085 |
|
|
|
1086 |
|
if (strstr (line, "EXE_COLOR")) |
|
1087 |
|
{ |
|
1088 |
|
unsigned int red, green, blue; |
|
1089 |
|
|
|
1090 |
|
value = (strchr (line, '=') + 1); |
|
1091 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1092 |
|
EXE_COLOR.red = red; |
|
1093 |
|
EXE_COLOR.green = green; |
|
1094 |
|
EXE_COLOR.blue = blue; |
|
1095 |
|
} |
|
1096 |
|
|
|
1097 |
|
if (strstr (line, "LNK_COLOR")) |
|
1098 |
|
{ |
|
1099 |
|
unsigned int red, green, blue; |
|
1100 |
|
|
|
1101 |
|
value = (strchr (line, '=') + 1); |
|
1102 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1103 |
|
LNK_COLOR.red = red; |
|
1104 |
|
LNK_COLOR.green = green; |
|
1105 |
|
LNK_COLOR.blue = blue; |
|
1106 |
|
} |
|
1107 |
|
|
|
1108 |
|
if (strstr (line, "SOCK_COLOR")) |
|
1109 |
|
{ |
|
1110 |
|
unsigned int red, green, blue; |
|
1111 |
|
|
|
1112 |
|
value = (strchr (line, '=') + 1); |
|
1113 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1114 |
|
SOCK_COLOR.red = red; |
|
1115 |
|
SOCK_COLOR.green = green; |
|
1116 |
|
SOCK_COLOR.blue = blue; |
|
1117 |
|
} |
|
1118 |
|
|
|
1119 |
|
if (strstr (line, "TAG_COLOR")) |
|
1120 |
|
{ |
|
1121 |
|
unsigned int red, green, blue; |
|
1122 |
|
|
|
1123 |
|
value = (strchr (line, '=') + 1); |
|
1124 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1125 |
|
TAG_COLOR.red = red; |
|
1126 |
|
TAG_COLOR.green = green; |
|
1127 |
|
TAG_COLOR.blue = blue; |
|
1128 |
|
} |
|
1129 |
|
if (strstr (line, "TAB_COLOR")) |
|
1130 |
|
{ |
|
1131 |
|
unsigned int red, green, blue; |
|
1132 |
|
|
|
1133 |
|
value = (strchr (line, '=') + 1); |
|
1134 |
|
sscanf (value, "%04X,%04X,%04X", &red, &green, &blue); |
|
1135 |
|
TAB_COLOR.red = red; |
|
1136 |
|
TAB_COLOR.green = green; |
|
1137 |
|
TAB_COLOR.blue = blue; |
|
1138 |
|
} |
|
1139 |
|
if(strstr(line, "ZVT_COLOR")) |
|
1140 |
|
{ |
|
1141 |
|
unsigned int red, green, blue; |
|
1142 |
|
int i; |
|
1143 |
|
|
|
1144 |
|
value = (strchr(line, '=') +1); |
|
1145 |
|
sscanf(value, "%d,%04X,%04X,%04X", &i, &red, &green, &blue); |
|
1146 |
|
zvt.palette[i].red = red; |
|
1147 |
|
zvt.palette[i].green = green; |
|
1148 |
|
zvt.palette[i].blue = blue; |
|
1149 |
|
} |
|
1150 |
|
if(strstr(line, "MAN_PROGRAM")) |
|
1151 |
|
{ |
|
1152 |
|
value = (strchr(line, '=') +1); |
|
1153 |
|
strncpy (cfg.man_program, value, sizeof (cfg.man_program)); |
|
1154 |
|
} |
|
1155 |
|
|
|
1156 |
|
} |
|
1157 |
|
fclose (f); |
|
1158 |
|
|
|
1159 |
|
if (stat (config_file, &stat_buf) != 0) |
|
1160 |
|
fprintf (stderr, "Unable to stat config file.. this is wierd\n"); |
|
1161 |
|
else |
|
1162 |
|
cfg.config_mtime = stat_buf.st_mtime; |
|
1163 |
|
|
|
1164 |
|
return TRUE; |
|
1165 |
|
} |
|
1166 |
|
|
| File src/filelist.c added (mode: 100644) (index 0000000..19067d7) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
#include <stdio.h> |
|
21 |
|
#include <stdlib.h> |
|
22 |
|
#include <string.h> |
|
23 |
|
#include <sys/time.h> |
|
24 |
|
//#include <sys/types.h> |
|
25 |
|
#include <sys/stat.h> |
|
26 |
|
#include <regex.h> |
|
27 |
|
#include <dirent.h> |
|
28 |
|
//#include <pwd.h> |
|
29 |
|
//#include <grp.h> |
|
30 |
|
#include <unistd.h> |
|
31 |
|
#include "vide.h" |
|
32 |
|
|
|
33 |
|
typedef struct |
|
34 |
|
{ |
|
35 |
|
gchar path[PATH_MAX]; |
|
36 |
|
gint row; |
|
37 |
|
} |
|
38 |
|
DirHistoryEntry; |
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
static GList * |
|
43 |
|
history_find (GList * list, gchar * path) |
|
44 |
|
{ |
|
45 |
|
GList *tmp; |
|
46 |
|
DirHistoryEntry *entry; |
|
47 |
|
|
|
48 |
|
for (tmp = list; tmp != NULL; tmp = tmp->next) |
|
49 |
|
{ |
|
50 |
|
entry = tmp->data; |
|
51 |
|
if (STREQ (entry->path, path)) |
|
52 |
|
return tmp; |
|
53 |
|
} |
|
54 |
|
return NULL; |
|
55 |
|
} |
|
56 |
|
|
|
57 |
|
void |
|
58 |
|
get_perm_string (gchar * buf, gint len, mode_t mode) |
|
59 |
|
{ |
|
60 |
|
gchar *perm_sets[] = |
|
61 |
|
{ "---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx" }; |
|
62 |
|
gint u, g, o; |
|
63 |
|
|
|
64 |
|
u = (mode & S_IRWXU) >> 6; |
|
65 |
|
g = (mode & S_IRWXG) >> 3; |
|
66 |
|
o = (mode & S_IRWXO); |
|
67 |
|
|
|
68 |
|
g_snprintf (buf, len, "-%s%s%s", perm_sets[u], perm_sets[g], perm_sets[o]); |
|
69 |
|
|
|
70 |
|
if (S_ISLNK (mode)) |
|
71 |
|
buf[0] = 'l'; |
|
72 |
|
else if (S_ISDIR (mode)) |
|
73 |
|
buf[0] = 'd'; |
|
74 |
|
else if (S_ISBLK (mode)) |
|
75 |
|
buf[0] = 'b'; |
|
76 |
|
else if (S_ISCHR (mode)) |
|
77 |
|
buf[0] = 'c'; |
|
78 |
|
else if (S_ISFIFO (mode)) |
|
79 |
|
buf[0] = 'f'; |
|
80 |
|
else if (S_ISSOCK (mode)) |
|
81 |
|
buf[0] = 's'; |
|
82 |
|
|
|
83 |
|
if (mode & S_ISVTX) |
|
84 |
|
buf[9] = (buf[9] == '-') ? 'T' : 't'; |
|
85 |
|
if (mode & S_ISGID) |
|
86 |
|
buf[6] = (buf[6] == '-') ? 'S' : 's'; |
|
87 |
|
if (mode & S_ISUID) |
|
88 |
|
buf[3] = (buf[3] == '-') ? 'S' : 's'; |
|
89 |
|
} |
|
90 |
|
|
|
91 |
|
gint is_dir (FileInfo * info) |
|
92 |
|
{ |
|
93 |
|
if (S_ISDIR (info->statbuf.st_mode)) |
|
94 |
|
return 1; |
|
95 |
|
if (S_ISLNK (info->statbuf.st_mode)) |
|
96 |
|
{ |
|
97 |
|
struct stat statbuf; |
|
98 |
|
stat (info->filename, &statbuf); |
|
99 |
|
if (S_ISDIR (statbuf.st_mode)) |
|
100 |
|
return 1; |
|
101 |
|
} |
|
102 |
|
|
|
103 |
|
return 0; |
|
104 |
|
} |
|
105 |
|
|
|
106 |
|
void |
|
107 |
|
change_dir (FileView * view, gchar * path) |
|
108 |
|
{ |
|
109 |
|
GList *tmp; |
|
110 |
|
History history; |
|
111 |
|
gint list_length = 0; |
|
112 |
|
static gint i = 0; |
|
113 |
|
|
|
114 |
|
/* change the cursor to stop watch for a large directory */ |
|
115 |
|
|
|
116 |
|
|
|
117 |
|
if (access (path, F_OK) != 0) |
|
118 |
|
{ |
|
119 |
|
status_bar_message ("That directory does not exist"); |
|
120 |
|
return; |
|
121 |
|
} |
|
122 |
|
if (access (path, R_OK) != 0) |
|
123 |
|
{ |
|
124 |
|
status_bar_message ("You do not have read access on that directory"); |
|
125 |
|
return; |
|
126 |
|
} |
|
127 |
|
if (chdir (path)) |
|
128 |
|
{ |
|
129 |
|
status_errno (); |
|
130 |
|
return; |
|
131 |
|
} |
|
132 |
|
|
|
133 |
|
g_snprintf(history.dir, sizeof(history.dir), view->dir); |
|
134 |
|
view->menu_history = g_list_prepend(view->menu_history, |
|
135 |
|
duplicate(&history, sizeof(History))); |
|
136 |
|
if((list_length = g_list_length(view->menu_history)) > 10) |
|
137 |
|
view->menu_history = g_list_remove_link(view->menu_history, |
|
138 |
|
g_list_last(view->menu_history)); |
|
139 |
|
/* Keeps the startup dir from being listed twice */ |
|
140 |
|
if(i < 2) |
|
141 |
|
{ |
|
142 |
|
view->menu_history = g_list_remove_link(view->menu_history, |
|
143 |
|
g_list_last(view->menu_history)); |
|
144 |
|
i++; |
|
145 |
|
} |
|
146 |
|
|
|
147 |
|
|
|
148 |
|
strncpy(view->last_dir, view->dir, PATH_MAX); |
|
149 |
|
view->last_row = view->row; |
|
150 |
|
/* Save the last row before we reload the list */ |
|
151 |
|
tmp = history_find (view->dir_history, view->dir); |
|
152 |
|
if (tmp != NULL) |
|
153 |
|
{ |
|
154 |
|
DirHistoryEntry *entry = tmp->data; |
|
155 |
|
entry->row = view->row; |
|
156 |
|
} |
|
157 |
|
getcwd (view->dir, PATH_MAX); |
|
158 |
|
load_dir_list (view); |
|
159 |
|
|
|
160 |
|
tmp = history_find(view->dir_history, view->dir); |
|
161 |
|
if (tmp != NULL) |
|
162 |
|
{ |
|
163 |
|
DirHistoryEntry *entry = tmp->data; |
|
164 |
|
|
|
165 |
|
if(entry->row <= (GTK_CLIST(view->clist)->rows)) |
|
166 |
|
{ |
|
167 |
|
focus_on_row(view, entry->row); |
|
168 |
|
} |
|
169 |
|
else |
|
170 |
|
{ |
|
171 |
|
focus_on_row(view, 0); |
|
172 |
|
} |
|
173 |
|
view->dir_history = g_list_remove_link (view->dir_history, tmp); |
|
174 |
|
view->dir_history = g_list_prepend (view->dir_history, entry); |
|
175 |
|
g_list_free(tmp); |
|
176 |
|
} |
|
177 |
|
else |
|
178 |
|
{ |
|
179 |
|
DirHistoryEntry entry; |
|
180 |
|
|
|
181 |
|
gtk_clist_select_row(GTK_CLIST(view->clist), 0, 0); |
|
182 |
|
gtk_widget_grab_focus(view->clist); |
|
183 |
|
strncpy (entry.path, view->dir, sizeof (entry.path)); |
|
184 |
|
entry.row = 0; |
|
185 |
|
|
|
186 |
|
view->dir_history = |
|
187 |
|
g_list_prepend (view->dir_history, |
|
188 |
|
duplicate (&entry, sizeof (DirHistoryEntry))); |
|
189 |
|
if (g_list_length (view->dir_history) > cfg.dir_history_max_length) |
|
190 |
|
{ |
|
191 |
|
tmp = g_list_nth (view->dir_history, cfg.dir_history_max_length); |
|
192 |
|
view->dir_history = g_list_remove_link (view->dir_history, tmp); |
|
193 |
|
g_list_free (tmp); |
|
194 |
|
} |
|
195 |
|
focus_on_row(view, 0); |
|
196 |
|
} |
|
197 |
|
|
|
198 |
|
} |
|
199 |
|
|
|
200 |
|
gint name_sort (GtkCList * clist, gconstpointer row1, gconstpointer row2) |
|
201 |
|
{ |
|
202 |
|
FileInfo *info1, *info2; |
|
203 |
|
|
|
204 |
|
info1 = ((GtkCListRow *) row1)->data; |
|
205 |
|
info2 = ((GtkCListRow *) row2)->data; |
|
206 |
|
|
|
207 |
|
if (STREQ (info1->filename, "../")) |
|
208 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
209 |
|
if (STREQ (info2->filename, "../")) |
|
210 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
211 |
|
|
|
212 |
|
if (is_dir (info1)) |
|
213 |
|
{ |
|
214 |
|
if (is_dir (info2)) |
|
215 |
|
return strcmp (info1->filename, info2->filename); |
|
216 |
|
else |
|
217 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
218 |
|
} |
|
219 |
|
|
|
220 |
|
if (is_dir (info2)) |
|
221 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
222 |
|
|
|
223 |
|
return strcmp (info1->filename, info2->filename); |
|
224 |
|
} |
|
225 |
|
|
|
226 |
|
gint size_sort (GtkCList * clist, gconstpointer row1, gconstpointer row2) |
|
227 |
|
{ |
|
228 |
|
FileInfo *info1, *info2; |
|
229 |
|
|
|
230 |
|
info1 = ((GtkCListRow *) row1)->data; |
|
231 |
|
info2 = ((GtkCListRow *) row2)->data; |
|
232 |
|
|
|
233 |
|
if (STREQ (info1->filename, "../")) |
|
234 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
235 |
|
if (STREQ (info2->filename, "../")) |
|
236 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
237 |
|
|
|
238 |
|
if (is_dir (info1)) |
|
239 |
|
{ |
|
240 |
|
if (is_dir (info2)) |
|
241 |
|
return (info1->statbuf.st_size - info2->statbuf.st_size); |
|
242 |
|
else |
|
243 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
244 |
|
} |
|
245 |
|
|
|
246 |
|
if (is_dir (info2)) |
|
247 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
248 |
|
|
|
249 |
|
return (info1->statbuf.st_size - info2->statbuf.st_size); |
|
250 |
|
} |
|
251 |
|
|
|
252 |
|
gint date_sort (GtkCList * clist, gconstpointer row1, gconstpointer row2) |
|
253 |
|
{ |
|
254 |
|
FileInfo *info1, *info2; |
|
255 |
|
|
|
256 |
|
info1 = ((GtkCListRow *) row1)->data; |
|
257 |
|
info2 = ((GtkCListRow *) row2)->data; |
|
258 |
|
|
|
259 |
|
if (STREQ (info1->filename, "../")) |
|
260 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
261 |
|
if (STREQ (info2->filename, "../")) |
|
262 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
263 |
|
|
|
264 |
|
if (is_dir (info1)) |
|
265 |
|
{ |
|
266 |
|
if (is_dir (info2)) |
|
267 |
|
return (info1->statbuf.st_mtime - info2->statbuf.st_mtime); |
|
268 |
|
else |
|
269 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
270 |
|
} |
|
271 |
|
|
|
272 |
|
if (is_dir (info2)) |
|
273 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
274 |
|
|
|
275 |
|
return (info1->statbuf.st_mtime - info2->statbuf.st_mtime); |
|
276 |
|
} |
|
277 |
|
|
|
278 |
|
gint perm_sort (GtkCList * clist, gconstpointer row1, gconstpointer row2) |
|
279 |
|
{ |
|
280 |
|
FileInfo *info1, *info2; |
|
281 |
|
|
|
282 |
|
info1 = ((GtkCListRow *) row1)->data; |
|
283 |
|
info2 = ((GtkCListRow *) row2)->data; |
|
284 |
|
|
|
285 |
|
if (STREQ (info1->filename, "../")) |
|
286 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
287 |
|
if (STREQ (info2->filename, "../")) |
|
288 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
289 |
|
|
|
290 |
|
if (is_dir (info1)) |
|
291 |
|
{ |
|
292 |
|
if (is_dir (info2)) |
|
293 |
|
return (info1->statbuf.st_mode - info2->statbuf.st_mode); |
|
294 |
|
else |
|
295 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
296 |
|
} |
|
297 |
|
|
|
298 |
|
if (is_dir (info2)) |
|
299 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
300 |
|
|
|
301 |
|
return (info1->statbuf.st_mode - info2->statbuf.st_mode); |
|
302 |
|
} |
|
303 |
|
|
|
304 |
|
gint user_sort (GtkCList * clist, gconstpointer row1, gconstpointer row2) |
|
305 |
|
{ |
|
306 |
|
FileInfo *info1, *info2; |
|
307 |
|
|
|
308 |
|
info1 = ((GtkCListRow *) row1)->data; |
|
309 |
|
info2 = ((GtkCListRow *) row2)->data; |
|
310 |
|
|
|
311 |
|
if (STREQ (info1->filename, "../")) |
|
312 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
313 |
|
if (STREQ (info2->filename, "../")) |
|
314 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
315 |
|
|
|
316 |
|
if (is_dir (info1)) |
|
317 |
|
{ |
|
318 |
|
if (is_dir (info2)) |
|
319 |
|
return (info1->statbuf.st_uid - info2->statbuf.st_uid); |
|
320 |
|
else |
|
321 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
322 |
|
} |
|
323 |
|
|
|
324 |
|
if (is_dir (info2)) |
|
325 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
326 |
|
|
|
327 |
|
return (info1->statbuf.st_uid - info2->statbuf.st_uid); |
|
328 |
|
} |
|
329 |
|
|
|
330 |
|
gint group_sort (GtkCList * clist, gconstpointer row1, gconstpointer row2) |
|
331 |
|
{ |
|
332 |
|
FileInfo *info1, *info2; |
|
333 |
|
|
|
334 |
|
info1 = ((GtkCListRow *) row1)->data; |
|
335 |
|
info2 = ((GtkCListRow *) row2)->data; |
|
336 |
|
|
|
337 |
|
if (STREQ (info1->filename, "../")) |
|
338 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
339 |
|
if (STREQ (info2->filename, "../")) |
|
340 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
341 |
|
|
|
342 |
|
if (is_dir (info1)) |
|
343 |
|
{ |
|
344 |
|
if (is_dir (info2)) |
|
345 |
|
return (info1->statbuf.st_gid - info2->statbuf.st_gid); |
|
346 |
|
else |
|
347 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? -1 : 1); |
|
348 |
|
} |
|
349 |
|
|
|
350 |
|
if (is_dir (info2)) |
|
351 |
|
return (clist->sort_type == GTK_SORT_ASCENDING ? 1 : -1); |
|
352 |
|
|
|
353 |
|
return (info1->statbuf.st_gid - info2->statbuf.st_gid); |
|
354 |
|
} |
|
355 |
|
|
|
356 |
|
void |
|
357 |
|
sort_list (FileView * view, |
|
358 |
|
GtkCListCompareFunc compare_func, GtkSortType direction, gint col) |
|
359 |
|
{ |
|
360 |
|
gtk_widget_hide (view->sort_arrows[GTK_CLIST (view->clist)->sort_column]); |
|
361 |
|
gtk_widget_show (view->sort_arrows[col]); |
|
362 |
|
gtk_arrow_set (GTK_ARROW (view->sort_arrows[col]), |
|
363 |
|
(direction == GTK_SORT_ASCENDING |
|
364 |
|
? GTK_ARROW_DOWN : GTK_ARROW_UP), GTK_SHADOW_IN); |
|
365 |
|
|
|
366 |
|
gtk_clist_set_compare_func (GTK_CLIST (view->clist), compare_func); |
|
367 |
|
gtk_clist_set_sort_type (GTK_CLIST (view->clist), direction); |
|
368 |
|
gtk_clist_set_sort_column (GTK_CLIST (view->clist), col); |
|
369 |
|
gtk_clist_sort (GTK_CLIST (view->clist)); |
|
370 |
|
} |
|
371 |
|
|
|
372 |
|
void |
|
373 |
|
focus_on_row (FileView * view, gint row) |
|
374 |
|
{ |
|
375 |
|
gtk_clist_freeze (GTK_CLIST (view->clist)); |
|
376 |
|
gtk_clist_unselect_all (GTK_CLIST (view->clist)); |
|
377 |
|
if(gtk_clist_get_selectable(GTK_CLIST(view->clist), row)) |
|
378 |
|
{ |
|
379 |
|
gtk_clist_select_row (GTK_CLIST (view->clist), row, 0); |
|
380 |
|
GTK_CLIST (view->clist)->focus_row = row; |
|
381 |
|
gtk_widget_draw_focus (view->clist); |
|
382 |
|
gtk_clist_moveto (GTK_CLIST (view->clist), row, 0, 0.5, 0.0); |
|
383 |
|
} |
|
384 |
|
else |
|
385 |
|
{ |
|
386 |
|
gtk_clist_select_row(GTK_CLIST(view->clist), 0, 0); |
|
387 |
|
GTK_CLIST (view->clist)->focus_row = 0; |
|
388 |
|
gtk_widget_draw_focus (view->clist); |
|
389 |
|
gtk_clist_moveto (GTK_CLIST (view->clist), 0, 0, 0.5, 0.0); |
|
390 |
|
} |
|
391 |
|
gtk_clist_thaw (GTK_CLIST (view->clist)); |
|
392 |
|
show_file_properties(); |
|
393 |
|
} |
|
394 |
|
|
|
395 |
|
void |
|
396 |
|
goto_row (GtkWidget * clist, gint row) |
|
397 |
|
{ |
|
398 |
|
gtk_clist_freeze (GTK_CLIST (clist)); |
|
399 |
|
gtk_clist_unselect_all (GTK_CLIST (clist)); |
|
400 |
|
gtk_clist_select_row (GTK_CLIST (clist), row, 0); |
|
401 |
|
GTK_CLIST (clist)->focus_row = row; |
|
402 |
|
gtk_clist_moveto (GTK_CLIST (clist), row, 0, 0.5, 0.0); |
|
403 |
|
gtk_clist_thaw (GTK_CLIST (clist)); |
|
404 |
|
} |
|
405 |
|
|
|
406 |
|
void |
|
407 |
|
set_filter_menu_active (FileView * view) |
|
408 |
|
{ |
|
409 |
|
/* |
|
410 |
|
GtkStyle *style = gtk_style_new (); |
|
411 |
|
GdkColor red; |
|
412 |
|
|
|
413 |
|
gdk_color_parse ("red", &red); |
|
414 |
|
style->fg[GTK_STATE_NORMAL] = red; |
|
415 |
|
style->fg[GTK_STATE_PRELIGHT] = red; |
|
416 |
|
|
|
417 |
|
gtk_widget_set_style (GTK_MENU_ITEM (view->filter_menu_item)->item.bin. |
|
418 |
|
child, style); |
|
419 |
|
*/ |
|
420 |
|
} |
|
421 |
|
|
|
422 |
|
void |
|
423 |
|
remove_filters (FileView * view) |
|
424 |
|
{ |
|
425 |
|
view->filename_filter.active = FALSE; |
|
426 |
|
view->size_filter.active = FALSE; |
|
427 |
|
view->date_filter.active = FALSE; |
|
428 |
|
|
|
429 |
|
refresh_list (view); |
|
430 |
|
} |
|
431 |
|
|
|
432 |
|
void |
|
433 |
|
initialize_filters (FileView * view) |
|
434 |
|
{ |
|
435 |
|
view->filter_directories = FALSE; |
|
436 |
|
|
|
437 |
|
view->filename_filter.active = TRUE; |
|
438 |
|
view->filename_filter.invert_mask = cfg.invert_filter; |
|
439 |
|
strncpy (view->filename_filter.pattern, cfg.start_filter, |
|
440 |
|
sizeof (view->filename_filter.pattern)); |
|
441 |
|
|
|
442 |
|
view->size_filter.active = FALSE; |
|
443 |
|
view->size_filter.size = 0; |
|
444 |
|
view->size_filter.op = GT; |
|
445 |
|
|
|
446 |
|
view->date_filter.active = FALSE; |
|
447 |
|
view->date_filter.time = time (NULL); |
|
448 |
|
view->date_filter.time_type = ATIME; |
|
449 |
|
view->date_filter.op = GT; |
|
450 |
|
} |
|
451 |
|
|
|
452 |
|
|
|
453 |
|
static gboolean |
|
454 |
|
match_filename_filter (FileView * view, FileInfo * info) |
|
455 |
|
{ |
|
456 |
|
gchar *pattern, *free_this; |
|
457 |
|
regex_t re; |
|
458 |
|
|
|
459 |
|
if(is_dir(info) && !view->filter_directories) |
|
460 |
|
return TRUE; |
|
461 |
|
|
|
462 |
|
free_this = pattern = strdup(view->filename_filter.pattern); |
|
463 |
|
|
|
464 |
|
if(regcomp(&re, pattern, REG_EXTENDED) == 0) |
|
465 |
|
{ |
|
466 |
|
if(regexec(&re, info->filename, 0, NULL, 0) == 0) |
|
467 |
|
{ |
|
468 |
|
free(free_this); |
|
469 |
|
regfree(&re); |
|
470 |
|
return !view->filename_filter.invert_mask; |
|
471 |
|
} |
|
472 |
|
|
|
473 |
|
free(free_this); |
|
474 |
|
regfree(&re); |
|
475 |
|
return view->filename_filter.invert_mask; |
|
476 |
|
} |
|
477 |
|
regfree(&re); |
|
478 |
|
|
|
479 |
|
return TRUE; |
|
480 |
|
|
|
481 |
|
/* glob matching instead of regular expression |
|
482 |
|
gchar *s, *pattern, *free_this; |
|
483 |
|
gboolean result; |
|
484 |
|
|
|
485 |
|
if (is_dir (info) && !view->filter_directories) |
|
486 |
|
return TRUE; |
|
487 |
|
|
|
488 |
|
free_this = pattern = strdup (view->filename_filter.pattern); |
|
489 |
|
while ((s = strchr (pattern, ',')) != NULL) |
|
490 |
|
{ |
|
491 |
|
*s = '\0'; |
|
492 |
|
if (gtk_pattern_match_simple (pattern, info->filename)) |
|
493 |
|
{ |
|
494 |
|
free (free_this); |
|
495 |
|
return !view->filename_filter.invert_mask; |
|
496 |
|
} |
|
497 |
|
pattern = s + 1; |
|
498 |
|
} |
|
499 |
|
|
|
500 |
|
result = gtk_pattern_match_simple (pattern, info->filename); |
|
501 |
|
free (free_this); |
|
502 |
|
return (view->filename_filter.invert_mask ? !result : result); |
|
503 |
|
*/ |
|
504 |
|
} |
|
505 |
|
|
|
506 |
|
static gboolean |
|
507 |
|
match_size_filter (FileView * view, FileInfo * info) |
|
508 |
|
{ |
|
509 |
|
if (is_dir (info) && !view->filter_directories) |
|
510 |
|
return TRUE; |
|
511 |
|
|
|
512 |
|
switch (view->size_filter.op) |
|
513 |
|
{ |
|
514 |
|
case GT: |
|
515 |
|
return (info->statbuf.st_size > view->size_filter.size); |
|
516 |
|
break; |
|
517 |
|
case LT: |
|
518 |
|
return (info->statbuf.st_size < view->size_filter.size); |
|
519 |
|
break; |
|
520 |
|
case EQ: |
|
521 |
|
return (info->statbuf.st_size == view->size_filter.size); |
|
522 |
|
break; |
|
523 |
|
default: |
|
524 |
|
return TRUE; |
|
525 |
|
} |
|
526 |
|
|
|
527 |
|
/* this can never happen */ |
|
528 |
|
return TRUE; |
|
529 |
|
} |
|
530 |
|
|
|
531 |
|
static gboolean |
|
532 |
|
match_date_filter (FileView * view, FileInfo * info) |
|
533 |
|
{ |
|
534 |
|
if (is_dir (info) && !view->filter_directories) |
|
535 |
|
return TRUE; |
|
536 |
|
|
|
537 |
|
switch (view->date_filter.time_type) |
|
538 |
|
{ |
|
539 |
|
case ATIME: |
|
540 |
|
if (view->date_filter.op == GT) |
|
541 |
|
return (difftime (view->date_filter.time, info->statbuf.st_atime) < |
|
542 |
|
0); |
|
543 |
|
else |
|
544 |
|
return (difftime (view->date_filter.time, info->statbuf.st_atime) > |
|
545 |
|
0); |
|
546 |
|
break; |
|
547 |
|
case MTIME: |
|
548 |
|
if (view->date_filter.op == GT) |
|
549 |
|
return (difftime (view->date_filter.time, info->statbuf.st_mtime) < |
|
550 |
|
0); |
|
551 |
|
else |
|
552 |
|
return (difftime (view->date_filter.time, info->statbuf.st_mtime) > |
|
553 |
|
0); |
|
554 |
|
break; |
|
555 |
|
case CTIME: |
|
556 |
|
if (view->date_filter.op == GT) |
|
557 |
|
return (difftime (view->date_filter.time, info->statbuf.st_ctime) < |
|
558 |
|
0); |
|
559 |
|
else |
|
560 |
|
return (difftime (view->date_filter.time, info->statbuf.st_ctime) > |
|
561 |
|
0); |
|
562 |
|
break; |
|
563 |
|
default: |
|
564 |
|
return TRUE; |
|
565 |
|
} |
|
566 |
|
|
|
567 |
|
/* this cant happen */ |
|
568 |
|
return TRUE; |
|
569 |
|
} |
|
570 |
|
|
|
571 |
|
/* NOTE: This function will cause curr_view and other_view to switch if */ |
|
572 |
|
/* curr_view isn't the view passed in */ |
|
573 |
|
void |
|
574 |
|
refresh_list (FileView * view) |
|
575 |
|
{ |
|
576 |
|
GtkAdjustment *vadj; |
|
577 |
|
gfloat scrollbar_pos; |
|
578 |
|
gint last_selected_row; |
|
579 |
|
|
|
580 |
|
g_return_if_fail (view != NULL); |
|
581 |
|
|
|
582 |
|
vadj = gtk_clist_get_vadjustment (GTK_CLIST (view->clist)); |
|
583 |
|
scrollbar_pos = vadj->value; |
|
584 |
|
last_selected_row = view->row; |
|
585 |
|
|
|
586 |
|
gtk_clist_freeze (GTK_CLIST (view->clist)); |
|
587 |
|
load_dir_list (view); |
|
588 |
|
/* gtk_adjustment_set_value (GTK_ADJUSTMENT (vadj), scrollbar_pos); |
|
589 |
|
focus_on_row (view, |
|
590 |
|
(last_selected_row < GTK_CLIST (view->clist)->rows |
|
591 |
|
? last_selected_row : GTK_CLIST (view->clist)->rows - 1));*/ |
|
592 |
|
gtk_clist_thaw (GTK_CLIST (view->clist)); |
|
593 |
|
} |
|
594 |
|
|
|
595 |
|
/* NOTE: This function will cause curr_view and other_view to switch if */ |
|
596 |
|
/* curr_view isn't the view passed in */ |
|
597 |
|
void |
|
598 |
|
load_dir_list (FileView * view) |
|
599 |
|
{ |
|
600 |
|
DIR *dp; |
|
601 |
|
struct dirent *entry; |
|
602 |
|
struct stat stat_buf; |
|
603 |
|
FileInfo info; |
|
604 |
|
|
|
605 |
|
|
|
606 |
|
g_return_if_fail (view != NULL); |
|
607 |
|
|
|
608 |
|
|
|
609 |
|
stat (view->dir, &stat_buf); |
|
610 |
|
|
|
611 |
|
|
|
612 |
|
if ((dp = opendir (view->dir)) == NULL) |
|
613 |
|
{ |
|
614 |
|
g_snprintf(view->dir, sizeof(view->dir), "%s", getenv("HOME")); |
|
615 |
|
fprintf (stderr, "Error opening directory going home now.\n"); |
|
616 |
|
create_error_dialog("Error opening directory going home now.\n"); |
|
617 |
|
return; |
|
618 |
|
} |
|
619 |
|
view->dir_mtime = stat_buf.st_mtime; |
|
620 |
|
|
|
621 |
|
gtk_clist_freeze (GTK_CLIST (view->clist)); |
|
622 |
|
gtk_clist_unselect_all (GTK_CLIST (view->clist)); |
|
623 |
|
gtk_clist_clear (GTK_CLIST (view->clist)); |
|
624 |
|
|
|
625 |
|
chdir (view->dir); |
|
626 |
|
while ((entry = readdir (dp)) != NULL) |
|
627 |
|
{ |
|
628 |
|
FileInfo *this_info; |
|
629 |
|
struct tm *tm_ptr; |
|
630 |
|
gchar size_buf[20]; |
|
631 |
|
gchar modified_buf[25]; |
|
632 |
|
gchar accessed_buf[25]; |
|
633 |
|
gchar changed_buf[25]; |
|
634 |
|
gchar perm_buf[11]; |
|
635 |
|
gchar uid_buf[20]; |
|
636 |
|
gchar gid_buf[20]; |
|
637 |
|
gchar *buf[MAX_COLUMNS]; |
|
638 |
|
int row; |
|
639 |
|
|
|
640 |
|
if (STREQ (entry->d_name, ".")) |
|
641 |
|
continue; |
|
642 |
|
if (((entry->d_name[0] == '.') && (!STREQ (entry->d_name, ".."))) |
|
643 |
|
&& !cfg.show_hidden) |
|
644 |
|
continue; |
|
645 |
|
lstat (entry->d_name, &(info.statbuf)); |
|
646 |
|
strncpy (info.filename, entry->d_name, sizeof (info.filename)); |
|
647 |
|
if (is_dir (&info)) |
|
648 |
|
strcat (info.filename, "/"); |
|
649 |
|
|
|
650 |
|
if (view->filename_filter.active |
|
651 |
|
&& !match_filename_filter (view, &info)) |
|
652 |
|
continue; |
|
653 |
|
if (view->size_filter.active && !match_size_filter (view, &info)) |
|
654 |
|
continue; |
|
655 |
|
if (view->date_filter.active && !match_date_filter (view, &info)) |
|
656 |
|
continue; |
|
657 |
|
|
|
658 |
|
this_info = duplicate (&info, sizeof (FileInfo)); |
|
659 |
|
|
|
660 |
|
buf[0] = this_info->filename; |
|
661 |
|
|
|
662 |
|
describe_file_size(size_buf, sizeof(size_buf), this_info); |
|
663 |
|
buf[1] = size_buf; |
|
664 |
|
|
|
665 |
|
tm_ptr = localtime (&(this_info->statbuf.st_mtime)); |
|
666 |
|
strftime (modified_buf, sizeof (modified_buf), "%b %d %H:%M", tm_ptr); |
|
667 |
|
buf[2] = modified_buf; |
|
668 |
|
|
|
669 |
|
tm_ptr = localtime (&(this_info->statbuf.st_atime)); |
|
670 |
|
strftime (accessed_buf, sizeof (accessed_buf), "%b %d %H:%M", tm_ptr); |
|
671 |
|
buf[3] = accessed_buf; |
|
672 |
|
|
|
673 |
|
tm_ptr = localtime (&(this_info->statbuf.st_ctime)); |
|
674 |
|
strftime (changed_buf, sizeof (changed_buf), "%b %d %H:%M", tm_ptr); |
|
675 |
|
buf[4] = changed_buf; |
|
676 |
|
|
|
677 |
|
get_perm_string (perm_buf, sizeof (perm_buf), |
|
678 |
|
this_info->statbuf.st_mode); |
|
679 |
|
buf[5] = perm_buf; |
|
680 |
|
|
|
681 |
|
describe_user_id(uid_buf, sizeof(uid_buf), this_info); |
|
682 |
|
buf[6] = uid_buf; |
|
683 |
|
|
|
684 |
|
describe_group_id(gid_buf, sizeof(gid_buf), this_info); |
|
685 |
|
buf[7] = gid_buf; |
|
686 |
|
|
|
687 |
|
|
|
688 |
|
row = gtk_clist_append (GTK_CLIST (view->clist), buf); |
|
689 |
|
gtk_clist_set_row_data_full (GTK_CLIST (view->clist), row, |
|
690 |
|
this_info, free_clist_row_data); |
|
691 |
|
switch (this_info->statbuf.st_mode & S_IFMT) |
|
692 |
|
{ |
|
693 |
|
case S_IFLNK: |
|
694 |
|
gtk_clist_set_foreground (GTK_CLIST (view->clist), row, &LNK_COLOR); |
|
695 |
|
break; |
|
696 |
|
case S_IFDIR: |
|
697 |
|
gtk_clist_set_foreground (GTK_CLIST (view->clist), row, &DIR_COLOR); |
|
698 |
|
break; |
|
699 |
|
case S_IFCHR: |
|
700 |
|
case S_IFBLK: |
|
701 |
|
gtk_clist_set_foreground (GTK_CLIST (view->clist), row, &DEV_COLOR); |
|
702 |
|
break; |
|
703 |
|
case S_IFSOCK: |
|
704 |
|
gtk_clist_set_foreground (GTK_CLIST (view->clist), row, |
|
705 |
|
&SOCK_COLOR); |
|
706 |
|
break; |
|
707 |
|
case S_IFREG: |
|
708 |
|
if (S_ISEXE (this_info->statbuf.st_mode)) |
|
709 |
|
gtk_clist_set_foreground (GTK_CLIST (view->clist), row, |
|
710 |
|
&EXE_COLOR); |
|
711 |
|
break; |
|
712 |
|
default: |
|
713 |
|
break; |
|
714 |
|
} |
|
715 |
|
} |
|
716 |
|
closedir (dp); |
|
717 |
|
|
|
718 |
|
gtk_clist_sort (GTK_CLIST (view->clist)); |
|
719 |
|
gtk_label_set_text(GTK_LABEL(view->dir_label), view->dir); |
|
720 |
|
gtk_clist_thaw (GTK_CLIST (view->clist)); |
|
721 |
|
|
|
722 |
|
g_list_free (view->tagged); |
|
723 |
|
view->tagged = NULL; |
|
724 |
|
} |
|
725 |
|
|
|
726 |
|
|
|
727 |
|
static void |
|
728 |
|
view_file (gchar * filename) |
|
729 |
|
{ |
|
730 |
|
gchar command[2 * NAME_MAX]; |
|
731 |
|
|
|
732 |
|
g_return_if_fail (filename != NULL); |
|
733 |
|
/* |
|
734 |
|
if(cfg.use_vi_server) |
|
735 |
|
{ |
|
736 |
|
start_vi_server(filename); |
|
737 |
|
return; |
|
738 |
|
} |
|
739 |
|
if(cfg.use_vimclient) |
|
740 |
|
{ |
|
741 |
|
call_vimclient(filename); |
|
742 |
|
return; |
|
743 |
|
} |
|
744 |
|
*/ |
|
745 |
|
|
|
746 |
|
g_snprintf(command, sizeof(command), "%s \"%s\"", cfg.vi_command, filename); |
|
747 |
|
create_zterm(command, TRUE); |
|
748 |
|
} |
|
749 |
|
|
|
750 |
|
void |
|
751 |
|
exec_action (gchar * action) |
|
752 |
|
{ |
|
753 |
|
FileInfo *info; |
|
754 |
|
GString *command; |
|
755 |
|
|
|
756 |
|
g_return_if_fail (action != NULL); |
|
757 |
|
|
|
758 |
|
if (strchr (action, '%') == NULL) |
|
759 |
|
{ |
|
760 |
|
GList *tmp, *base; |
|
761 |
|
tmp = get_selection (curr_view); |
|
762 |
|
g_return_if_fail (tmp != NULL); |
|
763 |
|
base = tmp; |
|
764 |
|
|
|
765 |
|
command = g_string_sized_new (MAX_LEN); |
|
766 |
|
g_string_assign (command, action); |
|
767 |
|
|
|
768 |
|
for (; tmp != NULL; tmp = tmp->next) |
|
769 |
|
{ |
|
770 |
|
info = tmp->data; |
|
771 |
|
g_string_sprintfa (command, " \"%s\"", info->filename); |
|
772 |
|
} |
|
773 |
|
if (strncmp (command->str, "x ", 2) == 0) |
|
774 |
|
{ |
|
775 |
|
create_zterm(command->str + 2, TRUE); |
|
776 |
|
} |
|
777 |
|
else if(strncmp(command->str, "vi ", 3) == 0) |
|
778 |
|
{ |
|
779 |
|
gchar buf[1024]; |
|
780 |
|
g_snprintf(buf, sizeof(buf), "%s \"%s\"", cfg.vi_command, info->filename); |
|
781 |
|
create_zterm(buf, TRUE); |
|
782 |
|
} |
|
783 |
|
else |
|
784 |
|
file_exec (command->str); |
|
785 |
|
g_list_free (base); |
|
786 |
|
g_string_free (command, TRUE); |
|
787 |
|
} |
|
788 |
|
else |
|
789 |
|
{ |
|
790 |
|
if ((command = expand_macros (action)) != NULL) |
|
791 |
|
{ |
|
792 |
|
if (strncmp (command->str, "x ", 2) == 0) |
|
793 |
|
create_zterm(command->str + 2, TRUE); |
|
794 |
|
else |
|
795 |
|
file_exec (command->str); |
|
796 |
|
g_string_free (command, TRUE); |
|
797 |
|
} |
|
798 |
|
} |
|
799 |
|
} |
|
800 |
|
|
|
801 |
|
void |
|
802 |
|
handle_file (FileView * view) |
|
803 |
|
{ |
|
804 |
|
FileInfo *info; |
|
805 |
|
gchar *ext, *program; |
|
806 |
|
/* |
|
807 |
|
gchar buf[PATH_MAX]; |
|
808 |
|
*/ |
|
809 |
|
|
|
810 |
|
|
|
811 |
|
g_return_if_fail (view != NULL); |
|
812 |
|
if (view->tagged != NULL) |
|
813 |
|
info = view->tagged->data; |
|
814 |
|
else |
|
815 |
|
info = gtk_clist_get_row_data (GTK_CLIST (view->clist), view->row); |
|
816 |
|
g_return_if_fail (info != NULL); |
|
817 |
|
|
|
818 |
|
|
|
819 |
|
if (is_dir (info)) |
|
820 |
|
{ |
|
821 |
|
gchar path[PATH_MAX]; |
|
822 |
|
|
|
823 |
|
|
|
824 |
|
if (strcmp (info->filename, "../") == 0) |
|
825 |
|
{ |
|
826 |
|
change_dir(view, ".."); |
|
827 |
|
return; |
|
828 |
|
} |
|
829 |
|
g_snprintf (path, sizeof (path), "%s/%s", view->dir, info->filename); |
|
830 |
|
change_dir (view, path); |
|
831 |
|
return; |
|
832 |
|
} |
|
833 |
|
|
|
834 |
|
ext = strchr (info->filename, '.'); |
|
835 |
|
if (ext == NULL) /* no extension */ |
|
836 |
|
{ |
|
837 |
|
if (S_ISEXE (info->statbuf.st_mode)) |
|
838 |
|
{ |
|
839 |
|
gchar command_line[NAME_MAX + 2]; |
|
840 |
|
g_snprintf (command_line, sizeof (command_line), "./%s", |
|
841 |
|
info->filename); |
|
842 |
|
file_exec (command_line); |
|
843 |
|
return; |
|
844 |
|
} |
|
845 |
|
else |
|
846 |
|
{ |
|
847 |
|
view_file(info->filename); |
|
848 |
|
return; |
|
849 |
|
} |
|
850 |
|
} |
|
851 |
|
|
|
852 |
|
if (ext == info->filename) /* its a dot file */ |
|
853 |
|
{ |
|
854 |
|
view_file (info->filename); |
|
855 |
|
return; |
|
856 |
|
} |
|
857 |
|
|
|
858 |
|
/* the file has an extension */ |
|
859 |
|
do |
|
860 |
|
{ |
|
861 |
|
ext++; /* get rid of the . prefix */ |
|
862 |
|
program = get_default_program_for_ext (ext); |
|
863 |
|
if(program == NULL) |
|
864 |
|
{ |
|
865 |
|
view_file(info->filename); |
|
866 |
|
free(program); |
|
867 |
|
return; |
|
868 |
|
} |
|
869 |
|
if (program != NULL) |
|
870 |
|
{ |
|
871 |
|
exec_action (program); |
|
872 |
|
free (program); |
|
873 |
|
return; |
|
874 |
|
} |
|
875 |
|
} |
|
876 |
|
while ((ext = strchr (ext, '.')) != NULL); |
|
877 |
|
|
|
878 |
|
/* Didn't find any matching extensions */ |
|
879 |
|
ext = strrchr (info->filename, '.') + 1; |
|
880 |
|
ext = str_to_lower (ext); |
|
881 |
|
|
|
882 |
|
/* use vi as default on all files */ |
|
883 |
|
/* that don't have a specific file type */ |
|
884 |
|
view_file (info->filename); |
|
885 |
|
|
|
886 |
|
free (ext); |
|
887 |
|
} |
| File src/term.c added (mode: 100644) (index 0000000..773d505) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. vim600:fdm=marker |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
#include <stdio.h> |
|
20 |
|
#include <unistd.h> |
|
21 |
|
#include <fcntl.h> |
|
22 |
|
#include <sys/time.h> |
|
23 |
|
#include <sys/types.h> |
|
24 |
|
#include <unistd.h> |
|
25 |
|
#include <errno.h> |
|
26 |
|
#include <string.h> |
|
27 |
|
#include <pwd.h> |
|
28 |
|
#include <stdlib.h> |
|
29 |
|
#include <signal.h> |
|
30 |
|
#include "vide.h" |
|
31 |
|
|
|
32 |
|
#include <gtk/gtk.h> |
|
33 |
|
#include <gdk/gdkx.h> |
|
34 |
|
#include <gdk/gdkprivate.h> |
|
35 |
|
#include <gdk/gdkkeysyms.h> |
|
36 |
|
#include<gnome.h> |
|
37 |
|
#include <zvt/vt.h> |
|
38 |
|
#include<X11/Xatom.h> |
|
39 |
|
|
|
40 |
|
|
|
41 |
|
static void |
|
42 |
|
term_key_cb(GtkWidget *widget, GdkEventKey *event, ZvtTerm *term); |
|
43 |
|
|
|
44 |
|
void |
|
45 |
|
write_to_term(ZvtTerm *term, gchar *message) |
|
46 |
|
{ |
|
47 |
|
write(term->vx->vt.keyfd, message, strlen(message)); |
|
48 |
|
} |
|
49 |
|
|
|
50 |
|
void |
|
51 |
|
write_to_all_vi_terms(gchar *message) |
|
52 |
|
{ |
|
53 |
|
ZvtTerm *term; |
|
54 |
|
gchar buf[NAME_MAX]; |
|
55 |
|
gint page = cfg.term_count; |
|
56 |
|
|
|
57 |
|
/* Write to the last page in the notebook. If it is a |
|
58 |
|
* quit command the page numbers will change otherwise |
|
59 |
|
*/ |
|
60 |
|
|
|
61 |
|
if(!page) |
|
62 |
|
return; |
|
63 |
|
|
|
64 |
|
while((term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page))) |
|
65 |
|
{ |
|
66 |
|
if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(term)))) |
|
67 |
|
{ |
|
68 |
|
g_snprintf(buf, sizeof(buf), "%c\r", GDK_Escape); |
|
69 |
|
write_to_term(term, buf); |
|
70 |
|
write_to_term(term, message); |
|
71 |
|
} |
|
72 |
|
page--; |
|
73 |
|
if(page < 1) |
|
74 |
|
break; |
|
75 |
|
} |
|
76 |
|
} |
|
77 |
|
|
|
78 |
|
|
|
79 |
|
/* Common terminal colors from the Gnome-terminal {{{ */ |
|
80 |
|
gushort linux_red[] = { 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa, |
|
81 |
|
0x5555, 0xffff, 0x5555, 0xffff, 0x5555, 0xffff, 0x5555, 0xffff, |
|
82 |
|
0x0, 0x0 }; |
|
83 |
|
gushort linux_grn[] = { 0x0000, 0x0000, 0xaaaa, 0x5555, 0x0000, 0x0000, 0xaaaa, 0xaaaa, |
|
84 |
|
0x5555, 0x5555, 0xffff, 0xffff, 0x5555, 0x5555, 0xffff, 0xffff, |
|
85 |
|
0x0, 0x0 }; |
|
86 |
|
gushort linux_blu[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, |
|
87 |
|
0x5555, 0x5555, 0x5555, 0x5555, 0xffff, 0xffff, 0xffff, 0xffff, |
|
88 |
|
0x0, 0x0 }; |
|
89 |
|
|
|
90 |
|
gushort xterm_red[] = { 0x0000, 0x6767, 0x0000, 0x6767, 0x0000, 0x6767, 0x0000, 0x6868, |
|
91 |
|
0x2a2a, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, |
|
92 |
|
0x0, 0x0 }; |
|
93 |
|
|
|
94 |
|
gushort xterm_grn[] = { 0x0000, 0x0000, 0x6767, 0x6767, 0x0000, 0x0000, 0x6767, 0x6868, |
|
95 |
|
0x2a2a, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, |
|
96 |
|
0x0, 0x0 }; |
|
97 |
|
gushort xterm_blu[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x6767, 0x6767, 0x6767, 0x6868, |
|
98 |
|
0x2a2a, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, |
|
99 |
|
0x0, 0x0 }; |
|
100 |
|
|
|
101 |
|
gushort rxvt_red[] = { 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, |
|
102 |
|
0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, |
|
103 |
|
0x0, 0x0 }; |
|
104 |
|
gushort rxvt_grn[] = { 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, |
|
105 |
|
0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, |
|
106 |
|
0x0, 0x0 }; |
|
107 |
|
gushort rxvt_blu[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, |
|
108 |
|
0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, |
|
109 |
|
0x0, 0x0 }; |
|
110 |
|
|
|
111 |
|
gushort *scheme_red[] = { linux_red, xterm_red, rxvt_red, rxvt_red }; |
|
112 |
|
gushort *scheme_blu[] = { linux_blu, xterm_blu, rxvt_blu, rxvt_blu }; |
|
113 |
|
gushort *scheme_grn[] = { linux_grn, xterm_grn, rxvt_grn, rxvt_grn }; |
|
114 |
|
|
|
115 |
|
|
|
116 |
|
static void |
|
117 |
|
set_color_scheme(ZvtTerm *term) |
|
118 |
|
{ |
|
119 |
|
GdkColor c; |
|
120 |
|
gushort red[18], green[18], blue[18]; |
|
121 |
|
int i; |
|
122 |
|
gushort *r = NULL; |
|
123 |
|
gushort *b = NULL; |
|
124 |
|
gushort *g = NULL; |
|
125 |
|
gint scheme = 0; |
|
126 |
|
|
|
127 |
|
if(!strcmp(zvt.term_color, "Linux")) |
|
128 |
|
{ |
|
129 |
|
r = scheme_red[0]; |
|
130 |
|
g = scheme_grn[0]; |
|
131 |
|
b = scheme_blu[0]; |
|
132 |
|
scheme = 1; |
|
133 |
|
} |
|
134 |
|
if(!strcmp(zvt.term_color, "Xterm")) |
|
135 |
|
{ |
|
136 |
|
r = scheme_red[1]; |
|
137 |
|
g = scheme_grn[1]; |
|
138 |
|
b = scheme_blu[1]; |
|
139 |
|
scheme = 1; |
|
140 |
|
} |
|
141 |
|
if(!strcmp(zvt.term_color, "Rxvt")) |
|
142 |
|
{ |
|
143 |
|
r = scheme_red[2]; |
|
144 |
|
g = scheme_grn[2]; |
|
145 |
|
b = scheme_blu[2]; |
|
146 |
|
scheme = 1; |
|
147 |
|
} |
|
148 |
|
if(!strcmp(zvt.term_color, "Custom")) |
|
149 |
|
{ |
|
150 |
|
for(i = 0; i < 18; i++) |
|
151 |
|
{ |
|
152 |
|
red[i] = zvt.palette[i].red; |
|
153 |
|
green[i] = zvt.palette[i].green; |
|
154 |
|
blue[i] = zvt.palette[i].blue; |
|
155 |
|
} |
|
156 |
|
scheme = 0; |
|
157 |
|
} |
|
158 |
|
|
|
159 |
|
if(scheme) |
|
160 |
|
{ |
|
161 |
|
for(i = 0; i < 18; i++) |
|
162 |
|
{ |
|
163 |
|
red[i] = r[i]; |
|
164 |
|
green[i] = g[i]; |
|
165 |
|
blue[i] = b[i]; |
|
166 |
|
} |
|
167 |
|
} |
|
168 |
|
if(!strcmp(zvt.background, "WhiteOnBlack")) |
|
169 |
|
{ |
|
170 |
|
red[16] = red[7]; |
|
171 |
|
blue[16] = blue[7]; |
|
172 |
|
green[16] = green[7]; |
|
173 |
|
red[17] = red[0]; |
|
174 |
|
blue[17] = blue[0]; |
|
175 |
|
green[17] = green[0]; |
|
176 |
|
} |
|
177 |
|
if(!strcmp(zvt.background, "BlackOnWhite")) |
|
178 |
|
{ |
|
179 |
|
red[16] = red[0]; |
|
180 |
|
blue[16] = blue[0]; |
|
181 |
|
green[16] = green[0]; |
|
182 |
|
red[17] = red[7]; |
|
183 |
|
blue[17] = blue[7]; |
|
184 |
|
green[17] = green[7]; |
|
185 |
|
} |
|
186 |
|
if(!strcmp(zvt.background, "GreenOnBlack")) |
|
187 |
|
{ |
|
188 |
|
red[17] = 0; |
|
189 |
|
blue[17] = 0; |
|
190 |
|
green[17] = 0; |
|
191 |
|
red[16] = 0; |
|
192 |
|
blue[16] = 0; |
|
193 |
|
green[16] = 0xffff; |
|
194 |
|
} |
|
195 |
|
if(!strcmp(zvt.background, "CustomBack")) |
|
196 |
|
{ |
|
197 |
|
for(i = 16; i < 18; i++) |
|
198 |
|
{ |
|
199 |
|
red[i] = zvt.palette[i].red; |
|
200 |
|
green[i] = zvt.palette[i].green; |
|
201 |
|
blue[i] = zvt.palette[i].blue; |
|
202 |
|
} |
|
203 |
|
} |
|
204 |
|
|
|
205 |
|
|
|
206 |
|
zvt_term_set_color_scheme((ZvtTerm *)term, red, green, blue); |
|
207 |
|
c.pixel = term->colors[17]; |
|
208 |
|
gdk_window_set_background(GTK_WIDGET(term)->window, &c); |
|
209 |
|
gtk_widget_queue_draw(GTK_WIDGET(term)); |
|
210 |
|
} |
|
211 |
|
|
|
212 |
|
/* }}} just a marker for vim6.0 folding text*/ |
|
213 |
|
|
|
214 |
|
ZvtTerm * |
|
215 |
|
get_focus_zvt(GtkNotebook *notebook, gint page_number) |
|
216 |
|
{ |
|
217 |
|
GList *child, *tmp; |
|
218 |
|
GtkWidget *ch; |
|
219 |
|
GtkWidget *vbox = NULL; |
|
220 |
|
gint focus_term; |
|
221 |
|
|
|
222 |
|
vbox = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_number); |
|
223 |
|
if(!vbox) |
|
224 |
|
return NULL; |
|
225 |
|
|
|
226 |
|
child = GTK_BOX(vbox)->children; |
|
227 |
|
focus_term = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox), |
|
228 |
|
"focus_term")); |
|
229 |
|
|
|
230 |
|
for(tmp = child; tmp != NULL; tmp = tmp->next) |
|
231 |
|
{ |
|
232 |
|
ch = ((GtkBoxChild*)(tmp->data))->widget; |
|
233 |
|
|
|
234 |
|
if(ZVT_IS_TERM(ch)) |
|
235 |
|
{ |
|
236 |
|
gint term_number = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(ch), |
|
237 |
|
"term_number")); |
|
238 |
|
if(term_number == focus_term) |
|
239 |
|
{ |
|
240 |
|
return ZVT_TERM(ch); |
|
241 |
|
} |
|
242 |
|
} |
|
243 |
|
} |
|
244 |
|
return NULL; |
|
245 |
|
|
|
246 |
|
|
|
247 |
|
} |
|
248 |
|
|
|
249 |
|
ZvtTerm * |
|
250 |
|
get_nth_zvt(GtkNotebook *notebook, gint n) |
|
251 |
|
{ |
|
252 |
|
GList *child, *tmp; |
|
253 |
|
GtkWidget *ch; |
|
254 |
|
GtkWidget *vbox = NULL; |
|
255 |
|
|
|
256 |
|
vbox = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), n); |
|
257 |
|
if(!vbox) |
|
258 |
|
return NULL; |
|
259 |
|
|
|
260 |
|
child = GTK_BOX(vbox)->children; |
|
261 |
|
|
|
262 |
|
for(tmp = child; tmp != NULL; tmp = tmp->next) |
|
263 |
|
{ |
|
264 |
|
ch = ((GtkBoxChild*)(tmp->data))->widget; |
|
265 |
|
|
|
266 |
|
if(ZVT_IS_TERM(ch)) |
|
267 |
|
return ZVT_TERM(ch); |
|
268 |
|
} |
|
269 |
|
return NULL; |
|
270 |
|
} |
|
271 |
|
|
|
272 |
|
void UpdateTerm (ZvtTerm * term) |
|
273 |
|
{ |
|
274 |
|
if(zvt.use_pixmap) |
|
275 |
|
{ |
|
276 |
|
zvt_term_set_background(ZVT_TERM(term), zvt.pixmap, |
|
277 |
|
zvt.transparent, ZVT_BACKGROUND_SHADED); |
|
278 |
|
} |
|
279 |
|
else if(zvt.transparent) |
|
280 |
|
{ |
|
281 |
|
zvt_term_set_background(term, NULL, zvt.transparent, 0); |
|
282 |
|
} |
|
283 |
|
else |
|
284 |
|
zvt_term_set_background(ZVT_TERM(term), NULL, 0, 0); |
|
285 |
|
|
|
286 |
|
zvt_term_set_font_name(ZVT_TERM (term), zvt.term_font); |
|
287 |
|
zvt_term_set_scrollback(ZVT_TERM (term), zvt.scroll_lines); |
|
288 |
|
zvt_term_set_blink (ZVT_TERM (term), zvt.use_blinking_cursor); |
|
289 |
|
zvt_term_set_bell (ZVT_TERM (term), zvt.terminal_bell); |
|
290 |
|
|
|
291 |
|
set_color_scheme (ZVT_TERM(term)); |
|
292 |
|
|
|
293 |
|
|
|
294 |
|
zvt_term_set_scroll_on_keystroke (ZVT_TERM (term), zvt.scroll_on_keystroke); |
|
295 |
|
zvt_term_set_scroll_on_output (ZVT_TERM (term), zvt.scroll_on_output); |
|
296 |
|
|
|
297 |
|
gtk_widget_queue_draw (GTK_WIDGET(term)); |
|
298 |
|
} |
|
299 |
|
|
|
300 |
|
void update_all_terms() |
|
301 |
|
{ |
|
302 |
|
ZvtTerm * ch; |
|
303 |
|
int a=1; |
|
304 |
|
|
|
305 |
|
while ((ch = get_nth_zvt(GTK_NOTEBOOK(app.notebook),a))) |
|
306 |
|
{ |
|
307 |
|
UpdateTerm (ZVT_TERM(ch)); |
|
308 |
|
a++; |
|
309 |
|
} |
|
310 |
|
|
|
311 |
|
} |
|
312 |
|
|
|
313 |
|
static void |
|
314 |
|
child_died_event (ZvtTerm *term, GtkWidget *vbox) |
|
315 |
|
{ |
|
316 |
|
gint page; |
|
317 |
|
ZvtTerm *tmp_term; |
|
318 |
|
GtkWidget *label; |
|
319 |
|
gint term_count; |
|
320 |
|
|
|
321 |
|
|
|
322 |
|
term_count = (GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox), |
|
323 |
|
"term_count")) -1); |
|
324 |
|
if(term_count) |
|
325 |
|
{ |
|
326 |
|
GList *child, *tmp; |
|
327 |
|
ZvtTerm *tmp_term; |
|
328 |
|
GtkWidget *ch; |
|
329 |
|
GtkWidget *page_label; |
|
330 |
|
GtkWidget *term_label; |
|
331 |
|
gchar *label_text; |
|
332 |
|
gchar buf[NAME_MAX]; |
|
333 |
|
gint term_number = 0; |
|
334 |
|
GtkWidget *menubar = gtk_object_get_data(GTK_OBJECT(term), "menubar"); |
|
335 |
|
|
|
336 |
|
gtk_widget_destroy(menubar); |
|
337 |
|
|
|
338 |
|
gtk_widget_hide(GTK_WIDGET(term)); |
|
339 |
|
|
|
340 |
|
zvt_term_closepty(term); |
|
341 |
|
gtk_widget_destroy(GTK_WIDGET(term)); |
|
342 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "term_count", |
|
343 |
|
GUINT_TO_POINTER(term_count)); |
|
344 |
|
page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)); |
|
345 |
|
child = GTK_BOX(vbox)->children; |
|
346 |
|
|
|
347 |
|
for(tmp = child; tmp != NULL; tmp = tmp->next) |
|
348 |
|
{ |
|
349 |
|
ch = ((GtkBoxChild*)(tmp->data))->widget; |
|
350 |
|
if(ZVT_IS_TERM(ch)) |
|
351 |
|
{ |
|
352 |
|
term_number++; |
|
353 |
|
gtk_object_set_data(GTK_OBJECT(ch), "term_number", |
|
354 |
|
GUINT_TO_POINTER(term_number)); |
|
355 |
|
} |
|
356 |
|
} |
|
357 |
|
/* set focus_term and notebook tab */ |
|
358 |
|
|
|
359 |
|
tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page); |
|
360 |
|
term_number = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(tmp_term), |
|
361 |
|
"term_number")); |
|
362 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", |
|
363 |
|
GUINT_TO_POINTER(term_number)); |
|
364 |
|
cfg.current_term = tmp_term; |
|
365 |
|
term_label = gtk_object_get_data(GTK_OBJECT(tmp_term), |
|
366 |
|
"term_label"); |
|
367 |
|
page_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
368 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), |
|
369 |
|
gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)))); |
|
370 |
|
gtk_label_get(GTK_LABEL(term_label), &label_text); |
|
371 |
|
g_snprintf(buf, sizeof(buf), "%d %s", |
|
372 |
|
gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) +1, |
|
373 |
|
label_text); |
|
374 |
|
gtk_label_set_text(GTK_LABEL(page_label), buf); |
|
375 |
|
|
|
376 |
|
|
|
377 |
|
gtk_widget_grab_focus(GTK_WIDGET(tmp_term)); |
|
378 |
|
|
|
379 |
|
} |
|
380 |
|
else |
|
381 |
|
{ |
|
382 |
|
gtk_widget_hide(GTK_WIDGET(term)); |
|
383 |
|
gtk_container_remove(GTK_CONTAINER(app.notebook), |
|
384 |
|
GTK_WIDGET(term)->parent); |
|
385 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), -1); |
|
386 |
|
page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)); |
|
387 |
|
|
|
388 |
|
if(page == 0) |
|
389 |
|
{ |
|
390 |
|
cfg.term_count = 0; |
|
391 |
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app.notebook), zvt.show_tabs); |
|
392 |
|
cfg.current_term = NULL; |
|
393 |
|
} |
|
394 |
|
else |
|
395 |
|
{ |
|
396 |
|
if(cfg.current_term == term) |
|
397 |
|
cfg.current_term = NULL; |
|
398 |
|
cfg.term_count--; |
|
399 |
|
} |
|
400 |
|
|
|
401 |
|
zvt_term_closepty(term); |
|
402 |
|
/* reset the notebook tabs and vi buffer list */ |
|
403 |
|
page = 1; |
|
404 |
|
while((tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page))) |
|
405 |
|
{ |
|
406 |
|
gchar *title; |
|
407 |
|
gchar *text; |
|
408 |
|
gchar buf[128]; |
|
409 |
|
|
|
410 |
|
if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(tmp_term)))) |
|
411 |
|
{ |
|
412 |
|
label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
413 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), page)); |
|
414 |
|
gtk_label_get(GTK_LABEL(label), &text); |
|
415 |
|
title = strstr(text, " ") + 1; |
|
416 |
|
if(page + 1 == 10) |
|
417 |
|
g_snprintf(buf, sizeof(buf), "%d %s", 0, title); |
|
418 |
|
else |
|
419 |
|
g_snprintf(buf, sizeof(buf), "%d %s", page + 1, title); |
|
420 |
|
gtk_label_set_text(GTK_LABEL(label), buf); |
|
421 |
|
if(cfg.current_term == NULL) |
|
422 |
|
cfg.current_term = tmp_term; |
|
423 |
|
} |
|
424 |
|
else |
|
425 |
|
{ |
|
426 |
|
label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
427 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), page)); |
|
428 |
|
gtk_label_get(GTK_LABEL(label), &text); |
|
429 |
|
title = strstr(text, " ") +1; |
|
430 |
|
if(page + 1 == 10) |
|
431 |
|
g_snprintf(buf, sizeof(buf), "%d %s", 0, title); |
|
432 |
|
else |
|
433 |
|
{ |
|
434 |
|
g_snprintf(buf, sizeof(buf), "%d %s", page +1, title); |
|
435 |
|
} |
|
436 |
|
gtk_label_set_text(GTK_LABEL(label), buf); |
|
437 |
|
} |
|
438 |
|
page++; |
|
439 |
|
} |
|
440 |
|
|
|
441 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), 0); |
|
442 |
|
gtk_widget_grab_focus(GTK_WIDGET(curr_view->clist)); |
|
443 |
|
} |
|
444 |
|
} |
|
445 |
|
|
|
446 |
|
static void |
|
447 |
|
switch_term_key_cb(GtkWidget *widget, GdkEventKey *event, ZvtTerm *term) |
|
448 |
|
{ |
|
449 |
|
GtkWidget *vbox; |
|
450 |
|
guint key_press_signal; |
|
451 |
|
gint term_count; |
|
452 |
|
gint curr_number; |
|
453 |
|
gint next_term = -1; |
|
454 |
|
|
|
455 |
|
vbox = gtk_object_get_data(GTK_OBJECT(term), "vbox"); |
|
456 |
|
term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox), "term_count")); |
|
457 |
|
if(term_count > 1) |
|
458 |
|
{ |
|
459 |
|
curr_number = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term), |
|
460 |
|
"term_number")); |
|
461 |
|
switch(event->keyval) |
|
462 |
|
{ |
|
463 |
|
case 'j': |
|
464 |
|
next_term = curr_number -1; |
|
465 |
|
break; |
|
466 |
|
case 'k': |
|
467 |
|
next_term = curr_number +1; |
|
468 |
|
break; |
|
469 |
|
default: |
|
470 |
|
break; |
|
471 |
|
} |
|
472 |
|
if((next_term > 0) & (next_term <= term_count)) |
|
473 |
|
{ |
|
474 |
|
GList *child, *tmp; |
|
475 |
|
GtkWidget *ch; |
|
476 |
|
gint tmp_num = -2; |
|
477 |
|
|
|
478 |
|
child = GTK_BOX(vbox)->children; |
|
479 |
|
for(tmp = child; tmp != NULL; tmp = tmp->next) |
|
480 |
|
{ |
|
481 |
|
ch = ((GtkBoxChild*)(tmp->data))->widget; |
|
482 |
|
if(ZVT_IS_TERM(ch)) |
|
483 |
|
tmp_num = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(ch), |
|
484 |
|
"term_number")); |
|
485 |
|
if(tmp_num == next_term) |
|
486 |
|
{ |
|
487 |
|
GtkWidget *term_label; |
|
488 |
|
GtkWidget *page_label; |
|
489 |
|
gchar buf[NAME_MAX]; |
|
490 |
|
gchar *label_text; |
|
491 |
|
|
|
492 |
|
gint term_number = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(ch), |
|
493 |
|
"term_number")); |
|
494 |
|
term_label = gtk_object_get_data(GTK_OBJECT(ch), |
|
495 |
|
"term_label"); |
|
496 |
|
page_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
497 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), |
|
498 |
|
gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)))); |
|
499 |
|
gtk_label_get(GTK_LABEL(term_label), &label_text); |
|
500 |
|
g_snprintf(buf, sizeof(buf), "%d %s", |
|
501 |
|
gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) + 1, |
|
502 |
|
label_text); |
|
503 |
|
gtk_label_set_text(GTK_LABEL(page_label), buf); |
|
504 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", |
|
505 |
|
GUINT_TO_POINTER(term_number)); |
|
506 |
|
cfg.current_term = (ZvtTerm *)ch; |
|
507 |
|
gtk_widget_grab_focus(GTK_WIDGET(ch)); |
|
508 |
|
break; |
|
509 |
|
} |
|
510 |
|
} |
|
511 |
|
} |
|
512 |
|
} |
|
513 |
|
switch(event->keyval) |
|
514 |
|
{ |
|
515 |
|
case 'n': |
|
516 |
|
create_zterm("sh", FALSE); |
|
517 |
|
break; |
|
518 |
|
case 'm': |
|
519 |
|
{ |
|
520 |
|
gchar buf[256]; |
|
521 |
|
gchar * word = zvt_term_get_buffer(term, NULL, VT_SELTYPE_WORD, |
|
522 |
|
term->vx->vt.cursorx, term->vx->vt.cursory, |
|
523 |
|
term->vx->vt.cursorx, term->vx->vt.cursory); |
|
524 |
|
g_snprintf(buf, sizeof(buf), "%s %s", cfg.man_program, word); |
|
525 |
|
create_zterm(buf, FALSE); |
|
526 |
|
/* |
|
527 |
|
g_print("cursorx is %d\n", term->vx->vt.cursorx); |
|
528 |
|
g_print("cursory is %d\n", term->vx->vt.cursory); |
|
529 |
|
g_print("word under cursor is %s\n", word); |
|
530 |
|
*/ |
|
531 |
|
g_free(word); |
|
532 |
|
} |
|
533 |
|
break; |
|
534 |
|
default: |
|
535 |
|
break; |
|
536 |
|
} |
|
537 |
|
|
|
538 |
|
|
|
539 |
|
gtk_signal_emit_stop_by_name(GTK_OBJECT(term), "key_press_event"); |
|
540 |
|
key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term), |
|
541 |
|
"signal_key_id")); |
|
542 |
|
gtk_signal_disconnect(GTK_OBJECT(term), key_press_signal); |
|
543 |
|
key_press_signal = gtk_signal_connect(GTK_OBJECT(term), "key_press_event", |
|
544 |
|
GTK_SIGNAL_FUNC(term_key_cb), term); |
|
545 |
|
gtk_object_set_data(GTK_OBJECT(term), "signal_key_id", |
|
546 |
|
GUINT_TO_POINTER(key_press_signal)); |
|
547 |
|
|
|
548 |
|
|
|
549 |
|
} |
|
550 |
|
|
|
551 |
|
static void |
|
552 |
|
switch_terms(ZvtTerm *term) |
|
553 |
|
{ |
|
554 |
|
guint key_press_signal; |
|
555 |
|
|
|
556 |
|
key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term), |
|
557 |
|
"signal_key_id")); |
|
558 |
|
gtk_signal_disconnect(GTK_OBJECT(term), key_press_signal); |
|
559 |
|
key_press_signal = gtk_signal_connect(GTK_OBJECT(term), "key_press_event", |
|
560 |
|
GTK_SIGNAL_FUNC(switch_term_key_cb), term); |
|
561 |
|
gtk_object_set_data(GTK_OBJECT(term), "signal_key_id", |
|
562 |
|
GUINT_TO_POINTER(key_press_signal)); |
|
563 |
|
} |
|
564 |
|
|
|
565 |
|
static void |
|
566 |
|
term_key_cb(GtkWidget *widget, GdkEventKey *event, ZvtTerm *term) |
|
567 |
|
{ |
|
568 |
|
|
|
569 |
|
if(event->state & GDK_CONTROL_MASK) |
|
570 |
|
{ |
|
571 |
|
if((event->keyval >= '0') & (event->keyval <= '9')) |
|
572 |
|
{ |
|
573 |
|
ZvtTerm *new_term; |
|
574 |
|
int page = event->keyval; |
|
575 |
|
|
|
576 |
|
|
|
577 |
|
if(page == '0') |
|
578 |
|
{ |
|
579 |
|
page = 9; |
|
580 |
|
if((new_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page))) |
|
581 |
|
cfg.current_term = new_term; |
|
582 |
|
} |
|
583 |
|
else |
|
584 |
|
{ |
|
585 |
|
page = page - 49; |
|
586 |
|
} |
|
587 |
|
|
|
588 |
|
gtk_signal_emit_stop_by_name(GTK_OBJECT(term), "key_press_event"); |
|
589 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), page); |
|
590 |
|
|
|
591 |
|
if(page != 0) |
|
592 |
|
{ |
|
593 |
|
new_term = get_focus_zvt(GTK_NOTEBOOK(app.notebook), page); |
|
594 |
|
cfg.current_term = new_term; |
|
595 |
|
gtk_widget_grab_focus(GTK_WIDGET(new_term)); |
|
596 |
|
} |
|
597 |
|
} |
|
598 |
|
|
|
599 |
|
} |
|
600 |
|
if(event->state & GDK_MOD1_MASK) |
|
601 |
|
{ |
|
602 |
|
GtkWidget *tools_menu = gtk_object_get_data(GTK_OBJECT(term), "tools_menu"); |
|
603 |
|
GtkWidget *vide_menu = gtk_object_get_data(GTK_OBJECT(term), "vide_menu"); |
|
604 |
|
|
|
605 |
|
|
|
606 |
|
if(vide_menu == NULL) |
|
607 |
|
return; |
|
608 |
|
|
|
609 |
|
switch(event->keyval) |
|
610 |
|
{ |
|
611 |
|
case 't': |
|
612 |
|
gtk_signal_emit_by_name(GTK_OBJECT(tools_menu), "activate-item"); |
|
613 |
|
break; |
|
614 |
|
case 'v': |
|
615 |
|
case 'V': |
|
616 |
|
gtk_signal_emit_by_name(GTK_OBJECT(vide_menu), "activate-item"); |
|
617 |
|
break; |
|
618 |
|
case 'w': |
|
619 |
|
case 'W': |
|
620 |
|
switch_terms(term); |
|
621 |
|
break; |
|
622 |
|
default: |
|
623 |
|
break; |
|
624 |
|
} |
|
625 |
|
gtk_signal_emit_stop_by_name(GTK_OBJECT(term), "key_press_event"); |
|
626 |
|
} |
|
627 |
|
} |
|
628 |
|
|
|
629 |
|
|
|
630 |
|
static void |
|
631 |
|
title_changed_event (ZvtTerm *term, VTTITLE_TYPE type, char *newtitle) |
|
632 |
|
{ |
|
633 |
|
GtkWidget *label; |
|
634 |
|
GtkWidget *term_label; |
|
635 |
|
gint page; |
|
636 |
|
gchar buf[512]; |
|
637 |
|
|
|
638 |
|
|
|
639 |
|
term_label = gtk_object_get_data(GTK_OBJECT(term), "term_label"); |
|
640 |
|
page = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term), |
|
641 |
|
"page_number")); |
|
642 |
|
gtk_label_set_text(GTK_LABEL(term_label), newtitle); |
|
643 |
|
|
|
644 |
|
label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
645 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), page)); |
|
646 |
|
page++; |
|
647 |
|
if(page == 10) |
|
648 |
|
page = 0; |
|
649 |
|
|
|
650 |
|
g_snprintf(buf, sizeof(buf), "%d %s", page, newtitle); |
|
651 |
|
gtk_label_set(GTK_LABEL(label), buf); |
|
652 |
|
|
|
653 |
|
} |
|
654 |
|
|
|
655 |
|
|
|
656 |
|
|
|
657 |
|
|
|
658 |
|
gint |
|
659 |
|
create_zterm (gchar *command, gboolean new_page) |
|
660 |
|
{ |
|
661 |
|
gint i, cmdindex, login_shell; |
|
662 |
|
char **p; |
|
663 |
|
struct passwd *pw; |
|
664 |
|
gchar buffer[40]; |
|
665 |
|
GtkWidget *vbox = NULL; |
|
666 |
|
GtkWidget *menubar; |
|
667 |
|
ZvtTerm *term; |
|
668 |
|
gchar buf[NAME_MAX]; |
|
669 |
|
gchar term_label[NAME_MAX]; |
|
670 |
|
gint page = 1; |
|
671 |
|
guint key_press_signal; |
|
672 |
|
guint child_died_signal_id; |
|
673 |
|
guint title_change_signal; |
|
674 |
|
|
|
675 |
|
extern char **environ; |
|
676 |
|
static char **env; |
|
677 |
|
static char **env_copy; |
|
678 |
|
static int winid_pos; |
|
679 |
|
|
|
680 |
|
|
|
681 |
|
login_shell = 0; |
|
682 |
|
cmdindex = 0; |
|
683 |
|
|
|
684 |
|
signal(SIGHUP, SIG_IGN); |
|
685 |
|
|
|
686 |
|
|
|
687 |
|
|
|
688 |
|
|
|
689 |
|
/* Create widgets and set options */ |
|
690 |
|
page = cfg.term_count +2; |
|
691 |
|
if(page == 10) |
|
692 |
|
page = 0; |
|
693 |
|
|
|
694 |
|
if(!strncmp(command, cfg.vi_command, strlen(cfg.vi_command))) |
|
695 |
|
{ |
|
696 |
|
gchar *command_copy = command; |
|
697 |
|
command_copy+=strlen(cfg.vi_command); |
|
698 |
|
g_snprintf(buf, sizeof(buf), "%d %s", page, command_copy); |
|
699 |
|
g_snprintf(term_label, sizeof(term_label), "%s", command_copy); |
|
700 |
|
} |
|
701 |
|
else |
|
702 |
|
{ |
|
703 |
|
g_snprintf(buf, sizeof(buf), "%d %s", page, command); |
|
704 |
|
g_snprintf(term_label, sizeof(term_label), "%s", command); |
|
705 |
|
} |
|
706 |
|
/* reset the page to the real notebook page number */ |
|
707 |
|
page = cfg.term_count +1; |
|
708 |
|
|
|
709 |
|
term = (ZvtTerm *)zvt_term_new_with_size(80,24); |
|
710 |
|
gtk_object_set_data(GTK_OBJECT(term), "label_text", buf); |
|
711 |
|
|
|
712 |
|
if(new_page) |
|
713 |
|
{ |
|
714 |
|
app.notebook_label = gtk_label_new(buf); |
|
715 |
|
gtk_widget_show(app.notebook_label); |
|
716 |
|
vbox = gtk_vbox_new (FALSE, 0); |
|
717 |
|
gtk_box_set_spacing (GTK_BOX (vbox), 0); |
|
718 |
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 0); |
|
719 |
|
gtk_notebook_append_page(GTK_NOTEBOOK(app.notebook), vbox, |
|
720 |
|
app.notebook_label); |
|
721 |
|
gtk_widget_show (vbox); |
|
722 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "term_count", GUINT_TO_POINTER(1)); |
|
723 |
|
gtk_object_set_data(GTK_OBJECT(term), "term_number", GUINT_TO_POINTER(1)); |
|
724 |
|
gtk_object_set_data(GTK_OBJECT(term), "vbox", vbox); |
|
725 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", GUINT_TO_POINTER(1)); |
|
726 |
|
gtk_object_set_data(GTK_OBJECT(term), "page_number", |
|
727 |
|
GUINT_TO_POINTER(page)); |
|
728 |
|
|
|
729 |
|
} |
|
730 |
|
else |
|
731 |
|
{ |
|
732 |
|
gint term_count; |
|
733 |
|
vbox = gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), |
|
734 |
|
gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook))); |
|
735 |
|
if(vbox == NULL) |
|
736 |
|
return 0; |
|
737 |
|
term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox), |
|
738 |
|
"term_count")); |
|
739 |
|
term_count++; |
|
740 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "term_count", |
|
741 |
|
GUINT_TO_POINTER(term_count)); |
|
742 |
|
gtk_object_set_data(GTK_OBJECT(term), "term_number", |
|
743 |
|
GUINT_TO_POINTER(term_count)); |
|
744 |
|
gtk_object_set_data(GTK_OBJECT(term), "page_number", |
|
745 |
|
GUINT_TO_POINTER(gtk_notebook_get_current_page( |
|
746 |
|
GTK_NOTEBOOK(app.notebook)))); |
|
747 |
|
gtk_object_set_data(GTK_OBJECT(term), "vbox", vbox); |
|
748 |
|
gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", |
|
749 |
|
GUINT_TO_POINTER(term_count)); |
|
750 |
|
} |
|
751 |
|
|
|
752 |
|
|
|
753 |
|
|
|
754 |
|
|
|
755 |
|
/* set terminal options */ |
|
756 |
|
gtk_widget_show (GTK_WIDGET(term)); |
|
757 |
|
zvt_term_set_font_name(ZVT_TERM (term), zvt.term_font); |
|
758 |
|
zvt_term_set_blink (ZVT_TERM (term), zvt.use_blinking_cursor); |
|
759 |
|
zvt_term_set_bell (ZVT_TERM (term), zvt.terminal_bell); |
|
760 |
|
zvt_term_set_scrollback(ZVT_TERM (term), zvt.scroll_lines); |
|
761 |
|
zvt_term_set_scroll_on_keystroke (ZVT_TERM (term), zvt.scroll_on_keystroke); |
|
762 |
|
zvt_term_set_scroll_on_output (ZVT_TERM (term), zvt.scroll_on_output); |
|
763 |
|
zvt_term_set_wordclass (ZVT_TERM (term), "-A-Za-z0-9/_:.,?+%="); |
|
764 |
|
if(zvt.use_pixmap) |
|
765 |
|
{ |
|
766 |
|
zvt_term_set_background(ZVT_TERM(term), zvt.pixmap, |
|
767 |
|
zvt.transparent, ZVT_BACKGROUND_SHADED); |
|
768 |
|
} |
|
769 |
|
else if(zvt.transparent) |
|
770 |
|
{ |
|
771 |
|
zvt_term_set_background(term, NULL, zvt.transparent, 0); |
|
772 |
|
} |
|
773 |
|
else |
|
774 |
|
zvt_term_set_background(ZVT_TERM(term), NULL, 0, 0); |
|
775 |
|
|
|
776 |
|
zvt_term_set_del_key_swap(ZVT_TERM(term), zvt.swap_backspace); |
|
777 |
|
if(new_page) |
|
778 |
|
cfg.term_count++; |
|
779 |
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app.notebook), zvt.show_tabs); |
|
780 |
|
|
|
781 |
|
/* Check if this term is running vi |
|
782 |
|
* This is used to determine if you can use :b, :sp, or :vs |
|
783 |
|
* commands to load files into this terminal |
|
784 |
|
*/ |
|
785 |
|
if(!strncmp(command, cfg.vi_command, strlen(cfg.vi_command))) |
|
786 |
|
{ |
|
787 |
|
gtk_object_set_user_data(GTK_OBJECT(term), GUINT_TO_POINTER(TRUE)); |
|
788 |
|
cfg.current_term = (ZvtTerm *)term; |
|
789 |
|
} |
|
790 |
|
else |
|
791 |
|
gtk_object_set_user_data(GTK_OBJECT(term), GUINT_TO_POINTER(FALSE)); |
|
792 |
|
|
|
793 |
|
|
|
794 |
|
|
|
795 |
|
menubar = create_term_menu(term, term_label); |
|
796 |
|
gtk_widget_show(menubar); |
|
797 |
|
gtk_object_set_data(GTK_OBJECT(term), "menubar", menubar); |
|
798 |
|
|
|
799 |
|
gtk_box_pack_end (GTK_BOX (vbox), GTK_WIDGET(term), 1, 1, 0); |
|
800 |
|
|
|
801 |
|
gtk_box_pack_end (GTK_BOX (vbox), menubar, FALSE, FALSE, 0); |
|
802 |
|
|
|
803 |
|
set_color_scheme((ZvtTerm*)term); |
|
804 |
|
|
|
805 |
|
key_press_signal = gtk_signal_connect(GTK_OBJECT(term), "key_press_event", |
|
806 |
|
GTK_SIGNAL_FUNC(term_key_cb), term); |
|
807 |
|
gtk_signal_connect(GTK_OBJECT(term), "button_press_event", |
|
808 |
|
GTK_SIGNAL_FUNC(gtk_widget_grab_focus), term); |
|
809 |
|
gtk_object_set_data(GTK_OBJECT(term), "signal_key_id", |
|
810 |
|
GUINT_TO_POINTER(key_press_signal)); |
|
811 |
|
|
|
812 |
|
child_died_signal_id = gtk_signal_connect (GTK_OBJECT (term), |
|
813 |
|
"child_died", |
|
814 |
|
GTK_SIGNAL_FUNC (child_died_event), |
|
815 |
|
vbox); |
|
816 |
|
gtk_object_set_data(GTK_OBJECT(term), "child_died_signal_id", |
|
817 |
|
GUINT_TO_POINTER(child_died_signal_id)); |
|
818 |
|
|
|
819 |
|
title_change_signal = gtk_signal_connect (GTK_OBJECT (term), |
|
820 |
|
"title_changed", |
|
821 |
|
GTK_SIGNAL_FUNC (title_changed_event), |
|
822 |
|
NULL); |
|
823 |
|
gtk_object_set_data(GTK_OBJECT(term), "title_change_signal", |
|
824 |
|
GUINT_TO_POINTER(title_change_signal)); |
|
825 |
|
|
|
826 |
|
|
|
827 |
|
XSync(GDK_DISPLAY(), False); |
|
828 |
|
/* set up terminal environment */ |
|
829 |
|
env = environ; |
|
830 |
|
|
|
831 |
|
|
|
832 |
|
for (p = env; *p; p++); |
|
833 |
|
i = p - env; |
|
834 |
|
env_copy = (char **) g_malloc (sizeof (char *) * (i + 3)); |
|
835 |
|
for (i = 0, p = env; *p; p++) { |
|
836 |
|
if (strncmp (*p, "TERM=", 5) == 0) { |
|
837 |
|
env_copy [i++] = "TERM=xterm"; |
|
838 |
|
} else if ((strncmp (*p, "COLUMNS=", 8) == 0) || |
|
839 |
|
(strncmp (*p, "LINES=", 6) == 0)) { |
|
840 |
|
continue; |
|
841 |
|
} else { |
|
842 |
|
env_copy [i++] = *p; |
|
843 |
|
} |
|
844 |
|
} |
|
845 |
|
|
|
846 |
|
env_copy [i++] = "COLORTERM=color-xterm"; |
|
847 |
|
winid_pos = i++; |
|
848 |
|
env_copy [winid_pos] = "TEST"; |
|
849 |
|
env_copy [i] = NULL; |
|
850 |
|
|
|
851 |
|
|
|
852 |
|
/* fork the shell or program */ |
|
853 |
|
switch (zvt_term_forkpty(ZVT_TERM (term), ZVT_TERM_DO_UTMP_LOG | ZVT_TERM_DO_WTMP_LOG)) { |
|
854 |
|
case -1: |
|
855 |
|
perror("ERROR: unable to fork:"); |
|
856 |
|
exit(1); |
|
857 |
|
break; |
|
858 |
|
|
|
859 |
|
case 0: |
|
860 |
|
{ |
|
861 |
|
GString *shell, *name; |
|
862 |
|
gchar *args[4]; |
|
863 |
|
|
|
864 |
|
/* get shell from passwd */ |
|
865 |
|
pw = getpwuid(getuid()); |
|
866 |
|
if (pw) { |
|
867 |
|
shell = g_string_new(pw->pw_shell); |
|
868 |
|
if (login_shell) |
|
869 |
|
name = g_string_new("-"); |
|
870 |
|
else |
|
871 |
|
name = g_string_new(""); |
|
872 |
|
|
|
873 |
|
g_string_append(name, strrchr(pw->pw_shell, '/')); |
|
874 |
|
} else { |
|
875 |
|
shell = g_string_new("/bin/sh"); |
|
876 |
|
if (login_shell) |
|
877 |
|
name = g_string_new("-sh"); |
|
878 |
|
else |
|
879 |
|
name = g_string_new("sh"); |
|
880 |
|
} |
|
881 |
|
|
|
882 |
|
/* |
|
883 |
|
* Without this the title change may not work. |
|
884 |
|
* I'm not sure why but if you launch vide from a shell this is |
|
885 |
|
* not needed. But if you launch it from a window manager menu |
|
886 |
|
* the title_changed event is not caught unless you specify the |
|
887 |
|
* term window id. This is from the gnome-terminal application |
|
888 |
|
* and is undocumented in the zvt docs. |
|
889 |
|
*/ |
|
890 |
|
sprintf(buffer, "WINDOWID=%d", |
|
891 |
|
(int) GDK_WINDOW_XWINDOW(GTK_WIDGET(term)->window)); |
|
892 |
|
env_copy[winid_pos] = buffer; |
|
893 |
|
|
|
894 |
|
|
|
895 |
|
if(!strcmp(command, "sh")) |
|
896 |
|
{ |
|
897 |
|
execle(shell->str, name->str, NULL, env_copy); |
|
898 |
|
_exit(127); |
|
899 |
|
} |
|
900 |
|
else |
|
901 |
|
{ |
|
902 |
|
args[0] = "sh"; |
|
903 |
|
args[1] = "-c"; |
|
904 |
|
args[2] = command; |
|
905 |
|
args[3] = NULL; |
|
906 |
|
|
|
907 |
|
/* This ensures that the signals are sent to the correct window |
|
908 |
|
* see the previous comment |
|
909 |
|
*/ |
|
910 |
|
environ = env_copy; |
|
911 |
|
|
|
912 |
|
execvp(args[0], args); |
|
913 |
|
_exit(127); |
|
914 |
|
} |
|
915 |
|
} |
|
916 |
|
|
|
917 |
|
default: |
|
918 |
|
break; |
|
919 |
|
} |
|
920 |
|
|
|
921 |
|
if(new_page) |
|
922 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), -1); |
|
923 |
|
|
|
924 |
|
|
|
925 |
|
return 0; |
|
926 |
|
} |
|
927 |
|
|
|
928 |
|
|
| File src/vide.c added (mode: 100644) (index 0000000..5591c8f) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
#include <sys/param.h> |
|
21 |
|
|
|
22 |
|
#if defined(__FreeBSD_version) |
|
23 |
|
#define RXVT_VIM "xterm -e vim" |
|
24 |
|
#define RXVT "xterm" |
|
25 |
|
#else |
|
26 |
|
#define RXVT_VIM "rxvt -e vim" |
|
27 |
|
#define RXVT "rxvt" |
|
28 |
|
#endif |
|
29 |
|
|
|
30 |
|
|
|
31 |
|
#include <string.h> |
|
32 |
|
#include <unistd.h> |
|
33 |
|
#include <stdio.h> |
|
34 |
|
#include <stdlib.h> |
|
35 |
|
#include <sys/types.h> |
|
36 |
|
#include <sys/wait.h> |
|
37 |
|
#include <signal.h> |
|
38 |
|
#include "vide.h" |
|
39 |
|
#include <gdk/gdkx.h> |
|
40 |
|
|
|
41 |
|
|
|
42 |
|
App app; |
|
43 |
|
Config cfg; |
|
44 |
|
FileView *curr_view; |
|
45 |
|
FileView *other_view; |
|
46 |
|
FileView *command_view; |
|
47 |
|
FileView *filetypes_view; |
|
48 |
|
Bookmarks bk; |
|
49 |
|
Zvt zvt; |
|
50 |
|
|
|
51 |
|
|
|
52 |
|
Column all_columns[MAX_COLUMNS] = |
|
53 |
|
{ {"Filename", 180, FILENAME, TRUE, name_sort} |
|
54 |
|
, |
|
55 |
|
{"Size", 80, SIZE, TRUE, size_sort} |
|
56 |
|
, |
|
57 |
|
{"Modified", 80, MODIFIED, TRUE, date_sort} |
|
58 |
|
, |
|
59 |
|
{"Accessed", 80, ACCESSED, FALSE, date_sort} |
|
60 |
|
, |
|
61 |
|
{"Changed", 80, CHANGED, FALSE, date_sort} |
|
62 |
|
, |
|
63 |
|
{"Permissions", 80, PERM, TRUE, perm_sort} |
|
64 |
|
, |
|
65 |
|
{"Owner", 60, OWNER, TRUE, user_sort} |
|
66 |
|
, |
|
67 |
|
{"Group", 60, GROUP, FALSE, group_sort} |
|
68 |
|
}; |
|
69 |
|
|
|
70 |
|
GdkColor EXE_COLOR; |
|
71 |
|
GdkColor DIR_COLOR; |
|
72 |
|
GdkColor LNK_COLOR; |
|
73 |
|
GdkColor DEV_COLOR; |
|
74 |
|
GdkColor COL_COLOR; |
|
75 |
|
GdkColor TAG_COLOR; |
|
76 |
|
GdkColor SOCK_COLOR; |
|
77 |
|
GdkColor DRAG_HILIGHT; |
|
78 |
|
GdkColor CLIST_COLOR; |
|
79 |
|
GdkColor TAB_COLOR; |
|
80 |
|
|
|
81 |
|
static void |
|
82 |
|
received_sigchild () |
|
83 |
|
{ |
|
84 |
|
int status; |
|
85 |
|
pid_t pid; |
|
86 |
|
|
|
87 |
|
pid = waitpid (-1, &status, WNOHANG); |
|
88 |
|
} |
|
89 |
|
|
|
90 |
|
static gint |
|
91 |
|
check_config_files (gpointer data) |
|
92 |
|
{ |
|
93 |
|
struct stat stat_buf; |
|
94 |
|
gchar filename[PATH_MAX + 10]; |
|
95 |
|
gboolean need_recreate = FALSE; |
|
96 |
|
|
|
97 |
|
g_snprintf (filename, sizeof (filename), "%s/settings", cfg.config_dir); |
|
98 |
|
if (stat (filename, &stat_buf) == 0) |
|
99 |
|
{ |
|
100 |
|
if (stat_buf.st_mtime != cfg.config_mtime) |
|
101 |
|
{ |
|
102 |
|
status_bar_message ("Configuration files have changed.. reloading"); |
|
103 |
|
read_config_file (); |
|
104 |
|
need_recreate = TRUE; |
|
105 |
|
cfg.config_mtime = stat_buf.st_mtime; |
|
106 |
|
} |
|
107 |
|
} |
|
108 |
|
|
|
109 |
|
g_snprintf (filename, sizeof (filename), "%s/filetypes", cfg.config_dir); |
|
110 |
|
if (stat (filename, &stat_buf) == 0) |
|
111 |
|
{ |
|
112 |
|
if (stat_buf.st_mtime != cfg.filetypes_mtime) |
|
113 |
|
{ |
|
114 |
|
status_bar_message ("Configuration files have changed.. reloading"); |
|
115 |
|
read_filetypes_file (); |
|
116 |
|
cfg.filetypes_mtime = stat_buf.st_mtime; |
|
117 |
|
} |
|
118 |
|
} |
|
119 |
|
|
|
120 |
|
g_snprintf (filename, sizeof (filename), "%s/bookmarks", cfg.config_dir); |
|
121 |
|
if (stat (filename, &stat_buf) == 0) |
|
122 |
|
{ |
|
123 |
|
if (stat_buf.st_mtime != cfg.bookmarks_mtime) |
|
124 |
|
{ |
|
125 |
|
status_bar_message ("Configuration files have changed.. reloading"); |
|
126 |
|
read_bookmarks_file (); |
|
127 |
|
need_recreate = TRUE; |
|
128 |
|
cfg.bookmarks_mtime = stat_buf.st_mtime; |
|
129 |
|
} |
|
130 |
|
} |
|
131 |
|
|
|
132 |
|
/* |
|
133 |
|
g_snprintf(filename, sizeof(filename), "%s/term_options", cfg.config_dir); |
|
134 |
|
if(stat(filename, &stat_buf) == 0) |
|
135 |
|
{ |
|
136 |
|
if(stat_buf.st_mtime != cfg.term_mtime) |
|
137 |
|
{ |
|
138 |
|
g_print("in vide.c update term()\n"); |
|
139 |
|
status_bar_message("Configuration files have changed.. reloading"); |
|
140 |
|
read_term_file(); |
|
141 |
|
update_all_terms(); |
|
142 |
|
cfg.term_mtime = stat_buf.st_mtime; |
|
143 |
|
} |
|
144 |
|
} |
|
145 |
|
*/ |
|
146 |
|
|
|
147 |
|
g_snprintf (filename, sizeof (filename), "%s/user_commands", |
|
148 |
|
cfg.config_dir); |
|
149 |
|
|
|
150 |
|
if (need_recreate) |
|
151 |
|
{ |
|
152 |
|
recreate_main_window (); |
|
153 |
|
update_all_terms(); |
|
154 |
|
} |
|
155 |
|
|
|
156 |
|
return TRUE; |
|
157 |
|
} |
|
158 |
|
|
|
159 |
|
gint |
|
160 |
|
update_list (gpointer data) |
|
161 |
|
{ |
|
162 |
|
/* check for changes in current directory & other directory |
|
163 |
|
* refresh list if any files have changed |
|
164 |
|
*/ |
|
165 |
|
|
|
166 |
|
struct stat statbuf; |
|
167 |
|
|
|
168 |
|
/* This checks if the first page of the notebook is showing. |
|
169 |
|
* Updating the clist when it is not on the screen causes errors. |
|
170 |
|
*/ |
|
171 |
|
if(gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) != 0) |
|
172 |
|
return TRUE; |
|
173 |
|
|
|
174 |
|
stat (curr_view->dir, &statbuf); |
|
175 |
|
/* if (statbuf.st_mtime != curr_view->dir_mtime) |
|
176 |
|
{ |
|
177 |
|
|
|
178 |
|
GtkAdjustment *vadj; |
|
179 |
|
gfloat scrollbar_pos; |
|
180 |
|
gint last_selected_row; |
|
181 |
|
|
|
182 |
|
|
|
183 |
|
vadj = gtk_clist_get_vadjustment (GTK_CLIST (curr_view->clist)); |
|
184 |
|
scrollbar_pos = vadj->value; |
|
185 |
|
last_selected_row = curr_view->row; |
|
186 |
|
gtk_clist_freeze(GTK_CLIST(curr_view->clist)); |
|
187 |
|
load_dir_list(curr_view); |
|
188 |
|
|
|
189 |
|
gtk_adjustment_set_value(GTK_ADJUSTMENT(vadj), scrollbar_pos); |
|
190 |
|
gtk_clist_unselect_all(GTK_CLIST(curr_view->clist)); |
|
191 |
|
|
|
192 |
|
focus_on_row(curr_view, |
|
193 |
|
curr_view->row < GTK_CLIST(curr_view->clist)->rows |
|
194 |
|
? curr_view->row |
|
195 |
|
: GTK_CLIST(curr_view->clist)->rows); |
|
196 |
|
|
|
197 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
198 |
|
gtk_clist_thaw(GTK_CLIST(curr_view->clist)); |
|
199 |
|
} |
|
200 |
|
*/ |
|
201 |
|
if (statbuf.st_mtime != curr_view->dir_mtime) |
|
202 |
|
{ |
|
203 |
|
GtkAdjustment *vadj; |
|
204 |
|
gfloat scrollbar_pos; |
|
205 |
|
GList *tmp; |
|
206 |
|
int index[GTK_CLIST(curr_view->clist)->rows]; |
|
207 |
|
int sel = 0; |
|
208 |
|
|
|
209 |
|
vadj = gtk_clist_get_vadjustment(GTK_CLIST(curr_view->clist)); |
|
210 |
|
scrollbar_pos = vadj->value; |
|
211 |
|
|
|
212 |
|
tmp = g_list_copy(GTK_CLIST(curr_view->clist)->selection); |
|
213 |
|
gtk_clist_freeze(GTK_CLIST(curr_view->clist)); |
|
214 |
|
load_dir_list(curr_view); |
|
215 |
|
|
|
216 |
|
gtk_adjustment_set_value(GTK_ADJUSTMENT(vadj), scrollbar_pos); |
|
217 |
|
gtk_clist_unselect_all(GTK_CLIST(curr_view->clist)); |
|
218 |
|
for (; tmp != NULL; tmp = tmp->next) |
|
219 |
|
{ |
|
220 |
|
gint i = (gint)tmp->data; |
|
221 |
|
if (i < GTK_CLIST(curr_view->clist)->rows) |
|
222 |
|
{ |
|
223 |
|
gtk_clist_select_row(GTK_CLIST(curr_view->clist), i, 0); |
|
224 |
|
index[sel] = i; |
|
225 |
|
sel++; |
|
226 |
|
} |
|
227 |
|
if (tmp->next == NULL && i < GTK_CLIST(curr_view->clist)->rows) |
|
228 |
|
{ |
|
229 |
|
GTK_CLIST(curr_view->clist)->focus_row = i; |
|
230 |
|
} |
|
231 |
|
else |
|
232 |
|
{ |
|
233 |
|
GTK_CLIST(curr_view->clist)->focus_row = index[sel]; |
|
234 |
|
} |
|
235 |
|
} |
|
236 |
|
/* no rows selected */ |
|
237 |
|
if(!sel) |
|
238 |
|
focus_on_row(curr_view, GTK_CLIST(curr_view->clist)->rows -1); |
|
239 |
|
gtk_widget_draw_focus(curr_view->clist); |
|
240 |
|
gtk_clist_thaw(GTK_CLIST(curr_view->clist)); |
|
241 |
|
} |
|
242 |
|
|
|
243 |
|
|
|
244 |
|
stat(other_view->dir, &statbuf); |
|
245 |
|
if (statbuf.st_mtime != other_view->dir_mtime) |
|
246 |
|
{ |
|
247 |
|
load_dir_list(other_view); |
|
248 |
|
chdir(curr_view->dir); |
|
249 |
|
} |
|
250 |
|
|
|
251 |
|
|
|
252 |
|
return TRUE; |
|
253 |
|
} |
|
254 |
|
|
|
255 |
|
|
|
256 |
|
int |
|
257 |
|
main (int argc, char *argv[]) |
|
258 |
|
{ |
|
259 |
|
struct sigaction new_action; |
|
260 |
|
gchar *home; |
|
261 |
|
gchar current_dir[PATH_MAX]; |
|
262 |
|
gint i; |
|
263 |
|
|
|
264 |
|
/* default terminal color scheme */ |
|
265 |
|
|
|
266 |
|
gushort red[] = { 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, |
|
267 |
|
0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, |
|
268 |
|
0xffff, 0x0, 0x0 }; |
|
269 |
|
gushort grn[] = { 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, |
|
270 |
|
0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, |
|
271 |
|
0xffff, 0x0, 0x0 }; |
|
272 |
|
gushort blu[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, |
|
273 |
|
0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, |
|
274 |
|
0xffff, 0x0, 0x0 }; |
|
275 |
|
|
|
276 |
|
/* white on black foreground/background */ |
|
277 |
|
red[16] = red[7]; |
|
278 |
|
blu[16] = blu[7]; |
|
279 |
|
grn[16] = grn[7]; |
|
280 |
|
red[17] = red[0]; |
|
281 |
|
blu[17] = blu[0]; |
|
282 |
|
grn[17] = blu[0]; |
|
283 |
|
|
|
284 |
|
|
|
285 |
|
for(i = 0; i < 18; i++) |
|
286 |
|
{ |
|
287 |
|
zvt.palette[i].red = red[i]; |
|
288 |
|
zvt.palette[i].green = grn[i]; |
|
289 |
|
zvt.palette[i].blue = blu[i]; |
|
290 |
|
} |
|
291 |
|
|
|
292 |
|
cfg.current_term = NULL; |
|
293 |
|
|
|
294 |
|
cfg.term_count = 0; |
|
295 |
|
|
|
296 |
|
/* i18n support */ |
|
297 |
|
gtk_set_locale(); |
|
298 |
|
|
|
299 |
|
getcwd(current_dir, sizeof(current_dir)); |
|
300 |
|
|
|
301 |
|
|
|
302 |
|
/* Set up handler for sigchild so that we don't get zombies */ |
|
303 |
|
new_action.sa_handler = received_sigchild; |
|
304 |
|
sigemptyset (&new_action.sa_mask); |
|
305 |
|
new_action.sa_flags = SA_RESTART; |
|
306 |
|
sigaction (SIGCHLD, &new_action, NULL); |
|
307 |
|
|
|
308 |
|
/*g_thread_init (NULL);*/ |
|
309 |
|
gtk_init (&argc, &argv); |
|
310 |
|
|
|
311 |
|
/* Setup the default colors and font */ |
|
312 |
|
gdk_color_parse ("forest green", &EXE_COLOR); |
|
313 |
|
gdk_color_parse ("blue", &DIR_COLOR); |
|
314 |
|
gdk_color_parse ("sky blue", &LNK_COLOR); |
|
315 |
|
gdk_color_parse ("orange", &DEV_COLOR); |
|
316 |
|
gdk_color_parse ("purple", &SOCK_COLOR); |
|
317 |
|
gdk_color_parse ("dark gray", &COL_COLOR); |
|
318 |
|
gdk_color_parse ("yellow", &TAG_COLOR); |
|
319 |
|
gdk_color_parse ("wheat", &DRAG_HILIGHT); |
|
320 |
|
gdk_color_parse ("red", &TAB_COLOR); |
|
321 |
|
|
|
322 |
|
g_snprintf(zvt.term_font, sizeof(zvt.term_font), |
|
323 |
|
"-Misc-Fixed-Bold-R-Normal--14-130-75-75-C-70-ISO8859-1"); |
|
324 |
|
|
|
325 |
|
cfg.filetypes = NULL; |
|
326 |
|
cfg.bookmarks = NULL; |
|
327 |
|
cfg.terms = NULL; |
|
328 |
|
app.right_view.history = NULL; |
|
329 |
|
app.left_view.history = NULL; |
|
330 |
|
app.right_view.menu_history = NULL; |
|
331 |
|
app.left_view.menu_history = NULL; |
|
332 |
|
cfg.fileselector = FALSE; |
|
333 |
|
|
|
334 |
|
|
|
335 |
|
/* this is here in case a previous version of vide configuration file |
|
336 |
|
* exists that doesn't have the cfg.vi_clone or cfg.man_program set |
|
337 |
|
*/ |
|
338 |
|
strncpy(cfg.man_program, "pauseme man -a", sizeof(cfg.man_program)); |
|
339 |
|
strncpy(cfg.vi_clone, "vim", sizeof(cfg.vi_clone)); |
|
340 |
|
/* Prepare and read config files */ |
|
341 |
|
set_config_dir (); |
|
342 |
|
if (!read_config_file ()) |
|
343 |
|
{ |
|
344 |
|
/* Set Default values */ |
|
345 |
|
g_snprintf(cfg.start_filter, sizeof(cfg.start_filter), "\\.o$"); |
|
346 |
|
cfg.invert_filter = TRUE; |
|
347 |
|
cfg.save_position = FALSE; |
|
348 |
|
cfg.save_position = FALSE; |
|
349 |
|
cfg.show_hidden = FALSE; |
|
350 |
|
cfg.start_with_cwd = FALSE; |
|
351 |
|
strncpy(cfg.vi_clone, "vim", sizeof(cfg.vi_clone)); |
|
352 |
|
strncpy(cfg.vi_command, "vim", sizeof(cfg.vi_command)); |
|
353 |
|
strncpy (cfg.viewer_command, RXVT_VIM, |
|
354 |
|
sizeof (cfg.viewer_command)); |
|
355 |
|
cfg.window_width = 640; |
|
356 |
|
cfg.window_height = 480; |
|
357 |
|
cfg.window_xpos = 0; |
|
358 |
|
cfg.window_ypos = 0; |
|
359 |
|
cfg.dir_history_max_length = 15; |
|
360 |
|
cfg.command_history_max_length = 10; |
|
361 |
|
strncpy (cfg.xterm_command, RXVT, sizeof (cfg.xterm_command)); |
|
362 |
|
chdir (getenv ("HOME")); |
|
363 |
|
getcwd (app.left_view.dir, PATH_MAX); |
|
364 |
|
strncpy (app.right_view.dir, app.left_view.dir, PATH_MAX); |
|
365 |
|
strncpy (cfg.left_startup_dir, app.left_view.dir, PATH_MAX); |
|
366 |
|
strncpy (cfg.right_startup_dir, app.left_view.dir, PATH_MAX); |
|
367 |
|
} |
|
368 |
|
|
|
369 |
|
if(!read_term_file()) |
|
370 |
|
{ |
|
371 |
|
int i; |
|
372 |
|
gushort rxvt_red[] = { 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, |
|
373 |
|
0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, |
|
374 |
|
0xffff, 0x0000, 0xffff, 0x0, 0x0 }; |
|
375 |
|
gushort rxvt_grn[] = { 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, |
|
376 |
|
0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, |
|
377 |
|
0x0000, 0xffff, 0xffff, 0x0, 0x0 }; |
|
378 |
|
gushort rxvt_blu[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, |
|
379 |
|
0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, |
|
380 |
|
0xffff, 0xffff, 0xffff, 0x0, 0x0 }; |
|
381 |
|
|
|
382 |
|
for(i = 0; i < 18; i++) |
|
383 |
|
{ |
|
384 |
|
zvt.palette[i].red = rxvt_red[i]; |
|
385 |
|
zvt.palette[i].green = rxvt_grn[i]; |
|
386 |
|
zvt.palette[i].blue = rxvt_blu[i]; |
|
387 |
|
} |
|
388 |
|
|
|
389 |
|
zvt.foreground[0].red = rxvt_red[0]; |
|
390 |
|
zvt.foreground[0].green = rxvt_grn[0]; |
|
391 |
|
zvt.foreground[0].blue = rxvt_blu[0]; |
|
392 |
|
zvt.foreground[1].red = rxvt_red[7]; |
|
393 |
|
zvt.foreground[1].green = rxvt_grn[7]; |
|
394 |
|
zvt.foreground[1].blue = rxvt_blu[7]; |
|
395 |
|
|
|
396 |
|
/* default zvt terminal options */ |
|
397 |
|
zvt.tab_position = GTK_POS_BOTTOM; |
|
398 |
|
zvt.terminal_bell = FALSE; |
|
399 |
|
zvt.use_blinking_cursor = TRUE; |
|
400 |
|
zvt.scroll_on_keystroke = FALSE; |
|
401 |
|
zvt.scroll_on_output = FALSE; |
|
402 |
|
zvt.swap_backspace = FALSE; |
|
403 |
|
zvt.transparent = FALSE; |
|
404 |
|
zvt.shaded = FALSE; |
|
405 |
|
zvt.use_pixmap = FALSE; |
|
406 |
|
zvt.scroll_lines = 100; |
|
407 |
|
zvt.scrollbar_position = 0; |
|
408 |
|
g_snprintf(zvt.background, sizeof(zvt.background), "WhiteOnBlack"); |
|
409 |
|
g_snprintf(zvt.term_color, sizeof(zvt.term_color), "Rxvt"); |
|
410 |
|
|
|
411 |
|
} |
|
412 |
|
|
|
413 |
|
if (!read_filetypes_file ()) |
|
414 |
|
{ |
|
415 |
|
/* Setup some default filetypes */ |
|
416 |
|
add_filetype ("jpeg,jpg,png,xpm,gif", "xv,gimp", "Image Files"); |
|
417 |
|
add_filetype ("c,cpp,h,pl,java, py", "vi", "Source Code Files"); |
|
418 |
|
add_filetype ("o,so,a", "x nm %f | less", "Object Files"); |
|
419 |
|
add_filetype ("htm,html,php", "netscape, vi", "HTML Documents"); |
|
420 |
|
add_filetype ("tar.gz,tgz", "x tar xzvf %f ,x tar tzvf %f | less", |
|
421 |
|
"Gzipped Tarballs"); |
|
422 |
|
add_filetype("zip, Z", "x unzip %f", "Zip"); |
|
423 |
|
add_filetype ("tar.bz2", "x bzip2 -cd %f | tar tv | less, x bzip2 -cd %f | tar xf -", "Bunzip2"); |
|
424 |
|
add_filetype ("rpm", "x rpm -qlip %f | less,x rpm -Uvh %f | less", |
|
425 |
|
"RPM Packages"); |
|
426 |
|
add_filetype ("pdf", "acroread,xpdf", "Adobe Acrobat Documents"); |
|
427 |
|
add_filetype ("ps", "gv", "PostScript Documents"); |
|
428 |
|
add_filetype ("rm, ram", "realplay", "Real Player"); |
|
429 |
|
} |
|
430 |
|
|
|
431 |
|
if (!read_bookmarks_file ()) |
|
432 |
|
{ |
|
433 |
|
/* Setup some default bookmarks */ |
|
434 |
|
if ((home = getenv ("HOME")) != NULL) |
|
435 |
|
add_bookmark("H", home, "../"); |
|
436 |
|
add_bookmark("R", "/", "../"); |
|
437 |
|
add_bookmark("U", "/usr", "../"); |
|
438 |
|
add_bookmark("L", "/usr/local", "../"); |
|
439 |
|
} |
|
440 |
|
|
|
441 |
|
|
|
442 |
|
if (!read_user_commands_file ()) |
|
443 |
|
{ |
|
444 |
|
gchar trash_com[128]; |
|
445 |
|
gchar memo_com[128]; |
|
446 |
|
g_snprintf (trash_com, 128, "mv %%f %s", cfg.trash); |
|
447 |
|
g_snprintf (memo_com, 128, "!%s %s/memo", cfg.viewer_command, |
|
448 |
|
cfg.config_dir); |
|
449 |
|
|
|
450 |
|
add_user_command (" ", "NULL"); |
|
451 |
|
add_user_command ("Memo", memo_com); |
|
452 |
|
add_user_command ("Trash :d", trash_com); |
|
453 |
|
add_user_command ("Copy :co", "cp -R %f %D"); |
|
454 |
|
add_user_command ("Move :m", "mv %f %D"); |
|
455 |
|
add_user_command ("Rename", "mv %f %{%f New Filename:}"); |
|
456 |
|
add_user_command ("New File", "touch %{Name of New File:}"); |
|
457 |
|
add_user_command ("New Dir", "mkdir %{Name of New Directory:}"); |
|
458 |
|
|
|
459 |
|
} |
|
460 |
|
|
|
461 |
|
if(!read_programs_file()) |
|
462 |
|
{ |
|
463 |
|
add_program("Netscape", "netscape"); |
|
464 |
|
add_program("Gimp", "gimp"); |
|
465 |
|
add_program("Glade", "glade"); |
|
466 |
|
add_program("X-chat", "xchat"); |
|
467 |
|
} |
|
468 |
|
if(!read_command_mode_file()) |
|
469 |
|
{ |
|
470 |
|
add_command("mutt", "!mutt"); |
|
471 |
|
add_command("ps", "!top"); |
|
472 |
|
add_command("vi", "exe rxvt -e vim %f"); |
|
473 |
|
add_command("Backup", "/~$"); |
|
474 |
|
add_command("touch", "exe touch %{Name of new file.}"); |
|
475 |
|
add_command("vide", "exe vide %d %D"); |
|
476 |
|
} |
|
477 |
|
|
|
478 |
|
|
|
479 |
|
if(cfg.start_with_cwd) |
|
480 |
|
{ |
|
481 |
|
strncpy(app.right_view.dir, current_dir, sizeof(app.right_view.dir)); |
|
482 |
|
strncpy(app.left_view.dir, current_dir, sizeof(app.left_view.dir)); |
|
483 |
|
} |
|
484 |
|
else |
|
485 |
|
{ |
|
486 |
|
if (cfg.right_startup_dir != NULL) |
|
487 |
|
strncpy (app.right_view.dir, cfg.right_startup_dir, |
|
488 |
|
sizeof (app.right_view.dir)); |
|
489 |
|
if (cfg.left_startup_dir != NULL) |
|
490 |
|
strncpy (app.left_view.dir, cfg.left_startup_dir, |
|
491 |
|
sizeof (app.left_view.dir)); |
|
492 |
|
} |
|
493 |
|
|
|
494 |
|
|
|
495 |
|
|
|
496 |
|
if(argv[1] != NULL) |
|
497 |
|
{ |
|
498 |
|
strncpy (app.left_view.dir, argv[1], sizeof (app.left_view.dir)); |
|
499 |
|
|
|
500 |
|
if (argv[2] != NULL) |
|
501 |
|
strncpy (app.right_view.dir, argv[2], sizeof (app.right_view.dir)); |
|
502 |
|
} |
|
503 |
|
|
|
504 |
|
|
|
505 |
|
app.left_view.last_row = 0; |
|
506 |
|
app.right_view.last_row = 0; |
|
507 |
|
strncpy (app.left_view.last_dir, app.left_view.dir, PATH_MAX); |
|
508 |
|
strncpy (app.right_view.last_dir, app.right_view.dir, PATH_MAX); |
|
509 |
|
|
|
510 |
|
|
|
511 |
|
|
|
512 |
|
/* Build GUI */ |
|
513 |
|
create_main_window (); |
|
514 |
|
initialize_filters (&app.right_view); |
|
515 |
|
initialize_filters (&app.left_view); |
|
516 |
|
change_dir(&app.right_view, app.right_view.dir); |
|
517 |
|
change_dir(&app.left_view, app.left_view.dir); |
|
518 |
|
sort_list (&app.right_view, name_sort, GTK_SORT_ASCENDING, 0); |
|
519 |
|
sort_list (&app.left_view, name_sort, GTK_SORT_ASCENDING, 0); |
|
520 |
|
gtk_widget_grab_focus(app.left_view.clist); |
|
521 |
|
gtk_clist_select_row(GTK_CLIST(app.left_view.clist), 0, 0); |
|
522 |
|
|
|
523 |
|
|
|
524 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), 0); |
|
525 |
|
|
|
526 |
|
/* checks for changes in configuration files */ |
|
527 |
|
gtk_timeout_add (1000, check_config_files, NULL); |
|
528 |
|
/* checks for changes in current directory */ |
|
529 |
|
gtk_timeout_add (500, update_list, NULL); |
|
530 |
|
|
|
531 |
|
gtk_main (); |
|
532 |
|
|
|
533 |
|
exit (0); |
|
534 |
|
} |
| File src/vide.h added (mode: 100644) (index 0000000..9912d39) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
#ifndef __VIDE_H__ |
|
21 |
|
#define __VIDE_H__ |
|
22 |
|
|
|
23 |
|
#define _GNU_SOURCE |
|
24 |
|
#include <gtk/gtk.h> |
|
25 |
|
#include <gdk/gdkkeysyms.h> |
|
26 |
|
#include <sys/types.h> |
|
27 |
|
#include <sys/stat.h> |
|
28 |
|
#include <limits.h> |
|
29 |
|
#include <zvt/zvtterm.h> |
|
30 |
|
|
|
31 |
|
#define VERSION "0.5.2" |
|
32 |
|
#define NAME_MAX 255 |
|
33 |
|
#define MAX_LEN 1024 |
|
34 |
|
#define MAX_BUTTONS 16 |
|
35 |
|
#define MAX_COLUMNS 8 |
|
36 |
|
|
|
37 |
|
#define STREQ(a,b) (strcmp((a),(b)) == 0) |
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
typedef struct History{ |
|
42 |
|
gchar dir[PATH_MAX]; |
|
43 |
|
gchar file[PATH_MAX]; |
|
44 |
|
}History; |
|
45 |
|
|
|
46 |
|
typedef struct Pattern{ |
|
47 |
|
gchar pattern[PATH_MAX]; |
|
48 |
|
int index; |
|
49 |
|
}Pattern; |
|
50 |
|
|
|
51 |
|
typedef struct Command{ |
|
52 |
|
gchar buffer[1024]; |
|
53 |
|
gint index; |
|
54 |
|
gchar number[100]; |
|
55 |
|
gchar count[100]; |
|
56 |
|
}Command; |
|
57 |
|
|
|
58 |
|
typedef enum |
|
59 |
|
{ FILENAME = 0, SIZE, MODIFIED, ACCESSED, CHANGED, |
|
60 |
|
PERM, OWNER, GROUP |
|
61 |
|
} |
|
62 |
|
ColumnFlags; |
|
63 |
|
typedef enum |
|
64 |
|
{ GENERAL_1 = 0, GENERAL_2, BOOKMARKS, FILETYPES, BUTTONS, |
|
65 |
|
COLUMNS, COLORS |
|
66 |
|
} |
|
67 |
|
ConfigDialogPages; |
|
68 |
|
typedef enum |
|
69 |
|
{ GT, LT, EQ } |
|
70 |
|
Operator; |
|
71 |
|
typedef enum |
|
72 |
|
{ YES, YES_TO_ALL, NO, CANCEL } |
|
73 |
|
ConfirmOverwriteButtons; |
|
74 |
|
|
|
75 |
|
typedef struct _FileInfo |
|
76 |
|
{ |
|
77 |
|
gchar filename[NAME_MAX]; |
|
78 |
|
struct stat statbuf; |
|
79 |
|
} |
|
80 |
|
FileInfo; |
|
81 |
|
|
|
82 |
|
typedef struct _FileType |
|
83 |
|
{ |
|
84 |
|
gchar description[NAME_MAX]; |
|
85 |
|
gchar extensions[NAME_MAX]; |
|
86 |
|
gchar programs[NAME_MAX]; |
|
87 |
|
} |
|
88 |
|
FileType; |
|
89 |
|
|
|
90 |
|
typedef struct _Button |
|
91 |
|
{ |
|
92 |
|
gchar *title; |
|
93 |
|
gint id; |
|
94 |
|
GtkSignalFunc callback; |
|
95 |
|
} |
|
96 |
|
Button; |
|
97 |
|
|
|
98 |
|
typedef struct _Column |
|
99 |
|
{ |
|
100 |
|
gchar *title; |
|
101 |
|
gint size; |
|
102 |
|
gint id; |
|
103 |
|
gint is_visible; |
|
104 |
|
GtkCListCompareFunc sort_func; |
|
105 |
|
} |
|
106 |
|
Column; |
|
107 |
|
|
|
108 |
|
typedef struct _UserCommand |
|
109 |
|
{ |
|
110 |
|
gchar name[NAME_MAX]; |
|
111 |
|
gchar action[NAME_MAX]; |
|
112 |
|
} |
|
113 |
|
UserCommand; |
|
114 |
|
|
|
115 |
|
typedef struct _Command_Mode_Programs |
|
116 |
|
{ |
|
117 |
|
gchar name[NAME_MAX]; |
|
118 |
|
gchar action[NAME_MAX]; |
|
119 |
|
} |
|
120 |
|
Command_Mode_Programs; |
|
121 |
|
|
|
122 |
|
|
|
123 |
|
typedef struct _Bookmarks |
|
124 |
|
{ |
|
125 |
|
gchar mark[5]; |
|
126 |
|
gchar dir[PATH_MAX]; |
|
127 |
|
gchar file[PATH_MAX]; |
|
128 |
|
} |
|
129 |
|
Bookmarks; |
|
130 |
|
|
|
131 |
|
|
|
132 |
|
typedef struct _TmpMarks |
|
133 |
|
{ |
|
134 |
|
gchar mark[5]; |
|
135 |
|
gchar dir[PATH_MAX]; |
|
136 |
|
gchar file[PATH_MAX]; |
|
137 |
|
} |
|
138 |
|
TmpMarks; |
|
139 |
|
|
|
140 |
|
typedef struct _Programs |
|
141 |
|
{ |
|
142 |
|
gchar name[NAME_MAX]; |
|
143 |
|
gchar action[NAME_MAX]; |
|
144 |
|
} |
|
145 |
|
Programs; |
|
146 |
|
|
|
147 |
|
typedef struct _FileView |
|
148 |
|
{ |
|
149 |
|
GtkWidget *clist; |
|
150 |
|
GtkWidget *sort_arrows[MAX_COLUMNS]; |
|
151 |
|
GtkWidget *filter_menu_item; |
|
152 |
|
GtkWidget *dir_label; |
|
153 |
|
GList *tagged; |
|
154 |
|
GList *iter; |
|
155 |
|
GList *iter_base; |
|
156 |
|
GList *dir_history; |
|
157 |
|
GList *history; |
|
158 |
|
GList *menu_history; |
|
159 |
|
gchar dir[PATH_MAX]; |
|
160 |
|
gchar glob[PATH_MAX]; |
|
161 |
|
|
|
162 |
|
gboolean filter_directories; |
|
163 |
|
struct |
|
164 |
|
{ |
|
165 |
|
gchar pattern[NAME_MAX]; |
|
166 |
|
gboolean invert_mask; |
|
167 |
|
gboolean active; |
|
168 |
|
} |
|
169 |
|
filename_filter; |
|
170 |
|
struct |
|
171 |
|
{ |
|
172 |
|
off_t size; |
|
173 |
|
Operator op; |
|
174 |
|
gboolean active; |
|
175 |
|
} |
|
176 |
|
size_filter; |
|
177 |
|
struct |
|
178 |
|
{ |
|
179 |
|
time_t time; |
|
180 |
|
Operator op; |
|
181 |
|
enum |
|
182 |
|
{ MTIME, ATIME, CTIME } |
|
183 |
|
time_type; |
|
184 |
|
gboolean active; |
|
185 |
|
} |
|
186 |
|
date_filter; |
|
187 |
|
time_t dir_mtime; |
|
188 |
|
time_t dir_ctime; |
|
189 |
|
gint row; |
|
190 |
|
gchar last_dir[PATH_MAX]; |
|
191 |
|
gint last_row; |
|
192 |
|
} |
|
193 |
|
FileView; |
|
194 |
|
|
|
195 |
|
typedef struct _App |
|
196 |
|
{ |
|
197 |
|
FileView left_view; |
|
198 |
|
FileView right_view; |
|
199 |
|
FileView command_view; |
|
200 |
|
FileView fileselector; |
|
201 |
|
FileView filetypes_view; |
|
202 |
|
GtkWidget *sw; |
|
203 |
|
GtkWidget *main_window; |
|
204 |
|
GtkWidget *main_window_vbox; |
|
205 |
|
GtkWidget *main_menu_bar; |
|
206 |
|
GtkWidget *notebook; |
|
207 |
|
GtkWidget *notebook_label; |
|
208 |
|
GtkWidget *sep; |
|
209 |
|
GtkWidget *label; |
|
210 |
|
GtkWidget *bookmark_menu; |
|
211 |
|
GtkWidget *bookmark_menu_item; |
|
212 |
|
GtkWidget *vide_menu_item; |
|
213 |
|
GtkWidget *options_menu_item; |
|
214 |
|
GtkWidget *tools_menu_item; |
|
215 |
|
GtkWidget *help_menu_item; |
|
216 |
|
GtkWidget *command_menu_item; |
|
217 |
|
GtkWidget *left_view_box; |
|
218 |
|
GtkWidget *right_view_box; |
|
219 |
|
GtkWidget *hbox; |
|
220 |
|
GtkWidget *status_bar; |
|
221 |
|
GtkWidget *mode_bar; |
|
222 |
|
GtkWidget *message_box; |
|
223 |
|
GtkWidget *filetypes_popup; |
|
224 |
|
GtkWidget *filetypes_clist; |
|
225 |
|
GtkWidget *term; |
|
226 |
|
GtkWidget *filetype_popup; |
|
227 |
|
GtkWidget *programs_menu; |
|
228 |
|
GtkWidget *history_menu; |
|
229 |
|
GtkWidget *mark_menu; |
|
230 |
|
GtkWidget *command_mode_menu; |
|
231 |
|
GtkWidget *delc_menu; |
|
232 |
|
GtkWidget *up_button; |
|
233 |
|
GtkWidget *buffer_menu; |
|
234 |
|
GtkWidget *split_menu; |
|
235 |
|
GtkWidget *vsplit_menu; |
|
236 |
|
} |
|
237 |
|
App; |
|
238 |
|
|
|
239 |
|
typedef struct _Zvt |
|
240 |
|
{ |
|
241 |
|
gboolean terminal_bell; |
|
242 |
|
gboolean use_blinking_cursor; |
|
243 |
|
gboolean scroll_on_keystroke; |
|
244 |
|
gboolean scroll_on_output; |
|
245 |
|
gboolean swap_backspace; |
|
246 |
|
gboolean transparent; |
|
247 |
|
gboolean shaded; |
|
248 |
|
gboolean show_tabs; |
|
249 |
|
gboolean use_pixmap; |
|
250 |
|
gchar pixmap[PATH_MAX]; |
|
251 |
|
gchar term_font[512]; |
|
252 |
|
gint scrollbar_position; |
|
253 |
|
GtkPositionType tab_position; |
|
254 |
|
gchar term_color[24]; |
|
255 |
|
gchar background[24]; |
|
256 |
|
gfloat scroll_lines; |
|
257 |
|
GdkColor palette[18]; |
|
258 |
|
GdkColor foreground[2]; |
|
259 |
|
}Zvt; |
|
260 |
|
|
|
261 |
|
|
|
262 |
|
typedef struct _Config |
|
263 |
|
{ |
|
264 |
|
gchar viewer_command[NAME_MAX]; |
|
265 |
|
gchar xterm_command[NAME_MAX]; |
|
266 |
|
gchar left_startup_dir[PATH_MAX]; |
|
267 |
|
gchar right_startup_dir[PATH_MAX]; |
|
268 |
|
gchar config_dir[PATH_MAX]; |
|
269 |
|
gchar trash[PATH_MAX]; |
|
270 |
|
gchar start_filter[NAME_MAX]; |
|
271 |
|
time_t config_mtime; |
|
272 |
|
time_t filetypes_mtime; |
|
273 |
|
time_t bookmarks_mtime; |
|
274 |
|
time_t user_commands_mtime; |
|
275 |
|
time_t programs_mtime; |
|
276 |
|
time_t command_mode_programs_mtime; |
|
277 |
|
time_t term_mtime; |
|
278 |
|
gboolean show_hidden; |
|
279 |
|
gboolean frozen; |
|
280 |
|
gboolean start_with_cwd; |
|
281 |
|
gboolean start_with_curr_dirs; |
|
282 |
|
gboolean use_scrollbars; |
|
283 |
|
gboolean invert_filter; |
|
284 |
|
gboolean save_position; |
|
285 |
|
gboolean fileselector; |
|
286 |
|
gint window_width; |
|
287 |
|
gint window_height; |
|
288 |
|
gint window_xpos; |
|
289 |
|
gint window_ypos; |
|
290 |
|
gint dir_history_max_length; |
|
291 |
|
gint command_history_max_length; |
|
292 |
|
GList *filetypes; |
|
293 |
|
GList *bookmarks; |
|
294 |
|
GList *tmp_marks; |
|
295 |
|
GList *user_commands; |
|
296 |
|
GList *programs; |
|
297 |
|
GList *terms; |
|
298 |
|
GList *command_mode_programs; |
|
299 |
|
ZvtTerm *current_term; |
|
300 |
|
gint term_count; |
|
301 |
|
gchar vi_clone[24]; |
|
302 |
|
gchar vi_command[48]; |
|
303 |
|
gchar man_program[128]; |
|
304 |
|
} |
|
305 |
|
Config; |
|
306 |
|
|
|
307 |
|
|
|
308 |
|
extern App app; |
|
309 |
|
extern Config cfg; |
|
310 |
|
extern FileView *curr_view; |
|
311 |
|
extern FileView *other_view; |
|
312 |
|
extern FileView *command_view; |
|
313 |
|
extern FileView *fileselector; |
|
314 |
|
extern FileView *filetypes_view; |
|
315 |
|
extern Bookmarks bk; |
|
316 |
|
extern TmpMarks tmark; |
|
317 |
|
extern Pattern pat; |
|
318 |
|
extern Command com; |
|
319 |
|
extern History history; |
|
320 |
|
extern Zvt zvt; |
|
321 |
|
|
|
322 |
|
|
|
323 |
|
extern Column all_columns[MAX_COLUMNS]; |
|
324 |
|
|
|
325 |
|
/* Colors */ |
|
326 |
|
extern GdkColor EXE_COLOR; |
|
327 |
|
extern GdkColor DIR_COLOR; |
|
328 |
|
extern GdkColor LNK_COLOR; |
|
329 |
|
extern GdkColor DEV_COLOR; |
|
330 |
|
extern GdkColor COL_COLOR; |
|
331 |
|
extern GdkColor TAG_COLOR; |
|
332 |
|
extern GdkColor SOCK_COLOR; |
|
333 |
|
extern GdkColor CLIST_COLOR; |
|
334 |
|
extern GdkColor DRAG_HILIGHT; |
|
335 |
|
extern GdkColor TAB_COLOR; |
|
336 |
|
|
|
337 |
|
|
|
338 |
|
/* Widget Utils */ |
|
339 |
|
extern GtkWidget *add_button (GtkWidget * box, gchar * label, gint fill, |
|
340 |
|
gint pad, GtkSignalFunc func, gpointer data); |
|
341 |
|
extern GtkWidget *add_label (GtkWidget * box, gchar * text, gfloat align, |
|
342 |
|
gint fill, gint pad); |
|
343 |
|
extern GtkWidget *add_entry (GtkWidget * box, gchar * init_text, gint fill, |
|
344 |
|
gint pad); |
|
345 |
|
extern GtkWidget *add_check_button (GtkWidget * box, gchar * label, |
|
346 |
|
gint state, gint fill, gint pad, |
|
347 |
|
GtkSignalFunc func, gpointer data); |
|
348 |
|
extern GtkWidget *add_radio_button (GtkWidget * box, gchar * label, |
|
349 |
|
GSList * group, gint fill, gint pad, |
|
350 |
|
GtkSignalFunc func, gpointer data); |
|
351 |
|
extern GtkWidget *add_hbox (GtkWidget * box, gint homogen, gint spacing, |
|
352 |
|
gint fill, gint pad); |
|
353 |
|
extern GtkWidget *add_vbox (GtkWidget * box, gint homogen, gint spacing, |
|
354 |
|
gint fill, gint pad); |
|
355 |
|
extern GtkWidget *add_sw (GtkWidget * box, GtkPolicyType h_policy, |
|
356 |
|
GtkPolicyType v_policy, gint fill, gint pad); |
|
357 |
|
extern GtkWidget *add_separator (GtkWidget * box, gint fill, gint pad); |
|
358 |
|
extern GtkWidget *add_table (GtkWidget * box, gint rows, gint cols, |
|
359 |
|
gint homogen, gint fill, gint pad); |
|
360 |
|
extern GtkWidget *add_label_to_table (GtkWidget * table, gchar * text, |
|
361 |
|
gfloat align, gint left, gint right, |
|
362 |
|
gint top, gint bottom); |
|
363 |
|
extern GtkWidget *add_entry_to_table (GtkWidget * table, gchar * init_text, |
|
364 |
|
gint left, gint right, gint top, |
|
365 |
|
gint bottom); |
|
366 |
|
extern GtkWidget *add_button_to_table (GtkWidget * table, gchar * label, |
|
367 |
|
GtkSignalFunc func, gpointer data, |
|
368 |
|
gint left, gint right, gint top, |
|
369 |
|
gint bottom); |
|
370 |
|
extern GtkWidget *add_check_button_to_table (GtkWidget * table, gchar * label, |
|
371 |
|
gint state, GtkSignalFunc func, |
|
372 |
|
gpointer data, gint left, |
|
373 |
|
gint right, gint top, |
|
374 |
|
gint bottom); |
|
375 |
|
extern GtkWidget *add_menu_item (GtkWidget * menu, gchar * label, |
|
376 |
|
GtkSignalFunc func, gpointer data); |
|
377 |
|
extern GtkWidget *add_menu_check_button (GtkWidget * menu, gchar * label, |
|
378 |
|
gboolean state, GtkSignalFunc func, |
|
379 |
|
gpointer data); |
|
380 |
|
extern GtkWidget *add_menu_separator (GtkWidget * menu); |
|
381 |
|
extern GtkWidget *add_submenu (GtkWidget * menu_bar, gchar * label, |
|
382 |
|
GtkWidget * menu); |
|
383 |
|
|
|
384 |
|
/* Utils */ |
|
385 |
|
extern void *duplicate (void *stuff, gint size); |
|
386 |
|
extern gchar *str_to_lower (gchar * string); |
|
387 |
|
extern void set_cursor_watch (); |
|
388 |
|
extern void set_cursor_normal (); |
|
389 |
|
extern gint S_ISEXE (mode_t mode); |
|
390 |
|
extern void free_clist_row_data (gpointer data); |
|
391 |
|
extern void my_glist_free (GList ** list); |
|
392 |
|
extern GList *string_glist_find (GList * list, gchar * search_text); |
|
393 |
|
extern void untag_all (FileView * view); |
|
394 |
|
extern GList *get_selection (FileView * view); |
|
395 |
|
extern GList *clist_get_selected_row_data (GtkWidget * clist); |
|
396 |
|
extern gint is_text (gchar * filename); |
|
397 |
|
extern void chomp (gchar * text); |
|
398 |
|
extern GString *expand_macros (gchar * text); |
|
399 |
|
extern GString *list_macros (gchar * text); |
|
400 |
|
extern void describe_file_size (gchar* buf, int buf_size, FileInfo* file_info); |
|
401 |
|
extern void describe_user_id (gchar* buf, int buf_size, FileInfo* file_info); |
|
402 |
|
extern void describe_group_id (gchar* buf, int buf_size, FileInfo* file_info); |
|
403 |
|
extern void show_file_properties(void); |
|
404 |
|
extern void show_full_file_properties(void); |
|
405 |
|
|
|
406 |
|
/* Filetypes */ |
|
407 |
|
extern gchar *get_programs_for_ext (gchar * ext); |
|
408 |
|
extern gchar *get_default_program_for_ext (gchar * ext); |
|
409 |
|
extern FileType *get_filetype_for_ext (gchar * ext); |
|
410 |
|
extern void add_filetype (gchar * ext, gchar * prog, gchar * desc); |
|
411 |
|
extern void create_filetype_command_clist(); |
|
412 |
|
|
|
413 |
|
/* User Commands */ |
|
414 |
|
extern void add_user_command (gchar * name, gchar * action); |
|
415 |
|
extern void load_user_commands(void); |
|
416 |
|
extern void file_list_key_press_cb(GtkWidget *widget, GdkEventKey *event, |
|
417 |
|
FileView *view); |
|
418 |
|
extern void fileselector_key_cb(GtkWidget *widget, GdkEventKey *event, |
|
419 |
|
gpointer data); |
|
420 |
|
extern void command_select_row_cb(GtkWidget *clist, gint row, gint col, |
|
421 |
|
GdkEvent *event, FileView *view); |
|
422 |
|
extern void program_select_row_cb(GtkWidget *clist, gint row, gint col, |
|
423 |
|
GdkEvent *event, FileView *view); |
|
424 |
|
|
|
425 |
|
/* Programs */ |
|
426 |
|
extern void add_program(gchar *name, gchar *action); |
|
427 |
|
extern void create_programs_menu(void); |
|
428 |
|
|
|
429 |
|
/* Command Mode Programs */ |
|
430 |
|
extern void add_command(gchar *name, gchar *action); |
|
431 |
|
extern void execute_command(gchar *action); |
|
432 |
|
|
|
433 |
|
/* Callbacks */ |
|
434 |
|
extern void permissions_cb (GtkWidget * widget); |
|
435 |
|
extern void ownership_cb (GtkWidget * widget); |
|
436 |
|
extern void file_info_cb (GtkWidget * widget); |
|
437 |
|
extern void sync_dirs_cb (GtkWidget * widget); |
|
438 |
|
extern void mkdir_cb (GtkWidget * widget); |
|
439 |
|
extern void toggle_tag_cb (); |
|
440 |
|
extern void command_cb (GtkWidget * widget); |
|
441 |
|
extern void configure_cb (GtkWidget * widget); |
|
442 |
|
extern void quit_cb (GtkWidget * widget); |
|
443 |
|
extern void toggle_tag_cb(); |
|
444 |
|
extern void find_next(FileView *view); |
|
445 |
|
extern void find_prev(FileView *view); |
|
446 |
|
extern void find_pattern(FileView *view); |
|
447 |
|
|
|
448 |
|
/* Window */ |
|
449 |
|
extern void status_bar_message (gchar * msg); |
|
450 |
|
extern void status_message (gchar * msg); |
|
451 |
|
extern void status_errno (); |
|
452 |
|
extern void create_main_window (); |
|
453 |
|
extern void recreate_main_window (); |
|
454 |
|
extern void search_mode(FileView *view); |
|
455 |
|
extern void command_mode(FileView *view); |
|
456 |
|
|
|
457 |
|
/* Term */ |
|
458 |
|
extern gint create_zterm(gchar *command, gboolean new_page); |
|
459 |
|
extern void write_to_term(ZvtTerm *term, gchar *message); |
|
460 |
|
extern void write_to_all_vi_terms(gchar *message); |
|
461 |
|
extern ZvtTerm * get_nth_zvt(GtkNotebook *notebook, gint n); |
|
462 |
|
extern ZvtTerm * get_focus_zvt(GtkNotebook *notebook, gint page_number); |
|
463 |
|
extern void update_all_terms(); |
|
464 |
|
extern GtkWidget *create_term_menu(ZvtTerm *term, gchar *command); |
|
465 |
|
extern void create_fileselector(GtkWidget *widget, gpointer data); |
|
466 |
|
|
|
467 |
|
/* Filelist */ |
|
468 |
|
extern void get_perm_string (gchar * string, gint len, mode_t mode); |
|
469 |
|
extern gint is_dir (FileInfo * info); |
|
470 |
|
extern void change_dir (FileView * view, gchar * path); |
|
471 |
|
extern gint name_sort (GtkCList * clist, gconstpointer row1, |
|
472 |
|
gconstpointer row2); |
|
473 |
|
extern gint size_sort (GtkCList * clist, gconstpointer row1, |
|
474 |
|
gconstpointer row2); |
|
475 |
|
extern gint date_sort (GtkCList * clist, gconstpointer row1, |
|
476 |
|
gconstpointer row2); |
|
477 |
|
extern gint perm_sort (GtkCList * clist, gconstpointer row1, |
|
478 |
|
gconstpointer row2); |
|
479 |
|
extern gint user_sort (GtkCList * clist, gconstpointer row1, |
|
480 |
|
gconstpointer row2); |
|
481 |
|
extern gint group_sort (GtkCList * clist, gconstpointer row1, |
|
482 |
|
gconstpointer row2); |
|
483 |
|
extern void sort_list (FileView * view, GtkCListCompareFunc, |
|
484 |
|
GtkSortType direction, gint col); |
|
485 |
|
extern void focus_on_row (FileView * view, gint row); |
|
486 |
|
extern void goto_row (GtkWidget * clist, gint row); |
|
487 |
|
extern void initialize_filters (FileView * view); |
|
488 |
|
extern void set_filter_menu_active (FileView * view); |
|
489 |
|
extern void remove_filters (FileView * view); |
|
490 |
|
extern void refresh_list (FileView * view); |
|
491 |
|
extern void load_dir_list (FileView * view); |
|
492 |
|
extern void exec_action (gchar * action); |
|
493 |
|
extern void handle_file (FileView * view); |
|
494 |
|
|
|
495 |
|
/*Bookmarks */ |
|
496 |
|
extern void add_bookmark(gchar *mark, gchar *dir, gchar *file); |
|
497 |
|
extern void add_tmp_mark(gchar *mark, gchar *dir, gchar *file); |
|
498 |
|
|
|
499 |
|
/* Menu */ |
|
500 |
|
extern GtkWidget *create_main_menu_bar (); |
|
501 |
|
extern void create_user_popup (); |
|
502 |
|
extern void create_special_popup_menu (); |
|
503 |
|
extern void create_user_command_menu (); |
|
504 |
|
extern void show_popup_menu (guint button, guint32 time); |
|
505 |
|
extern void show_special_popup_menu (guint button, guint32 time); |
|
506 |
|
extern void show_user_command_menu (guint button, guint32 time); |
|
507 |
|
extern void load_bookmarks (); |
|
508 |
|
extern void goto_mark(FileView *view); |
|
509 |
|
extern void set_mark(FileView *view); |
|
510 |
|
extern void set_menu_position(GtkMenu *menu, gint *x, gint *y, gpointer data); |
|
511 |
|
extern void create_history_menu(FileView *view); |
|
512 |
|
extern void bookmark_key_cb(GtkWidget *widget, GdkEventKey *event, FileView *view); |
|
513 |
|
extern void create_command_mode_menu(void); |
|
514 |
|
extern void create_delc_menu(void); |
|
515 |
|
extern void create_buffer_menu(void); |
|
516 |
|
|
|
517 |
|
/* File Ops */ |
|
518 |
|
extern gint file_copy (gchar * src, gchar * dest); |
|
519 |
|
extern gint file_move (gchar * src, gchar * dest); |
|
520 |
|
extern gint file_delete (gchar * file); |
|
521 |
|
extern gint file_chmod (gchar * path, gchar * mode, gboolean recurse_dirs); |
|
522 |
|
extern gint file_chown (gchar * path, uid_t owner_id, gid_t group_id, |
|
523 |
|
gboolean recurse_dirs); |
|
524 |
|
extern gint file_mkdir (gchar * path); |
|
525 |
|
extern gint file_symlink (gchar * src, gchar * dest); |
|
526 |
|
extern gint file_exec (gchar * command); |
|
527 |
|
extern gint exec_in_xterm (gchar * command); |
|
528 |
|
extern gint pipe_and_capture_output (gchar ** args); |
|
529 |
|
extern gint pipe_and_capture_output_threaded (gchar * command); |
|
530 |
|
extern void block_signal(void); |
|
531 |
|
extern void unblock_signal(void); |
|
532 |
|
|
|
533 |
|
/* Dialogs */ |
|
534 |
|
extern void create_copy_as_dialog (); |
|
535 |
|
extern void create_rename_dialog (); |
|
536 |
|
extern void create_mkdir_dialog (); |
|
537 |
|
extern void create_symlink_as_dialog (); |
|
538 |
|
extern void create_permissions_dialog (FileInfo * info); |
|
539 |
|
extern void create_ownership_dialog (FileInfo * info); |
|
540 |
|
extern void create_confirm_del_dialog (gchar * filename, guint * answer); |
|
541 |
|
extern void create_confirm_overwrite_dialog (gchar * filename, |
|
542 |
|
guint * answer); |
|
543 |
|
extern void create_command_dialog (); |
|
544 |
|
extern void create_filetype_dialog (FileType * ft, gboolean write_file); |
|
545 |
|
extern void create_init_filetype_dialog (gchar * ext, GtkWidget * clist); |
|
546 |
|
extern void create_open_with_dialog (); |
|
547 |
|
extern void create_config_dialog (); |
|
548 |
|
extern void create_add_ext_dialog (); |
|
549 |
|
extern void create_file_info_dialog (); |
|
550 |
|
extern void create_view_file_dialog (gchar * filename); |
|
551 |
|
extern void create_filename_filter_dialog (FileView * view); |
|
552 |
|
extern void create_size_filter_dialog (FileView * view); |
|
553 |
|
extern void create_date_filter_dialog (FileView * view); |
|
554 |
|
extern void create_glob_dialog (); |
|
555 |
|
extern void create_copy_here_dialog (); |
|
556 |
|
extern void create_rename_ext_dialog (); |
|
557 |
|
extern void create_user_prompt (gchar * prompt, gchar * init_text, |
|
558 |
|
gchar ** string); |
|
559 |
|
extern void create_user_command_dialog (UserCommand ** command); |
|
560 |
|
extern void create_programs_dialog(Programs **program); |
|
561 |
|
extern void create_confirm_dialog (gchar * label_text, guint * answer); |
|
562 |
|
extern void create_for_each_dialog (); |
|
563 |
|
extern void create_user_popup (); |
|
564 |
|
extern void create_filetype_popup(void); |
|
565 |
|
extern void create_error_dialog(gchar * label_text); |
|
566 |
|
|
|
567 |
|
|
|
568 |
|
/* Config Functions */ |
|
569 |
|
extern void set_config_dir (); |
|
570 |
|
extern void write_filetypes_file (); |
|
571 |
|
extern void write_bookmarks_file (); |
|
572 |
|
extern void write_user_commands_file (); |
|
573 |
|
extern void write_config_file (); |
|
574 |
|
extern void write_programs_file(); |
|
575 |
|
extern void write_command_mode_file(); |
|
576 |
|
extern void write_term_file(); |
|
577 |
|
extern gboolean read_filetypes_file (); |
|
578 |
|
extern gboolean read_bookmarks_file (); |
|
579 |
|
extern gboolean read_user_commands_file (); |
|
580 |
|
extern gboolean read_config_file (); |
|
581 |
|
extern gboolean read_programs_file(); |
|
582 |
|
extern gboolean read_command_mode_file(); |
|
583 |
|
extern gboolean read_term_file(); |
|
584 |
|
|
|
585 |
|
#endif /* __VIDE_H__ */ |
| File src/window.c added (mode: 100644) (index 0000000..d08e05c) |
|
1 |
|
/* vide |
|
2 |
|
* Copyright (C) 2000 Ken Steen. |
|
3 |
|
* |
|
4 |
|
* This program is free software; you can redistribute it and/or modify |
|
5 |
|
* it under the terms of the GNU General Public License as published by |
|
6 |
|
* the Free Software Foundation; either version 2 of the License, or |
|
7 |
|
* (at your option) any later version. |
|
8 |
|
* |
|
9 |
|
* This program is distributed in the hope that it will be useful, |
|
10 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
|
* GNU General Public License for more details. |
|
13 |
|
* |
|
14 |
|
* You should have received a copy of the GNU General Public License |
|
15 |
|
* along with this program; if not, write to the Free Software |
|
16 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
|
*/ |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
#include <glob.h> |
|
21 |
|
#include <stdio.h> |
|
22 |
|
#include <unistd.h> |
|
23 |
|
#include <stdlib.h> |
|
24 |
|
#include <string.h> |
|
25 |
|
#include <errno.h> |
|
26 |
|
#include <pwd.h> |
|
27 |
|
#include <sys/types.h> |
|
28 |
|
#include <time.h> |
|
29 |
|
#include "vide.h" |
|
30 |
|
#include <gdk/gdkx.h> |
|
31 |
|
#include <gnome.h> |
|
32 |
|
#include "icon_dirparent.xpm" |
|
33 |
|
|
|
34 |
|
struct sentinel { |
|
35 |
|
gint d; |
|
36 |
|
gint g; |
|
37 |
|
}sentinel; |
|
38 |
|
|
|
39 |
|
static GtkTargetEntry target_table[] = { |
|
40 |
|
{"text/plain", 0, 0} |
|
41 |
|
}; |
|
42 |
|
|
|
43 |
|
static guint n_targets = sizeof (target_table) / sizeof (target_table[0]); |
|
44 |
|
|
|
45 |
|
void |
|
46 |
|
notebook_cb(GtkNotebook *notebook, GtkNotebookPage *page, |
|
47 |
|
gint page_num, gpointer data) |
|
48 |
|
{ |
|
49 |
|
|
|
50 |
|
if(page_num > 0) |
|
51 |
|
{ |
|
52 |
|
GtkWidget *label; |
|
53 |
|
GdkColor color = TAB_COLOR; |
|
54 |
|
GtkStyle *defstyle; |
|
55 |
|
GtkStyle *style = gtk_style_new(); |
|
56 |
|
ZvtTerm *term; |
|
57 |
|
gint a = 1; |
|
58 |
|
gchar *title; |
|
59 |
|
gchar *text; |
|
60 |
|
gchar buf[128]; |
|
61 |
|
|
|
62 |
|
|
|
63 |
|
defstyle = gtk_widget_get_default_style(); |
|
64 |
|
style = gtk_style_copy(defstyle); |
|
65 |
|
style->fg[0] = color; |
|
66 |
|
|
|
67 |
|
/* reset the page numbers in case a page was deleted when a |
|
68 |
|
* terminal was detached. |
|
69 |
|
*/ |
|
70 |
|
while(gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), a)) |
|
71 |
|
{ |
|
72 |
|
label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
73 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), a)); |
|
74 |
|
gtk_label_get(GTK_LABEL(label), &text); |
|
75 |
|
title = strstr(text, " ") +1; |
|
76 |
|
if(a +1 == 10) |
|
77 |
|
g_snprintf(buf, sizeof(buf), "%d %s", 0, title); |
|
78 |
|
else |
|
79 |
|
g_snprintf(buf, sizeof(buf), "%d %s", a +1, title); |
|
80 |
|
gtk_label_set_text(GTK_LABEL(label), buf); |
|
81 |
|
a++; |
|
82 |
|
} |
|
83 |
|
a = 1; |
|
84 |
|
|
|
85 |
|
term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page_num); |
|
86 |
|
if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(term)))) |
|
87 |
|
{ |
|
88 |
|
|
|
89 |
|
/* reset all pages to normal */ |
|
90 |
|
while((term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), a))) |
|
91 |
|
{ |
|
92 |
|
label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
93 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), a)); |
|
94 |
|
gtk_label_get(GTK_LABEL(label), &text); |
|
95 |
|
title = strstr(text, " ") +1; |
|
96 |
|
if(a +1 == 10) |
|
97 |
|
g_snprintf(buf, sizeof(buf), "%d %s", 0, title); |
|
98 |
|
else |
|
99 |
|
g_snprintf(buf, sizeof(buf), "%d %s", a +1, title); |
|
100 |
|
gtk_label_set_text(GTK_LABEL(label), buf); |
|
101 |
|
|
|
102 |
|
gtk_widget_set_style(GTK_WIDGET(label), defstyle); |
|
103 |
|
gtk_object_set_data(GTK_OBJECT(term), "page_number", |
|
104 |
|
GINT_TO_POINTER(a)); |
|
105 |
|
a++; |
|
106 |
|
|
|
107 |
|
} |
|
108 |
|
/* highlight current buffer */ |
|
109 |
|
label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook), |
|
110 |
|
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), page_num)); |
|
111 |
|
gtk_widget_set_style(GTK_WIDGET(label), style); |
|
112 |
|
cfg.current_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page_num); |
|
113 |
|
} |
|
114 |
|
} |
|
115 |
|
else |
|
116 |
|
{ |
|
117 |
|
goto_row(command_view->clist, 0); |
|
118 |
|
gtk_widget_grab_focus (curr_view->clist); |
|
119 |
|
show_file_properties(); |
|
120 |
|
/* |
|
121 |
|
|
|
122 |
|
if(curr_view->row >= GTK_CLIST(curr_view->clist)->rows) |
|
123 |
|
focus_on_row(curr_view, 0); |
|
124 |
|
else |
|
125 |
|
{ |
|
126 |
|
focus_on_row(curr_view, curr_view->row); |
|
127 |
|
} |
|
128 |
|
gtk_widget_grab_focus (curr_view->clist); |
|
129 |
|
*/ |
|
130 |
|
} |
|
131 |
|
} |
|
132 |
|
|
|
133 |
|
static void |
|
134 |
|
toggle_command_style () |
|
135 |
|
{ |
|
136 |
|
GtkStyle *style; |
|
137 |
|
|
|
138 |
|
style = gtk_style_new (); |
|
139 |
|
style->bg[GTK_STATE_NORMAL] = COL_COLOR; |
|
140 |
|
if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (command_view->clist))) |
|
141 |
|
{ |
|
142 |
|
gtk_widget_set_style (GTK_CLIST (command_view->clist)->column[0].button, |
|
143 |
|
style); |
|
144 |
|
} |
|
145 |
|
else |
|
146 |
|
gtk_widget_restore_default_style (GTK_CLIST (command_view->clist)-> |
|
147 |
|
column[0].button); |
|
148 |
|
} |
|
149 |
|
|
|
150 |
|
|
|
151 |
|
static void |
|
152 |
|
switch_views () |
|
153 |
|
{ |
|
154 |
|
gint i; |
|
155 |
|
gint num_cols; |
|
156 |
|
GtkStyle *style; |
|
157 |
|
FileView *temp; |
|
158 |
|
|
|
159 |
|
temp = other_view; |
|
160 |
|
other_view = curr_view; |
|
161 |
|
curr_view = temp; |
|
162 |
|
|
|
163 |
|
gtk_signal_emit_by_name (GTK_OBJECT (other_view->clist), "end-selection"); |
|
164 |
|
gtk_clist_unselect_all (GTK_CLIST (other_view->clist)); |
|
165 |
|
|
|
166 |
|
style = gtk_style_new (); |
|
167 |
|
style->bg[GTK_STATE_NORMAL] = COL_COLOR; |
|
168 |
|
num_cols = GTK_CLIST (curr_view->clist)->columns; |
|
169 |
|
for (i = 0; i < num_cols; i++) |
|
170 |
|
{ |
|
171 |
|
gtk_widget_set_style (GTK_CLIST (curr_view->clist)->column[i].button, |
|
172 |
|
style); |
|
173 |
|
gtk_widget_set_style (curr_view->sort_arrows[i], style); |
|
174 |
|
} |
|
175 |
|
for (i = 0; i < num_cols; i++) |
|
176 |
|
{ |
|
177 |
|
gtk_widget_restore_default_style (GTK_CLIST (other_view->clist)-> |
|
178 |
|
column[i].button); |
|
179 |
|
gtk_widget_restore_default_style (other_view->sort_arrows[i]); |
|
180 |
|
} |
|
181 |
|
|
|
182 |
|
chdir (curr_view->dir); |
|
183 |
|
} |
|
184 |
|
|
|
185 |
|
|
|
186 |
|
static gboolean |
|
187 |
|
command_row_cb (FileView * command_view) |
|
188 |
|
{ |
|
189 |
|
GList *tmp; |
|
190 |
|
gchar buf[1024]; |
|
191 |
|
|
|
192 |
|
for (tmp = cfg.user_commands; tmp != NULL; tmp = tmp->next) |
|
193 |
|
{ |
|
194 |
|
gchar *command_text; |
|
195 |
|
gchar *file_name; |
|
196 |
|
GString *expanded_com; |
|
197 |
|
UserCommand *command = tmp->data; |
|
198 |
|
gtk_clist_get_text (GTK_CLIST (command_view->clist), |
|
199 |
|
command_view->row, 0, &command_text); |
|
200 |
|
gtk_clist_get_text (GTK_CLIST (curr_view->clist), |
|
201 |
|
curr_view->row, 0, &file_name); |
|
202 |
|
if (!strcmp (command_text, command->name)) |
|
203 |
|
{ |
|
204 |
|
expanded_com = expand_macros (command->action); |
|
205 |
|
if(expanded_com == NULL) |
|
206 |
|
{ |
|
207 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
208 |
|
toggle_command_style(); |
|
209 |
|
goto_row(command_view->clist, 0); |
|
210 |
|
g_string_free(expanded_com, TRUE); |
|
211 |
|
} |
|
212 |
|
else if(!g_strncasecmp("!", expanded_com->str, 1)) |
|
213 |
|
{ |
|
214 |
|
g_snprintf(buf, sizeof(buf), ":%s", expanded_com->str); |
|
215 |
|
execute_command(buf); |
|
216 |
|
g_string_free(expanded_com, TRUE); |
|
217 |
|
return TRUE; |
|
218 |
|
} |
|
219 |
|
else |
|
220 |
|
{ |
|
221 |
|
pipe_and_capture_output_threaded(expanded_com->str); |
|
222 |
|
g_string_free(expanded_com, TRUE); |
|
223 |
|
} |
|
224 |
|
} |
|
225 |
|
} |
|
226 |
|
return FALSE; |
|
227 |
|
} |
|
228 |
|
|
|
229 |
|
void |
|
230 |
|
load_user_commands (void) |
|
231 |
|
{ |
|
232 |
|
GList *tmp; |
|
233 |
|
|
|
234 |
|
|
|
235 |
|
for (tmp = cfg.user_commands; tmp != NULL; tmp = tmp->next) |
|
236 |
|
{ |
|
237 |
|
gchar *name_buf[NAME_MAX]; |
|
238 |
|
UserCommand *command = tmp->data; |
|
239 |
|
|
|
240 |
|
*name_buf = command->name; |
|
241 |
|
gtk_clist_append (GTK_CLIST (command_view->clist), name_buf); |
|
242 |
|
|
|
243 |
|
} |
|
244 |
|
} |
|
245 |
|
|
|
246 |
|
void |
|
247 |
|
mouse_command_cb(GtkWidget *clist, gint row, gint col, GdkEvent *event, FileView *view) |
|
248 |
|
{ |
|
249 |
|
if (event) |
|
250 |
|
{ |
|
251 |
|
switch (event->type) |
|
252 |
|
{ |
|
253 |
|
case GDK_2BUTTON_PRESS: |
|
254 |
|
command_row_cb(command_view); |
|
255 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
256 |
|
goto_row(command_view->clist, 0); |
|
257 |
|
|
|
258 |
|
return; |
|
259 |
|
break; |
|
260 |
|
|
|
261 |
|
default: |
|
262 |
|
break; |
|
263 |
|
} |
|
264 |
|
} |
|
265 |
|
} |
|
266 |
|
|
|
267 |
|
void |
|
268 |
|
command_select_row_cb (GtkWidget * clist, |
|
269 |
|
gint row, gint col, GdkEvent * event, FileView * view) |
|
270 |
|
{ |
|
271 |
|
gchar status_text[128]; |
|
272 |
|
view->row = row; |
|
273 |
|
|
|
274 |
|
if (command_view->row == 0) |
|
275 |
|
{ |
|
276 |
|
g_snprintf (status_text, sizeof (status_text), "No Commands Selected"); |
|
277 |
|
gtk_label_set_text (GTK_LABEL (app.status_bar), status_text); |
|
278 |
|
} |
|
279 |
|
else |
|
280 |
|
{ |
|
281 |
|
GList *tmp; |
|
282 |
|
for (tmp = cfg.user_commands; tmp != NULL; tmp = tmp->next) |
|
283 |
|
{ |
|
284 |
|
gchar *command_text; |
|
285 |
|
gchar *file_name; |
|
286 |
|
GString *expanded_com; |
|
287 |
|
UserCommand *command = tmp->data; |
|
288 |
|
gtk_clist_get_text (GTK_CLIST (command_view->clist), |
|
289 |
|
command_view->row, 0, &command_text); |
|
290 |
|
gtk_clist_get_text (GTK_CLIST (curr_view->clist), |
|
291 |
|
curr_view->row, 0, &file_name); |
|
292 |
|
if (!strcmp (command_text, command->name)) |
|
293 |
|
{ |
|
294 |
|
expanded_com = list_macros (command->action); |
|
295 |
|
|
|
296 |
|
g_snprintf (status_text, sizeof (status_text), |
|
297 |
|
"%s", expanded_com->str); |
|
298 |
|
gtk_label_set_text (GTK_LABEL (app.status_bar), status_text); |
|
299 |
|
g_string_free(expanded_com, TRUE); |
|
300 |
|
} |
|
301 |
|
} |
|
302 |
|
} |
|
303 |
|
} |
|
304 |
|
|
|
305 |
|
static void |
|
306 |
|
select_row_cb (GtkWidget * clist, |
|
307 |
|
gint row, gint col, GdkEvent * event, FileView * view) |
|
308 |
|
{ |
|
309 |
|
view->row = row; |
|
310 |
|
|
|
311 |
|
if (curr_view != view) |
|
312 |
|
switch_views (); |
|
313 |
|
|
|
314 |
|
/* |
|
315 |
|
g_snprintf (status_text, sizeof (status_text), |
|
316 |
|
"%d of %d files selected", |
|
317 |
|
g_list_length (GTK_CLIST (view->clist)->selection), |
|
318 |
|
GTK_CLIST (view->clist)->rows); |
|
319 |
|
gtk_label_set_text (GTK_LABEL (app.status_bar), status_text); |
|
320 |
|
*/ |
|
321 |
|
|
|
322 |
|
show_file_properties(); |
|
323 |
|
|
|
324 |
|
if (event) |
|
325 |
|
{ |
|
326 |
|
switch (event->type) |
|
327 |
|
{ |
|
328 |
|
case GDK_2BUTTON_PRESS: |
|
329 |
|
handle_file (view); |
|
330 |
|
return; |
|
331 |
|
break; |
|
332 |
|
|
|
333 |
|
default: |
|
334 |
|
break; |
|
335 |
|
} |
|
336 |
|
} |
|
337 |
|
} |
|
338 |
|
|
|
339 |
|
|
|
340 |
|
void |
|
341 |
|
window_key_press_cb (GtkWidget * widget, GdkEventKey * event) |
|
342 |
|
{ |
|
343 |
|
if(event->state & GDK_CONTROL_MASK) |
|
344 |
|
{ |
|
345 |
|
switch(event->keyval) |
|
346 |
|
{ |
|
347 |
|
case 'c': |
|
348 |
|
{ |
|
349 |
|
sentinel.g = 0; |
|
350 |
|
sentinel.d = 0; |
|
351 |
|
break; |
|
352 |
|
} |
|
353 |
|
default: |
|
354 |
|
break; |
|
355 |
|
} |
|
356 |
|
|
|
357 |
|
} |
|
358 |
|
|
|
359 |
|
if (event->state & GDK_MOD1_MASK) |
|
360 |
|
{ |
|
361 |
|
switch(event->keyval) |
|
362 |
|
{ |
|
363 |
|
case 'q': |
|
364 |
|
quit_cb(NULL); |
|
365 |
|
break; |
|
366 |
|
default: |
|
367 |
|
break; |
|
368 |
|
} |
|
369 |
|
} |
|
370 |
|
} |
|
371 |
|
|
|
372 |
|
/* This puts the popup menu over the current clist */ |
|
373 |
|
void |
|
374 |
|
set_menu_position(GtkMenu *menu, gint *x, gint *y, gpointer data) |
|
375 |
|
{ |
|
376 |
|
gdk_window_get_origin((curr_view->clist)->window, x, y); |
|
377 |
|
*x += 2; |
|
378 |
|
*y += 2; |
|
379 |
|
} |
|
380 |
|
|
|
381 |
|
void |
|
382 |
|
mouse_cb(GtkWidget *widget, GdkEventButton *event, FileView *view) |
|
383 |
|
{ |
|
384 |
|
if(view == command_view) |
|
385 |
|
return; |
|
386 |
|
|
|
387 |
|
if(event->button == 3) |
|
388 |
|
{ |
|
389 |
|
int x, y, row, column; |
|
390 |
|
GdkModifierType state; |
|
391 |
|
/* |
|
392 |
|
* there must be an easier way to get the right mouse click to select |
|
393 |
|
* a row |
|
394 |
|
*/ |
|
395 |
|
|
|
396 |
|
gdk_window_get_pointer(event->window, &x, &y, &state); |
|
397 |
|
gtk_clist_get_selection_info(GTK_CLIST(view->clist), x, y, &row, &column); |
|
398 |
|
gtk_clist_unselect_all(GTK_CLIST(view->clist)); |
|
399 |
|
gtk_clist_select_row(GTK_CLIST(view->clist), row, column); |
|
400 |
|
|
|
401 |
|
create_filetype_popup(); |
|
402 |
|
gtk_menu_popup(GTK_MENU(app.filetype_popup), NULL, NULL, |
|
403 |
|
set_menu_position, NULL, event->type, event->time); |
|
404 |
|
} |
|
405 |
|
} |
|
406 |
|
|
|
407 |
|
|
|
408 |
|
void |
|
409 |
|
file_list_key_press_cb (GtkWidget * widget, |
|
410 |
|
GdkEventKey * event, FileView * view) |
|
411 |
|
{ |
|
412 |
|
|
|
413 |
|
/* Ctrl+<letter> Shortcuts */ |
|
414 |
|
if (event->state & GDK_CONTROL_MASK) |
|
415 |
|
{ |
|
416 |
|
|
|
417 |
|
switch (event->keyval) |
|
418 |
|
{ |
|
419 |
|
case 'f': |
|
420 |
|
event->state = 0; |
|
421 |
|
event->keyval = GDK_Page_Down; |
|
422 |
|
break; |
|
423 |
|
case 'b': |
|
424 |
|
event->state = 0; |
|
425 |
|
event->keyval = GDK_Page_Up; |
|
426 |
|
break; |
|
427 |
|
case 'c': |
|
428 |
|
sentinel.d = 0; |
|
429 |
|
sentinel.g = 0; |
|
430 |
|
break; |
|
431 |
|
/* Ctrl g shows file properties on status bar - patch by Sergei Gnezdov */ |
|
432 |
|
case 'g': |
|
433 |
|
show_full_file_properties(); |
|
434 |
|
break; |
|
435 |
|
|
|
436 |
|
default: |
|
437 |
|
break; |
|
438 |
|
} |
|
439 |
|
|
|
440 |
|
if(event->keyval >= '0' && event->keyval <= '9') |
|
441 |
|
{ |
|
442 |
|
ZvtTerm *focus_term; |
|
443 |
|
int page = event->keyval; |
|
444 |
|
|
|
445 |
|
if(page == '0') |
|
446 |
|
{ |
|
447 |
|
page = 9; |
|
448 |
|
} |
|
449 |
|
else |
|
450 |
|
{ |
|
451 |
|
page = page -49; |
|
452 |
|
} |
|
453 |
|
|
|
454 |
|
gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), page); |
|
455 |
|
focus_term = get_focus_zvt(GTK_NOTEBOOK(app.notebook), page); |
|
456 |
|
gtk_widget_grab_focus(GTK_WIDGET(focus_term)); |
|
457 |
|
} |
|
458 |
|
|
|
459 |
|
return; |
|
460 |
|
} |
|
461 |
|
|
|
462 |
|
/* Alt+<letter> Shortcuts */ |
|
463 |
|
if (event->state & GDK_MOD1_MASK) |
|
464 |
|
{ |
|
465 |
|
switch (event->keyval) |
|
466 |
|
{ |
|
467 |
|
case 'B': |
|
468 |
|
case 'b': |
|
469 |
|
gtk_signal_emit_by_name (GTK_OBJECT (app.bookmark_menu_item), |
|
470 |
|
"activate-item"); |
|
471 |
|
break; |
|
472 |
|
|
|
473 |
|
case 'T': |
|
474 |
|
case 't': |
|
475 |
|
gtk_signal_emit_by_name(GTK_OBJECT(app.tools_menu_item), |
|
476 |
|
"activate-item"); |
|
477 |
|
break; |
|
478 |
|
case 'V': |
|
479 |
|
case 'v': |
|
480 |
|
gtk_signal_emit_by_name (GTK_OBJECT (app.vide_menu_item), |
|
481 |
|
"activate-item"); |
|
482 |
|
break; |
|
483 |
|
case 'O': |
|
484 |
|
case 'o': |
|
485 |
|
gtk_signal_emit_by_name (GTK_OBJECT (app.options_menu_item), |
|
486 |
|
"activate-item"); |
|
487 |
|
break; |
|
488 |
|
case 'h': |
|
489 |
|
gtk_signal_emit_by_name (GTK_OBJECT (app.help_menu_item), |
|
490 |
|
"activate-item"); |
|
491 |
|
break; |
|
492 |
|
case 'C': |
|
493 |
|
case 'c': |
|
494 |
|
gtk_signal_emit_by_name(GTK_OBJECT(app.command_menu_item), |
|
495 |
|
"activate-item"); |
|
496 |
|
break; |
|
497 |
|
default: |
|
498 |
|
break; |
|
499 |
|
} |
|
500 |
|
return; |
|
501 |
|
} |
|
502 |
|
|
|
503 |
|
/* Other Shortcuts */ |
|
504 |
|
switch (event->keyval) |
|
505 |
|
{ |
|
506 |
|
case GDK_Return: |
|
507 |
|
if (GTK_WIDGET_HAS_FOCUS (command_view->clist)) |
|
508 |
|
{ |
|
509 |
|
gboolean uses_zterm; |
|
510 |
|
|
|
511 |
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (command_view->clist), |
|
512 |
|
"key_press_event"); |
|
513 |
|
gtk_widget_grab_focus(curr_view->clist); |
|
514 |
|
gtk_widget_restore_default_style(GTK_CLIST |
|
515 |
|
(command_view->clist)->column[0].button); |
|
516 |
|
|
|
517 |
|
uses_zterm = command_row_cb(command_view); |
|
518 |
|
|
|
519 |
|
if(!uses_zterm) |
|
520 |
|
{ |
|
521 |
|
goto_row(command_view->clist, 0); |
|
522 |
|
show_file_properties(); |
|
523 |
|
} |
|
524 |
|
return; |
|
525 |
|
break; |
|
526 |
|
} |
|
527 |
|
else |
|
528 |
|
{ |
|
529 |
|
handle_file(view); |
|
530 |
|
break; |
|
531 |
|
} |
|
532 |
|
|
|
533 |
|
case GDK_Tab: |
|
534 |
|
case GDK_space: |
|
535 |
|
if (GTK_WIDGET_HAS_FOCUS (command_view->clist)) |
|
536 |
|
{ |
|
537 |
|
toggle_command_style (); |
|
538 |
|
goto_row (command_view->clist, 0); |
|
539 |
|
|
|
540 |
|
if(other_view->row >= GTK_CLIST(other_view->clist)->rows) |
|
541 |
|
{ |
|
542 |
|
focus_on_row(other_view, 0); |
|
543 |
|
} |
|
544 |
|
else |
|
545 |
|
focus_on_row(other_view, other_view->row); |
|
546 |
|
gtk_widget_grab_focus (curr_view->clist); |
|
547 |
|
|
|
548 |
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (command_view->clist), |
|
549 |
|
"key_press_event"); |
|
550 |
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (app.main_window), |
|
551 |
|
"key_press_event"); |
|
552 |
|
} |
|
553 |
|
else |
|
554 |
|
{ |
|
555 |
|
toggle_command_style (); |
|
556 |
|
goto_row (command_view->clist, 0); |
|
557 |
|
gtk_widget_grab_focus (command_view->clist); |
|
558 |
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (curr_view->clist), |
|
559 |
|
"key_press_event"); |
|
560 |
|
gtk_signal_emit_stop_by_name (GTK_OBJECT (app.main_window), |
|
561 |
|
"key_press_event"); |
|
562 |
|
} |
|
563 |
|
return; |
|
564 |
|
break; |
|
565 |
|
|
|
566 |
|
case GDK_Insert: |
|
567 |
|
toggle_tag_cb (); |
|
568 |
|
break; |
|
569 |
|
|
|
570 |
|
default: |
|
571 |
|
break; |
|
572 |
|
} |
|
573 |
|
|
|
574 |
|
/* code to mimic vi key bindings */ |
|
575 |
|
if ((event->keyval < 0x100) |
|
576 |
|
&& (event->state == 0 || event->state & GDK_SHIFT_MASK |
|
577 |
|
|| event->state & GDK_MOD2_MASK)) |
|
578 |
|
{ |
|
579 |
|
/* code to mimic vi key bindings |
|
580 |
|
* |
|
581 |
|
* j = move up in the list |
|
582 |
|
* k = move down the list |
|
583 |
|
* l = move right in the list |
|
584 |
|
* h = move left in the list |
|
585 |
|
* u = Up directory |
|
586 |
|
* gg = goto top of list |
|
587 |
|
* G = goto bottom of list |
|
588 |
|
*/ |
|
589 |
|
switch (event->keyval) |
|
590 |
|
{ |
|
591 |
|
case 'j': |
|
592 |
|
event->keyval = GDK_Down; |
|
593 |
|
break; |
|
594 |
|
case 'k': |
|
595 |
|
event->keyval = GDK_Up; |
|
596 |
|
break; |
|
597 |
|
case 'G': |
|
598 |
|
goto_row (widget, GTK_CLIST (widget)->rows - 1); |
|
599 |
|
break; |
|
600 |
|
case 'g': |
|
601 |
|
{ |
|
602 |
|
if(sentinel.g) |
|
603 |
|
{ |
|
604 |
|
sentinel.g = 0; |
|
605 |
|
goto_row (widget, 0); |
|
606 |
|
break; |
|
607 |
|
} |
|
608 |
|
else |
|
609 |
|
{ |
|
610 |
|
sentinel.g = 1; |
|
611 |
|
break; |
|
612 |
|
} |
|
613 |
|
} |
|
614 |
|
|
|
615 |
|
case 'd': |
|
616 |
|
{ |
|
617 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
618 |
|
{ |
|
619 |
|
sentinel.d = 0; |
|
620 |
|
break; |
|
621 |
|
} |
|
622 |
|
if(sentinel.d) |
|
623 |
|
{ |
|
624 |
|
gchar buf[PATH_MAX]; |
|
625 |
|
gchar *file; |
|
626 |
|
gtk_clist_get_text(GTK_CLIST(view->clist), view->row, |
|
627 |
|
0, &file); |
|
628 |
|
g_snprintf(buf, sizeof(buf), "mv -f \"%s\" %s/", file, cfg.trash); |
|
629 |
|
pipe_and_capture_output_threaded(buf); |
|
630 |
|
gtk_clist_remove(GTK_CLIST(view->clist), view->row); |
|
631 |
|
focus_on_row(view, |
|
632 |
|
view->row < GTK_CLIST(view->clist)->rows |
|
633 |
|
? view->row |
|
634 |
|
: view->row -1); |
|
635 |
|
sentinel.d = 0; |
|
636 |
|
break; |
|
637 |
|
} |
|
638 |
|
else |
|
639 |
|
{ |
|
640 |
|
sentinel.d = 1; |
|
641 |
|
break; |
|
642 |
|
} |
|
643 |
|
} |
|
644 |
|
case 'l': |
|
645 |
|
event->keyval = GDK_Right; |
|
646 |
|
break; |
|
647 |
|
case 'u': |
|
648 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
649 |
|
break; |
|
650 |
|
change_dir(view, ".."); |
|
651 |
|
break; |
|
652 |
|
case 'h': |
|
653 |
|
event->keyval = GDK_Left; |
|
654 |
|
return; |
|
655 |
|
break; |
|
656 |
|
case 'p': |
|
657 |
|
create_filetype_popup(); |
|
658 |
|
gtk_menu_popup(GTK_MENU(app.filetype_popup), NULL, NULL, |
|
659 |
|
set_menu_position, NULL, event->type, event->time); |
|
660 |
|
break; |
|
661 |
|
case 'P': |
|
662 |
|
create_programs_menu(); |
|
663 |
|
gtk_menu_popup(GTK_MENU(app.programs_menu), NULL, NULL, |
|
664 |
|
set_menu_position, NULL, event->type, event->time); |
|
665 |
|
break; |
|
666 |
|
case 't': |
|
667 |
|
toggle_tag_cb(); |
|
668 |
|
break; |
|
669 |
|
case 'v': |
|
670 |
|
/* visual mode to select multiple files */ |
|
671 |
|
break; |
|
672 |
|
case 'm': |
|
673 |
|
if (GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
674 |
|
break; |
|
675 |
|
event->keyval = 0; |
|
676 |
|
set_mark(view); |
|
677 |
|
break; |
|
678 |
|
case GDK_apostrophe: |
|
679 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
680 |
|
break; |
|
681 |
|
event->keyval = 0; |
|
682 |
|
goto_mark(view); |
|
683 |
|
break; |
|
684 |
|
case 'n': |
|
685 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
686 |
|
break; |
|
687 |
|
if(view->glob == NULL) |
|
688 |
|
break; |
|
689 |
|
find_next(view); |
|
690 |
|
break; |
|
691 |
|
case 'N': |
|
692 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
693 |
|
break; |
|
694 |
|
if(view->glob == NULL) |
|
695 |
|
break; |
|
696 |
|
find_prev(view); |
|
697 |
|
break; |
|
698 |
|
case ':': |
|
699 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
700 |
|
break; |
|
701 |
|
else |
|
702 |
|
{ |
|
703 |
|
command_mode(view); |
|
704 |
|
break; |
|
705 |
|
} |
|
706 |
|
case '/': |
|
707 |
|
if(GTK_WIDGET_HAS_FOCUS(command_view->clist)) |
|
708 |
|
break; |
|
709 |
|
else |
|
710 |
|
{ |
|
711 |
|
search_mode(view); |
|
712 |
|
break; |
|
713 |
|
} |
|
714 |
|
default: |
|
715 |
|
break; |
|
716 |
|
} |
|
717 |
|
} |
|
718 |
|
} |
|
719 |
|
|
|
720 |
|
|
|
721 |
|
/* |
|
722 |
|
* STATUS MESSAGE FUNCTIONS |
|
723 |
|
*/ |
|
724 |
|
|
|
725 |
|
void |
|
726 |
|
status_bar_message (gchar * msg) |
|
727 |
|
{ |
|
728 |
|
gtk_label_set_text (GTK_LABEL (app.status_bar), msg); |
|
729 |
|
} |
|
730 |
|
|
|
731 |
|
void |
|
732 |
|
status_errno () |
|
733 |
|
{ |
|
734 |
|
status_bar_message(g_strerror(errno)); |
|
735 |
|
} |
|
736 |
|
|
|
737 |
|
/* |
|
738 |
|
* Up Directory Button Callback |
|
739 |
|
*/ |
|
740 |
|
|
|
741 |
|
static void |
|
742 |
|
updir_click_cb(GtkWidget *widget, GdkEventButton *event, FileView *view) |
|
743 |
|
{ |
|
744 |
|
if (event->button == 1) |
|
745 |
|
{ |
|
746 |
|
gchar path[PATH_MAX]; |
|
747 |
|
g_snprintf(path, sizeof(path), "%s/..", view->dir); |
|
748 |
|
change_dir(view, path); |
|
749 |
|
} |
|
750 |
|
else if (event->button == 3) |
|
751 |
|
{ |
|
752 |
|
gchar *home; |
|
753 |
|
if ((home = getenv("HOME")) != NULL) |
|
754 |
|
change_dir(view, home); |
|
755 |
|
} |
|
756 |
|
} |
|
757 |
|
|
|
758 |
|
|
|
759 |
|
static void |
|
760 |
|
column_button_cb(GtkWidget *widget, gint col, FileView *view) |
|
761 |
|
{ |
|
762 |
|
GtkSortType direction; |
|
763 |
|
|
|
764 |
|
if(GTK_CLIST(view->clist)->sort_column == col) |
|
765 |
|
direction = (GTK_CLIST(view->clist)->sort_type == GTK_SORT_ASCENDING |
|
766 |
|
? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING); |
|
767 |
|
else |
|
768 |
|
direction = GTK_CLIST(view->clist)->sort_type; |
|
769 |
|
|
|
770 |
|
gtk_clist_freeze(GTK_CLIST(view->clist)); |
|
771 |
|
gtk_clist_unselect_all(GTK_CLIST(view->clist)); |
|
772 |
|
sort_list(view, all_columns[col].sort_func, direction, col); |
|
773 |
|
gtk_widget_grab_focus(GTK_WIDGET(view->clist)); |
|
774 |
|
gtk_clist_select_row(GTK_CLIST(view->clist), 0, 0); |
|
775 |
|
gtk_clist_thaw(GTK_CLIST(view->clist)); |
|
776 |
|
} |
|
777 |
|
|
|
778 |
|
/* |
|
779 |
|
* WIDGET BUILDERS |
|
780 |
|
*/ |
|
781 |
|
|
|
782 |
|
static GtkWidget * |
|
783 |
|
create_file_view (FileView * view) |
|
784 |
|
{ |
|
785 |
|
GtkWidget *vbox; |
|
786 |
|
GtkWidget *hbox; |
|
787 |
|
GtkStyle *style; |
|
788 |
|
GtkWidget *sw; |
|
789 |
|
guint key_press_signal; |
|
790 |
|
gint i; |
|
791 |
|
sentinel.g = 0; |
|
792 |
|
sentinel.d = 0; |
|
793 |
|
|
|
794 |
|
/* Top Pane */ |
|
795 |
|
vbox = gtk_vbox_new (FALSE, 0); |
|
796 |
|
gtk_widget_show (vbox); |
|
797 |
|
|
|
798 |
|
hbox = gtk_hbox_new (FALSE, 0); |
|
799 |
|
gtk_widget_show (hbox); |
|
800 |
|
|
|
801 |
|
|
|
802 |
|
style = gtk_widget_get_style (app.main_window); |
|
803 |
|
|
|
804 |
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); |
|
805 |
|
|
|
806 |
|
sw = gtk_scrolled_window_new (NULL, NULL); |
|
807 |
|
if(cfg.use_scrollbars) |
|
808 |
|
{ |
|
809 |
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), |
|
810 |
|
GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS); |
|
811 |
|
} |
|
812 |
|
else |
|
813 |
|
{ |
|
814 |
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), |
|
815 |
|
GTK_POLICY_NEVER, GTK_POLICY_NEVER); |
|
816 |
|
} |
|
817 |
|
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); |
|
818 |
|
gtk_widget_show (sw); |
|
819 |
|
|
|
820 |
|
/* File List */ |
|
821 |
|
view->clist = gtk_clist_new (MAX_COLUMNS); |
|
822 |
|
for (i = 0; i < MAX_COLUMNS; i++) |
|
823 |
|
{ |
|
824 |
|
GtkWidget *hbox = gtk_hbox_new (FALSE, 0); |
|
825 |
|
GtkWidget *label = gtk_label_new (all_columns[i].title); |
|
826 |
|
|
|
827 |
|
view->sort_arrows[i] = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN); |
|
828 |
|
|
|
829 |
|
/* put up directory button in first column if using scrollbars */ |
|
830 |
|
if ( i == 0) |
|
831 |
|
{ |
|
832 |
|
/* start as blank label will be reset as soon as directory loads */ |
|
833 |
|
view->dir_label = gtk_label_new(" "); |
|
834 |
|
gtk_box_pack_start(GTK_BOX(hbox), view->dir_label, FALSE, TRUE, 0); |
|
835 |
|
gtk_widget_show(view->dir_label); |
|
836 |
|
|
|
837 |
|
if(cfg.use_scrollbars) |
|
838 |
|
{ |
|
839 |
|
GtkTooltips *tooltips; |
|
840 |
|
GtkWidget *pixmapwid; |
|
841 |
|
GdkPixmap *pixmap; |
|
842 |
|
GdkBitmap *mask; |
|
843 |
|
|
|
844 |
|
app.up_button = gtk_button_new(); |
|
845 |
|
gtk_signal_connect(GTK_OBJECT(app.up_button), "button_press_event", |
|
846 |
|
GTK_SIGNAL_FUNC(updir_click_cb), view); |
|
847 |
|
tooltips = gtk_tooltips_new(); |
|
848 |
|
gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), app.up_button, |
|
849 |
|
"Left Click: Up Dir Right Click: Home", NULL); |
|
850 |
|
gtk_box_pack_end(GTK_BOX(hbox), app.up_button, FALSE, FALSE, 0); |
|
851 |
|
gtk_widget_show(app.up_button); |
|
852 |
|
|
|
853 |
|
style = gtk_widget_get_style(app.main_window); |
|
854 |
|
pixmap = gdk_pixmap_create_from_xpm_d(app.main_window->window, &mask, |
|
855 |
|
&style->bg[GTK_STATE_NORMAL], icon_dirparent_xpm); |
|
856 |
|
pixmapwid = gtk_pixmap_new(pixmap, mask); |
|
857 |
|
gtk_container_add(GTK_CONTAINER(app.up_button), pixmapwid); |
|
858 |
|
gtk_widget_show(pixmapwid); |
|
859 |
|
} |
|
860 |
|
|
|
861 |
|
|
|
862 |
|
} |
|
863 |
|
else |
|
864 |
|
{ |
|
865 |
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); |
|
866 |
|
|
|
867 |
|
gtk_widget_show(label); |
|
868 |
|
} |
|
869 |
|
|
|
870 |
|
|
|
871 |
|
gtk_widget_show (hbox); |
|
872 |
|
gtk_clist_set_column_widget (GTK_CLIST (view->clist), i, hbox); |
|
873 |
|
} |
|
874 |
|
gtk_clist_column_titles_show (GTK_CLIST (view->clist)); |
|
875 |
|
gtk_clist_set_shadow_type (GTK_CLIST (view->clist), GTK_SHADOW_ETCHED_IN); |
|
876 |
|
gtk_clist_set_selection_mode (GTK_CLIST (view->clist), |
|
877 |
|
GTK_SELECTION_EXTENDED); |
|
878 |
|
gtk_clist_set_use_drag_icons (GTK_CLIST (view->clist), TRUE); |
|
879 |
|
gtk_clist_set_row_height (GTK_CLIST (view->clist), 16); |
|
880 |
|
|
|
881 |
|
for (i = 0; i < MAX_COLUMNS; i++) |
|
882 |
|
{ |
|
883 |
|
gtk_clist_set_column_width (GTK_CLIST (view->clist), i, |
|
884 |
|
all_columns[i].size); |
|
885 |
|
gtk_clist_set_column_visibility (GTK_CLIST (view->clist), i, |
|
886 |
|
all_columns[i].is_visible); |
|
887 |
|
} |
|
888 |
|
|
|
889 |
|
gtk_signal_connect (GTK_OBJECT (view->clist), "select_row", |
|
890 |
|
GTK_SIGNAL_FUNC (select_row_cb), view); |
|
891 |
|
gtk_signal_connect(GTK_OBJECT(view->clist), "button_press_event", |
|
892 |
|
GTK_SIGNAL_FUNC(mouse_cb), view); |
|
893 |
|
|
|
894 |
|
gtk_signal_connect(GTK_OBJECT(view->clist), "click_column", |
|
895 |
|
GTK_SIGNAL_FUNC(column_button_cb), view); |
|
896 |
|
|
|
897 |
|
key_press_signal = gtk_signal_connect (GTK_OBJECT (view->clist), |
|
898 |
|
"key-press-event", GTK_SIGNAL_FUNC (file_list_key_press_cb), view); |
|
899 |
|
gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id", |
|
900 |
|
GUINT_TO_POINTER(key_press_signal)); |
|
901 |
|
|
|
902 |
|
|
|
903 |
|
gtk_drag_dest_set (view->clist, GTK_DEST_DEFAULT_ALL, target_table, |
|
904 |
|
n_targets, GDK_ACTION_ASK); |
|
905 |
|
|
|
906 |
|
gtk_container_add (GTK_CONTAINER (sw), view->clist); |
|
907 |
|
gtk_widget_show (view->clist); |
|
908 |
|
|
|
909 |
|
/* Set the CLIST_COLOR for resetting from the DRAG_HILIGHT color */ |
|
910 |
|
{ |
|
911 |
|
GtkStyle *style = gtk_widget_get_style (view->clist); |
|
912 |
|
CLIST_COLOR.red = style->base[GTK_STATE_NORMAL].red; |
|
913 |
|
CLIST_COLOR.green = style->base[GTK_STATE_NORMAL].green; |
|
914 |
|
CLIST_COLOR.blue = style->base[GTK_STATE_NORMAL].blue; |
|
915 |
|
} |
|
916 |
|
|
|
917 |
|
return vbox; |
|
918 |
|
} |
|
919 |
|
|
|
920 |
|
GtkWidget * |
|
921 |
|
create_command_view (void) |
|
922 |
|
{ |
|
923 |
|
GtkWidget *sw; |
|
924 |
|
GtkWidget *frame; |
|
925 |
|
guint selection_signal; |
|
926 |
|
|
|
927 |
|
frame = gtk_frame_new(NULL); |
|
928 |
|
gtk_box_pack_start(GTK_BOX(app.hbox), frame, FALSE, FALSE, 0); |
|
929 |
|
gtk_widget_show(frame); |
|
930 |
|
sw = gtk_scrolled_window_new (NULL, NULL); |
|
931 |
|
gtk_container_add(GTK_CONTAINER(frame), sw); |
|
932 |
|
if(cfg.use_scrollbars) |
|
933 |
|
{ |
|
934 |
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), |
|
935 |
|
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
|
936 |
|
} |
|
937 |
|
else |
|
938 |
|
{ |
|
939 |
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), |
|
940 |
|
GTK_POLICY_NEVER, GTK_POLICY_NEVER); |
|
941 |
|
} |
|
942 |
|
|
|
943 |
|
gtk_widget_show (sw); |
|
944 |
|
command_view = &app.command_view; |
|
945 |
|
command_view->clist = gtk_clist_new (1); |
|
946 |
|
gtk_clist_set_selection_mode (GTK_CLIST (command_view->clist), |
|
947 |
|
GTK_SELECTION_BROWSE); |
|
948 |
|
|
|
949 |
|
gtk_container_add (GTK_CONTAINER (sw), command_view->clist); |
|
950 |
|
gtk_clist_set_shadow_type (GTK_CLIST (command_view->clist), |
|
951 |
|
GTK_SHADOW_NONE); |
|
952 |
|
gtk_clist_column_titles_show (GTK_CLIST (command_view->clist)); |
|
953 |
|
app.label = gtk_label_new (" Commands "); |
|
954 |
|
gtk_widget_show (app.label); |
|
955 |
|
|
|
956 |
|
gtk_clist_set_column_widget (GTK_CLIST (command_view->clist), 0, app.label); |
|
957 |
|
gtk_widget_show (command_view->clist); |
|
958 |
|
load_user_commands (); |
|
959 |
|
selection_signal = gtk_signal_connect (GTK_OBJECT (command_view->clist), |
|
960 |
|
"select_row", GTK_SIGNAL_FUNC (command_select_row_cb), command_view); |
|
961 |
|
gtk_signal_connect(GTK_OBJECT(command_view->clist), "select_row", |
|
962 |
|
GTK_SIGNAL_FUNC(mouse_command_cb), command_view); |
|
963 |
|
gtk_object_set_data(GTK_OBJECT(command_view->clist), "signal_key_id", |
|
964 |
|
GUINT_TO_POINTER(selection_signal)); |
|
965 |
|
gtk_signal_connect (GTK_OBJECT (command_view->clist), "key_press_event", |
|
966 |
|
GTK_SIGNAL_FUNC (file_list_key_press_cb), command_view); |
|
967 |
|
return sw; |
|
968 |
|
|
|
969 |
|
} |
|
970 |
|
|
|
971 |
|
/* Main Window Setup */ |
|
972 |
|
void |
|
973 |
|
create_main_window () |
|
974 |
|
{ |
|
975 |
|
|
|
976 |
|
app.main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
|
977 |
|
|
|
978 |
|
gtk_signal_connect (GTK_OBJECT (app.main_window), "delete_event", |
|
979 |
|
GTK_SIGNAL_FUNC (quit_cb), NULL); |
|
980 |
|
|
|
981 |
|
gtk_signal_connect (GTK_OBJECT (app.main_window),"key_press_event", |
|
982 |
|
GTK_SIGNAL_FUNC (window_key_press_cb), NULL); |
|
983 |
|
|
|
984 |
|
gtk_widget_set_usize (app.main_window, cfg.window_width, cfg.window_height); |
|
985 |
|
if(cfg.save_position) |
|
986 |
|
gtk_widget_set_uposition (GTK_WIDGET (app.main_window), cfg.window_xpos, |
|
987 |
|
cfg.window_ypos); |
|
988 |
|
|
|
989 |
|
gtk_window_set_policy (GTK_WINDOW (app.main_window), TRUE, TRUE, FALSE); |
|
990 |
|
gtk_widget_realize (app.main_window); |
|
991 |
|
|
|
992 |
|
app.notebook = gtk_notebook_new(); |
|
993 |
|
gtk_container_add(GTK_CONTAINER(app.main_window), app.notebook); |
|
994 |
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app.notebook), GTK_POS_BOTTOM); |
|
995 |
|
|
|
996 |
|
app.notebook_label = gtk_label_new("1 Vide"); |
|
997 |
|
gtk_widget_show(app.notebook_label); |
|
998 |
|
|
|
999 |
|
app.main_window_vbox = gtk_vbox_new (FALSE, 0); |
|
1000 |
|
gtk_widget_show(app.notebook); |
|
1001 |
|
gtk_widget_show (app.main_window_vbox); |
|
1002 |
|
|
|
1003 |
|
gtk_notebook_append_page(GTK_NOTEBOOK(app.notebook), app.main_window_vbox, |
|
1004 |
|
app.notebook_label); |
|
1005 |
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app.notebook), zvt.show_tabs); |
|
1006 |
|
gtk_signal_connect(GTK_OBJECT(app.notebook), "switch-page", |
|
1007 |
|
GTK_SIGNAL_FUNC(notebook_cb), NULL); |
|
1008 |
|
|
|
1009 |
|
|
|
1010 |
|
|
|
1011 |
|
/* menubar */ |
|
1012 |
|
app.main_menu_bar = create_main_menu_bar (); |
|
1013 |
|
gtk_widget_show (app.main_menu_bar); |
|
1014 |
|
gtk_box_pack_start (GTK_BOX (app.main_window_vbox), app.main_menu_bar, |
|
1015 |
|
FALSE, FALSE, 0); |
|
1016 |
|
|
|
1017 |
|
|
|
1018 |
|
app.hbox = gtk_hbox_new (FALSE, 0); |
|
1019 |
|
gtk_widget_show (app.hbox); |
|
1020 |
|
|
|
1021 |
|
/* Left Panel */ |
|
1022 |
|
app.left_view_box = create_file_view (&app.left_view); |
|
1023 |
|
curr_view = &app.left_view; |
|
1024 |
|
gtk_box_pack_start (GTK_BOX (app.hbox), app.left_view_box, TRUE, TRUE, 0); |
|
1025 |
|
|
|
1026 |
|
/* Command clist */ |
|
1027 |
|
app.sw = create_command_view (); |
|
1028 |
|
|
|
1029 |
|
/* Right Panel */ |
|
1030 |
|
app.right_view_box = create_file_view (&app.right_view); |
|
1031 |
|
other_view = &app.right_view; |
|
1032 |
|
gtk_box_pack_start (GTK_BOX (app.hbox), app.right_view_box, TRUE, TRUE, 0); |
|
1033 |
|
gtk_box_pack_start (GTK_BOX (app.main_window_vbox), app.hbox, TRUE, TRUE, |
|
1034 |
|
0); |
|
1035 |
|
|
|
1036 |
|
app.sep = gtk_hseparator_new (); |
|
1037 |
|
gtk_box_pack_start (GTK_BOX (app.main_window_vbox), app.sep, FALSE, FALSE, |
|
1038 |
|
0); |
|
1039 |
|
gtk_widget_show (app.sep); |
|
1040 |
|
|
|
1041 |
|
|
|
1042 |
|
|
|
1043 |
|
/* Staus Bar */ |
|
1044 |
|
app.message_box = gtk_hbox_new(TRUE, 0); |
|
1045 |
|
gtk_widget_show(app.message_box); |
|
1046 |
|
gtk_box_pack_start(GTK_BOX(app.main_window_vbox), app.message_box, |
|
1047 |
|
FALSE, FALSE, 0); |
|
1048 |
|
gtk_box_set_homogeneous(GTK_BOX(app.message_box), FALSE); |
|
1049 |
|
|
|
1050 |
|
app.status_bar = add_label (app.message_box, "Ready", 0.5, TRUE, 0); |
|
1051 |
|
gtk_misc_set_alignment (GTK_MISC (app.status_bar), 0.02, 0.5); |
|
1052 |
|
gtk_widget_show (GTK_WIDGET (app.status_bar)); |
|
1053 |
|
|
|
1054 |
|
app.sep = gtk_hseparator_new(); |
|
1055 |
|
gtk_box_pack_end(GTK_BOX(app.main_window_vbox), app.sep, FALSE, FALSE, 0); |
|
1056 |
|
gtk_widget_show(app.sep); |
|
1057 |
|
|
|
1058 |
|
|
|
1059 |
|
load_bookmarks (); |
|
1060 |
|
|
|
1061 |
|
gtk_widget_show (app.main_window); |
|
1062 |
|
|
|
1063 |
|
} |
|
1064 |
|
|
|
1065 |
|
void |
|
1066 |
|
recreate_main_window () |
|
1067 |
|
{ |
|
1068 |
|
FileView *last_view; |
|
1069 |
|
GtkAdjustment *vadj; |
|
1070 |
|
gfloat scrollbar_pos; |
|
1071 |
|
gint last_selected_row; |
|
1072 |
|
gint page; |
|
1073 |
|
|
|
1074 |
|
/* Save some info on the current view so we can reset it when done */ |
|
1075 |
|
last_view = curr_view; |
|
1076 |
|
scrollbar_pos = |
|
1077 |
|
gtk_clist_get_vadjustment (GTK_CLIST (curr_view->clist))->value; |
|
1078 |
|
last_selected_row = curr_view->row; |
|
1079 |
|
|
|
1080 |
|
gtk_widget_destroy (app.main_menu_bar); |
|
1081 |
|
gtk_widget_destroy (app.left_view_box); |
|
1082 |
|
gtk_widget_destroy (app.right_view_box); |
|
1083 |
|
gtk_widget_destroy (app.sw); |
|
1084 |
|
gtk_widget_destroy (app.hbox); |
|
1085 |
|
gtk_widget_destroy (app.message_box); |
|
1086 |
|
gtk_widget_destroy (app.sep); |
|
1087 |
|
|
|
1088 |
|
app.main_menu_bar = create_main_menu_bar (); |
|
1089 |
|
gtk_widget_show (app.main_menu_bar); |
|
1090 |
|
gtk_box_pack_start (GTK_BOX (app.main_window_vbox), app.main_menu_bar, |
|
1091 |
|
FALSE, FALSE, 0); |
|
1092 |
|
|
|
1093 |
|
app.hbox = gtk_hbox_new (FALSE, 0); |
|
1094 |
|
gtk_box_pack_start (GTK_BOX (app.main_window_vbox), app.hbox, TRUE, TRUE, |
|
1095 |
|
0); |
|
1096 |
|
gtk_widget_show (app.hbox); |
|
1097 |
|
|
|
1098 |
|
/* Left Panel */ |
|
1099 |
|
app.left_view_box = create_file_view (&app.left_view); |
|
1100 |
|
gtk_box_pack_start (GTK_BOX (app.hbox), app.left_view_box, TRUE, TRUE, 0); |
|
1101 |
|
|
|
1102 |
|
/* command Panel */ |
|
1103 |
|
app.sw = create_command_view (); |
|
1104 |
|
|
|
1105 |
|
|
|
1106 |
|
/* Right Panel */ |
|
1107 |
|
app.right_view_box = create_file_view (&app.right_view); |
|
1108 |
|
gtk_box_pack_start (GTK_BOX (app.hbox), app.right_view_box, TRUE, TRUE, 0); |
|
1109 |
|
|
|
1110 |
|
app.sep = gtk_hseparator_new (); |
|
1111 |
|
gtk_box_pack_start (GTK_BOX (app.main_window_vbox), app.sep, FALSE, FALSE, |
|
1112 |
|
0); |
|
1113 |
|
gtk_widget_show (app.sep); |
|
1114 |
|
|
|
1115 |
|
/* Staus Bar */ |
|
1116 |
|
app.message_box = gtk_hbox_new(TRUE, 0); |
|
1117 |
|
gtk_widget_show(app.message_box); |
|
1118 |
|
gtk_box_pack_start(GTK_BOX(app.main_window_vbox), app.message_box, |
|
1119 |
|
FALSE, FALSE, 0); |
|
1120 |
|
|
|
1121 |
|
gtk_box_set_homogeneous(GTK_BOX(app.message_box), FALSE); |
|
1122 |
|
app.status_bar = add_label (app.message_box, "Ready", 0.5, TRUE, 0); |
|
1123 |
|
gtk_misc_set_alignment (GTK_MISC (app.status_bar), 0.02, 0.5); |
|
1124 |
|
gtk_widget_show (GTK_WIDGET (app.status_bar)); |
|
1125 |
|
|
|
1126 |
|
load_bookmarks (); |
|
1127 |
|
|
|
1128 |
|
change_dir(&app.right_view, app.right_view.dir); |
|
1129 |
|
change_dir(&app.left_view, app.left_view.dir); |
|
1130 |
|
sort_list (&app.right_view, name_sort, GTK_SORT_ASCENDING, 0); |
|
1131 |
|
sort_list (&app.left_view, name_sort, GTK_SORT_ASCENDING, 0); |
|
1132 |
|
|
|
1133 |
|
gtk_widget_show (app.hbox); |
|
1134 |
|
|
|
1135 |
|
gtk_widget_grab_focus(last_view->clist); |
|
1136 |
|
gtk_clist_unselect_all (GTK_CLIST (last_view->clist)); |
|
1137 |
|
gtk_clist_select_row (GTK_CLIST (last_view->clist), last_selected_row, 0); |
|
1138 |
|
GTK_CLIST (last_view->clist)->focus_row = last_selected_row; |
|
1139 |
|
page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)); |
|
1140 |
|
if(page == 0) |
|
1141 |
|
gtk_widget_draw_focus(last_view->clist); |
|
1142 |
|
else |
|
1143 |
|
gtk_widget_grab_focus(GTK_WIDGET(get_nth_zvt( |
|
1144 |
|
GTK_NOTEBOOK(app.notebook), page))); |
|
1145 |
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app.notebook), zvt.tab_position); |
|
1146 |
|
update_all_terms(); |
|
1147 |
|
|
|
1148 |
|
vadj = gtk_clist_get_vadjustment (GTK_CLIST (last_view->clist)); |
|
1149 |
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (vadj), scrollbar_pos); |
|
1150 |
|
} |