diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-06-21 21:00:07 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-12-22 17:46:18 +0800 |
commit | 81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd (patch) | |
tree | bd54887c1997252af5f54e57f70e0d4ef96a1f87 | |
parent | 88df5753cb658269ef9609825cd494ac463e0d6d (diff) | |
download | gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.tar gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.tar.gz gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.tar.bz2 gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.tar.lz gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.tar.xz gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.tar.zst gsoc2013-empathy-81ad14a2dbcb5d71ed7befff0c7e2d7516a24dcd.zip |
Add a close signal, emitted by both cancel and apply
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 14 | ||||
-rw-r--r-- | src/empathy-accounts-dialog.c | 9 |
2 files changed, 18 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index be195fd8b..68a91c902 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -21,6 +21,7 @@ * Martyn Russell <martyn@imendio.com> * Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> * Jonathan Tellier <jonathan.tellier@gmail.com> + * Danielle Madeley <danielle.madeley@collabora.co.uk> */ #include <config.h> @@ -130,6 +131,7 @@ enum { HANDLE_APPLY, ACCOUNT_CREATED, CANCELLED, + CLOSE, LAST_SIGNAL }; @@ -890,6 +892,7 @@ account_widget_cancel_clicked_cb (GtkWidget *button, EmpathyAccountWidget *self) { g_signal_emit (self, signals[CANCELLED], 0); + g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_CANCEL); } static void @@ -954,6 +957,7 @@ account_widget_applied_cb (GObject *source_object, tp_account_set_enabled_async (account, TRUE, account_widget_account_enabled_cb, widget); g_signal_emit (widget, signals[ACCOUNT_CREATED], 0, account); + // FIXME: should we emit a signal here? } else { @@ -981,6 +985,9 @@ account_widget_applied_cb (GObject *source_object, priv->contains_pending_changes = FALSE; + /* announce the widget can be closed */ + g_signal_emit (widget, signals[CLOSE], 0, GTK_RESPONSE_APPLY); + /* unref the widget - part of the workaround */ g_object_unref (widget); } @@ -2376,6 +2383,13 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass) G_TYPE_NONE, 0); + signals[CLOSE] = + g_signal_new ("close", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, + 1, G_TYPE_INT); + g_type_class_add_private (klass, sizeof (EmpathyAccountWidgetPriv)); } diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index ad53edd9d..efafd369b 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -21,6 +21,7 @@ * Xavier Claessens <xclaesse@gmail.com> * Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> * Jonathan Tellier <jonathan.tellier@gmail.com> + * Danielle Madeley <danielle.madeley@collabora.co.uk> */ #include <config.h> @@ -560,6 +561,7 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog) priv->setting_widget_object = empathy_account_widget_new_for_protocol (settings, FALSE); + // FIXME: why doesn't this work for cancel, but does for apply? g_object_add_weak_pointer (G_OBJECT (priv->setting_widget_object), (gpointer *) &priv->setting_widget_object); @@ -574,11 +576,7 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog) g_signal_connect (priv->setting_widget_object, "cancelled", G_CALLBACK (empathy_account_dialog_widget_cancelled_cb), dialog); - /* FIXME: need to hook up apply button, where to buttons belong? */ - /* FIXME: yes? */ - g_signal_connect_swapped (priv->setting_widget_object, "account-created", - G_CALLBACK (gtk_widget_destroy), subdialog); - g_signal_connect_swapped (priv->setting_widget_object, "cancelled", + g_signal_connect_swapped (priv->setting_widget_object, "close", G_CALLBACK (gtk_widget_destroy), subdialog); gtk_container_add ( @@ -787,6 +785,7 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog, if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, COL_ACCOUNT, account, -1); + // FIXME: this is called before @setting_widget_object is cleared return priv->setting_widget_object != NULL && empathy_account_widget_contains_pending_changes ( priv->setting_widget_object); |