diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-01-31 01:34:47 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-31 01:34:47 +0800 |
commit | c0c10affc5a017649df2ebcc2930741ed0256225 (patch) | |
tree | 723f8a985f266bbe061ce3f04987f7a9fa36c9f8 | |
parent | e1a4deb5e6825a27a2cfeae4c8fa1dc10519cc4b (diff) | |
download | gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.tar gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.tar.gz gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.tar.bz2 gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.tar.lz gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.tar.xz gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.tar.zst gsoc2013-empathy-c0c10affc5a017649df2ebcc2930741ed0256225.zip |
Updated empetit to use the new dispatcher.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=2338
-rw-r--r-- | tests/empetit.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/empetit.c b/tests/empetit.c index 6ba5a2ad4..03c6ce6cc 100644 --- a/tests/empetit.c +++ b/tests/empetit.c @@ -8,6 +8,7 @@ #include <libempathy-gtk/empathy-contact-list-store.h> #include <libempathy-gtk/empathy-contact-selector.h> +static GtkWidget *window = NULL; static void destroy_cb (GtkWidget *widget, @@ -18,6 +19,25 @@ destroy_cb (GtkWidget *widget, static void +chat_cb (EmpathyDispatchOperation *dispatch, + const GError *error, + gpointer user_data) +{ + GtkWidget *dialog; + + if (error != NULL) + { + dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + error->message ? error->message : "No error message"); + + gtk_dialog_run (GTK_DIALOG (dialog)); + } + + gtk_widget_destroy (window); +} + +static void clicked_cb (GtkButton *button, gpointer data) { @@ -29,17 +49,20 @@ clicked_cb (GtkButton *button, if (!contact) return; - empathy_dispatcher_chat_with_contact (contact); + /* This is required otherwise the dispatcher isn't ref'd, and so it + * disappears by the time the callback gets called. It's deliberately not + * freed otherwise it segfaults... sigh */ + empathy_dispatcher_dup_singleton (); + empathy_dispatcher_chat_with_contact (contact, chat_cb, NULL); } - int main (int argc, char *argv[]) { EmpathyContactManager *manager; EmpathyContactListStore *store; EmpathyContactSelector *selector; - GtkWidget *window, *vbox, *button; + GtkWidget *vbox, *button; gchar *icon_path; gtk_init (&argc, &argv); |