[gnome-internet-radio-locator] Fix playback control



commit 2d48398ef478de245ea2c8aef0145f77ac94ddcd
Author: Ole Aamot <ole gnome org>
Date:   Sun Feb 3 13:44:43 2019 +0100

    Fix playback control

 data/Makefile.am                           |  4 ----
 src/gnome-internet-radio-locator-markers.c |  7 +++----
 src/gnome-internet-radio-locator.c         | 20 +++++++-------------
 3 files changed, 10 insertions(+), 21 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 7317c43..0cdaa4e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -16,10 +16,6 @@ appdata_DATA = $(appdata_in_files:.xml.in=.xml)
 # gsettingsconvertdir = $(datadir)/GConf/gsettings
 # gsettingsconvert_DATA = eog.convert
 
-# uidir = $(pkgdatadir)
-# ui_DATA = \
-#      eog-toolbar.xml
-
 # pkgconfigdir = $(libdir)/pkgconfig
 # pkgconfig_DATA = gnome-internet-radio-locator.pc
 
diff --git a/src/gnome-internet-radio-locator-markers.c b/src/gnome-internet-radio-locator-markers.c
index a6afda0..cf77886 100644
--- a/src/gnome-internet-radio-locator-markers.c
+++ b/src/gnome-internet-radio-locator-markers.c
@@ -80,8 +80,7 @@ marker_function (ChamplainMarker *self,
 {
         gchar *station, *station_link;
        gchar *markup;
-       gint context_id;
-
+       guint context_id;
        station = (gchar *)champlain_label_get_text (CHAMPLAIN_LABEL (self));
        station_link = strtok(station, "\n");
        gtk_entry_set_text(GTK_ENTRY(input),(gchar *)station_link);
@@ -91,14 +90,14 @@ marker_function (ChamplainMarker *self,
        while (stationinfo != NULL) {
                 if (strcasecmp(stationinfo->location, station_link)==0) {
                        gchar *statusmsg = g_strconcat(stationinfo->name, " in ", stationinfo->location, " 
(", stationinfo->band, ", ", g_strdup_printf("%li", stationinfo->stream->samplerate), " Hz, ", 
g_strdup_printf("%li", stationinfo->stream->bitrate), " kbps)", NULL);
-                       gst_player_stop(player);
                        gnome_internet_radio_locator_player_new(GST_PLAYER(player), stationinfo->stream->uri);
                        context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), "Station Name");
+                       gtk_statusbar_pop (GTK_STATUSBAR (statusbar), GPOINTER_TO_INT (context_id));
                        gtk_statusbar_push (GTK_STATUSBAR (statusbar), GPOINTER_TO_INT (context_id), 
statusmsg);
-                       gst_player_play(player);
                }
                stationinfo = stationinfo->next;
        }
+       gst_player_play(player);
        if (user_data != NULL) {
                champlain_label_set_text (CHAMPLAIN_LABEL (self), user_data);
        }
diff --git a/src/gnome-internet-radio-locator.c b/src/gnome-internet-radio-locator.c
index 55fc957..7c1983e 100644
--- a/src/gnome-internet-radio-locator.c
+++ b/src/gnome-internet-radio-locator.c
@@ -410,7 +410,10 @@ listen_station(GSimpleAction *simple, GVariant *parameter, gpointer user_data) {
 
 static void
 stop_station(GSimpleAction *simple, GVariant *parameter, gpointer user_data) {
+  guint context_id;
   gnome_internet_radio_locator_player_stop(player);
+  context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), "Station Name");
+  gtk_statusbar_pop (GTK_STATUSBAR (statusbar), GPOINTER_TO_INT (context_id));
   return;
 }
 
@@ -710,7 +713,7 @@ on_search_matches(GtkEntryCompletion *widget,
        gchar *country;
        gchar *state;
        GError **err;
-       gint context_id;
+       guint context_id;
 
        gtk_tree_model_get_value(model, iter, STATION_LOCATION, &city);
        gtk_tree_model_get_value(model, iter, STATION_URI, &value);
@@ -767,11 +770,12 @@ on_search_matches(GtkEntryCompletion *widget,
                if (strcasecmp(stationinfo->stream->uri, g_value_get_string(&value))==0) {
                        gchar *statusmsg = g_strconcat(stationinfo->name, " in ", stationinfo->location, " 
(", stationinfo->band, ", ", g_strdup_printf("%li", stationinfo->stream->samplerate), " Hz, ", 
g_strdup_printf("%li", stationinfo->stream->bitrate), " kbps)", NULL);
                        context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), "Station Name");
+                       gtk_statusbar_pop (GTK_STATUSBAR (statusbar), GPOINTER_TO_INT (context_id));
                        gtk_statusbar_push (GTK_STATUSBAR (statusbar), GPOINTER_TO_INT (context_id), 
statusmsg);
-                       gst_player_play(player);
                }
                stationinfo = stationinfo->next;
        }
+       gst_player_play(player);
        return FALSE;
 }
 
@@ -850,23 +854,13 @@ main (int argc,
 
        bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
 
-#if 0
-       button = gtk_button_new();
-       image = gtk_image_new_from_icon_name("new", GTK_ICON_SIZE_BUTTON);
-       gtk_button_set_image (GTK_BUTTON (button), image);
-       gtk_button_set_label (GTK_BUTTON (button), "New");
-       g_signal_connect(button, "clicked", G_CALLBACK(on_new_station_clicked), view);
-       gtk_container_add (GTK_CONTAINER (bbox), button);
-#endif
-
-#if 0
        button = gtk_button_new();
        image = gtk_image_new_from_icon_name("media-playback-start", GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image (GTK_BUTTON (button), image);
        gtk_button_set_label (GTK_BUTTON (button), "New");
        g_signal_connect(button, "clicked", G_CALLBACK (on_new_station_clicked), view);
        gtk_container_add (GTK_CONTAINER (bbox), button);
-#endif
+
        memset(&stats, 0, sizeof(stats));
 
        input = gtk_entry_new();


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