[totem/wip/hadess/glsink-preparation: 2/5] backend: Remove enum to string helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/glsink-preparation: 2/5] backend: Remove enum to string helper
- Date: Thu, 27 Jan 2022 11:46:28 +0000 (UTC)
commit 7be5e10f2e1b98466011393dc4c3c04cb3455d3d
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jan 25 15:29:23 2022 +0100
backend: Remove enum to string helper
Replaced with g_enum_to_string()
src/backend/bacon-video-widget.c | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 9cd7dcb8f..b78b336bc 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -322,21 +322,6 @@ GST_DEBUG_CATEGORY (_totem_gst_debug_cat);
typedef gchar * (* MsgToStrFunc) (GstMessage * msg);
-static const gchar *
-get_type_name (GType class_type, int type)
-{
- GEnumClass *eclass;
- GEnumValue *value;
-
- eclass = G_ENUM_CLASS (g_type_class_peek (class_type));
- value = g_enum_get_value (eclass, type);
-
- if (value == NULL)
- return "unknown";
-
- return value->value_nick;
-}
-
static gchar **
bvw_get_missing_plugins_foo (const GList * missing_plugins, MsgToStrFunc func)
{
@@ -4625,7 +4610,7 @@ bacon_video_widget_dvd_event (BaconVideoWidget * bvw,
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
g_return_if_fail (GST_IS_ELEMENT (bvw->play));
- GST_DEBUG ("Sending event '%s'", get_type_name (BVW_TYPE_DVD_EVENT, type));
+ GST_DEBUG ("Sending event '%s'", g_enum_to_string (BVW_TYPE_DVD_EVENT, type));
switch (type) {
case BVW_DVD_ROOT_MENU:
@@ -4974,9 +4959,9 @@ bacon_video_widget_set_rotation (BaconVideoWidget *bvw,
return;
GST_DEBUG ("Rotating to %s (%f degrees) from %s",
- get_type_name (BVW_TYPE_ROTATION, rotation),
+ g_enum_to_string (BVW_TYPE_ROTATION, rotation),
rotation * 90.0,
- get_type_name (BVW_TYPE_ROTATION, bvw->rotation));
+ g_enum_to_string (BVW_TYPE_ROTATION, bvw->rotation));
bvw->rotation = rotation;
@@ -5605,7 +5590,7 @@ bacon_video_widget_get_metadata_string (BaconVideoWidget * bvw,
if (res && string && *string != '\0' && g_utf8_validate (string, -1, NULL)) {
g_value_take_string (value, string);
- GST_DEBUG ("%s = '%s'", get_type_name (BVW_TYPE_METADATA_TYPE, type), string);
+ GST_DEBUG ("%s = '%s'", g_enum_to_string (BVW_TYPE_METADATA_TYPE, type), string);
} else {
g_value_set_string (value, NULL);
g_free (string);
@@ -5695,7 +5680,7 @@ bacon_video_widget_get_metadata_int (BaconVideoWidget * bvw,
}
g_value_set_int (value, integer);
- GST_DEBUG ("%s = %d", get_type_name (BVW_TYPE_METADATA_TYPE, type), integer);
+ GST_DEBUG ("%s = %d", g_enum_to_string (BVW_TYPE_METADATA_TYPE, type), integer);
return;
}
@@ -5750,7 +5735,7 @@ bacon_video_widget_get_metadata_bool (BaconVideoWidget * bvw,
}
g_value_set_boolean (value, boolean);
- GST_DEBUG ("%s = %s", get_type_name (BVW_TYPE_METADATA_TYPE, type), (boolean) ? "yes" : "no");
+ GST_DEBUG ("%s = %s", g_enum_to_string (BVW_TYPE_METADATA_TYPE, type), (boolean) ? "yes" : "no");
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]