diff options
author | Milan Crha <mcrha@redhat.com> | 2013-06-24 20:48:00 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-06-24 20:48:00 +0800 |
commit | 6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe (patch) | |
tree | 2ae3f1fd54ea7110d5cfd5205935a3dd0ebe85a8 /e-util | |
parent | 0f90d1f1ce1314673768dde28c6931cd6ff2bbfa (diff) | |
download | gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.tar gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.tar.gz gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.tar.bz2 gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.tar.lz gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.tar.xz gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.tar.zst gsoc2013-evolution-6011ffb5e7cde4ab7e1bc4fb044e4ad8628fffbe.zip |
Notify user about question dialogs
Set an urgency hint on dialog's parent, or dialog itself, when it has
no parent, to get user's attention to the dialog. For example, when
there is a changed mail composer window on a different workspace than
evolution's main window and user invokes quit by File->Quit in evolution,
then the window is waiting for a response on the composer, but there
was no hint it's waiting for anything.
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-alert-dialog.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c index b4e12ad8c9..156c2729ac 100644 --- a/e-util/e-alert-dialog.c +++ b/e-util/e-alert-dialog.c @@ -322,17 +322,43 @@ e_alert_dialog_new_for_args (GtkWindow *parent, return dialog; } +static gboolean +dialog_focus_in_event_cb (GtkWindow *dialog, + GdkEvent *event, + GtkWindow *parent) +{ + gtk_window_set_urgency_hint (parent, FALSE); + + return FALSE; +} + gint e_alert_run_dialog (GtkWindow *parent, EAlert *alert) { GtkWidget *dialog; gint response; + gulong signal_id = 0; g_return_val_if_fail (E_IS_ALERT (alert), 0); dialog = e_alert_dialog_new (parent, alert); + + if (parent) { + gtk_window_set_urgency_hint (parent, TRUE); + signal_id = g_signal_connect (dialog, "focus-in-event", G_CALLBACK (dialog_focus_in_event_cb), parent); + } else { + gtk_window_set_urgency_hint (GTK_WINDOW (dialog), TRUE); + } + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (parent) { + gtk_window_set_urgency_hint (parent, FALSE); + if (signal_id) + g_signal_handler_disconnect (dialog, signal_id); + } + gtk_widget_destroy (dialog); return response; |