1 /*
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2, or (at your option)
5 any later version.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 */
16
17 #include <glib.h>
18 #include <gtk/gtk.h>
19 #include "main.h"
20 #include "stock.h"
21 #include "theme_sel.h"
22 #include "font_sel.h"
23 #include "preview_pane.h"
24 #include "about_dialog.h"
25
about_clicked(GtkWidget * widget,gpointer u)26 static void about_clicked(GtkWidget *widget, gpointer u)
27 {
28 show_about_dialog();
29 }
30
apply_clicked(GtkWidget * widget,gpointer u)31 static void apply_clicked(GtkWidget *widget, gpointer u)
32 {
33 apply_new_look(FALSE);
34 }
35
ok_clicked(GtkWidget * widget,gpointer u)36 static void ok_clicked(GtkWidget *widget, gpointer u)
37 {
38 apply_new_look(FALSE);
39 gtk_main_quit();
40 }
41
create_mainwin(void)42 GtkWidget* create_mainwin(void)
43 {
44 GtkWidget *mainwin = gtk_dialog_new();
45 GtkWidget *about_button, *apply_button, *ok_button, *cancel_button;
46 gtk_widget_realize(mainwin);
47 gtk_window_set_title(GTK_WINDOW(mainwin), PROJNAME);
48 gtk_window_set_resizable(GTK_WINDOW(mainwin), TRUE);
49 gtk_window_set_default_size(GTK_WINDOW(mainwin), 360, 450);
50 g_signal_connect(G_OBJECT(mainwin), "destroy", G_CALLBACK(gtk_main_quit), NULL);
51
52 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), create_preview_pane(), FALSE, FALSE, 0);
53 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
54 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), create_theme_sel(), TRUE, TRUE, 0);
55 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
56 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->vbox), create_font_sel(), FALSE, FALSE, 0);
57
58 about_button = gtk_button_new_from_stock(GTK_STOCK_ABOUT);
59 g_signal_connect(G_OBJECT(about_button), "clicked", G_CALLBACK(about_clicked), NULL);
60 gtk_box_pack_end(GTK_BOX(GTK_DIALOG(mainwin)->action_area), about_button, TRUE, TRUE, 0);
61
62 apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
63 g_signal_connect(G_OBJECT(apply_button), "clicked", G_CALLBACK(apply_clicked), NULL);
64 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->action_area), apply_button, TRUE, TRUE, 0);
65 await_activation(apply_button);
66
67 ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);
68 g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(ok_clicked), NULL);
69 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->action_area), ok_button, TRUE, TRUE, 0);
70 await_activation(ok_button);
71
72 cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
73 g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(gtk_main_quit), NULL);
74 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mainwin)->action_area), cancel_button, TRUE, TRUE, 0);
75
76 return mainwin;
77 }
78