X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Ftuner.c;h=751835671bc19db2dedf73fa5c088fd66cf0a2a0;hb=c416aafc058f98a9e57473fc16268cc19955083c;hp=5875b0b8064bab0c9e953a8cba9c9b69f11cd25f;hpb=c2fde0bb7086dfc38ecf87405662b62c5227c602;p=tunertool diff --git a/src/tuner.c b/src/tuner.c index 5875b0b..7518356 100644 --- a/src/tuner.c +++ b/src/tuner.c @@ -195,6 +195,9 @@ static GtkWidget *currentFrequency; static GtkWidget *drawingarea1; static GtkWidget *drawingarea2; +static GstElement *bin1 = NULL; +static GstElement *bin2 = NULL; + static void recalculate_scale (double a4) { @@ -454,6 +457,25 @@ button_release_event (GtkWidget * widget, GdkEventButton * event, return TRUE; } +static gboolean +window_is_active_notify (GObject * object, GParamSpec * pspec, gpointer user_data) +{ + if (gtk_window_is_active (GTK_WINDOW (object))) { + if (bin1) + gst_element_set_state(bin1, GST_STATE_PLAYING); + if (bin2) + gst_element_set_state(bin2, GST_STATE_PLAYING); + } + else { + if (bin1) + gst_element_set_state(bin1, GST_STATE_PAUSED); + if (bin2) + gst_element_set_state(bin2, GST_STATE_PAUSED); + } + + return FALSE; +} + int main (int argc, char *argv[]) { @@ -468,7 +490,6 @@ main (int argc, char *argv[]) osso_context_t *osso_context = NULL; /* handle to osso */ #endif - GstElement *bin1, *bin2; GstElement *src1, *pitch, *sink1; GstElement *src2, *sink2; GstBus *bus; @@ -540,6 +561,9 @@ main (int argc, char *argv[]) gtk_container_set_border_width (GTK_CONTAINER (mainBox), 0); #endif + if (GTK_IS_WINDOW (mainWin)) + g_signal_connect (G_OBJECT (mainWin), "notify::is-active", G_CALLBACK (window_is_active_notify), NULL); + /* Bin for tuner functionality */ bin1 = gst_pipeline_new ("bin1");