Commit c0fd1864 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

GladePropertyDef, GladeSignalDef: support deprecated since

Add support for deprecated since version
parent d662716d
......@@ -179,7 +179,10 @@ struct _GladePropertyDef
guint deprecated : 1; /* True if this property is deprecated */
gdouble weight; /* This will determine the position of this property in
guint16 deprecated_since_major;
guint16 deprecated_since_minor;
gdouble weight; /* This will determine the position of this property in
* the editor.
*/
......@@ -239,6 +242,8 @@ glade_property_def_new (GladeWidgetAdaptor *adaptor,
property_def->version_since_major = GLADE_WIDGET_ADAPTOR_VERSION_SINCE_MAJOR (adaptor);
property_def->version_since_minor = GLADE_WIDGET_ADAPTOR_VERSION_SINCE_MINOR (adaptor);
property_def->deprecated = GLADE_WIDGET_ADAPTOR_DEPRECATED (adaptor);
property_def->deprecated_since_major = 0;
property_def->deprecated_since_minor = 0;
return property_def;
}
......@@ -1573,6 +1578,22 @@ glade_property_def_since_minor (GladePropertyDef *property_def)
return property_def->version_since_minor;
}
guint16
glade_property_def_deprecated_since_major (GladePropertyDef *property_def)
{
g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), 0);
return property_def->deprecated_since_major;
}
guint16
glade_property_def_deprecated_since_minor (GladePropertyDef *property_def)
{
g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), 0);
return property_def->deprecated_since_minor;
}
void
_glade_property_def_reset_version (GladePropertyDef *property_def)
{
......@@ -1580,6 +1601,8 @@ _glade_property_def_reset_version (GladePropertyDef *property_def)
property_def->version_since_major = 0;
property_def->version_since_minor = 0;
property_def->deprecated_since_major = 0;
property_def->deprecated_since_minor = 0;
}
gboolean
......@@ -2204,6 +2227,10 @@ glade_property_def_update_from_node (GladeXmlNode *node,
&property_def->version_since_major,
&property_def->version_since_minor);
glade_xml_get_property_version (node, GLADE_TAG_DEPRECATED_SINCE,
&property_def->deprecated_since_major,
&property_def->deprecated_since_minor);
property_def->deprecated =
glade_xml_get_property_boolean (node,
GLADE_TAG_DEPRECATED,
......
......@@ -49,6 +49,21 @@ G_BEGIN_DECLS
(glade_property_def_since_minor (GLADE_PROPERTY_DEF (def)) <= minor_version) : \
(glade_property_def_since_major (GLADE_PROPERTY_DEF (def)) <= major_version))
/**
* GLADE_PROPERTY_DEF_DEPRECATED_SINCE_CHECK:
* @def: A #GladePropertyDef
* @major: The major version to check
* @minor: The minor version to check
*
* Evaluates to %TRUE if @def is deprecated in its owning library version-@major.@minor.
*
*/
#define GLADE_PROPERTY_DEF_DEPRECATED_SINCE_CHECK(def, major, minor) \
((glade_property_def_deprecated_since_major (def) || glade_property_def_deprecated_since_minor (def)) ? \
((glade_property_def_deprecated_since_major (def) == major) ? \
(glade_property_def_deprecated_since_minor (def) <= minor) : \
(glade_property_def_deprecated_since_major (def) <= major)) : \
FALSE)
#define GLADE_PROPERTY_DEF_OBJECT_DELIMITER ", "
......@@ -86,17 +101,17 @@ void glade_property_def_set_ignore (GladeProperty
gboolean glade_property_def_get_ignore (GladePropertyDef *property_def);
void glade_property_def_set_name (GladePropertyDef *property_def,
const gchar *name);
const gchar *glade_property_def_get_name (GladePropertyDef *property_def);
const gchar *glade_property_def_get_name (GladePropertyDef *property_def);
void glade_property_def_set_tooltip (GladePropertyDef *property_def,
const gchar *tooltip);
const gchar *glade_property_def_get_tooltip (GladePropertyDef *property_def);
const gchar *glade_property_def_id (GladePropertyDef *property_def);
const gchar *glade_property_def_get_tooltip (GladePropertyDef *property_def);
const gchar *glade_property_def_id (GladePropertyDef *property_def);
gboolean glade_property_def_themed_icon (GladePropertyDef *property_def);
void glade_property_def_set_construct_only (GladePropertyDef *property_def,
gboolean construct_only);
gboolean glade_property_def_get_construct_only (GladePropertyDef *property_def);
const GValue *glade_property_def_get_default (GladePropertyDef *property_def);
const GValue *glade_property_def_get_original_default (GladePropertyDef *property_def);
const GValue *glade_property_def_get_default (GladePropertyDef *property_def);
const GValue *glade_property_def_get_original_default (GladePropertyDef *property_def);
gboolean glade_property_def_translatable (GladePropertyDef *property_def);
gboolean glade_property_def_needs_sync (GladePropertyDef *property_def);
......@@ -113,11 +128,13 @@ gboolean glade_property_def_transfer_on_paste (GladeProperty
gboolean glade_property_def_custom_layout (GladePropertyDef *property_def);
gdouble glade_property_def_weight (GladePropertyDef *property_def);
const gchar *glade_property_def_create_type (GladePropertyDef *property_def);
const gchar *glade_property_def_create_type (GladePropertyDef *property_def);
guint16 glade_property_def_since_major (GladePropertyDef *property_def);
guint16 glade_property_def_since_minor (GladePropertyDef *property_def);
gboolean glade_property_def_deprecated (GladePropertyDef *property_def);
guint16 glade_property_def_deprecated_since_major (GladePropertyDef *property_def);
guint16 glade_property_def_deprecated_since_minor (GladePropertyDef *property_def);
GValue *glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def,
const gchar *string,
......
......@@ -39,7 +39,9 @@ struct _GladeSignalDef
const gchar *type; /* Name of the object class that this signal
* belongs to eg GtkButton */
guint deprecated : 1; /* True if this signal is deprecated */
guint deprecated : 1; /* True if this signal is deprecated */
guint16 deprecated_since_major;
guint16 deprecated_since_minor;
};
G_DEFINE_BOXED_TYPE(GladeSignalDef, glade_signal_def, glade_signal_def_clone, glade_signal_def_free)
......@@ -84,6 +86,8 @@ glade_signal_def_new (GladeWidgetAdaptor *adaptor,
def->version_since_major = GLADE_WIDGET_ADAPTOR_VERSION_SINCE_MAJOR (adaptor);
def->version_since_minor = GLADE_WIDGET_ADAPTOR_VERSION_SINCE_MINOR (adaptor);
def->deprecated = GLADE_WIDGET_ADAPTOR_DEPRECATED (adaptor);
def->deprecated_since_major = 0;
def->deprecated_since_minor = 0;
return def;
}
......@@ -134,6 +138,10 @@ glade_signal_def_update_from_node (GladeSignalDef *signal_def,
&signal_def->version_since_major,
&signal_def->version_since_minor);
glade_xml_get_property_version (node, GLADE_TAG_DEPRECATED_SINCE,
&signal_def->deprecated_since_major,
&signal_def->deprecated_since_minor);
signal_def->deprecated =
glade_xml_get_property_boolean (node,
GLADE_TAG_DEPRECATED,
......@@ -256,6 +264,39 @@ glade_signal_def_since_minor (GladeSignalDef *signal_def)
return signal_def->version_since_minor;
}
/**
* glade_signal_def_deprecated_since_major:
* @signal_def: a #GladeSignalDef
*
* Get the major version that deprecated this signal.
*
* Returns: the major version
*/
guint16
glade_signal_def_deprecated_since_major (GladeSignalDef *signal_def)
{
g_return_val_if_fail (signal_def != NULL, 0);
return signal_def->deprecated_since_major;
}
/**
* glade_signal_def_deprecated_since_minor:
* @signal_def: a #GladeSignalDef
*
* Get the minor version that deprecated this signal.
*
* Returns: the minor version
*/
guint16
glade_signal_def_deprecated_since_minor (GladeSignalDef *signal_def)
{
g_return_val_if_fail (signal_def != NULL, 0);
return signal_def->deprecated_since_minor;
}
/**
* glade_signal_def_set_deprecated:
* @signal_def: a #GladeSignalDef
......
......@@ -29,7 +29,7 @@
G_BEGIN_DECLS
/**
* GLADE_SIGNALS_DEF_VERSION_CHECK:
* GLADE_SIGNAL_DEF_VERSION_CHECK:
* @klass: A #GladeSignalDef
* @major_version: The major version to check
* @minor_version: The minor version to check
......@@ -37,11 +37,26 @@ G_BEGIN_DECLS
* Evaluates to %TRUE if @klass is available in its owning library version-@major_verion.@minor_version.
*
*/
#define GLADE_SIGNALS_DEF_VERSION_CHECK(klass, major_version, minor_version) \
#define GLADE_SIGNAL_DEF_VERSION_CHECK(klass, major_version, minor_version) \
((glade_signal_def_since_major (GLADE_SIGNAL_DEF (klass)) == major_version) ? \
(glade_signal_def_since_minor (GLADE_SIGNAL_DEF (klass)) <= minor_version) : \
(glade_signal_def_since_major (GLADE_SIGNAL_DEF (klass)) <= major_version))
/**
* GLADE_SIGNAL_DEF_DEPRECATED_SINCE_CHECK:
* @klass: A #GladeSignalDef
* @major: The major version to check
* @minor: The minor version to check
*
* Evaluates to %TRUE if @klass is available in its owning library version-@major.@minor.
*
*/
#define GLADE_SIGNAL_DEF_DEPRECATED_SINCE_CHECK(def, major, minor) \
((glade_signal_def_deprecated_since_major (def) || glade_signal_def_deprecated_since_minor (def)) ? \
((glade_signal_def_deprecated_since_major (def) == major) ? \
(glade_signal_def_deprecated_since_minor (def) <= minor) : \
(glade_signal_def_deprecated_since_major (def) <= major)) : \
FALSE)
#define GLADE_SIGNAL_DEF(klass) ((GladeSignalDef *)(klass))
......@@ -60,8 +75,8 @@ void glade_signal_def_update_from_node (GladeSignalDef
const gchar *domain);
GladeWidgetAdaptor *glade_signal_def_get_adaptor (const GladeSignalDef *signal_def);
const gchar *glade_signal_def_get_name (const GladeSignalDef *signal_def);
const gchar *glade_signal_def_get_object_type_name (const GladeSignalDef *signal_def);
const gchar *glade_signal_def_get_name (const GladeSignalDef *signal_def);
const gchar *glade_signal_def_get_object_type_name (const GladeSignalDef *signal_def);
GSignalFlags glade_signal_def_get_flags (const GladeSignalDef *signal_def);
void glade_signal_def_set_since (GladeSignalDef *signal_def,
......@@ -69,6 +84,8 @@ void glade_signal_def_set_since (GladeSignalDef
guint16 since_minor);
guint16 glade_signal_def_since_major (GladeSignalDef *signal_def);
guint16 glade_signal_def_since_minor (GladeSignalDef *signal_def);
guint16 glade_signal_def_deprecated_since_major (GladeSignalDef *signal_def);
guint16 glade_signal_def_deprecated_since_minor (GladeSignalDef *signal_def);
void glade_signal_def_set_deprecated (GladeSignalDef *signal_def,
gboolean deprecated);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment