diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-06-01 17:58:22 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-06-01 18:04:02 -0300 |
commit | 6a10020e766f2546400f18f48626a94f6dfc655f (patch) | |
tree | 4aec7efc0e752ab90c6530fa828910f659595a57 /gladeui | |
parent | 5887067a98dd916441bb84c00129dbf1a03a1285 (diff) | |
download | glade-6a10020e766f2546400f18f48626a94f6dfc655f.tar.gz |
GladeWidgetAdaptor: added deprecated-since metadata
Added metadata needed to know in which Gtk version a class is deprecated
Diffstat (limited to 'gladeui')
-rw-r--r-- | gladeui/glade-project.c | 7 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.c | 8 | ||||
-rw-r--r-- | gladeui/glade-widget-adaptor.h | 40 | ||||
-rw-r--r-- | gladeui/glade-xml-utils.h | 1 |
4 files changed, 51 insertions, 5 deletions
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c index ae2d9e2d..f19611ef 100644 --- a/gladeui/glade-project.c +++ b/gladeui/glade-project.c @@ -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) { diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index f7854989..9a00b546 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -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); diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h index 7461c423..da02f257 100644 --- a/gladeui/glade-widget-adaptor.h +++ b/gladeui/glade-widget-adaptor.h @@ -65,6 +65,40 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass; (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, ...) \ diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h index f9a68aa0..6b00b270 100644 --- a/gladeui/glade-xml-utils.h +++ b/gladeui/glade-xml-utils.h @@ -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" |