-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbonbon.c
71 lines (60 loc) · 1.6 KB
/
bonbon.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
63
64
65
66
67
68
69
70
#include "page_connection.h"
#include "page_keyboard.h"
#include "grab_keyboard.h"
#include "preferences.h"
#include "aboutdialog.h"
#include "page_shell.h"
#include "connection.h"
#include "errors.h"
#include "funcs.h"
#include "bonbon.h"
#include "ui.h"
#include <gtk/gtk.h>
#include <string.h>
global_t global;
void show_version()
{
g_print( "Program: %s\n"
"Version: %s\n", PROGRAM_NAME, PROGRAM_VERSION );
}
void show_using()
{
g_print( "Using: bonbon [-v||--version]\n"
"\t-v || --version\tshow bonbon version and exit\n" );
}
int main( int argc, char** argv )
{
if( argc == 2 )
{
if( strcmp( argv[1], "-v" ) == 0 || strcmp( argv[1], "--version" ) == 0 )
{
show_version();
return( SUCCESS );
}
}
else if( argc != 1 )
{
g_print( "Error! Unknown argument: \"%s\"\n", argv[1] );
show_using();
return( SUCCESS );
}
gdk_threads_init();
gtk_init( &argc, &argv );
GtkBuilder* builder = gtk_builder_new();
if( !gtk_builder_add_from_string( builder, ui, -1, &global.error_msg ) ) {
g_warning( "%s\n", global.error_msg->message );
global.error_msg = NULL;
return( BUILDER_LOAD_FAIL );
}
page_connection_bind( builder );
page_keyboard_bind( builder );
page_shell_bind( builder );
grab_window_bind( builder );
preferences_window_bind( builder );
aboutdialog_bind( builder );
gtk_builder_connect_signals( builder, NULL );
show_in_statusbar( READY_MESSAGE );
g_object_unref( builder );
gtk_main();
return( SUCCESS );
}