mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 13:23:07 +02:00
gfilemonitor: Use an enum for properties to allow -Wswitch-enum
This lets the compiler tell us if we’ve accidentally missed a property implementation from `get_property()` or `set_property()`. Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
parent
40fd0e4759
commit
5aa42683ee
@ -64,12 +64,11 @@ struct _GFileMonitorPrivate
|
|||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFileMonitor, g_file_monitor, G_TYPE_OBJECT)
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFileMonitor, g_file_monitor, G_TYPE_OBJECT)
|
||||||
|
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_RATE_LIMIT = 1,
|
||||||
PROP_RATE_LIMIT,
|
|
||||||
PROP_CANCELLED
|
PROP_CANCELLED
|
||||||
};
|
} GFileMonitorProperty;
|
||||||
|
|
||||||
static guint g_file_monitor_changed_signal;
|
static guint g_file_monitor_changed_signal;
|
||||||
|
|
||||||
@ -79,16 +78,17 @@ g_file_monitor_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
//GFileMonitor *monitor;
|
switch ((GFileMonitorProperty) prop_id)
|
||||||
|
|
||||||
//monitor = G_FILE_MONITOR (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
{
|
||||||
case PROP_RATE_LIMIT:
|
case PROP_RATE_LIMIT:
|
||||||
/* not supported by default */
|
/* not supported by default */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_CANCELLED:
|
||||||
|
/* Read only */
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -101,7 +101,7 @@ g_file_monitor_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
switch (prop_id)
|
switch ((GFileMonitorProperty) prop_id)
|
||||||
{
|
{
|
||||||
case PROP_RATE_LIMIT:
|
case PROP_RATE_LIMIT:
|
||||||
/* we expect this to be overridden... */
|
/* we expect this to be overridden... */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user