Commit f808abe8 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

print a message for missing displayable values in

* gladeui/glade-property-class.c: print a message for missing displayable values in
  glade_property_class_update_from_node() and gpc_get_displayable_values_from_node()

* plugins/gtk+/glade-gtk.c: removed inline displayable values in
   glade_gtk_image_type_get_type() and glade_gtk_button_type_get_type()

* plugins/gtk+/gtk+.xml.in: added missing displayable values in GtkToolButton::glade-type,
  GtkButton::glade-type, GtkImage::glade-type and GtkArrow::arrow-type

svn path=/trunk/; revision=1398
parent 475909ca
2007-06-26 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* gladeui/glade-property-class.c: print a message for missing displayable values in
glade_property_class_update_from_node() and gpc_get_displayable_values_from_node()
* plugins/gtk+/glade-gtk.c: removed inline displayable values in
glade_gtk_image_type_get_type() and glade_gtk_button_type_get_type()
* plugins/gtk+/gtk+.xml.in: added missing displayable values in GtkToolButton::glade-type,
GtkButton::glade-type, GtkImage::glade-type and GtkArrow::arrow-type
2007-06-26 Vincent Geddes <vgeddes@gnome.org>
* src/Makefile.am
......
......@@ -1376,12 +1376,28 @@ glade_property_class_get_displayable_value(GladePropertyClass *klass, gint value
*/
static GArray *
gpc_get_displayable_values_from_node (GladeXmlNode *node,
GEnumValue *values,
gint n_values,
GladePropertyClass *klass,
const gchar *domain)
{
gpointer the_class = g_type_class_ref(klass->pspec->value_type);
GArray *array;
GladeXmlNode *child;
GEnumValue *values;
gint n_values, n = 0;
gboolean first_not_found = TRUE;
if (G_IS_PARAM_SPEC_ENUM(klass->pspec))
{
GEnumClass *eclass = the_class;
values = eclass->values;
n_values = eclass->n_values;
}
else
{
GFlagsClass *fclass = the_class;
values = (GEnumValue*)fclass->values;
n_values = fclass->n_values;
}
if ((child = glade_xml_search_child (node, GLADE_TAG_VALUE)) == NULL)
return NULL;
......@@ -1425,11 +1441,53 @@ gpc_get_displayable_values_from_node (GladeXmlNode *node,
break;
}
}
if (i == n_values)
{
if (first_not_found)
{
g_message (_("Displayable value id not found in %s::%s"),
((GladeWidgetAdaptor*)klass->handle)->name, klass->id);
first_not_found = FALSE;
}
g_message ("\t%s",id);
}
else n++;
g_free(id);
child = glade_xml_node_next (child);
}
if (n != n_values)
{
gint i;
g_message (_("%d missing displayable value for %s::%s"), n_values - n,
((GladeWidgetAdaptor*)klass->handle)->name, klass->id);
for(i=0; i < n_values; i++)
{
gboolean not_found = TRUE;
child = glade_xml_node_get_children (node);
while (child != NULL)
{
if(strcmp (glade_xml_get_property_string_required (child, GLADE_TAG_ID, NULL),
values[i].value_name) == 0)
{
not_found = FALSE;
break;
}
child = glade_xml_node_next (child);
}
if (not_found)
g_message ("\t%s", values[i].value_name);
}
}
g_type_class_unref(the_class);
return array;
}
......@@ -1628,32 +1686,6 @@ glade_property_class_update_from_node (GladeXmlNode *node,
klass->tooltip = g_strdup (dgettext (domain, buff));
}
/* If this property's value is an enumeration then we try to get the displayable values */
if (G_IS_PARAM_SPEC_ENUM(klass->pspec))
{
GEnumClass *eclass = g_type_class_ref(klass->pspec->value_type);
child = glade_xml_search_child (node, GLADE_TAG_DISPLAYABLE_VALUES);
if (child)
klass->displayable_values = gpc_get_displayable_values_from_node
(child, eclass->values, eclass->n_values, domain);
g_type_class_unref(eclass);
}
/* the same way if it is a Flags property */
if (G_IS_PARAM_SPEC_FLAGS(klass->pspec))
{
GFlagsClass *fclass = g_type_class_ref(klass->pspec->value_type);
child = glade_xml_search_child (node, GLADE_TAG_DISPLAYABLE_VALUES);
if (child)
klass->displayable_values = gpc_get_displayable_values_from_node
(child, (GEnumValue*)fclass->values, fclass->n_values, domain);
g_type_class_unref(fclass);
}
/* Visible lines */
glade_xml_get_value_int (node, GLADE_TAG_VISIBLE_LINES, &klass->visible_lines);
......@@ -1679,6 +1711,28 @@ glade_property_class_update_from_node (GladeXmlNode *node,
klass->transfer_on_paste = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSFER_ON_PASTE, klass->transfer_on_paste);
klass->save_always = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE_ALWAYS, klass->save_always);
/* If this property's value is an enumeration or flag then we try to get the displayable values */
if (G_IS_PARAM_SPEC_ENUM(klass->pspec) ||
G_IS_PARAM_SPEC_FLAGS(klass->pspec))
{
child = glade_xml_search_child (node, GLADE_TAG_DISPLAYABLE_VALUES);
if (child)
{
klass->displayable_values = gpc_get_displayable_values_from_node
(child, klass, domain);
}
else if (!klass->displayable_values && klass->visible &&
klass->pspec->value_type != GLADE_TYPE_STOCK &&
klass->pspec->value_type != GLADE_TYPE_STOCK_IMAGE)
{
/* Displayable values could be defined in the parent class
* We do not need displayable values if the property is not visible
*/
g_message (_("No displayable values for %s::%s"),
((GladeWidgetAdaptor*)klass->handle)->name, klass->id);
}
}
/* A sprinkle of hard-code to get atk properties working right
*/
if (glade_xml_get_property_boolean (node, GLADE_TAG_ATK_ACTION, FALSE))
......
......@@ -178,14 +178,11 @@ glade_gtk_image_type_get_type (void)
static GType etype = 0;
if (etype == 0) {
static GEnumValue values[] = {
{ GLADEGTK_IMAGE_FILENAME, "a", "glade-gtk-image-filename" },
{ GLADEGTK_IMAGE_STOCK, "b", "glade-gtk-image-stock" },
{ GLADEGTK_IMAGE_ICONTHEME, "c", "glade-gtk-image-icontheme" },
{ GLADEGTK_IMAGE_FILENAME, "GLADEGTK_IMAGE_FILENAME", "glade-gtk-image-filename" },
{ GLADEGTK_IMAGE_STOCK, "GLADEGTK_IMAGE_STOCK", "glade-gtk-image-stock" },
{ GLADEGTK_IMAGE_ICONTHEME, "GLADEGTK_IMAGE_ICONTHEME", "glade-gtk-image-icontheme" },
{ 0, NULL, NULL }
};
values[GLADEGTK_IMAGE_FILENAME].value_name = _("Filename");
values[GLADEGTK_IMAGE_STOCK].value_name = _("Stock");
values[GLADEGTK_IMAGE_ICONTHEME].value_name = _("Icon Theme");
etype = g_enum_register_static ("GladeGtkImageType", values);
}
......@@ -198,14 +195,11 @@ glade_gtk_button_type_get_type (void)
static GType etype = 0;
if (etype == 0) {
static GEnumValue values[] = {
{ GLADEGTK_BUTTON_LABEL, "a", "glade-gtk-button-label" },
{ GLADEGTK_BUTTON_STOCK, "b", "glade-gtk-button-stock" },
{ GLADEGTK_BUTTON_CONTAINER, "c", "glade-gtk-button-container" },
{ GLADEGTK_BUTTON_LABEL, "GLADEGTK_BUTTON_LABEL", "glade-gtk-button-label" },
{ GLADEGTK_BUTTON_STOCK, "GLADEGTK_BUTTON_STOCK", "glade-gtk-button-stock" },
{ GLADEGTK_BUTTON_CONTAINER, "GLADEGTK_BUTTON_CONTAINER", "glade-gtk-button-container" },
{ 0, NULL, NULL }
};
values[GLADEGTK_BUTTON_LABEL].value_name = _("Label");
values[GLADEGTK_BUTTON_STOCK].value_name = _("Stock");
values[GLADEGTK_BUTTON_CONTAINER].value_name = _("Container");
etype = g_enum_register_static ("GladeGtkButtonType", values);
}
......
......@@ -463,6 +463,11 @@ embedded in another object</_tooltip>
<property id="label-widget" disabled="True"/>
<property id="glade-type" _name="Image Type" save="False">
<spec>glade_gtk_image_type_spec</spec>
<displayable-values>
<value id="GLADEGTK_IMAGE_FILENAME" _name="Filename"/>
<value id="GLADEGTK_IMAGE_STOCK" _name="Stock"/>
<value id="GLADEGTK_IMAGE_ICONTHEME" _name="Icon Theme"/>
</displayable-values>
</property>
<property id="glade-stock" _name="Stock Image" save="False">
<spec>glade_standard_stock_image_spec</spec>
......@@ -619,6 +624,11 @@ embedded in another object</_tooltip>
<property id="glade-type" _name="Edit Type" save="False" weight="0">
<spec>glade_gtk_button_type_spec</spec>
<displayable-values>
<value id="GLADEGTK_BUTTON_LABEL" _name="Label"/>
<value id="GLADEGTK_BUTTON_STOCK" _name="Stock"/>
<value id="GLADEGTK_BUTTON_CONTAINER" _name="Container"/>
</displayable-values>
</property>
<property id="response-id" _name="Response ID" default="0" common="False" ignore="True" save-always="True">
......@@ -841,6 +851,11 @@ embedded in another object</_tooltip>
<property id="stock" visible="False" default="gtk-missing-image"/>
<property id="glade-type" _name="Edit Type" save="False" weight="0">
<spec>glade_gtk_image_type_spec</spec>
<displayable-values>
<value id="GLADEGTK_IMAGE_FILENAME" _name="Filename"/>
<value id="GLADEGTK_IMAGE_STOCK" _name="Stock"/>
<value id="GLADEGTK_IMAGE_ICONTHEME" _name="Icon Theme"/>
</displayable-values>
</property>
<property id="pixbuf-animation" disabled="True"/>
<property id="file" disabled="True"/>
......@@ -1126,6 +1141,7 @@ embedded in another object</_tooltip>
<value id="GTK_ARROW_DOWN" _name="Down"/>
<value id="GTK_ARROW_LEFT" _name="Left"/>
<value id="GTK_ARROW_RIGHT" _name="Right"/>
<value id="GTK_ARROW_NONE" _name="None"/>
</displayable-values>
</property>
<property id="shadow-type">
......
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