]> git.0d.be Git - empathy.git/blobdiff - tests/empetit.c
Adjust empetit to test the contact selector filtering.
[empathy.git] / tests / empetit.c
index 43fddcbe23aa12b8757c858de557dd20dc849986..e2eb61f66eeaec3007cec65d5994e2bef9c08df4 100644 (file)
@@ -21,7 +21,7 @@ chat_cb (EmpathyDispatchOperation *dispatch,
   if (error != NULL)
     {
       dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL,
-          GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+          GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
           error->message ? error->message : "No error message");
 
       gtk_dialog_run (GTK_DIALOG (dialog));
@@ -37,16 +37,14 @@ clicked_cb (GtkButton *button,
   EmpathyContactSelector *selector = EMPATHY_CONTACT_SELECTOR (data);
   EmpathyContact *contact;
 
-  contact = empathy_contact_selector_get_selected (selector);
+  contact = empathy_contact_selector_dup_selected (selector);
 
   if (!contact)
     return;
 
-  /* 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);
+
+  g_object_unref (contact);
 }
 
 int main (int argc,
@@ -62,6 +60,9 @@ int main (int argc,
   manager = empathy_contact_manager_dup_singleton ();
   selector = empathy_contact_selector_new (EMPATHY_CONTACT_LIST (manager));
 
+  empathy_contact_selector_set_visible (EMPATHY_CONTACT_SELECTOR (selector),
+      (EmpathyContactSelectorFilterFunc) empathy_contact_can_send_files, NULL);
+
   vbox = gtk_vbox_new (FALSE, 2);
 
   gtk_box_pack_start (GTK_BOX (vbox), selector, FALSE, FALSE, 5);