1 /* XView Action Icons (for Drag and Drop).
2 Copyright (C) 1995 Jakub Jelinek.
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
30 extern char *regex_command_title
;
34 void add_action_icon (char *filename
, char *geometry
)
36 char *iconname
, *title
, *p
, *base
= x_basename (filename
);
40 iconname
= regex_command (base
, "Icon", NULL
, NULL
);
42 iconname
= strdup ("file.xpm");
43 if (*iconname
!= '/') {
44 p
= copy_strings (ICONDIR
, iconname
, NULL
);
48 title
= regex_command_title
;
50 title
= strdup (base
);
54 y
= strlen (filename
);
56 for (q
= title
, x
= 1; *q
; q
++, x
++)
60 else if (q
[1] == 'd')
63 r
= xmalloc (x
, "Icon Title");
64 for (q
= title
, p
= r
; *q
; q
++, p
++)
70 } else if (q
[1] == 'd') {
83 for (p
= geometry
; *p
&& (*p
< '0' || *p
> '9'); p
++);
84 for (; *p
>= '0' && *p
<= '9'; p
++);
86 icon
= CreateXpmIcon (iconname
, x
, y
, title
);
88 icon
->filename
= strdup (filename
);
97 void xv_action_icons (void)
101 void *keys
= profile_init_iterator ("Action Icons", profile_name
);
103 xv_dispatch_a_bit ();
105 add_action_icon ("/bin/rm", "+45+100");
106 add_action_icon ("/usr/bin/lpr", "+45+160");
109 while (keys
!= NULL
) {
110 keys
= profile_iterator_next (keys
, &key
, &value
);
111 add_action_icon (key
, value
);