fio: add minimal gui program
[fio.git] / gfio.c
CommitLineData
ff1f3280
SC
1/*
2 * gfio - gui front end for fio - the flexible io tester
3 *
4 * Copyright (C) 2012 Stephen M. Cameron <stephenmcameron@gmail.com>
5 *
6 * The license below covers all files distributed with fio unless otherwise
7 * noted in the file itself.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23#include <gtk/gtk.h>
24
25struct gui {
26 GtkWidget *window;
27};
28
29static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
30 __attribute__((unused)) gpointer data)
31{
32 gtk_main_quit();
33}
34
35static void init_ui(int *argc, char **argv[], struct gui *ui)
36{
37 gtk_init(argc, argv);
38
39 ui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
40 gtk_window_set_title(GTK_WINDOW(ui->window), "fio");
41 gtk_window_set_default_size(GTK_WINDOW(ui->window), 700, 500);
42
43 g_signal_connect(ui->window, "delete-event", G_CALLBACK (quit_clicked), NULL);
44 g_signal_connect(ui->window, "destroy", G_CALLBACK (quit_clicked), NULL);
45
46 gtk_widget_show_all(ui->window);
47}
48
49int main(int argc, char *argv[])
50{
51 struct gui ui;
52
53 init_ui(&argc, &argv, &ui);
54 gtk_main();
55 return 0;
56}