📄 status-window.c
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: status-window.c,v 1.13 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"GtkWidget* create_status_window2 (void) { GtkWidget *status_window; GtkWidget *dialog_vbox1; GtkWidget *frame1; GtkWidget *table1; GtkWidget *label1; GtkWidget *label2; GtkWidget *account_name; GtkWidget *x_of_y; GtkWidget *progressbar; GtkWidget *vseparator1; GtkWidget *scrolledwindow1; GtkWidget *status; GtkWidget *dialog_action_area1; GtkWidget *vbox1; GtkWidget *hbox2; GtkWidget *checkbutton1; GtkWidget *hbox3; GtkWidget *checkbutton2; GtkWidget *hseparator1; GtkWidget *hbox1; GtkWidget *skip; GtkWidget *stopthat; status_window = gtk_dialog_new (); gtk_widget_set_name (status_window, "status_window"); gtk_object_set_data (GTK_OBJECT (status_window), "status_window", status_window); gtk_window_set_title (GTK_WINDOW (status_window), _("TradeClient Status")); gtk_window_set_policy (GTK_WINDOW (status_window), TRUE, TRUE, TRUE);#if 0 gtk_widget_set_uposition (status_window, 240, 170);#endif gtk_widget_set_usize(GTK_WIDGET(status_window), 350,300); dialog_vbox1 = GTK_DIALOG (status_window)->vbox; gtk_widget_set_name (dialog_vbox1, "dialog_vbox1"); gtk_object_set_data (GTK_OBJECT (status_window), "dialog_vbox1", dialog_vbox1); gtk_widget_show (dialog_vbox1); frame1 = gtk_frame_new (NULL); gtk_widget_set_name (frame1, "frame1"); gtk_widget_ref (frame1); gtk_object_set_data_full (GTK_OBJECT (status_window), "frame1", frame1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame1, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (frame1), 2); table1 = gtk_table_new (4, 3, FALSE); gtk_widget_set_name (table1, "table1"); gtk_widget_ref (table1); gtk_object_set_data_full (GTK_OBJECT (status_window), "table1", table1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (table1); gtk_container_add (GTK_CONTAINER (frame1), table1); gtk_container_set_border_width (GTK_CONTAINER (table1), 2); label1 = gtk_label_new (_("Current Account")); gtk_widget_set_name (label1, "label1"); gtk_widget_ref (label1); gtk_object_set_data_full (GTK_OBJECT (status_window), "label1", label1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label1); gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); label2 = gtk_label_new (_("Receiving Message")); gtk_widget_set_name (label2, "label2"); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (status_window), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label2); gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0); account_name = gtk_label_new (_("None")); gtk_widget_set_name (account_name, "account_name"); gtk_widget_ref (account_name); gtk_object_set_data_full (GTK_OBJECT (status_window), "account_name", account_name, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (account_name); gtk_table_attach (GTK_TABLE (table1), account_name, 2, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); x_of_y = gtk_label_new (_("Receiving 0 of 0")); gtk_widget_set_name (x_of_y, "x_of_y"); gtk_widget_ref (x_of_y); gtk_object_set_data_full (GTK_OBJECT (status_window), "x_of_y", x_of_y, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (x_of_y); gtk_table_attach (GTK_TABLE (table1), x_of_y, 2, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); progressbar = gtk_progress_bar_new (); gtk_widget_set_name (progressbar, "progressbar"); gtk_widget_ref (progressbar); gtk_object_set_data_full (GTK_OBJECT (status_window), "progressbar", progressbar, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (progressbar); gtk_table_attach (GTK_TABLE (table1), progressbar, 0, 3, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0);#if 0 gtk_progress_set_format_string (GTK_PROGRESS (progressbar), "%P %% (%Pk/s)");#endif vseparator1 = gtk_vseparator_new (); gtk_widget_set_name (vseparator1, "vseparator1"); gtk_widget_ref (vseparator1); gtk_object_set_data_full (GTK_OBJECT (status_window), "vseparator1", vseparator1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vseparator1); gtk_table_attach (GTK_TABLE (table1), vseparator1, 1, 2, 0, 2, (GtkAttachOptions) (0), (GtkAttachOptions) (GTK_FILL), 2, 0); scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_name (scrolledwindow1, "scrolledwindow1"); gtk_widget_ref (scrolledwindow1); gtk_object_set_data_full (GTK_OBJECT (status_window), "scrolledwindow1", scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindow1); gtk_table_attach (GTK_TABLE (table1), scrolledwindow1, 0, 3, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); status = gtk_text_new (NULL, NULL); gtk_widget_set_name (status, "status"); gtk_widget_ref (status); gtk_object_set_data_full (GTK_OBJECT (status_window), "status", status, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (status); gtk_container_add (GTK_CONTAINER (scrolledwindow1), status); gtk_widget_set_usize (status, -2, 146); dialog_action_area1 = GTK_DIALOG (status_window)->action_area; gtk_widget_set_name (dialog_action_area1, "dialog_action_area1"); gtk_object_set_data (GTK_OBJECT (status_window), "dialog_action_area1", dialog_action_area1); gtk_widget_show (dialog_action_area1); gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 5); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (vbox1, "vbox1"); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (status_window), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_box_pack_start (GTK_BOX (dialog_action_area1), vbox1, TRUE, TRUE, 0); hbox2 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox2, "hbox2"); gtk_widget_ref (hbox2); gtk_object_set_data_full (GTK_OBJECT (status_window), "hbox2", hbox2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); checkbutton1 = gtk_check_button_new_with_label (_("Only show this window if there is an error")); gtk_widget_set_name (checkbutton1, "checkbutton1"); gtk_widget_ref (checkbutton1); gtk_object_set_data_full (GTK_OBJECT (status_window), "checkbutton1", checkbutton1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (checkbutton1); gtk_box_pack_start (GTK_BOX (hbox2), checkbutton1, FALSE, FALSE, 0); hbox3 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox3, "hbox3"); gtk_widget_ref (hbox3); gtk_object_set_data_full (GTK_OBJECT (status_window), "hbox3", hbox3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox3); gtk_box_pack_start (GTK_BOX (vbox1), hbox3, TRUE, TRUE, 0); checkbutton2 = gtk_check_button_new_with_label (_("Hide this window when done")); gtk_widget_set_name (checkbutton2, "checkbutton2"); gtk_widget_ref (checkbutton2); gtk_object_set_data_full (GTK_OBJECT (status_window), "checkbutton2", checkbutton2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (checkbutton2); gtk_box_pack_start (GTK_BOX (hbox3), checkbutton2, FALSE, FALSE, 0); hseparator1 = gtk_hseparator_new (); gtk_widget_set_name (hseparator1, "hseparator1"); gtk_widget_ref (hseparator1); gtk_object_set_data_full (GTK_OBJECT (status_window), "hseparator1", hseparator1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hseparator1); gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 0); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_set_name (hbox1, "hbox1"); gtk_widget_ref (hbox1); gtk_object_set_data_full (GTK_OBJECT (status_window), "hbox1", hbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); skip = gtk_button_new_with_label (_("Skip Account")); gtk_widget_set_name (skip, "skip"); gtk_widget_ref (skip); gtk_object_set_data_full (GTK_OBJECT (status_window), "skip", skip, (GtkDestroyNotify) gtk_widget_unref); /* not now gtk_widget_show (skip); */ gtk_box_pack_start (GTK_BOX (hbox1), skip, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (skip), 2); stopthat = gtk_button_new_with_label (_("Stop Transaction")); gtk_widget_set_name (stopthat, "stopthat"); gtk_widget_ref (stopthat); gtk_object_set_data_full (GTK_OBJECT (status_window), "stopthat", stopthat, (GtkDestroyNotify) gtk_widget_unref); /* not now gtk_widget_show (stopthat); */ gtk_box_pack_start (GTK_BOX (hbox1), stopthat, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (stopthat), 2); return status_window;}GtkWidget *create_status_window () { GtkWidget *win=create_status_window2 (); gtk_widget_set_sensitive (lookup_widget (win, "stopthat"), FALSE); gtk_widget_set_sensitive (lookup_widget (win, "skip"), FALSE); gtk_signal_connect (GTK_OBJECT (win), "delete_event", GTK_SIGNAL_FUNC (destroy_status), NULL); gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "stopthat")), "clicked", GTK_SIGNAL_FUNC (stop_transaction_clicked), NULL); gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "skip")), "clicked", GTK_SIGNAL_FUNC (skip_account_clicked), NULL); gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "checkbutton1")), "toggled", GTK_SIGNAL_FUNC (status_toggle_error_only), NULL); gtk_signal_connect (GTK_OBJECT (lookup_widget (win, "checkbutton2")), "toggled", GTK_SIGNAL_FUNC (status_toggle_hide_when_done), NULL); if (tm_globs->flags & HIDE_STATUS_WINDOW) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (win, "checkbutton1")), TRUE); } if (tm_globs->flags & HIDE_STATUS_WHEN_DONE) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (win, "checkbutton2")), TRUE); } return win;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -