[Xfce4-commits] <thunar:shared-progress-dialog> Fix progress dialog visibility toggling. Raise to front if not active.

Jannis Pohlmann jannis at xfce.org
Sun Sep 13 14:56:03 CEST 2009


Updating branch refs/heads/shared-progress-dialog
         to 6e20e6d00dfb704f0a266daa01cb1d46792b3a8e (commit)
       from 8d588b8140e53068cb17b8f8c44cc2c351512de6 (commit)

commit 6e20e6d00dfb704f0a266daa01cb1d46792b3a8e
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Sep 13 14:54:13 2009 +0200

    Fix progress dialog visibility toggling. Raise to front if not active.

 thunar/thunar-progress-dialog.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-progress-dialog.c b/thunar/thunar-progress-dialog.c
index 71a9465..aac2fc1 100644
--- a/thunar/thunar-progress-dialog.c
+++ b/thunar/thunar-progress-dialog.c
@@ -177,11 +177,18 @@ thunar_progress_dialog_toggled (ThunarProgressDialog *dialog,
   _thunar_return_val_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog), FALSE);
   _thunar_return_val_if_fail (GTK_IS_STATUS_ICON (status_icon), FALSE);
 
-  /* toggle the visibility of the progress dialog */
-  if (GTK_WIDGET_VISIBLE (GTK_WIDGET (dialog)))
-    gtk_window_present (GTK_WINDOW (dialog));
+  /* check if the window is visible and has the focus */
+  if (GTK_WIDGET_VISIBLE (GTK_WIDGET (dialog)) 
+      && gtk_window_is_active (GTK_WINDOW (dialog)))
+    {
+      /* it is, so hide it now */
+      gtk_widget_hide (GTK_WIDGET (dialog));
+    }
   else
-    gtk_widget_show (GTK_WIDGET (dialog));
+    {
+      /* it's not, so we need to raise it above other windows */
+      gtk_window_present (GTK_WINDOW (dialog));
+    }
 
   return TRUE;
 }



More information about the Xfce4-commits mailing list