-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.c
62 lines (52 loc) · 2 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Screentest - CRT/LCD monitor testing utility.
* https://tobix.github.io/screentest/
* Copyright (C) 2001 Jan "Yenya" Kasprzak <[email protected]>
* Copyright (C) 2006-2017 Tobias Gruetzmacher <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU 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 <config.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include "gettext.h"
#include "main.h"
#define _(String) gettext(String)
GtkBuilder *builder;
int main(int argc, char *argv[]) {
guint err;
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
gtk_init(&argc, &argv);
builder = gtk_builder_new();
err = gtk_builder_add_from_file(builder, DATADIR "/screentest/screentest.ui",
NULL);
if (err == 0)
err = gtk_builder_add_from_file(builder, "screentest.ui", NULL);
if (err == 0) {
GtkWidget *dialog = gtk_message_dialog_new(
NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("The interface definition file was not found.\n"
"Please make sure this program is installed correctly."));
gtk_window_set_title(GTK_WINDOW(dialog), PACKAGE_NAME);
gtk_dialog_run(GTK_DIALOG(dialog));
exit(1);
}
gtk_builder_connect_signals(builder, NULL);
gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(builder, "mainwin")));
gtk_main();
return 0;
}