diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2009-12-19 09:42:25 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2009-12-21 17:52:47 +0800 |
commit | 4a9ec5b513a5e7c183cfcb55b1b2bcda1e5f2f52 (patch) | |
tree | 6a7dc8d3a7b0a0e62c527f30390be3f349a935b0 /libempathy-gtk/empathy-contact-selector-dialog.c | |
parent | c56343b28433a6285ad3d954cb276f03e0a6d665 (diff) | |
download | gsoc2013-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-contact-selector-dialog.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-selector-dialog.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c index 1f3e21a6d..58e0fff35 100644 --- a/libempathy-gtk/empathy-contact-selector-dialog.c +++ b/libempathy-gtk/empathy-contact-selector-dialog.c @@ -202,34 +202,6 @@ out: } static void -contact_selector_dialog_response_cb (GtkWidget *widget, - gint response, - EmpathyContactSelectorDialog *dialog) -{ - EmpathyContactSelectorDialogPriv *priv = GET_PRIV (dialog); - TpConnection *connection; - const gchar *id; - EmpathyContactSelectorDialogClass *class = \ - EMPATHY_CONTACT_SELECTOR_DIALOG_GET_CLASS (dialog); - - connection = empathy_account_chooser_get_connection ( - EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser)); - id = gtk_entry_get_text (GTK_ENTRY (priv->entry_id)); - if (!connection || EMP_STR_EMPTY (id)) - { - gtk_widget_destroy (widget); - return; - } - - if (response == GTK_RESPONSE_ACCEPT) - { - class->got_response (dialog, connection, id); - } - - gtk_widget_destroy (widget); -} - -static void contact_selector_change_state_button_cb (GtkEditable *editable, EmpathyContactSelectorDialog *dialog) { @@ -331,9 +303,6 @@ empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog) g_object_unref (completion); g_object_unref (model); - g_signal_connect (dialog, "response", - G_CALLBACK (contact_selector_dialog_response_cb), dialog); - empathy_builder_connect (gui, dialog, "entry_id", "changed", contact_selector_change_state_button_cb, NULL); @@ -435,6 +404,31 @@ empathy_contact_selector_dialog_class_init ( G_PARAM_READWRITE)); } +const gchar * +empathy_contact_selector_dialog_get_selected ( + EmpathyContactSelectorDialog *self, + TpConnection **connection) +{ + EmpathyContactSelectorDialogPriv *priv; + const char *id; + + g_return_val_if_fail (EMPATHY_IS_CONTACT_SELECTOR_DIALOG (self), NULL); + + priv = GET_PRIV (self); + + if (connection) + { + if (priv->show_account_chooser) + *connection = empathy_account_chooser_get_connection ( + EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser)); + else + *connection = NULL; + } + + id = gtk_entry_get_text (GTK_ENTRY (priv->entry_id)); + return id; +} + void empathy_contact_selector_dialog_set_show_account_chooser ( EmpathyContactSelectorDialog *self, |