[gnome-software: 22/25] gs-app-row: Add cast to property enum type for switch




commit 8124fbec7ba5b67f497b1f95e7e33d6a2cf680af
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Feb 2 12:33:12 2021 +0000

    gs-app-row: Add cast to property enum type for switch
    
    This means that the compiler will warn about unhandled properties if
    compiling with `-Wswitch-enum`. Previously it couldn’t as it only knew
    the `prop_id` was an integer.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-app-row.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index f4e97d77a..45d1c372c 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -599,7 +599,7 @@ gs_app_row_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
        GsAppRow *app_row = GS_APP_ROW (object);
        GsAppRowPrivate *priv = gs_app_row_get_instance_private (app_row);
 
-       switch (prop_id) {
+       switch ((GsAppRowProperty) prop_id) {
        case PROP_APP:
                g_value_set_object (value, priv->app);
                break;
@@ -623,7 +623,7 @@ gs_app_row_set_property (GObject *object, guint prop_id, const GValue *value, GP
 {
        GsAppRow *app_row = GS_APP_ROW (object);
 
-       switch (prop_id) {
+       switch ((GsAppRowProperty) prop_id) {
        case PROP_APP:
                gs_app_row_set_app (app_row, g_value_get_object (value));
                break;


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