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

📄 message-window.c

📁 一个功能全面的电子邮件客户端
💻 C
📖 第 1 页 / 共 3 页
字号:
  gtk_widget_show (ccline);  gtk_entry_set_editable (GTK_ENTRY (ccline), FALSE);  gtk_table_attach (GTK_TABLE (table2), ccline, 1, 2, 2, 3,                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  subjectline = gtk_entry_new ();  gtk_widget_set_name (subjectline, "subjectline");  gtk_widget_ref (subjectline);  gtk_object_set_data_full (GTK_OBJECT (message), "subjectline", subjectline,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (subjectline);  gtk_entry_set_editable (GTK_ENTRY (subjectline), FALSE);  gtk_table_attach (GTK_TABLE (table2), subjectline, 1, 2, 3, 4,                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  message_pane = gtk_vpaned_new ();  gtk_widget_set_name (message_pane, "message_pane");  gtk_widget_ref (message_pane);  gtk_object_set_data_full (GTK_OBJECT (message), "message_pane", message_pane,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (message_pane);  gtk_box_pack_start (GTK_BOX (vbox8), message_pane, TRUE, TRUE, 0);  gtk_paned_set_handle_size (GTK_PANED (message_pane), 8);  gtk_paned_set_gutter_size (GTK_PANED (message_pane), 9);  gtk_paned_set_position (GTK_PANED (message_pane), tm_globs->ppos.msgw_vp1);  gtk_signal_connect (GTK_OBJECT (message_pane), "size_allocate",                         GTK_SIGNAL_FUNC (ppos_set_msgw), NULL);  scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);  gtk_widget_set_name (scrolledwindow2, "scrolledwindow2");  gtk_widget_ref (scrolledwindow2);  gtk_object_set_data_full (GTK_OBJECT (message), "scrolledwindow2", scrolledwindow2,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (scrolledwindow2);  gtk_container_add (GTK_CONTAINER (message_pane), scrolledwindow2);  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);  messagebody = gtk_text_new (NULL, NULL);  gtk_widget_set_name (messagebody, "messagebody");  gtk_widget_ref (messagebody);  gtk_object_set_data_full (GTK_OBJECT (message), "messagebody", messagebody,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (messagebody);  gtk_container_add (GTK_CONTAINER (scrolledwindow2), messagebody);  frame11 = gtk_frame_new (_("Attachments"));  gtk_widget_set_name (frame11, "frame11");  gtk_widget_ref (frame11);  gtk_object_set_data_full (GTK_OBJECT (message), "frame11", frame11,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (frame11);  gtk_container_add (GTK_CONTAINER (message_pane), frame11);  scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);  gtk_widget_set_name (scrolledwindow3, "scrolledwindow3");  gtk_widget_ref (scrolledwindow3);  gtk_object_set_data_full (GTK_OBJECT (message), "scrolledwindow3", scrolledwindow3,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (scrolledwindow3);  gtk_container_add (GTK_CONTAINER (frame11), scrolledwindow3);  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);  attachment_clist = gtk_clist_new (3);  gtk_widget_set_name (attachment_clist, "attachment_clist");  gtk_widget_ref (attachment_clist);  gtk_object_set_data_full (GTK_OBJECT (message), "attachment_clist", attachment_clist,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (attachment_clist);  gtk_container_add (GTK_CONTAINER (scrolledwindow3), attachment_clist);  gtk_clist_set_column_width (GTK_CLIST (attachment_clist), 0, tm_globs->cpos.msgw[0]);  gtk_clist_set_column_width (GTK_CLIST (attachment_clist), 1, tm_globs->cpos.msgw[1]);  gtk_clist_set_column_width (GTK_CLIST (attachment_clist), 2, tm_globs->cpos.msgw[2]);  gtk_clist_column_titles_show (GTK_CLIST (attachment_clist));  gtk_signal_connect (GTK_OBJECT (attachment_clist), "resize_column",                         GTK_SIGNAL_FUNC (cpos_set_msgw), NULL);  label25 = gtk_label_new (_("Content Type"));  gtk_widget_set_name (label25, "label25");  gtk_widget_ref (label25);  gtk_object_set_data_full (GTK_OBJECT (message), "label25", label25,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (label25);  gtk_clist_set_column_widget (GTK_CLIST (attachment_clist), 0, label25);  label26 = gtk_label_new (_("Filename"));  gtk_widget_set_name (label26, "label26");  gtk_widget_ref (label26);  gtk_object_set_data_full (GTK_OBJECT (message), "label26", label26,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (label26);  gtk_clist_set_column_widget (GTK_CLIST (attachment_clist), 1, label26);  label27 = gtk_label_new (_("Size"));  gtk_widget_set_name (label27, "label27");  gtk_widget_ref (label27);  gtk_object_set_data_full (GTK_OBJECT (message), "label27", label27,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (label27);  gtk_clist_set_column_widget (GTK_CLIST (attachment_clist), 2, label27);  frame9 = gtk_frame_new (NULL);  gtk_widget_set_name (frame9, "frame9");  gtk_widget_ref (frame9);  gtk_object_set_data_full (GTK_OBJECT (message), "frame9", frame9,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (frame9);  gtk_box_pack_start (GTK_BOX (vbox6), frame9, FALSE, FALSE, 0);  gtk_frame_set_shadow_type (GTK_FRAME (frame9), GTK_SHADOW_IN);  label11 = gtk_label_new ("");  gtk_widget_set_name (label11, "label11");  gtk_widget_ref (label11);  gtk_object_set_data_full (GTK_OBJECT (message), "label11", label11,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (label11);  gtk_container_add (GTK_CONTAINER (frame9), label11);  gtk_object_set_data (GTK_OBJECT (message), "tooltips", tooltips);  gtk_window_add_accel_group (GTK_WINDOW (message), accel_group);  return message;}void message_window_connect_signals (GtkWidget *win, char *message) {	GtkWidget *scratch;	scratch = pixmap_widget_create (win, PIXMAP_REPLY);	gtk_widget_show (scratch);	gtk_container_add (GTK_CONTAINER (lookup_widget (win, "replyto")), scratch);	scratch = pixmap_widget_create (win, PIXMAP_REPLYALL);	gtk_widget_show (scratch);	gtk_container_add (GTK_CONTAINER (lookup_widget (win, "replytoall")), scratch);	scratch = pixmap_widget_create (win, PIXMAP_FORWARD);	gtk_widget_show (scratch);	gtk_container_add (GTK_CONTAINER (lookup_widget (win, "forward")), scratch);	scratch = pixmap_widget_create (win, PIXMAP_SAVE);	gtk_widget_show (scratch);	gtk_container_add (GTK_CONTAINER (lookup_widget (win, "saveas")), scratch);	scratch = pixmap_widget_create (win, PIXMAP_PRINT);	gtk_widget_show (scratch);	gtk_container_add (GTK_CONTAINER (lookup_widget (win, "print")), scratch);        gtk_signal_connect (GTK_OBJECT (win), "size_allocate",                            GTK_SIGNAL_FUNC (wsize_set_msgw), NULL);	gtk_signal_connect (GTK_OBJECT (win), "delete_event",	                    GTK_SIGNAL_FUNC (message_window_destroy), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem15")), "activate",	                    GTK_SIGNAL_FUNC (message_window_close), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "replyto")), "clicked",	                    GTK_SIGNAL_FUNC (message_window_replyto), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem2")), "activate",	                    GTK_SIGNAL_FUNC (message_window_replyto), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "replytoall")), "clicked",	                    GTK_SIGNAL_FUNC (message_window_replytoall), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem3")), "activate",	                    GTK_SIGNAL_FUNC (message_window_replytoall), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "forward")), "clicked",	                    GTK_SIGNAL_FUNC (message_window_forward), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem4")), "activate",	                    GTK_SIGNAL_FUNC (message_window_forward), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "saveas")), "clicked",	                    GTK_SIGNAL_FUNC (message_window_save), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem10")), "activate",	                    GTK_SIGNAL_FUNC (message_window_save), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "print")), "clicked",	                    GTK_SIGNAL_FUNC (message_window_print), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem11")), "activate",	                    GTK_SIGNAL_FUNC (message_window_print), (gpointer)message);		gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "attachment_clist")), "select_row",	                    GTK_SIGNAL_FUNC (clicked_on_attachment), (gpointer)message);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "attachment_clist")), "button_press_event",	                    GTK_SIGNAL_FUNC (message_attachment_event), (gpointer)message);		gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem16")), "activate",	                    GTK_SIGNAL_FUNC (puma_die), NULL);	gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "menuitem41")), "activate",	                    GTK_SIGNAL_FUNC (activate_aboutbox), NULL);	clip_handle_editable (lw (win, "fromline"));	clip_handle_editable (lw (win, "toline"));	clip_handle_editable (lw (win, "ccline"));	clip_handle_editable (lw (win, "subjectline"));	clip_handle_editable (lw (win, "messagebody"));}GtkWidget *message_window_new (msg_info *info) {	GtkWidget *win=create_message_window ();	GtkCList *clist=GTK_CLIST (lookup_widget (win, "attachment_clist"));	Attachment *att=(Attachment *)calloc (1, sizeof (Attachment)), *tatt;	Header_Info *hinfo;	char *tmpmsg, *msg=NULL, *cl_data[3], *head;	if (!info)		return NULL;		gtk_window_set_title (GTK_WINDOW (win), info->msg->subject);	tmpmsg=message_load (info->fl, info->msg);	message_window_connect_signals (win, tmpmsg);	head=message_load_head (info->fl, info->msg);	hinfo=parse_header (head);	free (head);	att->mtype=strdup ("dummyatt");	msg=mime_process (tmpmsg, att, 0);	tatt=att->next;	free (att->mtype);	free (att);	att=tatt;	while (att) {		cl_data[0]=att->mtype;		cl_data[1]=att->fname;		cl_data[2]=(char *)calloc (20, 1);		sprintf (cl_data[2], "%d", (int)att->length);		gtk_clist_set_row_data (clist, gtk_clist_append (clist, cl_data), (gpointer)att);		free (cl_data[2]);		att=att->next;	}	if (hinfo->from) gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "fromline")), hinfo->from);	if (hinfo->subject) gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "subjectline")), hinfo->subject);	if (hinfo->to) gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "toline")), hinfo->to);	if (hinfo->cc) gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "ccline")), hinfo->cc);	if ((hinfo->sensitivity)&&(strlen(hinfo->sensitivity))&&(strcmp(hinfo->sensitivity,"Public-Document"))) {		gtk_widget_show (lookup_widget (win, "sens_label"));		gtk_widget_show (lookup_widget (win, "sens_entry"));		gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "sens_entry")), hinfo->sensitivity);	}        if ((hinfo->replyby)&&(strlen(hinfo->replyby))) {                gtk_widget_show (lookup_widget (win, "replyby_label"));                gtk_widget_show (lookup_widget (win, "replyby_entry"));                gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "replyby_entry")), hinfo->replyby);        }        if ((hinfo->expiry)&&(strlen(hinfo->expiry))) {                gtk_widget_show (lookup_widget (win, "expiry_label"));                gtk_widget_show (lookup_widget (win, "expiry_entry"));                gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "expiry_entry")), hinfo->expiry);        }	if (msg) gtk_text_insert (GTK_TEXT (lookup_widget (win, "messagebody")), NULL, NULL,	                 NULL, msg, -1);	destroy_hinfo (hinfo);	free (msg);	gtk_widget_show (win);	return win;}GtkWidget *message_window_new_stream (char *message) {	GtkWidget *win=create_message_window ();	GtkCList *clist=GTK_CLIST (lookup_widget (win, "attachment_clist"));	int hsize=message_hsize (message);	char *head=(char *)calloc (hsize, 1);	Header_Info *hinfo;	char *body, *tmp;	Attachment *att=NULL, *old_att;	char *cl_data[3];		memmove (head, message, hsize);	hinfo=parse_header (head);	free( head ) ;	att=(Attachment *)calloc (1, sizeof (Attachment));	att->mtype=strdup ("dummyatt");	body=mime_process (message, att, 0);	free (att->mtype);	old_att=att;	att=att->next;	free (old_att);	gtk_window_set_title (GTK_WINDOW (win), hinfo->subject);	message_window_connect_signals (win, message);		if (hinfo->from) {		tmp=rm_crlf (hinfo->from);		gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "fromline")), tmp);		free (tmp);	}	if (hinfo->subject) {		tmp=rm_crlf (hinfo->subject);		gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "subjectline")), tmp);		free (tmp);	}	if (hinfo->to) {		tmp=rm_crlf (hinfo->to);		gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "toline")), tmp);		free (tmp);	}	if (hinfo->cc) {		tmp=rm_crlf (hinfo->cc);		gtk_entry_set_text (GTK_ENTRY (lookup_widget (win, "ccline")), tmp);		free (tmp);	}	if (body)		gtk_text_insert (GTK_TEXT (lookup_widget (win, "messagebody")), NULL, NULL,		                 NULL, body, -1);		while (att) {		cl_data[0]=att->mtype;		cl_data[1]=att->fname;		cl_data[2]=(char *)calloc (20, 1);		sprintf (cl_data[2], "%d", (int)att->length);		gtk_clist_set_row_data (clist, gtk_clist_append (clist, cl_data), (gpointer)att);		free (cl_data[2]);		att=att->next;	}	gtk_widget_show (win);	return win;}

⌨️ 快捷键说明

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