From: Dana Jansens Date: Mon, 8 Aug 2011 22:02:57 +0000 (-0400) Subject: Remove complicated stuff from config_value.c that we're not using at the moment. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=984d8b97029a55cc3b0187af98490b004f437022;p=dana%2Fopenbox.git Remove complicated stuff from config_value.c that we're not using at the moment. --- diff --git a/openbox/config_value.c b/openbox/config_value.c index b871ec0c..ef6db3bf 100644 --- a/openbox/config_value.c +++ b/openbox/config_value.c @@ -79,53 +79,6 @@ gboolean config_value_is_action_list(const ObConfigValue *v) return v->type == OB_CV_ACTION_LIST; } -/**************************** pointer functions ****************************/ - -void config_value_copy_ptr(ObConfigValue *v, - ObConfigValueDataType type, - ObConfigValueDataPtr p, - const ObConfigValueEnum e[]) -{ - switch (type) { - case OB_CONFIG_VALUE_STRING: - *p.string = config_value_string(v); - break; - case OB_CONFIG_VALUE_BOOLEAN: - *p.boolean = config_value_bool(v); - break; - case OB_CONFIG_VALUE_INTEGER: - *p.integer = config_value_int(v); - break; - case OB_CONFIG_VALUE_ENUM: - *p.enumeration = config_value_enum(v, e); - break; - case OB_CONFIG_VALUE_FRACTION: { - gint n, d; - config_value_fraction(v, &n, &d); - p.fraction->numer = n; - p.fraction->denom = d; - break; - } - case OB_CONFIG_VALUE_GRAVITY_COORD: { - GravityCoord c; - config_value_gravity_coord(v, &c); - *p.coord = c; - break; - } - case OB_CONFIG_VALUE_STRING_LIST: { - *p.list = config_value_string_list(v); - break; - } - case OB_CONFIG_VALUE_ACTIONLIST: - *p.actions = config_value_action_list(v); - break; - case NUM_OB_CONFIG_VALUE_TYPES: - default: - g_assert_not_reached(); - } -} - - /***************************** getter functions ****************************/ const gchar* config_value_string(ObConfigValue *v) @@ -149,19 +102,6 @@ guint config_value_int(ObConfigValue *v) s = v->v.string; return strtol(s, &s, 10); } -guint config_value_enum(ObConfigValue *v, const ObConfigValueEnum choices[]) -{ - const ObConfigValueEnum *e; - - g_return_val_if_fail(v != NULL, (guint)-1); - g_return_val_if_fail(config_value_is_string(v), (guint)-1); - g_return_val_if_fail(choices != NULL, (guint)-1); - - for (e = choices; e->name; ++e) - if (g_strcasecmp(v->v.string, e->name) == 0) - return e->value; - return (guint)-1; -} void config_value_fraction(ObConfigValue *v, gint *numer, gint *denom) { gchar *s; diff --git a/openbox/config_value.h b/openbox/config_value.h index d1123341..d68dac9d 100644 --- a/openbox/config_value.h +++ b/openbox/config_value.h @@ -24,40 +24,6 @@ struct _GravityCoord; struct _ObActionList; typedef struct _ObConfigValue ObConfigValue; -typedef struct _ObConfigValueEnum ObConfigValueEnum; - -struct _ObConfigValueEnum { - const gchar *name; - guint value; -}; - -typedef enum { - OB_CONFIG_VALUE_STRING, - OB_CONFIG_VALUE_BOOLEAN, - OB_CONFIG_VALUE_ENUM, - OB_CONFIG_VALUE_INTEGER, - OB_CONFIG_VALUE_FRACTION, - OB_CONFIG_VALUE_GRAVITY_COORD, - OB_CONFIG_VALUE_STRING_LIST, - OB_CONFIG_VALUE_ACTIONLIST, - NUM_OB_CONFIG_VALUE_TYPES -} ObConfigValueDataType; - -/*! This holds a pointer to one of the possible types in ObConfigValueType. */ -typedef union _ObConfigValueDataPtr { - const gpointer *pointer; /*!< Generic pointer */ - const gchar **string; - gboolean *boolean; - guint *integer; - guint *enumeration; - struct { - guint numer; - guint denom; - } *fraction; - struct _GravityCoord *coord; - const gchar *const**list; - struct _ObActionList **actions; -} ObConfigValueDataPtr; void config_value_ref(ObConfigValue *v); void config_value_unref(ObConfigValue *v); @@ -81,20 +47,11 @@ gboolean config_value_is_string(const ObConfigValue *v); gboolean config_value_is_string_list(const ObConfigValue *v); gboolean config_value_is_action_list(const ObConfigValue *v); -/*! Copies the data inside @v to the destination that the pointer @p is - pointing to. */ -void config_value_copy_ptr(ObConfigValue *v, - ObConfigValueDataType type, - ObConfigValueDataPtr p, - const ObConfigValueEnum e[]); - /* These ones are valid on a string value */ const gchar* config_value_string(ObConfigValue *v); gboolean config_value_bool(ObConfigValue *v); guint config_value_int(ObConfigValue *v); -/*! returns (guint)-1 if an error */ -guint config_value_enum(ObConfigValue *v, const ObConfigValueEnum e[]); void config_value_fraction(ObConfigValue *v, gint *numer, gint *denom); void config_value_gravity_coord(ObConfigValue *v, struct _GravityCoord *c);