[gnome-packagekit] Ensure we reset the UI to sensitive after creating the system package list



commit 96cbef5d16e32616e8b1763c52ab9ba52cf42ae2
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jul 1 14:45:55 2010 +0100

    Ensure we reset the UI to sensitive after creating the system package list

 src/gpk-service-pack.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/src/gpk-service-pack.c b/src/gpk-service-pack.c
index 6d6bba5..0c5056f 100644
--- a/src/gpk-service-pack.c
+++ b/src/gpk-service-pack.c
@@ -371,6 +371,25 @@ out:
 }
 
 /**
+ * gpk_pack_reset_ui:
+ **/
+static void
+gpk_pack_reset_ui (void)
+{
+	GtkWidget *widget;
+
+	/* stop the action */
+	gpk_pack_widgets_activate (TRUE);
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "frame_progress"));
+	gtk_widget_hide (widget);
+	gpk_pack_set_percentage (100);
+
+	/* blank */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "progressbar_percentage"));
+	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (widget), "");
+}
+
+/**
  * gpk_pack_ready_cb:
  **/
 static void
@@ -390,15 +409,8 @@ gpk_pack_ready_cb (GObject *object, GAsyncResult *res, gpointer userdata)
 		g_error_free (error);
 	}
 
-	/* stop the action */
-	gpk_pack_widgets_activate (TRUE);
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "frame_progress"));
-	gtk_widget_hide (widget);
-	gpk_pack_set_percentage (100);
-
-	/* blank */
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "progressbar_percentage"));
-	gtk_progress_bar_set_text (GTK_PROGRESS_BAR (widget), "");
+	/* reset regardless of success/failure */
+	gpk_pack_reset_ui ();
 }
 
 
@@ -521,6 +533,7 @@ gpk_pack_button_create_cb (GtkWidget *widget2, gpointer data)
 			gpk_error_dialog_modal (GTK_WINDOW (widget), _("Create error"), _("Cannot copy system package array"), error->message);
 			g_error_free (error);
 		}
+		gpk_pack_reset_ui ();
 		goto out;
 	}
 



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