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

📄 status.c

📁 一个功能全面的电子邮件客户端
💻 C
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: status.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 insert_warning (char *warning, ...) {	va_list ap;	char outstr[1024];        GdkColor colors[2];        gboolean success[2];	GdkColor col1={ 0, 0xAAAA, 0xAAAA, 0x0000 };	GdkColor col2={ 0, 0xFFFF, 0xFFFF, 0xFFFF };	GtkWidget *console=lookup_widget (tm_globs->status, "status");	if (tm_globs->status->window) gdk_window_raise (tm_globs->status->window);	if( !(tm_globs->flags & HIDE_STATUS_WINDOW) ) {#if DEBUG>=7		printf ("flags: %d\n", (int)tm_globs->flags);#endif		show_status (NULL, NULL);	}	va_start (ap, warning);	vsnprintf (outstr, 1024, warning, ap);	va_end (ap);	        colors[0] = col1;        colors[1] = col2;        gdk_colormap_alloc_colors(gdk_colormap_get_system(), colors, 2,          FALSE, TRUE, success);	gtk_text_insert (GTK_TEXT (console), tm_globs->unread_odd->font, &colors[0], &colors[1], outstr, strlen (outstr));        gdk_colormap_free_colors(gdk_colormap_get_system(), colors, 2);}void insert_error (char *error, ...) {	va_list ap;	char outstr[1024];        GdkColor colors[2];        gboolean success[2];	GdkColor col1={ 0, 0xAAAA, 0x0000, 0x0000 };	GdkColor col2={ 0, 0xFFFF, 0xFFFF, 0xFFFF };	GtkWidget *console=lookup_widget (tm_globs->status, "status");        if (tm_globs->status->window) gdk_window_raise (tm_globs->status->window);	show_status (NULL, NULL);	va_start (ap, error);	vsnprintf (outstr, 1024, error, ap);	va_end (ap);        colors[0] = col1;        colors[1] = col2;        gdk_colormap_alloc_colors(gdk_colormap_get_system(), colors, 2,          FALSE, TRUE, success);	gtk_text_insert (GTK_TEXT (console), tm_globs->unread_odd->font, &colors[0], &colors[1], outstr, strlen (outstr));        gdk_colormap_free_colors(gdk_colormap_get_system(), colors, 2);}void insert_message (char *message, ...) {	va_list ap;	char outstr[1024];        GdkColor colors[2];        gboolean success[2];	GdkColor col1={ 0, 0x0000, 0x0000, 0xAAAA };	GdkColor col2={ 0, 0xFFFF, 0xFFFF, 0xFFFF };	GtkWidget *console=lookup_widget (tm_globs->status, "status");	if( !(tm_globs->flags & HIDE_STATUS_WINDOW) ) {#if DEBUG>=7		printf ("flags: %d\n", (int)tm_globs->flags);#endif		show_status (NULL, NULL);	}	va_start (ap, message);	vsnprintf (outstr, 1024, message, ap);	va_end (ap);        colors[0] = col1;        colors[1] = col2;        gdk_colormap_alloc_colors(gdk_colormap_get_system(), colors, 2,          FALSE, TRUE, success);	gtk_text_insert (GTK_TEXT (console), tm_globs->unread_odd->font, &colors[0], &colors[1], outstr, strlen (outstr));        gdk_colormap_free_colors(gdk_colormap_get_system(), colors, 2);}void insert_debug (char *debug, ...) {	va_list ap;	char outstr[1024];        GdkColor colors[2];        gboolean success[2];	GdkColor col1={ 0, 0x0000, 0xAAAA, 0x0000 };	GdkColor col2={ 0, 0xFFFF, 0xFFFF, 0xFFFF };	GtkWidget *console=lookup_widget (tm_globs->status, "status");	if( !(tm_globs->flags & HIDE_STATUS_WINDOW) ) {#if DEBUG>=7		printf ("flags: %d\n", (int)tm_globs->flags);#endif		show_status (NULL, NULL);	}	va_start (ap, debug);	vsnprintf (outstr, 1024, debug, ap);	va_end (ap);        colors[0] = col1;        colors[1] = col2;        gdk_colormap_alloc_colors(gdk_colormap_get_system(), colors, 2,          FALSE, TRUE, success);	gtk_text_insert (GTK_TEXT (console), tm_globs->unread_odd->font, &colors[0], &colors[1], outstr, strlen (outstr));        gdk_colormap_free_colors(gdk_colormap_get_system(), colors, 2);}void set_account_name (char *name) {	GtkWidget *label=lookup_widget (tm_globs->status, "account_name");	gtk_label_set_text (GTK_LABEL (label), name);}void set_receiving (int x, int y) {	GtkWidget *label=lookup_widget (tm_globs->status, "x_of_y");	char *tmpline=(char *)calloc (256, sizeof(char));	snprintf (tmpline, 256, _("receiving message %d of %d"), x, y);	gtk_label_set_text (GTK_LABEL (label), tmpline);	free (tmpline);}void set_progress (int grabbed, int total) {	GtkWidget *widg=lookup_widget (tm_globs->status, "progressbar");	float prog=0;	if (grabbed==0&&total==0){		gtk_progress_bar_update (GTK_PROGRESS_BAR (widg), 0.0);		gtk_progress_set_show_text (GTK_PROGRESS (widg), TRUE);		return;	}	if (grabbed==1&&total==1){		gtk_progress_bar_update (GTK_PROGRESS_BAR (widg), 1.0);		gtk_progress_set_show_text (GTK_PROGRESS (widg), FALSE);		return;	}	if (total!=0) prog=(float)grabbed/(float)total;	if (grabbed>total) grabbed=total;	if (prog>0 && prog<1) 		gtk_progress_bar_update (GTK_PROGRESS_BAR (widg), prog);#if 1        while (gtk_events_pending ())          gtk_main_iteration ();#endif}

⌨️ 快捷键说明

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