summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkbuilder.c2
-rw-r--r--gtk/gtkbuilderparser.c11
-rw-r--r--gtk/tools/gtk-builder-tool-simplify.c29
-rw-r--r--gtk/ui/gtkplacesview.ui1
-rw-r--r--gtk/ui/gtkplacesviewrow.ui1
5 files changed, 37 insertions, 7 deletions
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index b6663126cf..ef1237fccc 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -71,7 +71,7 @@
* element contains an `<object>` element which describes the child object.
* The target toolkit version(s) are described by <requires> elements,
* the “lib” attribute specifies the widget library in question (currently
- * the only supported value is “gtk+”) and the “version” attribute specifies
+ * the only supported value is “gtk”) and the “version” attribute specifies
* the target version in the form “`<major>`.`<minor>`”. The builder will error
* out if the version requirements are not met.
*
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index 66ff6981a7..b714a8e869 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -2014,15 +2014,18 @@ end_element (GtkBuildableParseContext *context,
* required versions, possibly throw a signal allowing them
* to check their library versions here.
*/
- if (!strcmp (req_info->library, "gtk+"))
+ if (!strcmp (req_info->library, "gtk"))
{
- if (!GTK_CHECK_VERSION (req_info->major, req_info->minor, 0))
+ if (req_info->major == 4 && req_info->minor == 0)
+ {
+ /* We allow 3.99.x to pass as 4.0 */
+ }
+ else if (gtk_check_version (req_info->major, req_info->minor, 0) != NULL)
{
g_set_error (error,
GTK_BUILDER_ERROR,
GTK_BUILDER_ERROR_VERSION_MISMATCH,
- "Required %s version %d.%d, current version is %d.%d",
- req_info->library,
+ "Required GTK version %d.%d, current version is %d.%d",
req_info->major, req_info->minor,
GTK_MAJOR_VERSION, GTK_MINOR_VERSION);
_gtk_builder_prefix_error (data->builder, context, error);
diff --git a/gtk/tools/gtk-builder-tool-simplify.c b/gtk/tools/gtk-builder-tool-simplify.c
index d40556b0cb..868d0dc49a 100644
--- a/gtk/tools/gtk-builder-tool-simplify.c
+++ b/gtk/tools/gtk-builder-tool-simplify.c
@@ -62,6 +62,7 @@ typedef struct {
char *output_filename;
FILE *output;
gboolean convert3to4;
+ gboolean has_gtk_requires;
} MyParserData;
static void
@@ -1636,6 +1637,17 @@ rewrite_scale (Element *element,
}
static void
+rewrite_requires (Element *element,
+ MyParserData *data)
+{
+ if (has_attribute (element, "lib", "gtk+"))
+ {
+ set_attribute_value (element, "lib", "gtk");
+ set_attribute_value (element, "version", "4.0");
+ }
+}
+
+static void
rewrite_overlay (Element *element,
MyParserData *data)
{
@@ -1978,6 +1990,9 @@ rewrite_element (Element *element,
property_has_been_removed (element, data))
return TRUE;
+ if (g_str_equal (element->element_name, "requires"))
+ rewrite_requires (element, data);
+
return FALSE;
}
@@ -2039,6 +2054,12 @@ enhance_element (Element *element,
{
GList *l;
+ if (strcmp (element->element_name, "requires") == 0 &&
+ has_attribute (element, "lib", "gtk+"))
+ {
+ data->has_gtk_requires = TRUE;
+ }
+
add_old_default_properties (element, data);
for (l = element->children; l; l = l->next)
@@ -2046,6 +2067,13 @@ enhance_element (Element *element,
Element *child = l->data;
enhance_element (child, data);
}
+
+ if (element == data->root && !data->has_gtk_requires)
+ {
+ Element *requires = add_element (element, "requires");
+ set_attribute_value (requires, "lib", "gtk+");
+ set_attribute_value (requires, "version", "3.0");
+ }
}
static void
@@ -2133,6 +2161,7 @@ simplify_file (const char *filename,
data.input_filename = filename;
data.output_filename = NULL;
data.convert3to4 = convert3to4;
+ data.has_gtk_requires = FALSE;
if (replace)
{
diff --git a/gtk/ui/gtkplacesview.ui b/gtk/ui/gtkplacesview.ui
index 98460819b1..7c5a927ae2 100644
--- a/gtk/ui/gtkplacesview.ui
+++ b/gtk/ui/gtkplacesview.ui
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
- <requires lib="gtk+" version="3.16"/>
<object class="GtkListStore" id="completion_store">
<columns>
<column type="gchararray"/>
diff --git a/gtk/ui/gtkplacesviewrow.ui b/gtk/ui/gtkplacesviewrow.ui
index 915d20a189..1941c222a3 100644
--- a/gtk/ui/gtkplacesviewrow.ui
+++ b/gtk/ui/gtkplacesviewrow.ui
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
- <requires lib="gtk+" version="3.16"/>
<template class="GtkPlacesViewRow" parent="GtkListBoxRow">
<property name="width-request">100</property>
<property name="child">