Commit 6a10020e authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

GladeWidgetAdaptor: added deprecated-since metadata

Added metadata needed to know in which Gtk version a class is deprecated
parent 5887067a
......@@ -3500,10 +3500,11 @@ glade_project_verify_adaptor (GladeProject *project,
}
if ((flags & GLADE_VERIFY_DEPRECATIONS) != 0 &&
GWA_DEPRECATED (adaptor_iter))
(GWA_DEPRECATED (adaptor_iter) ||
GWA_DEPRECATED_SINCE_CHECK (adaptor_iter, target_major, target_minor)))
{
GLADE_NOTE (VERIFY, g_print ("VERIFY: Adaptor '%s' is deprecated\n",
glade_widget_adaptor_get_name (adaptor_iter)));
GLADE_NOTE (VERIFY, g_print ("VERIFY: Adaptor '%s' is deprecated\n",
glade_widget_adaptor_get_name (adaptor_iter)));
if (forwidget)
{
......
......@@ -1686,6 +1686,8 @@ gwa_derived_class_init (GladeWidgetAdaptorClass *adaptor_class,
{
GladeXmlNode *node = data->node;
GModule *module = data->module;
guint16 deprecated_since_major = 0;
guint16 deprecated_since_minor = 0;
/* Load catalog symbols from module */
if (module)
......@@ -1700,6 +1702,12 @@ gwa_derived_class_init (GladeWidgetAdaptorClass *adaptor_class,
glade_xml_get_property_boolean
(node, GLADE_TAG_DEPRECATED, adaptor_class->deprecated);
glade_xml_get_property_version
(node, GLADE_TAG_DEPRECATED_SINCE,
&deprecated_since_major, &deprecated_since_minor);
adaptor_class->deprecated_since_major = deprecated_since_major;
adaptor_class->deprecated_since_minor = deprecated_since_minor;
adaptor_class->toplevel =
glade_xml_get_property_boolean
(node, GLADE_TAG_TOPLEVEL, adaptor_class->toplevel);
......
......@@ -64,6 +64,40 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
(GWA_VERSION_SINCE_MINOR (adaptor) <= minor_version) : \
(GWA_VERSION_SINCE_MAJOR (adaptor) <= major_version))
/**
* GWA_DEPRECATED_SINCE_MAJOR:
* @obj: A #GladeWidgetAdaptor
*
* Checks major version in which this widget was deprecated
*/
#define GWA_DEPRECATED_SINCE_MAJOR(obj) \
((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->deprecated_since_major : 0)
/**
* GWA_DEPRECATED_SINCE_MINOR:
* @obj: A #GladeWidgetAdaptor
*
* Checks minor version in which this widget was deprecated
*/
#define GWA_DEPRECATED_SINCE_MINOR(obj) \
((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->deprecated_since_minor : 0)
/**
* GWA_DEPRECATED_SINCE_CHECK:
* @adaptor: A #GladeWidgetAdaptor
* @major_version: The major version to check
* @minor_version: The minor version to check
*
* Evaluates to %TRUE if @adaptor is deprecated in its owning library version-@major_verion.@minor_version.
*
*/
#define GWA_DEPRECATED_SINCE_CHECK(adaptor, major_version, minor_version) \
((GWA_DEPRECATED_SINCE_MAJOR (adaptor) || GWA_DEPRECATED_SINCE_MINOR (adaptor)) ? \
((GWA_DEPRECATED_SINCE_MAJOR (adaptor) == major_version) ? \
(GWA_DEPRECATED_SINCE_MINOR (adaptor) <= minor_version) : \
(GWA_DEPRECATED_SINCE_MAJOR (adaptor) <= major_version)) : \
FALSE)
/**
* GWA_IS_TOPLEVEL:
* @obj: A #GladeWidgetAdaptor
......@@ -681,13 +715,15 @@ struct _GladeWidgetAdaptorClass
GladeDestroyObjectFunc destroy_object; /* Object destructor */
GladeWriteWidgetFunc write_widget_after;/* Writes widget attributes to the xml (after children) */
guint16 deprecated_since_major;
guint16 deprecated_since_minor;
void (* glade_reserved1) (void);
void (* glade_reserved2) (void);
void (* glade_reserved3) (void);
void (* glade_reserved4) (void);
void (* glade_reserved5) (void);
void (* glade_reserved6) (void);
};
#define glade_widget_adaptor_create_widget(adaptor, query, ...) \
......
......@@ -69,6 +69,7 @@ typedef struct _GladeProject GladeProject;
#define GLADE_TAG_VERSION_SINCE "since"
#define GLADE_TAG_BUILDER_SINCE "gtkbuilder-since"
#define GLADE_TAG_DEPRECATED "deprecated"
#define GLADE_TAG_DEPRECATED_SINCE "deprecated-since"
#define GLADE_TAG_GLADE_CATALOG "glade-catalog"
#define GLADE_TAG_GLADE_WIDGET_CLASSES "glade-widget-classes"
......
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