Bug #708840 - Crash when closing subscription dialog with running operation

This commit is contained in:
Milan Crha
2013-09-30 17:53:42 +02:00
parent 10032e2479
commit caef69cb73

View File

@ -1428,6 +1428,33 @@ subscription_editor_add_store (EMSubscriptionEditor *editor,
g_ptr_array_add (editor->priv->stores, data);
}
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 (