[gnome-video-arcade] db: Exclude devices and mechanical machines



commit 8069ce9e45933e49ca5a702143775f15ad09cb86
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Sep 13 21:53:19 2015 -0400

    db: Exclude devices and mechanical machines
    
    MAME slipped in a couple new XML attributes while I wasn't looking:
    
      isdevice (yes|no)
      ismechanical (yes|no)
    
    Similar to "isbios (yes|no)", update the available games query to
    exclude BIOS ROMs, device ROMs, and ROMs for mechanical games.
    
    https://bugzilla.gnome.org/710222

 src/gva-columns.c    |    2 ++
 src/gva-db.c         |   20 +++++++++++++++++++-
 src/gva-game-store.c |    2 ++
 src/gva-game-store.h |    6 ++++++
 4 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/src/gva-columns.c b/src/gva-columns.c
index 36a095b..5731bfa 100644
--- a/src/gva-columns.c
+++ b/src/gva-columns.c
@@ -1000,6 +1000,8 @@ column_info[GVA_GAME_STORE_NUM_COLUMNS] =
         { "sourcefile",         N_("Driver"),
                                 columns_factory_sourcefile },
         { "isbios",             NULL },
+        { "isdevice",           NULL },
+        { "ismechanical",       NULL },
         { "runnable",           NULL },
         { "cloneof",            NULL },
         { "romof",              NULL },
diff --git a/src/gva-db.c b/src/gva-db.c
index 9fcf38d..b5a1f66 100644
--- a/src/gva-db.c
+++ b/src/gva-db.c
@@ -52,6 +52,10 @@
                 "sourcefile, " \
                 "isbios DEFAULT 'no' " \
                 "CHECK (isbios in ('yes', 'no')), " \
+                "isdevice DEFAULT 'no' " \
+                "CHECK (isdevice in ('yes', 'no')), " \
+                "ismechanical DEFAULT 'no' " \
+                "CHECK (ismechanical in ('yes', 'no')), " \
                 "runnable DEFAULT 'yes' " \
                 "CHECK (runnable in ('yes', 'no')), " \
                 "cloneof, " \
@@ -243,7 +247,9 @@
                 "LEFT JOIN (SELECT name, description FROM game WHERE " \
                 "isbios = 'yes') AS bios ON game.romof = bios.name " \
                 "WHERE (romset IN ('good', 'best available') " \
-                "AND isbios = 'no');"
+                "AND isbios = 'no' " \
+                "AND isdevice = 'no' " \
+                "AND ismechanical = 'no');"
 
 #define SQL_DROP_TABLES \
         "DROP TABLE IF EXISTS mame; " \
@@ -266,6 +272,8 @@
                 "@category, " \
                 "@sourcefile, " \
                 "@isbios, " \
+                "@isdevice, " \
+                "@ismechanical, " \
                 "@runnable, " \
                 "@cloneof, " \
                 "@romof, " \
@@ -460,6 +468,8 @@ static struct
         const gchar *index_;
         const gchar *input;
         const gchar *isbios;
+        const gchar *isdevice;
+        const gchar *ismechanical;
         const gchar *keydelta;
         const gchar *machine;
         const gchar *mame;
@@ -952,6 +962,8 @@ db_parser_start_element_game (ParserData *data,
 
         /* Bind default values. */
         db_parser_bind_text (stmt, "@isbios", "no");
+        db_parser_bind_text (stmt, "@isdevice", "no");
+        db_parser_bind_text (stmt, "@ismechanical", "no");
         db_parser_bind_text (stmt, "@runnable", "yes");
 
         for (ii = 0; attribute_name[ii] != NULL; ii++)
@@ -967,6 +979,10 @@ db_parser_start_element_game (ParserData *data,
                         param = "@sourcefile";
                 else if (attribute_name[ii] == intern.isbios)
                         param = "@isbios";
+                else if (attribute_name[ii] == intern.isdevice)
+                        param = "@isdevice";
+                else if (attribute_name[ii] == intern.ismechanical)
+                        param = "@ismechanical";
                 else if (attribute_name[ii] == intern.runnable)
                         param = "@runnable";
                 else if (attribute_name[ii] == intern.cloneof)
@@ -1769,6 +1785,8 @@ gva_db_build (GError **error)
         intern.index_        = g_intern_static_string ("index_");
         intern.input         = g_intern_static_string ("input");
         intern.isbios        = g_intern_static_string ("isbios");
+        intern.isdevice      = g_intern_static_string ("isdevice");
+        intern.ismechanical  = g_intern_static_string ("ismechanical");
         intern.keydelta      = g_intern_static_string ("keydelta");
         intern.machine       = g_intern_static_string ("machine");
         intern.mame          = g_intern_static_string ("mame");
diff --git a/src/gva-game-store.c b/src/gva-game-store.c
index 3b164dd..844f653 100644
--- a/src/gva-game-store.c
+++ b/src/gva-game-store.c
@@ -152,6 +152,8 @@ game_store_constructor (GType type,
         types[column++] = G_TYPE_BOOLEAN;    /* COLUMN_FAVORITE */
         types[column++] = G_TYPE_STRING;     /* COLUMN_SOURCEFILE */
         types[column++] = G_TYPE_BOOLEAN;    /* COLUMN_ISBIOS */
+        types[column++] = G_TYPE_BOOLEAN;    /* COLUMN_ISDEVICE */
+        types[column++] = G_TYPE_BOOLEAN;    /* COLUMN_ISMECHANICAL */
         types[column++] = G_TYPE_BOOLEAN;    /* COLUMN_RUNNABLE */
         types[column++] = G_TYPE_STRING;     /* COLUMN_CLONEOF */
         types[column++] = G_TYPE_STRING;     /* COLUMN_ROMOF */
diff --git a/src/gva-game-store.h b/src/gva-game-store.h
index 77411fe..485e537 100644
--- a/src/gva-game-store.h
+++ b/src/gva-game-store.h
@@ -67,6 +67,10 @@ typedef struct _GvaGameStoreClass GvaGameStoreClass;
  *      Corresponds to the "available.sourcefile" database field.
  * @GVA_GAME_STORE_COLUMN_ISBIOS:
  *      Corresponds to the "available.isbios" database field.
+ * @GVA_GAME_STORE_COLUMN_ISDEVICE:
+ *      Corresponds to the "available.isdevice" database field.
+ * @GVA_GAME_STORE_COLUMN_ISMECHANICAL:
+ *      Corresponds to the "available.ismechanical" database field.
  * @GVA_GAME_STORE_COLUMN_RUNNABLE:
  *      Corresponds to the "available.runnable" database field.
  * @GVA_GAME_STORE_COLUMN_CLONEOF:
@@ -142,6 +146,8 @@ typedef enum
         GVA_GAME_STORE_COLUMN_FAVORITE,           /* G_TYPE_BOOLEAN */
         GVA_GAME_STORE_COLUMN_SOURCEFILE,         /* G_TYPE_STRING */
         GVA_GAME_STORE_COLUMN_ISBIOS,             /* G_TYPE_BOOLEAN */
+        GVA_GAME_STORE_COLUMN_ISDEVICE,           /* G_TYPE_BOOLEAN */
+        GVA_GAME_STORE_COLUMN_ISMECHANICAL,       /* G_TYPE_BOOLEAN */
         GVA_GAME_STORE_COLUMN_RUNNABLE,           /* G_TYPE_BOOLEAN */
         GVA_GAME_STORE_COLUMN_CLONEOF,            /* G_TYPE_STRING */
         GVA_GAME_STORE_COLUMN_ROMOF,              /* G_TYPE_STRING */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]