⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callbacks.c

📁 一个功能全面的电子邮件客户端
💻 C
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: callbacks.c,v 1.12 2001/03/20 22:19:33 ttabner Exp $ * * Copyright (C) 1999-2000 Bynari Inc. * Copyright (C) 2001 Project TradeClient * * LGPL * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library * General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include "puma.h"void puma_die (GtkWidget *widget, gpointer data) {	DIR *d;	struct dirent *di;	char *tmps;	/* Save everything and them kill it */	save_preferences ();	folders_write_index ();	abooks_save_all ();	calendar_save ();	d=opendir ("/tmp/tradeclient");	if (d) {		tmps=(char *)calloc (302, sizeof(char));		while ((di=readdir (d))) {			snprintf (tmps, 300, "/tmp/tradeclient/%s", di->d_name);			unlink (tmps);		}		closedir (d);		free (tmps);		rmdir ("/tmp/tradeclient");	}	g_list_free (message_get_selection ());	if (tm_globs->imap_window) gtk_widget_destroy (tm_globs->imap_window);	gtk_main_quit ();	cleanup ();	abook_destroy_all ();	rule_destroy_all ();	event_destroy_all ();	event_store_destroy_all ();	todo_destroy_all ();	free (tm_globs);}void destroy_ewmd_dialog (GtkWidget *widget, gpointer data) {	GtkWidget *parent=lookup_widget (widget, "dialog1");	gtk_widget_destroy (parent);	if ((int)data==ERROR_DIALOG) {		gtk_main_quit ();	}}void destroy_aboutbox (GtkWidget *widget, gpointer data) {	gtk_widget_destroy (tm_globs->about);	tm_globs->about=NULL;}void activate_aboutbox (GtkWidget *widget, gpointer data) {	if (tm_globs->about==NULL) {		tm_globs->about=create_about_box ();	}	gtk_widget_show (tm_globs->about);}void destroy_new_password_dialog (GtkWidget *widget, gpointer data) {	GtkWidget *dialog=lookup_widget (widget, "enter_password");	if (data!=(void *)0xdeadbeef) {		pipe_child_stat_put (SKIP, "", 0);	}	pipe_data_put( OOOREAD, "", 0 ) ;	gtk_widget_destroy (dialog);}void accept_new_password_dialog (GtkWidget *widget, gpointer data) {	char *passwd=gtk_entry_get_text (GTK_ENTRY (lookup_widget (widget, "entry1")));	PopAccount *acct=tm_globs->curaccount;	if (((acct->flags & REMBER_PASSWORD) == REMBER_PASSWORD) ||	    ((acct->flags & REMBER_PASSWORD_ALWAYS) == REMBER_PASSWORD_ALWAYS)) 		acct->ppasswd=strdup (passwd);	pipe_parent_stat_put (NEWPASSWORD, passwd, strlen (passwd));	destroy_new_password_dialog (widget, (gpointer)0xdeadbeef);}gint do_something (GtkWidget *widget, GdkEvent *event, gpointer data) {    calendar_hide (widget, event, data);	    return TRUE;	}void docsource_destroy (GtkWidget *widget, gpointer data) {	gtk_widget_destroy (lookup_widget (widget, "doc_source"));}void docsource_create (GtkWidget *widget, gpointer data) {	GtkWidget *window;	Message *msg;	char *mesg;	if (tm_globs->msg_selected) {		msg=(Message *)tm_globs->msg_selected;		window=create_doc_source ();		mesg=message_load (folder_seek (folder_seek_by_name (msg->rfolder)), msg);		gtk_text_insert (GTK_TEXT (lookup_widget (window, "source_text")), NULL, NULL, NULL, mesg, -1);		free (mesg);		gtk_signal_connect (GTK_OBJECT (lookup_widget (window, "close_button")), "clicked",												GTK_SIGNAL_FUNC (docsource_destroy), NULL);		gtk_widget_show (window);		}}void message_anti_leak () {	time_t curtime=time(NULL);	Folder *fl=folder_first ();	Message *msg;	while (fl) {		msg=fl->msglst;		while (msg) {			if (msg->texttime!=0)				if (curtime-msg->texttime>=60*2) {#if DEBUG > 1					printf ("deleting cashed message msg->subject=%s\n", msg->subject);#endif					msg->texttime=0;					free (msg->text);					msg->text=NULL;				}			msg=msg->next;		}		fl=fl->next;	}}voidscared_save_all (){#if DEBUG > 4  printf ("I'm scared!!!  I'm saving everything!!!\n");#endif  save_preferences ();  folders_write_index ();  abooks_save_all ();  calendar_save ();}char *get_word (char *s, int c) {        char *t = cut_string (s, ' ', 1, c);        char *w = cut_string (t, ' ', 2, (c - 1));        free (t);        return w;}char *get_month (int m) {	char *w;	switch (m) {		case 1:			w = "January";			break;		case 2:			w = "February";			break;		case 3:			w = "March";			break;		case 4:			w = "April";			break;		case 5:			w = "May";			break;		case 6:			w = "June";			break;		case 7:			w = "July";			break;		case 8:			w = "August";			break;		case 9:			w = "September";			break;		case 10:			w = "October";			break;		case 11:			w = "November";			break;		case 12:			w = "December";			break;		default:			w = NULL;	}	return w;}char *get_year (int y) {	char *s, *w;	if (y > 9) {		s = "20%d";	} else {		s = "200%d";	}	w = (char *)malloc (10 * sizeof (char));	snprintf (w, 10, s, y);	return w;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -