aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-new-call-dialog.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2009-12-19 09:42:25 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2009-12-21 17:52:47 +0800
commit4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52 (patch)
tree6a7dc8d3a7b0a0e62c527f30390be3f349a935b0 /libempathy-gtk/empathy-new-call-dialog.c
parentc56343b28433a6285ad3d954cb276f03e0a6d665 (diff)
downloadgsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.tar
gsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.tar.gz
gsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.tar.bz2
gsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.tar.lz
gsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.tar.xz
gsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.tar.zst
gsoc2013-empathy-4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52.zip
[EmpathyContactSelectorDialog] remove got_response vcall
The got_response vcall method wasn't generic enough. It assumed that your response code was always GTK_RESPONSE_ACCEPT, and doesn't allow for the dialog to be used with gtk_dialog_run. Instead dialogs now use the regular response() vcall provided by GtkDialog, and an additional API method empathy_contact_selector_dialog_get_selected() provides the information content of the dialog.
Diffstat (limited to 'libempathy-gtk/empathy-new-call-dialog.c')
-rw-r--r--libempathy-gtk/empathy-new-call-dialog.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 2437b4978..1a171af5a 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -90,13 +90,20 @@ got_contact_cb (EmpathyTpContactFactory *factory,
}
static void
-empathy_new_call_dialog_got_response (EmpathyContactSelectorDialog *dialog,
- TpConnection *connection,
- const gchar *contact_id)
+empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
{
EmpathyNewCallDialogPriv *priv = GET_PRIV (dialog);
EmpathyTpContactFactory *factory;
gboolean video;
+ TpConnection *connection;
+ const gchar *contact_id;
+
+ if (response_id != GTK_RESPONSE_ACCEPT) goto out;
+
+ contact_id = empathy_contact_selector_dialog_get_selected (
+ EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), &connection);
+
+ if (EMP_STR_EMPTY (contact_id) || connection == NULL) goto out;
/* check if video is enabled now because the dialog will be destroyed once
* we return from this function. */
@@ -107,6 +114,9 @@ empathy_new_call_dialog_got_response (EmpathyContactSelectorDialog *dialog,
got_contact_cb, GUINT_TO_POINTER (video), NULL, NULL);
g_object_unref (factory);
+
+out:
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static gboolean
@@ -204,15 +214,17 @@ empathy_new_call_dialog_class_init (
EmpathyNewCallDialogClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- EmpathyContactSelectorDialogClass *dialog_class = \
+ GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (class);
+ EmpathyContactSelectorDialogClass *selector_dialog_class = \
EMPATHY_CONTACT_SELECTOR_DIALOG_CLASS (class);
g_type_class_add_private (class, sizeof (EmpathyNewCallDialogPriv));
object_class->constructor = empathy_new_call_dialog_constructor;
- dialog_class->got_response = empathy_new_call_dialog_got_response;
- dialog_class->account_filter = empathy_new_call_dialog_account_filter;
+ dialog_class->response = empathy_new_call_dialog_response;
+
+ selector_dialog_class->account_filter = empathy_new_call_dialog_account_filter;
}
/**