empathy r2338 - trunk/tests
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2338 - trunk/tests
- Date: Fri, 30 Jan 2009 17:34:47 +0000 (UTC)
Author: xclaesse
Date: Fri Jan 30 17:34:47 2009
New Revision: 2338
URL: http://svn.gnome.org/viewvc/empathy?rev=2338&view=rev
Log:
Updated empetit to use the new dispatcher.
Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>
Modified:
trunk/tests/empetit.c
Modified: trunk/tests/empetit.c
==============================================================================
--- trunk/tests/empetit.c (original)
+++ trunk/tests/empetit.c Fri Jan 30 17:34:47 2009
@@ -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 @@
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 @@
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]