[gnome-software: 7/21] gs-plugin-loader: Use a typedef for the property enum
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 7/21] gs-plugin-loader: Use a typedef for the property enum
- Date: Wed, 27 Apr 2022 10:41:23 +0000 (UTC)
commit 890dd9d9f129b9f7b6379afbac7b9402a20eea98
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Mar 30 13:08:01 2022 +0100
gs-plugin-loader: Use a typedef for the property enum
This allows `-Wswitch-enum` to be useful in catching unhandled
properties in future.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
lib/gs-plugin-loader.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 4e9ee979c..b3eb7ce54 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -105,12 +105,12 @@ enum {
SIGNAL_LAST
};
-enum {
+typedef enum {
PROP_EVENTS = 1,
PROP_ALLOW_UPDATES,
PROP_NETWORK_AVAILABLE,
PROP_NETWORK_METERED,
-};
+} GsPluginLoaderProperty;
static guint signals [SIGNAL_LAST] = { 0 };
@@ -2613,7 +2613,7 @@ gs_plugin_loader_get_property (GObject *object, guint prop_id,
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
- switch (prop_id) {
+ switch ((GsPluginLoaderProperty) prop_id) {
case PROP_EVENTS:
g_value_set_pointer (value, plugin_loader->events_by_id);
break;
@@ -2636,7 +2636,14 @@ static void
gs_plugin_loader_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
- switch (prop_id) {
+ switch ((GsPluginLoaderProperty) prop_id) {
+ case PROP_EVENTS:
+ case PROP_ALLOW_UPDATES:
+ case PROP_NETWORK_AVAILABLE:
+ case PROP_NETWORK_METERED:
+ /* Read only */
+ g_assert_not_reached ();
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]