Mon Dec 6 21:48:52 PST 1999
(KainX) Dialog for E-Biff too. SVN revision: 1528
This commit is contained in:
parent
9cbe26bb39
commit
7ee92cdd38
|
@ -1433,3 +1433,10 @@ Mon Dec 6 20:18:45 PST 1999
|
|||
(KainX)
|
||||
|
||||
E-Slides now has a full-featured working config dialog. Damn good work, Tom.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Mon Dec 6 21:48:52 PST 1999
|
||||
(KainX)
|
||||
|
||||
Dialog for E-Biff too.
|
||||
|
|
|
@ -1854,7 +1854,7 @@ Epplet_textbox_contents(Epplet_gadget eg)
|
|||
|
||||
g = (GadTextBox *) eg;
|
||||
|
||||
return g->contents;
|
||||
return ((g->contents) ? (g->contents) : "");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
161
epplets/E-Biff.c
161
epplets/E-Biff.c
|
@ -21,6 +21,8 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
static const char cvs_ident[] = "$Id$";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
@ -46,7 +48,9 @@ extern void Epplet_redraw(void);
|
|||
#define BEGMATCH(a, b) (!strncasecmp((a), (b), (sizeof(b) - 1)))
|
||||
#define NONULL(x) ((x) ? (x) : (""))
|
||||
|
||||
Epplet_gadget close_button, mp_button, help_button, nomail, newmail, seven, label;
|
||||
Epplet_gadget close_button, mp_button, cfg_button, nomail, newmail, seven, label;
|
||||
Epplet_gadget cfg_tb_mbox, cfg_tb_mailprog, cfg_tb_interval, cfg_tb_nomail, cfg_tb_newmail, cfg_tb_seven, cfg_tb_sound;
|
||||
Window config_win = None;
|
||||
unsigned long new_cnt, total_cnt;
|
||||
size_t file_size;
|
||||
time_t file_mtime;
|
||||
|
@ -54,7 +58,7 @@ char *folder_path = NULL, *mailprog = MAIL_PROG, *sound = NULL,
|
|||
*nomail_image = NOMAIL_IMAGE, *newmail_image = NEWMAIL_IMAGE,
|
||||
*seven_image = SEVEN_IMAGE;
|
||||
int mp_pid = 0;
|
||||
int beep = 1;
|
||||
int beep = 1, cfg_beep;
|
||||
double interval = 2.0;
|
||||
|
||||
static void mailcheck_cb(void *data);
|
||||
|
@ -63,6 +67,12 @@ static void mailprog_cb(void *data);
|
|||
static void help_cb(void *data);
|
||||
static void in_cb(void *data, Window w);
|
||||
static void out_cb(void *data, Window w);
|
||||
static int delete_cb(void *data, Window win);
|
||||
static void apply_config(void);
|
||||
static void ok_cb(void *data);
|
||||
static void apply_cb(void *data);
|
||||
static void cancel_cb(void *data);
|
||||
static void config_cb(void *data);
|
||||
static void process_conf(void);
|
||||
extern int mbox_folder_count(char *, int);
|
||||
|
||||
|
@ -132,7 +142,7 @@ in_cb(void *data, Window w)
|
|||
if (w == Epplet_get_main_window()) {
|
||||
Epplet_gadget_show(close_button);
|
||||
Epplet_gadget_show(mp_button);
|
||||
Epplet_gadget_show(help_button);
|
||||
Epplet_gadget_show(cfg_button);
|
||||
}
|
||||
return;
|
||||
data = NULL;
|
||||
|
@ -144,12 +154,149 @@ out_cb(void *data, Window w)
|
|||
if (w == Epplet_get_main_window()) {
|
||||
Epplet_gadget_hide(close_button);
|
||||
Epplet_gadget_hide(mp_button);
|
||||
Epplet_gadget_hide(help_button);
|
||||
Epplet_gadget_hide(cfg_button);
|
||||
}
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
delete_cb(void *data, Window win)
|
||||
{
|
||||
config_win = None;
|
||||
return 1;
|
||||
win = (Window) 0;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_config(void)
|
||||
{
|
||||
char buff[1024];
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_mbox));
|
||||
if (strcmp(folder_path, buff)) {
|
||||
Epplet_modify_config("mailbox", buff);
|
||||
folder_path = Epplet_query_config("mailbox");
|
||||
mailcheck_cb(NULL);
|
||||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_interval));
|
||||
if ((interval = atof(buff)) != 0.0) {
|
||||
Epplet_modify_config("interval", buff);
|
||||
} else {
|
||||
interval = atof(Epplet_query_config_def("interval", "2.0"));
|
||||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_mailprog));
|
||||
if (strcmp(mailprog, buff)) {
|
||||
Epplet_modify_config("mailprog", buff);
|
||||
mailprog = Epplet_query_config("mailprog");
|
||||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_newmail));
|
||||
if (strcmp(newmail_image, buff)) {
|
||||
Epplet_modify_config("new_mail_image", buff);
|
||||
newmail_image = Epplet_query_config("new_mail_image");
|
||||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_nomail));
|
||||
if (strcmp(nomail_image, buff)) {
|
||||
Epplet_modify_config("no_mail_image", buff);
|
||||
nomail_image = Epplet_query_config("no_mail_image");
|
||||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_seven));
|
||||
if (strcmp(seven_image, buff)) {
|
||||
Epplet_modify_config("seven_image", buff);
|
||||
newmail_image = Epplet_query_config("seven_image");
|
||||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_sound));
|
||||
if (sound && strlen(buff) && strcmp(sound, buff)) {
|
||||
Epplet_modify_config("sound", buff);
|
||||
sound = Epplet_query_config("sound");
|
||||
}
|
||||
|
||||
if (beep != cfg_beep) {
|
||||
beep = cfg_beep;
|
||||
sprintf(buff, "%d", beep);
|
||||
Epplet_modify_config("beep", buff);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ok_cb(void *data)
|
||||
{
|
||||
Epplet_window_destroy(config_win);
|
||||
config_win = None;
|
||||
apply_config();
|
||||
Epplet_save_config();
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_cb(void *data)
|
||||
{
|
||||
apply_config();
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_cb(void *data)
|
||||
{
|
||||
Epplet_window_destroy(config_win);
|
||||
config_win = None;
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
config_cb(void *data)
|
||||
{
|
||||
char buff[128];
|
||||
|
||||
if (config_win) {
|
||||
return;
|
||||
}
|
||||
|
||||
config_win = Epplet_create_window_config(300, 370, "E-Biff Configuration", ok_cb, NULL, apply_cb, NULL, cancel_cb, NULL);
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(4, 4, "Mailbox path:", 2));
|
||||
Epplet_gadget_show(cfg_tb_mbox = Epplet_create_textbox(NULL, folder_path, 4, 18, 292, 20, 2, NULL, NULL));
|
||||
|
||||
sprintf(buff, "%3.2f", interval);
|
||||
Epplet_gadget_show(Epplet_create_label(4, 50, "Polling interval (seconds):", 2));
|
||||
Epplet_gadget_show(cfg_tb_interval = Epplet_create_textbox(NULL, buff, 4, 64, 292, 20, 2, NULL, NULL));
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(4, 96, "Mail reader command line:", 2));
|
||||
Epplet_gadget_show(cfg_tb_mailprog = Epplet_create_textbox(NULL, mailprog, 4, 110, 292, 20, 2, NULL, NULL));
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(4, 142, "Image to display with new mail:", 2));
|
||||
Epplet_gadget_show(cfg_tb_newmail = Epplet_create_textbox(NULL, newmail_image, 4, 156, 292, 20, 2, NULL, NULL));
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(4, 188, "Image to display with no new mail:", 2));
|
||||
Epplet_gadget_show(cfg_tb_nomail = Epplet_create_textbox(NULL, nomail_image, 4, 202, 292, 20, 2, NULL, NULL));
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(4, 234, "Seven of Nine Image:", 2));
|
||||
Epplet_gadget_show(cfg_tb_seven = Epplet_create_textbox(NULL, seven_image, 4, 248, 292, 20, 2, NULL, NULL));
|
||||
|
||||
Epplet_gadget_show(Epplet_create_label(4, 280, "Sound command for new mail:", 2));
|
||||
Epplet_gadget_show(cfg_tb_sound = Epplet_create_textbox(NULL, sound, 4, 294, 292, 20, 2, NULL, NULL));
|
||||
|
||||
cfg_beep = beep;
|
||||
Epplet_gadget_show(Epplet_create_togglebutton(NULL, NULL, 4, 326, 12, 12, &cfg_beep, NULL, NULL));
|
||||
Epplet_gadget_show(Epplet_create_label(20, 326, "Beep when new mail arrives?", 2));
|
||||
|
||||
Epplet_window_show(config_win);
|
||||
Epplet_window_pop_context();
|
||||
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
process_conf(void) {
|
||||
|
||||
|
@ -199,10 +346,12 @@ main(int argc, char **argv)
|
|||
D(("Generated folder path of \"%s\"\n", folder_path));
|
||||
}
|
||||
Epplet_modify_config("mailbox", folder_path);
|
||||
free(folder_path);
|
||||
folder_path = Epplet_query_config("mailbox");
|
||||
}
|
||||
close_button = Epplet_create_button(NULL, NULL, 2, 2, 0, 0, "CLOSE", 0, NULL, close_cb, NULL);
|
||||
help_button = Epplet_create_button(NULL, NULL, 18, 2, 0, 0, "HELP", 0, NULL, help_cb, NULL);
|
||||
mp_button = Epplet_create_button(NULL, NULL, 34, 2, 0, 0, "CONFIGURE", 0, NULL, mailprog_cb, NULL);
|
||||
cfg_button = Epplet_create_button(NULL, NULL, 18, 2, 0, 0, "CONFIGURE", 0, NULL, config_cb, NULL);
|
||||
mp_button = Epplet_create_button(NULL, NULL, 34, 2, 0, 0, "EJECT", 0, NULL, mailprog_cb, NULL);
|
||||
|
||||
nomail = Epplet_create_image(2, 3, 44, 30, nomail_image);
|
||||
newmail = Epplet_create_image(2, 3, 44, 30, newmail_image);
|
||||
|
|
|
@ -397,7 +397,7 @@ apply_config(void)
|
|||
}
|
||||
|
||||
strcpy(buff, Epplet_textbox_contents(cfg_tb_path));
|
||||
if (strcasecmp(path, buff)) {
|
||||
if (strcmp(path, buff)) {
|
||||
if (get_images(buff)) {
|
||||
free(path);
|
||||
path = strdup(buff);
|
||||
|
@ -410,6 +410,8 @@ apply_config(void)
|
|||
strcpy(buff, Epplet_textbox_contents(cfg_tb_delay));
|
||||
if ((delay = atof(buff)) != 0.0) {
|
||||
Epplet_modify_config("delay", buff);
|
||||
} else {
|
||||
delay = atof(Epplet_query_config_def("delay", "2.0"));
|
||||
}
|
||||
|
||||
zoom_cmd = strdup(Epplet_textbox_contents(cfg_tb_zoom));
|
||||
|
|
Loading…
Reference in New Issue