[gtk+/composite-templates] Implemented id tag for template and added cheack for id to be 'this'
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] Implemented id tag for template and added cheack for id to be 'this'
- Date: Thu, 26 Jul 2012 11:49:21 +0000 (UTC)
commit 0583a0d349fc64013721723de9d5937a3ebbdb67
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Thu Jul 26 08:47:31 2012 -0300
Implemented id tag for template and added cheack for id to be 'this'
gtk/gtkbuilderparser.c | 25 +++++++++++++++++++++----
gtk/gtkdialog.ui | 4 ++--
gtk/gtkmessagedialog.ui | 4 ++--
3 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index 19c657f..10b4c1f 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -679,6 +679,7 @@ parse_template (ParserData *data,
GObject *parent = data->template_object;
const gchar *parent_class = NULL;
const gchar *class_name = NULL;
+ const gchar *id = NULL;
GType parent_type, class_type;
ObjectInfo *object_info;
gint i;
@@ -695,11 +696,13 @@ parse_template (ParserData *data,
class_name = values[i];
else if (strcmp (names[i], "parent") == 0)
parent_class = values[i];
+ else if (strcmp (names[i], "id") == 0)
+ id = values[i];
else
- {
- error_invalid_attribute (data, element_name, names[i], error);
- return;
- }
+ {
+ error_invalid_attribute (data, element_name, names[i], error);
+ return;
+ }
}
if (!class_name)
@@ -714,6 +717,20 @@ parse_template (ParserData *data,
return;
}
+ if (!id)
+ {
+ error_missing_attribute (data, element_name, "id", error);
+ return;
+ }
+
+ if (strcmp (id, "this"))
+ {
+ error_generic (error, GTK_BUILDER_ERROR_INVALID_VALUE, data,
+ element_name, "%s template should be named 'this' not %s '%s'",
+ class_name, id);
+ return;
+ }
+
if ((class_type = g_type_from_name (class_name)) == G_TYPE_INVALID)
{
error_generic (error, GTK_BUILDER_ERROR_TEMPLATE_CLASS_MISMATCH, data,
diff --git a/gtk/gtkdialog.ui b/gtk/gtkdialog.ui
index 6fe9195..b078f5c 100644
--- a/gtk/gtkdialog.ui
+++ b/gtk/gtkdialog.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.20"/>
- <template class="GtkDialog" parent="GtkWindow">
+ <!-- interface-requires gtk+ 3.0 -->
+ <template parent="GtkWindow" class="GtkDialog" id="this">
<child>
<object class="GtkBox" id="vbox">
<property name="visible">True</property>
diff --git a/gtk/gtkmessagedialog.ui b/gtk/gtkmessagedialog.ui
index b499186..8f2332f 100644
--- a/gtk/gtkmessagedialog.ui
+++ b/gtk/gtkmessagedialog.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.20"/>
- <template class="GtkMessageDialog" parent="GtkDialog">
+ <!-- interface-requires gtk+ 3.0 -->
+ <template parent="GtkDialog" class="GtkMessageDialog" id="this">
<child internal-child="vbox">
<object class="GtkBox" id="vbox">
<property name="spacing">14</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]