</packing>
</child>
<child>
- <object class="GtkComboBox" id="PresenceCombobox">
+ <object class="GtkComboBox" id="PresenceComboBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">PresenceListStore</property>
<property name="id_column">0</property>
- <property name="active_id">unavailable</property>
+ <property name="active_id">available</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
#import "JubGtkChatUI.h"
#import "JubGtkHelper.h"
+#include <string.h>
+
static gboolean roster_row_activated(GtkTreeView *tree_view, GtkTreePath *path,
GtkTreeViewColumn *column, gpointer data)
{
return TRUE;
}
+static void presence_changed(GtkComboBox *combo_box, gpointer data)
+{
+ XMPPPresence *pres;
+ XMPPConnection *connection = data;
+ OFAutoreleasePool *pool = [OFAutoreleasePool new];
+
+ const char *status = gtk_combo_box_get_active_id(combo_box);
+
+ if (!strcmp(status, "unavailable"))
+ pres = [XMPPPresence presenceWithType: @"unavailable"];
+ else {
+ pres = [XMPPPresence presence];
+ if (strcmp(status, "available"))
+ [pres addShow: @(status)];
+ }
+
+ [connection sendStanza: pres];
+
+ [pool release];
+}
+
static gboolean filter_roster_by_presence(GtkTreeModel *model,
GtkTreeIter *iter, gpointer data)
{
@try {
GtkTreeView *roster_view;
+ GtkComboBox *presence_combo;
groupMap = [[OFMapTable alloc]
initWithKeyFunctions: keyFunctions
g_signal_connect(roster_view, "row_activated",
G_CALLBACK(roster_row_activated), self);
+
+ presence_combo = GTK_COMBO_BOX(gtk_builder_get_object(builder,
+ "PresenceComboBox"));
+
+ g_signal_connect(presence_combo, "changed",
+ G_CALLBACK(presence_changed), connection);
} @catch (id e) {
[self release];
@throw e;