2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999,2000 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include <gtk/gtkwindow.h>
26 #include <gtk/gtkvbox.h>
27 #include <gtk/gtkhbox.h>
28 #include <gtk/gtklabel.h>
29 #include <gtk/gtkprogressbar.h>
30 #include <gtk/gtkbutton.h>
33 #include "progressdialog.h"
37 ProgressDialog *progress_dialog_create(void)
39 ProgressDialog *progress;
44 GtkWidget *cancel_btn;
45 GtkWidget *cancel_area;
46 GtkWidget *progressbar;
48 gchar *text[] = {NULL, NULL, NULL};
50 text[1] = _("Account");
51 text[2] = _("Status");
53 debug_print(_("Creating progress dialog...\n"));
54 progress = g_new0(ProgressDialog, 1);
56 window = gtk_window_new(GTK_WINDOW_DIALOG);
57 gtk_widget_set_usize(window, 450, -1);
58 gtk_container_set_border_width(GTK_CONTAINER(window), 8);
59 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
60 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
61 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
63 vbox = gtk_vbox_new(FALSE, 8);
64 gtk_container_add(GTK_CONTAINER(window), vbox);
65 gtk_widget_show(vbox);
67 hbox = gtk_hbox_new(FALSE, 0);
68 gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 8);
69 gtk_widget_show(hbox);
71 label = gtk_label_new("");
72 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8);
73 gtk_widget_show(label);
75 gtkut_button_set_create(&cancel_area, &cancel_btn, _("Cancel"),
76 NULL, NULL, NULL, NULL);
77 gtk_box_pack_end(GTK_BOX(vbox), cancel_area, FALSE, FALSE, 0);
78 gtk_widget_grab_default(cancel_btn);
79 gtk_widget_show_all(cancel_area);
81 progressbar = gtk_progress_bar_new();
82 gtk_box_pack_start(GTK_BOX(vbox), progressbar, FALSE, FALSE, 0);
83 gtk_widget_show(progressbar);
85 clist = gtk_clist_new_with_titles(3, text);
86 gtk_widget_show(clist);
87 gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
88 gtk_widget_set_usize(clist, -1, 120);
89 gtk_clist_set_column_justification(GTK_CLIST(clist), 0,
91 gtk_clist_set_column_width(GTK_CLIST(clist), 0, 16);
92 gtk_clist_set_column_width(GTK_CLIST(clist), 1, 180);
94 progress->window = window;
95 progress->label = label;
96 progress->cancel_btn = cancel_btn;
97 progress->progressbar = progressbar;
98 progress->clist = clist;
103 void progress_dialog_set_label(ProgressDialog *progress, gchar *str)
105 gtk_label_set_text(GTK_LABEL(progress->label), str);
108 void progress_dialog_set_value(ProgressDialog *progress, gfloat value)
110 gtk_progress_set_value(GTK_PROGRESS(progress->progressbar), value);
113 void progress_dialog_set_percentage(ProgressDialog *progress,
116 gtk_progress_set_percentage(GTK_PROGRESS(progress->progressbar),
120 void progress_dialog_destroy(ProgressDialog *progress)
123 gtk_widget_destroy(progress->window);