2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 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.
26 #include <gdk/gdkkeysyms.h>
29 #include "manage_window.h"
30 #include "description_window.h"
31 #include "../gtkutils.h"
33 static void description_create (DescriptionWindow *dwindow);
34 static void description_window_key_pressed (GtkWidget *widget,
38 void description_window_create(DescriptionWindow *dwindow)
41 description_create(dwindow);
43 manage_window_set_transient(GTK_WINDOW(dwindow->window));
44 gtk_widget_show(dwindow->window);
46 gtk_widget_hide(dwindow->window);
49 static void description_create(DescriptionWindow * dwindow)
55 GtkWidget *scrolledwin;
59 dwindow->window = gtk_window_new(GTK_WINDOW_DIALOG);
60 gtk_widget_set_usize(dwindow->window,400,450);
62 gtk_window_set_title(GTK_WINDOW(dwindow->window),
63 gettext(dwindow->title));
64 gtk_container_set_border_width(GTK_CONTAINER(dwindow->window), 8);
65 gtk_window_set_position(GTK_WINDOW(dwindow->window), GTK_WIN_POS_CENTER);
66 gtk_window_set_modal(GTK_WINDOW(dwindow->window), TRUE);
67 gtk_window_set_policy(GTK_WINDOW(dwindow->window), FALSE, FALSE, FALSE);
69 /* Check number of lines to be show */
71 for (i = 0; dwindow->symbol_table[i] != NULL; i = i + dwindow->columns) {
75 scrolledwin = gtk_scrolled_window_new(NULL, NULL);
76 gtk_widget_show(scrolledwin);
77 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
79 table = gtk_table_new(sz, dwindow->columns, FALSE);
80 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwin), table);
81 gtk_container_set_border_width(GTK_CONTAINER(table), 4);
83 gtk_table_set_col_spacings(GTK_TABLE(table), 10);
85 for(i = 0; dwindow->symbol_table[i] != NULL; i = i + dwindow->columns) {
86 if(dwindow->symbol_table[i][0] != '\0') {
89 label = gtk_label_new(dwindow->symbol_table[i]);
90 gtk_misc_set_alignment (GTK_MISC(label), 0, 0);
91 gtk_table_attach(GTK_TABLE(table), label,
93 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
96 label = gtk_label_new(gettext(dwindow->symbol_table[i+1]));
97 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
98 gtk_misc_set_alignment (GTK_MISC(label), 0, 0);
99 gtk_table_attach(GTK_TABLE(table), label,
101 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
104 GtkWidget *separator;
106 separator = gtk_hseparator_new();
107 gtk_table_attach(GTK_TABLE(table), separator,
109 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
114 gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
115 NULL, NULL, NULL, NULL);
116 gtk_widget_show(hbbox);
118 vbox = gtk_vbox_new(FALSE, 0);
119 gtk_widget_show(vbox);
120 gtk_container_add(GTK_CONTAINER(dwindow->window), vbox);
121 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(scrolledwin),
123 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbbox),
127 gtk_table_attach_defaults(GTK_TABLE(table), hbbox,
130 gtk_widget_grab_default(ok_btn);
131 gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
132 GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
134 (GTK_OBJECT(dwindow->window), "key_press_event",
135 GTK_SIGNAL_FUNC(description_window_key_pressed),
137 gtk_signal_connect(GTK_OBJECT(dwindow->window), "delete_event",
138 GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
140 gtk_widget_show_all(table);
143 static void description_window_key_pressed(GtkWidget *widget,
147 if (event && event->keyval == GDK_Escape)