gnome-screensaver r1357 - in trunk: . src



Author: mccann
Date: Thu Jan 31 03:10:09 2008
New Revision: 1357
URL: http://svn.gnome.org/viewvc/gnome-screensaver?rev=1357&view=rev

Log:
2008-01-30  William Jon McCann  <mccann jhu edu>

	* src/copy-theme-dialog.c: (copy_finished),
	(copy_theme_dialog_copy_next), (timeout_display_dialog),
	(copy_theme_dialog_begin):
	* src/gnome-screensaver-preferences.c: (theme_copy_complete_cb),
	(theme_installer_run):
	Only show transfer dialog if the transfer takes more than .5 sec.
	Patch from: John Millikin <jmillikin gmail com>
	Fixes #512492



Modified:
   trunk/ChangeLog
   trunk/src/copy-theme-dialog.c
   trunk/src/gnome-screensaver-preferences.c

Modified: trunk/src/copy-theme-dialog.c
==============================================================================
--- trunk/src/copy-theme-dialog.c	(original)
+++ trunk/src/copy-theme-dialog.c	Thu Jan 31 03:10:09 2008
@@ -166,6 +166,13 @@
 	return dialog;
 }
 
+static gboolean
+copy_finished (CopyThemeDialog *dialog)
+{
+	return (g_cancellable_is_cancelled (dialog->priv->cancellable) ||
+	        dialog->priv->file == NULL);
+}
+
 static void
 copy_theme_dialog_init (CopyThemeDialog *dlg)
 {
@@ -392,12 +399,10 @@
 	GFile *file, *destination;
 	gchar *basename, *full_basename;
 	
-	if (dialog->priv->file == NULL)
+	if (copy_finished (dialog))
 	{
-		/* Copy is complete */
 		g_signal_emit (G_OBJECT (dialog), signals[COMPLETE],
 		               0, NULL);
-		gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_NONE);
 		return;
 	}
 	
@@ -416,14 +421,35 @@
 	                   NULL, NULL, single_copy_complete, dialog);
 }
 
+static gboolean
+timeout_display_dialog (gpointer data)
+{
+	if (IS_COPY_THEME_DIALOG (data))
+	{
+		CopyThemeDialog *dialog = COPY_THEME_DIALOG (data);
+		if (!copy_finished (dialog))
+		{
+			gtk_widget_show (GTK_WIDGET (dialog));
+			
+			g_signal_connect (dialog, "response",
+			                  G_CALLBACK (copy_theme_dialog_response),
+			                  dialog);
+		}
+	}
+	return FALSE;
+}
+
 void
 copy_theme_dialog_begin (CopyThemeDialog *dialog)
 {
-	g_object_ref (dialog);
+	gtk_widget_hide (GTK_WIDGET (dialog));
+	
+	/* If the copy operation takes more than half a second to
+	 * complete, display the dialog.
+	**/
+	g_timeout_add (500, timeout_display_dialog, dialog);
+	
 	copy_theme_dialog_copy_next (dialog);
-	if (!g_cancellable_is_cancelled (dialog->priv->cancellable))
-		gtk_dialog_run (GTK_DIALOG (dialog));
-	g_object_unref (dialog);
 }
 
 static void

Modified: trunk/src/gnome-screensaver-preferences.c
==============================================================================
--- trunk/src/gnome-screensaver-preferences.c	(original)
+++ trunk/src/gnome-screensaver-preferences.c	Thu Jan 31 03:10:09 2008
@@ -811,6 +811,7 @@
 theme_copy_complete_cb (GtkWidget *dialog, gpointer user_data)
 {
         reload_themes ();
+        gtk_widget_destroy (dialog);
 }
 
 static void
@@ -831,7 +832,6 @@
                           G_CALLBACK (theme_copy_complete_cb), NULL);
         
         copy_theme_dialog_begin (COPY_THEME_DIALOG (copy_dialog));
-        gtk_widget_destroy (copy_dialog);
 }
 
 /* Callback issued during drag movements */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]