@interface JubGtkRosterUI: OFObject <XMPPRosterDelegate, XMPPConnectionDelegate>
{
+ GtkWidget *roster_window;
GtkTreeStore *roster_model;
GtkTreeModelFilter *roster_filter;
OFMapTable *groupMap;
OFMutableDictionary *chatMap;
OFCountedSet *presences;
XMPPConnection *connection;
- GtkBuilder *builder;
}
-- initWithBuilder: (GtkBuilder*)builder
- connection: (XMPPConnection*)connection;
+- initWithConnection: (XMPPConnection*)connection;
- (JubGtkChatUI*)chatForJID: (XMPPJID*)jid;
@end
}
@implementation JubGtkRosterUI
-- initWithBuilder: (GtkBuilder*)builder_
- connection: (XMPPConnection*)connection_
+- initWithConnection: (XMPPConnection*)connection_
{
self = [super init];
@try {
GtkTreeView *roster_view;
GtkComboBox *presence_combo;
+ GtkBuilder *builder;
groupMap = [[OFMapTable alloc]
initWithKeyFunctions: keyFunctions
presences = [[OFCountedSet alloc] init];
connection = [connection_ retain];
- builder = g_object_ref(builder_);
+ builder = gtk_builder_new();
+ gtk_builder_add_from_file(builder, "data/gtk/roster.ui", NULL);
+ gtk_builder_connect_signals(builder, NULL);
+
+ roster_window =
+ GTK_WIDGET(gtk_builder_get_object(builder, "RosterWindow"));
+
+ gtk_widget_show(roster_window);
roster_model = GTK_TREE_STORE(gtk_builder_get_object(builder,
"RosterTreeStore"));
g_signal_connect(presence_combo, "changed",
G_CALLBACK(presence_changed), connection);
+
+ g_object_unref(G_OBJECT(builder));
} @catch (id e) {
[self release];
@throw e;
{
[groupMap release];
[contactMap release];
+ [chatMap release];
[presences release];
[connection release];
- if (roster_model)
- g_object_unref(roster_model);
-
- if (roster_filter)
- g_object_unref(roster_filter);
-
- g_object_unref(builder);
+ gtk_widget_destroy(roster_window);
[super dealloc];
}
gtk_init(argc, argv);
- builder = gtk_builder_new();
- gtk_builder_add_from_file(builder, "data/gtk/roster.ui", NULL);
-
- rosterUI = [[JubGtkRosterUI alloc] initWithBuilder: builder
- connection: connection];
+ rosterUI = [[JubGtkRosterUI alloc]
+ initWithConnection: connection];
} @catch (id e) {
[self release];
@throw e;
- (void)dealloc
{
[rosterUI release];
- g_object_unref(G_OBJECT(builder));
[super dealloc];
}
- (void)startUIThread
{
- GtkWidget *roster_window;
-
- roster_window =
- GTK_WIDGET(gtk_builder_get_object(builder, "RosterWindow"));
-
- gtk_builder_connect_signals(builder, NULL);
-
- gtk_widget_show(roster_window);
-
[[OFThread threadWithBlock: ^(void){
gtk_main();
[OFApplication terminate];