X-Git-Url: http://cgit.babelmonkeys.de/?p=jubjub.git;a=blobdiff_plain;f=src%2Fgui%2Fgtk%2FJubGtkRosterUI.m;h=90bad6fa50c53abd97a0c916afa7c816e5405610;hp=c27142f2f68fa0bf4b697ae8c121fae2cbd3e704;hb=e7980c8d1a40175b56fad21082291152e214825d;hpb=0daa7a1cf98c6281dd7ba09baf0bf36cd1e154f7 diff --git a/src/gui/gtk/JubGtkRosterUI.m b/src/gui/gtk/JubGtkRosterUI.m index c27142f..90bad6f 100644 --- a/src/gui/gtk/JubGtkRosterUI.m +++ b/src/gui/gtk/JubGtkRosterUI.m @@ -1,10 +1,11 @@ +#import +#include + #import "JubGtkRosterUI.h" #import "JubGObjectMap.h" #import "JubGtkChatUI.h" #import "JubGtkHelper.h" -#include - static void roster_row_activated(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) { @@ -86,7 +87,6 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, @try { GtkTreeView *roster_view; - GtkComboBox *presence_combo; GtkBuilder *builder; groupMap = [[OFMapTable alloc] @@ -362,4 +362,35 @@ static gboolean filter_roster_by_presence(GtkTreeModel *model, } } +- (void)client: (JubChatClient*)client + didChangePresence: (XMPPPresence*)presence +{ + OFString *tooltip = @""; + OFString *show = + [[presence elementForName: @"show" + namespace: XMPP_NS_CLIENT] stringValue]; + OFString *status = + [[presence elementForName: @"status" + namespace: XMPP_NS_CLIENT] stringValue]; + + if (status != nil) + tooltip = [@"Status: " stringByAppendingString: status]; + + // FIXME: Changing the active id will send another presence + g_idle_add_block(^{ + if ([presence.type isEqual: @"unavailable"]) + gtk_combo_box_set_active_id(presence_combo, + "unavailable"); + else if (show == nil) + gtk_combo_box_set_active_id(presence_combo, + "available"); + else + gtk_combo_box_set_active_id(presence_combo, + [show UTF8String]); + + + gtk_widget_set_tooltip_markup(GTK_WIDGET(presence_combo), + [tooltip UTF8String]); + }); +} @end