From 62fb875be3885fcecbed4f614f01975cd200c9c8 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Sat, 16 Feb 2013 13:47:28 +0100 Subject: [PATCH] Prefix ivars with an underscore --- src/core/JubChatClient.h | 14 ++-- src/core/JubChatClient.m | 82 +++++++++++------------ src/core/JubConfig.h | 6 +- src/core/JubConfig.m | 23 +++---- src/core/main.m | 20 +++--- src/gui/gtk/JubGtkChatUI.h | 12 ++-- src/gui/gtk/JubGtkChatUI.m | 66 +++++++++---------- src/gui/gtk/JubGtkRosterUI.h | 16 ++--- src/gui/gtk/JubGtkRosterUI.m | 123 ++++++++++++++++++----------------- src/gui/gtk/JubGtkUI.h | 2 +- src/gui/gtk/JubGtkUI.m | 6 +- 11 files changed, 186 insertions(+), 184 deletions(-) diff --git a/src/core/JubChatClient.h b/src/core/JubChatClient.h index c6a1da8..79884f8 100644 --- a/src/core/JubChatClient.h +++ b/src/core/JubChatClient.h @@ -7,13 +7,13 @@ @interface JubChatClient : OFObject { - OFMutableDictionary *chatMap; - XMPPConnection *connection; - XMPPRoster *roster; - XMPPStreamManagement *streamManagement; - XMPPContactManager *contactManager; - XMPPPresence *presence; - id ui; + OFMutableDictionary *_chatMap; + XMPPConnection *_connection; + XMPPRoster *_roster; + XMPPStreamManagement *_streamManagement; + XMPPContactManager *_contactManager; + XMPPPresence *_presence; + id _ui; } @property (readonly) XMPPConnection *connection; @property (readonly) XMPPRoster *roster; diff --git a/src/core/JubChatClient.m b/src/core/JubChatClient.m index 3c563f5..9acdf39 100644 --- a/src/core/JubChatClient.m +++ b/src/core/JubChatClient.m @@ -1,37 +1,37 @@ #import "JubChatClient.h" @implementation JubChatClient -@synthesize connection; -@synthesize roster; -@synthesize contactManager; -@synthesize presence; -@synthesize ui; +@synthesize connection = _connection; +@synthesize roster = _roster; +@synthesize contactManager = _contactManager; +@synthesize presence = _presence; +@synthesize ui = _ui; - initWithConfig: (JubConfig*)config { self = [super init]; @try { - chatMap = [[OFMutableDictionary alloc] init]; + _chatMap = [[OFMutableDictionary alloc] init]; - connection = [XMPPConnection new]; - connection.username = config.username; - connection.domain = config.domain; - connection.server = config.server; - connection.password = config.password; - [connection addDelegate: self]; + _connection = [XMPPConnection new]; + _connection.username = config.username; + _connection.domain = config.domain; + _connection.server = config.server; + _connection.password = config.password; + [_connection addDelegate: self]; - roster = [[XMPPRoster alloc] initWithConnection: connection]; - [roster addDelegate: self]; + _roster = [[XMPPRoster alloc] initWithConnection: _connection]; + [_roster addDelegate: self]; - contactManager = [[XMPPContactManager alloc] - initWithConnection: connection - roster: roster]; + _contactManager = [[XMPPContactManager alloc] + initWithConnection: _connection + roster: _roster]; - streamManagement = [[XMPPStreamManagement alloc] - initWithConnection: connection]; + _streamManagement = [[XMPPStreamManagement alloc] + initWithConnection: _connection]; - [connection asyncConnectAndHandle]; + [_connection asyncConnectAndHandle]; } @catch (id e) { [self release]; @throw e; @@ -42,12 +42,12 @@ - (void)dealloc { - [roster release]; - [contactManager release]; - [streamManagement release]; - [connection release]; - [presence release]; - [chatMap release]; + [_roster release]; + [_contactManager release]; + [_streamManagement release]; + [_connection release]; + [_presence release]; + [_chatMap release]; [super dealloc]; } @@ -57,27 +57,27 @@ OFAutoreleasePool *pool = [OFAutoreleasePool new]; OFString *bareJID = [contact.rosterItem.JID bareJID]; - id chat = [chatMap objectForKey: bareJID]; + id chat = [_chatMap objectForKey: bareJID]; if (chat == nil) { OFString * title = [@"Chat with " stringByAppendingString: bareJID]; - chat = [[[[ui chatUIClass] alloc] + chat = [[[[_ui chatUIClass] alloc] initWithTitle: title closeBlock: ^{ - [chatMap removeObjectForKey: bareJID]; + [_chatMap removeObjectForKey: bareJID]; } sendBlock: ^(OFString *text) { XMPPMessage *msg = [XMPPMessage messageWithType: @"chat"]; msg.body = text; [contact sendMessage: msg - connection: connection]; + connection: _connection]; } ] autorelease]; - [chatMap setObject: chat - forKey: bareJID]; + [_chatMap setObject: chat + forKey: bareJID]; } [pool release]; @@ -85,21 +85,21 @@ return chat; } -- (void)connection: (XMPPConnection*)connection_ +- (void)connection: (XMPPConnection*)connection wasBoundToJID: (XMPPJID*)jid { of_log(@"Bound to JID: %@", [jid fullJID]); - [roster requestRoster]; + [_roster requestRoster]; } -- (void)connection: (XMPPConnection*)connection_ - didReceivePresence: (XMPPPresence*)presence_ +- (void)connection: (XMPPConnection*)connection + didReceivePresence: (XMPPPresence*)presence { - if ([presence_.from isEqual: connection.JID]) { - [ui client: self - didChangePresence: presence_]; - OF_SETTER(presence, presence_, YES, 0); + if ([presence.from isEqual: connection.JID]) { + [_ui client: self + didChangePresence: presence]; + OF_SETTER(_presence, presence, YES, 0); } } @@ -107,6 +107,6 @@ { XMPPPresence *pres = [XMPPPresence presence]; [pres setStatus: @"Hello from JubJub"]; - [connection sendStanza: pres]; + [_connection sendStanza: pres]; } @end diff --git a/src/core/JubConfig.h b/src/core/JubConfig.h index 8e8e6ae..ab4b0bb 100644 --- a/src/core/JubConfig.h +++ b/src/core/JubConfig.h @@ -4,9 +4,9 @@ @interface JubConfig : OFObject { - OFString *domain, *server; - OFString *username; - OFString *password; + OFString *_domain, *_server; + OFString *_username; + OFString *_password; } @property (readonly) OFString *domain, *server; @property (readonly) OFString *username; diff --git a/src/core/JubConfig.m b/src/core/JubConfig.m index a3f1196..b8a5f5a 100644 --- a/src/core/JubConfig.m +++ b/src/core/JubConfig.m @@ -1,9 +1,10 @@ #import "JubConfig.h" @implementation JubConfig -@synthesize domain, server; -@synthesize username; -@synthesize password; +@synthesize domain = _domain; +@synthesize server = _server;; +@synthesize username = _username; +@synthesize password = _password; - initWithFile: (OFString*)file { @@ -22,16 +23,16 @@ // TODO: Add error handling for missing elements of_log(@"Parsed file: %@", element); - domain = [[[element + _domain = [[[element elementForName: @"domain" namespace: CONFIG_NS] stringValue] copy]; - server = [[[element + _server = [[[element elementForName: @"server" namespace: CONFIG_NS] stringValue] copy]; - username = [[[element + _username = [[[element elementForName: @"username" namespace: CONFIG_NS] stringValue] copy]; - password = [[[element + _password = [[[element elementForName: @"password" namespace: CONFIG_NS] stringValue] copy]; @@ -46,10 +47,10 @@ - (void)dealloc { - [domain release]; - [server release]; - [username release]; - [password release]; + [_domain release]; + [_server release]; + [_username release]; + [_password release]; [super dealloc]; } diff --git a/src/core/main.m b/src/core/main.m index 229e6c5..459a15c 100644 --- a/src/core/main.m +++ b/src/core/main.m @@ -7,8 +7,8 @@ @interface AppDelegate: OFObject { - JubChatClient *client; - id ui; + JubChatClient *_client; + id _ui; } @end @@ -20,29 +20,29 @@ OF_APPLICATION_DELEGATE(AppDelegate) JubConfig *config = [[[JubConfig alloc] initWithFile: @"config.xml"] autorelease]; - client = [[JubChatClient alloc] initWithConfig: config]; + _client = [[JubChatClient alloc] initWithConfig: config]; - ui = [[JubGtkUI alloc] initWithClient: client]; + _ui = [[JubGtkUI alloc] initWithClient: _client]; - client.ui = ui; - [client.connection addDelegate: self]; + _client.ui = _ui; + [_client.connection addDelegate: self]; - [ui startUIThread]; + [_ui startUIThread]; } -- (void)connection: (XMPPConnection*)conn +- (void)connection: (XMPPConnection*)connection didReceiveElement: (OFXMLElement*)element { of_log(@"In: %@", element); } -- (void)connection: (XMPPConnection*)conn +- (void)connection: (XMPPConnection*)connection didSendElement: (OFXMLElement*)element { of_log(@"Out: %@", element); } -- (void)connection: (XMPPConnection*)connection_ +- (void)connection: (XMPPConnection*)connection didThrowException: (id)e { @throw e; diff --git a/src/gui/gtk/JubGtkChatUI.h b/src/gui/gtk/JubGtkChatUI.h index 37e47ff..4694d3f 100644 --- a/src/gui/gtk/JubGtkChatUI.h +++ b/src/gui/gtk/JubGtkChatUI.h @@ -6,11 +6,11 @@ @interface JubGtkChatUI: OFObject { - GtkWidget *chat_window; - GtkTextView *chat_view; - GtkTextBuffer *chat_buffer; - jub_send_block_t sendBlock; - jub_close_block_t closeBlock; - BOOL bufferEmpty; + GtkWidget *_chat_window; + GtkTextView *_chat_view; + GtkTextBuffer *_chat_buffer; + jub_send_block_t _sendBlock; + jub_close_block_t _closeBlock; + BOOL _bufferEmpty; } @end diff --git a/src/gui/gtk/JubGtkChatUI.m b/src/gui/gtk/JubGtkChatUI.m index 7db4aef..975a08d 100644 --- a/src/gui/gtk/JubGtkChatUI.m +++ b/src/gui/gtk/JubGtkChatUI.m @@ -36,19 +36,19 @@ static void call_close_block(GtkWidget *object, gpointer data) @implementation JubGtkChatUI - initWithTitle: (OFString*)title - closeBlock: (jub_close_block_t)closeBlock_ - sendBlock: (jub_send_block_t)sendBlock_ + closeBlock: (jub_close_block_t)closeBlock + sendBlock: (jub_send_block_t)sendBlock { self = [super init]; @try { __block volatile BOOL initialized = NO; - __block GtkWidget *chat_window_; - __block GtkTextBuffer *chat_buffer_; + __block GtkWidget *chat_window; + __block GtkTextBuffer *chat_buffer; - closeBlock = [closeBlock_ copy]; - sendBlock = [sendBlock_ copy]; - bufferEmpty = YES; + _closeBlock = [closeBlock copy]; + _sendBlock = [sendBlock copy]; + _bufferEmpty = YES; g_idle_add_block(^{ GtkEntry *chat_entry; @@ -57,15 +57,15 @@ static void call_close_block(GtkWidget *object, gpointer data) gtk_builder_add_from_file(builder, "data/gtk/chat.ui", NULL); - chat_window_ = GTK_WIDGET( + chat_window = GTK_WIDGET( gtk_builder_get_object(builder, "ChatWindow")); - g_signal_connect(chat_window_, "destroy", + g_signal_connect(chat_window, "destroy", G_CALLBACK(call_close_block), closeBlock); - chat_view = GTK_TEXT_VIEW( + _chat_view = GTK_TEXT_VIEW( gtk_builder_get_object(builder, "ChatTextView")); - chat_buffer_ = gtk_text_view_get_buffer(chat_view); - gtk_text_buffer_create_tag(chat_buffer_, "bold", + chat_buffer = gtk_text_view_get_buffer(_chat_view); + gtk_text_buffer_create_tag(chat_buffer, "bold", "weight", PANGO_WEIGHT_BOLD, NULL); chat_entry = GTK_ENTRY( @@ -77,9 +77,9 @@ static void call_close_block(GtkWidget *object, gpointer data) g_signal_connect(chat_entry, "key_release_event", G_CALLBACK(call_send_block), send_params); - gtk_window_set_title(GTK_WINDOW(chat_window_), + gtk_window_set_title(GTK_WINDOW(chat_window), [title UTF8String]); - gtk_widget_show(chat_window_); + gtk_widget_show(chat_window); initialized = YES; @@ -88,8 +88,8 @@ static void call_close_block(GtkWidget *object, gpointer data) while (!initialized); - chat_buffer = chat_buffer_; - chat_window = chat_window_; + _chat_buffer = chat_buffer; + _chat_window = chat_window; } @catch (id e) { [self release]; @throw e; @@ -100,9 +100,9 @@ static void call_close_block(GtkWidget *object, gpointer data) - (void)dealloc { - gtk_widget_destroy(chat_window); - [sendBlock release]; - [closeBlock release]; + gtk_widget_destroy(_chat_window); + [_sendBlock release]; + [_closeBlock release]; [super dealloc]; } @@ -110,29 +110,29 @@ static void call_close_block(GtkWidget *object, gpointer data) - (void)addMessage: (OFString*)text sender: (OFString*)sender { - BOOL first = bufferEmpty; - if (OF_UNLIKELY(bufferEmpty)) bufferEmpty = NO; + BOOL first = _bufferEmpty; + if (OF_UNLIKELY(_bufferEmpty)) _bufferEmpty = NO; g_idle_add_block(^{ GtkTextIter end_iter; GtkTextMark *insert_mark = - gtk_text_buffer_get_insert(chat_buffer); + gtk_text_buffer_get_insert(_chat_buffer); if (OF_LIKELY(!first)) - gtk_text_buffer_insert_at_cursor(chat_buffer, "\n", 1); + gtk_text_buffer_insert_at_cursor(_chat_buffer, "\n", 1); - gtk_text_buffer_get_end_iter(chat_buffer, &end_iter); - gtk_text_buffer_insert_with_tags_by_name(chat_buffer, &end_iter, - [sender UTF8String], [sender UTF8StringLength], "bold", - NULL); - gtk_text_buffer_get_end_iter(chat_buffer, &end_iter); - gtk_text_buffer_insert_with_tags_by_name(chat_buffer, &end_iter, - ": ", 2, "bold", NULL); + gtk_text_buffer_get_end_iter(_chat_buffer, &end_iter); + gtk_text_buffer_insert_with_tags_by_name(_chat_buffer, + &end_iter, [sender UTF8String], [sender UTF8StringLength], + "bold", NULL); + gtk_text_buffer_get_end_iter(_chat_buffer, &end_iter); + gtk_text_buffer_insert_with_tags_by_name(_chat_buffer, + &end_iter, ": ", 2, "bold", NULL); - gtk_text_buffer_insert_at_cursor(chat_buffer, [text UTF8String], - [text UTF8StringLength]); + gtk_text_buffer_insert_at_cursor(_chat_buffer, + [text UTF8String], [text UTF8StringLength]); - gtk_text_view_scroll_to_mark(chat_view, insert_mark, 0, + gtk_text_view_scroll_to_mark(_chat_view, insert_mark, 0, FALSE, 0, 0); }); } diff --git a/src/gui/gtk/JubGtkRosterUI.h b/src/gui/gtk/JubGtkRosterUI.h index 4f3d7ac..40214f7 100644 --- a/src/gui/gtk/JubGtkRosterUI.h +++ b/src/gui/gtk/JubGtkRosterUI.h @@ -8,14 +8,14 @@ @interface JubGtkRosterUI: OFObject { - GtkWidget *roster_window; - GtkTreeStore *roster_model; - GtkTreeModelFilter *roster_filter; - GtkComboBox *presence_combo; - gulong presence_combo_changed_handler_id; - OFMapTable *groupMap; - OFMutableDictionary *contactMap; - JubChatClient *client; + GtkWidget *_roster_window; + GtkTreeStore *_roster_model; + GtkTreeModelFilter *_roster_filter; + GtkComboBox *_presence_combo; + gulong _presence_combo_changed_handler_id; + OFMapTable *_groupMap; + OFMutableDictionary *_contactMap; + JubChatClient *_client; } - initWithClient: (JubChatClient*)client; diff --git a/src/gui/gtk/JubGtkRosterUI.m b/src/gui/gtk/JubGtkRosterUI.m index 901da50..99e5144 100644 --- a/src/gui/gtk/JubGtkRosterUI.m +++ b/src/gui/gtk/JubGtkRosterUI.m @@ -73,7 +73,7 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, } @implementation JubGtkRosterUI -- initWithClient: (JubChatClient*)client_ +- initWithClient: (JubChatClient*)client { self = [super init]; @@ -81,30 +81,30 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, GtkTreeView *roster_view; GtkBuilder *builder; - groupMap = [[OFMapTable alloc] + _groupMap = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions valueFunctions: rowRefFunctions]; - contactMap = [[OFMutableDictionary alloc] init]; - client = [client_ retain]; + _contactMap = [[OFMutableDictionary alloc] init]; + _client = [client retain]; - [client.contactManager addDelegate: self]; + [_client.contactManager addDelegate: self]; builder = gtk_builder_new(); gtk_builder_add_from_file(builder, "data/gtk/roster.ui", NULL); gtk_builder_connect_signals(builder, NULL); - roster_window = + _roster_window = GTK_WIDGET(gtk_builder_get_object(builder, "RosterWindow")); - gtk_widget_show(roster_window); + gtk_widget_show(_roster_window); - roster_model = GTK_TREE_STORE(gtk_builder_get_object(builder, + _roster_model = GTK_TREE_STORE(gtk_builder_get_object(builder, "RosterTreeStore")); - roster_filter = GTK_TREE_MODEL_FILTER( + _roster_filter = GTK_TREE_MODEL_FILTER( gtk_builder_get_object(builder, "RosterTreeModelFilter")); - gtk_tree_model_filter_set_visible_func(roster_filter, + gtk_tree_model_filter_set_visible_func(_roster_filter, filter_roster_by_presence, NULL, NULL); roster_view = GTK_TREE_VIEW(gtk_builder_get_object(builder, @@ -113,11 +113,11 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, g_signal_connect(roster_view, "row_activated", G_CALLBACK(roster_row_activated), client); - presence_combo = GTK_COMBO_BOX(gtk_builder_get_object(builder, + _presence_combo = GTK_COMBO_BOX(gtk_builder_get_object(builder, "PresenceComboBox")); - presence_combo_changed_handler_id = - g_signal_connect(presence_combo, "changed", + _presence_combo_changed_handler_id = + g_signal_connect(_presence_combo, "changed", G_CALLBACK(presence_changed), client.connection); g_object_unref(G_OBJECT(builder)); @@ -131,12 +131,12 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, - (void)dealloc { - [client.contactManager removeDelegate: self]; - [groupMap release]; - [contactMap release]; - [client release]; + [_client.contactManager removeDelegate: self]; + [_groupMap release]; + [_contactMap release]; + [_client release]; - gtk_widget_destroy(roster_window); + gtk_widget_destroy(_roster_window); [super dealloc]; } @@ -147,7 +147,7 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, if (message.body == nil || ![message.type isEqual: @"chat"]) return; - id chat = [client chatForContact: contact]; + id chat = [_client chatForContact: contact]; [chat addMessage: message.body sender: [message.from bareJID]]; } @@ -163,63 +163,64 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, OFString *bareJID = [item.JID bareJID]; OFMapTable *contactRows; - if (!(contactRows = [contactMap objectForKey: bareJID])) { + if (!(contactRows = [_contactMap objectForKey: bareJID])) { contactRows = [OFMapTable mapTableWithKeyFunctions: keyFunctions valueFunctions: rowRefFunctions]; - [contactMap setObject: contactRows - forKey: bareJID]; + [_contactMap setObject: contactRows + forKey: bareJID]; } - group_ref = [groupMap valueForKey: group]; + group_ref = [_groupMap valueForKey: group]; if (!group_ref) { // Create new group row - gtk_tree_store_append(roster_model, &group_iter, NULL); - gtk_tree_store_set(roster_model, &group_iter, + gtk_tree_store_append(_roster_model, &group_iter, NULL); + gtk_tree_store_set(_roster_model, &group_iter, 0, [group UTF8String], -1); group_path = gtk_tree_model_get_path(GTK_TREE_MODEL( - roster_model), &group_iter); + _roster_model), &group_iter); group_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL( - roster_model), group_path); + _roster_model), group_path); - [groupMap setValue: group_ref - forKey: group]; + [_groupMap setValue: group_ref + forKey: group]; } else { // Get iter for existing group row group_path = gtk_tree_row_reference_get_path(group_ref); - gtk_tree_model_get_iter(GTK_TREE_MODEL(roster_model), + gtk_tree_model_get_iter(GTK_TREE_MODEL(_roster_model), &group_iter, group_path); } gtk_tree_path_free(group_path); // Create new contact row - gtk_tree_store_append(roster_model, &contact_iter, &group_iter); + gtk_tree_store_append(_roster_model, &contact_iter, + &group_iter); if (item.name) - gtk_tree_store_set(roster_model, &contact_iter, + gtk_tree_store_set(_roster_model, &contact_iter, 0, [item.name UTF8String], 1, [bareJID UTF8String], 2, "unavailable", -1); else if (item.JID.node) - gtk_tree_store_set(roster_model, &contact_iter, + gtk_tree_store_set(_roster_model, &contact_iter, 0, [item.JID.node UTF8String], 1, [bareJID UTF8String], 2, "unavailable", -1); else - gtk_tree_store_set(roster_model, &contact_iter, + gtk_tree_store_set(_roster_model, &contact_iter, 0, [item.JID.domain UTF8String], 1, [bareJID UTF8String], 2, "unavailable", -1); contact_path = gtk_tree_model_get_path(GTK_TREE_MODEL( - roster_model), &contact_iter); + _roster_model), &contact_iter); contact_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL( - roster_model), contact_path); + _roster_model), contact_path); gtk_tree_path_free(contact_path); @@ -236,32 +237,32 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, GtkTreePath *contact_path, *group_path; GtkTreeRowReference *contact_ref, *group_ref; OFString *bareJID = [item.JID bareJID]; - OFMapTable *contactRows = [contactMap objectForKey: bareJID]; + OFMapTable *contactRows = [_contactMap objectForKey: bareJID]; contact_ref = [contactRows valueForKey: group]; contact_path = gtk_tree_row_reference_get_path(contact_ref); - gtk_tree_model_get_iter(GTK_TREE_MODEL(roster_model), + gtk_tree_model_get_iter(GTK_TREE_MODEL(_roster_model), &contact_iter, contact_path); gtk_tree_path_free(contact_path); - gtk_tree_store_remove(roster_model, &contact_iter); + gtk_tree_store_remove(_roster_model, &contact_iter); - group_ref = [groupMap valueForKey: group]; + group_ref = [_groupMap valueForKey: group]; group_path = gtk_tree_row_reference_get_path(group_ref); - gtk_tree_model_get_iter(GTK_TREE_MODEL(roster_model), + gtk_tree_model_get_iter(GTK_TREE_MODEL(_roster_model), &group_iter, group_path); - if (!gtk_tree_model_iter_has_child(GTK_TREE_MODEL(roster_model), - &group_iter)) { - gtk_tree_store_remove(roster_model, &group_iter); - [groupMap removeValueForKey: group]; + if (!gtk_tree_model_iter_has_child(GTK_TREE_MODEL( + _roster_model), &group_iter)) { + gtk_tree_store_remove(_roster_model, &group_iter); + [_groupMap removeValueForKey: group]; } gtk_tree_path_free(group_path); [contactRows removeValueForKey: group]; if([contactRows count] == 0) - [contactMap removeObjectForKey: bareJID]; + [_contactMap removeObjectForKey: bareJID]; }); } @@ -348,32 +349,32 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, GtkTreePath *path; GtkTreeRowReference *ref; OFString *bareJID = [contact.rosterItem.JID bareJID]; - OFMapTable *contactRows = [contactMap objectForKey: bareJID]; + OFMapTable *contactRows = [_contactMap objectForKey: bareJID]; for (OFString *group in contact.rosterItem.groups) { ref = [contactRows valueForKey: group]; path = gtk_tree_row_reference_get_path(ref); - gtk_tree_model_get_iter(GTK_TREE_MODEL(roster_model), + gtk_tree_model_get_iter(GTK_TREE_MODEL(_roster_model), &iter, path); gtk_tree_path_free(path); if ([highPresence.type isEqual: @"available"]) { if (highPresence.show != nil) - gtk_tree_store_set(roster_model, &iter, + gtk_tree_store_set(_roster_model, &iter, 2, [highPresence.show UTF8String], -1); else - gtk_tree_store_set(roster_model, &iter, + gtk_tree_store_set(_roster_model, &iter, 2, "available", -1); } else - gtk_tree_store_set(roster_model, &iter, + gtk_tree_store_set(_roster_model, &iter, 2, "unavailable", -1); - gtk_tree_store_set(roster_model, &iter, + gtk_tree_store_set(_roster_model, &iter, 3, [tooltip UTF8String], -1); } - gtk_tree_model_filter_refilter(roster_filter); + gtk_tree_model_filter_refilter(_roster_filter); }); } @@ -394,24 +395,24 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, g_idle_add_block(^{ // Block the PresenceComboBox's changed handler, so it doesn't // fire and resend presence - g_signal_handler_block(presence_combo, - presence_combo_changed_handler_id); + g_signal_handler_block(_presence_combo, + _presence_combo_changed_handler_id); if ([presence.type isEqual: @"unavailable"]) - gtk_combo_box_set_active_id(presence_combo, + gtk_combo_box_set_active_id(_presence_combo, "unavailable"); else if (show == nil) - gtk_combo_box_set_active_id(presence_combo, + gtk_combo_box_set_active_id(_presence_combo, "available"); else - gtk_combo_box_set_active_id(presence_combo, + gtk_combo_box_set_active_id(_presence_combo, [show UTF8String]); // Unblock the changed handler - g_signal_handler_unblock(presence_combo, - presence_combo_changed_handler_id); + g_signal_handler_unblock(_presence_combo, + _presence_combo_changed_handler_id); - gtk_widget_set_tooltip_markup(GTK_WIDGET(presence_combo), + gtk_widget_set_tooltip_markup(GTK_WIDGET(_presence_combo), [tooltip UTF8String]); }); } diff --git a/src/gui/gtk/JubGtkUI.h b/src/gui/gtk/JubGtkUI.h index acf813a..83b1847 100644 --- a/src/gui/gtk/JubGtkUI.h +++ b/src/gui/gtk/JubGtkUI.h @@ -8,6 +8,6 @@ @interface JubGtkUI: OFObject { - JubGtkRosterUI *rosterUI; + JubGtkRosterUI *_rosterUI; } @end diff --git a/src/gui/gtk/JubGtkUI.m b/src/gui/gtk/JubGtkUI.m index d3595a9..52e31e7 100644 --- a/src/gui/gtk/JubGtkUI.m +++ b/src/gui/gtk/JubGtkUI.m @@ -24,7 +24,7 @@ void on_roster_window_destroy(GObject *object, gpointer user_data) gtk_init(argc, argv); - rosterUI = [[JubGtkRosterUI alloc] + _rosterUI = [[JubGtkRosterUI alloc] initWithClient: client]; } @catch (id e) { [self release]; @@ -36,7 +36,7 @@ void on_roster_window_destroy(GObject *object, gpointer user_data) - (void)dealloc { - [rosterUI release]; + [_rosterUI release]; [super dealloc]; } @@ -59,7 +59,7 @@ void on_roster_window_destroy(GObject *object, gpointer user_data) - (void)client: (JubChatClient*)client didChangePresence: (XMPPPresence*)presence { - [rosterUI client: client + [_rosterUI client: client didChangePresence: presence]; } @end -- 2.39.5