📄 new-message.c
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: new-message.c,v 1.16 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"Messages *messages=NULL;void destroy_message (Message *message) { Folder *folder=folder_seek (folder_seek_by_name (message->rfolder)); Folder *vfolder; char *temp=(char *)calloc (5, sizeof(char)); GtkWidget *body=lookup_widget (tm_globs->main_window, "message_body"); if (message) { if (message->folder) { vfolder=folder_seek (folder_seek_by_name (message->folder)); } else { vfolder=folder; } gtk_text_set_point (GTK_TEXT (body), 0); gtk_text_forward_delete (GTK_TEXT (body), gtk_text_get_length (GTK_TEXT(body)));/* if ((message->flags & MESSAGE_READ)==MESSAGE_READ) { vfolder->total--; } else { vfolder->unread--; vfolder->total--; } snprintf (temp, 5, "%d", vfolder->unread); gtk_ctree_node_set_text (GTK_CTREE (ctree), vfolder->tree_item, 1, temp); snprintf (temp, 5, "%d", vfolder->total); gtk_ctree_node_set_text (GTK_CTREE (ctree), vfolder->tree_item, 2, temp);*/ free (temp); message_delete (folder, message->id); }}void message_clist_set_style (GtkWidget *clist, int row, MessageStyle styletype) { switch (styletype) { case STYLE_UNREAD_EVEN: gtk_clist_set_cell_style (GTK_CLIST (clist), row, 0, tm_globs->unread_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 1, tm_globs->unread_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 2, tm_globs->unread_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 3, tm_globs->unread_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 4, tm_globs->unread_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 5, tm_globs->unread_even); break; case STYLE_UNREAD_ODD: gtk_clist_set_cell_style (GTK_CLIST (clist), row, 0, tm_globs->unread_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 1, tm_globs->unread_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 2, tm_globs->unread_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 3, tm_globs->unread_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 4, tm_globs->unread_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 5, tm_globs->unread_odd); break; case STYLE_READ_EVEN: gtk_clist_set_cell_style (GTK_CLIST (clist), row, 0, tm_globs->read_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 1, tm_globs->read_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 2, tm_globs->read_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 3, tm_globs->read_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 4, tm_globs->read_even); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 5, tm_globs->read_even); break; case STYLE_READ_ODD: gtk_clist_set_cell_style (GTK_CLIST (clist), row, 0, tm_globs->read_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 1, tm_globs->read_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 2, tm_globs->read_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 3, tm_globs->read_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 4, tm_globs->read_odd); gtk_clist_set_cell_style (GTK_CLIST (clist), row, 5, tm_globs->read_odd); break; }}void message_clist_reset_shading (GtkWidget *clist) { msg_info *info; int i; if( GTK_IS_CLIST( clist ) ) { gtk_clist_freeze (GTK_CLIST (clist)); for( i=0 ; i < GTK_CLIST(clist)->rows ; i++ ) { info = gtk_clist_get_row_data( GTK_CLIST(clist), i ) ; if( info ) { info -> row = i ; folder_shade_row( GTK_CLIST(clist), i, i, info -> msg -> flags & MESSAGE_UNREAD, info->msg->sensitivity ) ; } } gtk_clist_thaw( GTK_CLIST( clist ) ) ; } return ;}void create_new_message (Folder *folder, Message *msg) { GtkWidget *message_clist=lookup_widget (tm_globs->main_window, "message_clist"); GtkWidget *ctree=lookup_widget (tm_globs->main_window, "folder_tree"); char temp[5] ; int row; msg_info *info; char *clist_data[6]; if (tm_globs->visable==folder) { info=(msg_info *)calloc (1, sizeof(msg_info)); info->msg=msg; info->fl=folder; clist_data[0]=NULL; if (msg->priority) clist_data[1]=strdup (msg->priority); else clist_data[1]=NULL; if (msg->subject) clist_data[2]=strdup (msg->subject); else clist_data[2]=NULL; if (msg->from) clist_data[3]=strdup (msg->from); else clist_data[3]=NULL; if( msg->date ) clist_data[4]=strdup(msg->date); if( msg->time ) clist_data[5]=strdup (ctime (&msg->time)); else { msg -> time = time( NULL ) ; clist_data[5]=strdup (ctime (&msg->time)); } row=gtk_clist_prepend (GTK_CLIST (message_clist), clist_data); info->row=row; gtk_clist_set_row_data (GTK_CLIST (message_clist), row, (gpointer)info); message_clist_reset_shading (message_clist); if (clist_data [0]) free (clist_data[0]); if (clist_data [1]) free (clist_data[1]); if (clist_data [2]) free (clist_data[2]); if (clist_data [3]) free (clist_data[3]); if (clist_data [4]) free (clist_data[4]); if (clist_data [5]) free (clist_data[5]); } snprintf (temp, 5, "%d", folder->unread); gtk_ctree_node_set_text (GTK_CTREE (ctree), folder->tree_item, 1, temp); snprintf (temp, 5, "%d", folder->total); gtk_ctree_node_set_text (GTK_CTREE (ctree), folder->tree_item, 2, temp); return ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -