[gnome-video-arcade] main: Pulse the progress bar while analyzing ROMs
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-video-arcade] main: Pulse the progress bar while analyzing ROMs
- Date: Sat, 1 Aug 2015 18:00:51 +0000 (UTC)
commit 64f23a9d3e45abc6fdf4b59b2d4a9db9a9b13ddd
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Aug 1 13:48:48 2015 -0400
main: Pulse the progress bar while analyzing ROMs
Apparently at some point "mame -verifyroms" stopped showing status for
all ROMs and now only shows status for ROMs having issues. This broke
the progress indicator.
Since we obviously don't know in advance which ROMs have issues, we
can no longer compute percent complete based on MAME output. So just
pulse the progress bar until the process exits.
src/gva-audit.c | 2 --
src/gva-main.c | 26 ++++++++++++++++++++------
2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/src/gva-audit.c b/src/gva-audit.c
index 243059c..ae4ecb5 100644
--- a/src/gva-audit.c
+++ b/src/gva-audit.c
@@ -169,8 +169,6 @@ audit_read (GvaProcess *process,
g_strdup (status), string);
}
- gva_process_inc_progress (process);
-
g_free (name);
g_free (status);
diff --git a/src/gva-main.c b/src/gva-main.c
index 10e29ba..bae8b90 100644
--- a/src/gva-main.c
+++ b/src/gva-main.c
@@ -40,6 +40,8 @@
"SELECT DISTINCT manufacturer, 'manufacturer' FROM available UNION " \
"SELECT DISTINCT year, 'year' FROM available;"
+#define PROGRESS_BAR_PULSE_INTERVAL_MS 100
+
/* Entry completion columns */
enum
{
@@ -134,6 +136,16 @@ main_menu_item_deselect_cb (GtkMenuItem *item)
gva_main_statusbar_pop (menu_tooltip_cid);
}
+static gboolean
+main_progress_bar_pulse_cb (gpointer user_data)
+{
+ GtkProgressBar *progress_bar = GTK_PROGRESS_BAR (user_data);
+
+ gtk_progress_bar_pulse (progress_bar);
+
+ return TRUE;
+}
+
/**
* gva_main_init:
*
@@ -271,12 +283,11 @@ gva_main_analyze_roms (GError **error)
GvaProcess *process;
GvaProcess *process2 = NULL;
guint context_id;
- guint total_supported;
gboolean main_loop_quit = FALSE;
gboolean success = FALSE;
+ guint timeout_id = 0;
context_id = gva_main_statusbar_get_context_id (G_STRFUNC);
- total_supported = gva_mame_get_total_supported (NULL);
process = gva_audit_roms (error);
if (process == NULL)
@@ -290,10 +301,10 @@ gva_main_analyze_roms (GError **error)
gva_main_progress_bar_set_fraction (0.0);
gva_main_statusbar_push (context_id, _("Analyzing ROM files..."));
- g_signal_connect (
- process, "notify::progress",
- G_CALLBACK (main_build_database_progress_cb),
- GUINT_TO_POINTER (total_supported));
+ timeout_id = g_timeout_add (
+ PROGRESS_BAR_PULSE_INTERVAL_MS,
+ main_progress_bar_pulse_cb,
+ GVA_WIDGET_MAIN_PROGRESS_BAR);
while (!gva_process_has_exited (process, NULL))
main_loop_quit = gtk_main_iteration ();
@@ -313,6 +324,9 @@ gva_main_analyze_roms (GError **error)
gva_main_progress_bar_hide ();
exit:
+ if (timeout_id > 0)
+ g_source_remove (timeout_id);
+
if (process != NULL)
g_object_unref (process);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]