diff options
author | Milan Crha <mcrha@redhat.com> | 2013-09-30 23:53:42 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-09-30 23:53:42 +0800 |
commit | caef69cb73071bfebb1f8a25f60b88111c2a9f10 (patch) | |
tree | 5f81834eecce3f3910c25179e7bd4933b40deac5 /mail | |
parent | 10032e2479eb6fc9f5684346364ec52c246a5969 (diff) | |
download | gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.tar gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.tar.gz gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.tar.bz2 gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.tar.lz gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.tar.xz gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.tar.zst gsoc2013-evolution-caef69cb73071bfebb1f8a25f60b88111c2a9f10.zip |
Bug #708840 - Crash when closing subscription dialog with running operation
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-subscription-editor.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c index c8b3c016e3..88240e9c9d 100644 --- a/mail/em-subscription-editor.c +++ b/mail/em-subscription-editor.c @@ -1429,6 +1429,33 @@ subscription_editor_add_store (EMSubscriptionEditor *editor, } static void +emse_notebook_sensitive_changed_cb (GtkWidget *notebook, + GParamSpec *param, + GtkDialog *editor) +{ + gtk_dialog_set_response_sensitive (editor, + GTK_RESPONSE_CLOSE, gtk_widget_get_sensitive (notebook)); +} + +static gboolean +subscription_editor_delete_event_cb (EMSubscriptionEditor *editor, + GdkEvent *event, + gpointer user_data) +{ + /* stop processing if the button is insensitive */ + return !gtk_widget_get_sensitive (editor->priv->notebook); +} + +static void +subscription_editor_response_cb (EMSubscriptionEditor *editor, + gint response_id, + gpointer user_data) +{ + if (!gtk_widget_get_sensitive (editor->priv->notebook)) + g_signal_stop_emission_by_name (editor, "response"); +} + +static void subscription_editor_set_store (EMSubscriptionEditor *editor, CamelStore *store) { @@ -1574,6 +1601,9 @@ subscription_editor_constructed (GObject *object) /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (em_subscription_editor_parent_class)->constructed (object); + + g_signal_connect (editor, "delete-event", G_CALLBACK (subscription_editor_delete_event_cb), NULL); + g_signal_connect (editor, "response", G_CALLBACK (subscription_editor_response_cb), NULL); } static void @@ -1771,6 +1801,9 @@ em_subscription_editor_init (EMSubscriptionEditor *editor) G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + g_signal_connect (widget, "notify::sensitive", + G_CALLBACK (emse_notebook_sensitive_changed_cb), editor); + widget = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); gtk_box_set_spacing (GTK_BOX (widget), 6); gtk_button_box_set_layout ( |