[totem] Fix uses of deprecated GLib threading API if we have a new enough GLib
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Fix uses of deprecated GLib threading API if we have a new enough GLib
- Date: Wed, 21 Dec 2011 11:09:51 +0000 (UTC)
commit 2516addf19b96bfee3449f648ccbeb87223993fa
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Dec 21 09:44:16 2011 +0000
Fix uses of deprecated GLib threading API if we have a new enough GLib
If we have GLib â 2.31.0, use the new threading API instead of the old one.
This doesn't bump our GLib dependency.
browser-plugin/totem-plugin-viewer.c | 2 +
src/backend/bacon-video-widget-gst-0.10.c | 32 +++++++++++++++++++++++++++++
src/backend/bvw-test.c | 2 +
src/test-properties-page.c | 2 +
src/totem-audio-preview.c | 2 +
src/totem-object.c | 4 +++
src/totem-resources.c | 4 +++
src/totem-video-thumbnailer.c | 2 +
src/totem.c | 2 +
9 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 9462cc9..f0e0d85 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -2228,7 +2228,9 @@ int main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
g_set_application_name (_("Movie browser plugin"));
gtk_window_set_default_icon_name ("totem");
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index dd39a80..b6f8bde 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -240,7 +240,11 @@ struct BaconVideoWidgetPrivate
/* When seeking, queue up the seeks if they happen before
* the previous one finished */
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ GMutex seek_mutex;
+#else
GMutex *seek_mutex;
+#endif
GstClock *clock;
GstClockTime seek_req_time;
gint64 seek_time;
@@ -1162,7 +1166,11 @@ bacon_video_widget_init (BaconVideoWidget * bvw)
priv->tag_update_queue = g_async_queue_new_full ((GDestroyNotify) update_tags_delayed_data_destroy);
priv->tag_update_id = 0;
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_init (&priv->seek_mutex);
+#else
priv->seek_mutex = g_mutex_new ();
+#endif
priv->clock = gst_system_clock_obtain ();
priv->seek_req_time = GST_CLOCK_TIME_NONE;
priv->seek_time = -1;
@@ -2015,13 +2023,21 @@ bvw_bus_message_cb (GstBus * bus, GstMessage * message, gpointer data)
case GST_MESSAGE_ASYNC_DONE: {
gint64 _time;
/* When a seek has finished, set the playing state again */
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_lock (&bvw->priv->seek_mutex);
+#else
g_mutex_lock (bvw->priv->seek_mutex);
+#endif
bvw->priv->seek_req_time = gst_clock_get_internal_time (bvw->priv->clock);
_time = bvw->priv->seek_time;
bvw->priv->seek_time = -1;
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_unlock (&bvw->priv->seek_mutex);
+#else
g_mutex_unlock (bvw->priv->seek_mutex);
+#endif
if (_time >= 0) {
GST_DEBUG ("Have an old seek to schedule, doing it now");
@@ -2537,7 +2553,11 @@ bacon_video_widget_finalize (GObject * object)
bvw->priv->mount_cancellable = NULL;
}
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_clear (&bvw->priv->seek_mutex);
+#else
g_mutex_free (bvw->priv->seek_mutex);
+#endif
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -3641,7 +3661,11 @@ bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 _time, gboolean accu
got_time_tick (bvw->priv->play, _time * GST_MSECOND, bvw);
/* Is there a pending seek? */
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_lock (&bvw->priv->seek_mutex);
+#else
g_mutex_lock (bvw->priv->seek_mutex);
+#endif
/* If there's no pending seek, or
* it's been too long since the seek,
* or we don't have an accurate seek requested */
@@ -3651,11 +3675,19 @@ bacon_video_widget_seek_time (BaconVideoWidget *bvw, gint64 _time, gboolean accu
accurate) {
bvw->priv->seek_time = -1;
bvw->priv->seek_req_time = cur_time;
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_unlock (&bvw->priv->seek_mutex);
+#else
g_mutex_unlock (bvw->priv->seek_mutex);
+#endif
} else {
GST_LOG ("Not long enough since last seek, queuing it");
bvw->priv->seek_time = _time;
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_mutex_unlock (&bvw->priv->seek_mutex);
+#else
g_mutex_unlock (bvw->priv->seek_mutex);
+#endif
return TRUE;
}
diff --git a/src/backend/bvw-test.c b/src/backend/bvw-test.c
index 3995214..dc9b2f5 100644
--- a/src/backend/bvw-test.c
+++ b/src/backend/bvw-test.c
@@ -80,7 +80,9 @@ int main
#ifdef GDK_WINDOWING_X11
XInitThreads ();
#endif
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
gdk_threads_init ();
context = g_option_context_new ("- Play audio and video inside a web browser");
diff --git a/src/test-properties-page.c b/src/test-properties-page.c
index 0e70405..ccc39e4 100644
--- a/src/test-properties-page.c
+++ b/src/test-properties-page.c
@@ -62,7 +62,9 @@ int main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
diff --git a/src/totem-audio-preview.c b/src/totem-audio-preview.c
index 4e0c7c4..722d67e 100644
--- a/src/totem-audio-preview.c
+++ b/src/totem-audio-preview.c
@@ -161,7 +161,9 @@ int main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
g_set_application_name (_("Audio Preview"));
g_setenv("PULSE_PROP_application.icon_name", "totem", TRUE);
diff --git a/src/totem-object.c b/src/totem-object.c
index 7cbeac5..6caceb6 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -960,8 +960,12 @@ totem_object_action_exit (TotemObject *totem)
totem_object_plugins_shutdown (totem);
/* Exit forcefully if we can't do the shutdown in 10 seconds */
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_thread_new ("force-exit", (GThreadFunc) totem_action_wait_force_exit, NULL);
+#else
g_thread_create ((GThreadFunc) totem_action_wait_force_exit,
NULL, FALSE, NULL);
+#endif
if (gtk_main_level () > 0)
gtk_main_quit ();
diff --git a/src/totem-resources.c b/src/totem-resources.c
index 3d10773..1b0cf2b 100644
--- a/src/totem-resources.c
+++ b/src/totem-resources.c
@@ -112,7 +112,11 @@ totem_resources_monitor_start (const char *input, gint wall_clock_time)
sleep_time = wall_clock_time;
finished = FALSE;
+#if GLIB_CHECK_VERSION (2, 31, 0)
+ g_thread_new ("time-monitor", time_monitor, (gpointer) input);
+#else
g_thread_create (time_monitor, (gpointer) input, FALSE, NULL);
+#endif
}
void
diff --git a/src/totem-video-thumbnailer.c b/src/totem-video-thumbnailer.c
index 9a2ec92..87d8330 100644
--- a/src/totem-video-thumbnailer.c
+++ b/src/totem-video-thumbnailer.c
@@ -978,7 +978,9 @@ int main (int argc, char *argv[])
const char *input, *output;
ThumbApp app;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
context = g_option_context_new ("Thumbnail movies");
options = gst_init_get_option_group ();
diff --git a/src/totem.c b/src/totem.c
index 7c07058..617b1db 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -256,7 +256,9 @@ main (int argc, char **argv)
}
#endif
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
g_type_init ();
gtk_init (&argc, &argv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]