[gnome-settings-daemon] orientation: Add "to string" helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] orientation: Add "to string" helper
- Date: Thu, 2 Jun 2011 16:48:50 +0000 (UTC)
commit c2b520103e008c68c9e00a02e794ae1a3951de8e
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jun 2 17:45:30 2011 +0100
orientation: Add "to string" helper
plugins/orientation/gsd-orientation-calc.c | 19 +++++++++++++++++++
plugins/orientation/gsd-orientation-calc.h | 5 +++--
2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/plugins/orientation/gsd-orientation-calc.c b/plugins/orientation/gsd-orientation-calc.c
index 8bdec79..978103c 100644
--- a/plugins/orientation/gsd-orientation-calc.c
+++ b/plugins/orientation/gsd-orientation-calc.c
@@ -40,6 +40,25 @@
#define THRESHOLD_LANDSCAPE 25
#define THRESHOLD_PORTRAIT 20
+const char *
+gsd_orientation_to_string (OrientationUp o)
+{
+ switch (o) {
+ case ORIENTATION_UNDEFINED:
+ return "undefined";
+ case ORIENTATION_NORMAL:
+ return "normal";
+ case ORIENTATION_BOTTOM_UP:
+ return "bottom up";
+ case ORIENTATION_LEFT_UP:
+ return "left up";
+ case ORIENTATION_RIGHT_UP:
+ return "right up";
+ default:
+ g_assert_not_reached ();
+ }
+}
+
OrientationUp gsd_orientation_calc (OrientationUp prev,
int x, int y, int z)
{
diff --git a/plugins/orientation/gsd-orientation-calc.h b/plugins/orientation/gsd-orientation-calc.h
index ef7446e..0d6c7f4 100644
--- a/plugins/orientation/gsd-orientation-calc.h
+++ b/plugins/orientation/gsd-orientation-calc.h
@@ -36,8 +36,9 @@ typedef enum {
#define ORIENTATION_UP_UP ORIENTATION_NORMAL
-OrientationUp gsd_orientation_calc (OrientationUp prev,
- int x, int y, int z);
+const char * gsd_orientation_to_string (OrientationUp orientation);
+OrientationUp gsd_orientation_calc (OrientationUp prev,
+ int x, int y, int z);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]