xaizek / vide (License: GPLv2+) (since 2018-12-07)
Graphical predecessor of vifm that uses GTK+.
Commit 695cdb530483b2b27a1f0039884267292099c3ed

Import Vide v0.5.2
This is graphical (uses GTK+) predecessor of vifm.
Author: xaizek
Author date (UTC): 2014-05-18 15:10
Committer name: xaizek
Committer date (UTC): 2014-05-18 15:10
Parent(s):
Signing key:
Tree: 1248ff796bd7bd3d21a97ff9eccc38fdf503532e
File Lines added Lines deleted
AUTHORS 12 0
COPYING 339 0
ChangeLog 148 0
INSTALL 18 0
Makefile.am 6 0
Makefile.in 377 0
NEWS 0 0
README 4 0
TODO 11 0
acconfig.h 9 0
aclocal.m4 849 0
autogen.sh 148 0
config.h.in 27 0
configure 3242 0
configure.in 55 0
install-sh 251 0
macros/Makefile 234 0
macros/Makefile.am 41 0
macros/Makefile.in 234 0
macros/aclocal-include.m4 16 0
macros/autogen.sh 169 0
macros/compiler-flags.m4 109 0
macros/curses.m4 318 0
macros/gnome-bonobo-check.m4 150 0
macros/gnome-common.m4 14 0
macros/gnome-fileutils.m4 414 0
macros/gnome-ghttp-check.m4 14 0
macros/gnome-gnorba-check.m4 35 0
macros/gnome-guile-checks.m4 119 0
macros/gnome-libgtop-check.m4 217 0
macros/gnome-objc-checks.m4 83 0
macros/gnome-orbit-check.m4 33 0
macros/gnome-print-check.m4 171 0
macros/gnome-pthread-check.m4 16 0
macros/gnome-support.m4 68 0
macros/gnome-undelfs.m4 20 0
macros/gnome-vfs.m4 120 0
macros/gnome-x-checks.m4 80 0
macros/gnome-xml-check.m4 30 0
macros/gnome.m4 128 0
macros/gperf-check.m4 79 0
macros/linger.m4 28 0
macros/need-declaration.m4 42 0
missing 190 0
mkinstalldirs 40 0
src/Makefile.am 56 0
src/Makefile.in 413 0
src/add_ext_dialog.c 173 0
src/bookmarks.c 271 0
src/buffer_menu.c 115 0
src/callbacks.c 132 0
src/command_mode.c 796 0
src/command_mode_menu.c 128 0
src/config_dialog.c 1729 0
src/config_files.c 1166 0
src/confirm_dialog.c 126 0
src/copy_here_dialog.c 93 0
src/date_filter_dialog.c 182 0
src/file_info_dialog.c 264 0
src/filelist.c 887 0
src/filename_filter_dialog.c 115 0
src/fileops.c 338 0
src/fileselector.c 390 0
src/filetype.c 132 0
src/filetype_dialog.c 237 0
src/filetype_popup.c 326 0
src/for_each_dialog.c 144 0
src/history.c 77 0
src/icon_dirparent.xpm 72 0
src/init_filetype_dialog.c 151 0
src/main_menu.c 336 0
src/misc_dialogs.c 238 0
src/ownership_dialog.c 254 0
src/pauseme 8 0
src/permissions_dialog.c 338 0
src/programs_dialog.c 128 0
src/programs_menu.c 101 0
src/rename_ext_dialog.c 121 0
src/search_mode.c 342 0
src/size_filter_dialog.c 176 0
src/term.c 928 0
src/term_menu.c 336 0
src/user_command.c 32 0
src/user_command_dialog.c 128 0
src/user_prompt.c 97 0
src/utils.c 512 0
src/vide.c 534 0
src/vide.h 585 0
src/vide0.5.2.txt 159 0
src/view_dialog.c 92 0
src/widget_utils.c 340 0
src/window.c 1150 0
stamp-h.in 1 0
File AUTHORS added (mode: 100644) (index 0000000..42efe0c)
1 Vide is based on the source code of emelfm by Michael Clark.
2
3 Sergei Gnezdov worked on the FreeBSD port of Vide0.5 and contributed several
4 patches including Ctrl + G to show the file information on the status bar.
5
6 Colman Reilly careilly@thecia.ie maintains the FreeBSD port available from
7 http://www.freebsd.org/ports/x11-fm.html
8
9
10 Bug reports or questions should be sent to ksteen@users.sourceforge.net
11
12
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 ChangeLog added (mode: 100644) (index 0000000..75b7798)
1 Changes 0.5 to 0.5.2
2 Fixed annoying bug when using vim that would cause the clist to display
3 incorrectly.
4
5 A menu bar was added to each zvt term widget
6
7 The notebook page can now contain more than one terminal.
8
9 The terminals can now be detached from the notebook page.
10
11 New keybindings for the terms.
12 <alt>w j moves down one term
13 <alt>w k moves up one term
14 <alt>w n creates a new terminal on the notebook page.
15 <alt>w m creates a new term running man + word under the cursor.
16 This is similar to pressing K in vim with the added benefit of still
17 being able to see the original code while reading the man page.
18
19 When selecting a file from the term menu bar you can use your normal
20 bookmarks with ' and search for files with /pattern. You cannot use
21 :commands.
22
23 The status bar message was changed to show a brief summary of the
24 selected file. If more than one file is selected, the number of
25 selected files is shown
26
27 :path command was changed to :pwd or :pw
28 or you can just use ctrl g which will show the full path and the file
29 information.
30
31 Changes 0.4 to 0.5
32 All terminal colors may now be customized.
33 Fixed support for vile, elvis, and nvi.
34 Added hidden notebook tab option.
35 Fixed memory leak when using regcomp();
36 :ls command creates a popup menu and jumps to the notebook page selected.
37 All notebook tabs now show the notebook page number.
38 Added relative directory to :cd and :sb commands - :cd projects
39 or :cd ~/misc
40 :q quit unless there are stll terminals open
41 :q! quit even if there are terminals open
42 :x write current vi and close page unless readonly.
43 Added a cancel option to all main menus.
44 Added :!! command :!![command] creates a shell and executes pauseme + the
45 executed command. :!!ls instead of :!pauseme ls
46 :path or :pa will show the full path of the current directory on the status
47 bar - patch submited by Sergei Gnezdov
48 Ctrl+G will show the file properties of the current selected file on
49 the status bar - patch submited by Sergei Gnezdov
50 %f may be use inside of a %{} prompt command to put the current selected
51 file inside of the popup entry - this probably should be expanded to
52 enable %d or %D to be use also. - patch submited by Eric Johnson
53
54 Changes 0.3 to 0.4
55 added sorting function to bookmarks
56 added notebook interface and zvt
57 removed pauseme from the :! command
58 fixed bug with setting a :com without enough arguments.
59 If you use the mouse to select the notebook page, move the scrollbars,
60 or click on the column title the clist now grabs the focus back like
61 it should. The up directory button still does not work properly.
62 Ctrl Q was changed to alt q.
63
64 Changes 0.2.9 to 0.3
65 Fixed column title lists to change sort.
66 Fixed to work with gnome-terminal as it takes different arguments than
67 xterm or rxvt
68 Added support for vimclient. Only works with gvim6.0
69 :vs command for vim6.0 running in a console
70 Removed the -f option from the mv command as it will delete a file if you
71 tried to move the file into the same directory.
72 Changed the copy command to cp -R to allow copying of directories
73
74 Changes 0.2.8 to 0.2.9
75
76 fixed bug in using a search pattern in a command. :com backup /~$
77 fixed command mode to use all the selected files with the command instead of
78 just the first selected file.
79 vi_server can now accept multiple files up to 100 files
80 The 100 file limit is just an arbitrary number that could be increased.
81 You can load multiple files into vi with :e
82 /[Return] will now search for the previous pattern
83 t will tag or untag files in a directory
84 Added filters to the Options menu
85 Date, Size, Name
86 :fil[ter]
87 :nofil[ter]
88 :set filter [pattern]
89 :set filter invert [pattern]
90 :in[vert]
91 :on[ly] will hide the command list and other file list
92 :new will show the hidden file list
93
94
95 Changes vide 0.27 to vide 0.28
96
97 numbers used to show vi sessions are reused
98 vide will reattach to vi sessions from a previous vide session
99 support for nvi, elvis, vile
100 added code to handle vi_server from the filetypes popup menu
101 fixed bug when emptying trash directory from the other view that would
102 not let you move back into the trash directory.
103
104 Changes vide 0.26 to vide 0.2.7
105
106 fixed reloading of trash directory when removing a large amount of files
107 fixed focus bug when useing dd on last file in a directory
108 added up directory button
109 added :x command same as :q
110 added '' will return to last position
111 added :his[tory] command
112 initial support for loading of files into a running vim.
113
114
115
116 Changes vide 0.2.5 to vide-0.2.6
117
118 vide can now handle file names with spaces
119 Scrollbars are now configurable
120 Mouse double click in command menu executes selected command
121 Mouse right click will create filetype popup menu
122 Changed updating of clists to reduce flicker
123 Fixed directory history when moving up a directory
124 :commands are now user defineable
125 :com popup menu of user commands
126 :com name action to set user commands
127 :exe command to execute a program
128 :/ command to allow searches in user commands
129 :delc popup menu to delete commands
130
131
132
133 Changes vide-0.2.4 to vide-0.2.5
134
135 bug fixes for grab focus and update of file lists
136
137 Changes vide0.2.3 to vide0.2.4
138
139 gg now moves to row 0 instead of g
140 dd will delete the selected file
141 N will search backwards for the last search pattern.
142 m will set marks.
143 ' will goto set marks.
144 :sp will change the other file list to the current file list directory or
145 to a set path.
146 :cd will change the current file list to your home enviroment or to a set path.
147 configure option to allow starting vide in the current working directory.
148
File INSTALL added (mode: 100644) (index 0000000..0435a1b)
1 Installation
2 ~~~~~~~~~~~~
3 You need:
4
5 Gnome libraries installed.
6
7 ./configure
8 make
9 ("su" if you don't have access to /usr/local/bin)
10 make install
11
12 Start Vide, type :h[Enter] and play with the commands listed in the
13 help file.
14
15
16
17
18
File Makefile.am added (mode: 100644) (index 0000000..bf9d389)
1 ## Process this file with automake to produce Makefile.in
2
3 SUBDIRS = src
4
5
6
File Makefile.in added (mode: 100644) (index 0000000..01c8c88)
1 # Makefile.in generated automatically by automake 1.4a from Makefile.am
2
3 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 # This Makefile.in is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13
14 SHELL = @SHELL@
15
16 srcdir = @srcdir@
17 top_srcdir = @top_srcdir@
18 VPATH = @srcdir@
19 prefix = @prefix@
20 exec_prefix = @exec_prefix@
21
22 bindir = @bindir@
23 sbindir = @sbindir@
24 libexecdir = @libexecdir@
25 datadir = @datadir@
26 sysconfdir = @sysconfdir@
27 sharedstatedir = @sharedstatedir@
28 localstatedir = @localstatedir@
29 libdir = @libdir@
30 infodir = @infodir@
31 mandir = @mandir@
32 includedir = @includedir@
33 oldincludedir = /usr/include
34
35 DESTDIR =
36
37 pkgdatadir = $(datadir)/@PACKAGE@
38 pkglibdir = $(libdir)/@PACKAGE@
39 pkgincludedir = $(includedir)/@PACKAGE@
40
41 top_builddir = .
42
43 ACLOCAL = @ACLOCAL@
44 AUTOCONF = @AUTOCONF@
45 AUTOMAKE = @AUTOMAKE@
46 AUTOHEADER = @AUTOHEADER@
47
48 INSTALL = @INSTALL@
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 INSTALL_DATA = @INSTALL_DATA@
51 INSTALL_SCRIPT = @INSTALL_SCRIPT@
52 INSTALL_STRIP_FLAG =
53 transform = @program_transform_name@
54
55 NORMAL_INSTALL = :
56 PRE_INSTALL = :
57 POST_INSTALL = :
58 NORMAL_UNINSTALL = :
59 PRE_UNINSTALL = :
60 POST_UNINSTALL = :
61 CC = @CC@
62 GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@
63 GNOMEUI_LIBS = @GNOMEUI_LIBS@
64 GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@
65 GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@
66 GNOME_CONFIG = @GNOME_CONFIG@
67 GNOME_DOCKLETS_LIBS = @GNOME_DOCKLETS_LIBS@
68 GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@
69 GNOME_LIBDIR = @GNOME_LIBDIR@
70 GNOME_LIBS = @GNOME_LIBS@
71 GNORBA_CFLAGS = @GNORBA_CFLAGS@
72 GNORBA_LIBS = @GNORBA_LIBS@
73 GTKXMHTML_LIBS = @GTKXMHTML_LIBS@
74 GTK_CFLAGS = @GTK_CFLAGS@
75 GTK_CONFIG = @GTK_CONFIG@
76 GTK_LIBS = @GTK_LIBS@
77 MAKEINFO = @MAKEINFO@
78 ORBIT_CFLAGS = @ORBIT_CFLAGS@
79 ORBIT_CONFIG = @ORBIT_CONFIG@
80 ORBIT_IDL = @ORBIT_IDL@
81 ORBIT_LIBS = @ORBIT_LIBS@
82 PACKAGE = @PACKAGE@
83 PTHREAD_LIB = @PTHREAD_LIB@
84 VERSION = @VERSION@
85 XPM_LIBS = @XPM_LIBS@
86 ZVT_LIBS = @ZVT_LIBS@
87 cflags_set = @cflags_set@
88 cxxflags_set = @cxxflags_set@
89
90 SUBDIRS = src
91 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
93 CONFIG_HEADER = config.h
94 CONFIG_CLEAN_FILES =
95 DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
96 Makefile.am Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in \
97 configure configure.in install-sh missing mkinstalldirs
98
99
100 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
101
102 TAR = gtar
103 GZIP_ENV = --best
104 all: all-redirect
105 .SUFFIXES:
106 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
107 cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
108
109 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
110 cd $(top_builddir) \
111 && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
112
113 $(ACLOCAL_M4): configure.in
114 cd $(srcdir) && $(ACLOCAL)
115
116 config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
117 $(SHELL) ./config.status --recheck
118 $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
119 cd $(srcdir) && $(AUTOCONF)
120
121 config.h: stamp-h
122 @if test ! -f $@; then \
123 rm -f stamp-h; \
124 $(MAKE) stamp-h; \
125 else :; fi
126 stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
127 cd $(top_builddir) \
128 && CONFIG_FILES= CONFIG_HEADERS=config.h \
129 $(SHELL) ./config.status
130 @echo timestamp > stamp-h 2> /dev/null
131 $(srcdir)/config.h.in: $(srcdir)/stamp-h.in
132 @if test ! -f $@; then \
133 rm -f $(srcdir)/stamp-h.in; \
134 $(MAKE) $(srcdir)/stamp-h.in; \
135 else :; fi
136 $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
137 cd $(top_srcdir) && $(AUTOHEADER)
138 @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
139
140 mostlyclean-hdr:
141
142 clean-hdr:
143
144 distclean-hdr:
145 -rm -f config.h
146
147 maintainer-clean-hdr:
148
149 # This directory's subdirectories are mostly independent; you can cd
150 # into them and run `make' without going through this Makefile.
151 # To change the values of `make' variables: instead of editing Makefiles,
152 # (1) if the variable is set in `config.status', edit `config.status'
153 # (which will cause the Makefiles to be regenerated when you run `make');
154 # (2) otherwise, pass the desired values on the `make' command line.
155
156 @SET_MAKE@
157
158 all-recursive install-data-recursive install-exec-recursive \
159 installdirs-recursive install-recursive uninstall-recursive \
160 check-recursive installcheck-recursive info-recursive dvi-recursive:
161 @set fnord $(MAKEFLAGS); amf=$$2; \
162 dot_seen=no; \
163 target=`echo $@ | sed s/-recursive//`; \
164 list='$(SUBDIRS)'; for subdir in $$list; do \
165 echo "Making $$target in $$subdir"; \
166 if test "$$subdir" = "."; then \
167 dot_seen=yes; \
168 local_target="$$target-am"; \
169 else \
170 local_target="$$target"; \
171 fi; \
172 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
173 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
174 done; \
175 if test "$$dot_seen" = "no"; then \
176 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
177 fi; test -z "$$fail"
178
179 mostlyclean-recursive clean-recursive distclean-recursive \
180 maintainer-clean-recursive:
181 @set fnord $(MAKEFLAGS); amf=$$2; \
182 dot_seen=no; \
183 rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
184 rev="$$subdir $$rev"; \
185 test "$$subdir" = "." && dot_seen=yes; \
186 done; \
187 test "$$dot_seen" = "no" && rev=". $$rev"; \
188 target=`echo $@ | sed s/-recursive//`; \
189 for subdir in $$rev; do \
190 echo "Making $$target in $$subdir"; \
191 if test "$$subdir" = "."; then \
192 local_target="$$target-am"; \
193 else \
194 local_target="$$target"; \
195 fi; \
196 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
197 || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
198 done && test -z "$$fail"
199 tags-recursive:
200 list='$(SUBDIRS)'; for subdir in $$list; do \
201 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
202 done
203
204 tags: TAGS
205
206 ID: $(HEADERS) $(SOURCES) $(LISP)
207 list='$(SOURCES) $(HEADERS)'; \
208 unique=`for i in $$list; do echo $$i; done | \
209 awk ' { files[$$0] = 1; } \
210 END { for (i in files) print i; }'`; \
211 here=`pwd` && cd $(srcdir) \
212 && mkid -f$$here/ID $$unique $(LISP)
213
214 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
215 tags=; \
216 here=`pwd`; \
217 list='$(SUBDIRS)'; for subdir in $$list; do \
218 if test "$$subdir" = .; then :; else \
219 test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
220 fi; \
221 done; \
222 list='$(SOURCES) $(HEADERS)'; \
223 unique=`for i in $$list; do echo $$i; done | \
224 awk ' { files[$$0] = 1; } \
225 END { for (i in files) print i; }'`; \
226 test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
227 || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
228
229 mostlyclean-tags:
230
231 clean-tags:
232
233 distclean-tags:
234 -rm -f TAGS ID
235
236 maintainer-clean-tags:
237
238 distdir = $(PACKAGE)-$(VERSION)
239 top_distdir = $(distdir)
240
241 # This target untars the dist file and tries a VPATH configuration. Then
242 # it guarantees that the distribution is self-contained by making another
243 # tarfile.
244 distcheck: dist
245 -rm -rf $(distdir)
246 GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
247 mkdir $(distdir)/=build
248 mkdir $(distdir)/=inst
249 dc_install_base=`cd $(distdir)/=inst && pwd`; \
250 cd $(distdir)/=build \
251 && ../configure --srcdir=.. --prefix=$$dc_install_base \
252 && $(MAKE) $(AM_MAKEFLAGS) \
253 && $(MAKE) $(AM_MAKEFLAGS) dvi \
254 && $(MAKE) $(AM_MAKEFLAGS) check \
255 && $(MAKE) $(AM_MAKEFLAGS) install \
256 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
257 && $(MAKE) $(AM_MAKEFLAGS) dist
258 -rm -rf $(distdir)
259 @banner="$(distdir).tar.gz is ready for distribution"; \
260 dashes=`echo "$$banner" | sed s/./=/g`; \
261 echo "$$dashes"; \
262 echo "$$banner"; \
263 echo "$$dashes"
264 dist: distdir
265 -chmod -R a+r $(distdir)
266 GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
267 -rm -rf $(distdir)
268 dist-all: distdir
269 -chmod -R a+r $(distdir)
270 GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
271 -rm -rf $(distdir)
272 distdir: $(DISTFILES)
273 -rm -rf $(distdir)
274 mkdir $(distdir)
275 -chmod 777 $(distdir)
276 here=`cd $(top_builddir) && pwd`; \
277 top_distdir=`cd $(distdir) && pwd`; \
278 distdir=`cd $(distdir) && pwd`; \
279 cd $(top_srcdir) \
280 && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
281 @for file in $(DISTFILES); do \
282 d=$(srcdir); \
283 if test -d $$d/$$file; then \
284 cp -pr $$d/$$file $(distdir)/$$file; \
285 else \
286 test -f $(distdir)/$$file \
287 || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
288 || cp -p $$d/$$file $(distdir)/$$file || :; \
289 fi; \
290 done
291 for subdir in $(SUBDIRS); do \
292 if test "$$subdir" = .; then :; else \
293 test -d $(distdir)/$$subdir \
294 || mkdir $(distdir)/$$subdir \
295 || exit 1; \
296 chmod 777 $(distdir)/$$subdir; \
297 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
298 || exit 1; \
299 fi; \
300 done
301 info-am:
302 info: info-recursive
303 dvi-am:
304 dvi: dvi-recursive
305 check-am: all-am
306 check: check-recursive
307 installcheck-am:
308 installcheck: installcheck-recursive
309 all-recursive-am: config.h
310 $(MAKE) $(AM_MAKEFLAGS) all-recursive
311
312 install-exec-am:
313 install-exec: install-exec-recursive
314
315 install-data-am:
316 install-data: install-data-recursive
317
318 install-am: all-am
319 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
320 install: install-recursive
321 uninstall-am:
322 uninstall: uninstall-recursive
323 all-am: Makefile config.h
324 all-redirect: all-recursive-am
325 install-strip:
326 $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
327 installdirs: installdirs-recursive
328 installdirs-am:
329
330
331 mostlyclean-generic:
332
333 clean-generic:
334
335 distclean-generic:
336 -rm -f Makefile $(CONFIG_CLEAN_FILES)
337 -rm -f config.cache config.log stamp-h stamp-h[0-9]*
338
339 maintainer-clean-generic:
340 mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
341
342 mostlyclean: mostlyclean-recursive
343
344 clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
345
346 clean: clean-recursive
347
348 distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
349
350 distclean: distclean-recursive
351 -rm -f config.status
352
353 maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
354 maintainer-clean-generic distclean-am
355 @echo "This command is intended for maintainers to use;"
356 @echo "it deletes files that may require special tools to rebuild."
357
358 maintainer-clean: maintainer-clean-recursive
359 -rm -f config.status
360
361 .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
362 install-data-recursive uninstall-data-recursive install-exec-recursive \
363 uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
364 all-recursive check-recursive installcheck-recursive info-recursive \
365 dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
366 maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
367 distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
368 dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
369 install-exec-am install-exec install-data-am install-data install-am \
370 install uninstall-am uninstall all-redirect all-am all installdirs-am \
371 installdirs mostlyclean-generic distclean-generic clean-generic \
372 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
373
374
375 # Tell versions [3.59,3.63) of GNU make to not export all variables.
376 # Otherwise a system limit (for SysV at least) may be exceeded.
377 .NOEXPORT:
File NEWS added (mode: 100644) (index 0000000..e69de29)
File README added (mode: 100644) (index 0000000..56bdb71)
1 The help menu lists all of the commands used in vide. :h [Enter] or [Alt] h
2 will activate the help memu.
3
4
File TODO added (mode: 100644) (index 0000000..3d7f8e3)
1 The Gnome requirement should be removed. The only Gnome libraries that are
2 used by Vide are the zvt terminal and gdk_imlib. Everything else is written
3 in Gtk+. Gdk_imlib is already available as an addition to Gtk+ without
4 requiring Gnome. The zvt term can be separated from Gnome by writting a
5 new autoconf for zvt as it only requires Gtk+ and gdk_imlib.
6
7 The most requested feature is a ncurses based version. This is on hold until
8 the current gui is fully established and stable.
9
10
11
File acconfig.h added (mode: 100644) (index 0000000..4a321c8)
1 #undef ENABLE_NLS
2 #undef HAVE_CATGETS
3 #undef HAVE_GETTEXT
4 #undef HAVE_LC_MESSAGES
5 #undef HAVE_STPCPY
6 #undef HAVE_LIBSM
7 #undef PACKAGE_LOCALE_DIR
8 #undef PACKAGE_DATA_DIR
9 #undef PACKAGE_SOURCE_DIR
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, &micro) != 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 autogen.sh added (mode: 100755) (index 0000000..293b797)
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 srcdir=`dirname $0`
5 PKG_NAME="the package."
6
7 DIE=0
8
9 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
10 echo
11 echo "**Error**: You must have \`autoconf' installed to."
12 echo "Download the appropriate package for your distribution,"
13 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
14 DIE=1
15 }
16
17 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
18 (libtool --version) < /dev/null > /dev/null 2>&1 || {
19 echo
20 echo "**Error**: You must have \`libtool' installed."
21 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
22 echo "(or a newer version if it is available)"
23 DIE=1
24 }
25 }
26
27 grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
28 grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
29 (gettext --version) < /dev/null > /dev/null 2>&1 || {
30 echo
31 echo "**Error**: You must have \`gettext' installed."
32 echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
33 echo "(or a newer version if it is available)"
34 DIE=1
35 }
36 }
37
38 grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
39 grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
40 (gettext --version) < /dev/null > /dev/null 2>&1 || {
41 echo
42 echo "**Error**: You must have \`gettext' installed."
43 echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
44 echo "(or a newer version if it is available)"
45 DIE=1
46 }
47 }
48
49 (automake --version) < /dev/null > /dev/null 2>&1 || {
50 echo
51 echo "**Error**: You must have \`automake' installed."
52 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
53 echo "(or a newer version if it is available)"
54 DIE=1
55 NO_AUTOMAKE=yes
56 }
57
58
59 # if no automake, don't bother testing for aclocal
60 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
61 echo
62 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
63 echo "installed doesn't appear recent enough."
64 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
65 echo "(or a newer version if it is available)"
66 DIE=1
67 }
68
69 if test "$DIE" -eq 1; then
70 exit 1
71 fi
72
73 if test -z "$*"; then
74 echo "**Warning**: I am going to run \`configure' with no arguments."
75 echo "If you wish to pass any to it, please specify them on the"
76 echo \`$0\'" command line."
77 echo
78 fi
79
80 case $CC in
81 xlc )
82 am_opt=--include-deps;;
83 esac
84
85 for coin in `find $srcdir -name configure.in -print`
86 do
87 dr=`dirname $coin`
88 if test -f $dr/NO-AUTO-GEN; then
89 echo skipping $dr -- flagged as no auto-gen
90 else
91 echo processing $dr
92 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
93 ( cd $dr
94 aclocalinclude="$ACLOCAL_FLAGS"
95 for k in $macrodirs; do
96 if test -d $k; then
97 aclocalinclude="$aclocalinclude -I $k"
98 ##else
99 ## echo "**Warning**: No such directory \`$k'. Ignored."
100 fi
101 done
102 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
103 if grep "sed.*POTFILES" configure.in >/dev/null; then
104 : do nothing -- we still have an old unmodified configure.in
105 else
106 echo "Creating $dr/aclocal.m4 ..."
107 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
108 echo "Running gettextize... Ignore non-fatal messages."
109 echo "no" | gettextize --force --copy
110 echo "Making $dr/aclocal.m4 writable ..."
111 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
112 fi
113 fi
114 if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
115 echo "Creating $dr/aclocal.m4 ..."
116 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
117 echo "Running gettextize... Ignore non-fatal messages."
118 echo "no" | gettextize --force --copy
119 echo "Making $dr/aclocal.m4 writable ..."
120 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
121 fi
122 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
123 echo "Running libtoolize..."
124 libtoolize --force --copy
125 fi
126 echo "Running aclocal $aclocalinclude ..."
127 aclocal $aclocalinclude
128 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
129 echo "Running autoheader..."
130 autoheader
131 fi
132 echo "Running automake --gnu $am_opt ..."
133 automake --add-missing --gnu $am_opt
134 echo "Running autoconf ..."
135 autoconf
136 )
137 fi
138 done
139
140 #conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
141
142 if test x$NOCONFIGURE = x; then
143 echo Running $srcdir/configure $conf_flags "$@" ...
144 $srcdir/configure $conf_flags "$@" \
145 && echo Now type \`make\' to compile $PKG_NAME
146 else
147 echo Skipping configure process.
148 fi
File config.h.in added (mode: 100644) (index 0000000..8df5899)
1 /* config.h.in. Generated automatically from configure.in by autoheader. */
2
3 /* Define if you need to in order for stat and other things to work. */
4 #undef _POSIX_SOURCE
5
6 /* Define if you have the ANSI C header files. */
7 #undef STDC_HEADERS
8
9 #undef ENABLE_NLS
10 #undef HAVE_CATGETS
11 #undef HAVE_GETTEXT
12 #undef HAVE_LC_MESSAGES
13 #undef HAVE_STPCPY
14 #undef HAVE_LIBSM
15 #undef PACKAGE_LOCALE_DIR
16 #undef PACKAGE_DATA_DIR
17 #undef PACKAGE_SOURCE_DIR
18
19 /* Define if you have the <X11/SM/SMlib.h> header file. */
20 #undef HAVE_X11_SM_SMLIB_H
21
22 /* Name of package */
23 #undef PACKAGE
24
25 /* Version number of package */
26 #undef VERSION
27
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, &micro) != 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, &micro) != 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 configure.in added (mode: 100644) (index 0000000..0ed14e2)
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT(configure.in)
4 AM_INIT_AUTOMAKE(vide, 0.5.2)
5 AM_CONFIG_HEADER(config.h)
6
7 AM_ACLOCAL_INCLUDE(macros)
8
9 GNOME_INIT
10 AC_ISC_POSIX
11 AC_PROG_CC
12 AM_PROG_CC_STDC
13 AC_HEADER_STDC
14
15 GNOME_COMPILE_WARNINGS
16 GNOME_X_CHECKS
17
18 ZVT_LIBS=`$GNOME_CONFIG --libs zvt`
19 AC_SUBST(ZVT_LIBS)
20
21 AM_PATH_GTK(1.2.0, ,
22 AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?), gthread)
23
24 dnl Set PACKAGE_DATA_DIR in config.h.
25 if test "x${datadir}" = 'x${prefix}/share'; then
26 if test "x${prefix}" = "xNONE"; then
27 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
28 else
29 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
30 fi
31 else
32 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
33 fi
34
35
36 dnl Set PACKAGE_SOURCE_DIR in config.h.
37 packagesrcdir=`cd $srcdir && pwd`
38 AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
39
40 dnl Use -Wall if we have gcc.
41 changequote(,)dnl
42 if test "x$GCC" = "xyes"; then
43 case " $CFLAGS " in
44 *[\ \ ]-Wall[\ \ ]*) ;;
45 *) CFLAGS="$CFLAGS -Wall" ;;
46 esac
47 fi
48 changequote([,])dnl
49
50 AC_OUTPUT([
51 Makefile
52 macros/Makefile
53 src/Makefile
54 ])
55
File install-sh added (mode: 100755) (index 0000000..e9de238)
1 #!/bin/sh
2 #
3 # install - install a program, script, or datafile
4 # This comes from X11R5 (mit/util/scripts/install.sh).
5 #
6 # Copyright 1991 by the Massachusetts Institute of Technology
7 #
8 # Permission to use, copy, modify, distribute, and sell this software and its
9 # documentation for any purpose is hereby granted without fee, provided that
10 # the above copyright notice appear in all copies and that both that
11 # copyright notice and this permission notice appear in supporting
12 # documentation, and that the name of M.I.T. not be used in advertising or
13 # publicity pertaining to distribution of the software without specific,
14 # written prior permission. M.I.T. makes no representations about the
15 # suitability of this software for any purpose. It is provided "as is"
16 # without express or implied warranty.
17 #
18 # Calling this script install-sh is preferred over install.sh, to prevent
19 # `make' implicit rules from creating a file called install from it
20 # when there is no Makefile.
21 #
22 # This script is compatible with the BSD install script, but was written
23 # from scratch. It can only install one file at a time, a restriction
24 # shared with many OS's install programs.
25
26
27 # set DOITPROG to echo to test this script
28
29 # Don't use :- since 4.3BSD and earlier shells don't like it.
30 doit="${DOITPROG-}"
31
32
33 # put in absolute paths if you don't have them in your path; or use env. vars.
34
35 mvprog="${MVPROG-mv}"
36 cpprog="${CPPROG-cp}"
37 chmodprog="${CHMODPROG-chmod}"
38 chownprog="${CHOWNPROG-chown}"
39 chgrpprog="${CHGRPPROG-chgrp}"
40 stripprog="${STRIPPROG-strip}"
41 rmprog="${RMPROG-rm}"
42 mkdirprog="${MKDIRPROG-mkdir}"
43
44 transformbasename=""
45 transform_arg=""
46 instcmd="$mvprog"
47 chmodcmd="$chmodprog 0755"
48 chowncmd=""
49 chgrpcmd=""
50 stripcmd=""
51 rmcmd="$rmprog -f"
52 mvcmd="$mvprog"
53 src=""
54 dst=""
55 dir_arg=""
56
57 while [ x"$1" != x ]; do
58 case $1 in
59 -c) instcmd="$cpprog"
60 shift
61 continue;;
62
63 -d) dir_arg=true
64 shift
65 continue;;
66
67 -m) chmodcmd="$chmodprog $2"
68 shift
69 shift
70 continue;;
71
72 -o) chowncmd="$chownprog $2"
73 shift
74 shift
75 continue;;
76
77 -g) chgrpcmd="$chgrpprog $2"
78 shift
79 shift
80 continue;;
81
82 -s) stripcmd="$stripprog"
83 shift
84 continue;;
85
86 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
87 shift
88 continue;;
89
90 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
91 shift
92 continue;;
93
94 *) if [ x"$src" = x ]
95 then
96 src=$1
97 else
98 # this colon is to work around a 386BSD /bin/sh bug
99 :
100 dst=$1
101 fi
102 shift
103 continue;;
104 esac
105 done
106
107 if [ x"$src" = x ]
108 then
109 echo "install: no input file specified"
110 exit 1
111 else
112 true
113 fi
114
115 if [ x"$dir_arg" != x ]; then
116 dst=$src
117 src=""
118
119 if [ -d $dst ]; then
120 instcmd=:
121 chmodcmd=""
122 else
123 instcmd=mkdir
124 fi
125 else
126
127 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
128 # might cause directories to be created, which would be especially bad
129 # if $src (and thus $dsttmp) contains '*'.
130
131 if [ -f $src -o -d $src ]
132 then
133 true
134 else
135 echo "install: $src does not exist"
136 exit 1
137 fi
138
139 if [ x"$dst" = x ]
140 then
141 echo "install: no destination specified"
142 exit 1
143 else
144 true
145 fi
146
147 # If destination is a directory, append the input filename; if your system
148 # does not like double slashes in filenames, you may need to add some logic
149
150 if [ -d $dst ]
151 then
152 dst="$dst"/`basename $src`
153 else
154 true
155 fi
156 fi
157
158 ## this sed command emulates the dirname command
159 dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
160
161 # Make sure that the destination directory exists.
162 # this part is taken from Noah Friedman's mkinstalldirs script
163
164 # Skip lots of stat calls in the usual case.
165 if [ ! -d "$dstdir" ]; then
166 defaultIFS='
167 '
168 IFS="${IFS-${defaultIFS}}"
169
170 oIFS="${IFS}"
171 # Some sh's can't handle IFS=/ for some reason.
172 IFS='%'
173 set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
174 IFS="${oIFS}"
175
176 pathcomp=''
177
178 while [ $# -ne 0 ] ; do
179 pathcomp="${pathcomp}${1}"
180 shift
181
182 if [ ! -d "${pathcomp}" ] ;
183 then
184 $mkdirprog "${pathcomp}"
185 else
186 true
187 fi
188
189 pathcomp="${pathcomp}/"
190 done
191 fi
192
193 if [ x"$dir_arg" != x ]
194 then
195 $doit $instcmd $dst &&
196
197 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
198 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
199 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
200 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
201 else
202
203 # If we're going to rename the final executable, determine the name now.
204
205 if [ x"$transformarg" = x ]
206 then
207 dstfile=`basename $dst`
208 else
209 dstfile=`basename $dst $transformbasename |
210 sed $transformarg`$transformbasename
211 fi
212
213 # don't allow the sed command to completely eliminate the filename
214
215 if [ x"$dstfile" = x ]
216 then
217 dstfile=`basename $dst`
218 else
219 true
220 fi
221
222 # Make a temp file name in the proper directory.
223
224 dsttmp=$dstdir/#inst.$$#
225
226 # Move or copy the file name to the temp name
227
228 $doit $instcmd $src $dsttmp &&
229
230 trap "rm -f ${dsttmp}" 0 &&
231
232 # and set any options; do chmod last to preserve setuid bits
233
234 # If any of these fail, we abort the whole thing. If we want to
235 # ignore errors from any of these, just make sure not to ignore
236 # errors from the above "$doit $instcmd $src $dsttmp" command.
237
238 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
239 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
240 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
241 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
242
243 # Now rename the file to the real destination.
244
245 $doit $rmcmd -f $dstdir/$dstfile &&
246 $doit $mvcmd $dsttmp $dstdir/$dstfile
247
248 fi &&
249
250
251 exit 0
File macros/Makefile added (mode: 100644) (index 0000000..b715d31)
1 # Generated automatically from Makefile.in by configure.
2 # Makefile.in generated automatically by automake 1.4a from Makefile.am
3
4 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14
15 SHELL = /bin/sh
16
17 srcdir = .
18 top_srcdir = ..
19 prefix = /usr/local
20 exec_prefix = ${prefix}
21
22 bindir = ${exec_prefix}/bin
23 sbindir = ${exec_prefix}/sbin
24 libexecdir = ${exec_prefix}/libexec
25 datadir = ${prefix}/share
26 sysconfdir = ${prefix}/etc
27 sharedstatedir = ${prefix}/com
28 localstatedir = ${prefix}/var
29 libdir = ${exec_prefix}/lib
30 infodir = ${prefix}/info
31 mandir = ${prefix}/man
32 includedir = ${prefix}/include
33 oldincludedir = /usr/include
34
35 DESTDIR =
36
37 pkgdatadir = $(datadir)/vide
38 pkglibdir = $(libdir)/vide
39 pkgincludedir = $(includedir)/vide
40
41 top_builddir = ..
42
43 ACLOCAL = aclocal -I macros
44 AUTOCONF = autoconf
45 AUTOMAKE = automake
46 AUTOHEADER = autoheader
47
48 INSTALL = /usr/bin/install -c
49 INSTALL_PROGRAM = ${INSTALL}
50 INSTALL_DATA = ${INSTALL} -m 644
51 INSTALL_SCRIPT = ${INSTALL_PROGRAM}
52 INSTALL_STRIP_FLAG =
53 transform = s,x,x,
54
55 NORMAL_INSTALL = :
56 PRE_INSTALL = :
57 POST_INSTALL = :
58 NORMAL_UNINSTALL = :
59 PRE_UNINSTALL = :
60 POST_UNINSTALL = :
61 CC = gcc
62 GNOMEGNORBA_LIBS = -rdynamic -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl
63 GNOMEUI_LIBS = -rdynamic -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl
64 GNOME_APPLETS_LIBS =
65 GNOME_CAPPLET_LIBS =
66 GNOME_CONFIG = /usr/bin/gnome-config
67 GNOME_DOCKLETS_LIBS =
68 GNOME_INCLUDEDIR = -I/usr/include -DNEED_GNOMESUPPORT_H -I/usr/lib/gnome-libs/include -I/usr/lib/glib/include -I/usr/X11R6/include
69 GNOME_LIBDIR = -rdynamic -L/usr/lib -L/usr/X11R6/lib
70 GNOME_LIBS = -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl
71 GNORBA_CFLAGS = -I/usr/include -DNEED_GNOMESUPPORT_H -I/usr/lib/gnome-libs/include -I/usr/lib/glib/include -I/usr/X11R6/include
72 GNORBA_LIBS = -rdynamic -L/usr/lib -L/usr/X11R6/lib -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl
73 GTKXMHTML_LIBS = -rdynamic -lgtkxmhtml -lXpm -ljpeg -lpng -lz -lSM -lICE -lgtk -lgdk -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm
74 GTK_CFLAGS = -I/usr/lib/glib/include -D_REENTRANT -I/usr/X11R6/include
75 GTK_CONFIG = /usr/bin/gtk-config
76 GTK_LIBS = -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lgthread -lglib -lpthread -ldl -lXi -lXext -lX11 -lm
77 MAKEINFO = makeinfo
78 ORBIT_CFLAGS = -I/usr/lib/glib/include -I/usr/include
79 ORBIT_CONFIG = /usr/bin/orbit-config
80 ORBIT_IDL = /usr/bin/orbit-idl
81 ORBIT_LIBS = -L/usr/lib -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lglib -lnsl -lm
82 PACKAGE = vide
83 PTHREAD_LIB = -lpthread
84 VERSION = 0.5.2
85 XPM_LIBS = -lXpm
86 ZVT_LIBS = -rdynamic -L/usr/lib -L/usr/X11R6/lib -lzvt -lutil -lSM -lICE -lgtk -lgdk -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm
87 cflags_set = yes
88 cxxflags_set = @cxxflags_set@
89
90 MACROS = aclocal-include.m4 compiler-flags.m4 curses.m4 gnome-bonobo-check.m4 gnome-fileutils.m4 gnome-ghttp-check.m4 gnome-gnorba-check.m4 gnome-guile-checks.m4 gnome-libgtop-check.m4 gnome-objc-checks.m4 gnome-orbit-check.m4 gnome-print-check.m4 gnome-pthread-check.m4 gnome-support.m4 gnome-undelfs.m4 gnome-vfs.m4 gnome-x-checks.m4 gnome-xml-check.m4 gnome.m4 gperf-check.m4 linger.m4 need-declaration.m4
91
92
93 EXTRA_DIST = $(MACROS) gnome-common.m4 autogen.sh
94 MAINTAINERCLEANFILES = macros.dep
95
96 #gnome_aclocaldir = $(datadir)/aclocal/gnome
97
98 #gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 autogen.sh
99 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
100 CONFIG_HEADER = ../config.h
101 CONFIG_CLEAN_FILES =
102 DATA = $(gnome_aclocal_DATA)
103
104 DIST_COMMON = Makefile.am Makefile.in
105
106
107 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
108
109 TAR = gtar
110 GZIP_ENV = --best
111 all: all-redirect
112 .SUFFIXES:
113 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
114 cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile
115
116 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
117 cd $(top_builddir) \
118 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
119
120
121 install-gnome_aclocalDATA: $(gnome_aclocal_DATA)
122 @$(NORMAL_INSTALL)
123 $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir)
124 @list='$(gnome_aclocal_DATA)'; for p in $$list; do \
125 if test -f $(srcdir)/$$p; then \
126 echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \
127 $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \
128 else if test -f $$p; then \
129 echo " $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \
130 $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \
131 fi; fi; \
132 done
133
134 uninstall-gnome_aclocalDATA:
135 @$(NORMAL_UNINSTALL)
136 list='$(gnome_aclocal_DATA)'; for p in $$list; do \
137 rm -f $(DESTDIR)$(gnome_aclocaldir)/$$p; \
138 done
139 tags: TAGS
140 TAGS:
141
142
143 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
144
145 subdir = macros
146
147 distdir: $(DISTFILES)
148 here=`cd $(top_builddir) && pwd`; \
149 top_distdir=`cd $(top_distdir) && pwd`; \
150 distdir=`cd $(distdir) && pwd`; \
151 cd $(top_srcdir) \
152 && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu macros/Makefile
153 @for file in $(DISTFILES); do \
154 d=$(srcdir); \
155 if test -d $$d/$$file; then \
156 cp -pr $$d/$$file $(distdir)/$$file; \
157 else \
158 test -f $(distdir)/$$file \
159 || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
160 || cp -p $$d/$$file $(distdir)/$$file || :; \
161 fi; \
162 done
163 info-am:
164 info: info-am
165 dvi-am:
166 dvi: dvi-am
167 check-am: all-am
168 check: check-am
169 installcheck-am:
170 installcheck: installcheck-am
171 install-exec-am:
172 install-exec: install-exec-am
173
174 install-data-am: install-gnome_aclocalDATA
175 install-data: install-data-am
176
177 install-am: all-am
178 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
179 install: install-am
180 uninstall-am: uninstall-gnome_aclocalDATA
181 uninstall: uninstall-am
182 all-am: Makefile $(DATA)
183 all-redirect: all-am
184 install-strip:
185 $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
186 installdirs:
187 $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir)
188
189
190 mostlyclean-generic:
191
192 clean-generic:
193
194 distclean-generic:
195 -rm -f Makefile $(CONFIG_CLEAN_FILES)
196 -rm -f config.cache config.log stamp-h stamp-h[0-9]*
197
198 maintainer-clean-generic:
199 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
200 mostlyclean-am: mostlyclean-generic
201
202 mostlyclean: mostlyclean-am
203
204 clean-am: clean-generic mostlyclean-am
205
206 clean: clean-am
207
208 distclean-am: distclean-generic clean-am
209
210 distclean: distclean-am
211
212 maintainer-clean-am: maintainer-clean-generic distclean-am
213 @echo "This command is intended for maintainers to use;"
214 @echo "it deletes files that may require special tools to rebuild."
215
216 maintainer-clean: maintainer-clean-am
217
218 .PHONY: uninstall-gnome_aclocalDATA install-gnome_aclocalDATA tags \
219 distdir info-am info dvi-am dvi check check-am installcheck-am \
220 installcheck install-exec-am install-exec install-data-am install-data \
221 install-am install uninstall-am uninstall all-redirect all-am all \
222 installdirs mostlyclean-generic distclean-generic clean-generic \
223 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
224
225
226 macros.dep: Makefile.am
227 @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@
228
229 #gnome-macros.dep: Makefile.am
230 # @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@
231
232 # Tell versions [3.59,3.63) of GNU make to not export all variables.
233 # Otherwise a system limit (for SysV at least) may be exceeded.
234 .NOEXPORT:
File macros/Makefile.am added (mode: 100644) (index 0000000..2b7b6eb)
1 ## Please update this variable if any new macros are created
2
3 MACROS= \
4 aclocal-include.m4 \
5 compiler-flags.m4 \
6 curses.m4 \
7 gnome-bonobo-check.m4 \
8 gnome-fileutils.m4 \
9 gnome-ghttp-check.m4 \
10 gnome-gnorba-check.m4 \
11 gnome-guile-checks.m4 \
12 gnome-libgtop-check.m4 \
13 gnome-objc-checks.m4 \
14 gnome-orbit-check.m4 \
15 gnome-print-check.m4 \
16 gnome-pthread-check.m4 \
17 gnome-support.m4 \
18 gnome-undelfs.m4 \
19 gnome-vfs.m4 \
20 gnome-x-checks.m4 \
21 gnome-xml-check.m4 \
22 gnome.m4 \
23 gperf-check.m4 \
24 linger.m4 \
25 need-declaration.m4
26
27 EXTRA_DIST=$(MACROS) gnome-common.m4 autogen.sh
28 MAINTAINERCLEANFILES=macros.dep
29
30 @MAINT@macros.dep: Makefile.am
31 @MAINT@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@
32
33 if INSIDE_GNOME_COMMON
34 gnome_aclocaldir = $(datadir)/aclocal/gnome
35
36 gnome-macros.dep: Makefile.am
37 @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@
38
39 gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 autogen.sh
40
41 endif
File macros/Makefile.in added (mode: 100644) (index 0000000..0eb78cc)
1 # Makefile.in generated automatically by automake 1.4a from Makefile.am
2
3 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 # This Makefile.in is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13
14 SHELL = @SHELL@
15
16 srcdir = @srcdir@
17 top_srcdir = @top_srcdir@
18 VPATH = @srcdir@
19 prefix = @prefix@
20 exec_prefix = @exec_prefix@
21
22 bindir = @bindir@
23 sbindir = @sbindir@
24 libexecdir = @libexecdir@
25 datadir = @datadir@
26 sysconfdir = @sysconfdir@
27 sharedstatedir = @sharedstatedir@
28 localstatedir = @localstatedir@
29 libdir = @libdir@
30 infodir = @infodir@
31 mandir = @mandir@
32 includedir = @includedir@
33 oldincludedir = /usr/include
34
35 DESTDIR =
36
37 pkgdatadir = $(datadir)/@PACKAGE@
38 pkglibdir = $(libdir)/@PACKAGE@
39 pkgincludedir = $(includedir)/@PACKAGE@
40
41 top_builddir = ..
42
43 ACLOCAL = @ACLOCAL@
44 AUTOCONF = @AUTOCONF@
45 AUTOMAKE = @AUTOMAKE@
46 AUTOHEADER = @AUTOHEADER@
47
48 INSTALL = @INSTALL@
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 INSTALL_DATA = @INSTALL_DATA@
51 INSTALL_SCRIPT = @INSTALL_SCRIPT@
52 INSTALL_STRIP_FLAG =
53 transform = @program_transform_name@
54
55 NORMAL_INSTALL = :
56 PRE_INSTALL = :
57 POST_INSTALL = :
58 NORMAL_UNINSTALL = :
59 PRE_UNINSTALL = :
60 POST_UNINSTALL = :
61 CC = @CC@
62 GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@
63 GNOMEUI_LIBS = @GNOMEUI_LIBS@
64 GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@
65 GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@
66 GNOME_CONFIG = @GNOME_CONFIG@
67 GNOME_DOCKLETS_LIBS = @GNOME_DOCKLETS_LIBS@
68 GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@
69 GNOME_LIBDIR = @GNOME_LIBDIR@
70 GNOME_LIBS = @GNOME_LIBS@
71 GNORBA_CFLAGS = @GNORBA_CFLAGS@
72 GNORBA_LIBS = @GNORBA_LIBS@
73 GTKXMHTML_LIBS = @GTKXMHTML_LIBS@
74 GTK_CFLAGS = @GTK_CFLAGS@
75 GTK_CONFIG = @GTK_CONFIG@
76 GTK_LIBS = @GTK_LIBS@
77 MAKEINFO = @MAKEINFO@
78 ORBIT_CFLAGS = @ORBIT_CFLAGS@
79 ORBIT_CONFIG = @ORBIT_CONFIG@
80 ORBIT_IDL = @ORBIT_IDL@
81 ORBIT_LIBS = @ORBIT_LIBS@
82 PACKAGE = @PACKAGE@
83 PTHREAD_LIB = @PTHREAD_LIB@
84 VERSION = @VERSION@
85 XPM_LIBS = @XPM_LIBS@
86 ZVT_LIBS = @ZVT_LIBS@
87 cflags_set = @cflags_set@
88 cxxflags_set = @cxxflags_set@
89
90 MACROS = aclocal-include.m4 compiler-flags.m4 curses.m4 gnome-bonobo-check.m4 gnome-fileutils.m4 gnome-ghttp-check.m4 gnome-gnorba-check.m4 gnome-guile-checks.m4 gnome-libgtop-check.m4 gnome-objc-checks.m4 gnome-orbit-check.m4 gnome-print-check.m4 gnome-pthread-check.m4 gnome-support.m4 gnome-undelfs.m4 gnome-vfs.m4 gnome-x-checks.m4 gnome-xml-check.m4 gnome.m4 gperf-check.m4 linger.m4 need-declaration.m4
91
92
93 EXTRA_DIST = $(MACROS) gnome-common.m4 autogen.sh
94 MAINTAINERCLEANFILES = macros.dep
95
96 @INSIDE_GNOME_COMMON_TRUE@gnome_aclocaldir = $(datadir)/aclocal/gnome
97
98 @INSIDE_GNOME_COMMON_TRUE@gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 autogen.sh
99 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
100 CONFIG_HEADER = ../config.h
101 CONFIG_CLEAN_FILES =
102 DATA = $(gnome_aclocal_DATA)
103
104 DIST_COMMON = Makefile.am Makefile.in
105
106
107 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
108
109 TAR = gtar
110 GZIP_ENV = --best
111 all: all-redirect
112 .SUFFIXES:
113 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
114 cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile
115
116 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
117 cd $(top_builddir) \
118 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
119
120
121 install-gnome_aclocalDATA: $(gnome_aclocal_DATA)
122 @$(NORMAL_INSTALL)
123 $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir)
124 @list='$(gnome_aclocal_DATA)'; for p in $$list; do \
125 if test -f $(srcdir)/$$p; then \
126 echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \
127 $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \
128 else if test -f $$p; then \
129 echo " $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p"; \
130 $(INSTALL_DATA) $$p $(DESTDIR)$(gnome_aclocaldir)/$$p; \
131 fi; fi; \
132 done
133
134 uninstall-gnome_aclocalDATA:
135 @$(NORMAL_UNINSTALL)
136 list='$(gnome_aclocal_DATA)'; for p in $$list; do \
137 rm -f $(DESTDIR)$(gnome_aclocaldir)/$$p; \
138 done
139 tags: TAGS
140 TAGS:
141
142
143 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
144
145 subdir = macros
146
147 distdir: $(DISTFILES)
148 here=`cd $(top_builddir) && pwd`; \
149 top_distdir=`cd $(top_distdir) && pwd`; \
150 distdir=`cd $(distdir) && pwd`; \
151 cd $(top_srcdir) \
152 && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu macros/Makefile
153 @for file in $(DISTFILES); do \
154 d=$(srcdir); \
155 if test -d $$d/$$file; then \
156 cp -pr $$d/$$file $(distdir)/$$file; \
157 else \
158 test -f $(distdir)/$$file \
159 || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
160 || cp -p $$d/$$file $(distdir)/$$file || :; \
161 fi; \
162 done
163 info-am:
164 info: info-am
165 dvi-am:
166 dvi: dvi-am
167 check-am: all-am
168 check: check-am
169 installcheck-am:
170 installcheck: installcheck-am
171 install-exec-am:
172 install-exec: install-exec-am
173
174 install-data-am: install-gnome_aclocalDATA
175 install-data: install-data-am
176
177 install-am: all-am
178 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
179 install: install-am
180 uninstall-am: uninstall-gnome_aclocalDATA
181 uninstall: uninstall-am
182 all-am: Makefile $(DATA)
183 all-redirect: all-am
184 install-strip:
185 $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
186 installdirs:
187 $(mkinstalldirs) $(DESTDIR)$(gnome_aclocaldir)
188
189
190 mostlyclean-generic:
191
192 clean-generic:
193
194 distclean-generic:
195 -rm -f Makefile $(CONFIG_CLEAN_FILES)
196 -rm -f config.cache config.log stamp-h stamp-h[0-9]*
197
198 maintainer-clean-generic:
199 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
200 mostlyclean-am: mostlyclean-generic
201
202 mostlyclean: mostlyclean-am
203
204 clean-am: clean-generic mostlyclean-am
205
206 clean: clean-am
207
208 distclean-am: distclean-generic clean-am
209
210 distclean: distclean-am
211
212 maintainer-clean-am: maintainer-clean-generic distclean-am
213 @echo "This command is intended for maintainers to use;"
214 @echo "it deletes files that may require special tools to rebuild."
215
216 maintainer-clean: maintainer-clean-am
217
218 .PHONY: uninstall-gnome_aclocalDATA install-gnome_aclocalDATA tags \
219 distdir info-am info dvi-am dvi check check-am installcheck-am \
220 installcheck install-exec-am install-exec install-data-am install-data \
221 install-am install uninstall-am uninstall all-redirect all-am all \
222 installdirs mostlyclean-generic distclean-generic clean-generic \
223 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
224
225
226 macros.dep: Makefile.am
227 @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@
228
229 @INSIDE_GNOME_COMMON_TRUE@gnome-macros.dep: Makefile.am
230 @INSIDE_GNOME_COMMON_TRUE@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@
231
232 # Tell versions [3.59,3.63) of GNU make to not export all variables.
233 # Otherwise a system limit (for SysV at least) may be exceeded.
234 .NOEXPORT:
File macros/aclocal-include.m4 added (mode: 100644) (index 0000000..abf6533)
1 # aclocal-include.m4
2 #
3 # This macro adds the name macrodir to the set of directories
4 # that `aclocal' searches for macros.
5
6 # serial 1
7
8 dnl AM_ACLOCAL_INCLUDE(macrodir)
9 AC_DEFUN([AM_ACLOCAL_INCLUDE],
10 [
11 AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y)
12
13 test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
14
15 for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
16 ])
File macros/autogen.sh added (mode: 100644) (index 0000000..18cfd60)
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5
6 if [ -n "$GNOME2_PATH" ]; then
7 ACLOCAL_FLAGS="-I $GNOME2_PATH/share/aclocal $ACLOCAL_FLAGS"
8 PATH="$GNOME2_PATH/bin:$PATH"
9 export PATH
10 fi
11
12 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
13 echo
14 echo "**Error**: You must have \`autoconf' installed to compile Gnome."
15 echo "Download the appropriate package for your distribution,"
16 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
17 DIE=1
18 }
19
20 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
21 (libtool --version) < /dev/null > /dev/null 2>&1 || {
22 echo
23 echo "**Error**: You must have \`libtool' installed to compile Gnome."
24 echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
25 echo "(or a newer version if it is available)"
26 DIE=1
27 }
28 }
29
30 grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
31 grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
32 (gettext --version) < /dev/null > /dev/null 2>&1 || {
33 echo
34 echo "**Error**: You must have \`gettext' installed to compile Gnome."
35 echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
36 echo "(or a newer version if it is available)"
37 DIE=1
38 }
39 }
40
41 grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
42 grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
43 (gettext --version) < /dev/null > /dev/null 2>&1 || {
44 echo
45 echo "**Error**: You must have \`gettext' installed to compile Gnome."
46 echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
47 echo "(or a newer version if it is available)"
48 DIE=1
49 }
50 }
51
52 (automake --version) < /dev/null > /dev/null 2>&1 || {
53 echo
54 echo "**Error**: You must have \`automake' installed to compile Gnome."
55 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
56 echo "(or a newer version if it is available)"
57 DIE=1
58 NO_AUTOMAKE=yes
59 }
60
61
62 # if no automake, don't bother testing for aclocal
63 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
64 echo
65 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
66 echo "installed doesn't appear recent enough."
67 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
68 echo "(or a newer version if it is available)"
69 DIE=1
70 }
71
72 if test "$DIE" -eq 1; then
73 exit 1
74 fi
75
76 if test -z "$*"; then
77 echo "**Warning**: I am going to run \`configure' with no arguments."
78 echo "If you wish to pass any to it, please specify them on the"
79 echo \`$0\'" command line."
80 echo
81 fi
82
83 case $CC in
84 xlc )
85 am_opt=--include-deps;;
86 esac
87
88 for coin in `find $srcdir -name configure.in -print`
89 do
90 dr=`dirname $coin`
91 if test -f $dr/NO-AUTO-GEN; then
92 echo skipping $dr -- flagged as no auto-gen
93 else
94 echo processing $dr
95 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
96 ( cd $dr
97 macrosdir=`find . -name macros -print`
98 for i in $macrodirs; do
99 if test -f $i/gnome-gettext.m4; then
100 DELETEFILES="$DELETEFILES $i/gnome-gettext.m4"
101 fi
102 done
103
104 echo "deletefiles is $DELETEFILES"
105 aclocalinclude="$ACLOCAL_FLAGS"
106 for k in $aclocalinclude; do
107 if test -d $k; then
108 if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then
109 rm -f $DELETEFILES
110 fi
111 fi
112 done
113 for k in $macrodirs; do
114 if test -d $k; then
115 aclocalinclude="$aclocalinclude -I $k"
116 if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then
117 rm -f $DELETEFILES
118 fi
119 fi
120 done
121 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
122 if grep "sed.*POTFILES" configure.in >/dev/null; then
123 : do nothing -- we still have an old unmodified configure.in
124 else
125 echo "Creating $dr/aclocal.m4 ..."
126 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
127 echo "Running gettextize... Ignore non-fatal messages."
128 echo "no" | gettextize --force --copy
129 echo "Making $dr/aclocal.m4 writable ..."
130 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
131 fi
132 fi
133 if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
134 echo "Creating $dr/aclocal.m4 ..."
135 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
136 echo "Running gettextize... Ignore non-fatal messages."
137 echo "no" | gettextize --force --copy
138 echo "Making $dr/aclocal.m4 writable ..."
139 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
140 fi
141 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
142 if test -z "$NO_LIBTOOLIZE" ; then
143 echo "Running libtoolize..."
144 libtoolize --force --copy
145 fi
146 fi
147 echo "Running aclocal $aclocalinclude ..."
148 aclocal $aclocalinclude
149 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
150 echo "Running autoheader..."
151 autoheader
152 fi
153 echo "Running automake --gnu $am_opt ..."
154 automake --add-missing --gnu $am_opt
155 echo "Running autoconf ..."
156 autoconf
157 )
158 fi
159 done
160
161 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
162
163 if test x$NOCONFIGURE = x; then
164 echo Running $srcdir/configure $conf_flags "$@" ...
165 $srcdir/configure $conf_flags "$@" \
166 && echo Now type \`make\' to compile $PKG_NAME || exit 1
167 else
168 echo Skipping configure process.
169 fi
File macros/compiler-flags.m4 added (mode: 100644) (index 0000000..63f8e2e)
1 dnl GNOME_COMPILE_WARNINGS
2 dnl Turn on many useful compiler warnings
3 dnl For now, only works on GCC
4 AC_DEFUN([GNOME_COMPILE_WARNINGS],[
5 AC_ARG_ENABLE(compile-warnings,
6 [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum)
7
8 AC_MSG_CHECKING(what warning flags to pass to the C compiler)
9 warnCFLAGS=
10 if test "x$GCC" != xyes; then
11 enable_compile_warnings=no
12 fi
13
14 if test "x$enable_compile_warnings" != "xno"; then
15 if test "x$GCC" = "xyes"; then
16 case " $CFLAGS " in
17 *[\ \ ]-Wall[\ \ ]*) ;;
18 *) warnCFLAGS="-Wall -Wunused" ;;
19 esac
20
21 ## -W is not all that useful. And it cannot be controlled
22 ## with individual -Wno-xxx flags, unlike -Wall
23 if test "x$enable_compile_warnings" = "xyes"; then
24 warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations"
25 fi
26 fi
27 fi
28 AC_MSG_RESULT($warnCFLAGS)
29
30 AC_ARG_ENABLE(iso-c,
31 [ --enable-iso-c Try to warn if code is not ISO C ],,
32 enable_iso_c=no)
33
34 AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
35 complCFLAGS=
36 if test "x$enable_iso_c" != "xno"; then
37 if test "x$GCC" = "xyes"; then
38 case " $CFLAGS " in
39 *[\ \ ]-ansi[\ \ ]*) ;;
40 *) complCFLAGS="$complCFLAGS -ansi" ;;
41 esac
42
43 case " $CFLAGS " in
44 *[\ \ ]-pedantic[\ \ ]*) ;;
45 *) complCFLAGS="$complCFLAGS -pedantic" ;;
46 esac
47 fi
48 fi
49 AC_MSG_RESULT($complCFLAGS)
50 if test "x$cflags_set" != "xyes"; then
51 CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
52 cflags_set=yes
53 AC_SUBST(cflags_set)
54 fi
55 ])
56
57 dnl For C++, do basically the same thing.
58
59 AC_DEFUN([GNOME_CXX_WARNINGS],[
60 AC_ARG_ENABLE(cxx-warnings,
61 [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum)
62
63 AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
64 warnCXXFLAGS=
65 if test "x$GCC" != xyes; then
66 enable_compile_warnings=no
67 fi
68 if test "x$enable_cxx_warnings" != "xno"; then
69 if test "x$GCC" = "xyes"; then
70 case " $CXXFLAGS " in
71 *[\ \ ]-Wall[\ \ ]*) ;;
72 *) warnCXXFLAGS="-Wall -Wno-unused" ;;
73 esac
74
75 ## -W is not all that useful. And it cannot be controlled
76 ## with individual -Wno-xxx flags, unlike -Wall
77 if test "x$enable_cxx_warnings" = "xyes"; then
78 warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wshadow -Woverloaded-virtual"
79 fi
80 fi
81 fi
82 AC_MSG_RESULT($warnCXXFLAGS)
83
84 AC_ARG_ENABLE(iso-cxx,
85 [ --enable-iso-cxx Try to warn if code is not ISO C++ ],,
86 enable_iso_cxx=no)
87
88 AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
89 complCXXFLAGS=
90 if test "x$enable_iso_cxx" != "xno"; then
91 if test "x$GCC" = "xyes"; then
92 case " $CXXFLAGS " in
93 *[\ \ ]-ansi[\ \ ]*) ;;
94 *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
95 esac
96
97 case " $CXXFLAGS " in
98 *[\ \ ]-pedantic[\ \ ]*) ;;
99 *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
100 esac
101 fi
102 fi
103 AC_MSG_RESULT($complCXXFLAGS)
104 if test "x$cxxflags_set" != "xyes"; then
105 CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
106 cxxflags_set=yes
107 AC_SUBST(cxxflags_set)
108 fi
109 ])
File macros/curses.m4 added (mode: 100644) (index 0000000..3dd4ffa)
1 dnl Curses detection: Munged from Midnight Commander's configure.in
2 dnl
3 dnl What it does:
4 dnl =============
5 dnl
6 dnl - Determine which version of curses is installed on your system
7 dnl and set the -I/-L/-l compiler entries and add a few preprocessor
8 dnl symbols
9 dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
10 dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
11 dnl Makefile.in's
12 dnl - Modify the following configure variables (these are the only
13 dnl curses.m4 variables you can access from within configure.in)
14 dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
15 dnl an ncurses.h that's been renamed to curses.h
16 dnl is found.
17 dnl CURSES_LIBS - sets -L and -l's appropriately
18 dnl CFLAGS - if --with-sco, add -D_SVID3
19 dnl has_curses - exports result of tests to rest of configure
20 dnl
21 dnl Usage:
22 dnl ======
23 dnl 1) Add lines indicated below to acconfig.h
24 dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
25 dnl 3) Instead of #include <curses.h> you should use the following to
26 dnl properly locate ncurses or curses header file
27 dnl
28 dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
29 dnl #include <ncurses.h>
30 dnl #else
31 dnl #include <curses.h>
32 dnl #endif
33 dnl
34 dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
35 dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
36 dnl
37 dnl Notes with automake:
38 dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
39 dnl configure.in
40 dnl - your Makefile.am can look something like this
41 dnl -----------------------------------------------
42 dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
43 dnl if HAS_CURSES
44 dnl CURSES_TARGETS=name_of_curses_prog
45 dnl endif
46 dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
47 dnl other_programs_SOURCES = blah blah blah
48 dnl name_of_curses_prog_SOURCES = blah blah blah
49 dnl other_programs_LDADD = blah
50 dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
51 dnl -----------------------------------------------
52 dnl
53 dnl
54 dnl The following lines should be added to acconfig.h:
55 dnl ==================================================
56 dnl
57 dnl /*=== Curses version detection defines ===*/
58 dnl /* Found some version of curses that we're going to use */
59 dnl #undef HAS_CURSES
60 dnl
61 dnl /* Use SunOS SysV curses? */
62 dnl #undef USE_SUNOS_CURSES
63 dnl
64 dnl /* Use old BSD curses - not used right now */
65 dnl #undef USE_BSD_CURSES
66 dnl
67 dnl /* Use SystemV curses? */
68 dnl #undef USE_SYSV_CURSES
69 dnl
70 dnl /* Use Ncurses? */
71 dnl #undef USE_NCURSES
72 dnl
73 dnl /* If you Curses does not have color define this one */
74 dnl #undef NO_COLOR_CURSES
75 dnl
76 dnl /* Define if you want to turn on SCO-specific code */
77 dnl #undef SCO_FLAVOR
78 dnl
79 dnl /* Set to reflect version of ncurses *
80 dnl * 0 = version 1.*
81 dnl * 1 = version 1.9.9g
82 dnl * 2 = version 4.0/4.1 */
83 dnl #undef NCURSES_970530
84 dnl
85 dnl /*=== End new stuff for acconfig.h ===*/
86 dnl
87
88
89 AC_DEFUN(AC_CHECK_CURSES,[
90 search_ncurses=true
91 screen_manager=""
92 has_curses=false
93
94 CFLAGS=${CFLAGS--O}
95
96 AC_SUBST(CURSES_LIBS)
97 AC_SUBST(CURSES_INCLUDEDIR)
98
99 AC_ARG_WITH(sco,
100 [ --with-sco Use this to turn on SCO-specific code],[
101 if test x$withval = xyes; then
102 AC_DEFINE(SCO_FLAVOR)
103 CFLAGS="$CFLAGS -D_SVID3"
104 fi
105 ])
106
107 AC_ARG_WITH(sunos-curses,
108 [ --with-sunos-curses Used to force SunOS 4.x curses],[
109 if test x$withval = xyes; then
110 AC_USE_SUNOS_CURSES
111 fi
112 ])
113
114 AC_ARG_WITH(osf1-curses,
115 [ --with-osf1-curses Used to force OSF/1 curses],[
116 if test x$withval = xyes; then
117 AC_USE_OSF1_CURSES
118 fi
119 ])
120
121 AC_ARG_WITH(vcurses,
122 [ --with-vcurses[=incdir] Used to force SysV curses],
123 if test x$withval != xyes; then
124 CURSES_INCLUDEDIR="-I$withval"
125 fi
126 AC_USE_SYSV_CURSES
127 )
128
129 AC_ARG_WITH(ncurses,
130 [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
131 if test x$withval = xno ; then
132 search_ncurses=false
133 elif test x$withval != xyes ; then
134 CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
135 CURSES_INCLUDEDIR="-I$withval/include"
136 search_ncurses=false
137 screen_manager="ncurses"
138 AC_DEFINE(USE_NCURSES)
139 AC_DEFINE(HAS_CURSES)
140 has_curses=true
141 fi
142 )
143
144 if $search_ncurses
145 then
146 AC_SEARCH_NCURSES()
147 fi
148
149
150 ])
151
152
153 AC_DEFUN(AC_USE_SUNOS_CURSES, [
154 search_ncurses=false
155 screen_manager="SunOS 4.x /usr/5include curses"
156 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
157 AC_DEFINE(USE_SUNOS_CURSES)
158 AC_DEFINE(HAS_CURSES)
159 has_curses=true
160 AC_DEFINE(NO_COLOR_CURSES)
161 AC_DEFINE(USE_SYSV_CURSES)
162 CURSES_INCLUDEDIR="-I/usr/5include"
163 CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
164 AC_MSG_RESULT(Please note that some screen refreshs may fail)
165 ])
166
167 AC_DEFUN(AC_USE_OSF1_CURSES, [
168 AC_MSG_RESULT(Using OSF1 curses)
169 search_ncurses=false
170 screen_manager="OSF1 curses"
171 AC_DEFINE(HAS_CURSES)
172 has_curses=true
173 AC_DEFINE(NO_COLOR_CURSES)
174 AC_DEFINE(USE_SYSV_CURSES)
175 CURSES_LIBS="-lcurses"
176 ])
177
178 AC_DEFUN(AC_USE_SYSV_CURSES, [
179 AC_MSG_RESULT(Using SysV curses)
180 AC_DEFINE(HAS_CURSES)
181 has_curses=true
182 AC_DEFINE(USE_SYSV_CURSES)
183 search_ncurses=false
184 screen_manager="SysV/curses"
185 CURSES_LIBS="-lcurses"
186 ])
187
188 dnl AC_ARG_WITH(bsd-curses,
189 dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
190 dnl search_ncurses=false
191 dnl screen_manager="Ultrix/cursesX"
192 dnl if test $system = ULTRIX
193 dnl then
194 dnl THIS_CURSES=cursesX
195 dnl else
196 dnl THIS_CURSES=curses
197 dnl fi
198 dnl
199 dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
200 dnl AC_DEFINE(HAS_CURSES)
201 dnl has_curses=true
202 dnl AC_DEFINE(USE_BSD_CURSES)
203 dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
204 dnl AC_WARN(Use of the bsdcurses extension has some)
205 dnl AC_WARN(display/input problems.)
206 dnl AC_WARN(Reconsider using xcurses)
207 dnl)
208
209
210 dnl
211 dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
212 dnl
213 AC_DEFUN(AC_NCURSES, [
214 if $search_ncurses
215 then
216 if test -f $1/$2
217 then
218 AC_MSG_RESULT(Found ncurses on $1/$2)
219 CURSES_LIBS="$3"
220 CURSES_INCLUDEDIR="$4"
221 search_ncurses=false
222 screen_manager=$5
223 AC_DEFINE(HAS_CURSES)
224 has_curses=true
225 AC_DEFINE(USE_NCURSES)
226 fi
227 fi
228 ])
229
230 AC_DEFUN(AC_SEARCH_NCURSES, [
231 AC_CHECKING("location of ncurses.h file")
232
233 AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
234 AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
235 AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
236 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
237
238 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
239
240 AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
241
242 dnl
243 dnl We couldn't find ncurses, try SysV curses
244 dnl
245 if $search_ncurses
246 then
247 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
248 AC_USE_SYSV_CURSES)
249 AC_EGREP_CPP(USE_NCURSES,[
250 #include <curses.h>
251 #ifdef __NCURSES_H
252 #undef USE_NCURSES
253 USE_NCURSES
254 #endif
255 ],[
256 CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
257 AC_DEFINE(HAS_CURSES)
258 has_curses=true
259 AC_DEFINE(USE_NCURSES)
260 search_ncurses=false
261 screen_manager="ncurses installed as curses"
262 ])
263 fi
264
265 dnl
266 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
267 dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
268 dnl should be replaced by a more fine grained selection routine
269 dnl
270 if $search_ncurses
271 then
272 if test -f /usr/5include/curses.h
273 then
274 AC_USE_SUNOS_CURSES
275 fi
276 else
277 # check for ncurses version, to properly ifdef mouse-fix
278 AC_MSG_CHECKING(for ncurses version)
279 ncurses_version=unknown
280 cat > conftest.$ac_ext <<EOF
281 [#]line __oline__ "configure"
282 #include "confdefs.h"
283 #ifdef RENAMED_NCURSES
284 #include <curses.h>
285 #else
286 #include <ncurses.h>
287 #endif
288 #undef VERSION
289 VERSION:NCURSES_VERSION
290 EOF
291 if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
292 egrep "VERSION:" >conftest.out 2>&1; then
293 changequote(,)dnl
294 ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
295 changequote([,])dnl
296 fi
297 rm -rf conftest*
298 AC_MSG_RESULT($ncurses_version)
299 case "$ncurses_version" in
300 changequote(,)dnl
301 4.[01])
302 changequote([,])dnl
303 AC_DEFINE(NCURSES_970530,2)
304 ;;
305 1.9.9g)
306 AC_DEFINE(NCURSES_970530,1)
307 ;;
308 1*)
309 AC_DEFINE(NCURSES_970530,0)
310 ;;
311 esac
312 fi
313 ])
314
315
316
317
318
File macros/gnome-bonobo-check.m4 added (mode: 100644) (index 0000000..7eb2b26)
1 # Configure paths for Bonobo
2 # Miguel de Icaza, 99-04-12
3 # Stolen from Chris Lahey 99-2-5
4 # stolen from Manish Singh again
5 # stolen back from Frank Belew
6 # stolen from Manish Singh
7 # Shamelessly stolen from Owen Taylor
8
9 dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
10 dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS
11 dnl
12 AC_DEFUN([AM_PATH_BONOBO],
13 [
14 dnl
15 dnl Get the cflags and libraries from the gnome-config script
16 dnl
17 AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)],
18 bonobo_prefix="$withval", bonobo_prefix="")
19 AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)],
20 bonobo_exec_prefix="$withval", bonobo_exec_prefix="")
21 AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program],
22 , enable_bonobotest=yes)
23
24 if test x$bonobo_exec_prefix != x ; then
25 bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix"
26 if test x${GNOME_CONFIG+set} != xset ; then
27 GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config
28 fi
29 fi
30 if test x$bonobo_prefix != x ; then
31 bonobo_args="$bonobo_args --prefix=$bonobo_prefix"
32 if test x${GNOME_CONFIG+set} != xset ; then
33 GNOME_CONFIG=$bonobo_prefix/bin/gnome-config
34 fi
35 fi
36
37 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
38 min_bonobo_version=ifelse([$1], ,0.1.0,$1)
39 AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version)
40 no_bonobo=""
41 if test "$GNOME_CONFIG" = "no" ; then
42 no_bonobo=yes
43 else
44 BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo`
45 BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo`
46
47 bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
49 bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
51 bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \
52 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
53 if test "x$enable_bonobotest" = "xyes" ; then
54 ac_save_CFLAGS="$CFLAGS"
55 ac_save_LIBS="$LIBS"
56 CFLAGS="$CFLAGS $BONOBO_CFLAGS"
57 LIBS="$LIBS $BONOBO_LIBS"
58 dnl
59 dnl Now check if the installed BONOBO is sufficiently new. (Also sanity
60 dnl checks the results of gnome-config to some extent
61 dnl
62 rm -f conf.bonobotest
63 AC_TRY_RUN([
64 #include <stdio.h>
65 #include <stdlib.h>
66 #include <string.h>
67 #include <bonobo.h>
68
69 static char*
70 my_strdup (char *str)
71 {
72 char *new_str;
73
74 if (str)
75 {
76 new_str = malloc ((strlen (str) + 1) * sizeof(char));
77 strcpy (new_str, str);
78 }
79 else
80 new_str = NULL;
81
82 return new_str;
83 }
84
85 int main ()
86 {
87 int major, minor, micro;
88 char *tmp_version;
89
90 system ("touch conf.bonobotest");
91 bonobo_object_get_type ();
92 return 0;
93 }
94
95 ],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
96 CFLAGS="$ac_save_CFLAGS"
97 LIBS="$ac_save_LIBS"
98 fi
99 fi
100 if test "x$no_bonobo" = x ; then
101 AC_MSG_RESULT(yes)
102 ifelse([$2], , :, [$2])
103 else
104 AC_MSG_RESULT(no)
105 if test "$GNOME_CONFIG" = "no" ; then
106 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
107 echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in"
108 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
109 echo "*** full path to gnome-config."
110 else
111 if test -f conf.bonobotest ; then
112 :
113 else
114 echo "*** Could not run BONOBO test program, checking why..."
115 CFLAGS="$CFLAGS $BONOBO_CFLAGS"
116 LIBS="$LIBS $BONOBO_LIBS"
117 AC_TRY_LINK([
118 #include <stdio.h>
119 #include <bonobo/gnome-object.h>
120 ], [ return 0; ],
121 [ echo "*** The test program compiled, but did not run. This usually means"
122 echo "*** that the run-time linker is not finding BONOBO or finding the wrong"
123 echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your"
124 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
125 echo "*** to the installed location Also, make sure you have run ldconfig if that"
126 echo "*** is required on your system"
127 echo "***"
128 echo "*** If you have an old version installed, it is best to remove it, although"
129 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
130 [ echo "*** The test program failed to compile or link. See the file config.log for the"
131 echo "*** exact error that occured. This usually means BONOBO was incorrectly installed"
132 echo "*** or that you have moved BONOBO since it was installed. In the latter case, you"
133 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
134 CFLAGS="$ac_save_CFLAGS"
135 LIBS="$ac_save_LIBS"
136 fi
137 fi
138 BONOBO_CFLAGS=""
139 BONOBO_LIBS=""
140 ifelse([$3], , :, [$3])
141 fi
142 AC_SUBST(BONOBO_CFLAGS)
143 AC_SUBST(BONOBO_LIBS)
144 rm -f conf.bonobotest
145 ])
146
147 AC_DEFUN([BONOBO_CHECK], [
148 AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)])
149 ])
150
File macros/gnome-common.m4 added (mode: 100644) (index 0000000..b723829)
1 # gnome-common.m4
2 #
3 # This only for packages that are not in the GNOME CVS tree.
4
5 dnl GNOME_COMMON_INIT
6
7 AC_DEFUN([GNOME_COMMON_INIT],
8 [
9 GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome
10 AC_SUBST(GNOME_ACLOCAL_DIR)
11
12 ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR"
13 ])
14
File macros/gnome-fileutils.m4 added (mode: 100644) (index 0000000..7c11a78)
1 dnl
2 dnl GNOME_FILEUTILS_CHECKS
3 dnl
4 dnl checks that are needed for the diskusage applet.
5 dnl
6
7 AC_DEFUN([GNOME_FILEUTILS_CHECKS],
8 [
9 AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
10 mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
11 sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
12
13 AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
14 getcwd getmntinfo gettimeofday isascii lchown \
15 listmntent memcpy mkfifo strchr strerror strrchr vprintf)
16
17 dnl Set some defaults when cross-compiling
18
19 if test x$cross_compiling = xyes ; then
20 case "$host_os" in
21 linux*)
22 fu_cv_sys_mounted_getmntent1=yes
23 fu_cv_sys_stat_statfs2_bsize=yes
24 ;;
25 sunos*)
26 fu_cv_sys_stat_statfs4=yes
27 ;;
28 freebsd*)
29 fu_cv_sys_stat_statfs2_bsize=yes
30 ;;
31 osf*)
32 fu_cv_sys_stat_statfs3_osf1=yes
33 ;;
34 esac
35 fi
36
37 # Determine how to get the list of mounted filesystems.
38 list_mounted_fs=
39
40 # If the getmntent function is available but not in the standard library,
41 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
42 AC_FUNC_GETMNTENT
43
44 # This test must precede the ones for getmntent because Unicos-9 is
45 # reported to have the getmntent function, but its support is incompatible
46 # with other getmntent implementations.
47
48 # NOTE: Normally, I wouldn't use a check for system type as I've done for
49 # `CRAY' below since that goes against the whole autoconf philosophy. But
50 # I think there is too great a chance that some non-Cray system has a
51 # function named listmntent to risk the false positive.
52
53 if test -z "$list_mounted_fs"; then
54 # Cray UNICOS 9
55 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
56 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
57 [fu_cv_sys_mounted_cray_listmntent=no
58 AC_EGREP_CPP(yes,
59 [#ifdef _CRAY
60 yes
61 #endif
62 ], [test $ac_cv_func_listmntent = yes \
63 && fu_cv_sys_mounted_cray_listmntent=yes]
64 )
65 ]
66 )
67 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
68 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
69 list_mounted_fs=found
70 AC_DEFINE(MOUNTED_LISTMNTENT)
71 fi
72 fi
73
74 if test $ac_cv_func_getmntent = yes; then
75
76 # This system has the getmntent function.
77 # Determine whether it's the one-argument variant or the two-argument one.
78
79 if test -z "$list_mounted_fs"; then
80 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
81 AC_MSG_CHECKING([for one-argument getmntent function])
82 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
83 [test $ac_cv_header_mntent_h = yes \
84 && fu_cv_sys_mounted_getmntent1=yes \
85 || fu_cv_sys_mounted_getmntent1=no])
86 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
87 if test $fu_cv_sys_mounted_getmntent1 = yes; then
88 list_mounted_fs=found
89 AC_DEFINE(MOUNTED_GETMNTENT1)
90 fi
91 fi
92
93 if test -z "$list_mounted_fs"; then
94 # SVR4
95 AC_MSG_CHECKING([for two-argument getmntent function])
96 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
97 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
98 fu_cv_sys_mounted_getmntent2=yes,
99 fu_cv_sys_mounted_getmntent2=no)])
100 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
101 if test $fu_cv_sys_mounted_getmntent2 = yes; then
102 list_mounted_fs=found
103 AC_DEFINE(MOUNTED_GETMNTENT2)
104 fi
105 fi
106
107 if test -z "$list_mounted_fs"; then
108 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
109 fi
110
111 fi
112
113 if test -z "$list_mounted_fs"; then
114 # DEC Alpha running OSF/1.
115 AC_MSG_CHECKING([for getfsstat function])
116 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
117 [AC_TRY_LINK([
118 #include <sys/types.h>
119 #include <sys/mount.h>
120 #include <sys/fs_types.h>],
121 [struct statfs *stats;
122 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
123 fu_cv_sys_mounted_getsstat=yes,
124 fu_cv_sys_mounted_getsstat=no)])
125 AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
126 if test $fu_cv_sys_mounted_getsstat = yes; then
127 list_mounted_fs=found
128 AC_DEFINE(MOUNTED_GETFSSTAT)
129 fi
130 fi
131
132 if test -z "$list_mounted_fs"; then
133 # AIX.
134 AC_MSG_CHECKING([for mntctl function and struct vmount])
135 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
136 [AC_TRY_CPP([#include <fshelp.h>],
137 fu_cv_sys_mounted_vmount=yes,
138 fu_cv_sys_mounted_vmount=no)])
139 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
140 if test $fu_cv_sys_mounted_vmount = yes; then
141 list_mounted_fs=found
142 AC_DEFINE(MOUNTED_VMOUNT)
143 fi
144 fi
145
146 if test -z "$list_mounted_fs"; then
147 # SVR3
148 AC_MSG_CHECKING([for FIXME existence of three headers])
149 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
150 [AC_TRY_CPP([
151 #include <sys/statfs.h>
152 #include <sys/fstyp.h>
153 #include <mnttab.h>],
154 fu_cv_sys_mounted_fread_fstyp=yes,
155 fu_cv_sys_mounted_fread_fstyp=no)])
156 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
157 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
158 list_mounted_fs=found
159 AC_DEFINE(MOUNTED_FREAD_FSTYP)
160 fi
161 fi
162
163 if test -z "$list_mounted_fs"; then
164 # 4.4BSD and DEC OSF/1.
165 AC_MSG_CHECKING([for getmntinfo function])
166 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
167 [
168 ok=
169 if test $ac_cv_func_getmntinfo = yes; then
170 AC_EGREP_HEADER(f_type;, sys/mount.h,
171 ok=yes)
172 fi
173 test -n "$ok" \
174 && fu_cv_sys_mounted_getmntinfo=yes \
175 || fu_cv_sys_mounted_getmntinfo=no
176 ])
177 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
178 if test $fu_cv_sys_mounted_getmntinfo = yes; then
179 list_mounted_fs=found
180 AC_DEFINE(MOUNTED_GETMNTINFO)
181 fi
182 fi
183
184 # FIXME: add a test for netbsd-1.1 here
185
186 if test -z "$list_mounted_fs"; then
187 # Ultrix
188 AC_MSG_CHECKING([for getmnt function])
189 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
190 [AC_TRY_CPP([
191 #include <sys/fs_types.h>
192 #include <sys/mount.h>],
193 fu_cv_sys_mounted_getmnt=yes,
194 fu_cv_sys_mounted_getmnt=no)])
195 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
196 if test $fu_cv_sys_mounted_getmnt = yes; then
197 list_mounted_fs=found
198 AC_DEFINE(MOUNTED_GETMNT)
199 fi
200 fi
201
202 if test -z "$list_mounted_fs"; then
203 # SVR2
204 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
205 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
206 [AC_TRY_CPP([#include <mnttab.h>],
207 fu_cv_sys_mounted_fread=yes,
208 fu_cv_sys_mounted_fread=no)])
209 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
210 if test $fu_cv_sys_mounted_fread = yes; then
211 list_mounted_fs=found
212 AC_DEFINE(MOUNTED_FREAD)
213 fi
214 fi
215
216 if test -z "$list_mounted_fs"; then
217 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
218 # FIXME -- no need to abort building the whole package
219 # Can't build mountlist.c or anything that needs its functions
220 fi
221
222 AC_CHECKING(how to get filesystem space usage)
223 space=no
224
225 # Perform only the link test since it seems there are no variants of the
226 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
227 # because that got a false positive on SCO OSR5. Adding the declaration
228 # of a `struct statvfs' causes this test to fail (as it should) on such
229 # systems. That system is reported to work fine with STAT_STATFS4 which
230 # is what it gets when this test fails.
231 if test $space = no; then
232 # SVR4
233 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
234 [AC_TRY_LINK([#include <sys/types.h>
235 #include <sys/statvfs.h>],
236 [struct statvfs fsd; statvfs (0, &fsd);],
237 fu_cv_sys_stat_statvfs=yes,
238 fu_cv_sys_stat_statvfs=no)])
239 if test $fu_cv_sys_stat_statvfs = yes; then
240 space=yes
241 AC_DEFINE(STAT_STATVFS)
242 fi
243 fi
244
245 if test $space = no; then
246 # DEC Alpha running OSF/1
247 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
248 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
249 [AC_TRY_RUN([
250 #include <sys/param.h>
251 #include <sys/types.h>
252 #include <sys/mount.h>
253 main ()
254 {
255 struct statfs fsd;
256 fsd.f_fsize = 0;
257 exit (statfs (".", &fsd, sizeof (struct statfs)));
258 }],
259 fu_cv_sys_stat_statfs3_osf1=yes,
260 fu_cv_sys_stat_statfs3_osf1=no,
261 fu_cv_sys_stat_statfs3_osf1=no)])
262 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
263 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
264 space=yes
265 AC_DEFINE(STAT_STATFS3_OSF1)
266 fi
267 fi
268
269 if test $space = no; then
270 # AIX
271 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
272 member (AIX, 4.3BSD)])
273 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
274 [AC_TRY_RUN([
275 #ifdef HAVE_SYS_PARAM_H
276 #include <sys/param.h>
277 #endif
278 #ifdef HAVE_SYS_MOUNT_H
279 #include <sys/mount.h>
280 #endif
281 #ifdef HAVE_SYS_VFS_H
282 #include <sys/vfs.h>
283 #endif
284 main ()
285 {
286 struct statfs fsd;
287 fsd.f_bsize = 0;
288 exit (statfs (".", &fsd));
289 }],
290 fu_cv_sys_stat_statfs2_bsize=yes,
291 fu_cv_sys_stat_statfs2_bsize=no,
292 fu_cv_sys_stat_statfs2_bsize=no)])
293 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
294 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
295 space=yes
296 AC_DEFINE(STAT_STATFS2_BSIZE)
297 fi
298 fi
299
300 if test $space = no; then
301 # SVR3
302 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
303 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
304 [AC_TRY_RUN([#include <sys/types.h>
305 #include <sys/statfs.h>
306 main ()
307 {
308 struct statfs fsd;
309 exit (statfs (".", &fsd, sizeof fsd, 0));
310 }],
311 fu_cv_sys_stat_statfs4=yes,
312 fu_cv_sys_stat_statfs4=no,
313 fu_cv_sys_stat_statfs4=no)])
314 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
315 if test $fu_cv_sys_stat_statfs4 = yes; then
316 space=yes
317 AC_DEFINE(STAT_STATFS4)
318 fi
319 fi
320
321 if test $space = no; then
322 # 4.4BSD and NetBSD
323 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
324 member (4.4BSD and NetBSD)])
325 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
326 [AC_TRY_RUN([#include <sys/types.h>
327 #ifdef HAVE_SYS_PARAM_H
328 #include <sys/param.h>
329 #endif
330 #ifdef HAVE_SYS_MOUNT_H
331 #include <sys/mount.h>
332 #endif
333 main ()
334 {
335 struct statfs fsd;
336 fsd.f_fsize = 0;
337 exit (statfs (".", &fsd));
338 }],
339 fu_cv_sys_stat_statfs2_fsize=yes,
340 fu_cv_sys_stat_statfs2_fsize=no,
341 fu_cv_sys_stat_statfs2_fsize=no)])
342 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
343 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
344 space=yes
345 AC_DEFINE(STAT_STATFS2_FSIZE)
346 fi
347 fi
348
349 if test $space = no; then
350 # Ultrix
351 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
352 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
353 [AC_TRY_RUN([#include <sys/types.h>
354 #ifdef HAVE_SYS_PARAM_H
355 #include <sys/param.h>
356 #endif
357 #ifdef HAVE_SYS_MOUNT_H
358 #include <sys/mount.h>
359 #endif
360 #ifdef HAVE_SYS_FS_TYPES_H
361 #include <sys/fs_types.h>
362 #endif
363 main ()
364 {
365 struct fs_data fsd;
366 /* Ultrix's statfs returns 1 for success,
367 0 for not mounted, -1 for failure. */
368 exit (statfs (".", &fsd) != 1);
369 }],
370 fu_cv_sys_stat_fs_data=yes,
371 fu_cv_sys_stat_fs_data=no,
372 fu_cv_sys_stat_fs_data=no)])
373 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
374 if test $fu_cv_sys_stat_fs_data = yes; then
375 space=yes
376 AC_DEFINE(STAT_STATFS2_FS_DATA)
377 fi
378 fi
379
380 if test $space = no; then
381 # SVR2
382 AC_TRY_CPP([#include <sys/filsys.h>],
383 AC_DEFINE(STAT_READ_FILSYS) space=yes)
384 fi
385
386 if test -n "$list_mounted_fs" && test $space != no; then
387 DF_PROG="df"
388 # LIBOBJS="$LIBOBJS fsusage.o"
389 # LIBOBJS="$LIBOBJS mountlist.o"
390 fi
391
392 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
393 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
394 # enable the work-around code in fsusage.c.
395 AC_MSG_CHECKING([for statfs that truncates block counts])
396 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
397 [AC_TRY_COMPILE([
398 #if !defined(sun) && !defined(__sun)
399 choke -- this is a workaround for a Sun-specific problem
400 #endif
401 #include <sys/types.h>
402 #include <sys/vfs.h>],
403 [struct statfs t; long c = *(t.f_spare);],
404 fu_cv_sys_truncating_statfs=yes,
405 fu_cv_sys_truncating_statfs=no,
406 )])
407 if test $fu_cv_sys_truncating_statfs = yes; then
408 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS)
409 fi
410 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
411
412 AC_CHECKING(for AFS)
413 test -d /afs && AC_DEFINE(AFS)
414 ])
File macros/gnome-ghttp-check.m4 added (mode: 100644) (index 0000000..0ecacaa)
1 AC_DEFUN([GNOME_GHTTP_CHECK],[
2 AC_REQUIRE([GNOME_INIT_HOOK])
3 GHTTP_LIB=
4 AC_CHECK_FUNC(connect,,[
5 AC_CHECK_LIB(socket,connect,
6 GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)])
7 AC_CHECK_FUNC(gethostbyname,,[
8 AC_CHECK_LIB(nsl,gethostbyname,
9 GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)])
10 AC_CHECK_LIB(ghttp, ghttp_request_new,
11 GHTTP_LIB="-lghttp $GHTTP_LIB",GHTTP_LIB="",-L$gnome_prefix $GHTTP_LIB)
12 AC_SUBST(GHTTP_LIB)
13 AC_PROVIDE([GNOME_GHTTP_CHECK])
14 ])
File macros/gnome-gnorba-check.m4 added (mode: 100644) (index 0000000..dbac0a6)
1 dnl
2 dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
3 dnl
4 dnl if failflag is "failure" it aborts if gnorba is not found.
5 dnl
6
7 AC_DEFUN([GNOME_GNORBA_HOOK],[
8 GNOME_ORBIT_HOOK([],$2)
9 AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
10 gnome_cv_gnorba_found=no
11 if test x$gnome_cv_orbit_found = xyes; then
12 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
13 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
14 if test -n "$GNORBA_LIBS"; then
15 gnome_cv_gnorba_found=yes
16 fi
17 fi
18 ])
19 AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
20 if test x$gnome_cv_orbit_found = xyes; then
21 $1
22 GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
23 GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
24 AC_SUBST(GNORBA_CFLAGS)
25 AC_SUBST(GNORBA_LIBS)
26 else
27 if test x$2 = xfailure; then
28 AC_MSG_ERROR(gnorba library not installed or installation problem)
29 fi
30 fi
31 ])
32
33 AC_DEFUN([GNOME_GNORBA_CHECK], [
34 GNOME_GNORBA_HOOK([],failure)
35 ])
File macros/gnome-guile-checks.m4 added (mode: 100644) (index 0000000..1086d30)
1 dnl
2 dnl GNOME_CHECK_GUILE (failflag)
3 dnl
4 dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
5 dnl
6
7 AC_DEFUN([GNOME_CHECK_GUILE],
8 [
9 saved_ldflags="$LDFLAGS"
10 saved_cppflags="$CPPFLAGS"
11 LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
12
13 AC_CHECK_LIB(qthreads,qt_null,[
14 QTTHREADS_LIB="-lqthreads"
15 ],[
16 AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
17 ],$LIBS)
18 AC_SUBST(QTTHREADS_LIB)
19
20 AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
21 AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
22
23 AC_SUBST(TERMCAP_LIB)
24 AC_SUBST(READLINE_LIB)
25
26 if test "x$cross_compiling" = "xyes" ; then
27 name_build_guile="$target_alias-guile-config"
28 else
29 name_build_guile="guile-config"
30 fi
31
32 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
33
34 if test "x$BUILD_GUILE" = "xyes"; then
35 AC_MSG_CHECKING(whether $name_build_guile works)
36 if test x`$name_build_guile --version >/dev/null 2>&1 || \
37 echo no` = xno; then
38 BUILD_GUILE=no
39 fi
40 AC_MSG_RESULT($BUILD_GUILE)
41 else
42
43 if test "x$cross_compiling" = "xyes" ; then
44 name_build_guile="$target_alias-build-guile"
45 else
46 name_build_guile="build-guile"
47 fi
48
49 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
50
51 if test "x$BUILD_GUILE" = "xyes"; then
52 AC_MSG_CHECKING(whether $name_build_guile works)
53 if test x`$name_build_guile --version >/dev/null 2>&1 || \
54 echo no` = xno; then
55 BUILD_GUILE=no
56 fi
57 AC_MSG_RESULT($BUILD_GUILE)
58 fi
59 fi
60
61 AC_CHECK_LIB(m, sin)
62
63 if test "x$BUILD_GUILE" = "xyes"; then
64 AC_MSG_CHECKING(for guile libraries)
65 GUILE_LIBS="`$name_build_guile link`"
66 AC_MSG_RESULT($GUILE_LIBS)
67 AC_MSG_CHECKING(for guile headers)
68 GUILE_INCS="`$name_build_guile compile`"
69 AC_MSG_RESULT($GUILE_INCS)
70 else
71 GUILE_LIBS="$GNOME_LIBDIR"
72 GUILE_INCS="$GNOME_INCLUDEDIR"
73 AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
74 AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS")
75 AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
76 AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl")
77 AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket")
78 GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB"
79 fi
80
81 AC_SUBST(GUILE_LIBS)
82 AC_SUBST(GUILE_INCS)
83
84 saved_LIBS="$LIBS"
85 LIBS="$LIBS $GUILE_LIBS"
86 CPPFLAGS="$saved_cppflags $GUILE_INCS"
87
88 AC_MSG_CHECKING(whether guile works)
89 AC_TRY_LINK([
90 #include <libguile.h>
91 #include <guile/gh.h>
92 ],[
93 gh_eval_str("(newline)");
94 scm_boot_guile(0,NULL,NULL,NULL);
95 ],[
96 ac_cv_guile_found=yes
97 AC_DEFINE(HAVE_GUILE)
98 ],[
99 ac_cv_guile_found=no
100 ])
101 AC_MSG_RESULT($ac_cv_guile_found)
102
103 if test x$ac_cv_guile_found = xno ; then
104 if test x$1 = xfail ; then
105 AC_MSG_ERROR(Can not find Guile on this system)
106 else
107 AC_MSG_WARN(Can not find Guile on this system)
108 fi
109 ac_cv_guile_found=no
110 GUILE_LIBS= GUILE_INCS=
111 fi
112
113 LIBS="$saved_LIBS"
114 LDFLAGS="$saved_ldflags"
115 CPPFLAGS="$saved_cppflags"
116
117 AC_SUBST(GUILE_LIBS)
118 AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
119 ])
File macros/gnome-libgtop-check.m4 added (mode: 100644) (index 0000000..0ce6f6f)
1 dnl
2 dnl LIBGTOP_CHECK_TYPE
3 dnl
4 dnl Improved version of AC_CHECK_TYPE which takes into account
5 dnl that we need to #include some other header files on some
6 dnl systems to get some types.
7
8 dnl AC_LIBGTOP_CHECK_TYPE(TYPE, DEFAULT)
9 AC_DEFUN(AC_LIBGTOP_CHECK_TYPE,
10 [AC_REQUIRE([AC_HEADER_STDC])dnl
11 AC_MSG_CHECKING(for $1)
12 AC_CACHE_VAL(ac_cv_type_$1,
13 [AC_EGREP_CPP(dnl
14 changequote(<<,>>)dnl
15 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
16 changequote([,]), [#include <sys/types.h>
17 #if STDC_HEADERS
18 #include <stdlib.h>
19 #include <stddef.h>
20 #endif
21
22 /* For Tru64 */
23 #ifdef HAVE_SYS_BITYPES_H
24 #include <sys/bitypes.h>
25 #endif
26 ], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
27 AC_MSG_RESULT($ac_cv_type_$1)
28 if test $ac_cv_type_$1 = no; then
29 AC_DEFINE($1, $2)
30 fi
31 ])
32
33 dnl
34 dnl GNOME_LIBGTOP_TYPES
35 dnl
36 dnl some typechecks for libgtop.
37 dnl
38
39 AC_DEFUN([GNOME_LIBGTOP_TYPES],
40 [
41 AC_CHECK_HEADERS(sys/bitypes.h)
42 AC_LIBGTOP_CHECK_TYPE(u_int64_t, unsigned long long int)
43 AC_LIBGTOP_CHECK_TYPE(int64_t, signed long long int)
44 ])
45
46 dnl
47 dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag)
48 dnl
49 dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop
50 dnl is not found.
51 dnl
52
53 AC_DEFUN([GNOME_LIBGTOP_HOOK],
54 [
55 AC_REQUIRE([GNOME_LIBGTOP_TYPES])
56
57 AC_SUBST(LIBGTOP_LIBDIR)
58 AC_SUBST(LIBGTOP_INCLUDEDIR)
59 AC_SUBST(LIBGTOP_EXTRA_LIBS)
60 AC_SUBST(LIBGTOP_LIBS)
61 AC_SUBST(LIBGTOP_INCS)
62 AC_SUBST(LIBGTOP_NAMES_LIBS)
63 AC_SUBST(LIBGTOP_NAMES_INCS)
64 AC_SUBST(LIBGTOP_MAJOR_VERSION)
65 AC_SUBST(LIBGTOP_MINOR_VERSION)
66 AC_SUBST(LIBGTOP_MICRO_VERSION)
67 AC_SUBST(LIBGTOP_VERSION)
68 AC_SUBST(LIBGTOP_VERSION_CODE)
69 AC_SUBST(LIBGTOP_SERVER_VERSION)
70 AC_SUBST(LIBGTOP_INTERFACE_AGE)
71 AC_SUBST(LIBGTOP_BINARY_AGE)
72 AC_SUBST(LIBGTOP_BINDIR)
73 AC_SUBST(LIBGTOP_SERVER)
74
75 dnl Get the cflags and libraries from the libgtop-config script
76 dnl
77 AC_ARG_WITH(libgtop,
78 [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)],
79 libgtop_config_prefix="$withval", libgtop_config_prefix="")
80 AC_ARG_WITH(libgtop-exec,
81 [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)],
82 libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="")
83
84 if test x$libgtop_config_exec_prefix != x ; then
85 libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix"
86 if test x${LIBGTOP_CONFIG+set} != xset ; then
87 LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config
88 fi
89 fi
90 if test x$libgtop_config_prefix != x ; then
91 libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix"
92 if test x${LIBGTOP_CONFIG+set} != xset ; then
93 LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config
94 fi
95 fi
96
97 AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no)
98 dnl IMPORTANT NOTICE:
99 dnl If you increase this number here, this means that *ALL*
100 dnl modules will require the new version, even if they explicitly
101 dnl give a lower number in their `configure.in' !!!
102 real_min_libgtop_version=1.0.0
103 min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1)
104 dnl I know, the following code looks really ugly, but if you want
105 dnl to make changes, please test it with a brain-dead /bin/sh and
106 dnl with a brain-dead /bin/test (not all shells/tests support the
107 dnl `<' operator to compare strings, that's why I convert everything
108 dnl into numbers and test them).
109 min_libgtop_major=`echo $min_libgtop_version | \
110 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
111 min_libgtop_minor=`echo $min_libgtop_version | \
112 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
113 min_libgtop_micro=`echo $min_libgtop_version | \
114 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
115 test x$min_libgtop_micro = x && min_libgtop_micro=0
116 real_min_libgtop_major=`echo $real_min_libgtop_version | \
117 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
118 real_min_libgtop_minor=`echo $real_min_libgtop_version | \
119 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
120 real_min_libgtop_micro=`echo $real_min_libgtop_version | \
121 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
122 test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0
123 dnl You cannot require a version less then $real_min_libgtop_version,
124 dnl so you don't need to update each `configure.in' when it's increased.
125 if test $real_min_libgtop_major -gt $min_libgtop_major ; then
126 min_libgtop_major=$real_min_libgtop_major
127 min_libgtop_minor=$real_min_libgtop_minor
128 min_libgtop_micro=$real_min_libgtop_micro
129 elif test $real_min_libgtop_major = $min_libgtop_major ; then
130 if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then
131 min_libgtop_minor=$real_min_libgtop_minor
132 min_libgtop_micro=$real_min_libgtop_micro
133 elif test $real_min_libgtop_minor = $min_libgtop_minor ; then
134 if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then
135 min_libgtop_micro=$real_min_libgtop_micro
136 fi
137 fi
138 fi
139 min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro"
140 AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version)
141 no_libgtop=""
142 if test "$LIBGTOP_CONFIG" = "no" ; then
143 no_libgtop=yes
144 else
145 configfile=`$LIBGTOP_CONFIG --config`
146 libgtop_major_version=`$LIBGTOP_CONFIG --version | \
147 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
148 libgtop_minor_version=`$LIBGTOP_CONFIG --version | \
149 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
150 libgtop_micro_version=`$LIBGTOP_CONFIG --version | \
151 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
152 if test $libgtop_major_version != $min_libgtop_major ; then
153 no_libgtop=mismatch
154 else
155 test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes
156 if test $libgtop_minor_version = $min_libgtop_minor ; then
157 test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes
158 fi
159 fi
160 . $configfile
161 fi
162 if test x$no_libgtop = x ; then
163 AC_DEFINE(HAVE_LIBGTOP)
164 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION")
165 AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE)
166 AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION)
167 AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION)
168 AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION)
169 AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION)
170 AC_MSG_RESULT(yes)
171 dnl Note that an empty true branch is not valid sh syntax.
172 ifelse([$2], [], :, [$2])
173 else
174 AC_MSG_RESULT(no)
175 if test "$no_libgtop"x = mismatchx; then
176 AC_MSG_ERROR(LibGTop major version mismatch $libgtop_major_version != $min_libgtop_major)
177 fi
178 if test "x$3" = "xfail"; then
179 AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found)
180 else
181 AC_MSG_WARN(LibGTop >= $min_libgtop_version not found)
182 fi
183 fi
184
185 AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes)
186 ])
187
188 AC_DEFUN([GNOME_INIT_LIBGTOP],[
189 GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2)
190 ])
191
192 dnl
193 dnl GNOME_LIBGTOP_DOCU
194 dnl
195 dnl checks whether the documentation of LibGTop is installed
196 dnl
197
198 AC_DEFUN([GNOME_LIBGTOP_DOCU],
199 [
200 AC_REQUIRE([GNOME_LIBGTOP_HOOK])
201
202 helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop"
203
204 AC_MSG_CHECKING(whether you have the LibGTop Documentation)
205
206 if test -f "$helpdir/C/topic.dat" ; then
207 have_libgtop_docu=yes
208 AC_DEFINE(HAVE_LIBGTOP_DOCU)
209 else
210 have_libgtop_docu=no
211 fi
212
213 AC_MSG_RESULT($have_libgtop_docu)
214
215 AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes)
216 ])
217
File macros/gnome-objc-checks.m4 added (mode: 100644) (index 0000000..c69acb0)
1 AC_DEFUN([GNOME_CHECK_OBJC],
2 [
3 dnl Look for an ObjC compiler.
4 dnl FIXME: extend list of possible names of ObjC compilers.
5 AC_CHECK_PROGS(OBJC, $OBJC egcs, "")
6 if test "x$OBJC" = "x" ; then
7 AC_CHECK_PROGS(OBJC, $OBJC egcc, "")
8 if test "x$OBJC" = "x" ; then
9 AC_CHECK_PROGS(OBJC, $OBJC gcc, "")
10 fi
11 fi
12
13 AC_REQUIRE([GNOME_PTHREAD_CHECK])
14
15 OBJC_LIBS="-lobjc $PTHREAD_LIB"
16 AC_CHECK_FUNC(sched_yield,,[
17 AC_CHECK_LIB(rt,sched_yield,
18 OBJC_LIBS="$OBJC_LIBS -lrt",[
19 AC_CHECK_LIB(posix4,sched_yield,
20 OBJC_LIBS="$OBJC_LIBS -lposix4",,
21 $OBJC_LIBS)],
22 $OBJC_LIBS)])
23 AC_SUBST(OBJC_LIBS)
24
25 AC_CACHE_CHECK([if Objective C compiler ($OBJC) works],
26 ac_cv_prog_objc_works, [
27 if test -n "$OBJC"; then
28 cat > conftest.m <<EOF
29 #include <objc/Object.h>
30 @interface myRandomObj : Object
31 {
32 }
33 @end
34 @implementation myRandomObj
35 @end
36 int main () {
37 /* No, you are not seeing double. Remember that square brackets
38 are the autoconf m4 quotes. */
39 id myid = [[myRandomObj alloc]];
40 [[myid free]];
41 return 0;
42 }
43 EOF
44
45 $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
46 result=$?
47 rm -f conftest*
48
49 if test $result -eq 0; then
50 ac_cv_prog_objc_works=yes
51 fi
52 else
53 ac_cv_prog_objc_works=no
54 fi
55 ])
56
57 AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes)
58 dnl Also set the shell variable OBJECTIVE_C to "yes" or "no".
59 OBJECTIVE_C=$ac_cv_prog_objc_works
60 ])
61
62 AC_DEFUN([GNOME_INIT_OBJC],
63 [
64 AC_MSG_CHECKING(for an obGnomeConf.sh)
65 my_gnome_libdir=`$GNOME_CONFIG --libdir`
66 if test -f $my_gnome_libdir/obGnomeConf.sh; then
67 . $my_gnome_libdir/obGnomeConf.sh
68 AC_MSG_RESULT(found $my_gnome_libdir)
69 ac_cv_have_gnome_objc=yes
70 else
71 AC_MSG_RESULT(not found)
72 AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install)
73 ac_cv_have_gnome_objc=no
74 fi
75
76 dnl Add a conditional on whether or not we have gnome-objc
77 AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes)
78 HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc
79
80 AC_SUBST(OBGNOME_INCLUDEDIR)
81 AC_SUBST(OBGNOME_LIBS)
82 AC_SUBST(OBGTK_LIBS)
83 ])
File macros/gnome-orbit-check.m4 added (mode: 100644) (index 0000000..54bf33a)
1 dnl
2 dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
3 dnl
4 dnl if failflag is "failure" it aborts if orbit is not found.
5 dnl
6
7 AC_DEFUN([GNOME_ORBIT_HOOK],[
8 AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
9 AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
10 AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
11 if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
12 gnome_cv_orbit_found=no
13 else
14 gnome_cv_orbit_found=yes
15 fi
16 ])
17 AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
18 if test x$gnome_cv_orbit_found = xyes; then
19 $1
20 ORBIT_CFLAGS=`orbit-config --cflags client server`
21 ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
22 AC_SUBST(ORBIT_CFLAGS)
23 AC_SUBST(ORBIT_LIBS)
24 else
25 if test x$2 = xfailure; then
26 AC_MSG_ERROR(ORBit not installed or installation problem)
27 fi
28 fi
29 ])
30
31 AC_DEFUN([GNOME_ORBIT_CHECK], [
32 GNOME_ORBIT_HOOK([],failure)
33 ])
File macros/gnome-print-check.m4 added (mode: 100644) (index 0000000..7d98281)
1 # Configure paths for GNOME-PRINT
2 # Chris Lahey 99-2-5
3 # stolen from Manish Singh again
4 # stolen back from Frank Belew
5 # stolen from Manish Singh
6 # Shamelessly stolen from Owen Taylor
7
8 dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
9 dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS
10 dnl
11 AC_DEFUN(AM_PATH_GNOME_PRINT,
12 [dnl
13 dnl Get the cflags and libraries from the gnome-config script
14 dnl
15 AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)],
16 gnome_print_prefix="$withval", gnome_print_prefix="")
17 AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)],
18 gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="")
19 AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program],
20 , enable_gnome_printtest=yes)
21
22 if test x$gnome_print_exec_prefix != x ; then
23 gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix"
24 if test x${GNOME_CONFIG+set} != xset ; then
25 GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config
26 fi
27 fi
28 if test x$gnome_print_prefix != x ; then
29 gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix"
30 if test x${GNOME_CONFIG+set} != xset ; then
31 GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config
32 fi
33 fi
34
35 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
36 min_gnome_print_version=ifelse([$1], ,0.1.0,$1)
37 AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version)
38 no_gnome_print=""
39 if test "$GNOME_CONFIG" = "no" ; then
40 no_gnome_print=yes
41 else
42 GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print`
43 GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print`
44
45 gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \
46 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
47 gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \
48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
49 gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \
50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
51 if test "x$enable_gnome_printtest" = "xyes" ; then
52 ac_save_CFLAGS="$CFLAGS"
53 ac_save_LIBS="$LIBS"
54 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
55 LIBS="$LIBS $GNOME_PRINT_LIBS"
56 dnl
57 dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity
58 dnl checks the results of gnome-config to some extent
59 dnl
60 rm -f conf.gnome_printtest
61 AC_TRY_RUN([
62 #include <stdio.h>
63 #include <stdlib.h>
64 #include <string.h>
65 #include <libgnomeprint/gnome-print.h>
66
67 static char*
68 my_strdup (char *str)
69 {
70 char *new_str;
71
72 if (str)
73 {
74 new_str = malloc ((strlen (str) + 1) * sizeof(char));
75 strcpy (new_str, str);
76 }
77 else
78 new_str = NULL;
79
80 return new_str;
81 }
82
83 int main ()
84 {
85 int major, minor, micro;
86 char *tmp_version;
87
88 system ("touch conf.gnome_printtest");
89
90 /* HP/UX 9 (%@#!) writes to sscanf strings */
91 tmp_version = my_strdup("$min_gnome_print_version");
92 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
93 printf("%s, bad version string\n", "$min_gnome_print_version");
94 exit(1);
95 }
96 return 0;
97 #if 0
98 if (($gnome_print_major_version > major) ||
99 (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) ||
100 (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro)))
101 {
102 return 0;
103 }
104 else
105 {
106 printf("\n*** 'gnome-config print --version' returned %d.%d.%d, but the minimum version\n", $gnome_print_major_version, $gnome_print_minor_version, $gnome_print_micro_version);
107 printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro);
108 printf("*** best to upgrade to the required version.\n");
109 printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n");
110 printf("*** to point to the correct copy of gnome-config, and remove the file\n");
111 printf("*** config.cache before re-running configure\n");
112 return 1;
113 }
114 #endif
115 }
116
117 ],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
118 CFLAGS="$ac_save_CFLAGS"
119 LIBS="$ac_save_LIBS"
120 fi
121 fi
122 if test "x$no_gnome_print" = x ; then
123 AC_MSG_RESULT(yes)
124 ifelse([$2], , :, [$2])
125 else
126 AC_MSG_RESULT(no)
127 if test "$GNOME_CONFIG" = "no" ; then
128 echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
129 echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in"
130 echo "*** your path, or set the GNOME_CONFIG environment variable to the"
131 echo "*** full path to gnome-config."
132 else
133 if test -f conf.gnome_printtest ; then
134 :
135 else
136 echo "*** Could not run GNOME-PRINT test program, checking why..."
137 CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
138 LIBS="$LIBS $GNOME_PRINT_LIBS"
139 AC_TRY_LINK([
140 #include <stdio.h>
141 #include <libgnomeprint/gnome-print.h>
142 ], [ return 0; ],
143 [ echo "*** The test program compiled, but did not run. This usually means"
144 echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong"
145 echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your"
146 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
147 echo "*** to the installed location Also, make sure you have run ldconfig if that"
148 echo "*** is required on your system"
149 echo "***"
150 echo "*** If you have an old version installed, it is best to remove it, although"
151 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
152 [ echo "*** The test program failed to compile or link. See the file config.log for the"
153 echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed"
154 echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you"
155 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
156 CFLAGS="$ac_save_CFLAGS"
157 LIBS="$ac_save_LIBS"
158 fi
159 fi
160 GNOME_PRINT_CFLAGS=""
161 GNOME_PRINT_LIBS=""
162 ifelse([$3], , :, [$3])
163 fi
164 AC_SUBST(GNOME_PRINT_CFLAGS)
165 AC_SUBST(GNOME_PRINT_LIBS)
166 rm -f conf.gnome_printtest
167 ])
168
169 AC_DEFUN([GNOME_PRINT_CHECK], [
170 AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)])
171 ])
File macros/gnome-pthread-check.m4 added (mode: 100644) (index 0000000..a4eb3b4)
1 dnl
2 dnl And better, use gthreads instead...
3 dnl
4
5 AC_DEFUN([GNOME_PTHREAD_CHECK],[
6 PTHREAD_LIB=""
7 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
8 [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
9 [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
10 [AC_CHECK_FUNC(pthread_create)]
11 )]
12 )]
13 )
14 AC_SUBST(PTHREAD_LIB)
15 AC_PROVIDE([GNOME_PTHREAD_CHECK])
16 ])
File macros/gnome-support.m4 added (mode: 100644) (index 0000000..2c1d049)
1 dnl GNOME_SUPPORT_CHECKS
2 dnl Check for various support functions needed by the standard
3 dnl Gnome libraries. Sets LIBOBJS, might define some macros.
4 dnl This should only be used when building the Gnome libs;
5 dnl Gnome clients should not need this macro.
6 AC_DEFUN([GNOME_SUPPORT_CHECKS],[
7 # we need an `awk' to build `gnomesupport.h'
8 AC_REQUIRE([AC_PROG_AWK])
9
10 # this should go away soon
11 need_gnome_support=yes
12
13 save_LIBOBJS="$LIBOBJS"
14 LIBOBJS=
15
16 AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
17
18 # for `scandir'
19 AC_HEADER_DIRENT
20
21 # copied from `configure.in' of `libiberty'
22 vars="program_invocation_short_name program_invocation_name sys_errlist"
23 for v in $vars; do
24 AC_MSG_CHECKING([for $v])
25 AC_CACHE_VAL(gnome_cv_var_$v,
26 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
27 [eval "gnome_cv_var_$v=yes"],
28 [eval "gnome_cv_var_$v=no"])])
29 if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then
30 AC_MSG_RESULT(yes)
31 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
32 AC_DEFINE_UNQUOTED($n)
33 else
34 AC_MSG_RESULT(no)
35 fi
36 done
37
38 AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen)
39 AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf)
40
41 AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o")
42
43 # to include `error.c' error.c has some HAVE_* checks
44 AC_CHECK_FUNCS(vprintf doprnt strerror_r)
45 AM_FUNC_ERROR_AT_LINE
46
47 # This is required if we declare setreuid () and setregid ().
48 AC_TYPE_UID_T
49
50 # see if we need to declare some functions. Solaris is notorious for
51 # putting functions into the `libc' but not listing them in the headers
52 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h)
53 GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize)
54 GCC_NEED_DECLARATION(scandir,[
55 #ifdef HAVE_DIRENT_H
56 #include <dirent.h>
57 #endif
58 ])
59
60 # Turn our LIBOBJS into libtool objects. This is gross, but it
61 # requires changes to autoconf before it goes away.
62 LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
63 AC_SUBST(need_gnome_support)
64 AC_SUBST(LTLIBOBJS)
65
66 LIBOBJS="$save_LIBOBJS"
67 AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes)
68 ])
File macros/gnome-undelfs.m4 added (mode: 100644) (index 0000000..c8ea6f4)
1 dnl GNOME_UNDELFS_CHECKS
2 dnl Check for ext2fs undel support.
3 dnl Set shell variable ext2fs_undel to "yes" if we have it,
4 dnl "no" otherwise. May define USE_EXT2FSLIB for cpp.
5 dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
6
7 AC_DEFUN([GNOME_UNDELFS_CHECKS], [
8 AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h)
9 ext2fs_undel=no
10 EXT2FS_UNDEL_LIBS=
11 if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
12 then
13 if test x$ac_cv_header_linux_ext2_fs_h = xyes
14 then
15 AC_DEFINE(USE_EXT2FSLIB)
16 ext2fs_undel=yes
17 EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
18 fi
19 fi
20 ])
File macros/gnome-vfs.m4 added (mode: 100644) (index 0000000..137a39d)
1 dnl GNOME_VFS_CHECKS
2 dnl Check for various functions needed by libvfs.
3 dnl This has various effects:
4 dnl Sets GNOME_VFS_LIBS to libraries required
5 dnl Sets termnet to true or false depending on whether it is required.
6 dnl If yes, defines USE_TERMNET.
7 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
8 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
9 dnl "no" (--without-vfs).
10 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
11
12 dnl Private define
13 AC_DEFUN([GNOME_WITH_VFS],[
14 dnl FIXME: network checks should probably be in their own macro.
15 AC_CHECK_LIB(nsl, t_accept)
16 AC_CHECK_LIB(socket, socket)
17
18 have_socket=no
19 AC_CHECK_FUNCS(socket, have_socket=yes)
20 if test $have_socket = no; then
21 # socket is not in the default libraries. See if it's in some other.
22 for lib in bsd socket inet; do
23 AC_CHECK_LIB($lib, socket, [
24 LIBS="$LIBS -l$lib"
25 have_socket=yes
26 AC_DEFINE(HAVE_SOCKET)
27 break])
28 done
29 fi
30
31 have_gethostbyname=no
32 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
33 if test $have_gethostbyname = no; then
34 # gethostbyname is not in the default libraries. See if it's in some other.
35 for lib in bsd socket inet; do
36 AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
37 done
38 fi
39
40 vfs_flags="tarfs"
41 use_net_code=false
42 if test $have_socket = yes; then
43 AC_STRUCT_LINGER
44 AC_CHECK_FUNCS(pmap_set, , [
45 AC_CHECK_LIB(rpc, pmap_set, [
46 LIBS="-lrpc $LIBS"
47 AC_DEFINE(HAVE_PMAP_SET)
48 ])])
49 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
50 dnl add for source routing support setsockopt
51 AC_CHECK_HEADERS(rpc/pmap_clnt.h)
52 vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
53 use_net_code=true
54 fi
55
56 dnl
57 dnl Samba support
58 dnl
59 smbfs=""
60 SAMBAFILES=""
61 AC_ARG_WITH(samba,
62 [--with-samba Support smb virtual file system],[
63 if test "x$withval != xno"; then
64 AC_DEFINE(WITH_SMBFS)
65 vfs_flags="$vfs_flags, smbfs"
66 smbfs="smbfs.o"
67 SAMBAFILES="\$(SAMBAFILES)"
68 fi
69 ])
70 AC_SUBST(smbfs)
71 AC_SUBST(SAMBAFILES)
72
73 dnl
74 dnl The termnet support
75 dnl
76 termnet=false
77 AC_ARG_WITH(termnet,
78 [--with-termnet If you want a termified net support],[
79 if test x$withval = xyes; then
80 AC_DEFINE(USE_TERMNET)
81 termnet=true
82 fi
83 ])
84
85 TERMNET=""
86 AC_DEFINE(USE_VFS)
87 if $use_net_code; then
88 AC_DEFINE(USE_NETCODE)
89 fi
90 mcserv=
91 if test $have_socket = yes; then
92 mcserv="mcserv"
93 if $termnet; then
94 TERMNET="-ltermnet"
95 fi
96 fi
97
98 AC_SUBST(TERMNET)
99 AC_SUBST(mcserv)
100
101 dnl FIXME:
102 dnl GNOME_VFS_LIBS=
103
104 ])
105
106 AC_DEFUN([GNOME_VFS_CHECKS],[
107 use_vfs=yes
108 AC_ARG_WITH(vfs,
109 [--with-vfs Compile with the VFS code],
110 use_vfs=$withval
111 )
112 case $use_vfs in
113 yes) GNOME_WITH_VFS;;
114 no) use_vfs=no;;
115 *) use_vfs=no;;
116 dnl Should we issue a warning?
117 esac
118 ])
119
120
File macros/gnome-x-checks.m4 added (mode: 100644) (index 0000000..1e397ef)
1 dnl GNOME_X_CHECKS
2 dnl
3 dnl Basic X11 related checks for X11. At the end, the following will be
4 dnl defined/changed:
5 dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK
6 dnl CPPFLAGS Will include $X_CFLAGS
7 dnl GNOME_HAVE_SM `true' or `false' depending on whether session
8 dnl management is available. It is available if
9 dnl both -lSM and X11/SM/SMlib.h exist. (Some
10 dnl Solaris boxes have the library but not the header)
11 dnl XPM_LIBS -lXpm if Xpm library is present, otherwise ""
12 dnl
13 dnl The following configure cache variables are defined (but not used):
14 dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
15 dnl
16 AC_DEFUN([GNOME_X_CHECKS],
17 [
18 AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
19 dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could
20 dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
21 dnl
22 dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
23 dnl CPPFLAGS, not CFLAGS
24 CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
25
26 saved_ldflags="$LDFLAGS"
27 LDFLAGS="$LDFLAGS $GTK_LIBS"
28
29 gnome_cv_passdown_x_libs="$GTK_LIBS"
30 gnome_cv_passdown_X_LIBS="$GTK_LIBS"
31 gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
32 gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
33
34 LDFLAGS="$saved_ldflags $GTK_LIBS"
35
36 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
37 USE_DEVGTK=true
38
39 dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
40 dnl AC_EGREP_CPP(answer_affirmatively,
41 dnl [#include <gtk/gtkfeatures.h>
42 dnl #ifdef GTK_HAVE_FEATURES_1_1_0
43 dnl answer_affirmatively
44 dnl #endif
45 dnl ], dev_gtk=yes, dev_gtk=no)
46 dnl if test "$dev_gtk" = "yes"; then
47 dnl USE_DEVGTK=true
48 dnl fi
49 dnl AC_MSG_RESULT("$dev_gtk")
50
51 GNOME_HAVE_SM=true
52 case "$GTK_LIBS" in
53 *-lSM*)
54 dnl Already found it.
55 ;;
56 *)
57 dnl Assume that if we have -lSM then we also have -lICE.
58 AC_CHECK_LIB(SM, SmcSaveYourselfDone,
59 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
60 $x_libs -lICE)
61 ;;
62 esac
63
64 if test "$GNOME_HAVE_SM" = true; then
65 AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
66 fi
67
68 if test "$GNOME_HAVE_SM" = true; then
69 AC_DEFINE(HAVE_LIBSM)
70 fi
71
72 XPM_LIBS=""
73 AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
74 AC_SUBST(XPM_LIBS)
75
76 AC_REQUIRE([GNOME_PTHREAD_CHECK])
77 LDFLAGS="$saved_ldflags"
78
79 AC_PROVIDE([GNOME_X_CHECKS])
80 ])
File macros/gnome-xml-check.m4 added (mode: 100644) (index 0000000..4bc91d1)
1 dnl
2 dnl GNOME_XML_HOOK (script-if-xml-found, failflag)
3 dnl
4 dnl If failflag is "failure", script aborts due to lack of XML
5 dnl
6 dnl Check for availability of the libxml library
7 dnl the XML parser uses libz if available too
8 dnl
9
10 AC_DEFUN([GNOME_XML_HOOK],[
11 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
12 if test "$GNOME_CONFIG" = no; then
13 if test x$2 = xfailure; then
14 AC_MSG_ERROR(Could not find gnome-config)
15 fi
16 fi
17 AC_CHECK_LIB(xml, xmlNewDoc, [
18 $1
19 GNOME_XML_LIB=`$GNOME_CONFIG --libs xml`
20 ], [
21 if test x$2 = xfailure; then
22 AC_MSG_ERROR(Could not link sample xml program)
23 fi
24 ], `$GNOME_CONFIG --libs xml`)
25 AC_SUBST(GNOME_XML_LIB)
26 ])
27
28 AC_DEFUN([GNOME_XML_CHECK], [
29 GNOME_XML_HOOK([],failure)
30 ])
File macros/gnome.m4 added (mode: 100644) (index 0000000..659c22c)
1 dnl
2 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
3 dnl
4 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
5 dnl is not found.
6 dnl
7
8 AC_DEFUN([GNOME_INIT_HOOK],[
9 AC_SUBST(GNOME_LIBS)
10 AC_SUBST(GNOMEUI_LIBS)
11 AC_SUBST(GNOMEGNORBA_LIBS)
12 AC_SUBST(GTKXMHTML_LIBS)
13 AC_SUBST(ZVT_LIBS)
14 AC_SUBST(GNOME_LIBDIR)
15 AC_SUBST(GNOME_INCLUDEDIR)
16
17 AC_ARG_WITH(gnome-includes,
18 [ --with-gnome-includes Specify location of GNOME headers],[
19 CFLAGS="$CFLAGS -I$withval"
20 ])
21
22 AC_ARG_WITH(gnome-libs,
23 [ --with-gnome-libs Specify location of GNOME libs],[
24 LDFLAGS="$LDFLAGS -L$withval"
25 gnome_prefix=$withval
26 ])
27
28 AC_ARG_WITH(gnome,
29 [ --with-gnome Specify prefix for GNOME files],
30 if test x$withval = xyes; then
31 want_gnome=yes
32 dnl Note that an empty true branch is not
33 dnl valid sh syntax.
34 ifelse([$1], [], :, [$1])
35 else
36 if test "x$withval" = xno; then
37 want_gnome=no
38 else
39 want_gnome=yes
40 LDFLAGS="$LDFLAGS -L$withval/lib"
41 CFLAGS="$CFLAGS -I$withval/include"
42 gnome_prefix=$withval/lib
43 fi
44 fi,
45 want_gnome=yes)
46
47 if test "x$want_gnome" = xyes; then
48
49 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
50 if test "$GNOME_CONFIG" = "no"; then
51 no_gnome_config="yes"
52 else
53 AC_MSG_CHECKING(if $GNOME_CONFIG works)
54 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
55 AC_MSG_RESULT(yes)
56 GNOME_GNORBA_HOOK([],$2)
57 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
58 GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
59 GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
60 GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
61 ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
62 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
63 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
64 $1
65 else
66 AC_MSG_RESULT(no)
67 no_gnome_config="yes"
68 fi
69 fi
70
71 if test x$exec_prefix = xNONE; then
72 if test x$prefix = xNONE; then
73 gnome_prefix=$ac_default_prefix/lib
74 else
75 gnome_prefix=$prefix/lib
76 fi
77 else
78 gnome_prefix=`eval echo \`echo $libdir\``
79 fi
80
81 if test "$no_gnome_config" = "yes"; then
82 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
83 if test -f $gnome_prefix/gnomeConf.sh; then
84 AC_MSG_RESULT(found)
85 echo "loading gnome configuration from" \
86 "$gnome_prefix/gnomeConf.sh"
87 . $gnome_prefix/gnomeConf.sh
88 $1
89 else
90 AC_MSG_RESULT(not found)
91 if test x$2 = xfail; then
92 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
93 fi
94 fi
95 fi
96 fi
97
98 if test -n "$3"; then
99 n="$3"
100 for i in $n; do
101 AC_MSG_CHECKING(extra library \"$i\")
102 case $i in
103 applets)
104 AC_SUBST(GNOME_APPLETS_LIBS)
105 GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
106 AC_MSG_RESULT($GNOME_APPLETS_LIBS);;
107 docklets)
108 AC_SUBST(GNOME_DOCKLETS_LIBS)
109 GNOME_DOCKLETS_LIBS=`$GNOME_CONFIG --libs-only-l docklets`
110 AC_MSG_RESULT($GNOME_DOCKLETS_LIBS);;
111 capplet)
112 AC_SUBST(GNOME_CAPPLET_LIBS)
113 GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
114 AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
115 *)
116 AC_MSG_RESULT(unknown library)
117 esac
118 done
119 fi
120 ])
121
122 dnl
123 dnl GNOME_INIT ([additional-inits])
124 dnl
125
126 AC_DEFUN([GNOME_INIT],[
127 GNOME_INIT_HOOK([],fail,$1)
128 ])
File macros/gperf-check.m4 added (mode: 100644) (index 0000000..1b73d3f)
1 dnl
2 dnl AC_PROG_GPERF (MINIMUM-VERSION)
3 dnl
4 dnl Check for availability of gperf.
5 dnl Abort if not found or if current version is not up to par.
6 dnl
7
8 AC_DEFUN([AC_PROG_GPERF],[
9 AC_PATH_PROG(GPERF, gperf, no)
10 if test "$GPERF" = no; then
11 AC_MSG_ERROR(Could not find gperf)
12 fi
13 min_gperf_version=ifelse([$1], ,2.7,$1)
14 AC_MSG_CHECKING(for gperf - version >= $min_gperf_version)
15 gperf_major_version=`$GPERF --version | \
16 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\1/'`
17 gperf_minor_version=`$GPERF --version | \
18 sed 's/GNU gperf \([[0-9]]*\).\([[0-9]]*\)/\2/'`
19 no_gperf=""
20 dnl
21 dnl Now check if the installed gperf is sufficiently new.
22 dnl
23 AC_TRY_RUN([
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27
28 static char*
29 my_strdup (char *str)
30 {
31 char *new_str;
32
33 if (str)
34 {
35 new_str = malloc ((strlen (str) + 1) * sizeof(char));
36 strcpy (new_str, str);
37 }
38 else
39 new_str = NULL;
40
41 return new_str;
42 }
43
44 int
45 main ()
46 {
47 char *tmp_version;
48
49 int major;
50 int minor;
51
52 /* HP/UX 9 (%@#!) writes to sscanf strings */
53 tmp_version = my_strdup("$min_gperf_version");
54 if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
55 printf ("%s, bad version string\n", "$min_gperf_version");
56 exit (1);
57 }
58
59 if (($gperf_major_version > major) ||
60 (($gperf_major_version == major) && ($gperf_minor_version >= minor))) {
61 return 0;
62 } else {
63 printf ("\n");
64 printf ("*** An old version of gperf ($gperf_major_version.$gperf_minor_version) was found.\n");
65 printf ("*** You need a version of gperf newer than %d.%d.%d. The latest version of\n",
66 major, minor);
67 printf ("*** gperf is always available from ftp://ftp.gnu.org.\n");
68 printf ("***\n");
69 return 1;
70 }
71 }
72 ],,no_gperf=yes,[/bin/true])
73 if test "x$no_gperf" = x ; then
74 AC_MSG_RESULT(yes)
75 else
76 AC_MSG_RESULT(no)
77 fi
78
79 ])
File macros/linger.m4 added (mode: 100644) (index 0000000..dfa7c8a)
1 dnl
2 dnl Check for struct linger
3 dnl
4 AC_DEFUN(AC_STRUCT_LINGER, [
5 av_struct_linger=no
6 AC_MSG_CHECKING(struct linger is available)
7 AC_TRY_RUN([
8 #include <sys/types.h>
9 #include <sys/socket.h>
10
11 struct linger li;
12
13 main ()
14 {
15 li.l_onoff = 1;
16 li.l_linger = 120;
17 exit (0);
18 }
19 ],[
20 AC_DEFINE(HAVE_STRUCT_LINGER)
21 av_struct_linger=yes
22 ],[
23 av_struct_linger=no
24 ],[
25 av_struct_linger=no
26 ])
27 AC_MSG_RESULT($av_struct_linger)
28 ])
File macros/need-declaration.m4 added (mode: 100644) (index 0000000..d5b7bc6)
1 dnl See whether we need a declaration for a function.
2 dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
3 AC_DEFUN(GCC_NEED_DECLARATION,
4 [AC_MSG_CHECKING([whether $1 must be declared])
5 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
6 [AC_TRY_COMPILE([
7 #include <stdio.h>
8 #ifdef HAVE_STRING_H
9 #include <string.h>
10 #else
11 #ifdef HAVE_STRINGS_H
12 #include <strings.h>
13 #endif
14 #endif
15 #ifdef HAVE_STDLIB_H
16 #include <stdlib.h>
17 #endif
18 #ifdef HAVE_UNISTD_H
19 #include <unistd.h>
20 #endif
21 $2],
22 [char *(*pfn) = (char *(*)) $1],
23 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
24 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
25 AC_MSG_RESULT(yes)
26 gcc_need_declarations="$gcc_need_declarations $1"
27 gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
28 AC_DEFINE_UNQUOTED($gcc_tr_decl)
29 else
30 AC_MSG_RESULT(no)
31 fi
32 ])dnl
33
34 dnl Check multiple functions to see whether each needs a declaration.
35 dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
36 AC_DEFUN(GCC_NEED_DECLARATIONS,
37 [for ac_func in $1
38 do
39 GCC_NEED_DECLARATION($ac_func, $2)
40 done
41 ]
42 )
File missing added (mode: 100755) (index 0000000..7789652)
1 #! /bin/sh
2 # Common stub for a few missing GNU programs while installing.
3 # Copyright (C) 1996, 1997 Free Software Foundation, Inc.
4 # Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
20
21 if test $# -eq 0; then
22 echo 1>&2 "Try \`$0 --help' for more information"
23 exit 1
24 fi
25
26 case "$1" in
27
28 -h|--h|--he|--hel|--help)
29 echo "\
30 $0 [OPTION]... PROGRAM [ARGUMENT]...
31
32 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
33 error status if there is no known handling for PROGRAM.
34
35 Options:
36 -h, --help display this help and exit
37 -v, --version output version information and exit
38
39 Supported PROGRAM values:
40 aclocal touch file \`aclocal.m4'
41 autoconf touch file \`configure'
42 autoheader touch file \`config.h.in'
43 automake touch all \`Makefile.in' files
44 bison create \`y.tab.[ch]', if possible, from existing .[ch]
45 flex create \`lex.yy.c', if possible, from existing .c
46 lex create \`lex.yy.c', if possible, from existing .c
47 makeinfo touch the output file
48 yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
49 ;;
50
51 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
52 echo "missing - GNU libit 0.0"
53 ;;
54
55 -*)
56 echo 1>&2 "$0: Unknown \`$1' option"
57 echo 1>&2 "Try \`$0 --help' for more information"
58 exit 1
59 ;;
60
61 aclocal)
62 echo 1>&2 "\
63 WARNING: \`$1' is missing on your system. You should only need it if
64 you modified \`acinclude.m4' or \`configure.in'. You might want
65 to install the \`Automake' and \`Perl' packages. Grab them from
66 any GNU archive site."
67 touch aclocal.m4
68 ;;
69
70 autoconf)
71 echo 1>&2 "\
72 WARNING: \`$1' is missing on your system. You should only need it if
73 you modified \`configure.in'. You might want to install the
74 \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
75 archive site."
76 touch configure
77 ;;
78
79 autoheader)
80 echo 1>&2 "\
81 WARNING: \`$1' is missing on your system. You should only need it if
82 you modified \`acconfig.h' or \`configure.in'. You might want
83 to install the \`Autoconf' and \`GNU m4' packages. Grab them
84 from any GNU archive site."
85 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
86 test -z "$files" && files="config.h"
87 touch_files=
88 for f in $files; do
89 case "$f" in
90 *:*) touch_files="$touch_files "`echo "$f" |
91 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
92 *) touch_files="$touch_files $f.in";;
93 esac
94 done
95 touch $touch_files
96 ;;
97
98 automake)
99 echo 1>&2 "\
100 WARNING: \`$1' is missing on your system. You should only need it if
101 you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
102 You might want to install the \`Automake' and \`Perl' packages.
103 Grab them from any GNU archive site."
104 find . -type f -name Makefile.am -print |
105 sed 's/\.am$/.in/' |
106 while read f; do touch "$f"; done
107 ;;
108
109 bison|yacc)
110 echo 1>&2 "\
111 WARNING: \`$1' is missing on your system. You should only need it if
112 you modified a \`.y' file. You may need the \`Bison' package
113 in order for those modifications to take effect. You can get
114 \`Bison' from any GNU archive site."
115 rm -f y.tab.c y.tab.h
116 if [ $# -ne 1 ]; then
117 eval LASTARG="\${$#}"
118 case "$LASTARG" in
119 *.y)
120 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
121 if [ -f "$SRCFILE" ]; then
122 cp "$SRCFILE" y.tab.c
123 fi
124 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
125 if [ -f "$SRCFILE" ]; then
126 cp "$SRCFILE" y.tab.h
127 fi
128 ;;
129 esac
130 fi
131 if [ ! -f y.tab.h ]; then
132 echo >y.tab.h
133 fi
134 if [ ! -f y.tab.c ]; then
135 echo 'main() { return 0; }' >y.tab.c
136 fi
137 ;;
138
139 lex|flex)
140 echo 1>&2 "\
141 WARNING: \`$1' is missing on your system. You should only need it if
142 you modified a \`.l' file. You may need the \`Flex' package
143 in order for those modifications to take effect. You can get
144 \`Flex' from any GNU archive site."
145 rm -f lex.yy.c
146 if [ $# -ne 1 ]; then
147 eval LASTARG="\${$#}"
148 case "$LASTARG" in
149 *.l)
150 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
151 if [ -f "$SRCFILE" ]; then
152 cp "$SRCFILE" lex.yy.c
153 fi
154 ;;
155 esac
156 fi
157 if [ ! -f lex.yy.c ]; then
158 echo 'main() { return 0; }' >lex.yy.c
159 fi
160 ;;
161
162 makeinfo)
163 echo 1>&2 "\
164 WARNING: \`$1' is missing on your system. You should only need it if
165 you modified a \`.texi' or \`.texinfo' file, or any other file
166 indirectly affecting the aspect of the manual. The spurious
167 call might also be the consequence of using a buggy \`make' (AIX,
168 DU, IRIX). You might want to install the \`Texinfo' package or
169 the \`GNU make' package. Grab either from any GNU archive site."
170 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
171 if test -z "$file"; then
172 file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
173 file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
174 fi
175 touch $file
176 ;;
177
178 *)
179 echo 1>&2 "\
180 WARNING: \`$1' is needed, and you do not seem to have it handy on your
181 system. You might have modified some files without having the
182 proper tools for further handling them. Check the \`README' file,
183 it often tells you about the needed prerequirements for installing
184 this package. You may also peek at any GNU archive site, in case
185 some other package would contain this missing \`$1' program."
186 exit 1
187 ;;
188 esac
189
190 exit 0
File mkinstalldirs added (mode: 100755) (index 0000000..4f58503)
1 #! /bin/sh
2 # mkinstalldirs --- make directory hierarchy
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
4 # Created: 1993-05-16
5 # Public domain
6
7 # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
8
9 errstatus=0
10
11 for file
12 do
13 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
14 shift
15
16 pathcomp=
17 for d
18 do
19 pathcomp="$pathcomp$d"
20 case "$pathcomp" in
21 -* ) pathcomp=./$pathcomp ;;
22 esac
23
24 if test ! -d "$pathcomp"; then
25 echo "mkdir $pathcomp"
26
27 mkdir "$pathcomp" || lasterr=$?
28
29 if test ! -d "$pathcomp"; then
30 errstatus=$lasterr
31 fi
32 fi
33
34 pathcomp="$pathcomp/"
35 done
36 done
37
38 exit $errstatus
39
40 # mkinstalldirs ends here
File src/Makefile.am added (mode: 100644) (index 0000000..f2f7f46)
1 ## Process this file with automake to produce Makefile.in
2
3 INCLUDES = \
4 @GTK_CFLAGS@ \
5 $(GNOME_INCLUDEDIR)
6
7 pkgdata_DATA = vide0.5.2.txt
8
9 bin_PROGRAMS = vide
10
11 bin_SCRIPTS = pauseme
12
13 vide_SOURCES = \
14 vide.c vide.h \
15 add_ext_dialog.c \
16 bookmarks.c \
17 buffer_menu.c \
18 callbacks.c \
19 command_mode.c \
20 command_mode_menu.c \
21 config_dialog.c \
22 config_files.c \
23 confirm_dialog.c \
24 copy_here_dialog.c \
25 date_filter_dialog.c \
26 file_info_dialog.c \
27 filelist.c \
28 filename_filter_dialog.c \
29 fileops.c \
30 fileselector.c \
31 filetype.c \
32 filetype_dialog.c \
33 filetype_popup.c \
34 for_each_dialog.c \
35 history.c \
36 init_filetype_dialog.c \
37 main_menu.c \
38 misc_dialogs.c \
39 ownership_dialog.c \
40 permissions_dialog.c \
41 programs_dialog.c \
42 programs_menu.c \
43 rename_ext_dialog.c \
44 search_mode.c \
45 size_filter_dialog.c \
46 term.c \
47 term_menu.c \
48 user_command.c \
49 user_command_dialog.c \
50 user_prompt.c \
51 utils.c \
52 view_dialog.c \
53 widget_utils.c \
54 window.c
55
56 vide_LDADD= $(GNOME_LIBDIR) $(GNOMEUI_LIBS) $(ZVT_LIBS) @GTK_LIBS@
File src/Makefile.in added (mode: 100644) (index 0000000..584df5c)
1 # Makefile.in generated automatically by automake 1.4a from Makefile.am
2
3 # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 # This Makefile.in is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13
14 SHELL = @SHELL@
15
16 srcdir = @srcdir@
17 top_srcdir = @top_srcdir@
18 VPATH = @srcdir@
19 prefix = @prefix@
20 exec_prefix = @exec_prefix@
21
22 bindir = @bindir@
23 sbindir = @sbindir@
24 libexecdir = @libexecdir@
25 datadir = @datadir@
26 sysconfdir = @sysconfdir@
27 sharedstatedir = @sharedstatedir@
28 localstatedir = @localstatedir@
29 libdir = @libdir@
30 infodir = @infodir@
31 mandir = @mandir@
32 includedir = @includedir@
33 oldincludedir = /usr/include
34
35 DESTDIR =
36
37 pkgdatadir = $(datadir)/@PACKAGE@
38 pkglibdir = $(libdir)/@PACKAGE@
39 pkgincludedir = $(includedir)/@PACKAGE@
40
41 top_builddir = ..
42
43 ACLOCAL = @ACLOCAL@
44 AUTOCONF = @AUTOCONF@
45 AUTOMAKE = @AUTOMAKE@
46 AUTOHEADER = @AUTOHEADER@
47
48 INSTALL = @INSTALL@
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 INSTALL_DATA = @INSTALL_DATA@
51 INSTALL_SCRIPT = @INSTALL_SCRIPT@
52 INSTALL_STRIP_FLAG =
53 transform = @program_transform_name@
54
55 NORMAL_INSTALL = :
56 PRE_INSTALL = :
57 POST_INSTALL = :
58 NORMAL_UNINSTALL = :
59 PRE_UNINSTALL = :
60 POST_UNINSTALL = :
61 CC = @CC@
62 GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@
63 GNOMEUI_LIBS = @GNOMEUI_LIBS@
64 GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@
65 GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@
66 GNOME_CONFIG = @GNOME_CONFIG@
67 GNOME_DOCKLETS_LIBS = @GNOME_DOCKLETS_LIBS@
68 GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@
69 GNOME_LIBDIR = @GNOME_LIBDIR@
70 GNOME_LIBS = @GNOME_LIBS@
71 GNORBA_CFLAGS = @GNORBA_CFLAGS@
72 GNORBA_LIBS = @GNORBA_LIBS@
73 GTKXMHTML_LIBS = @GTKXMHTML_LIBS@
74 GTK_CFLAGS = @GTK_CFLAGS@
75 GTK_CONFIG = @GTK_CONFIG@
76 GTK_LIBS = @GTK_LIBS@
77 MAKEINFO = @MAKEINFO@
78 ORBIT_CFLAGS = @ORBIT_CFLAGS@
79 ORBIT_CONFIG = @ORBIT_CONFIG@
80 ORBIT_IDL = @ORBIT_IDL@
81 ORBIT_LIBS = @ORBIT_LIBS@
82 PACKAGE = @PACKAGE@
83 PTHREAD_LIB = @PTHREAD_LIB@
84 VERSION = @VERSION@
85 XPM_LIBS = @XPM_LIBS@
86 ZVT_LIBS = @ZVT_LIBS@
87 cflags_set = @cflags_set@
88 cxxflags_set = @cxxflags_set@
89
90 INCLUDES = @GTK_CFLAGS@ $(GNOME_INCLUDEDIR)
91
92
93 pkgdata_DATA = vide0.5.2.txt
94
95 bin_PROGRAMS = vide
96
97 bin_SCRIPTS = pauseme
98
99 vide_SOURCES = vide.c vide.h add_ext_dialog.c bookmarks.c buffer_menu.c callbacks.c command_mode.c command_mode_menu.c config_dialog.c config_files.c confirm_dialog.c copy_here_dialog.c date_filter_dialog.c file_info_dialog.c filelist.c filename_filter_dialog.c fileops.c fileselector.c filetype.c filetype_dialog.c filetype_popup.c for_each_dialog.c history.c init_filetype_dialog.c main_menu.c misc_dialogs.c ownership_dialog.c permissions_dialog.c programs_dialog.c programs_menu.c rename_ext_dialog.c search_mode.c size_filter_dialog.c term.c term_menu.c user_command.c user_command_dialog.c user_prompt.c utils.c view_dialog.c widget_utils.c window.c
100
101
102 vide_LDADD = $(GNOME_LIBDIR) $(GNOMEUI_LIBS) $(ZVT_LIBS) @GTK_LIBS@
103 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
104 CONFIG_HEADER = ../config.h
105 CONFIG_CLEAN_FILES =
106 PROGRAMS = $(bin_PROGRAMS)
107
108
109 DEFS = @DEFS@ -I. -I$(srcdir) -I..
110 CPPFLAGS = @CPPFLAGS@
111 LDFLAGS = @LDFLAGS@
112 LIBS = @LIBS@
113 vide_OBJECTS = vide.o add_ext_dialog.o bookmarks.o buffer_menu.o \
114 callbacks.o command_mode.o command_mode_menu.o config_dialog.o \
115 config_files.o confirm_dialog.o copy_here_dialog.o date_filter_dialog.o \
116 file_info_dialog.o filelist.o filename_filter_dialog.o fileops.o \
117 fileselector.o filetype.o filetype_dialog.o filetype_popup.o \
118 for_each_dialog.o history.o init_filetype_dialog.o main_menu.o \
119 misc_dialogs.o ownership_dialog.o permissions_dialog.o \
120 programs_dialog.o programs_menu.o rename_ext_dialog.o search_mode.o \
121 size_filter_dialog.o term.o term_menu.o user_command.o \
122 user_command_dialog.o user_prompt.o utils.o view_dialog.o \
123 widget_utils.o window.o
124 vide_DEPENDENCIES =
125 vide_LDFLAGS =
126 SCRIPTS = $(bin_SCRIPTS)
127
128 CFLAGS = @CFLAGS@
129 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
130 CCLD = $(CC)
131 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
132 DATA = $(pkgdata_DATA)
133
134 DIST_COMMON = Makefile.am Makefile.in
135
136
137 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
138
139 TAR = gtar
140 GZIP_ENV = --best
141 DEP_FILES = .deps/add_ext_dialog.P .deps/bookmarks.P \
142 .deps/buffer_menu.P .deps/callbacks.P .deps/command_mode.P \
143 .deps/command_mode_menu.P .deps/config_dialog.P .deps/config_files.P \
144 .deps/confirm_dialog.P .deps/copy_here_dialog.P \
145 .deps/date_filter_dialog.P .deps/file_info_dialog.P .deps/filelist.P \
146 .deps/filename_filter_dialog.P .deps/fileops.P .deps/fileselector.P \
147 .deps/filetype.P .deps/filetype_dialog.P .deps/filetype_popup.P \
148 .deps/for_each_dialog.P .deps/history.P .deps/init_filetype_dialog.P \
149 .deps/main_menu.P .deps/misc_dialogs.P .deps/ownership_dialog.P \
150 .deps/permissions_dialog.P .deps/programs_dialog.P \
151 .deps/programs_menu.P .deps/rename_ext_dialog.P .deps/search_mode.P \
152 .deps/size_filter_dialog.P .deps/term.P .deps/term_menu.P \
153 .deps/user_command.P .deps/user_command_dialog.P .deps/user_prompt.P \
154 .deps/utils.P .deps/vide.P .deps/view_dialog.P .deps/widget_utils.P \
155 .deps/window.P
156 SOURCES = $(vide_SOURCES)
157 OBJECTS = $(vide_OBJECTS)
158
159 all: all-redirect
160 .SUFFIXES:
161 .SUFFIXES: .S .c .o .s
162 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
163 cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile
164
165 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
166 cd $(top_builddir) \
167 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
168
169
170 mostlyclean-binPROGRAMS:
171
172 clean-binPROGRAMS:
173 -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
174
175 distclean-binPROGRAMS:
176
177 maintainer-clean-binPROGRAMS:
178
179 install-binPROGRAMS: $(bin_PROGRAMS)
180 @$(NORMAL_INSTALL)
181 $(mkinstalldirs) $(DESTDIR)$(bindir)
182 @list='$(bin_PROGRAMS)'; for p in $$list; do \
183 if test -f $$p; then \
184 echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
185 $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
186 else :; fi; \
187 done
188
189 uninstall-binPROGRAMS:
190 @$(NORMAL_UNINSTALL)
191 list='$(bin_PROGRAMS)'; for p in $$list; do \
192 rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
193 done
194
195 .s.o:
196 $(COMPILE) -c $<
197
198 .S.o:
199 $(COMPILE) -c $<
200
201 mostlyclean-compile:
202 -rm -f *.o core *.core
203
204 clean-compile:
205
206 distclean-compile:
207 -rm -f *.tab.c
208
209 maintainer-clean-compile:
210
211 vide: $(vide_OBJECTS) $(vide_DEPENDENCIES)
212 @rm -f vide
213 $(LINK) $(vide_LDFLAGS) $(vide_OBJECTS) $(vide_LDADD) $(LIBS)
214
215 install-binSCRIPTS: $(bin_SCRIPTS)
216 @$(NORMAL_INSTALL)
217 $(mkinstalldirs) $(DESTDIR)$(bindir)
218 @list='$(bin_SCRIPTS)'; for p in $$list; do \
219 if test -f $$p; then \
220 echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
221 $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
222 else if test -f $(srcdir)/$$p; then \
223 echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
224 $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
225 else :; fi; fi; \
226 done
227
228 uninstall-binSCRIPTS:
229 @$(NORMAL_UNINSTALL)
230 list='$(bin_SCRIPTS)'; for p in $$list; do \
231 rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
232 done
233
234 install-pkgdataDATA: $(pkgdata_DATA)
235 @$(NORMAL_INSTALL)
236 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
237 @list='$(pkgdata_DATA)'; for p in $$list; do \
238 if test -f $(srcdir)/$$p; then \
239 echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p"; \
240 $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p; \
241 else if test -f $$p; then \
242 echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p"; \
243 $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p; \
244 fi; fi; \
245 done
246
247 uninstall-pkgdataDATA:
248 @$(NORMAL_UNINSTALL)
249 list='$(pkgdata_DATA)'; for p in $$list; do \
250 rm -f $(DESTDIR)$(pkgdatadir)/$$p; \
251 done
252
253 tags: TAGS
254
255 ID: $(HEADERS) $(SOURCES) $(LISP)
256 list='$(SOURCES) $(HEADERS)'; \
257 unique=`for i in $$list; do echo $$i; done | \
258 awk ' { files[$$0] = 1; } \
259 END { for (i in files) print i; }'`; \
260 here=`pwd` && cd $(srcdir) \
261 && mkid -f$$here/ID $$unique $(LISP)
262
263 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
264 tags=; \
265 here=`pwd`; \
266 list='$(SOURCES) $(HEADERS)'; \
267 unique=`for i in $$list; do echo $$i; done | \
268 awk ' { files[$$0] = 1; } \
269 END { for (i in files) print i; }'`; \
270 test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
271 || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
272
273 mostlyclean-tags:
274
275 clean-tags:
276
277 distclean-tags:
278 -rm -f TAGS ID
279
280 maintainer-clean-tags:
281
282 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
283
284 subdir = src
285
286 distdir: $(DISTFILES)
287 here=`cd $(top_builddir) && pwd`; \
288 top_distdir=`cd $(top_distdir) && pwd`; \
289 distdir=`cd $(distdir) && pwd`; \
290 cd $(top_srcdir) \
291 && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile
292 @for file in $(DISTFILES); do \
293 d=$(srcdir); \
294 if test -d $$d/$$file; then \
295 cp -pr $$d/$$file $(distdir)/$$file; \
296 else \
297 test -f $(distdir)/$$file \
298 || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
299 || cp -p $$d/$$file $(distdir)/$$file || :; \
300 fi; \
301 done
302
303 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
304
305 -include $(DEP_FILES)
306
307 mostlyclean-depend:
308
309 clean-depend:
310
311 distclean-depend:
312 -rm -rf .deps
313
314 maintainer-clean-depend:
315
316 %.o: %.c
317 @echo '$(COMPILE) -c $<'; \
318 $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
319 @-cp .deps/$(*F).pp .deps/$(*F).P; \
320 tr ' ' '\012' < .deps/$(*F).pp \
321 | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
322 >> .deps/$(*F).P; \
323 rm .deps/$(*F).pp
324
325 %.lo: %.c
326 @echo '$(LTCOMPILE) -c $<'; \
327 $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
328 @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
329 < .deps/$(*F).pp > .deps/$(*F).P; \
330 tr ' ' '\012' < .deps/$(*F).pp \
331 | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
332 >> .deps/$(*F).P; \
333 rm -f .deps/$(*F).pp
334 info-am:
335 info: info-am
336 dvi-am:
337 dvi: dvi-am
338 check-am: all-am
339 check: check-am
340 installcheck-am:
341 installcheck: installcheck-am
342 install-exec-am: install-binPROGRAMS install-binSCRIPTS
343 install-exec: install-exec-am
344
345 install-data-am: install-pkgdataDATA
346 install-data: install-data-am
347
348 install-am: all-am
349 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
350 install: install-am
351 uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
352 uninstall-pkgdataDATA
353 uninstall: uninstall-am
354 all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
355 all-redirect: all-am
356 install-strip:
357 $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
358 installdirs:
359 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) \
360 $(DESTDIR)$(pkgdatadir)
361
362
363 mostlyclean-generic:
364
365 clean-generic:
366
367 distclean-generic:
368 -rm -f Makefile $(CONFIG_CLEAN_FILES)
369 -rm -f config.cache config.log stamp-h stamp-h[0-9]*
370
371 maintainer-clean-generic:
372 mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
373 mostlyclean-tags mostlyclean-depend mostlyclean-generic
374
375 mostlyclean: mostlyclean-am
376
377 clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \
378 clean-generic mostlyclean-am
379
380 clean: clean-am
381
382 distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \
383 distclean-depend distclean-generic clean-am
384
385 distclean: distclean-am
386
387 maintainer-clean-am: maintainer-clean-binPROGRAMS \
388 maintainer-clean-compile maintainer-clean-tags \
389 maintainer-clean-depend maintainer-clean-generic \
390 distclean-am
391 @echo "This command is intended for maintainers to use;"
392 @echo "it deletes files that may require special tools to rebuild."
393
394 maintainer-clean: maintainer-clean-am
395
396 .PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
397 maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
398 mostlyclean-compile distclean-compile clean-compile \
399 maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS \
400 uninstall-pkgdataDATA install-pkgdataDATA tags mostlyclean-tags \
401 distclean-tags clean-tags maintainer-clean-tags distdir \
402 mostlyclean-depend distclean-depend clean-depend \
403 maintainer-clean-depend info-am info dvi-am dvi check check-am \
404 installcheck-am installcheck install-exec-am install-exec \
405 install-data-am install-data install-am install uninstall-am uninstall \
406 all-redirect all-am all installdirs mostlyclean-generic \
407 distclean-generic clean-generic maintainer-clean-generic clean \
408 mostlyclean distclean maintainer-clean
409
410
411 # Tell versions [3.59,3.63) of GNU make to not export all variables.
412 # Otherwise a system limit (for SysV at least) may be exceeded.
413 .NOEXPORT:
File src/add_ext_dialog.c added (mode: 100644) (index 0000000..d2ffd0e)
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
26 static GtkWidget *add_ext_dialog;
27 static GtkWidget *filetypes_clist;
28 static gchar *new_extension;
29
30 static void
31 add_ext_ok_cb (GtkWidget * widget)
32 {
33 FileType *ft;
34 gchar *program, *s;
35 gint selected_row;
36
37 if (GTK_CLIST (filetypes_clist)->selection == NULL)
38 {
39 status_bar_message("Please select a filetype first\n");
40 return;
41 }
42 else
43 {
44 selected_row = (gint) GTK_CLIST (filetypes_clist)->selection->data;
45 }
46
47 ft = gtk_clist_get_row_data (GTK_CLIST (filetypes_clist), selected_row);
48 strncat (ft->extensions, ",", sizeof (ft->extensions));
49 strncat (ft->extensions, new_extension, sizeof (ft->extensions));
50 write_filetypes_file ();
51
52 program = s = strdup (ft->programs);
53 if ((s = strchr (program, ',')) != NULL)
54 *s = '\0';
55
56 exec_action (program);
57
58 free (program);
59 free (new_extension);
60 gtk_grab_remove (add_ext_dialog);
61 gtk_widget_destroy (add_ext_dialog);
62 if(1 < gtk_main_level())
63 gtk_main_quit();
64 }
65
66 static void
67 filetypes_select_row_cb (GtkWidget * clist,
68 gint row, gint col, GdkEvent * event, gpointer label)
69 {
70 gchar label_text[NAME_MAX];
71 gchar *program, *s;
72 FileType *ft = gtk_clist_get_row_data (GTK_CLIST (clist), row);
73
74 if (event->type == GDK_2BUTTON_PRESS)
75 {
76 add_ext_ok_cb (NULL);
77 return;
78 }
79
80 program = s = strdup (ft->programs);
81 if ((s = strchr (program, ',')) != NULL)
82 *s = '\0';
83
84 g_snprintf (label_text, sizeof (label_text), "Default Action: %s", program);
85 gtk_label_set_text (GTK_LABEL (GTK_WIDGET (label)), label_text);
86 free (program);
87 }
88
89 static void
90 cancel_cb (GtkWidget * widget)
91 {
92 free (new_extension);
93 gtk_grab_remove (add_ext_dialog);
94 gtk_widget_destroy (add_ext_dialog);
95 if(1 < gtk_main_level())
96 gtk_main_quit();
97 }
98
99 static void
100 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
101 {
102 if (event->keyval == GDK_Escape)
103 cancel_cb (NULL);
104 }
105
106 void
107 create_add_ext_dialog (gchar * ext)
108 {
109 GtkWidget *dialog_vbox;
110 GtkWidget *action_area;
111 GtkWidget *sw;
112 GtkWidget *default_program_label;
113 GList *tmp;
114 gchar *filetypes_titles[2] = { "Extensions", "Description" };
115 gchar *buf[2];
116 gchar label_text[MAX_LEN];
117
118 if (cfg.filetypes == NULL)
119 {
120 status_bar_message("No Filetypes exist\n");
121 return;
122 }
123
124 new_extension = strdup (ext);
125
126 add_ext_dialog = gtk_dialog_new ();
127 gtk_widget_set_usize (add_ext_dialog, 250, 275);
128 dialog_vbox = GTK_DIALOG (add_ext_dialog)->vbox;
129 action_area = GTK_DIALOG (add_ext_dialog)->action_area;
130 gtk_signal_connect (GTK_OBJECT (add_ext_dialog), "key_press_event",
131 GTK_SIGNAL_FUNC (key_press_cb), NULL);
132
133 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
134
135 g_snprintf (label_text, sizeof (label_text),
136 "Choose filetype for extension: %s", ext);
137 add_label (dialog_vbox, label_text, 0, FALSE, 5);
138
139 sw =
140 add_sw (dialog_vbox, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, TRUE, 5);
141
142 filetypes_clist = gtk_clist_new_with_titles (2, filetypes_titles);
143 gtk_container_add (GTK_CONTAINER (sw), filetypes_clist);
144 gtk_widget_show (filetypes_clist);
145
146 for (tmp = cfg.filetypes; tmp != NULL; tmp = tmp->next)
147 {
148 FileType *ft = tmp->data;
149 gint i;
150
151 buf[0] = ft->extensions;
152 buf[1] = ft->description;
153
154 i = gtk_clist_append (GTK_CLIST (filetypes_clist), buf);
155 gtk_clist_set_row_data (GTK_CLIST (filetypes_clist), i, ft);
156 }
157 g_list_free(tmp);
158
159 default_program_label = add_label (dialog_vbox, "Default Action: ",
160 0.01, FALSE, 5);
161 gtk_signal_connect (GTK_OBJECT (filetypes_clist), "select_row",
162 GTK_SIGNAL_FUNC (filetypes_select_row_cb),
163 default_program_label);
164
165 add_button (action_area, "Ok", TRUE, 5, add_ext_ok_cb, NULL);
166 add_button (action_area, "Cancel", TRUE, 5, cancel_cb, NULL);
167
168 gtk_window_set_position (GTK_WINDOW (add_ext_dialog), GTK_WIN_POS_CENTER);
169 gtk_widget_show (add_ext_dialog);
170 gtk_grab_add (add_ext_dialog);
171 gtk_window_set_transient_for (GTK_WINDOW (add_ext_dialog),
172 GTK_WINDOW (app.main_window));
173 }
File src/bookmarks.c added (mode: 100644) (index 0000000..ed1afa7)
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<vide.h>
20 #include<ctype.h>
21 #include<string.h>
22 #include<unistd.h>
23
24 void
25 add_bookmark(gchar *mark, gchar *dir, gchar *file)
26 {
27
28 g_snprintf(bk.mark, sizeof(bk.mark), mark);
29 g_snprintf(bk.dir, sizeof(bk.dir), dir);
30 g_snprintf(bk.file, sizeof(bk.file), file);
31 cfg.bookmarks = g_list_append(cfg.bookmarks,
32 duplicate(&bk, sizeof (Bookmarks)));
33 }
34
35 static void
36 find_bookmark(FileView *view, gchar *value)
37 {
38 GList *tmp;
39 gint i;
40 gchar *file;
41
42 for(tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next)
43 {
44 Bookmarks *bk = tmp->data;
45 if(!strcmp(value, bk->mark))
46 {
47 change_dir(view, bk->dir);
48
49 gtk_clist_freeze(GTK_CLIST(view->clist));
50 for(i = 0; i < GTK_CLIST(view->clist)->rows; i++)
51 {
52 gtk_clist_get_text(GTK_CLIST(view->clist), i, 0, &file);
53
54 if(!strcmp(bk->file, file))
55 {
56 focus_on_row(view, i);
57 gtk_clist_thaw(GTK_CLIST(view->clist));
58 return;
59 }
60 }
61 focus_on_row(view, 0);
62 gtk_clist_thaw(GTK_CLIST(view->clist));
63 return;
64 }
65 }
66 status_bar_message("Mark not found");
67 return;
68 }
69
70 static void
71 set_bookmark(FileView *view, gchar *value)
72 {
73 gchar *file;
74 GList *tmp;
75
76
77 gtk_clist_get_text(GTK_CLIST(view->clist), view->row, 0, &file);
78
79
80 /* Check if mark is already used and overwrite it */
81 for(tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next)
82 {
83 Bookmarks *bk = tmp->data;
84 if(!strcmp(value, bk->mark))
85 {
86 g_snprintf(bk->dir, sizeof(bk->dir), view->dir);
87 g_snprintf(bk->file, sizeof(bk->file), file);
88 write_bookmarks_file();
89 recreate_main_window();
90 return;
91 }
92 }
93 g_snprintf(bk.mark, sizeof(bk.mark), value);
94 g_snprintf(bk.dir, sizeof(bk.dir), view->dir);
95 g_snprintf(bk.file, sizeof(bk.file), file);
96 cfg.bookmarks = g_list_append(cfg.bookmarks,
97 duplicate(&bk, sizeof (Bookmarks)));
98 write_bookmarks_file();
99 recreate_main_window();
100 }
101
102 static void
103 back_to_normal_mode(FileView *view)
104 {
105 guint new_key_press_signal;
106
107 status_bar_message(" ");
108
109 new_key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(
110 GTK_OBJECT(view->clist),"signal_key_id"));
111 gtk_signal_disconnect(GTK_OBJECT(view->clist), new_key_press_signal);
112
113 if(cfg.fileselector)
114 {
115 new_key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
116 "key_press_event", GTK_SIGNAL_FUNC(fileselector_key_cb), view);
117 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
118 GUINT_TO_POINTER(new_key_press_signal));
119 }
120 else
121 {
122
123 new_key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
124 "key_press_event", GTK_SIGNAL_FUNC(file_list_key_press_cb), view);
125 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
126 GUINT_TO_POINTER(new_key_press_signal));
127 }
128 show_file_properties();
129
130 }
131 static void
132 set_mark_key_cb(GtkWidget *widget, GdkEventKey *event, FileView *view)
133 {
134 gchar value[10];
135
136 if ((event->keyval == 'c') && (event->state & GDK_CONTROL_MASK))
137 {
138 event->keyval = 0;
139 back_to_normal_mode(view);
140 return;
141 }
142 if(event->keyval == 0)
143 return;
144 if(event->keyval == GDK_apostrophe)
145 {
146 event->keyval = 0;
147 back_to_normal_mode(view);
148 status_bar_message("' is a reserved mark");
149 return;
150 }
151
152
153 if ((event->keyval == GDK_Shift_L) || (event->keyval == GDK_Shift_R))
154 return;
155
156 if ((event->keyval < 0x100) && (event->state == 0
157 || event->state & GDK_SHIFT_MASK))
158 {
159 /* a - z */
160 if ((event->keyval > 0x060) && (event->keyval < 0x07b))
161 {
162 g_snprintf(value, sizeof(value), "%c", event->keyval);
163 set_bookmark(view, value);
164 event->keyval = 0;
165 back_to_normal_mode(view);
166 return;
167 }
168 /* A - Z */
169 if ((event->keyval >0x040) && (event->keyval < 0x05a))
170 {
171 g_snprintf(value, sizeof(value), "%c", event->keyval);
172 set_bookmark(view, value);
173 event->keyval = 0;
174 back_to_normal_mode(view);
175 return;
176 }
177 }
178 event->keyval = 0;
179 back_to_normal_mode(view);
180 status_bar_message("Invalid Mark");
181 }
182 static void
183 find_mark_key_cb(GtkWidget *widget, GdkEventKey *event, FileView *view)
184 {
185 gchar value[10];
186
187 if ((event->keyval == 'c') && (event->state & GDK_CONTROL_MASK))
188 {
189 event->keyval = 0;
190 back_to_normal_mode(view);
191 return;
192 }
193 if ((event->keyval == GDK_Shift_L) || (event->keyval == GDK_Shift_R))
194 return;
195 if(event->keyval == 0)
196 return;
197
198 /* return to last position */
199 if(event->keyval == GDK_apostrophe)
200 {
201 gint tmp = view->last_row;
202
203 change_dir(view, view->last_dir);
204 gtk_clist_freeze(GTK_CLIST(view->clist));
205 focus_on_row(view, tmp);
206 gtk_clist_thaw(GTK_CLIST(view->clist));
207
208 event->keyval = 0;
209 back_to_normal_mode(view);
210 return;
211 }
212
213
214
215 if ((event->keyval < 0x100) && (event->state == 0
216 || event->state & GDK_SHIFT_MASK))
217 {
218 /* a - z */
219 if ((event->keyval > 0x060) && (event->keyval < 0x07b))
220 {
221 g_snprintf(value, sizeof(value), "%c", event->keyval);
222 find_bookmark(view, value);
223 event->keyval = 0;
224 back_to_normal_mode(view);
225 return;
226 }
227 /* A - Z */
228 if ((event->keyval >0x040) && (event->keyval < 0x05a))
229 {
230 g_snprintf(value, sizeof(value), "%c", event->keyval);
231 find_bookmark(view, value);
232 event->keyval = 0;
233 back_to_normal_mode(view);
234 return;
235 }
236 }
237 event->keyval = 0;
238 back_to_normal_mode(view);
239 status_bar_message("Invalid Mark");
240 }
241
242 void
243 set_mark(FileView *view)
244 {
245 guint key_press_signal;
246
247 key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(view->clist), "signal_key_id"));
248 gtk_signal_disconnect(GTK_OBJECT(view->clist), key_press_signal);
249
250 key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
251 "key_press_event", GTK_SIGNAL_FUNC(set_mark_key_cb), view);
252 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
253 GUINT_TO_POINTER(key_press_signal));
254
255 }
256
257 void
258 goto_mark(FileView *view)
259 {
260 guint key_press_signal;
261
262 key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(view->clist), "signal_key_id"));
263 gtk_signal_disconnect(GTK_OBJECT(view->clist), key_press_signal);
264
265 key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
266 "key_press_event", GTK_SIGNAL_FUNC(find_mark_key_cb), view);
267 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
268 GUINT_TO_POINTER(key_press_signal));
269
270
271 }
File src/buffer_menu.c added (mode: 100644) (index 0000000..65cedda)
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 <string.h>
20 #include "vide.h"
21
22
23 static void
24 action_cb(GtkWidget *widget, gpointer data)
25 {
26 gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), GPOINTER_TO_INT(data));
27 }
28
29
30 static void
31 menu_key_cb(GtkWidget *widget, GdkEventKey *event)
32 {
33 if ((event->keyval < 0x100)
34 && (event->state == 0 || event->state & GDK_SHIFT_MASK
35 || event->state & GDK_MOD2_MASK))
36 {
37 switch (event->keyval)
38 {
39
40 case 'j':
41 event->keyval = GDK_Down;
42 break;
43 case 'k':
44 event->keyval = GDK_Up;
45 break;
46 default:
47 event->keyval = 0;
48 break;
49 }
50 }
51 if(event->keyval == GDK_Return)
52 {
53
54 }
55 return;
56 }
57
58
59 void
60 create_buffer_menu(void)
61 {
62 GtkWidget *label;
63 ZvtTerm *tmp_term;
64 gint page = 1;
65
66 app.buffer_menu = gtk_menu_new();
67
68
69 add_menu_item(app.buffer_menu, " 1 Vide", action_cb, GINT_TO_POINTER(0));
70 add_menu_separator(app.buffer_menu);
71 while((tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook), page)))
72 {
73 gchar *text;
74 gchar buf[128];
75
76 label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook),
77 gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), page));
78 gtk_label_get(GTK_LABEL(label), &text);
79
80 if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(tmp_term))))
81 {
82 if(tmp_term == cfg.current_term)
83 {
84 g_snprintf(buf, sizeof(buf), "* %s", text);
85 add_menu_item(app.buffer_menu, buf, action_cb,
86 GINT_TO_POINTER(page));
87 }
88 else
89 {
90 g_snprintf(buf, sizeof(buf), " %s", text);
91 add_menu_item(app.buffer_menu, buf, action_cb,
92 GINT_TO_POINTER(page));
93 }
94
95 }
96 else
97 {
98 g_snprintf(buf, sizeof(buf), " %s", text);
99 add_menu_item(app.buffer_menu, buf, action_cb,
100 GINT_TO_POINTER(page));
101 }
102
103 add_menu_separator(app.buffer_menu);
104 page++;
105 }
106
107 add_menu_item(app.buffer_menu, "Cancel", NULL, NULL);
108
109
110
111 gtk_signal_connect(GTK_OBJECT(app.buffer_menu), "key_press_event",
112 GTK_SIGNAL_FUNC(menu_key_cb), NULL);
113 }
114
115
File src/callbacks.c added (mode: 100644) (index 0000000..ac1153f)
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 <unistd.h>
22 #include "vide.h"
23
24
25 void
26 permissions_cb (GtkWidget * widget)
27 {
28 FileInfo *info;
29
30 curr_view->iter = get_selection (curr_view);
31 g_return_if_fail (curr_view->iter != NULL);
32
33 curr_view->iter_base = curr_view->iter;
34 info = curr_view->iter->data;
35 create_permissions_dialog (info);
36 }
37
38 void
39 ownership_cb (GtkWidget * widget)
40 {
41 FileInfo *info;
42
43 curr_view->iter = get_selection (curr_view);
44 g_return_if_fail (curr_view->iter != NULL);
45
46 curr_view->iter_base = curr_view->iter;
47 info = curr_view->iter->data;
48 create_ownership_dialog (info);
49 }
50
51 void
52 file_info_cb (GtkWidget * widget)
53 {
54 FileInfo *info;
55
56 curr_view->iter = get_selection (curr_view);
57 g_return_if_fail (curr_view->iter != NULL);
58
59 curr_view->iter_base = curr_view->iter;
60 info = curr_view->iter->data;
61 create_file_info_dialog (info);
62 }
63
64 void
65 rename_cb (GtkWidget * widget)
66 {
67 create_rename_dialog ();
68 }
69
70 void
71 mkdir_cb (GtkWidget * widget)
72 {
73 create_mkdir_dialog ();
74 }
75
76 void
77 symlink_as_cb (GtkWidget * widget)
78 {
79 create_symlink_as_dialog ();
80 }
81
82 void
83 toggle_tag_cb ()
84 {
85 FileInfo *info = gtk_clist_get_row_data (GTK_CLIST (curr_view->clist),
86 curr_view->row);
87 gint row = curr_view->row;
88
89 if (g_list_find (curr_view->tagged, info) != NULL)
90 {
91 curr_view->tagged = g_list_remove (curr_view->tagged, info);
92 gtk_clist_set_background (GTK_CLIST (curr_view->clist), row,
93 &CLIST_COLOR);
94 status_bar_message("File removed from tag list");
95 }
96 else
97 {
98 curr_view->tagged = g_list_append (curr_view->tagged, info);
99 gtk_clist_unselect_all(GTK_CLIST(curr_view->clist));
100 gtk_clist_set_background (GTK_CLIST (curr_view->clist), row,
101 &TAG_COLOR);
102 status_bar_message("File is tagged");
103 }
104 }
105
106
107 void
108 command_cb (GtkWidget * widget)
109 {
110 create_command_dialog ();
111 }
112
113 void
114 configure_cb (GtkWidget * widget)
115 {
116 create_config_dialog (GENERAL_1);
117 }
118
119 void
120 quit_cb (GtkWidget * widget)
121 {
122 write_filetypes_file ();
123 write_bookmarks_file ();
124 write_user_commands_file ();
125 write_programs_file();
126 write_config_file ();
127 write_command_mode_file();
128 write_term_file();
129 gtk_main_quit ();
130 }
131
132
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/command_mode_menu.c added (mode: 100644) (index 0000000..dcc094e)
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 <string.h>
20 #include "vide.h"
21
22
23 static void
24 delc_cb(GtkWidget *widget, gpointer data)
25 {
26 GList *tmp;
27
28 for(tmp = cfg.command_mode_programs; tmp != NULL; tmp = tmp->next)
29 {
30 Command_Mode_Programs *program = tmp->data;
31 if(!strcmp(program->name, data))
32 {
33 cfg.command_mode_programs = g_list_remove_link(cfg.command_mode_programs,
34 tmp);
35 break;
36 }
37 }
38 write_command_mode_file();
39 recreate_main_window();
40 g_list_free(tmp);
41 }
42
43 static void
44 action_cb(GtkWidget *widget, gpointer data)
45 {
46 gchar buffer[1024];
47 g_snprintf(buffer, sizeof(buffer), ":%s", (char *)data);
48 execute_command(buffer);
49 }
50
51 static void
52 menu_key_cb(GtkWidget *widget, GdkEventKey *event)
53 {
54 if ((event->keyval < 0x100)
55 && (event->state == 0 || event->state & GDK_SHIFT_MASK
56 || event->state & GDK_MOD2_MASK))
57 {
58 switch (event->keyval)
59 {
60
61 case 'j':
62 event->keyval = GDK_Down;
63 break;
64 case 'k':
65 event->keyval = GDK_Up;
66 break;
67 default:
68 event->keyval = 0;
69 break;
70 }
71 }
72 if(event->keyval == GDK_Return)
73 {
74
75 }
76 return;
77 }
78
79
80 void
81 create_command_mode_menu(void)
82 {
83 GList *tmp;
84 gchar label[1024];
85
86 app.command_mode_menu = gtk_menu_new();
87
88 for(tmp = cfg.command_mode_programs; tmp != NULL; tmp = tmp->next)
89 {
90 Command_Mode_Programs *program = tmp->data;
91
92 g_snprintf(label, sizeof(label), "%s %s", program->name,
93 program->action);
94 add_menu_item(app.command_mode_menu, label,
95 action_cb, program->name);
96 add_menu_separator(app.command_mode_menu);
97 }
98 add_menu_item(app.command_mode_menu, "Cancel", action_cb, NULL);
99 gtk_signal_connect(GTK_OBJECT(app.command_mode_menu), "key_press_event",
100 GTK_SIGNAL_FUNC(menu_key_cb), NULL);
101 g_list_free(tmp);
102 }
103
104 void
105 create_delc_menu(void)
106 {
107 GList *tmp;
108 gchar label[1024];
109
110 app.delc_menu = gtk_menu_new();
111
112 for(tmp = cfg.command_mode_programs; tmp != NULL; tmp = tmp->next)
113 {
114 Command_Mode_Programs *program = tmp->data;
115
116 g_snprintf(label, sizeof(label), "%s %s", program->name,
117 program->action);
118 add_menu_item(app.delc_menu, label,
119 delc_cb, program->name);
120 add_menu_separator(app.delc_menu);
121 }
122 add_menu_item(app.delc_menu, "Cancel", action_cb, NULL);
123 gtk_signal_connect(GTK_OBJECT(app.delc_menu), "key_press_event",
124 GTK_SIGNAL_FUNC(menu_key_cb), NULL);
125 g_list_free(tmp);
126
127
128 }
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/confirm_dialog.c added (mode: 100644) (index 0000000..5860d2e)
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 "vide.h"
21
22 static GtkWidget *dialog;
23
24 static void
25 confirm_cb (GtkWidget * widget, guint * answer)
26 {
27 *answer = GPOINTER_TO_UINT (gtk_object_get_user_data (GTK_OBJECT (widget)));
28
29 gtk_grab_remove (dialog);
30 gtk_widget_destroy (dialog);
31 gtk_main_quit ();
32 }
33 static void
34 error_cb(GtkWidget *widget, gpointer data)
35 {
36 gtk_grab_remove(dialog);
37 gtk_widget_destroy(dialog);
38 if(1 < gtk_main_level())
39 gtk_main_quit();
40 }
41
42 static void
43 delete_event_cb (GtkWidget * widget)
44 {
45 /* this is just here so the user can't close the dialog without clicking
46 * one of the buttons
47 */
48 }
49
50 static void
51 key_press_cb (GtkWidget * widget, GdkEventKey * event, guint * answer)
52 {
53 if (event->keyval == GDK_Escape)
54 {
55 *answer = CANCEL;
56 gtk_grab_remove (dialog);
57 gtk_widget_destroy (dialog);
58 gtk_main_quit ();
59 }
60 }
61
62 void
63 create_error_dialog(gchar *label_text)
64 {
65 GtkWidget *button;
66 GtkWidget *dialog_vbox;
67 GtkWidget *action_area;
68
69 dialog = gtk_dialog_new ();
70 dialog_vbox = GTK_DIALOG (dialog)->vbox;
71 action_area = GTK_DIALOG (dialog)->action_area;
72 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
73 gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
74 GTK_SIGNAL_FUNC (delete_event_cb), NULL);
75 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
76 GTK_SIGNAL_FUNC (key_press_cb), NULL);
77 add_label(dialog_vbox, "Unable to execute command", 0, TRUE, 5);
78 add_label (dialog_vbox, label_text, 0, TRUE, 5);
79
80 button = add_button (action_area, "OK", TRUE, 0, error_cb, NULL);
81 gtk_widget_grab_focus (button);
82
83 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
84 gtk_widget_show (dialog);
85 gtk_grab_add (dialog);
86 gtk_window_set_transient_for (GTK_WINDOW (dialog),
87 GTK_WINDOW (app.main_window));
88 }
89 void
90 create_confirm_dialog (gchar * label_text, guint * answer)
91 {
92 GtkWidget *button;
93 GtkWidget *dialog_vbox;
94 GtkWidget *action_area;
95
96 dialog = gtk_dialog_new ();
97 dialog_vbox = GTK_DIALOG (dialog)->vbox;
98 action_area = GTK_DIALOG (dialog)->action_area;
99 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
100 gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
101 GTK_SIGNAL_FUNC (delete_event_cb), NULL);
102 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
103 GTK_SIGNAL_FUNC (key_press_cb), answer);
104
105 add_label (dialog_vbox, label_text, 0, TRUE, 5);
106
107 button = add_button (action_area, "Yes", TRUE, 0, confirm_cb, answer);
108 gtk_object_set_user_data (GTK_OBJECT (button), GUINT_TO_POINTER (YES));
109 gtk_widget_grab_focus (button);
110
111 button =
112 add_button (action_area, "Yes To All", TRUE, 0, confirm_cb, answer);
113 gtk_object_set_user_data (GTK_OBJECT (button),
114 GUINT_TO_POINTER (YES_TO_ALL));
115 button = add_button (action_area, "No", TRUE, 0, confirm_cb, answer);
116 gtk_object_set_user_data (GTK_OBJECT (button), GUINT_TO_POINTER (NO));
117
118 button = add_button (action_area, "Cancel", TRUE, 0, confirm_cb, answer);
119 gtk_object_set_user_data (GTK_OBJECT (button), GUINT_TO_POINTER (CANCEL));
120
121 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
122 gtk_widget_show (dialog);
123 gtk_grab_add (dialog);
124 gtk_window_set_transient_for (GTK_WINDOW (dialog),
125 GTK_WINDOW (app.main_window));
126 }
File src/copy_here_dialog.c added (mode: 100644) (index 0000000..0bacaa0)
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 <unistd.h>
21 #include "vide.h"
22
23 static GtkWidget *dialog;
24 static GtkWidget *entry;
25
26 static void
27 ok_cb (GtkWidget * widget, gchar * filename)
28 {
29 gchar *new_name;
30 //gint overwrite_button;
31
32 if ((new_name = gtk_entry_get_text (GTK_ENTRY (entry))) == NULL)
33 return;
34
35 file_copy (filename, new_name);
36
37 refresh_list (curr_view);
38 gtk_grab_remove (dialog);
39 gtk_widget_destroy (dialog);
40 }
41
42 static void
43 cancel_cb (GtkWidget * widget)
44 {
45 gtk_grab_remove (dialog);
46 gtk_widget_destroy (dialog);
47 }
48
49 static void
50 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
51 {
52 if (event->keyval == GDK_Escape)
53 cancel_cb (NULL);
54 }
55
56 void
57 create_copy_here_dialog ()
58 {
59 GtkWidget *dialog_vbox;
60 GtkWidget *action_area;
61 GtkWidget *wid;
62 FileInfo *info;
63
64 dialog = gtk_dialog_new ();
65 dialog_vbox = GTK_DIALOG (dialog)->vbox;
66 action_area = GTK_DIALOG (dialog)->action_area;
67 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
68 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
69 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
70 GTK_SIGNAL_FUNC (key_press_cb), NULL);
71
72 wid = add_label (dialog_vbox, "This allows you to copy a file\n"
73 "to the current directory\n"
74 "rather than the opposite directory.\n\n"
75 "Enter New Filename: ", 0.0, FALSE, 5);
76 gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT);
77
78 info =
79 gtk_clist_get_row_data (GTK_CLIST (curr_view->clist), curr_view->row);
80 entry = add_entry (dialog_vbox, info->filename, FALSE, 0);
81 gtk_signal_connect (GTK_OBJECT (entry), "activate",
82 GTK_SIGNAL_FUNC (ok_cb), info->filename);
83 gtk_widget_grab_focus (entry);
84
85 add_button (action_area, "Ok", TRUE, 0, ok_cb, info->filename);
86 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL);
87
88 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
89 gtk_widget_show (dialog);
90 gtk_grab_add (dialog);
91 gtk_window_set_transient_for (GTK_WINDOW (dialog),
92 GTK_WINDOW (app.main_window));
93 }
File src/date_filter_dialog.c added (mode: 100644) (index 0000000..59d6177)
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 "vide.h"
21 #include <time.h>
22 #include <unistd.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26
27 static GtkWidget *dialog;
28 static GtkWidget *date_entry;
29 static GtkWidget *operation_combo;
30
31 void
32 ok_cb (GtkWidget * widget, FileView * view)
33 {
34 gchar date_string[MAX_LEN];
35 gchar *s;
36 struct tm tm_time;
37
38 view->date_filter.active = TRUE;
39 /* set_filter_menu_active (view); */
40
41 g_snprintf (date_string, sizeof (date_string),
42 "%s 00:00:00", gtk_entry_get_text (GTK_ENTRY (date_entry)));
43 strptime (date_string, "%m-%d-%Y %T", &tm_time);
44 view->date_filter.time = mktime (&tm_time);
45
46 s = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry));
47 if (STREQ (s, "Accessed Since"))
48 {
49 view->date_filter.op = GT;
50 view->date_filter.time_type = ATIME;
51 }
52 else if (STREQ (s, "Accessed Before"))
53 {
54 view->date_filter.op = LT;
55 view->date_filter.time_type = ATIME;
56 }
57 else if (STREQ (s, "Modified Since"))
58 {
59 view->date_filter.op = GT;
60 view->date_filter.time_type = MTIME;
61 }
62 else if (STREQ (s, "Modified Before"))
63 {
64 view->date_filter.op = LT;
65 view->date_filter.time_type = MTIME;
66 }
67 else if (STREQ (s, "Changed Since"))
68 {
69 view->date_filter.op = GT;
70 view->date_filter.time_type = CTIME;
71 }
72 else if (STREQ (s, "Changed Before"))
73 {
74 view->date_filter.op = LT;
75 view->date_filter.time_type = CTIME;
76 }
77
78 gtk_grab_remove (dialog);
79 gtk_widget_destroy (dialog);
80 if(1 < gtk_main_level())
81 gtk_main_quit();
82 load_dir_list (view);
83 }
84
85 void
86 cancel_cb (GtkWidget * widget)
87 {
88 gtk_grab_remove (dialog);
89 gtk_widget_destroy (dialog);
90 if(1 < gtk_main_level())
91 gtk_main_quit();
92 }
93
94 static void
95 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
96 {
97 if (event->keyval == GDK_Escape)
98 cancel_cb (NULL);
99 }
100
101 void
102 create_date_filter_dialog (FileView * view)
103 {
104 GtkWidget *dialog_vbox;
105 GtkWidget *action_area;
106 GtkWidget *hbox;
107 gchar date_string[11];
108 struct tm *tm_ptr;
109 GList *tmp = NULL;
110
111 dialog = gtk_dialog_new ();
112 dialog_vbox = GTK_DIALOG (dialog)->vbox;
113 action_area = GTK_DIALOG (dialog)->action_area;
114 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
115 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
116 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
117 GTK_SIGNAL_FUNC (key_press_cb), NULL);
118
119 add_label (dialog_vbox, "Date Filter: ", 0.0, FALSE, 5);
120
121 hbox = add_hbox (dialog_vbox, FALSE, 5, TRUE, 5);
122
123 operation_combo = gtk_combo_new ();
124 gtk_widget_set_usize (operation_combo, 130, 0);
125 gtk_box_pack_start (GTK_BOX (hbox), operation_combo, FALSE, FALSE, 0);
126 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
127 FALSE);
128 gtk_widget_show (operation_combo);
129
130 tmp = g_list_append (tmp, strdup ("Accessed Since"));
131 tmp = g_list_append (tmp, strdup ("Accessed Before"));
132 tmp = g_list_append (tmp, strdup ("Modified Since"));
133 tmp = g_list_append (tmp, strdup ("Modified Before"));
134 tmp = g_list_append (tmp, strdup ("Changed Since"));
135 tmp = g_list_append (tmp, strdup ("Changed Before"));
136 gtk_combo_set_popdown_strings (GTK_COMBO (operation_combo), tmp);
137 switch (view->date_filter.time_type)
138 {
139 case ATIME:
140 if (view->date_filter.op == GT)
141 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
142 "Accessed Since");
143 else
144 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
145 "Accessed Before");
146 break;
147 case MTIME:
148 if (view->date_filter.op == GT)
149 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
150 "Modified Since");
151 else
152 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
153 "Modified Before");
154 break;
155 case CTIME:
156 if (view->date_filter.op == GT)
157 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
158 "Changed Since");
159 else
160 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
161 "Changed Before");
162 break;
163 default:
164 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
165 "Accessed Since");
166 break;
167 }
168
169 tm_ptr = localtime (&(view->date_filter.time));
170 strftime (date_string, sizeof (date_string), "%m-%d-%Y", tm_ptr);
171 date_entry = add_entry (hbox, date_string, FALSE, 0);
172 gtk_widget_set_usize (date_entry, 100, 0);
173
174 add_button (action_area, "Ok", FALSE, 0, ok_cb, view);
175 add_button (action_area, "Cancel", FALSE, 0, cancel_cb, NULL);
176
177 gtk_widget_show (dialog);
178 gtk_grab_add (dialog);
179 gtk_window_set_transient_for (GTK_WINDOW (dialog),
180 GTK_WINDOW (app.main_window));
181 g_list_free(tmp);
182 }
File src/file_info_dialog.c added (mode: 100644) (index 0000000..81b9097)
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 <string.h>
21 #include <unistd.h>
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <time.h>
25 #include <pwd.h>
26 #include <grp.h>
27 #include "vide.h"
28
29 #define FILE_TYPE_LENGTH 64 /* max length of the file type string */
30
31 static void
32 close_cb (GtkWidget * widget, GtkWidget * dialog)
33 {
34 gtk_grab_remove (dialog);
35 gtk_widget_destroy (dialog);
36 if(1 < gtk_main_level())
37 gtk_main_quit();
38
39 curr_view->iter = curr_view->iter->next;
40 if (curr_view->iter != NULL)
41 {
42 FileInfo *info = curr_view->iter->data;
43 create_file_info_dialog (info);
44 }
45 else
46 {
47 g_list_free (curr_view->iter_base);
48 gtk_clist_select_row (GTK_CLIST (curr_view->clist), curr_view->row, 0);
49 gtk_widget_grab_focus (curr_view->clist);
50 }
51 }
52
53 static void
54 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
55 {
56 if (event->keyval == GDK_Escape)
57 close_cb (NULL, widget);
58 }
59
60 static void
61 get_file_type_using_file_command (gchar * filename, gchar * string, gint len)
62 {
63 FILE *pipe;
64 gchar command[MAX_LEN];
65 gchar buf[len + NAME_MAX], *s;
66
67 g_snprintf (command, sizeof (command), "file \"%s\"", filename);
68 if ((pipe = popen (command, "r")) == NULL)
69 {
70 fprintf (stderr, "Unable to open pipe for file command\n");
71 return;
72 }
73
74 fgets (buf, sizeof (buf), pipe);
75 if ((s = strchr (buf, ':')) != NULL)
76 strncpy (string, s + 2, len);
77 else
78 strncpy (string, buf, len);
79
80 pclose (pipe);
81 }
82
83 void
84 create_file_info_dialog (FileInfo * info)
85 {
86 GtkWidget *file_info_dialog;
87 GtkWidget *dialog_vbox;
88 GtkWidget *action_area;
89 GtkWidget *table;
90 gchar label_text[MAX_LEN];
91 gchar perm_string[11];
92 struct tm *tm_ptr;
93 struct passwd *pw_buf;
94 struct group *grp_buf;
95
96 file_info_dialog = gtk_dialog_new ();
97 dialog_vbox = GTK_DIALOG (file_info_dialog)->vbox;
98 action_area = GTK_DIALOG (file_info_dialog)->action_area;
99 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
100 gtk_signal_connect (GTK_OBJECT (file_info_dialog), "key_press_event",
101 GTK_SIGNAL_FUNC (key_press_cb), NULL);
102
103 g_snprintf (label_text, sizeof (label_text), "Filename: %s",
104 info->filename);
105 add_label (dialog_vbox, label_text, 0, TRUE, 5);
106
107 add_separator (dialog_vbox, TRUE, 5);
108
109 if (S_ISLNK (info->statbuf.st_mode))
110 {
111 gchar linkto[PATH_MAX + NAME_MAX];
112 gchar *filename;
113 int len;
114
115 strncpy (label_text, "File Type: Symbolic Link", sizeof (label_text));
116 add_label (dialog_vbox, label_text, 0, TRUE, 0);
117
118 filename = strdup (info->filename);
119 len = strlen (filename);
120 if (filename[len - 1] == '/')
121 filename[len - 1] = '\0';
122
123 len = readlink (filename, linkto, sizeof (linkto));
124 if (len > 0)
125 {
126 linkto[len] = '\0';
127 g_snprintf (label_text, sizeof (label_text), "Link To: %s", linkto);
128 add_label (dialog_vbox, label_text, 0, TRUE, 0);
129 }
130 else
131 {
132 strncpy (label_text, "Link To: Couldn't Resolve Link",
133 sizeof (label_text));
134 add_label (dialog_vbox, label_text, 0, TRUE, 0);
135 }
136 free (filename);
137 }
138 else if (S_ISREG (info->statbuf.st_mode))
139 {
140 gchar file_type[FILE_TYPE_LENGTH];
141 gint len;
142
143 get_file_type_using_file_command (info->filename, file_type,
144 sizeof (file_type));
145 if ((len = strlen (file_type)) > (FILE_TYPE_LENGTH - 2))
146 {
147 for (len = FILE_TYPE_LENGTH - 4; len < FILE_TYPE_LENGTH - 1; len++)
148 {
149 file_type[len] = '.';
150 }
151 file_type[FILE_TYPE_LENGTH - 1] = '\0';
152 }
153 else
154 {
155 file_type[len - 1] = '\0';
156 }
157
158 g_snprintf (label_text, sizeof (label_text), "File Type: %s",
159 file_type);
160
161 add_label (dialog_vbox, label_text, 0, TRUE, 0);
162 }
163 else if (S_ISDIR (info->statbuf.st_mode))
164 {
165 strncpy (label_text, "File Type: Directory", sizeof (label_text));
166 add_label (dialog_vbox, label_text, 0, TRUE, 0);
167 }
168 else if (S_ISCHR (info->statbuf.st_mode))
169 {
170 strncpy (label_text, "File Type: Character Device",
171 sizeof (label_text));
172 add_label (dialog_vbox, label_text, 0, TRUE, 0);
173 }
174 else if (S_ISBLK (info->statbuf.st_mode))
175 {
176 strncpy (label_text, "File Type: Block Device", sizeof (label_text));
177 add_label (dialog_vbox, label_text, 0, TRUE, 0);
178 }
179 else if (S_ISFIFO (info->statbuf.st_mode))
180 {
181 strncpy (label_text, "File Type: FIFO Pipe", sizeof (label_text));
182 add_label (dialog_vbox, label_text, 0, TRUE, 0);
183 }
184 else if (S_ISSOCK (info->statbuf.st_mode))
185 {
186 strncpy (label_text, "File Type: Socket", sizeof (label_text));
187 add_label (dialog_vbox, label_text, 0, TRUE, 0);
188 }
189 else
190 {
191 strncpy (label_text, "File Type: Unknown", sizeof (label_text));
192 add_label (dialog_vbox, label_text, 0, TRUE, 0);
193 }
194
195 if (info->statbuf.st_size < 10240) /* less than 10K */
196 g_snprintf (label_text, sizeof (label_text),
197 "Size: %d bytes", (int) info->statbuf.st_size);
198 else if (info->statbuf.st_size < 1048576) /* less than a meg */
199 g_snprintf (label_text, sizeof (label_text),
200 "Size: %.2f Kbytes", (float) info->statbuf.st_size / 1024.0);
201 else /* more than a meg */
202 g_snprintf (label_text, sizeof (label_text),
203 "Size: %.2f Mbytes",
204 (float) info->statbuf.st_size / 1048576.0);
205
206 add_label (dialog_vbox, label_text, 0, TRUE, 0);
207
208 add_separator (dialog_vbox, TRUE, 5);
209
210 if ((pw_buf = getpwuid (info->statbuf.st_uid)) != NULL)
211 {
212 g_snprintf (label_text, sizeof (label_text),
213 "User: %s", pw_buf->pw_name);
214 }
215 else
216 {
217 g_snprintf (label_text, sizeof (label_text),
218 "User: %d", (int) info->statbuf.st_uid);
219 }
220 add_label (dialog_vbox, label_text, 0, TRUE, 0);
221
222 if ((grp_buf = getgrgid (info->statbuf.st_gid)) != NULL)
223 {
224 g_snprintf (label_text, sizeof (label_text),
225 "Group: %s", grp_buf->gr_name);
226 }
227 else
228 {
229 g_snprintf (label_text, sizeof (label_text),
230 "Group: %d", (int) info->statbuf.st_gid);
231 }
232 add_label (dialog_vbox, label_text, 0, TRUE, 0);
233
234 get_perm_string (perm_string, sizeof (label_text), info->statbuf.st_mode);
235 g_snprintf (label_text, sizeof (label_text), "Permissions: %s",
236 perm_string);
237 add_label (dialog_vbox, label_text, 0, TRUE, 0);
238
239 add_separator (dialog_vbox, TRUE, 5);
240
241 table = add_table (dialog_vbox, 3, 2, FALSE, TRUE, 5);
242 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
243
244 tm_ptr = localtime (&info->statbuf.st_atime);
245 strftime (label_text, sizeof (label_text), "%a %b %d %I:%M %p", tm_ptr);
246 add_label_to_table (table, "Accessed: ", 0, 0, 1, 0, 1);
247 add_label_to_table (table, label_text, 0, 1, 2, 0, 1);
248
249 tm_ptr = localtime (&info->statbuf.st_mtime);
250 strftime (label_text, sizeof (label_text), "%a %b %d %I:%M %p", tm_ptr);
251 add_label_to_table (table, "Modified: ", 0, 0, 1, 1, 2);
252 add_label_to_table (table, label_text, 0, 1, 2, 1, 2);
253
254 tm_ptr = localtime (&info->statbuf.st_ctime);
255 strftime (label_text, sizeof (label_text), "%a %b %d %I:%M %p", tm_ptr);
256 add_label_to_table (table, "Changed: ", 0, 0, 1, 2, 3);
257 add_label_to_table (table, label_text, 0, 1, 2, 2, 3);
258
259 add_button (action_area, "Close", TRUE, 0, close_cb, file_info_dialog);
260
261 gtk_window_set_position (GTK_WINDOW (file_info_dialog), GTK_WIN_POS_CENTER);
262 gtk_widget_show (file_info_dialog);
263 gtk_grab_add (file_info_dialog);
264 }
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/filename_filter_dialog.c added (mode: 100644) (index 0000000..6e876c7)
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 <string.h>
21 #include "vide.h"
22
23 static GtkWidget *dialog;
24 static GtkWidget *pattern_entry;
25 static GtkWidget *invert_check;
26
27 static void
28 ok_cb (GtkWidget * widget, FileView * view)
29 {
30 gchar *s;
31
32 s = gtk_entry_get_text (GTK_ENTRY (pattern_entry));
33 if (strlen (s) == 0)
34 {
35 gtk_grab_remove (dialog);
36 gtk_widget_destroy (dialog);
37 if(1 < gtk_main_level())
38 gtk_main_quit();
39 return;
40 }
41
42 view->filename_filter.active = TRUE;
43 /*set_filter_menu_active (view); */
44
45 strncpy (view->filename_filter.pattern, s,
46 sizeof (view->filename_filter.pattern));
47 view->filename_filter.invert_mask =
48 GTK_TOGGLE_BUTTON (invert_check)->active;
49
50
51 gtk_grab_remove (dialog);
52 gtk_widget_destroy (dialog);
53 if(1 < gtk_main_level())
54 gtk_main_quit();
55
56 load_dir_list (view);
57 }
58
59 static void
60 cancel_cb (GtkWidget * widget)
61 {
62 gtk_grab_remove (dialog);
63 gtk_widget_destroy (dialog);
64 if(1 < gtk_main_level())
65 gtk_main_quit();
66 }
67
68 static void
69 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
70 {
71 if (event->keyval == GDK_Escape)
72 cancel_cb (NULL);
73 }
74
75 void
76 create_filename_filter_dialog (FileView * view)
77 {
78 GtkWidget *dialog_vbox;
79 GtkWidget *action_area;
80 GtkTooltips *tooltips;
81
82 dialog = gtk_dialog_new ();
83 dialog_vbox = GTK_DIALOG (dialog)->vbox;
84 action_area = GTK_DIALOG (dialog)->action_area;
85 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
86 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
87 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
88 GTK_SIGNAL_FUNC (key_press_cb), NULL);
89
90 tooltips = gtk_tooltips_new ();
91
92 add_label (dialog_vbox, "Filename Filter: ", 0.0, FALSE, 5);
93 pattern_entry = add_entry (dialog_vbox, view->filename_filter.pattern,
94 FALSE, 0);
95 gtk_signal_connect (GTK_OBJECT (pattern_entry), "activate",
96 GTK_SIGNAL_FUNC (ok_cb), view);
97 gtk_widget_grab_focus (pattern_entry);
98
99 add_label (dialog_vbox, "Example: \\.c$ ^file", 0.0, FALSE, 0);
100
101 invert_check = add_check_button (dialog_vbox, "Invert",
102 view->filename_filter.invert_mask,
103 TRUE, 0, NULL, NULL);
104 gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), invert_check,
105 "Show files that DO NOT match the given mask", NULL);
106
107 add_button (action_area, "Ok", TRUE, 0, ok_cb, view);
108 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL);
109
110 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
111 gtk_widget_show (dialog);
112 gtk_grab_add (dialog);
113 gtk_window_set_transient_for (GTK_WINDOW (dialog),
114 GTK_WINDOW (app.main_window));
115 }
File src/fileops.c added (mode: 100644) (index 0000000..b6ee84f)
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 <stdlib.h>
21 #include <stdio.h>
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 #include <sys/wait.h>
25 #include <unistd.h>
26 #include <fcntl.h>
27 #include <errno.h>
28 #include <pthread.h>
29 #include "vide.h"
30
31 /*
32 * This file contains functions used to handle different file operations
33 * like copying, deleting, sym linking, etc.. most functions do this by
34 * forking and running the standard unix commands for the appropriate operation
35 */
36
37 static void start_reader_thread (void *ptr);
38
39 /* executes the argument array passed to it and waits for
40 * the forked process to exit before returning. It is used to do most
41 * of the file operations.
42 static gint
43 exec_and_wait(args)
44 gchar **args;
45 {
46 gint pid, status;
47
48 pid = fork();
49 if (pid == -1)
50 return -1;
51 if (pid == 0)
52 {
53 execvp(args[0], args);
54 exit(127);
55 }
56
57 do
58 {
59 if (waitpid(pid, &status, 0) == -1)
60 {
61 if (errno != EINTR)
62 return -1;
63 }
64 else
65 return status;
66 } while(1);
67 }
68 */
69
70 /* simply executes the argument array passed. the sigchild handler set up
71 * during startup will handle the process when it has ended so that we dont
72 * get zombies
73 */
74 static gint
75 execute (gchar ** args)
76 {
77 gint pid;
78
79 if ((pid = fork ()) == 0)
80 {
81 close(0);
82 execvp (args[0], args);
83 exit (127);
84 }
85
86 return pid;
87 }
88
89 /* copy src to dest.. return when the operation is done */
90 gint file_copy (gchar * src, gchar * dest)
91 {
92 gchar *args[5];
93
94 args[0] = "cp";
95 args[1] = "-r";
96 args[2] = src;
97 args[3] = dest;
98 args[4] = NULL;
99
100 return pipe_and_capture_output (args);
101 }
102
103 /* delete file.. return when the operation is done */
104 gint file_delete (gchar * file)
105 {
106 gchar *args[4];
107
108 args[0] = "rm";
109 args[1] = "-rf";
110 args[2] = file;
111 args[3] = NULL;
112
113 return pipe_and_capture_output (args);
114 }
115
116 /* move src to dest.. return when the operation is done */
117 gint file_move (gchar * src, gchar * dest)
118 {
119 gchar *args[4];
120
121 args[0] = "mv";
122 args[1] = src;
123 args[2] = dest;
124 args[3] = NULL;
125
126 return pipe_and_capture_output (args);
127 }
128
129 gint file_chmod (gchar * path, gchar * mode, gboolean recurse_dirs)
130 {
131 gchar *args[5];
132 gint i = 0;
133
134 args[i++] = "chmod";
135 if (recurse_dirs)
136 args[i++] = "-R";
137 args[i++] = mode;
138 args[i++] = path;
139 args[i++] = NULL;
140
141 return pipe_and_capture_output (args);
142 }
143
144 gint
145 file_chown (gchar * path,
146 uid_t owner_id, gid_t group_id, gboolean recurse_dirs)
147 {
148 gchar *args[5];
149 gchar mode[14];
150 gint i = 0;
151
152 g_snprintf (mode, sizeof (mode), "%d:%d", (int) owner_id, (int) group_id);
153
154 args[i++] = "chown";
155 if (recurse_dirs)
156 args[i++] = "-R";
157 args[i++] = mode;
158 args[i++] = path;
159 args[i++] = NULL;
160
161 return pipe_and_capture_output (args);
162 }
163
164 /* symlink src to dest */
165 gint file_symlink (gchar * src, gchar * dest)
166 {
167 return symlink (src, dest);
168 }
169
170 gint file_mkdir (gchar * path)
171 {
172 return mkdir (path, 0777);
173 }
174
175 /* execute command.. do not wait for it to exit */
176 gint file_exec (gchar * command)
177 {
178 gchar *args[4];
179 pid_t pid;
180
181 args[0] = "sh";
182 args[1] = "-c";
183 args[2] = command;
184 args[3] = NULL;
185
186 pid = execute (args);
187 return pid;
188 }
189
190 gint exec_in_xterm (gchar * command)
191 {
192 /* gnome-terminal takes different aguments than xterm or rxvt */
193 if(!strcmp(cfg.xterm_command, "gnome-terminal"))
194 {
195 gchar *args[4];
196 gchar buf[PATH_MAX];
197
198 g_snprintf(buf, sizeof(buf), "'%s'", command);
199
200 args[0] = cfg.xterm_command;
201 args[1] = "-e";
202 args[2] = command;
203 args[3] = NULL;
204
205 return execute(args);
206
207 }
208 else
209 {
210 gchar *args[7];
211
212 args[0] = cfg.xterm_command;
213 args[1] = "+sb";
214 args[2] = "-e";
215 args[3] = "sh";
216 args[4] = "-c";
217 args[5] = command;
218 args[6] = NULL;
219
220 return execute(args);
221 }
222
223 }
224
225 gint pipe_and_capture_output (gchar ** args)
226 {
227 gint file_pipes[2];
228 gint pid;
229 gchar buf[1024];
230 gint nread;
231
232 if (pipe (file_pipes) != 0)
233 {
234 status_errno ();
235 return -1;
236 }
237
238 if ((pid = fork ()) == -1)
239 {
240 status_errno ();
241 return -1;
242 }
243
244 if (pid == 0)
245 {
246 close (1);
247 close (2);
248 dup (file_pipes[1]);
249 dup (file_pipes[1]);
250 close (file_pipes[0]);
251 close (file_pipes[1]);
252
253 execvp (args[0], args);
254 exit (127);
255 }
256 else
257 {
258 close (file_pipes[1]);
259 while ((nread = read (file_pipes[0], buf, sizeof (buf) - 1)) > 0)
260 {
261 buf[nread] = '\0';
262 status_bar_message(buf);
263 }
264 close (file_pipes[0]);
265 }
266
267 return 0;
268 }
269
270 gint pipe_and_capture_output_threaded (gchar * command)
271 {
272 gint file_pipes[2];
273 gint pid;
274 gchar *args[4];
275 pthread_t reader_thread;
276
277
278 if (pipe (file_pipes) != 0)
279 {
280 status_errno ();
281 return -1;
282 }
283
284 if ((pid = fork ()) == -1)
285 {
286 status_errno ();
287 return -1;
288 }
289
290 if (pid == 0)
291 {
292 close (1);
293 close (2);
294 dup (file_pipes[1]);
295 dup (file_pipes[1]);
296 close (file_pipes[0]);
297 close (file_pipes[1]);
298
299 args[0] = "sh";
300 args[1] = "-c";
301 args[2] = command;
302 args[3] = NULL;
303 execvp (args[0], args);
304 exit (127);
305 }
306 else
307 {
308 close (file_pipes[1]);
309 pthread_create (&reader_thread, NULL, (void *) &start_reader_thread,
310 duplicate (&file_pipes[0], sizeof (gint)));
311 }
312
313 return 1;
314 }
315
316 static void
317 start_reader_thread (void *ptr)
318 {
319 gchar buf[1024];
320 gint nread, error;
321 gint *file_pipe = (gint *) ptr;
322 error = 0;
323
324 while ((nread = read (*file_pipe, buf, sizeof (buf) - 1)) > 0)
325 {
326 buf[nread] = '\0';
327 error = nread;
328 }
329 /* create error message dialog FIXME */
330 /* not all errors are returned correctly */
331 if(error != 0)
332 {
333 create_error_dialog(buf);
334 }
335 close (*file_pipe);
336 g_free (file_pipe);
337 pthread_exit (0);
338 }
File src/fileselector.c added (mode: 100644) (index 0000000..10bb58a)
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 "vide.h"
20
21 struct sentinel {
22 gint g;
23 gint action;
24 gint page;
25 }sentinel;
26
27 void
28 reset_to_normal(void)
29 {
30 guint key_press_signal;
31
32 cfg.fileselector = FALSE;
33
34 if(curr_view->clist == app.left_view.clist)
35 {
36 gtk_widget_show(GTK_WIDGET(app.right_view_box));
37 gtk_widget_show(GTK_WIDGET(app.sw));
38 }
39 else
40 {
41 gtk_widget_show(GTK_WIDGET(app.left_view_box));
42 gtk_widget_show(GTK_WIDGET(app.sw));
43 }
44
45 key_press_signal = GPOINTER_TO_INT(gtk_object_get_data
46 (GTK_OBJECT(curr_view->clist), "signal_key_id"));
47 gtk_signal_disconnect(GTK_OBJECT(curr_view->clist), key_press_signal);
48
49 key_press_signal = gtk_signal_connect(GTK_OBJECT(curr_view->clist),
50 "key_press_event", GTK_SIGNAL_FUNC(file_list_key_press_cb),
51 curr_view);
52 gtk_object_set_data(GTK_OBJECT(curr_view->clist), "signal_key_id",
53 GUINT_TO_POINTER(key_press_signal));
54
55
56 gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook),
57 sentinel.page);
58
59 }
60
61 static void
62 fileselect_commands()
63 {
64
65 }
66
67 static void
68 handle_selection(GdkEventKey *event)
69 {
70 FileInfo *info;
71
72
73 if (curr_view->tagged != NULL)
74 info = curr_view->tagged->data;
75 else
76 info = gtk_clist_get_row_data (GTK_CLIST (curr_view->clist),
77 curr_view->row);
78 g_return_if_fail (info != NULL);
79
80
81 if (is_dir (info))
82 {
83 gchar path[PATH_MAX];
84
85
86 if (strcmp (info->filename, "../") == 0)
87 {
88 change_dir(curr_view, "..");
89 return;
90 }
91 g_snprintf (path, sizeof (path), "%s/%s", curr_view->dir, info->filename);
92 change_dir (curr_view, path);
93 return;
94 }
95 else
96 {
97 switch(sentinel.action)
98 {
99 gchar buf[PATH_MAX];
100
101 case 0: /* load a file into the current vi buffer :e */
102 {
103 event->keyval = 0;
104 g_snprintf(buf, sizeof(buf), "%d\r", GDK_Escape);
105 write_to_term(cfg.current_term, buf);
106
107 g_snprintf(buf, sizeof(buf), ":e %s/%s\r\n", curr_view->dir,
108 info->filename);
109 write_to_term(cfg.current_term, buf);
110 event->keyval = 0;
111 reset_to_normal();
112 }
113 break;
114 case 1:/* split vi buffer and load file */
115 {
116 g_snprintf(buf, sizeof(buf), "%d\r", GDK_Escape);
117 write_to_term(cfg.current_term, buf);
118
119 if(!strcmp("vile", cfg.vi_clone))
120 {
121 g_snprintf(buf, sizeof(buf), ":split-current-window\r\n");
122 write_to_term(cfg.current_term, buf);
123 g_snprintf(buf, sizeof(buf), ":e %s/%s\r\n",
124 curr_view->dir, info->filename);
125 write_to_term(cfg.current_term, buf);
126 }
127 else
128 {
129 g_snprintf(buf, sizeof(buf), ":sp %s/%s\r\n",
130 curr_view->dir, info->filename);
131 write_to_term(cfg.current_term, buf);
132 }
133 event->keyval = 0;
134 reset_to_normal();
135 }
136 break;
137 case 2:/* vertically split vi bufer and load file */
138 {
139 g_snprintf(buf, sizeof(buf), "%d\r", GDK_Escape);
140 write_to_term(cfg.current_term, buf);
141
142 g_snprintf(buf, sizeof(buf), ":vs %s/%s\r\n", curr_view->dir,
143 info->filename);
144 write_to_term(cfg.current_term, buf);
145 event->keyval = 0;
146 reset_to_normal();
147 }
148 break;
149 case 3:/* open new terminal with vi and file */
150 {
151 g_snprintf(buf, sizeof(buf), "%s %s/%s", cfg.vi_command,
152 curr_view->dir, info->filename);
153
154 /* reset the notebook page first otherwise it will create the
155 * new term on the filemanager page.
156 */
157 gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), sentinel.page);
158 create_zterm(buf, FALSE);
159 event->keyval = 0;
160 reset_to_normal();
161 }
162 break;
163 case 4:/* use vimdiff program in new terminal */
164 {
165 }
166 break;
167
168 default:
169 event->keyval = 0;
170 reset_to_normal();
171 break;
172 }
173 }
174 }
175
176 void
177 fileselector_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
178 {
179 /* Ctrl+<letter> Shortcuts */
180 if (event->state & GDK_CONTROL_MASK)
181 {
182
183 switch (event->keyval)
184 {
185 case 'f':
186 event->state = 0;
187 event->keyval = GDK_Page_Down;
188 break;
189 case 'b':
190 event->state = 0;
191 event->keyval = GDK_Page_Up;
192 break;
193 case 'c':
194 {
195 event->keyval = 0;
196 reset_to_normal();
197 }
198 break;
199 /* Ctrl g shows file properties on status bar - patch by Sergei Gnezdov */
200 case 'g':
201 show_full_file_properties();
202 break;
203
204 default:
205 break;
206 }
207
208
209 return;
210 }
211
212 /* Alt+<letter> Shortcuts */
213 if (event->state & GDK_MOD1_MASK)
214 {
215 switch (event->keyval)
216 {
217 case 'B':
218 case 'b':
219 gtk_signal_emit_by_name (GTK_OBJECT (app.bookmark_menu_item),
220 "activate-item");
221 break;
222
223 case 'T':
224 case 't':
225 gtk_signal_emit_by_name(GTK_OBJECT(app.tools_menu_item),
226 "activate-item");
227 break;
228 case 'V':
229 case 'v':
230 gtk_signal_emit_by_name (GTK_OBJECT (app.vide_menu_item),
231 "activate-item");
232 break;
233 case 'O':
234 case 'o':
235 gtk_signal_emit_by_name (GTK_OBJECT (app.options_menu_item),
236 "activate-item");
237 break;
238 case 'H':
239 case 'h':
240 gtk_signal_emit_by_name (GTK_OBJECT (app.help_menu_item),
241 "activate-item");
242 break;
243 default:
244 break;
245 }
246 return;
247 }
248
249 /* Other Shortcuts */
250 switch (event->keyval)
251 {
252 /* Ignore tab and space otherwise Gtk+ will change which
253 * widget is focused.
254 */
255 case GDK_Tab:
256 case GDK_space:
257 event->keyval = 0;
258 break;
259
260 case GDK_Return:
261 handle_selection(event);
262 break;
263 default:
264 break;
265 }
266
267 /* code to mimic vi key bindings */
268 if ((event->keyval < 0x100)
269 && (event->state == 0 || event->state & GDK_SHIFT_MASK
270 || event->state & GDK_MOD2_MASK))
271 {
272 switch (event->keyval)
273 {
274 case 'j':
275 event->keyval = GDK_Down;
276 break;
277 case 'k':
278 event->keyval = GDK_Up;
279 break;
280 case 'G':
281 goto_row (widget, GTK_CLIST (widget)->rows - 1);
282 break;
283 case 'g':
284 {
285 if(sentinel.g)
286 {
287 sentinel.g = 0;
288 goto_row (widget, 0);
289 break;
290 }
291 else
292 {
293 sentinel.g = 1;
294 break;
295 }
296 }
297
298 case 'l':
299 event->keyval = GDK_Right;
300 break;
301 case 'u':
302 change_dir(curr_view, "..");
303 break;
304 case 'h':
305 event->keyval = GDK_Left;
306 return;
307 break;
308 case 'p':
309 create_filetype_popup();
310 gtk_menu_popup(GTK_MENU(app.filetype_popup), NULL, NULL,
311 set_menu_position, NULL, event->type, event->time);
312 break;
313 case 'P':
314 create_programs_menu();
315 gtk_menu_popup(GTK_MENU(app.programs_menu), NULL, NULL,
316 set_menu_position, NULL, event->type, event->time);
317 break;
318 case 't':
319 toggle_tag_cb();
320 break;
321 case 'm':
322 event->keyval = 0;
323 set_mark(curr_view);
324 break;
325 case GDK_apostrophe:
326 event->keyval = 0;
327 goto_mark(curr_view);
328 break;
329 case 'n':
330 if(curr_view->glob == NULL)
331 break;
332 find_next(curr_view);
333 break;
334 case 'N':
335 if(curr_view->glob == NULL)
336 break;
337 find_prev(curr_view);
338 break;
339 case '/':
340 {
341 search_mode(curr_view);
342 }
343 break;
344 case ':':
345 fileselect_commands(curr_view);
346 break;
347 default:
348 break;
349 }
350 }
351 return;
352 }
353
354 void
355 create_fileselector(GtkWidget *widget, gpointer action)
356 {
357 guint key_press_signal;
358
359 sentinel.action = GPOINTER_TO_INT(action);
360 sentinel.page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook));
361
362 cfg.fileselector = TRUE;
363
364
365 if(curr_view->clist == app.left_view.clist)
366 {
367 gtk_widget_hide(GTK_WIDGET(app.right_view_box));
368 gtk_widget_hide(GTK_WIDGET(app.sw));
369 }
370 else
371 {
372 gtk_widget_hide(GTK_WIDGET(app.left_view_box));
373 gtk_widget_hide(GTK_WIDGET(app.sw));
374 }
375
376
377 key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(
378 GTK_OBJECT(curr_view->clist), "signal_key_id"));
379
380 gtk_signal_disconnect(GTK_OBJECT(curr_view->clist), key_press_signal);
381
382 key_press_signal = gtk_signal_connect(GTK_OBJECT(curr_view->clist),
383 "key_press_event", GTK_SIGNAL_FUNC(fileselector_key_cb), NULL);
384
385 gtk_object_set_data(GTK_OBJECT(curr_view->clist), "signal_key_id",
386 GUINT_TO_POINTER(key_press_signal));
387
388 gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), 0);
389
390 }
File src/filetype.c added (mode: 100644) (index 0000000..29591d2)
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 <stdlib.h>
21 #include <string.h>
22 #include "vide.h"
23
24 /* Allocates and returns the programs string in the file types list with a
25 * matching extension.. the value returned needs to be freed
26 */
27 gchar *
28 get_programs_for_ext (gchar * ext)
29 {
30 FileType *ft = get_filetype_for_ext (ext);
31
32 if (ft != NULL)
33 return strdup (ft->programs);
34
35 return NULL;
36 }
37
38 /* same as above but returns the first program in the list */
39 gchar *
40 get_default_program_for_ext (gchar * ext)
41 {
42 FileType *ft = get_filetype_for_ext (ext);
43
44 if (ft != NULL)
45 {
46 gchar *program = strdup (ft->programs);
47 gchar *s;
48
49 if ((s = strchr (program, ',')) != NULL)
50 *s = '\0';
51
52 return program;
53 }
54
55 return NULL;
56 }
57
58 FileType *
59 get_filetype_for_ext (gchar * ext)
60 {
61 GList *tmp;
62 gchar *ext_copy, *s, *s2, *free_this;
63
64 ext = str_to_lower (ext);
65 for (tmp = cfg.filetypes; tmp != NULL; tmp = tmp->next)
66 {
67 FileType *ft = tmp->data;
68
69 free_this = ext_copy = strdup (ft->extensions);
70 while ((s = s2 = strchr (ext_copy, ',')) != NULL)
71 {
72 while (*(s2 - 1) == ' ') /* get rid of whitespace */
73 s2--;
74 *s2 = '\0';
75 while ((*ext_copy == '.') || (*ext_copy == ' '))
76 ext_copy++;
77
78 if (STREQ (ext_copy, ext))
79 {
80 free (free_this);
81 free (ext);
82 return ft;
83 }
84 ext_copy = s + 1;
85 }
86 while ((*ext_copy == '.') || (*ext_copy == ' '))
87 ext_copy++;
88 if (STREQ (ext_copy, ext))
89 {
90 free (free_this);
91 free (ext);
92 return ft;
93 }
94 free (free_this);
95 }
96 g_list_free(tmp);
97 free (ext);
98
99 return NULL;
100 }
101
102 /* first checks to see if a filetype with the same extensions exists..
103 * if not it creates and adds a new filetype
104 */
105 void
106 add_filetype (gchar * extensions, gchar * programs, gchar * description)
107 {
108 GList *tmp;
109
110 for (tmp = cfg.filetypes; tmp != NULL; tmp = tmp->next)
111 {
112 FileType *ft = tmp->data;
113
114 if (STREQ (extensions, ft->extensions))
115 {
116 strncpy (ft->programs, programs, sizeof (ft->programs));
117 strncpy (ft->description, description, sizeof (ft->description));
118 return;
119 }
120 }
121
122 {
123 FileType ft;
124 strncpy (ft.description, description, sizeof (ft.description));
125 strncpy (ft.extensions, extensions, sizeof (ft.extensions));
126 strncpy (ft.programs, programs, sizeof (ft.programs));
127
128 cfg.filetypes =
129 g_list_append (cfg.filetypes, duplicate (&ft, sizeof (FileType)));
130 }
131 }
132
File src/filetype_dialog.c added (mode: 100644) (index 0000000..fe64f95)
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 *filetype_dialog;
26 static GtkWidget *actions_list;
27 static GtkWidget *description_entry;
28 static GtkWidget *extensions_entry;
29 static FileType *this_filetype;
30
31
32 static void
33 add_action_cb (GtkWidget * widget)
34 {
35 gchar label[NAME_MAX];
36 gchar *extensions = gtk_entry_get_text (GTK_ENTRY (extensions_entry));
37 gchar *description = gtk_entry_get_text (GTK_ENTRY (description_entry));
38 gchar *new_action;
39
40 if (STREQ (extensions, ""))
41 {
42 status_bar_message("Extensions field cannot be blank\n");
43 return;
44 }
45 g_snprintf (label, sizeof (label), "Enter program for %s", description);
46
47 create_user_prompt (label, "", &new_action);
48 gtk_main ();
49
50 if (new_action != NULL)
51 {
52 gchar *buf[1];
53
54 buf[0] = new_action;
55 gtk_clist_append (GTK_CLIST (actions_list), buf);
56
57 g_free (new_action);
58 }
59 }
60
61 static void
62 change_action_cb (GtkWidget * widget)
63 {
64 gint selected_row;
65 gchar *action;
66 gchar *new_action;
67
68 if (GTK_CLIST (actions_list)->selection != NULL)
69 selected_row = (gint) GTK_CLIST (actions_list)->selection->data;
70 else
71 return;
72
73 if (selected_row < 0)
74 return;
75
76 gtk_clist_get_text (GTK_CLIST (actions_list), selected_row, 0, &action);
77
78 create_user_prompt ("Enter new action:", action, &new_action);
79 gtk_main ();
80
81 if (new_action != NULL)
82 {
83 gtk_clist_set_text (GTK_CLIST (actions_list), selected_row, 0,
84 new_action);
85 g_free (new_action);
86 }
87 }
88
89 static void
90 remove_action_cb (GtkWidget * widget)
91 {
92 gint selected_row;
93
94 if (GTK_CLIST (actions_list)->selection != NULL)
95 selected_row = (gint) GTK_CLIST (actions_list)->selection->data;
96 else
97 return;
98
99 if (selected_row < 0)
100 return;
101
102 gtk_clist_remove (GTK_CLIST (actions_list), selected_row);
103 }
104
105 static void
106 set_default_action_cb (GtkWidget * widget)
107 {
108 gint selected_row;
109
110 if (GTK_CLIST (actions_list)->selection != NULL)
111 selected_row = (gint) GTK_CLIST (actions_list)->selection->data;
112 else
113 return;
114
115 if (selected_row == 0)
116 return;
117
118 gtk_clist_swap_rows (GTK_CLIST (actions_list), selected_row, 0);
119 }
120
121 static void
122 done_cb (GtkWidget * widget, gpointer write_file)
123 {
124 gchar *description = gtk_entry_get_text (GTK_ENTRY (description_entry));
125 gchar *extensions = gtk_entry_get_text (GTK_ENTRY (extensions_entry));
126 gchar *program;
127 gint i;
128
129 strncpy (this_filetype->description, description,
130 sizeof (this_filetype->description));
131 strncpy (this_filetype->extensions, extensions,
132 sizeof (this_filetype->extensions));
133 strncpy (this_filetype->programs, "", sizeof (this_filetype->programs));
134
135 for (i = 0; i < GTK_CLIST (actions_list)->rows; i++)
136 {
137 gtk_clist_get_text (GTK_CLIST (actions_list), i, 0, &program);
138 strncat (this_filetype->programs, program,
139 sizeof (this_filetype->programs));
140
141 if ((i + 1) != GTK_CLIST (actions_list)->rows) /* not after the last one */
142 strncat (this_filetype->programs, ",",
143 sizeof (this_filetype->programs));
144 }
145
146 if (GPOINTER_TO_INT (write_file))
147 write_filetypes_file ();
148
149 gtk_grab_remove (filetype_dialog);
150 gtk_widget_destroy (filetype_dialog);
151 if(1 < gtk_main_level())
152 gtk_main_quit();
153 }
154
155 static void
156 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
157 {
158 if (event->keyval == GDK_Escape)
159 done_cb (NULL, GINT_TO_POINTER (FALSE));
160 }
161
162 void
163 create_filetype_dialog (FileType * ft, gboolean write_file)
164 {
165 GtkWidget *sw;
166 GtkWidget *hbox;
167 GtkWidget *vbox;
168 GtkWidget *table;
169 GtkWidget *dialog_vbox;
170 GtkWidget *action_area;
171 gchar *program, *s, *free_this;
172 gchar *buf[1];
173
174 this_filetype = ft;
175
176 filetype_dialog = gtk_dialog_new ();
177 gtk_widget_set_usize (filetype_dialog, 250, 250);
178 dialog_vbox = GTK_DIALOG (filetype_dialog)->vbox;
179 action_area = GTK_DIALOG (filetype_dialog)->action_area;
180 gtk_signal_connect (GTK_OBJECT (filetype_dialog), "key_press_event",
181 GTK_SIGNAL_FUNC (key_press_cb), NULL);
182
183 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
184 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
185 gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
186
187 table = add_table (dialog_vbox, 2, 2, FALSE, TRUE, 2);
188 add_label_to_table (table, "Description:", 0.8, 0, 1, 0, 1);
189 description_entry = add_entry_to_table (table, this_filetype->description,
190 1, 2, 0, 1);
191
192 add_label_to_table (table, "Extension(s):", 0.8, 0, 1, 1, 2);
193 extensions_entry = add_entry_to_table (table, this_filetype->extensions,
194 1, 2, 1, 2);
195
196 add_label (dialog_vbox, "Actions:", 0.01, FALSE, 0);
197
198 sw = add_sw (dialog_vbox, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, TRUE, 0);
199
200 actions_list = gtk_clist_new (1);
201 gtk_clist_set_selection_mode (GTK_CLIST (actions_list),
202 GTK_SELECTION_BROWSE);
203 gtk_clist_set_reorderable (GTK_CLIST (actions_list), TRUE);
204 gtk_container_add (GTK_CONTAINER (sw), actions_list);
205 gtk_widget_show (actions_list);
206
207 if ((s = strdup (this_filetype->programs)) != NULL)
208 {
209 free_this = program = s;
210 while ((s = strchr (program, ',')) != NULL)
211 {
212 *s++ = '\0';
213 buf[0] = program;
214 gtk_clist_append (GTK_CLIST (actions_list), buf);
215 program = s;
216 }
217 buf[0] = program;
218 gtk_clist_append (GTK_CLIST (actions_list), buf);
219 free (free_this);
220 }
221
222 vbox = add_vbox (action_area, TRUE, 2, TRUE, 0);
223 hbox = add_hbox (vbox, FALSE, 5, TRUE, 0);
224 add_button (hbox, "Add", TRUE, 0, add_action_cb, NULL);
225 add_button (hbox, "Remove", TRUE, 0, remove_action_cb, NULL);
226 add_button (hbox, "Change", TRUE, 0, change_action_cb, NULL);
227 add_button (hbox, "Set Default", TRUE, 0, set_default_action_cb, NULL);
228
229 hbox = add_hbox (vbox, TRUE, 2, TRUE, 2);
230 add_button (hbox, "Done", TRUE, 0, done_cb, GINT_TO_POINTER (write_file));
231
232 gtk_window_set_position (GTK_WINDOW (filetype_dialog), GTK_WIN_POS_MOUSE);
233 gtk_widget_show (filetype_dialog);
234 gtk_grab_add (filetype_dialog);
235 gtk_window_set_transient_for (GTK_WINDOW (filetype_dialog),
236 GTK_WINDOW (app.main_window));
237 }
File src/filetype_popup.c added (mode: 100644) (index 0000000..3aa3072)
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 <stdlib.h>
21 #include <string.h>
22 #include "vide.h"
23
24
25
26 static void
27 execute_com(gchar *command)
28 {
29 GString *expanded_command;
30
31 expanded_command = expand_macros(command);
32 if(command == NULL)
33 {
34 g_string_free(expanded_command, TRUE);
35 }
36 else
37 {
38 pipe_and_capture_output_threaded(expanded_command->str);
39 g_string_free(expanded_command, TRUE);
40 }
41 }
42
43 static void
44 trash_cb(GtkWidget *widget)
45 {
46 gchar buf[126];
47 g_snprintf(buf, 126, "mv %%f %s", cfg.trash);
48 execute_com(buf);
49
50 }
51
52 static void
53 copy_cb(GtkWidget *widget)
54 {
55 gchar buf[126];
56
57 g_snprintf(buf, 126, "cp %%f %%D");
58 execute_com(buf);
59 }
60
61 static void
62 move_cb(GtkWidget *widget)
63 {
64 gchar buf[126];
65
66 g_snprintf(buf, 126, "mv -f %%f %%D");
67 execute_com(buf);
68
69 }
70
71 static void
72 rename_cb(GtkWidget *widget)
73 {
74 gchar buf[126];
75
76 g_snprintf(buf, 126, "mv %%f %%{Filename:}");
77 execute_com(buf);
78
79 }
80
81 /* this should be user definable */
82 static void
83 make_tar_cb(GtkWidget *widget)
84 {
85 exec_action("tar c %f | gzip > %{Filename for tar.gz}");
86 }
87
88 static void
89 make_bz2_cb(GtkWidget *widget)
90 {
91 exec_action("tar c %f | bzip2 > %{Filename for tar.bz2}");
92 }
93
94
95 static void
96 choose_action_cb(GtkWidget *widget)
97 {
98 gchar *action, *s;
99 gtk_label_get(GTK_LABEL(GTK_MENU_ITEM(widget)->item.bin.child), &s);
100 action = g_strdup(s);
101 action = g_strdup(s); /* since exec action writes to the string passed */
102 exec_action(action);
103 g_free(action);
104 }
105
106
107 void
108 dialog_key_cb(GtkWidget *widget, GdkEventKey *event)
109 {
110 if ((event->keyval < 0x100)
111 && (event->state == 0 || event->state & GDK_SHIFT_MASK
112 || event->state & GDK_MOD2_MASK))
113 {
114 switch (event->keyval)
115 {
116
117 case 'j':
118 event->keyval = GDK_Down;
119 break;
120 case 'k':
121 event->keyval = GDK_Up;
122 break;
123 case 'l':
124 event->keyval = GDK_Right;
125 break;
126 case 'h':
127 event->keyval = GDK_Left;
128 break;
129 default:
130 event->keyval = 0;
131 break;
132 }
133 }
134 if(event->keyval == GDK_Return)
135 {
136
137 }
138 return;
139 }
140
141 void
142 start_netscape(GtkWidget *widget, gpointer data)
143 {
144 gchar com[PATH_MAX];
145 gchar *file;
146
147 gtk_clist_get_text(GTK_CLIST(curr_view->clist), curr_view->row, 0, &file);
148 g_snprintf(com, sizeof(com), "netscape %s/%s", curr_view->dir, file);
149 file_exec(com);
150 }
151 void
152 reuse_netscape(GtkWidget *widget, gpointer data)
153 {
154 gchar com[PATH_MAX];
155 gchar *file;
156
157 gtk_clist_get_text(GTK_CLIST(curr_view->clist), curr_view->row, 0, &file);
158 g_snprintf(com, sizeof(com), "netscape -remote 'openURL(file:%s/%s)'",
159 curr_view->dir, file);
160 file_exec(com);
161
162 }
163 void
164 new_window_netscape(GtkWidget *widget, gpointer data)
165 {
166 gchar com[PATH_MAX];
167 gchar *file;
168
169 gtk_clist_get_text(GTK_CLIST(curr_view->clist), curr_view->row, 0, &file);
170 g_snprintf(com, sizeof(com),
171 "netscape -remote 'openURL(file:%s/%s, new-window)'",
172 curr_view->dir, file);
173 file_exec(com);
174
175 }
176
177 void
178 add_netscape(void)
179 {
180
181 add_menu_item(app.filetype_popup, "Open in Netscape", start_netscape, NULL);
182 add_menu_separator(app.filetype_popup);
183 add_menu_item(app.filetype_popup, "Reuse Current Netscape Window",
184 reuse_netscape, NULL);
185 add_menu_separator(app.filetype_popup);
186 add_menu_item(app.filetype_popup, "Open in New Netscape Window",
187 new_window_netscape, NULL);
188 add_menu_separator(app.filetype_popup);
189 }
190 void
191 create_filetype_popup(void)
192 {
193
194 GtkWidget *menu_item;
195 GtkWidget *menu;
196 FileInfo *info;
197
198 app.filetype_popup = gtk_menu_new();
199
200 curr_view->iter = get_selection(curr_view);
201 g_return_if_fail(curr_view->iter != NULL);
202 curr_view->iter_base = curr_view->iter;
203 info = curr_view->iter->data;
204
205 if(S_ISDIR(info->statbuf.st_mode))
206 {
207 menu_item = add_menu_item(app.filetype_popup, "File Info",
208 file_info_cb, NULL);
209 add_menu_separator(app.filetype_popup);
210 menu_item = add_menu_item(app.filetype_popup, "Permissions",
211 permissions_cb, NULL);
212 add_menu_separator(app.filetype_popup);
213 menu_item = add_menu_item(app.filetype_popup, "User Group",
214 ownership_cb, NULL);
215 if(!cfg.fileselector)
216 {
217 add_menu_separator(app.filetype_popup);
218 /* add actions here */
219 menu_item = add_menu_item(app.filetype_popup, "Make tar.gz",
220 make_tar_cb, NULL);
221 add_menu_separator(app.filetype_popup);
222 menu_item = add_menu_item(app.filetype_popup, "Make tar.bz2",
223 make_bz2_cb, NULL);
224 add_menu_separator(app.filetype_popup);
225 }
226
227 }
228 else
229 {
230 GtkWidget *menu_item;
231
232 gchar *ext, *program, *s, *free_this;
233
234 menu_item = add_menu_item(app.filetype_popup, "File Info",
235 file_info_cb, NULL);
236 add_menu_separator(app.filetype_popup);
237
238 if(!cfg.fileselector)
239 {
240 menu = gtk_menu_new();
241 gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
242 GTK_SIGNAL_FUNC(dialog_key_cb), NULL);
243 add_menu_item(menu, "Trash", trash_cb, NULL);
244 add_menu_separator(menu);
245 add_menu_item(menu, "Copy", copy_cb, NULL);
246 add_menu_separator(menu);
247 add_menu_item(menu, "Move", move_cb, NULL);
248 add_menu_separator(menu);
249 add_menu_item(menu, "Rename", rename_cb, NULL);
250 menu_item = add_menu_item(app.filetype_popup, "Actions", NULL, NULL);
251 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
252 add_menu_separator(app.filetype_popup);
253 }
254
255 menu_item = add_menu_item(app.filetype_popup, "Permissions",
256 permissions_cb, NULL);
257 add_menu_separator(app.filetype_popup);
258 if(!cfg.fileselector)
259 {
260 menu_item = add_menu_item(app.filetype_popup, "Open With",
261 create_open_with_dialog, NULL);
262 add_menu_separator(app.filetype_popup);
263 }
264
265 info = gtk_clist_get_row_data(GTK_CLIST(curr_view->clist), curr_view->row);
266 if((ext = strchr(info->filename, '.')) == NULL)
267 {
268 /* if no filetype put vi on menu
269 add_menu_item(app.filetype_popup, cfg.viewer_command,
270 choose_action_cb, NULL);
271 add_menu_separator(app.filetype_popup);
272 */
273
274 add_menu_item(app.filetype_popup, "Cancel", NULL, NULL);
275 gtk_signal_connect(GTK_OBJECT(app.filetype_popup), "key_press_event",
276 GTK_SIGNAL_FUNC(dialog_key_cb), NULL);
277 return;
278 }
279
280
281 do
282 {
283
284 ext++; /* get rid of the leading '.' */
285 program = free_this = get_programs_for_ext(ext);
286 if (program != NULL)
287 {
288 while ((s = strchr(program, ',')) != NULL)
289 {
290 *s++ = '\0';
291 /* special menu for netscape -remote */
292 if(strcmp(program, "netscape"))
293 {
294 add_menu_item(app.filetype_popup, program,
295 choose_action_cb, NULL);
296 add_menu_separator(app.filetype_popup);
297 }
298 else
299 add_netscape();
300 program = s;
301 }
302 if(strcmp(program, "netscape"))
303 {
304 add_menu_item(app.filetype_popup, program, choose_action_cb, NULL);
305 add_menu_separator(app.filetype_popup);
306 }
307 else
308 add_netscape();
309
310 add_menu_item(app.filetype_popup, "Cancel", NULL, NULL);
311 gtk_signal_connect(GTK_OBJECT(app.filetype_popup),
312 "key_press_event",
313 GTK_SIGNAL_FUNC(dialog_key_cb), NULL);
314
315 free(free_this);
316 return;
317 }
318 } while ((ext = strchr(ext, '.')) != NULL);
319 }
320
321
322 add_menu_item(app.filetype_popup, "Cancel", NULL, NULL);
323 gtk_signal_connect(GTK_OBJECT(app.filetype_popup), "key_press_event",
324 GTK_SIGNAL_FUNC(dialog_key_cb), NULL);
325
326 }
File src/for_each_dialog.c added (mode: 100644) (index 0000000..cb06ba6)
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 <string.h>
21 #include "vide.h"
22
23 static GtkWidget *dialog;
24 static GtkWidget *entry;
25
26 static GString *
27 expand (gchar * text, gchar * filename)
28 {
29 GString *command_string = g_string_new ("");
30 gchar *s, *free_this, *command_copy;
31
32 command_copy = g_strdup (text);
33 free_this = s = command_copy;
34
35 if (strchr (command_copy, '%') == NULL)
36 {
37 g_string_sprintf (command_string, "%s %s", command_copy, filename);
38 g_free (free_this);
39 return command_string;
40 }
41
42 while ((s = strchr (command_copy, '%')) != NULL)
43 {
44 *s++ = '\0';
45 g_string_append (command_string, command_copy);
46 command_copy = s + 1;
47 switch (*s)
48 {
49 case 'f':
50 g_string_sprintfa (command_string, "\"%s\"", filename);
51 break;
52 case 'd':
53 g_string_sprintfa (command_string, "\"%s\"", curr_view->dir);
54 break;
55 case 'D':
56 g_string_sprintfa (command_string, "\"%s\"", other_view->dir);
57 break;
58 default:
59 g_string_append_c (command_string, '%');
60 g_string_append_c (command_string, *s);
61 break;
62 }
63 }
64 g_string_append (command_string, command_copy);
65 g_free (free_this);
66 return command_string;
67 }
68
69 static void
70 ok_cb (GtkWidget * widget, gchar * filename)
71 {
72 GList *tmp, *base;
73 gchar *text = gtk_entry_get_text (GTK_ENTRY (entry));
74 GString *command;
75
76 base = tmp = get_selection (curr_view);
77 for (; tmp != NULL; tmp = tmp->next)
78 {
79 FileInfo *info = tmp->data;
80 command = expand (text, info->filename);
81 if (strncmp (command->str, "x ", 2) == 0)
82 //exec_in_xterm (command->str + 2);
83 create_zterm(command->str +2, TRUE);
84 else
85 file_exec (command->str);
86 g_string_free (command, TRUE);
87 }
88 g_list_free(base);
89
90 gtk_grab_remove (dialog);
91 gtk_widget_destroy (dialog);
92 }
93
94 static void
95 cancel_cb (GtkWidget * widget)
96 {
97 gtk_grab_remove (dialog);
98 gtk_widget_destroy (dialog);
99 }
100
101 static void
102 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
103 {
104 if (event->keyval == GDK_Escape)
105 cancel_cb (NULL);
106 }
107
108 void
109 create_for_each_dialog ()
110 {
111 GtkWidget *dialog_vbox;
112 GtkWidget *action_area;
113 GtkWidget *wid;
114
115 dialog = gtk_dialog_new ();
116 dialog_vbox = GTK_DIALOG (dialog)->vbox;
117 action_area = GTK_DIALOG (dialog)->action_area;
118 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
119 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
120 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
121 GTK_SIGNAL_FUNC (key_press_cb), NULL);
122
123 wid = add_label (dialog_vbox, "Enter a command to execute\n"
124 "on each selected file:\n\n"
125 "Macros:\n"
126 "%f = Filename\n"
127 "%d = Active Directory\n"
128 "%D = Inactive Directory", 0.0, FALSE, 0);
129 gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT);
130
131 entry = add_entry (dialog_vbox, "", FALSE, 0);
132 gtk_signal_connect (GTK_OBJECT (entry), "activate",
133 GTK_SIGNAL_FUNC (ok_cb), NULL);
134 gtk_widget_grab_focus (entry);
135
136 add_button (action_area, "Ok", TRUE, 0, ok_cb, NULL);
137 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL);
138
139 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
140 gtk_widget_show (dialog);
141 gtk_grab_add (dialog);
142 gtk_window_set_transient_for (GTK_WINDOW (dialog),
143 GTK_WINDOW (app.main_window));
144 }
File src/history.c added (mode: 100644) (index 0000000..04c6c36)
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"vide.h"
20
21 void
22 history_cb(GtkWidget *widget, gpointer data)
23 {
24 change_dir(curr_view, data);
25
26 }
27
28 void
29 history_key_cb(GtkWidget *widget, GdkEventKey *event)
30 {
31
32 if ((event->keyval < 0x100)
33 && (event->state == 0 || event->state & GDK_SHIFT_MASK
34 || event->state & GDK_MOD2_MASK))
35 {
36 switch (event->keyval)
37 {
38
39 case 'j':
40 event->keyval = GDK_Down;
41 break;
42 case 'k':
43 event->keyval = GDK_Up;
44 break;
45 default:
46 event->keyval = 0;
47 break;
48 }
49 }
50 return;
51 }
52
53
54 void
55 create_history_menu(FileView *view)
56 {
57 GList *tmp = NULL;
58
59 app.history_menu = gtk_menu_new();
60
61 for(tmp = view->menu_history; tmp != NULL; tmp = tmp->next)
62 {
63 History *history = tmp->data;
64
65 add_menu_item(app.history_menu, history->dir, history_cb, history->dir);
66 add_menu_separator(app.history_menu);
67 }
68 g_list_free(tmp);
69 add_menu_item(app.history_menu, "Cancel", NULL, NULL);
70 gtk_signal_connect(GTK_OBJECT(app.history_menu), "key_press_event",
71 GTK_SIGNAL_FUNC(history_key_cb), NULL);
72
73 gtk_menu_popup(GTK_MENU(app.history_menu), NULL, NULL,
74 set_menu_position, NULL, 0, 0);
75
76 }
77
File src/icon_dirparent.xpm added (mode: 100644) (index 0000000..1e84b68)
1 /* XPM */
2 static char *icon_dirparent_xpm[] = {
3 /* width height num_colors chars_per_pixel */
4 " 19 16 49 1",
5 /* colors */
6 ". c #000000",
7 "# c #080808",
8 "a c #313131",
9 "b c #393939",
10 "c c #423110",
11 "d c #5a3910",
12 "e c #734a10",
13 "f c #845218",
14 "g c #845a18",
15 "h c #8c5a18",
16 "i c #8c6318",
17 "j c #946318",
18 "k c #9c9c9c",
19 "l c #a57321",
20 "m c #adb5ff",
21 "n c #b58429",
22 "o c #b5b5ff",
23 "p c #bdbdff",
24 "q c #c69429",
25 "r c #c6c6ff",
26 "s c #ce9c29",
27 "t c #ceceff",
28 "u c #d6a529",
29 "v c #d6a531",
30 "w c #d6d6ff",
31 "x c #dead31",
32 "y c #deb531",
33 "z c #dedeff",
34 "A c #e7bd39",
35 "B c #e7c639",
36 "C c #e7c642",
37 "D c #e7ce42",
38 "E c #e7ce4a",
39 "F c None",
40 "G c #e7e7ff",
41 "H c #e7efff",
42 "I c #efbd31",
43 "J c #efefff",
44 "K c #f7bd39",
45 "L c #f7c639",
46 "M c #f7f7ff",
47 "N c #ffce39",
48 "O c #ffde42",
49 "P c #ffef4a",
50 "Q c #fff74a",
51 "R c #ffff52",
52 "S c #ffff5a",
53 "T c #ffff6b",
54 "U c #ffffff",
55 /* pixels */
56 "FFFFFaFFFFFFFFFFFFF",
57 "FFFF.UaFFFFFFFFFFFF",
58 "FFF.UMMaccccFFFFFFF",
59 "FF.MMMJMaONOlFFFFFF",
60 "F.MMHJGJHasuddddddd",
61 "...JGGGG.#aPQRQRQQe",
62 "FFF.JGz.NOOTPPPPPBg",
63 "FFF.Jzw.SSRRSPPOOxh",
64 "FFF.Gtr.RSRSQPOONxh",
65 "FFF.Gtp.bSbbbbNNAvg",
66 "FFF.JroobSbtrbNKIqh",
67 "FFF.GommbSbrmbLAvqh",
68 "FFFkbbbbbPbbbbAxvqh",
69 "FFFFgEDCCCyxxvsqqnh",
70 "FFFFgjijiijjjjijjif",
71 "FFFFFFFFFFFFFFFFFFF"
72 };
File src/init_filetype_dialog.c added (mode: 100644) (index 0000000..99f8942)
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 "vide.h"
22
23 static GtkWidget *init_filetype_dialog;
24 static GtkWidget *extensions_entry;
25 static GtkWidget *program_entry;
26 static GtkWidget *description_entry;
27
28 static void
29 init_filetype_ok_cb (GtkWidget * widget, GtkWidget * clist)
30 {
31 gchar *program = gtk_entry_get_text (GTK_ENTRY (program_entry));
32 gchar *description = gtk_entry_get_text (GTK_ENTRY (description_entry));
33 gchar *extensions = gtk_entry_get_text (GTK_ENTRY (extensions_entry));
34
35 if (STREQ (extensions, ""))
36 {
37 return;
38 }
39 if (STREQ (program, ""))
40 {
41 return;
42 }
43 if (STREQ (description, "")) /* if no desc is given use the extensions */
44 description = extensions;
45
46 add_filetype (extensions, program, description);
47 write_filetypes_file ();
48
49 if (clist != NULL)
50 {
51 gchar *buf[2];
52 GList *tmp;
53 gtk_clist_clear (GTK_CLIST (clist));
54 for (tmp = cfg.filetypes; tmp != NULL; tmp = tmp->next)
55 {
56 FileType *ft = tmp->data;
57 int i;
58
59 buf[0] = ft->extensions;
60 buf[1] = ft->description;
61 i = gtk_clist_append (GTK_CLIST (clist), buf);
62 gtk_clist_set_row_data (GTK_CLIST (clist), i, ft);
63 }
64 gtk_grab_remove (init_filetype_dialog);
65 gtk_widget_destroy (init_filetype_dialog);
66 return;
67 }
68
69 exec_action (program);
70 gtk_grab_remove (init_filetype_dialog);
71 gtk_widget_destroy (init_filetype_dialog);
72 }
73
74 static void
75 add_ext_to_filetype_cb (GtkWidget * widget)
76 {
77 gchar *ext = gtk_entry_get_text (GTK_ENTRY (extensions_entry));
78
79 if (STREQ (ext, ""))
80 {
81 return;
82 }
83
84 create_add_ext_dialog (ext);
85 gtk_grab_remove (init_filetype_dialog);
86 gtk_widget_destroy (init_filetype_dialog);
87 }
88
89 static void
90 cancel_cb (GtkWidget * widget, GtkWidget * dialog)
91 {
92 gtk_grab_remove (dialog);
93 gtk_widget_destroy (dialog);
94 }
95
96 static void
97 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
98 {
99 if (event->keyval == GDK_Escape)
100 cancel_cb (NULL, widget);
101 }
102
103 void
104 create_init_filetype_dialog (gchar * ext, GtkWidget * clist)
105 {
106 GtkWidget *dialog_vbox;
107 GtkWidget *action_area;
108 GtkWidget *table;
109
110 init_filetype_dialog = gtk_dialog_new ();
111 dialog_vbox = GTK_DIALOG (init_filetype_dialog)->vbox;
112 action_area = GTK_DIALOG (init_filetype_dialog)->action_area;
113 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
114 gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
115 gtk_signal_connect (GTK_OBJECT (init_filetype_dialog), "key_press_event",
116 GTK_SIGNAL_FUNC (key_press_cb), NULL);
117
118 add_label (dialog_vbox, "Please enter information for this filetype:",
119 0.5, FALSE, 2);
120
121 table = add_table (dialog_vbox, 5, 2, FALSE, FALSE, 5);
122 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
123 add_label_to_table (table, "Description: ", 0.9, 0, 1, 0, 1);
124 description_entry = add_entry_to_table (table, "", 1, 2, 0, 1);
125 gtk_widget_grab_focus (description_entry);
126
127 add_label_to_table (table, "Extension(s): ", 0.9, 0, 1, 1, 2);
128 extensions_entry = add_entry_to_table (table, ext, 1, 2, 1, 2);
129
130 add_label_to_table (table, "Format: (mpg,mpeg,mpe)", 1, 1, 2, 2, 3);
131
132 add_label_to_table (table, "Program to open with: ", 0.8, 0, 1, 4, 5);
133 program_entry = add_entry_to_table (table, "", 1, 2, 4, 5);
134
135 table = add_table (action_area, 2, 2, TRUE, TRUE, 5);
136 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
137 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
138
139 add_button_to_table (table, "Add this extension to an existing filetype",
140 add_ext_to_filetype_cb, NULL, 0, 2, 0, 1);
141 add_button_to_table (table, "Ok", init_filetype_ok_cb, clist, 0, 1, 1, 2);
142 add_button_to_table (table, "Cancel", cancel_cb, init_filetype_dialog,
143 1, 2, 1, 2);
144
145 gtk_window_set_position (GTK_WINDOW (init_filetype_dialog),
146 GTK_WIN_POS_MOUSE);
147 gtk_widget_show (init_filetype_dialog);
148 gtk_grab_add (init_filetype_dialog);
149 gtk_window_set_transient_for (GTK_WINDOW (init_filetype_dialog),
150 GTK_WINDOW (app.main_window));
151 }
File src/main_menu.c added (mode: 100644) (index 0000000..c9cb8e8)
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 <unistd.h>
24 #include "vide.h"
25
26 static void
27 help_cb(GtkWidget *widget, gpointer data)
28 {
29 gchar help_command[NAME_MAX];
30 g_snprintf(help_command, sizeof(help_command), "%s %s/vide%s.txt",
31 cfg.vi_command, cfg.config_dir, VERSION);
32 create_zterm(help_command, TRUE);
33
34 }
35 void
36 show_hidden_cb (void)
37 {
38 gint last_selected_row;
39
40 last_selected_row = curr_view->row;
41 if (cfg.show_hidden)
42 cfg.show_hidden = FALSE;
43 else
44 cfg.show_hidden = TRUE;
45
46 gtk_clist_freeze(GTK_CLIST(curr_view->clist));
47 gtk_clist_freeze(GTK_CLIST(other_view->clist));
48
49 load_dir_list(other_view);
50 load_dir_list(curr_view);
51
52 focus_on_row (curr_view,
53 (last_selected_row < GTK_CLIST (curr_view->clist)->rows
54 ? last_selected_row
55 : GTK_CLIST (curr_view->clist)->rows - 1));
56 gtk_clist_thaw(GTK_CLIST(other_view->clist));
57 gtk_clist_thaw(GTK_CLIST(curr_view->clist));
58 }
59
60 static void
61 goto_bookmark (GtkWidget * menu_item, gchar *value)
62 {
63 GList *tmp;
64 gint i;
65 gchar *file;
66
67 for(tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next)
68 {
69 Bookmarks *bk = tmp->data;
70 if(!strcmp(value, bk->mark))
71 {
72 change_dir(curr_view, bk->dir);
73 gtk_clist_freeze(GTK_CLIST(curr_view->clist));
74 for(i = 0; i < GTK_CLIST(curr_view->clist)->rows; i++)
75 {
76 gtk_clist_get_text(GTK_CLIST(curr_view->clist), i, 0, &file);
77
78 if(!strcmp(bk->file, file))
79 {
80 focus_on_row(curr_view, i);
81 gtk_clist_thaw(GTK_CLIST(curr_view->clist));
82 return;
83 }
84 }
85 focus_on_row(curr_view, 0);
86 gtk_clist_thaw(GTK_CLIST(curr_view->clist));
87 return;
88 }
89 }
90 status_bar_message("Mark not found");
91 return;
92 }
93
94 /*
95 * Keypress Menu Callbacks
96 */
97 void
98 bookmark_key_cb (GtkWidget * widget, GdkEventKey * event, FileView * view)
99 {
100 if ((event->keyval == 'c') && (event->state & GDK_CONTROL_MASK))
101 {
102 gtk_signal_emit_by_name(GTK_OBJECT(app.vide_menu_item), "activate-item");
103 return;
104 }
105
106 if ((event->keyval < 0x100)
107 && (event->state == 0 || event->state & GDK_SHIFT_MASK
108 || event->state & GDK_MOD2_MASK))
109 {
110 switch (event->keyval)
111 {
112
113 case 'j':
114 event->keyval = GDK_Down;
115 break;
116 case 'k':
117 event->keyval = GDK_Up;
118 break;
119
120 case 'h':
121 event->keyval = GDK_Left;
122 break;
123 case 'l':
124 event->keyval = GDK_Right;
125 break;
126
127 default:
128 event->keyval = 0;
129 break;
130 }
131 }
132 return;
133 }
134
135
136 void
137 root_cb (void)
138 {
139 /* Should make this user definable for different systems */
140 gchar root_command[NAME_MAX];
141 g_snprintf(root_command, sizeof(root_command), "%s -e su root -c vide",
142 cfg.xterm_command);
143 file_exec(root_command);
144
145
146 }
147
148 void
149 open_trash_cb (void)
150 {
151 change_dir (curr_view, cfg.trash);
152
153 }
154
155 void
156 empty_trash_cb (void)
157 {
158 gchar tmp_dir[PATH_MAX];
159 g_snprintf(tmp_dir, sizeof(tmp_dir), curr_view->dir);
160
161 if (!chdir (cfg.trash))
162 {
163 /*fix . .. */
164 file_exec ("rm -f -r * *. .*");
165 }
166 chdir(tmp_dir);
167 }
168
169 static void
170 size_filter_cb(void)
171 {
172 create_size_filter_dialog(curr_view);
173 }
174
175 static void
176 filename_cb(void)
177 {
178 create_filename_filter_dialog(curr_view);
179 }
180
181 static void
182 date_filter_cb(void)
183 {
184 create_date_filter_dialog(curr_view);
185 }
186
187 static void
188 remove_filters_cb(void)
189 {
190 remove_filters(curr_view);
191 }
192
193
194
195 static void
196 edit_bookmarks_cb(GtkWidget *widget)
197 {
198 create_config_dialog(2);
199 }
200
201 gint
202 sort_bookmarks(gconstpointer a, gconstpointer b)
203 {
204 return strcmp(a, b);
205 }
206
207 void
208 load_bookmarks ()
209 {
210 GList *tmp;
211 GtkWidget *menu_item;
212
213
214 /* sort marks so that they are listed alphabetically */
215 cfg.bookmarks = g_list_sort(cfg.bookmarks, sort_bookmarks);
216
217 for (tmp = cfg.bookmarks; tmp != NULL; tmp = tmp->next)
218 {
219 gchar bookmark[((2 * PATH_MAX)+5)];
220 Bookmarks *bk = tmp->data;
221 if(!strcmp(bk->file, "../"))
222 {
223 g_snprintf(bookmark, sizeof(bookmark), "%s %s", bk->mark,
224 bk->dir);
225 }
226 else
227 {
228 g_snprintf(bookmark, sizeof(bookmark), "%s %s/%s", bk->mark,
229 bk->dir, bk->file);
230 }
231
232 menu_item = gtk_menu_item_new_with_label (bookmark);
233 gtk_widget_set_name (GTK_WIDGET (menu_item), bookmark);
234 gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
235 GTK_SIGNAL_FUNC (goto_bookmark), bk->mark);
236 gtk_signal_connect (GTK_OBJECT (menu_item), "key_press_event",
237 GTK_SIGNAL_FUNC (bookmark_key_cb), NULL);
238 gtk_menu_append (GTK_MENU (app.bookmark_menu), menu_item);
239 gtk_widget_show (menu_item);
240
241 }
242 add_menu_separator(app.bookmark_menu);
243 add_menu_item(app.bookmark_menu, "Cancel ", NULL, NULL);
244
245 }
246
247
248 GtkWidget *
249 create_main_menu_bar (void)
250 {
251
252 GtkWidget *main_menu_bar;
253 GtkWidget *menu;
254 GtkWidget *filter_menu;
255 GtkWidget *menu_item;
256
257 main_menu_bar = gtk_menu_bar_new ();
258
259 menu = gtk_menu_new();
260 gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
261 GTK_SIGNAL_FUNC(bookmark_key_cb), NULL);
262
263 add_menu_item(menu, "Cancel ", NULL, NULL);
264 add_menu_separator (menu);
265 add_menu_item (menu, "Become Root", root_cb, NULL);
266 add_menu_separator (menu);
267 add_menu_item (menu, "Open Trash", open_trash_cb, NULL);
268 add_menu_item (menu, "Empty Trash", empty_trash_cb, NULL);
269 add_menu_separator (menu);
270 add_menu_item (menu, "Quit Alt Q", quit_cb, NULL);
271 app.vide_menu_item = add_submenu (main_menu_bar, "_Vide", menu);
272
273 app.bookmark_menu = gtk_menu_new ();
274 gtk_signal_connect (GTK_OBJECT (app.bookmark_menu), "key_press_event",
275 GTK_SIGNAL_FUNC (bookmark_key_cb), NULL);
276 add_menu_item (app.bookmark_menu, "Edit Bookmarks", edit_bookmarks_cb,
277 NULL);
278 add_menu_separator (app.bookmark_menu);
279 app.bookmark_menu_item =
280 add_submenu (main_menu_bar, "_Bookmarks", app.bookmark_menu);
281
282
283 menu = gtk_menu_new ();
284 gtk_signal_connect (GTK_OBJECT (menu), "key_press_event",
285 GTK_SIGNAL_FUNC (bookmark_key_cb), NULL);
286 add_menu_item(menu, "Show Dot Files", show_hidden_cb, NULL);
287 add_menu_separator (menu);
288
289 filter_menu = gtk_menu_new();
290 gtk_signal_connect(GTK_OBJECT(filter_menu), "key_press_event",
291 GTK_SIGNAL_FUNC(bookmark_key_cb), NULL);
292 add_menu_item(filter_menu, "File Name Filter", filename_cb,
293 NULL);
294 add_menu_separator(filter_menu);
295 add_menu_item(filter_menu, "Date Filter", date_filter_cb, NULL);
296 add_menu_separator(filter_menu);
297 add_menu_item(filter_menu, "Size Filter", size_filter_cb, NULL);
298 menu_item = add_menu_item(menu, "Set Filters", NULL, NULL);
299 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), filter_menu);
300
301 add_menu_separator(menu);
302 add_menu_item(menu, "Remove Filters", remove_filters_cb, NULL);
303 add_menu_separator(menu);
304 add_menu_item (menu, "Configure", create_config_dialog, NULL);
305 add_menu_separator(menu);
306 add_menu_item(menu, "Cancel ", NULL, NULL);
307 app.options_menu_item = add_submenu (main_menu_bar, "_Options", menu);
308
309 /*
310 menu = gtk_menu_new();
311 gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
312 GTK_SIGNAL_FUNC(bookmark_key_cb), NULL);
313 add_menu_item(menu, "Open Project", NULL, NULL);
314 add_menu_item(menu, "New Project", NULL, NULL);
315 add_menu_item(menu, "Import Project", NULL, NULL);
316 add_menu_separator(menu);
317 add_menu_item(menu, "Close Project", NULL, NULL);
318 app.tools_menu_item = add_submenu(main_menu_bar, "_Tools", menu);
319 */
320
321
322 menu = gtk_menu_new ();
323 gtk_signal_connect (GTK_OBJECT (menu), "key_press_event",
324 GTK_SIGNAL_FUNC (bookmark_key_cb), NULL);
325 add_menu_item(menu, "Using Vide :h", help_cb, NULL);
326 add_menu_separator(menu);
327 add_menu_item(menu, "Cancel ", NULL, NULL);
328 app.help_menu_item = add_submenu (main_menu_bar, "_Help", menu);
329 gtk_menu_item_right_justify (GTK_MENU_ITEM (app.help_menu_item));
330
331
332 return main_menu_bar;
333
334
335
336 }
File src/misc_dialogs.c added (mode: 100644) (index 0000000..c7f6a26)
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 <string.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <unistd.h>
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include "vide.h"
27
28 void
29 create_copy_as_dialog ()
30 {
31 gchar label[NAME_MAX + 32];
32 gchar dest[PATH_MAX + NAME_MAX];
33 gchar src[PATH_MAX + NAME_MAX];
34 gchar *new_name;
35 FileInfo *info;
36 GList *tmp, *base;
37 //guint overwrite_button;
38 //gboolean check = cfg.confirm_overwrite;
39 //gboolean cancel = FALSE;
40
41 base = tmp = get_selection (curr_view);
42 g_return_if_fail (tmp != NULL);
43
44 for (; tmp != NULL; tmp = tmp->next)
45 {
46 info = tmp->data;
47 strncpy (src, info->filename, sizeof (src));
48 if (src[strlen (src) - 1] == '/')
49 src[strlen (src) - 1] = '\0';
50
51 g_snprintf (label, sizeof (label), "Enter new filename for: %s", src);
52 create_user_prompt (label, src, &new_name);
53 gtk_main ();
54
55 if (new_name != NULL)
56 {
57 g_snprintf (dest, sizeof (dest), "%s/%s", other_view->dir,
58 new_name);
59 g_snprintf (src, sizeof (src), "%s/%s", curr_view->dir,
60 info->filename);
61 file_copy (src, dest);
62 g_free (new_name);
63 }
64 }
65
66 g_list_free (base);
67 untag_all (curr_view);
68 refresh_list (other_view);
69 refresh_list (other_view);
70 }
71
72 void
73 create_symlink_as_dialog ()
74 {
75 gchar label[NAME_MAX + 32];
76 gchar *new_name;
77 gchar dest[PATH_MAX + NAME_MAX];
78 gchar src[PATH_MAX + NAME_MAX];
79 FileInfo *info;
80 GList *tmp, *base;
81
82 base = tmp = get_selection (curr_view);
83 g_return_if_fail (tmp != NULL);
84
85 for (; tmp != NULL; tmp = tmp->next)
86 {
87 info = tmp->data;
88 strncpy (src, info->filename, sizeof (src));
89 if (src[strlen (src) - 1] == '/')
90 src[strlen (src) - 1] = '\0';
91
92 g_snprintf (label, sizeof (label), "Enter new filename for: %s", src);
93 create_user_prompt (label, src, &new_name);
94 gtk_main ();
95
96 if (new_name != NULL)
97 {
98 g_snprintf (dest, sizeof (dest), "%s/%s", other_view->dir,
99 new_name);
100 g_snprintf (src, sizeof (src), "%s/%s", curr_view->dir,
101 info->filename);
102 if (file_symlink (src, dest) == -1)
103 status_errno ();
104 g_free (new_name);
105 }
106 }
107
108 g_list_free (base);
109 untag_all (curr_view);
110 refresh_list (other_view);
111 refresh_list (other_view);
112 }
113
114 void
115 create_rename_dialog ()
116 {
117 FileInfo *info;
118 gchar src[PATH_MAX + NAME_MAX];
119 gchar dest[PATH_MAX + NAME_MAX];
120 gchar *new_name;
121 GList *tmp, *base;
122 //guint overwrite_button;
123 //gboolean check = cfg.confirm_overwrite;
124 //gboolean cancel = FALSE;
125
126 base = tmp = get_selection (curr_view);
127 g_return_if_fail (tmp != NULL);
128
129 for (; tmp != NULL; tmp = tmp->next)
130 {
131 info = tmp->data;
132 strncpy (src, info->filename, sizeof (src));
133 if (src[strlen (src) - 1] == '/')
134 src[strlen (src) - 1] = '\0';
135
136 create_user_prompt ("Enter new file name:", src, &new_name);
137 gtk_main ();
138
139 if (new_name != NULL)
140 {
141 g_snprintf (dest, sizeof (dest), "%s/%s", curr_view->dir, new_name);
142 g_snprintf (src, sizeof (src), "%s/%s", curr_view->dir,
143 info->filename);
144 file_move (src, dest);
145 g_free (new_name);
146 }
147 }
148
149 g_list_free (base);
150 untag_all (curr_view);
151 refresh_list (curr_view);
152 }
153
154 void
155 create_mkdir_dialog ()
156 {
157 gchar *new_dir;
158 gchar path[PATH_MAX];
159
160 create_user_prompt ("Enter name for new directory:", "", &new_dir);
161 gtk_main ();
162
163 if (new_dir != NULL)
164 {
165 g_snprintf (path, sizeof (path), "%s/%s", curr_view->dir, new_dir);
166 if (file_mkdir (path) != 0)
167 status_errno ();
168 g_free (new_dir);
169 }
170
171 refresh_list (curr_view);
172 }
173
174 void
175 create_open_with_dialog ()
176 {
177 gchar *command;
178
179 create_user_prompt ("Enter command:", "", &command);
180 gtk_main ();
181
182 if (command != NULL)
183 {
184 GString *command_line = g_string_new (command);
185 GList *base, *tmp;
186 base = tmp = get_selection (curr_view);
187 for (; tmp != NULL; tmp = tmp->next)
188 {
189 FileInfo *info = tmp->data;
190 g_string_sprintfa (command_line, " \"%s\"", info->filename);
191 }
192
193 if (strncmp (command_line->str, "x ", 2) == 0)
194 create_zterm(command_line->str + 2, TRUE);
195 else
196 file_exec (command_line->str);
197 g_string_free (command_line, TRUE);
198 g_free (command);
199 }
200 }
201
202 void
203 create_confirm_del_dialog (gchar * filename, guint * answer)
204 {
205 gchar label_text[MAX_LEN];
206
207 g_snprintf (label_text, sizeof (label_text),
208 "Are you sure you want to delete: %s", filename);
209 create_confirm_dialog (label_text, answer);
210 }
211
212 void
213 create_confirm_overwrite_dialog (gchar * filename, guint * answer)
214 {
215 gchar label_text[MAX_LEN];
216
217 g_snprintf (label_text, sizeof (label_text),
218 "%s already exists! Overwrite this file?", filename);
219 create_confirm_dialog (label_text, answer);
220 }
221
222 void
223 create_command_dialog ()
224 {
225 gchar *command;
226
227 create_user_prompt ("Enter Command:", "", &command);
228 gtk_main ();
229
230 if (command != NULL)
231 {
232 if (strncmp (command, "x ", 2) == 0)
233 create_zterm (command + 2, TRUE);
234 else
235 file_exec (command);
236 g_free (command);
237 }
238 }
File src/ownership_dialog.c added (mode: 100644) (index 0000000..a1b1485)
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 <string.h>
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <pwd.h>
24 #include <grp.h>
25 #include "vide.h"
26
27 static GtkWidget *ownership_dialog;
28 static GtkWidget *user_combo;
29 static GtkWidget *group_combo;
30 static GtkWidget *recurse_dirs_button;
31
32 static uid_t
33 get_user_id ()
34 {
35 gchar *user;
36 struct passwd *pw_buf;
37 uid_t user_id;
38
39 user = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (user_combo)->entry));
40 if ((pw_buf = getpwnam (user)) != NULL)
41 user_id = pw_buf->pw_uid;
42 else
43 user_id = (uid_t) atoi (user);
44
45 return user_id;
46 }
47
48 static gid_t
49 get_group_id ()
50 {
51 gchar *group;
52 struct group *grp_buf;
53 gid_t group_id;
54
55 group = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (group_combo)->entry));
56 if ((grp_buf = getgrnam (group)) != NULL)
57 group_id = grp_buf->gr_gid;
58 else
59 group_id = (gid_t) atoi (group);
60
61 return group_id;
62 }
63
64 static void
65 ok_cb (GtkWidget * widget)
66 {
67 FileInfo *info;
68 gchar path[PATH_MAX + NAME_MAX];
69
70 info = curr_view->iter->data;
71 g_snprintf (path, sizeof (path), "%s/%s", curr_view->dir, info->filename);
72 file_chown (path, get_user_id (), get_group_id (),
73 GTK_TOGGLE_BUTTON (recurse_dirs_button)->active);
74
75 gtk_grab_remove (ownership_dialog);
76 gtk_widget_destroy (ownership_dialog);
77
78 curr_view->iter = curr_view->iter->next;
79 if (curr_view->iter != NULL)
80 {
81 info = curr_view->iter->data;
82 create_ownership_dialog (info);
83 }
84 else
85 {
86 g_list_free (curr_view->iter_base);
87 refresh_list (curr_view);
88 gtk_clist_select_row (GTK_CLIST (curr_view->clist), curr_view->row, 0);
89 gtk_widget_grab_focus (curr_view->clist);
90 }
91 }
92
93 static void
94 apply_to_all_cb (GtkWidget * widget)
95 {
96 FileInfo *info;
97 gchar path[PATH_MAX + NAME_MAX];
98
99 for (; curr_view->iter != NULL; curr_view->iter = curr_view->iter->next)
100 {
101 info = curr_view->iter->data;
102 g_snprintf (path, sizeof (path), "%s/%s", curr_view->dir,
103 info->filename);
104
105 file_chown (path, get_user_id (), get_group_id (),
106 GTK_TOGGLE_BUTTON (recurse_dirs_button)->active);
107 }
108
109 g_list_free (curr_view->iter_base);
110 gtk_grab_remove (ownership_dialog);
111 gtk_widget_destroy (ownership_dialog);
112 refresh_list (curr_view);
113 gtk_clist_select_row (GTK_CLIST (curr_view->clist), curr_view->row, 0);
114 gtk_widget_grab_focus (curr_view->clist);
115 }
116
117 static void
118 cancel_cb (GtkWidget * widget, GtkWidget * dialog)
119 {
120 gtk_grab_remove (dialog);
121 gtk_widget_destroy (dialog);
122 }
123
124 static void
125 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
126 {
127 if (event->keyval == GDK_Escape)
128 cancel_cb (NULL, widget);
129 }
130
131 void
132 create_ownership_dialog (FileInfo * info)
133 {
134 GtkWidget *dialog_vbox;
135 GtkWidget *action_area;
136 GtkWidget *table;
137 gchar label_text[NAME_MAX + 20];
138 gchar perm_string[11];
139
140 ownership_dialog = gtk_dialog_new ();
141 dialog_vbox = GTK_DIALOG (ownership_dialog)->vbox;
142 action_area = GTK_DIALOG (ownership_dialog)->action_area;
143 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
144 gtk_signal_connect (GTK_OBJECT (ownership_dialog), "key_press_event",
145 GTK_SIGNAL_FUNC (key_press_cb), NULL);
146
147 g_snprintf (label_text, sizeof (label_text),
148 "Filename: %s", info->filename);
149 add_label (dialog_vbox, label_text, 0, TRUE, 5);
150
151 get_perm_string (perm_string, sizeof (perm_string), info->statbuf.st_mode);
152 g_snprintf (label_text, sizeof (label_text), "Permissions: %s",
153 perm_string);
154 add_label (dialog_vbox, label_text, 0, TRUE, 0);
155
156 table = add_table (dialog_vbox, 2, 2, FALSE, TRUE, 0);
157 gtk_container_set_border_width (GTK_CONTAINER (table), 5);
158 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
159 add_label_to_table (table, "User: ", 0, 0, 1, 0, 1);
160
161 user_combo = gtk_combo_new ();
162 gtk_table_attach_defaults (GTK_TABLE (table), user_combo, 1, 2, 0, 1);
163 gtk_widget_show (user_combo);
164
165 add_label_to_table (table, "Group: ", 0, 0, 1, 1, 2);
166
167 group_combo = gtk_combo_new ();
168 gtk_table_attach_defaults (GTK_TABLE (table), group_combo, 1, 2, 1, 2);
169 gtk_widget_show (group_combo);
170
171 {
172 GList *users = NULL;
173 GList *groups = NULL;
174 struct passwd *pw_buf;
175 struct group *grp_buf;
176
177 if (getuid () == 0)
178 {
179 while ((pw_buf = getpwent ()) != NULL)
180 users = g_list_append (users, strdup (pw_buf->pw_name));
181 }
182 else
183 {
184 pw_buf = getpwuid (getuid ());
185 users = g_list_append (users, strdup (pw_buf->pw_name));
186 }
187
188 if (getuid () == 0)
189 {
190 while ((grp_buf = getgrent ()) != NULL)
191 groups = g_list_append (groups, strdup (grp_buf->gr_name));
192 }
193 else
194 {
195 gid_t grp_ids[32];
196 gint i, n;
197 n = getgroups (32, grp_ids);
198 for (i = 0; i < n; i++)
199 {
200 grp_buf = getgrgid (grp_ids[i]);
201 groups = g_list_append (groups, strdup (grp_buf->gr_name));
202 }
203 }
204
205 gtk_combo_set_popdown_strings (GTK_COMBO (user_combo), users);
206 gtk_combo_set_popdown_strings (GTK_COMBO (group_combo), groups);
207 if ((pw_buf = getpwuid (info->statbuf.st_uid)) != NULL)
208 {
209 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (user_combo)->entry),
210 pw_buf->pw_name);
211 }
212 else
213 {
214 gchar uid_buf[20];
215 g_snprintf (uid_buf, sizeof (uid_buf), "%d",
216 (int) info->statbuf.st_uid);
217 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (user_combo)->entry),
218 uid_buf);
219 }
220
221 if ((grp_buf = getgrgid (info->statbuf.st_gid)) != NULL)
222 {
223 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (group_combo)->entry),
224 grp_buf->gr_name);
225 }
226 else
227 {
228 gchar gid_buf[20];
229 g_snprintf (gid_buf, sizeof (gid_buf), "%d",
230 (int) info->statbuf.st_gid);
231 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (group_combo)->entry),
232 gid_buf);
233 }
234
235 g_list_free (users);
236 g_list_free (groups);
237 setpwent ();
238 setgrent ();
239 }
240
241 recurse_dirs_button = add_check_button (dialog_vbox, "Recurse Directories",
242 FALSE, FALSE, 5, NULL, NULL);
243
244 add_button (action_area, "Ok", TRUE, 0, ok_cb, NULL);
245 if (g_list_length (curr_view->iter) > 1)
246 add_button (action_area, "Apply To All", TRUE, 0, apply_to_all_cb, NULL);
247 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, ownership_dialog);
248
249 gtk_window_set_position (GTK_WINDOW (ownership_dialog), GTK_WIN_POS_CENTER);
250 gtk_widget_show (ownership_dialog);
251 gtk_grab_add (ownership_dialog);
252 gtk_window_set_transient_for (GTK_WINDOW (ownership_dialog),
253 GTK_WINDOW (app.main_window));
254 }
File src/pauseme added (mode: 100755) (index 0000000..a62a7f7)
1 #!/bin/sh
2
3 PROG=$1
4 shift
5 $PROG "$@"
6
7 echo "Press return ..."
8 read dummy
File src/permissions_dialog.c added (mode: 100644) (index 0000000..3e9bd05)
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 <unistd.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <pwd.h>
26 #include <grp.h>
27 #include <string.h>
28 #include "vide.h"
29
30 static GtkWidget *permissions_dialog;
31 static mode_t mask[12] =
32 { S_ISUID, S_ISGID, S_ISVTX, S_IRUSR, S_IWUSR, S_IXUSR,
33 S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
34 };
35 static gchar *add_strings[12] = { "u+s", "g+s", "o+t", "u+r", "u+w", "u+x",
36 "g+r", "g+w", "g+x", "o+r", "o+w", "o+x"
37 };
38 static gchar *remove_strings[12] = { "u-s", "g-s", "o-t", "u-r", "u-w", "u-x",
39 "g-r", "g-w", "g-x", "o-r", "o-w", "o-x"
40 };
41
42 enum
43 { SETUID, SETGID, STICKY, USR_READ, USR_WRITE, USR_EXEC, GRP_READ,
44 GRP_WRITE, GRP_EXEC, OTH_READ, OTH_WRITE, OTH_EXEC
45 };
46 static GtkWidget *chmod_buttons[12];
47 static GtkWidget *set_perms_button;
48 static GtkWidget *add_perms_button;
49 static GtkWidget *remove_perms_button;
50 static GtkWidget *recurse_dirs_button;
51
52 static void
53 get_mode_string (gchar * mode_string, gint length)
54 {
55 int i;
56
57 if (GTK_TOGGLE_BUTTON (set_perms_button)->active)
58 {
59 mode_t mode = 0;
60 for (i = 0; i < 12; i++)
61 {
62 if (GTK_TOGGLE_BUTTON (chmod_buttons[i])->active)
63 mode |= mask[i];
64 }
65 g_snprintf (mode_string, length, "%o", (unsigned int) mode);
66 return;
67 }
68 else if (GTK_TOGGLE_BUTTON (add_perms_button)->active)
69 {
70 *mode_string = '\0';
71 for (i = 0; i < 12; i++)
72 {
73 if (GTK_TOGGLE_BUTTON (chmod_buttons[i])->active)
74 {
75 strncat (mode_string, add_strings[i], length);
76 strncat (mode_string, ",", length);
77 }
78 }
79 i = strlen (mode_string);
80 if (i > 0)
81 mode_string[i - 1] = '\0'; /* get rid of trailing comma */
82 return;
83 }
84 else if (GTK_TOGGLE_BUTTON (remove_perms_button)->active)
85 {
86 *mode_string = '\0';
87 for (i = 0; i < 12; i++)
88 {
89 if (GTK_TOGGLE_BUTTON (chmod_buttons[i])->active)
90 {
91 strncat (mode_string, remove_strings[i], length);
92 strncat (mode_string, ",", length);
93 }
94 }
95 i = strlen (mode_string);
96 if (i > 0)
97 mode_string[i - 1] = '\0';
98 return;
99 }
100 else
101 {
102 fprintf (stderr, "Something messed up. Exit quickly.\n");
103 }
104
105 return;
106 }
107
108 static void
109 ok_cb (GtkWidget * widget)
110 {
111 FileInfo *info;
112 gchar path[PATH_MAX + NAME_MAX];
113 gchar mode_string[50];
114
115 get_mode_string (mode_string, sizeof (mode_string));
116 info = curr_view->iter->data;
117 g_snprintf (path, sizeof (path), "%s/%s", curr_view->dir, info->filename);
118 file_chmod (path, mode_string,
119 GTK_TOGGLE_BUTTON (recurse_dirs_button)->active);
120
121 gtk_grab_remove (permissions_dialog);
122 gtk_widget_destroy (permissions_dialog);
123
124 curr_view->iter = curr_view->iter->next;
125 if (curr_view->iter != NULL)
126 {
127 info = curr_view->iter->data;
128 create_permissions_dialog (info);
129 }
130 else
131 {
132 g_list_free (curr_view->iter_base);
133 refresh_list (curr_view);
134 gtk_clist_select_row (GTK_CLIST (curr_view->clist), curr_view->row, 0);
135 gtk_widget_grab_focus (curr_view->clist);
136 }
137 }
138
139 static void
140 apply_to_all_cb (GtkWidget * widget)
141 {
142 FileInfo *info;
143 gchar path[PATH_MAX + NAME_MAX];
144 gchar mode_string[50];
145
146 get_mode_string (mode_string, sizeof (mode_string));
147
148 for (; curr_view->iter != NULL; curr_view->iter = curr_view->iter->next)
149 {
150 info = curr_view->iter->data;
151 g_snprintf (path, sizeof (path), "%s/%s", curr_view->dir,
152 info->filename);
153
154 file_chmod (path, mode_string,
155 GTK_TOGGLE_BUTTON (recurse_dirs_button)->active);
156 }
157
158 g_list_free (curr_view->iter_base);
159 gtk_grab_remove (permissions_dialog);
160 gtk_widget_destroy (permissions_dialog);
161 refresh_list (curr_view);
162 gtk_clist_select_row (GTK_CLIST (curr_view->clist), curr_view->row, 0);
163 gtk_widget_grab_focus (curr_view->clist);
164 }
165
166 static void
167 cancel_cb (GtkWidget * widget, GtkWidget * dialog)
168 {
169 gtk_grab_remove (dialog);
170 gtk_widget_destroy (dialog);
171 }
172
173 static void
174 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
175 {
176 if (event->keyval == GDK_Escape)
177 cancel_cb (NULL, widget);
178 }
179
180 static void
181 add_chmod_button (GtkWidget * box, gint i, gchar * label, gint state)
182 {
183 chmod_buttons[i] = gtk_toggle_button_new_with_label (label);
184 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chmod_buttons[i]), state);
185 gtk_box_pack_start (GTK_BOX (box), chmod_buttons[i], TRUE, TRUE, 5);
186 gtk_widget_show (chmod_buttons[i]);
187 }
188
189 static void
190 clear_chmod_buttons (GtkWidget * widget)
191 {
192 int i;
193
194 for (i = 0; i < 12; i++)
195 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chmod_buttons[i]),
196 FALSE);
197 }
198
199 static void
200 reset_chmod_buttons (GtkWidget * widget, FileInfo * info)
201 {
202 int i;
203
204 for (i = 0; i < 12; i++)
205 {
206 if (info->statbuf.st_mode & mask[i])
207 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chmod_buttons[i]),
208 TRUE);
209 else
210 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chmod_buttons[i]),
211 FALSE);
212 }
213 }
214
215
216 void
217 create_permissions_dialog (FileInfo * info)
218 {
219 GtkWidget *sub_vbox;
220 GtkWidget *hbox;
221 GtkWidget *frame;
222 GtkWidget *dialog_vbox;
223 GtkWidget *action_area;
224 GtkWidget *table;
225 gchar label_text[NAME_MAX + 20];
226 struct passwd *pw_buf;
227 struct group *grp_buf;
228
229 permissions_dialog = gtk_dialog_new ();
230 dialog_vbox = GTK_DIALOG (permissions_dialog)->vbox;
231 action_area = GTK_DIALOG (permissions_dialog)->action_area;
232 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
233 gtk_signal_connect (GTK_OBJECT (permissions_dialog), "key_press_event",
234 GTK_SIGNAL_FUNC (key_press_cb), NULL);
235
236 g_snprintf (label_text, sizeof (label_text),
237 "Filename: %s", info->filename);
238 add_label (dialog_vbox, label_text, 0, TRUE, 5);
239
240 table = add_table (dialog_vbox, 2, 1, TRUE, TRUE, 0);
241
242 if ((pw_buf = getpwuid (info->statbuf.st_uid)) != NULL)
243 {
244 g_snprintf (label_text, sizeof (label_text),
245 "User: %s", pw_buf->pw_name);
246 }
247 else
248 {
249 g_snprintf (label_text, sizeof (label_text),
250 "User: %d", (int) info->statbuf.st_uid);
251 }
252 add_label_to_table (table, label_text, 0, 0, 1, 0, 1);
253
254 if ((grp_buf = getgrgid (info->statbuf.st_gid)) != NULL)
255 {
256 g_snprintf (label_text, sizeof (label_text),
257 "Group: %s", grp_buf->gr_name);
258 }
259 else
260 {
261 g_snprintf (label_text, sizeof (label_text),
262 "Group: %d", (int) info->statbuf.st_gid);
263 }
264 add_label_to_table (table, label_text, 0, 0, 1, 1, 2);
265
266 frame = gtk_frame_new ("File Permissions");
267 gtk_box_pack_start (GTK_BOX (dialog_vbox), frame, TRUE, TRUE, 5);
268 gtk_widget_show (frame);
269
270 sub_vbox = gtk_vbox_new (FALSE, 0);
271 gtk_container_add (GTK_CONTAINER (frame), sub_vbox);
272 gtk_widget_show (sub_vbox);
273
274 hbox = add_hbox (sub_vbox, TRUE, 0, TRUE, 0);
275 add_label (hbox, "", 0.5, TRUE, 0);
276 add_label (hbox, "Read", 0.5, TRUE, 0);
277 add_label (hbox, "Write", 0.5, TRUE, 0);
278 add_label (hbox, "Exec", 0.5, TRUE, 0);
279 add_label (hbox, "Special", 0.5, TRUE, 0);
280
281 hbox = add_hbox (sub_vbox, TRUE, 0, TRUE, 5);
282 add_label (hbox, "User", 0.5, TRUE, 0);
283 add_chmod_button (hbox, USR_READ, "", info->statbuf.st_mode & S_IRUSR);
284 add_chmod_button (hbox, USR_WRITE, "", info->statbuf.st_mode & S_IWUSR);
285 add_chmod_button (hbox, USR_EXEC, "", info->statbuf.st_mode & S_IXUSR);
286 add_chmod_button (hbox, SETUID, "Set UID", info->statbuf.st_mode & S_ISUID);
287
288 hbox = add_hbox (sub_vbox, TRUE, 0, TRUE, 5);
289 add_label (hbox, "Group", 0.5, TRUE, 0);
290 add_chmod_button (hbox, GRP_READ, "", info->statbuf.st_mode & S_IRGRP);
291 add_chmod_button (hbox, GRP_WRITE, "", info->statbuf.st_mode & S_IWGRP);
292 add_chmod_button (hbox, GRP_EXEC, "", info->statbuf.st_mode & S_IXGRP);
293 add_chmod_button (hbox, SETGID, "Set GID", info->statbuf.st_mode & S_ISGID);
294
295 hbox = add_hbox (sub_vbox, TRUE, 0, TRUE, 5);
296 add_label (hbox, "Other", 0.5, TRUE, 0);
297 add_chmod_button (hbox, OTH_READ, "", info->statbuf.st_mode & S_IROTH);
298 add_chmod_button (hbox, OTH_WRITE, "", info->statbuf.st_mode & S_IWOTH);
299 add_chmod_button (hbox, OTH_EXEC, "", info->statbuf.st_mode & S_IXOTH);
300 add_chmod_button (hbox, STICKY, "Sticky", info->statbuf.st_mode & S_ISVTX);
301
302 frame = gtk_frame_new ("Action:");
303 gtk_box_pack_start (GTK_BOX (dialog_vbox), frame, TRUE, TRUE, 5);
304 gtk_widget_show (frame);
305
306 sub_vbox = gtk_vbox_new (FALSE, 0);
307 gtk_container_add (GTK_CONTAINER (frame), sub_vbox);
308 gtk_widget_show (sub_vbox);
309
310 hbox = add_hbox (sub_vbox, TRUE, 0, TRUE, 0);
311 set_perms_button = add_radio_button (hbox, "Set", NULL, TRUE, 5,
312 reset_chmod_buttons, info);
313 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (set_perms_button), TRUE);
314 add_perms_button = add_radio_button (hbox, "Add",
315 gtk_radio_button_group
316 (GTK_RADIO_BUTTON (set_perms_button)),
317 TRUE, 5, clear_chmod_buttons, NULL);
318 remove_perms_button =
319 add_radio_button (hbox, "Remove",
320 gtk_radio_button_group (GTK_RADIO_BUTTON
321 (add_perms_button)), TRUE, 5,
322 clear_chmod_buttons, NULL);
323
324 recurse_dirs_button = add_check_button (dialog_vbox, "Recurse Directories",
325 FALSE, FALSE, 5, NULL, NULL);
326
327 add_button (action_area, "Ok", TRUE, 0, ok_cb, NULL);
328 if (g_list_length (curr_view->iter) > 1)
329 add_button (action_area, "Apply To All", TRUE, 0, apply_to_all_cb, NULL);
330 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, permissions_dialog);
331
332 gtk_window_set_position (GTK_WINDOW (permissions_dialog),
333 GTK_WIN_POS_CENTER);
334 gtk_widget_show (permissions_dialog);
335 gtk_grab_add (permissions_dialog);
336 gtk_window_set_transient_for (GTK_WINDOW (permissions_dialog),
337 GTK_WINDOW (app.main_window));
338 }
File src/programs_dialog.c added (mode: 100644) (index 0000000..504130a)
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 <string.h>
21 #include "vide.h"
22
23 static GtkWidget *dialog;
24 static GtkWidget *name_entry;
25 static GtkWidget *action_entry;
26
27 static void
28 ok_cb (GtkWidget * widget, Programs **program)
29 {
30 if (*program == NULL)
31 {
32 *program = g_malloc (sizeof (Programs));
33 cfg.programs = g_list_append (cfg.programs, *program);
34 }
35
36 strncpy ((*program)->name, gtk_entry_get_text (GTK_ENTRY (name_entry)),
37 sizeof ((*program)->name));
38 strncpy ((*program)->action, gtk_entry_get_text (GTK_ENTRY (action_entry)),
39 sizeof ((*program)->action));
40
41 gtk_grab_remove (dialog);
42 gtk_widget_destroy (dialog);
43 gtk_main_quit ();
44 }
45
46 static void
47 cancel_cb (GtkWidget * widget)
48 {
49 gtk_grab_remove (dialog);
50 gtk_widget_destroy (dialog);
51 gtk_main_quit ();
52 }
53
54 static void
55 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
56 {
57 if (event->keyval == GDK_Escape)
58 cancel_cb (NULL);
59 }
60
61 static void
62 delete_event_cb (GtkWidget * widget)
63 {
64 /* this is just here so the user can't close the dialog without clicking
65 * one of the buttons
66 */
67 }
68
69 void
70 create_programs_dialog (Programs ** program)
71 {
72 GtkWidget *dialog_vbox;
73 GtkWidget *action_area;
74 GtkWidget *table;
75 GtkWidget *wid;
76
77 dialog = gtk_dialog_new ();
78 dialog_vbox = GTK_DIALOG (dialog)->vbox;
79 action_area = GTK_DIALOG (dialog)->action_area;
80 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
81 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
82 gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", delete_event_cb,
83 NULL);
84 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
85 GTK_SIGNAL_FUNC (key_press_cb), NULL);
86
87 wid = add_label (dialog_vbox, "Macros:\n"
88 "%f = Selected Filename(s)\n"
89 "%d = Active Directory\n"
90 "%D = Inactive Directory\n"
91 "%{Prompt message} = Prompt user for input",
92 0.0, FALSE, 0);
93 gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT);
94
95 table = add_table (dialog_vbox, 2, 2, FALSE, FALSE, 0);
96 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
97
98 add_label_to_table (table, "Name: ", 0.0, 0, 1, 0, 1);
99 add_label_to_table (table, "Action: ", 0.0, 0, 1, 1, 2);
100 if (*program != NULL)
101 {
102 name_entry = add_entry_to_table (table, (*program)->name, 1, 2, 0, 1);
103 action_entry =
104 add_entry_to_table (table, (*program)->action, 1, 2, 1, 2);
105 }
106 else
107 {
108 name_entry = add_entry_to_table (table, "", 1, 2, 0, 1);
109 action_entry = add_entry_to_table (table, "", 1, 2, 1, 2);
110 }
111
112 gtk_signal_connect (GTK_OBJECT (name_entry), "activate",
113 GTK_SIGNAL_FUNC (ok_cb), program);
114
115 gtk_signal_connect (GTK_OBJECT (action_entry), "activate",
116 GTK_SIGNAL_FUNC (ok_cb), program);
117
118 gtk_widget_grab_focus (name_entry);
119
120 add_button (action_area, "Ok", TRUE, 0, ok_cb, program);
121 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL);
122
123 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
124 gtk_widget_show (dialog);
125 gtk_grab_add (dialog);
126 gtk_window_set_transient_for (GTK_WINDOW (dialog),
127 GTK_WINDOW (app.main_window));
128 }
File src/programs_menu.c added (mode: 100644) (index 0000000..f5ed658)
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 <string.h>
21 #include "vide.h"
22
23 void
24 add_program (gchar * name, gchar * action)
25 {
26 Programs program;
27
28 strncpy (program.name, name, sizeof (program.name));
29 strncpy (program.action, action, sizeof (program.action));
30 cfg.programs = g_list_append (cfg.programs,
31 duplicate (&program,
32 sizeof (Programs)));
33 }
34
35 static void
36 action_cb(GtkWidget *widget, gpointer data)
37 {
38 GString *expanded_com;
39
40 expanded_com = expand_macros(data);
41 if(expanded_com == NULL)
42 {
43 g_string_free(expanded_com, TRUE);
44 }
45 else
46 {
47 file_exec(expanded_com->str);
48 g_string_free(expanded_com, TRUE);
49 }
50 }
51
52 void
53 menu_key_cb(GtkWidget *widget, GdkEventKey *event)
54 {
55 if ((event->keyval < 0x100)
56 && (event->state == 0 || event->state & GDK_SHIFT_MASK
57 || event->state & GDK_MOD2_MASK))
58 {
59 switch (event->keyval)
60 {
61
62 case 'j':
63 event->keyval = GDK_Down;
64 break;
65 case 'k':
66 event->keyval = GDK_Up;
67 break;
68 default:
69 event->keyval = 0;
70 break;
71 }
72 }
73 if(event->keyval == GDK_Return)
74 {
75
76 }
77 return;
78 }
79
80
81 void
82 create_programs_menu(void)
83 {
84 GList *tmp;
85
86 app.programs_menu = gtk_menu_new();
87
88 for(tmp = cfg.programs; tmp != NULL; tmp = tmp->next)
89 {
90 Programs *program = tmp->data;
91
92 add_menu_item(app.programs_menu, program->name,
93 action_cb, program->action);
94 add_menu_separator(app.programs_menu);
95 }
96 add_menu_item(app.programs_menu, "Cancel", NULL, NULL);
97 gtk_signal_connect(GTK_OBJECT(app.programs_menu), "key_press_event",
98 GTK_SIGNAL_FUNC(menu_key_cb), NULL);
99
100 }
101
File src/rename_ext_dialog.c added (mode: 100644) (index 0000000..7890676)
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
21 #include <stdio.h>
22 #include <string.h>
23 #include "vide.h"
24
25 static GtkWidget *dialog;
26 static GtkWidget *from_entry;
27 static GtkWidget *to_entry;
28
29 static void
30 ok_cb (GtkWidget * widget)
31 {
32 gchar new_name[NAME_MAX];
33 gchar *from_sub = gtk_entry_get_text (GTK_ENTRY (from_entry));
34 gchar *to_sub = gtk_entry_get_text (GTK_ENTRY (to_entry));
35 gint i;
36
37 if (STREQ (from_sub, "") || STREQ (to_sub, ""))
38 return;
39
40 for (i = 0; i < GTK_CLIST (curr_view->clist)->rows; i++)
41 {
42 FileInfo *info =
43 gtk_clist_get_row_data (GTK_CLIST (curr_view->clist), i);
44 gchar *dup, *s;
45
46 dup = strdup (info->filename);
47 if ((s = strstr (dup, from_sub)) != NULL)
48 {
49 gchar *pre = dup;
50 *s = '\0';
51 s += strlen (from_sub);
52 g_snprintf (new_name, sizeof (new_name), "%s%s%s", pre, to_sub, s);
53
54 file_move (info->filename, new_name);
55 }
56 g_free (dup);
57 }
58
59 gtk_grab_remove (dialog);
60 gtk_widget_destroy (dialog);
61 refresh_list (curr_view);
62 }
63
64 static void
65 cancel_cb (GtkWidget * widget)
66 {
67 gtk_grab_remove (dialog);
68 gtk_widget_destroy (dialog);
69 }
70
71 static void
72 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
73 {
74 if (event->keyval == GDK_Escape)
75 cancel_cb (NULL);
76 }
77
78 void
79 create_rename_ext_dialog ()
80 {
81 GtkWidget *dialog_vbox;
82 GtkWidget *action_area;
83 GtkWidget *table;
84 GtkWidget *wid;
85
86 dialog = gtk_dialog_new ();
87 dialog_vbox = GTK_DIALOG (dialog)->vbox;
88 action_area = GTK_DIALOG (dialog)->action_area;
89 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
90 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
91 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
92 GTK_SIGNAL_FUNC (key_press_cb), NULL);
93
94 wid = add_label (dialog_vbox, "This allows you to replace substrings\n"
95 "in filenames with new strings.\n\n"
96 "Example: (From: .jpg To: .jpeg)", 0.0, FALSE, 0);
97 gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT);
98
99 table = add_table (dialog_vbox, 2, 2, FALSE, FALSE, 0);
100 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
101
102 add_label_to_table (table, "From: ", 0.0, 0, 1, 0, 1);
103 from_entry = add_entry_to_table (table, "", 1, 2, 0, 1);
104 gtk_widget_grab_focus (from_entry);
105 gtk_signal_connect (GTK_OBJECT (from_entry), "activate",
106 GTK_SIGNAL_FUNC (ok_cb), NULL);
107
108 add_label_to_table (table, "To: ", 0.0, 0, 1, 1, 2);
109 to_entry = add_entry_to_table (table, "", 1, 2, 1, 2);
110 gtk_signal_connect (GTK_OBJECT (to_entry), "activate",
111 GTK_SIGNAL_FUNC (ok_cb), NULL);
112
113 add_button (action_area, "Ok", TRUE, 0, ok_cb, NULL);
114 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL);
115
116 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
117 gtk_widget_show (dialog);
118 gtk_grab_add (dialog);
119 gtk_window_set_transient_for (GTK_WINDOW (dialog),
120 GTK_WINDOW (app.main_window));
121 }
File src/search_mode.c added (mode: 100644) (index 0000000..084ec4d)
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<sys/param.h>
20 #if(defined(BSD) && (BSD>=199103))
21 #include<sys/types.h> /* required for regex.h on FreeBSD 4.2 */
22 #endif
23 #include <fnmatch.h>
24 #include<stdio.h>
25 #include<string.h>
26 #include<regex.h>
27 #include<stdlib.h>
28 #include<ctype.h>
29 #include "vide.h"
30
31 Pattern pat;
32
33 int
34 search_for_pattern(FileView *view)
35 {
36 gchar *pattern, *s, *free_this = NULL;
37 GList *patterns = NULL;
38 regex_t re;
39 int i = 0;
40 int found = 0;
41
42 if((s = g_strdup(view->glob)) == NULL)
43 return found;
44
45 free_this = pattern = g_strdup(s);
46 while ((s = strchr(pattern, ',')) != NULL)
47 {
48 *s = '\0';
49 patterns = g_list_append(patterns, pattern);
50 pattern = s+1;
51 }
52 patterns = g_list_append(patterns, pattern);
53
54 gtk_clist_unselect_all(GTK_CLIST(view->clist));
55 /* search from the current row */
56
57
58 if((view->row +1) > (GTK_CLIST(view->clist)->rows -1))
59 return found;
60
61 for (i = view->row + 1; i < GTK_CLIST(view->clist)->rows -1; i++)
62 {
63 GList *tmp = NULL;
64 FileInfo *info = gtk_clist_get_row_data(GTK_CLIST(view->clist), i);
65
66 for (tmp = patterns; tmp != NULL; tmp = tmp->next)
67 {
68 pattern = tmp->data;
69 if(regcomp(&re, pattern, REG_EXTENDED) == 0)
70 {
71 if (regexec(&re, info->filename, 0, NULL, 0) == 0)
72 {
73 focus_on_row(view, i);
74 found++;
75 i = GTK_CLIST(view->clist)->rows;
76 }
77 }
78 }
79 }
80
81 regfree(&re);
82 g_free(free_this);
83 return found;
84
85 }
86
87 int
88 search_prev(FileView *view)
89 {
90 gchar *pattern, *s, *free_this;
91 GList *patterns = NULL;
92 regex_t re;
93 int i;
94 int found = 0;
95
96 if((s = g_strdup(view->glob)) == NULL)
97 return found;
98
99 free_this = pattern = g_strdup(s);
100 while ((s = strchr(pattern, ',')) != NULL)
101 {
102 *s = '\0';
103 patterns = g_list_append(patterns, pattern);
104 pattern = s+1;
105 }
106 patterns = g_list_append(patterns, pattern);
107
108 gtk_clist_unselect_all(GTK_CLIST(view->clist));
109
110 if((view->row -1) < 0)
111 return found;
112
113 for (i = view->row -1; i > 0; i--)
114 {
115 FileInfo *info = gtk_clist_get_row_data(GTK_CLIST(view->clist), i);
116 GList *tmp;
117
118 for (tmp = patterns; tmp != NULL; tmp = tmp->next)
119 {
120 pattern = tmp->data;
121 if(regcomp(&re, pattern, REG_EXTENDED) == 0)
122 {
123 if (regexec(&re, info->filename, 0, NULL, 0) == 0)
124 {
125 focus_on_row(view, i);
126 found++;
127 i = 0;
128 }
129 }
130 }
131
132 }
133
134 regfree(&re);
135 g_free(free_this);
136 return found;
137
138 }
139 void
140 find_prev(FileView *view)
141 {
142 int found = 0;
143 int row = view->row;
144
145 found = search_prev(view);
146
147 if(!found)
148 {
149 view->row = GTK_CLIST(view->clist)->rows -1;
150 found = search_prev(view);
151 }
152 if(!found)
153 {
154 view->row = row;
155 focus_on_row(view, row);
156 }
157 }
158
159
160 void
161 find_next(FileView *view)
162 {
163 int found = 0;
164 int row = view->row;
165 found = search_for_pattern(view);
166 if(!found)
167 {
168 view->row = 0;
169 found = search_for_pattern(view);
170 }
171 if(!found)
172 {
173 view->row = row;
174 gtk_clist_select_row(GTK_CLIST(view->clist), row, 0);
175 focus_on_row(view, row);
176 }
177 }
178
179 static void
180 back_to_normal_mode(FileView *view)
181 {
182 guint new_key_press_signal;
183 int x;
184 gchar status_text[128];
185
186 pat.index = 0;
187 for(x = 0; x < PATH_MAX; x++)
188 pat.pattern[x] = '\0';
189
190
191 new_key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(
192 GTK_OBJECT(view->clist),"signal_key_id"));
193 gtk_signal_disconnect(GTK_OBJECT(view->clist), new_key_press_signal);
194
195 if(cfg.fileselector)
196 {
197 new_key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
198 "key_press_event", GTK_SIGNAL_FUNC(fileselector_key_cb), NULL);
199 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
200 GUINT_TO_POINTER(new_key_press_signal));
201 }
202 else
203 {
204 new_key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
205 "key_press_event", GTK_SIGNAL_FUNC(file_list_key_press_cb), view);
206 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
207 GUINT_TO_POINTER(new_key_press_signal));
208 }
209
210 if(g_list_length(GTK_CLIST(curr_view->clist)->selection) == 0)
211 {
212 g_snprintf(status_text, sizeof(status_text),
213 "No matching files for /%s", view->glob);
214 }
215 else
216 {
217 g_snprintf(status_text, sizeof(status_text),
218 "%d of %d files selected",
219 g_list_length(GTK_CLIST(curr_view->clist)->selection),
220 GTK_CLIST(curr_view->clist)->rows);
221 }
222
223 status_bar_message(status_text);
224
225 }
226
227 void
228 find_pattern(FileView *view)
229 {
230 gchar *pattern, *s, *free_this;
231 GList *patterns = NULL;
232 regex_t re;
233 int i, first;
234
235 if((s = g_strdup(pat.pattern)) == NULL)
236 return;
237
238 s++;
239 g_snprintf(view->glob, sizeof(view->glob), "%s", s);
240
241 free_this = pattern = g_strdup(s);
242 while ((s = strchr(pattern, ',')) != NULL)
243 {
244 *s = '\0';
245 patterns = g_list_append(patterns, pattern);
246 pattern = s+1;
247 }
248 patterns = g_list_append(patterns, pattern);
249
250 gtk_clist_unselect_all(GTK_CLIST(view->clist));
251 first = 0;
252
253 for (i = 0; i < GTK_CLIST(view->clist)->rows; i++)
254 {
255 FileInfo *info = gtk_clist_get_row_data(GTK_CLIST(view->clist), i);
256 GList *tmp;
257
258 for (tmp = patterns; tmp != NULL; tmp = tmp->next)
259 {
260 pattern = tmp->data;
261 if(regcomp(&re, pattern, REG_EXTENDED) == 0)
262 {
263 if (regexec(&re, info->filename, 0, NULL, 0) == 0)
264 {
265 if(first)
266 {
267 gtk_clist_select_row(GTK_CLIST(view->clist), i, 0);
268 }
269 else
270 {
271 first = i;
272 focus_on_row(view, i);
273 }
274 }
275 }
276 }
277 }
278
279 regfree(&re);
280 view->row = first;
281 g_free(free_this);
282 back_to_normal_mode(view);
283 }
284
285
286
287
288
289 static void
290 get_pattern(GtkWidget *widget, GdkEventKey *event, FileView *view)
291 {
292
293 if ((event->keyval == 'c') && (event->state & GDK_CONTROL_MASK))
294 {
295 event->keyval = 0;
296 back_to_normal_mode(view);
297 status_bar_message(" ");
298 return;
299 }
300 else if (event->keyval == GDK_Return)
301 {
302 /* empty pattern use previous pattern for search */
303 if(pat.index == 1)
304 g_snprintf(pat.pattern, sizeof(pat.pattern), "/%s", view->glob);
305
306 event->keyval = 0;
307 find_pattern(view);
308 back_to_normal_mode(view);
309 return;
310 }
311 else if(event->keyval == GDK_BackSpace)
312 {
313 pat.index--;
314 pat.pattern[pat.index] = '\0';
315 status_bar_message(pat.pattern);
316 }
317 else if((event->keyval < 0x100) && (event->state == 0
318 || event->state & GDK_SHIFT_MASK))
319 {
320 pat.pattern[pat.index] = event->keyval;
321 pat.index++;
322 status_bar_message(pat.pattern);
323 }
324 else
325 event->keyval =0;
326 }
327
328 void
329 search_mode(FileView *view)
330 {
331 guint key_press_signal;
332 pat.index = 0;
333
334 key_press_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(view->clist), "signal_key_id"));
335 gtk_signal_disconnect(GTK_OBJECT(view->clist), key_press_signal);
336
337 key_press_signal = gtk_signal_connect(GTK_OBJECT(view->clist),
338 "key_press_event", GTK_SIGNAL_FUNC(get_pattern), view);
339 gtk_object_set_data(GTK_OBJECT(view->clist), "signal_key_id",
340 GUINT_TO_POINTER(key_press_signal));
341
342 }
File src/size_filter_dialog.c added (mode: 100644) (index 0000000..5bac97a)
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 <string.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <sys/types.h>
24 #include "vide.h"
25
26 static GtkWidget *dialog;
27 static GtkWidget *operation_combo;
28 static GtkWidget *size_entry;
29 static GtkWidget *units_combo;
30
31 static void
32 ok_cb (GtkWidget * widget, FileView * view)
33 {
34 gchar *s;
35 double size;
36
37 view->size_filter.active = TRUE;
38 //set_filter_menu_active (view);
39
40 s = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry));
41 if (STREQ (s, "Bigger Than"))
42 view->size_filter.op = GT;
43 else
44 view->size_filter.op = LT;
45
46 s = gtk_entry_get_text (GTK_ENTRY (size_entry));
47 size = atof (s);
48
49 s = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (units_combo)->entry));
50 if (STREQ (s, "Bytes"))
51 view->size_filter.size = (off_t) size;
52 else if (STREQ (s, "KBytes"))
53 view->size_filter.size = (off_t) (size * (1 << 10));
54 else
55 view->size_filter.size = (off_t) (size * (1 << 20));
56
57 gtk_grab_remove (dialog);
58 gtk_widget_destroy (dialog);
59 load_dir_list (view);
60 }
61
62 static void
63 cancel_cb (GtkWidget * widget)
64 {
65 gtk_grab_remove (dialog);
66 gtk_widget_destroy (dialog);
67 }
68
69 static void
70 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
71 {
72 if (event->keyval == GDK_Escape)
73 cancel_cb (NULL);
74 }
75
76 void
77 create_size_filter_dialog (FileView * view)
78 {
79 GtkWidget *dialog_vbox;
80 GtkWidget *action_area;
81 GtkWidget *hbox;
82 gchar size_string[32];
83 GList *tmp = NULL;
84
85 dialog = gtk_dialog_new ();
86 dialog_vbox = GTK_DIALOG (dialog)->vbox;
87 action_area = GTK_DIALOG (dialog)->action_area;
88 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
89 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
90 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
91 GTK_SIGNAL_FUNC (key_press_cb), NULL);
92
93 add_label (dialog_vbox, "Size Filter: ", 0.0, FALSE, 5);
94
95 hbox = add_hbox (dialog_vbox, FALSE, 5, TRUE, 5);
96
97 operation_combo = gtk_combo_new ();
98 gtk_widget_set_usize (operation_combo, 110, 0);
99 gtk_box_pack_start (GTK_BOX (hbox), operation_combo, FALSE, FALSE, 0);
100 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
101 FALSE);
102 gtk_widget_show (operation_combo);
103
104 tmp = g_list_append (tmp, strdup ("Bigger Than"));
105 tmp = g_list_append (tmp, strdup ("Smaller Than"));
106 gtk_combo_set_popdown_strings (GTK_COMBO (operation_combo), tmp);
107 g_list_free (tmp);
108 tmp = NULL;
109
110 switch (view->size_filter.op)
111 {
112 case GT:
113 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
114 "Bigger Than");
115 break;
116 case LT:
117 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
118 "Smaller Than");
119 break;
120 default:
121 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (operation_combo)->entry),
122 "Bigger Than");
123 break;
124 }
125
126 size_entry = add_entry (hbox, "", FALSE, 0);
127 gtk_widget_set_usize (size_entry, 60, 0);
128
129 units_combo = gtk_combo_new ();
130 gtk_widget_set_usize (units_combo, 80, 0);
131 gtk_box_pack_start (GTK_BOX (hbox), units_combo, FALSE, FALSE, 0);
132 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (units_combo)->entry), FALSE);
133 gtk_widget_show (units_combo);
134
135 tmp = g_list_append (tmp, strdup ("Bytes"));
136 tmp = g_list_append (tmp, strdup ("KBytes"));
137 tmp = g_list_append (tmp, strdup ("MBytes"));
138 gtk_combo_set_popdown_strings (GTK_COMBO (units_combo), tmp);
139 g_list_free (tmp);
140 tmp = NULL;
141
142 if (view->size_filter.size < (1 << 10))
143 {
144 g_snprintf (size_string, sizeof (size_string), "%ld",
145 view->size_filter.size);
146 gtk_entry_set_text (GTK_ENTRY (size_entry), size_string);
147 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (units_combo)->entry),
148 "Bytes");
149 }
150 else if (view->size_filter.size < (1 << 20))
151 {
152 g_snprintf (size_string, sizeof (size_string), "%.2f",
153 (double) ((double) view->size_filter.size /
154 (double) (1 << 10)));
155 gtk_entry_set_text (GTK_ENTRY (size_entry), size_string);
156 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (units_combo)->entry),
157 "KBytes");
158 }
159 else
160 {
161 g_snprintf (size_string, sizeof (size_string), "%.2f",
162 (double) ((double) view->size_filter.size /
163 (double) (1 << 20)));
164 gtk_entry_set_text (GTK_ENTRY (size_entry), size_string);
165 gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (units_combo)->entry),
166 "MBytes");
167 }
168
169 add_button (action_area, "Ok", FALSE, 0, ok_cb, view);
170 add_button (action_area, "Cancel", FALSE, 0, cancel_cb, NULL);
171
172 gtk_widget_show (dialog);
173 gtk_grab_add (dialog);
174 gtk_window_set_transient_for (GTK_WINDOW (dialog),
175 GTK_WINDOW (app.main_window));
176 }
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/term_menu.c added (mode: 100644) (index 0000000..d2c104f)
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 "vide.h"
20
21
22
23
24 static void
25 change_title(ZvtTerm *term, VTTITLE_TYPE type, char *newtitle,
26 GtkWidget *term_window)
27 {
28 gtk_window_set_title(GTK_WINDOW(term_window), newtitle);
29 }
30
31 static void
32 close_term_window(ZvtTerm *term, gpointer data)
33 {
34 zvt_term_closepty(term);
35 gtk_widget_destroy(GTK_WIDGET(term)->parent);
36 }
37
38 static void
39 detach_term(GtkWidget *widget, ZvtTerm *term)
40 {
41 GtkWidget *term_window;
42 GtkWidget *menu_bar;
43 GtkWidget *vbox;
44 GtkWidget *term_label;
45 gchar *label_text;
46 gint term_count;
47 guint child_died_signal_id;
48 guint title_change_signal;
49
50 vbox = gtk_object_get_data(GTK_OBJECT(term), "vbox");
51 term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox),
52 "term_count"));
53 child_died_signal_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
54 "child_died_signal_id"));
55 gtk_signal_disconnect(GTK_OBJECT(term), child_died_signal_id);
56 title_change_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
57 "title_change_signal"));
58 gtk_signal_disconnect(GTK_OBJECT(term), title_change_signal);
59 term_label = gtk_object_get_data(GTK_OBJECT(term), "term_label");
60 gtk_label_get(GTK_LABEL(term_label), &label_text);
61
62 term_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
63 gtk_window_set_title(GTK_WINDOW(term_window), label_text);
64 gtk_signal_connect(GTK_OBJECT(term_window), "delete-event",
65 GTK_SIGNAL_FUNC(gtk_widget_destroy), term_window);
66 gtk_widget_realize(term_window);
67
68
69 menu_bar = gtk_object_get_data(GTK_OBJECT(term), "menubar");
70 gtk_widget_destroy(menu_bar);
71
72 /* Need to use ref and unref with reparent here - don't know why? */
73 gtk_widget_ref(GTK_WIDGET(term));
74 gtk_widget_reparent(GTK_WIDGET(term), term_window);
75 gtk_widget_unref(GTK_WIDGET(term));
76
77 gtk_signal_connect(GTK_OBJECT(term), "child_died",
78 GTK_SIGNAL_FUNC(close_term_window), NULL);
79 gtk_signal_connect(GTK_OBJECT(term), "title_changed",
80 GTK_SIGNAL_FUNC(change_title), term_window);
81
82
83 gtk_widget_grab_focus(GTK_WIDGET(term));
84
85 gtk_widget_show(term_window);
86
87 if(term_count > 1)
88 {
89 GList *child, *tmp;
90 ZvtTerm *tmp_term;
91 GtkWidget *ch;
92 GtkWidget *page_label;
93 GtkWidget *term_label;
94 char *label_text;
95 gchar buf[NAME_MAX];
96
97 term_count--;
98 gtk_object_set_data(GTK_OBJECT(vbox), "term_count",
99 GUINT_TO_POINTER(term_count));
100 child = GTK_BOX(vbox)->children;
101
102 term_count = 0;
103 for(tmp = child; tmp != NULL; tmp = tmp->next)
104 {
105 ch = ((GtkBoxChild*)(tmp->data))->widget;
106 if(ZVT_IS_TERM(ch))
107 {
108 term_count++;
109 gtk_object_set_data(GTK_OBJECT(ch), "term_number",
110 GUINT_TO_POINTER(term_count));
111 }
112 }
113 tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook),
114 gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)));
115 term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(tmp_term),
116 "term_number"));
117 gtk_object_set_data(GTK_OBJECT(vbox), "focus_term",
118 GUINT_TO_POINTER(term_count));
119 cfg.current_term = tmp_term;
120 term_label = gtk_object_get_data(GTK_OBJECT(tmp_term), "term_label");
121 page_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook),
122 gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook),
123 gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook))));
124 gtk_label_get(GTK_LABEL(term_label), &label_text);
125 g_snprintf(buf, sizeof(buf), "%d %s",
126 gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) +1,
127 label_text);
128 gtk_label_set_text(GTK_LABEL(page_label), buf);
129
130
131 gtk_widget_grab_focus(GTK_WIDGET(tmp_term));
132
133
134 }
135 else
136 {
137 gint page;
138 gtk_widget_destroy(GTK_WIDGET(vbox));
139 gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), -1);
140 page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook));
141 if(page == 0)
142 {
143 cfg.term_count = 0;
144 cfg.current_term = NULL;
145 }
146 }
147 }
148
149 static void
150 split_zterm(GtkWidget *widget, gpointer data)
151 {
152 create_zterm("sh", FALSE);
153 }
154
155 static void
156 menu_position(GtkMenu *menu, gint *x, gint *y, gpointer data)
157 {
158 gdk_window_get_origin((app.main_window)->window, x, y);
159 *x += 4;
160 *y += 30;
161 }
162
163 static void
164 lookup_word(GtkWidget *widget, ZvtTerm* term)
165 {
166 gchar buf[256];
167 gchar * word = zvt_term_get_buffer(term, NULL, VT_SELTYPE_WORD,
168 term->vx->vt.cursorx, term->vx->vt.cursory,
169 term->vx->vt.cursorx, term->vx->vt.cursory);
170 g_snprintf(buf, sizeof(buf), "%s %s", cfg.man_program, word);
171 create_zterm(buf, FALSE);
172 g_free(word);
173 }
174
175 /*
176 static void
177 compare_file(GtkWidget *widget, ZvtTerm *term)
178 {
179 * get file name from fileselector
180 * get current filename from term
181 * call vimdiff in new term
182 * vsplit calling vim with new file
183 }
184 */
185
186 /*
187 static void
188 copy_text(GtkWidget *widget, ZvtTerm *term)
189 {
190 * use !vide_copy to filter text to vide clipboard_file
191 * return text as originally passed to program
192 }
193 */
194
195 /*
196 static void
197 paste_text(GtkWidget *widget, ZvtTerm *term)
198 {
199 read vide clipboard_file and write to term to paste text
200 }
201 */
202
203 static void
204 create_page_menu(GtkWidget *widget, gpointer data)
205 {
206 create_buffer_menu();
207 gtk_menu_popup(GTK_MENU(app.buffer_menu), NULL, NULL,
208 menu_position, NULL, 0, 0);
209 }
210
211
212 static void
213 menu_key_cb(GtkWidget *widget, GdkEventKey *event, FileView *view)
214 {
215 /* a - Z */
216 if((event->keyval < 0x100) && (event->state == 0 || event->state & GDK_SHIFT_MASK
217 || event->state & GDK_MOD2_MASK))
218 {
219 switch(event->keyval)
220 {
221 case 'j':
222 event->keyval = GDK_Down;
223 break;
224 case 'k':
225 event->keyval = GDK_Up;
226 break;
227 case 'h':
228 event->keyval = GDK_Left;
229 break;
230 case 'l':
231 event->keyval = GDK_Right;
232 break;
233 default:
234 break;
235 }
236 }
237 }
238
239 GtkWidget *
240 create_term_menu(ZvtTerm *term, gchar *command)
241 {
242 GtkWidget *menu_bar;
243 GtkWidget *menu;
244 GtkWidget *menu_item;
245 GtkWidget *vide_menu;
246 GtkWidget *tools_menu;
247 GtkWidget *term_label;
248 GdkColor color = TAB_COLOR;
249 GtkStyle *defstyle;
250 GtkStyle *style = gtk_style_new();
251
252 menu_bar = gtk_menu_bar_new();
253
254 defstyle = gtk_widget_get_default_style();
255 style = gtk_style_copy(defstyle);
256 style->fg[0] = color;
257
258 menu = gtk_menu_new();
259 gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
260 GTK_SIGNAL_FUNC(menu_key_cb), NULL);
261
262 gtk_object_set_data(GTK_OBJECT(term), "menu_bar", menu_bar);
263
264
265 /* The terminal is running vi */
266 if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(term))))
267 {
268 add_menu_item(menu, "Open File in Buffer", create_fileselector,
269 GUINT_TO_POINTER(0));
270 if(strcmp(cfg.vi_clone, "vi"))
271 add_menu_item (menu, "Split Buffer & Open File", create_fileselector,
272 GUINT_TO_POINTER(1));
273 if(!strcmp(cfg.vi_clone, "vim"))
274 add_menu_item (menu, "VSplit Buffer & Open File", create_fileselector,
275 GUINT_TO_POINTER(2));
276 add_menu_separator (menu);
277 }
278 add_menu_item(menu, "Open File in New Term",
279 create_fileselector, GUINT_TO_POINTER(3));
280 add_menu_separator (menu);
281 add_menu_item(menu, "New Shell", split_zterm, NULL);
282 add_menu_separator(menu);
283 add_menu_item(menu, "List Pages", create_page_menu, NULL);
284 add_menu_separator(menu);
285 add_menu_item(menu, "Detach Term", detach_term, term);
286 add_menu_separator(menu);
287 add_menu_item (menu, "Cancel", NULL, NULL);
288 vide_menu = add_submenu (menu_bar, "_Vide", menu);
289 gtk_object_set_data(GTK_OBJECT(term), "vide_menu", vide_menu);
290
291 menu = gtk_menu_new();
292 gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
293 GTK_SIGNAL_FUNC(menu_key_cb), NULL);
294 add_menu_item(menu, "Look up word", lookup_word, term);
295 add_menu_separator(menu);
296
297 /*
298 add_menu_item(menu, "Compare file to..", compare_file, term);
299 add_menu_separator(menu);
300 */
301
302 /* I don't know how to visually select text in nvi and vile
303 if((!strcmp("vim", cfg.vi_clone) | (!strcmp("elvis", cfg.vi_clone))))
304 {
305 add_menu_item(menu, "Copy", copy_text, term);
306 add_menu_separator(menu);
307 add_menu_item(menu, "Paste", paste_text, term);
308 add_menu_separator(menu);
309 }
310 */
311 add_menu_item(menu, "Cancel", NULL, NULL);
312 tools_menu = add_submenu(menu_bar, "_Tools", menu);
313 gtk_object_set_data(GTK_OBJECT(term), "tools_menu", tools_menu);
314
315 /* label for filename on menubar */
316 menu = gtk_menu_new();
317 menu_item = gtk_menu_item_new();
318 term_label = gtk_widget_new(GTK_TYPE_LABEL,
319 "GtkWidget::visible", TRUE,
320 "GtkWidget::parent", menu_item,
321 "GtkMisc::xalign", 0, 0, NULL);
322 gtk_label_set_text(GTK_LABEL(term_label), command);
323 gtk_widget_set_style(GTK_WIDGET(term_label), style);
324 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
325 gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), menu_item);
326 gtk_menu_item_right_justify(GTK_MENU_ITEM(menu_item));
327 gtk_widget_show(menu_item);
328 gtk_object_set_data(GTK_OBJECT(term), "term_label", term_label);
329
330
331 return menu_bar;
332
333
334 }
335
336
File src/user_command.c added (mode: 100644) (index 0000000..518ce85)
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 <string.h>
21 #include "vide.h"
22 void
23 add_user_command (gchar * name, gchar * action)
24 {
25 UserCommand command;
26
27 strncpy (command.name, name, sizeof (command.name));
28 strncpy (command.action, action, sizeof (command.action));
29 cfg.user_commands = g_list_append (cfg.user_commands,
30 duplicate (&command,
31 sizeof (UserCommand)));
32 }
File src/user_command_dialog.c added (mode: 100644) (index 0000000..9d4c7f9)
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 <string.h>
21 #include "vide.h"
22
23 static GtkWidget *dialog;
24 static GtkWidget *name_entry;
25 static GtkWidget *action_entry;
26
27 static void
28 ok_cb (GtkWidget * widget, UserCommand ** command)
29 {
30 if (*command == NULL)
31 {
32 *command = g_malloc (sizeof (UserCommand));
33 cfg.user_commands = g_list_append (cfg.user_commands, *command);
34 }
35
36 strncpy ((*command)->name, gtk_entry_get_text (GTK_ENTRY (name_entry)),
37 sizeof ((*command)->name));
38 strncpy ((*command)->action, gtk_entry_get_text (GTK_ENTRY (action_entry)),
39 sizeof ((*command)->action));
40
41 gtk_grab_remove (dialog);
42 gtk_widget_destroy (dialog);
43 gtk_main_quit ();
44 }
45
46 static void
47 cancel_cb (GtkWidget * widget)
48 {
49 gtk_grab_remove (dialog);
50 gtk_widget_destroy (dialog);
51 gtk_main_quit ();
52 }
53
54 static void
55 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
56 {
57 if (event->keyval == GDK_Escape)
58 cancel_cb (NULL);
59 }
60
61 static void
62 delete_event_cb (GtkWidget * widget)
63 {
64 /* this is just here so the user can't close the dialog without clicking
65 * one of the buttons
66 */
67 }
68
69 void
70 create_user_command_dialog (UserCommand ** command)
71 {
72 GtkWidget *dialog_vbox;
73 GtkWidget *action_area;
74 GtkWidget *table;
75 GtkWidget *wid;
76
77 dialog = gtk_dialog_new ();
78 dialog_vbox = GTK_DIALOG (dialog)->vbox;
79 action_area = GTK_DIALOG (dialog)->action_area;
80 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
81 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
82 gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", delete_event_cb,
83 NULL);
84 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
85 GTK_SIGNAL_FUNC (key_press_cb), NULL);
86
87 wid = add_label (dialog_vbox, "Macros:\n"
88 "%f = Selected Filename(s)\n"
89 "%d = Active Directory\n"
90 "%D = Inactive Directory\n"
91 "%{Prompt message} = Prompt user for input",
92 0.0, FALSE, 0);
93 gtk_label_set_justify (GTK_LABEL (wid), GTK_JUSTIFY_LEFT);
94
95 table = add_table (dialog_vbox, 2, 2, FALSE, FALSE, 0);
96 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
97
98 add_label_to_table (table, "Name: ", 0.0, 0, 1, 0, 1);
99 add_label_to_table (table, "Action: ", 0.0, 0, 1, 1, 2);
100 if (*command != NULL)
101 {
102 name_entry = add_entry_to_table (table, (*command)->name, 1, 2, 0, 1);
103 action_entry =
104 add_entry_to_table (table, (*command)->action, 1, 2, 1, 2);
105 }
106 else
107 {
108 name_entry = add_entry_to_table (table, "", 1, 2, 0, 1);
109 action_entry = add_entry_to_table (table, "", 1, 2, 1, 2);
110 }
111
112 gtk_signal_connect (GTK_OBJECT (name_entry), "activate",
113 GTK_SIGNAL_FUNC (ok_cb), command);
114
115 gtk_signal_connect (GTK_OBJECT (action_entry), "activate",
116 GTK_SIGNAL_FUNC (ok_cb), command);
117
118 gtk_widget_grab_focus (name_entry);
119
120 add_button (action_area, "Ok", TRUE, 0, ok_cb, command);
121 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, NULL);
122
123 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
124 gtk_widget_show (dialog);
125 gtk_grab_add (dialog);
126 gtk_window_set_transient_for (GTK_WINDOW (dialog),
127 GTK_WINDOW (app.main_window));
128 }
File src/user_prompt.c added (mode: 100644) (index 0000000..58b7f5f)
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 "vide.h"
21
22 static GtkWidget *dialog;
23 static GtkWidget *entry;
24
25 static void
26 ok_cb (GtkWidget * widget, gchar ** string)
27 {
28 gchar *s;
29
30 s = gtk_entry_get_text (GTK_ENTRY (entry));
31 if (strlen (s) == 0)
32 {
33 status_bar_message("Invalid input\n");
34 return;
35 }
36
37 *string = g_strdup (s);
38
39 gtk_grab_remove (dialog);
40 gtk_widget_destroy (dialog);
41 gtk_main_quit ();
42 }
43
44 static void
45 cancel_cb (GtkWidget * widget, gchar ** string)
46 {
47 *string = NULL;
48 gtk_grab_remove (dialog);
49 gtk_widget_destroy (dialog);
50 gtk_main_quit ();
51 }
52
53 static void
54 key_press_cb (GtkWidget * widget, GdkEventKey * event, gchar ** string)
55 {
56 if (event->keyval == GDK_Escape)
57 cancel_cb (NULL, string);
58 }
59
60 static void
61 delete_event_cb (GtkWidget * widget)
62 {
63 /* this is just here so the user can't close the dialog without clicking
64 * the Ok button
65 */
66 }
67
68 void
69 create_user_prompt (gchar * prompt, gchar * init_text, gchar ** string)
70 {
71 GtkWidget *dialog_vbox;
72 GtkWidget *action_area;
73
74 dialog = gtk_dialog_new ();
75 dialog_vbox = GTK_DIALOG (dialog)->vbox;
76 action_area = GTK_DIALOG (dialog)->action_area;
77 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
78 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
79 gtk_signal_connect (GTK_OBJECT (dialog), "delete_event", delete_event_cb,
80 NULL);
81 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
82 GTK_SIGNAL_FUNC (key_press_cb), string);
83
84 add_label (dialog_vbox, prompt, 0.0, FALSE, 5);
85 entry = add_entry (dialog_vbox, init_text, FALSE, 0);
86 gtk_signal_connect (GTK_OBJECT (entry), "activate",
87 GTK_SIGNAL_FUNC (ok_cb), string);
88 gtk_widget_grab_focus (entry);
89
90 add_button (action_area, "Ok", TRUE, 0, ok_cb, string);
91 add_button (action_area, "Cancel", TRUE, 0, cancel_cb, string);
92 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
93 gtk_widget_show (dialog);
94 gtk_grab_add (dialog);
95 gtk_window_set_transient_for (GTK_WINDOW (dialog),
96 GTK_WINDOW (app.main_window));
97 }
File src/utils.c added (mode: 100644) (index 0000000..4312645)
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 <unistd.h>
24 #include <ctype.h>
25 #include <sys/types.h>
26 #include <pwd.h>
27 #include <grp.h>
28 #include <time.h>
29 #include "vide.h"
30
31 void *
32 duplicate (void *stuff, int size)
33 {
34 void *new_stuff = (void *) malloc (size);
35 memcpy (new_stuff, stuff, size);
36 return new_stuff;
37 }
38
39 gchar *
40 str_to_lower (gchar * string)
41 {
42 gchar *new_string;
43 int i = 0;
44
45 if (string == NULL)
46 return NULL;
47
48 if ((new_string = strdup (string)) == NULL)
49 return NULL;
50
51 while ((new_string[i++] = tolower (new_string[i])) != '\0')
52 ;
53
54 return new_string;
55 }
56
57 void
58 set_cursor_watch ()
59 {
60 GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
61 gdk_window_set_cursor (app.main_window->window, cursor);
62 // gdk_cursor_destroy (cursor);
63 }
64
65 void
66 set_cursor_normal ()
67 {
68 /*
69 GdkCursor *cursor = gdk_cursor_new (GDK_LEFT_PTR);
70 gdk_window_set_cursor (app.main_window->window, cursor);
71 gdk_cursor_destroy (cursor);
72 */
73 /* while (gtk_events_pending())*/
74 /* gtk_main_iteration();*/
75 }
76
77 int
78 S_ISEXE (mode_t mode)
79 {
80 if ((S_IXUSR & mode) || (S_IXGRP & mode) || (S_IXOTH & mode))
81 return 1;
82 return 0;
83 }
84
85 int
86 is_text (gchar * filename)
87 {
88 FILE *pipe;
89 gchar line[MAX_LEN];
90
91 g_snprintf (line, sizeof (line), "file \"%s\"", filename);
92 if ((pipe = popen (line, "r")) == NULL)
93 {
94 fprintf (stderr, "Unable to open pipe for file command\n");
95 return 0;
96 }
97
98 while (fgets (line, MAX_LEN, pipe))
99 {
100 if (strstr (line, "text"))
101 {
102 pclose (pipe);
103 return 1;
104 }
105 }
106 pclose (pipe);
107 return 0;
108 }
109
110 void
111 free_clist_row_data (gpointer data)
112 {
113 if (data != NULL)
114 free (data);
115 }
116
117 void
118 my_glist_free (GList ** list)
119 {
120 GList *tmp;
121
122 for (tmp = *list; tmp != NULL; tmp = tmp->next)
123 {
124 if (tmp->data != NULL)
125 free (tmp->data);
126 }
127
128 g_list_free (*list);
129 *list = NULL;
130 }
131
132 GList *
133 string_glist_find (GList * list, gchar * search_text)
134 {
135 GList *tmp;
136 gchar *curr;
137
138 for (tmp = list; tmp != NULL; tmp = tmp->next)
139 {
140 curr = tmp->data;
141 if (STREQ (curr, search_text))
142 return tmp;
143 }
144 return NULL;
145 }
146
147 void
148 untag_all (FileView * view)
149 {
150 GList *tmp = curr_view->tagged;
151 for (; tmp != NULL; tmp = tmp->next)
152 {
153 FileInfo *info = tmp->data;
154 gint row = gtk_clist_find_row_from_data (GTK_CLIST (view->clist), info);
155 if (row < 0)
156 fprintf (stderr, "Trouble in get_selection()\n");
157 else
158 gtk_clist_set_background (GTK_CLIST (view->clist), row, &CLIST_COLOR);
159 }
160 g_list_free (curr_view->tagged);
161 curr_view->tagged = NULL;
162 }
163
164 GList *
165 get_selection (FileView * view)
166 {
167 if (curr_view->tagged != NULL)
168 return g_list_copy (curr_view->tagged);
169 else
170 return clist_get_selected_row_data (view->clist);
171 }
172
173 GList *
174 clist_get_selected_row_data (GtkWidget * clist)
175 {
176 GList *tmp;
177 GList *row_data = NULL;
178
179 /* this got rid of a problem when the user uses shift and the arrow keys */
180 /* to make a selection */
181 gtk_signal_emit_by_name (GTK_OBJECT (clist), "end-selection");
182
183 for (tmp = GTK_CLIST (clist)->selection; tmp != NULL; tmp = tmp->next)
184 {
185 FileInfo *info =
186 gtk_clist_get_row_data (GTK_CLIST (clist), (int) tmp->data);
187 row_data = g_list_append (row_data, info);
188 }
189
190 return row_data;
191 }
192
193 void
194 chomp (gchar * text)
195 {
196 if (text[strlen (text) - 1] == '\n')
197 text[strlen (text) - 1] = '\0';
198 }
199
200 /* This is the function that replaces %f etc. with their appropriate values
201 * The GString returned needs to be freed.
202 */
203 GString *
204 expand_macros (gchar * text)
205 {
206 GString *command_string = g_string_new ("");
207 gchar *s, *free_this, *command_copy;
208 FileInfo *info;
209
210 command_copy = g_strdup (text);
211 free_this = s = command_copy;
212 while ((s = strchr (command_copy, '%')) != NULL)
213 {
214 *s++ = '\0';
215 g_string_append (command_string, command_copy);
216 command_copy = s + 1;
217 switch (*s)
218 {
219 case 'f':
220 {
221 GList *tmp;
222 GList *base;
223
224 tmp = get_selection (curr_view);
225 if (tmp == NULL)
226 {
227 status_bar_message("No files selected\n");
228 g_free (free_this);
229 g_string_free (command_string, TRUE);
230 return NULL;
231 }
232 base = tmp;
233 for (; tmp != NULL; tmp = tmp->next)
234 {
235 info = tmp->data;
236 g_string_sprintfa (command_string, "\"%s\" ", info->filename);
237 }
238 g_list_free (base);
239 }
240 break;
241 case 'd':
242 g_string_sprintfa (command_string, "\"%s\"", curr_view->dir);
243 break;
244 case 'D':
245 g_string_sprintfa (command_string, "\"%s\"", other_view->dir);
246 break;
247 case '{':
248 if ((s = strchr (command_copy, '}')) == NULL)
249 {
250 status_bar_message("No matching '}' found in action text.\n");
251 g_free (free_this);
252 g_string_free (command_string, TRUE);
253 return NULL;
254 }
255 else
256 {
257 gchar *user_input;
258
259 *s++ = '\0';
260
261 /*%f inside of %{} will put the selected files into the popup entry */
262 if((s = strchr(command_copy, '%')) != NULL)
263 {
264 GList *tmp;
265 GList *base;
266 gchar *init_text;
267
268 tmp = get_selection (curr_view);
269 if (tmp == NULL)
270 {
271 status_bar_message("No files selected\n");
272 g_free (free_this);
273 g_string_free (command_string, TRUE);
274 return NULL;
275 }
276 base = tmp;
277 for (; tmp != NULL; tmp = tmp->next)
278 {
279 info = tmp->data;
280 init_text = g_strdup(info->filename);
281 }
282 g_list_free (base);
283 *s++ = '\0';
284 command_copy = s+1;
285
286 create_user_prompt(command_copy, init_text, &user_input);
287 }
288 else
289 create_user_prompt (command_copy, "", &user_input);
290
291 gtk_main ();
292 command_copy = s;
293 if (user_input != NULL)
294 {
295 g_string_append (command_string, user_input);
296 g_free (user_input);
297 g_free(free_this);
298 return command_string;
299 }
300 else
301 {
302 g_free (free_this);
303 g_string_free (command_string, TRUE);
304 return NULL;
305 }
306 }
307 break;
308 default:
309 g_string_append_c (command_string, '%');
310 g_string_append_c (command_string, *s);
311 break;
312 }
313 }
314 g_string_append (command_string, command_copy);
315 g_free (free_this);
316 return command_string;
317 }
318
319 /* Used to show the full command on the status bar without
320 * creating the popups
321 */
322 GString *
323 list_macros (gchar * text)
324 {
325 GString *command_string = g_string_new ("");
326 gchar *s, *free_this, *command_copy;
327 FileInfo *info;
328
329 command_copy = g_strdup (text);
330 free_this = s = command_copy;
331 while ((s = strchr (command_copy, '%')) != NULL)
332 {
333 *s++ = '\0';
334 g_string_append (command_string, command_copy);
335 command_copy = s + 1;
336 switch (*s)
337 {
338 case 'f':
339 {
340 GList *tmp;
341 GList *base;
342
343 tmp = get_selection (curr_view);
344 if (tmp == NULL)
345 {
346 g_free (free_this);
347 g_string_free (command_string, TRUE);
348 return NULL;
349 }
350 base = tmp;
351 for (; tmp != NULL; tmp = tmp->next)
352 {
353 info = tmp->data;
354 g_string_sprintfa (command_string, "\"%s\" ", info->filename);
355 }
356 g_list_free (base);
357 }
358 break;
359 case 'd':
360 g_string_sprintfa (command_string, "\"%s\"", curr_view->dir);
361 break;
362 case 'D':
363 g_string_sprintfa (command_string, "\"%s\"", other_view->dir);
364 break;
365 case '{':
366 {
367 g_string_append(command_string, " --User Prompt--");
368 g_free(free_this);
369 return command_string;
370 }
371 break;
372 default:
373 g_string_append_c (command_string, *s);
374 break;
375 }
376 }
377 g_string_append (command_string, command_copy);
378 g_free (free_this);
379 return command_string;
380 }
381
382 void
383 describe_file_size (gchar* buf, int buf_size, FileInfo* file_info)
384 {
385 if (file_info->statbuf.st_size < 10240) /* less than 10K */
386 {
387 g_snprintf (buf, buf_size, "%d bytes", (int) file_info->statbuf.st_size);
388 }
389 else if (file_info->statbuf.st_size < 1048576) /* less than a meg */
390 {
391 g_snprintf (buf, buf_size, "%.2f Kbytes",
392 ((float) file_info->statbuf.st_size / 1024.0));
393 }
394 else /* more than a meg */
395 {
396 g_snprintf (buf, buf_size, "%.2f Mbytes",
397 ((float) file_info->statbuf.st_size / 1048576.0));
398 }
399 }
400
401 void
402 describe_user_id (gchar* buf, int buf_size, FileInfo* file_info)
403 {
404 struct passwd *pwd_buf;
405
406 if ((pwd_buf = getpwuid (file_info->statbuf.st_uid)) == NULL)
407 {
408 g_snprintf (buf, buf_size, "%d", (int) file_info->statbuf.st_uid);
409 }
410 else
411 {
412 g_snprintf (buf, buf_size, "%s", pwd_buf->pw_name);
413 }
414 }
415
416 void
417 describe_group_id (gchar* buf, int buf_size, FileInfo* file_info)
418 {
419 struct group *grp_buf;
420
421 if ((grp_buf = getgrgid (file_info->statbuf.st_gid)) == NULL)
422 {
423 g_snprintf (buf, sizeof (buf), "%d", (int) file_info->statbuf.st_gid);
424 }
425 else
426 {
427 g_snprintf (buf, buf_size, "%s", grp_buf->gr_name);
428 }
429 }
430
431 /* This is based on code by Sergei Gnezdov */
432 void
433 show_full_file_properties()
434 {
435 gchar status_str[MAX_LEN];
436 FileInfo *info;
437 gchar perm_str[11];
438 gchar size_str[20];
439 struct tm *tm_ptr;
440 gchar modified_str[50];
441 gchar user_id_str[20];
442 gchar group_id_str[20];
443
444 info = gtk_clist_get_row_data(GTK_CLIST(curr_view->clist),
445 curr_view->row);
446 get_perm_string(perm_str, sizeof(perm_str), info->statbuf.st_mode);
447 tm_ptr = localtime(&info->statbuf.st_mtime);
448 strftime(modified_str, sizeof(modified_str),
449 "%a %b %d %H:%M", tm_ptr);
450 describe_file_size(size_str, sizeof(size_str), info);
451 describe_user_id(user_id_str, sizeof(user_id_str), info);
452 describe_group_id(group_id_str, sizeof(group_id_str), info);
453 if(!strcmp(info->filename, "../"))
454 g_snprintf(status_str, sizeof(status_str),
455 "%s Size: %s Modified: %s %s %s:%s %d files",
456 curr_view->dir, size_str, modified_str, perm_str,
457 user_id_str,group_id_str, GTK_CLIST(curr_view->clist)->rows);
458 else
459 g_snprintf(status_str, sizeof(status_str),
460 "%s Size: %s Modified: %s %s %s:%s %d files",
461 info->filename, size_str, modified_str, perm_str,
462 user_id_str,group_id_str, GTK_CLIST(curr_view->clist)->rows);
463
464 status_bar_message(status_str);
465
466 }
467 void
468 show_file_properties()
469 {
470 gchar status_str[MAX_LEN];
471 FileInfo *info;
472 gchar perm_str[11];
473 gchar size_str[20];
474 struct tm *tm_ptr;
475 gchar modified_str[50];
476 gchar user_id_str[20];
477 gchar group_id_str[20];
478 gint selections = 0;
479
480 if((selections = g_list_length(GTK_CLIST(curr_view->clist)->selection)) > 1)
481 {
482 g_snprintf(status_str, sizeof(status_str),
483 "%d of %d files selected",
484 selections, GTK_CLIST(curr_view->clist)->rows);
485 }
486 else
487 {
488
489 info = gtk_clist_get_row_data(GTK_CLIST(curr_view->clist),
490 curr_view->row);
491 get_perm_string(perm_str, sizeof(perm_str), info->statbuf.st_mode);
492 tm_ptr = localtime(&info->statbuf.st_mtime);
493 strftime(modified_str, sizeof(modified_str),
494 "%a %b %d %H:%M", tm_ptr);
495 describe_file_size(size_str, sizeof(size_str), info);
496 describe_user_id(user_id_str, sizeof(user_id_str), info);
497 describe_group_id(group_id_str, sizeof(group_id_str), info);
498 if(!strcmp(info->filename, "../"))
499 g_snprintf(status_str, sizeof(status_str),
500 "%s %s %s %s",
501 curr_view->dir, size_str, perm_str,
502 user_id_str);
503 else
504 g_snprintf(status_str, sizeof(status_str),
505 "%s %s %s %s",
506 info->filename, size_str, perm_str,
507 user_id_str);
508
509 }
510 status_bar_message(status_str);
511
512 }
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/vide0.5.2.txt added (mode: 100644) (index 0000000..cc0b1ea)
1
2
3 The basic vi keybindings are used to move through the file lists and menus.
4
5 j - moves down
6 k - moves up
7 l - moves right
8 h - moves left
9
10 ctrl f moves forward one page
11 ctrl b moves back one page
12
13 gg moves to the top of the list
14 G moves to the bottom of the list
15
16 dd moves the selected file to the trash directory.
17
18 u - moves up one directory
19
20 return or enter moves into a directory or executes the default action
21 when a file is selected.
22
23 p creates a popup menu for the type of file selected.
24 P creates a popup menu of user defined programs.
25
26 m (letter) will set a bookmark for the letter. ma will set a bookmark for
27 the selected file under mark a.
28
29 t will tag or untag a file. Files that are tagged will be acted on with
30 the next command. Either a : command like :d or a command selected from
31 the Commands list. If you change directories or alter the current
32 directory the tag list will be reset.
33
34 ' (letter) will goto the file of the set mark. 'a will goto the file set
35 with ma.
36 '' will goto the previous directory
37
38 The tab or space key moves between the file lists and command list.
39
40 The main menu is activated with meta or alt key + the underlined letter.
41 You can move through the menus with the j,k,l,h keys. If you activate
42 the menu and don't want to select anything just select Cancel under the
43 Vide menu or Ctrl c + return.
44
45 Ctrl+ G will display the file properties in the status bar.
46 - name of the selected file
47 - size of the file
48 - modification time of the file
49 - access permissions of the file
50 - user id and group id separated by a colon
51 - total number of files in directory.
52
53 / + regular expression pattern will highlight all files matching the pattern.
54 /\.c$ will highlight all .c files in the current directory.
55 /~$ will highlight all vim backup files in the current directory.
56 /[Return] will use the last regular expression search
57
58 n will goto the next file matching the last pattern search.
59 N will goto the previous file matching the last pattern search.
60
61 : will enter command mode.
62 :d[elete] will move selected file to the trash.
63 :h will start vim with this help file.
64 :co[py] will copy the selected file to the other directory.
65 :m[ove] will move the selected file to the other directory.
66 :q quit vide.
67 :ls will create a popup menu showing all the notebook pages. Selecting
68 a menu item will jump to that notebook page.
69 :sh[ell] will start a term in the current directory.
70 :! + command will execute the command in a new vide term.
71 :!top will execute the top program in a new notebook page.
72 :!! + command will execute pauseme + command in a new vide term.
73 :grep <args> will execute vim +"grep <args>".
74 This will only work when you use vim as your editor.
75 :0 will goto the top of the current file list.
76 :sb will change the other filelist to either the current directory
77 or a specified path.
78 :sb will change the other filelist to the current directory
79 :sb /usr/local will change the other filelist to the path specified
80 :cd will change the current filelist to your home directory or to a
81 specified path.
82 :cd /usr/local - will change the current filelist to /usr/local.
83 :cd will change the current filelist to your home directory.
84 :marks will activate the Bookmarks menu.
85 :com will activate a popup menu of user defined commands.
86 :com [name] [action] will set a new user command.
87 The following macros can be used to set user commands.
88 %f will be replaced with all of the currently selected files.
89 %d will be replaced with the current directory.
90 %D will be replaced with the other directory.
91 %{Prompt string} will create a dialog window with the prompt string.
92 ! followed by a command will execute that command inside a vide
93 terminal.
94 :delc will create a popup menu that will remove the user command selected.
95 :exe will execute a program.
96 Please note if the program requires a console it must be executed in
97 a terminal.
98 :com ps exe rxvt -e top
99 or
100 :com ps !top
101 :/[pattern] will select files matching the [pattern]
102 This allows complex or frequent pattern searches to be set as a user
103 command.
104 :com backup /~$
105 lets you select all vim backup files with the :backup command
106 :his[tory] will create a popup menu of the last ten directories in each
107 file list.
108 :on[ly] will hide the command list and the other file list.
109 :new will show the hidden lists.
110
111 Filters can be set from the Options menu. The file name filter can
112 be set from the :command.
113
114 :set filter [pattern] will set the file list to only show files matching
115 the pattern. :set filter \.c$ will only show the .c files in a d
116 directory.
117 :nofil[ter] removes the name filter and shows all files.
118 :fil[ter] resets the name filter to the last pattern.
119 :in[vert] toggles back and forth between showing the files not matching
120 the name filter pattern, and files matching the pattern.
121
122 A filter can also be set as a :com
123 :com myfiles set filter \.c$ will set the :myfiles command to show
124 only .c files.
125
126
127 :sp will split the current vi with the selected file.
128 the current vi is the highlighted notebook tab.
129 :sp number will split the vi associated with number with the selected
130 file.
131 :b will load the selected file into the current vi.
132 :b [number] will load the selected file into the vi associated with that
133 number.
134 :vs will vertically split a vim window with the file. This only works
135 with vim6.0
136
137 :pwd or :pw will show the full path of the current working directory
138 in the status bar.
139
140 If you have more than one terminal open on a notebook page you can move
141 between the different terms by clicking on the term with the mouse or
142 by using the following:
143
144 <alt>w j moves down one term
145 <alt>w k moves up one term
146
147
148 <alt>w n creates a new term running sh
149 <alt>w m will lookup the word under the cursor with a program that
150 can be set from the configuration dialog. The default program is man.
151
152
153
154
155 Ctrl+ C will return vide to normal mode.
156
157
158
159
File src/view_dialog.c added (mode: 100644) (index 0000000..6b43411)
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 "vide.h"
22
23 void
24 close_cb (GtkWidget * widget, GtkWidget * dialog)
25 {
26 gtk_widget_destroy (dialog);
27 }
28
29 static void
30 key_press_cb (GtkWidget * widget, GdkEventKey * event, gpointer data)
31 {
32 if (event->keyval == GDK_Escape)
33 close_cb (NULL, widget);
34 }
35
36 void
37 create_view_file_dialog (gchar * filename)
38 {
39 FILE *f;
40 GtkWidget *dialog;
41 GtkWidget *dialog_vbox;
42 GtkWidget *action_area;
43 GtkWidget *table;
44 GtkWidget *text_area;
45 GtkWidget *scrollbar;
46 gchar text[MAX_LEN];
47
48 if ((f = fopen (filename, "r")) == NULL)
49 {
50 return;
51 }
52
53 dialog = gtk_dialog_new ();
54 dialog_vbox = GTK_DIALOG (dialog)->vbox;
55 action_area = GTK_DIALOG (dialog)->action_area;
56
57 gtk_window_set_title (GTK_WINDOW (dialog), filename);
58 gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 5);
59 gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
60 gtk_box_set_spacing (GTK_BOX (dialog_vbox), 5);
61 gtk_box_set_homogeneous (GTK_BOX (action_area), TRUE);
62 gtk_signal_connect (GTK_OBJECT (dialog), "key_press_event",
63 GTK_SIGNAL_FUNC (key_press_cb), NULL);
64
65 table = gtk_table_new (1, 2, FALSE);
66 gtk_widget_set_usize (table, 500, 400);
67 gtk_box_pack_start (GTK_BOX (dialog_vbox), table, TRUE, TRUE, FALSE);
68 gtk_widget_show (table);
69
70 text_area = gtk_text_new (NULL, NULL);
71 gtk_text_set_editable (GTK_TEXT (text_area), FALSE);
72 gtk_text_set_word_wrap (GTK_TEXT (text_area), TRUE);
73 gtk_table_attach (GTK_TABLE (table), text_area, 0, 1, 0, 1,
74 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
75 0, 0);
76 gtk_widget_show (text_area);
77
78 scrollbar = gtk_vscrollbar_new (GTK_TEXT (text_area)->vadj);
79 gtk_table_attach (GTK_TABLE (table), scrollbar, 1, 2, 0, 1,
80 GTK_FILL, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
81 gtk_widget_show (scrollbar);
82
83 add_button (action_area, "Close", FALSE, 5, close_cb, dialog);
84
85 while (fgets (text, sizeof (text), f) != NULL)
86 gtk_text_insert (GTK_TEXT (text_area), NULL, NULL, NULL, text,
87 strlen (text));
88
89 fclose (f);
90
91 gtk_widget_show (dialog);
92 }
File src/widget_utils.c added (mode: 100644) (index 0000000..48cc59d)
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 "vide.h"
21
22 /* These all pretty much do the same thing.. create a widget and add it to
23 * the box or table passed.. return the new widget
24 */
25
26 void
27 add_tool_button (GtkWidget * toolbar, gchar * name, gchar * description,
28 GtkWidget * icon, GtkSignalFunc button_clicked)
29 {
30
31 gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), name, description, "",
32 icon, GTK_SIGNAL_FUNC (button_clicked),
33 GTK_OBJECT (toolbar));
34 }
35
36 GtkWidget *
37 add_button (GtkWidget * box,
38 gchar * label,
39 gint fill, gint pad, GtkSignalFunc func, gpointer data)
40 {
41 GtkWidget *button;
42 button = gtk_button_new_with_label (label);
43 gtk_signal_connect (GTK_OBJECT (button), "clicked", func, data);
44 gtk_box_pack_start (GTK_BOX (box), button, fill, TRUE, pad);
45 gtk_widget_show (button);
46
47 return button;
48 }
49
50 GtkWidget *
51 add_label (GtkWidget * box, gchar * text, gfloat align, gint fill, gint pad)
52 {
53 GtkWidget *label;
54 label = gtk_label_new (text);
55 gtk_misc_set_alignment (GTK_MISC (label), align, 0.5);
56 gtk_box_pack_start (GTK_BOX (box), label, fill, TRUE, pad);
57 gtk_widget_show(label);
58
59 return label;
60 }
61
62 GtkWidget *
63 add_entry (GtkWidget * box, gchar * init_text, gint fill, gint pad)
64 {
65 GtkWidget *entry;
66 entry = gtk_entry_new ();
67 if (init_text != NULL)
68 gtk_entry_set_text (GTK_ENTRY (entry), init_text);
69 gtk_box_pack_start (GTK_BOX (box), entry, fill, TRUE, pad);
70 gtk_widget_show (entry);
71
72 return entry;
73 }
74
75 GtkWidget *
76 add_check_button (GtkWidget * box,
77 gchar * label,
78 gint state,
79 gint fill, gint pad, GtkSignalFunc func, gpointer data)
80 {
81 GtkWidget *check_button;
82 check_button = gtk_check_button_new_with_label (label);
83 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), state);
84 gtk_signal_connect (GTK_OBJECT (check_button), "toggled", func, data);
85 gtk_box_pack_start (GTK_BOX (box), check_button, fill, TRUE, pad);
86 gtk_widget_show (check_button);
87
88 return check_button;
89 }
90
91 GtkWidget *
92 add_radio_button (GtkWidget * box,
93 gchar * label,
94 GSList * group,
95 gint fill, gint pad, GtkSignalFunc func, gpointer data)
96 {
97 GtkWidget *radio_button;
98 radio_button = gtk_radio_button_new_with_label (group, label);
99 gtk_signal_connect (GTK_OBJECT (radio_button), "toggled", func, data);
100 gtk_box_pack_start (GTK_BOX (box), radio_button, fill, TRUE, pad);
101 gtk_widget_show (radio_button);
102
103 return radio_button;
104 }
105
106 GtkWidget *
107 add_hbox (GtkWidget * box, gint homogen, gint spacing, gint fill, gint pad)
108 {
109 GtkWidget *hbox;
110 hbox = gtk_hbox_new (homogen, spacing);
111 gtk_box_pack_start (GTK_BOX (box), hbox, fill, TRUE, pad);
112 gtk_widget_show (hbox);
113
114 return hbox;
115 }
116
117 GtkWidget *
118 add_vbox (GtkWidget * box, gint homogen, gint spacing, gint fill, gint pad)
119 {
120 GtkWidget *vbox;
121 vbox = gtk_vbox_new (homogen, spacing);
122 gtk_box_pack_start (GTK_BOX (box), vbox, fill, TRUE, pad);
123 gtk_widget_show (vbox);
124
125 return vbox;
126 }
127
128 GtkWidget *
129 add_sw (GtkWidget * box,
130 GtkPolicyType h_policy, GtkPolicyType v_policy, gint fill, gint pad)
131 {
132 GtkWidget *sw;
133 sw = gtk_scrolled_window_new (NULL, NULL);
134 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), h_policy,
135 v_policy);
136 gtk_box_pack_start (GTK_BOX (box), sw, fill, TRUE, pad);
137 gtk_widget_show (sw);
138
139 return sw;
140 }
141
142 GtkWidget *
143 add_separator (GtkWidget * box, gint fill, gint pad)
144 {
145 GtkWidget *sep;
146
147 if (GTK_IS_HBOX (box))
148 {
149 sep = gtk_vseparator_new ();
150 gtk_box_pack_start (GTK_BOX (box), sep, fill, TRUE, pad);
151 }
152 else if (GTK_IS_VBOX (box))
153 {
154 sep = gtk_hseparator_new ();
155 gtk_box_pack_start (GTK_BOX (box), sep, fill, TRUE, pad);
156 }
157 else
158 {
159 return NULL;
160 }
161
162 gtk_widget_show (sep);
163 return sep;
164 }
165
166 GtkWidget *
167 add_table (GtkWidget * box,
168 gint rows, gint cols, gint homogen, gint fill, gint pad)
169 {
170 GtkWidget *table;
171 table = gtk_table_new (rows, cols, homogen);
172 gtk_box_pack_start (GTK_BOX (box), table, fill, TRUE, pad);
173 gtk_widget_show (table);
174
175 return table;
176 }
177
178 GtkWidget *
179 add_label_to_table (GtkWidget * table,
180 gchar * text,
181 gfloat align,
182 gint left, gint right, gint top, gint bottom)
183 {
184 GtkWidget *label;
185 label = gtk_label_new (text);
186 gtk_misc_set_alignment (GTK_MISC (label), align, 0.5);
187 gtk_table_attach_defaults (GTK_TABLE (table), label, left, right, top,
188 bottom);
189 gtk_widget_show (label);
190
191 return label;
192 }
193
194 GtkWidget *
195 add_entry_to_table (GtkWidget * table,
196 gchar * init_text,
197 gint left, gint right, gint top, gint bottom)
198 {
199 GtkWidget *entry;
200 entry = gtk_entry_new ();
201 if (init_text != NULL)
202 gtk_entry_set_text (GTK_ENTRY (entry), init_text);
203 gtk_table_attach_defaults (GTK_TABLE (table), entry, left, right, top,
204 bottom);
205 gtk_widget_show (entry);
206
207 return entry;
208 }
209
210 GtkWidget *
211 add_button_to_table (GtkWidget * table,
212 gchar * label,
213 GtkSignalFunc func,
214 gpointer data,
215 gint left, gint right, gint top, gint bottom)
216 {
217 GtkWidget *button;
218 button = gtk_button_new_with_label (label);
219 gtk_signal_connect (GTK_OBJECT (button), "clicked", func, data);
220 gtk_table_attach_defaults (GTK_TABLE (table), button, left, right, top,
221 bottom);
222 gtk_widget_show (button);
223
224 return button;
225 }
226
227 GtkWidget *
228 add_check_button_to_table (GtkWidget * table,
229 gchar * label,
230 gint state,
231 GtkSignalFunc func,
232 gpointer data,
233 gint left, gint right, gint top, gint bottom)
234 {
235 GtkWidget *check_button;
236 check_button = gtk_check_button_new_with_label (label);
237 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), state);
238 gtk_signal_connect (GTK_OBJECT (check_button), "toggled", func, data);
239 gtk_table_attach_defaults (GTK_TABLE (table), check_button,
240 left, right, top, bottom);
241 gtk_widget_show (check_button);
242
243 return check_button;
244 }
245
246 GtkWidget *
247 add_menu_item (GtkWidget * menu,
248 gchar * label, GtkSignalFunc func, gpointer data)
249 {
250 GtkWidget *menu_item;
251 menu_item = gtk_menu_item_new_with_label (label);
252 gtk_signal_connect (GTK_OBJECT (menu_item), "activate", func, data);
253 gtk_menu_append (GTK_MENU (menu), menu_item);
254 gtk_widget_show (menu_item);
255
256 return menu_item;
257 }
258
259 GtkWidget *
260 add_menu_check_button (GtkWidget * menu,
261 gchar * label,
262 gboolean state, GtkSignalFunc func, gpointer data)
263 {
264 GtkWidget *check;
265 check = gtk_check_menu_item_new_with_label (label);
266 gtk_signal_connect (GTK_OBJECT (check), "activate", func, data);
267 gtk_menu_append (GTK_MENU (menu), check);
268 gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (check), state);
269 gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (check), TRUE);
270 gtk_widget_show (check);
271
272 return check;
273 }
274
275 GtkWidget *
276 add_menu_separator (GtkWidget * menu)
277 {
278 GtkWidget *menu_item;
279 menu_item = gtk_menu_item_new ();
280 gtk_menu_append (GTK_MENU (menu), menu_item);
281 gtk_widget_show (menu_item);
282 gtk_widget_set_sensitive (GTK_WIDGET (menu_item), FALSE);
283
284 return menu_item;
285 }
286
287 GtkWidget *
288 add_submenu (GtkWidget * menu_bar, gchar * label_text, GtkWidget * menu)
289 {
290 GtkWidget *menu_item;
291 GtkWidget *label;
292
293 menu_item = gtk_menu_item_new ();
294 label = gtk_widget_new (GTK_TYPE_LABEL,
295 "GtkWidget::visible", TRUE,
296 "GtkWidget::parent", menu_item,
297 "GtkMisc::xalign", 0.0, NULL);
298 gtk_label_parse_uline (GTK_LABEL (label), label_text);
299 gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu);
300 gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), menu_item);
301 gtk_widget_show (menu_item);
302
303 return menu_item;
304 }
305
306
307
308 GtkWidget *
309 create_pixmap (GtkWidget * widget, const gchar * file)
310 {
311
312 GdkColormap *colormap;
313 GdkPixmap *gdkpixmap;
314 GdkBitmap *mask;
315 GtkWidget *pixmap;
316 GtkStyle *style;
317
318 colormap = gtk_widget_get_colormap (app.main_window);
319 style = gtk_widget_get_style (app.main_window);
320 gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
321 NULL, file);
322 pixmap = gtk_pixmap_new (gdkpixmap, mask);
323 gdk_pixmap_unref (gdkpixmap);
324 gdk_bitmap_unref (mask);
325 return pixmap;
326 }
327
328 /*
329 GtkWidget *
330 add_submenu(GtkWidget *menu_bar, gchar *label, GtkWidget *menu)
331 {
332 GtkWidget *menu_item;
333 menu_item = gtk_menu_item_new_with_label(label);
334 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
335 gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), menu_item);
336 gtk_widget_show(menu_item);
337
338 return menu_item;
339 }
340 */
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 }
File stamp-h.in added (mode: 100644) (index 0000000..9788f70)
1 timestamp
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vide

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vide

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master