[nautilus] progress-info: tie the application life to the whole file operation
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] progress-info: tie the application life to the whole file operation
- Date: Mon, 17 Jan 2011 15:04:30 +0000 (UTC)
commit 9e016ee923a2625ebd4d66cf18f3a6d2c903e6c8
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Jan 17 16:01:39 2011 +0100
progress-info: tie the application life to the whole file operation
And not to the progress widget only, as that
- starts hidden for the first seconds
- is not destroyed when the operation finishes, but only hidden
Using g_application_hold/release with the progress operation lifetime
seems like a better way to deal with the app lifecycle.
libnautilus-private/nautilus-progress-info.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/libnautilus-private/nautilus-progress-info.c b/libnautilus-private/nautilus-progress-info.c
index 66725a5..abd11ea 100644
--- a/libnautilus-private/nautilus-progress-info.c
+++ b/libnautilus-private/nautilus-progress-info.c
@@ -229,9 +229,6 @@ get_progress_window (void)
gtk_window_set_icon_name (GTK_WINDOW (progress_window),
"system-file-manager");
- gtk_application_add_window (nautilus_get_application (),
- GTK_WINDOW (progress_window));
-
vbox = gtk_vbox_new (FALSE, 0);
gtk_box_set_spacing (GTK_BOX (vbox), 5);
@@ -442,6 +439,13 @@ handle_new_progress_info (NautilusProgressInfo *info)
update_status_icon_and_window ();
}
+static void
+new_op_finished (NautilusProgressInfo *info)
+{
+ /* release the hold we added in new_op_started() */
+ g_application_release (G_APPLICATION (nautilus_get_application ()));
+}
+
static gboolean
new_op_started_timeout (NautilusProgressInfo *info)
{
@@ -462,6 +466,11 @@ new_op_started (NautilusProgressInfo *info)
g_timeout_add_seconds (2,
(GSourceFunc)new_op_started_timeout,
g_object_ref (info));
+
+ /* hold the application, so that it doesn't quit while this operation is
+ * in progress.
+ */
+ g_application_hold (G_APPLICATION (nautilus_get_application ()));
}
static void
@@ -474,6 +483,7 @@ nautilus_progress_info_init (NautilusProgressInfo *info)
G_UNLOCK (progress_info);
g_signal_connect (info, "started", (GCallback)new_op_started, NULL);
+ g_signal_connect (info, "finished", (GCallback)new_op_finished, NULL);
}
NautilusProgressInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]