[sound-juicer] Don't push endless status bar messages.



commit 113d2b173591a9ed9f4c58a9b241c703f13c356d
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Wed Aug 6 19:14:45 2014 +0100

    Don't push endless status bar messages.
    
    When extracting and playing the status bar is continuously updated with
    gtk_statusbar_push() but the messages are never cleared. To clear the
    status bar an empty message is pushed. This interacts badly with the
    re-read code that pushes and then pops messages and also wastes
    memory. Fix this by
    (i)  using different context ids for extracting, playing & re-reading.
    (ii) using gtk_statusbar_remove_all() rather than pushing empty messages
         to clear the statusbar.
    
    This exposes bug 724281 in older versions of GTK
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734603

 src/sj-extracting.c |    4 ++--
 src/sj-main.c       |    4 ++--
 src/sj-play.c       |    6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/sj-extracting.c b/src/sj-extracting.c
index e8285c3..a2b5af4 100644
--- a/src/sj-extracting.c
+++ b/src/sj-extracting.c
@@ -233,7 +233,7 @@ cleanup (void)
   gtk_button_set_label (GTK_BUTTON (extract_button), _("E_xtract"));
 
   /* Clear the Status bar */
-  gtk_statusbar_push (GTK_STATUSBAR (status_bar), 0, "");
+  gtk_statusbar_remove_all (GTK_STATUSBAR (status_bar), 2);
   /* Clear the progress bar */
   gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 0);
   gtk_widget_hide (progress_bar);
@@ -515,7 +515,7 @@ update_speed_progress (SjExtractor *extractor, float speed, int eta)
     eta_str = g_strdup (_("Estimated time left: unknown"));
   }
 
-  gtk_statusbar_push (GTK_STATUSBAR (status_bar), 0, eta_str);
+  gtk_statusbar_push (GTK_STATUSBAR (status_bar), 2, eta_str);
   g_free (eta_str);
 }
 
diff --git a/src/sj-main.c b/src/sj-main.c
index 3043d4f..603541a 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -2011,11 +2011,11 @@ static void
 ui_set_retrieving_metadata (gboolean state)
 {
   if (state) {
-    gtk_statusbar_push(GTK_STATUSBAR(status_bar), 0,
+    gtk_statusbar_push(GTK_STATUSBAR(status_bar), 1,
                        _("Retrieving track listing...please wait."));
     g_application_mark_busy (g_application_get_default ());
   } else {
-    gtk_statusbar_pop(GTK_STATUSBAR(status_bar), 0);
+    gtk_statusbar_pop(GTK_STATUSBAR(status_bar), 1);
     g_application_unmark_busy (g_application_get_default ());
   }
 }
diff --git a/src/sj-play.c b/src/sj-play.c
index 9b83779..0356388 100644
--- a/src/sj-play.c
+++ b/src/sj-play.c
@@ -117,7 +117,7 @@ _stop (void)
   gtk_widget_hide (seek_scale);
   gtk_widget_hide (volume_button);
   sj_main_set_title (NULL);
-  gtk_statusbar_push (GTK_STATUSBAR (statusbar), 0, "");
+  gtk_statusbar_remove_all (GTK_STATUSBAR (statusbar), 0);
   gtk_button_set_label (GTK_BUTTON (play_button), _("_Play"));
   slen = GST_CLOCK_TIME_NONE;
 
@@ -295,7 +295,7 @@ cb_state (GstBus *bus, GstMessage *message, gpointer user_data)
     gtk_list_store_set (track_store, &current_iter,
         COLUMN_STATE, STATE_IDLE, -1);
     sj_main_set_title (NULL);
-    gtk_statusbar_push (GTK_STATUSBAR (statusbar), 0, "");
+    gtk_statusbar_remove_all (GTK_STATUSBAR (statusbar), 0);
     current_track = -1;
   } else if (transition == GST_STATE_CHANGE_PAUSED_TO_PLAYING) {
     gtk_button_set_label (GTK_BUTTON (play_button), _("_Pause"));
@@ -627,7 +627,7 @@ stop_ui_hack (void)
   if (gtk_list_store_iter_is_valid (track_store, &current_iter))
     gtk_list_store_set (track_store, &current_iter, COLUMN_STATE, STATE_IDLE, -1);
   sj_main_set_title (NULL);
-  gtk_statusbar_push (GTK_STATUSBAR (statusbar), 0, "");
+  gtk_statusbar_remove_all (GTK_STATUSBAR (statusbar), 0);
   current_track = -1;
 }
 


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