GtkTreeStore *roster_model;
GtkTreeModelFilter *roster_filter;
GtkComboBox *presence_combo;
+ gulong presence_combo_changed_handler_id;
OFMapTable *groupMap;
OFMutableDictionary *contactMap;
OFMutableDictionary *chatMap;
presence_combo = GTK_COMBO_BOX(gtk_builder_get_object(builder,
"PresenceComboBox"));
- g_signal_connect(presence_combo, "changed",
- G_CALLBACK(presence_changed), connection);
+ presence_combo_changed_handler_id =
+ g_signal_connect(presence_combo, "changed",
+ G_CALLBACK(presence_changed), connection);
g_object_unref(G_OBJECT(builder));
} @catch (id e) {
if (status != nil)
tooltip = [@"<b>Status:</b> " stringByAppendingString: status];
- // FIXME: Changing the active id will send another presence
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);
+
if ([presence.type isEqual: @"unavailable"])
gtk_combo_box_set_active_id(presence_combo,
"unavailable");
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);
gtk_widget_set_tooltip_markup(GTK_WIDGET(presence_combo),
[tooltip UTF8String]);