[gnome-games/wip/abhinavsingh/gamepad-config] gamepad: Add size function to gamepad button enum
- From: Abhinav Singh <abhinavsingh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/abhinavsingh/gamepad-config] gamepad: Add size function to gamepad button enum
- Date: Wed, 10 May 2017 09:10:00 +0000 (UTC)
commit f09fe36cfffdf03a4f7068c862ad4969c708ed43
Author: theawless <theawless gmail com>
Date: Wed May 10 14:36:31 2017 +0530
gamepad: Add size function to gamepad button enum
src/gamepad/standard-gamepad-button.c | 10 ++++++++++
src/gamepad/standard-gamepad-button.h | 2 ++
src/gamepad/standard-gamepad-button.vapi | 6 ++++--
3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gamepad/standard-gamepad-button.c b/src/gamepad/standard-gamepad-button.c
index ba17680..bd7a4dd 100644
--- a/src/gamepad/standard-gamepad-button.c
+++ b/src/gamepad/standard-gamepad-button.c
@@ -2,6 +2,16 @@
#include "standard-gamepad-button.h"
+guint
+games_standard_gamepad_button_size (void)
+{
+ GEnumClass *enum_class = g_type_class_ref (GAMES_TYPE_STANDARD_GAMEPAD_BUTTON);
+ guint n_values = enum_class->n_values;
+ g_type_class_unref (enum_class);
+
+ return n_values;
+}
+
GType
games_standard_gamepad_button_get_type (void)
{
diff --git a/src/gamepad/standard-gamepad-button.h b/src/gamepad/standard-gamepad-button.h
index cd5e7bd..1faf924 100644
--- a/src/gamepad/standard-gamepad-button.h
+++ b/src/gamepad/standard-gamepad-button.h
@@ -3,6 +3,7 @@
#ifndef GAMES_STANDARD_GAMEPAD_BUTTON_H
#define GAMES_STANDARD_GAMEPAD_BUTTON_H
+#include <glib.h>
#include <glib-object.h>
G_BEGIN_DECLS
@@ -54,6 +55,7 @@ typedef enum {
} GamesStandardGamepadButton;
GType games_standard_gamepad_button_get_type (void) G_GNUC_CONST;
+guint games_standard_gamepad_button_size (void);
G_END_DECLS
diff --git a/src/gamepad/standard-gamepad-button.vapi b/src/gamepad/standard-gamepad-button.vapi
index bfde8af..3f483c4 100644
--- a/src/gamepad/standard-gamepad-button.vapi
+++ b/src/gamepad/standard-gamepad-button.vapi
@@ -1,7 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
[CCode (cheader_filename = "standard-gamepad-button.h")]
-private enum Games.StandardGamepadButton {
+public enum Games.StandardGamepadButton {
UNKNOWN,
A,
B,
@@ -19,5 +19,7 @@ private enum Games.StandardGamepadButton {
DPAD_DOWN,
DPAD_LEFT,
DPAD_RIGHT,
- HOME,
+ HOME;
+
+ public static uint size ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]