]> cgit.babelmonkeys.de Git - jubjub.git/blob - src/gui/gtk/JubGtkUI.m
Build roster window in JubGtkRosterUI
[jubjub.git] / src / gui / gtk / JubGtkUI.m
1 #import <ObjXMPP/ObjXMPP.h>
2 #include <gtk/gtk.h>
3
4 #import "JubGtkUI.h"
5 #import "JubGtkRosterUI.h"
6
7 void on_roster_window_destroy(GObject *object, gpointer user_data)
8 {
9         gtk_main_quit();
10 }
11
12 @implementation JubGtkUI
13 - initWithConnection: (XMPPConnection*)connection
14 {
15         self = [super init];
16
17         @try {
18                 int *argc;
19                 char ***argv;
20
21                 [[OFApplication sharedApplication] getArgumentCount: &argc
22                                                   andArgumentValues: &argv];
23
24                 gtk_init(argc, argv);
25
26                 rosterUI = [[JubGtkRosterUI alloc]
27                     initWithConnection: connection];
28         } @catch (id e) {
29                 [self release];
30                 @throw e;
31         }
32
33         return self;
34 }
35
36 - (void)dealloc
37 {
38         [rosterUI release];
39
40         [super dealloc];
41 }
42
43 - (void)startUIThread
44 {
45         [[OFThread threadWithBlock: ^(void){
46                 gtk_main();
47                 [OFApplication terminate];
48
49                 return nil;
50         }] start];
51 }
52
53 - (id<XMPPRosterDelegate>)rosterDelegate
54 {
55         return rosterUI;
56 }
57 @end