Commit 77a9f9ea authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

Fixed glade_property_class_make_adjustment() for floating and double


	* gladeui/glade-property-class.c: Fixed glade_property_class_make_adjustment()
	for floating and double values (page inc and size were not properly set).

	* gladeui/glade-app.c: Fixed a warning

	* gladeui/glade-editor-table.c: Was loading invisible properties, oops.
	
	* doc/properties.sgml: Documented custom-layout property.


svn path=/trunk/; revision=1996
parent b27b0834
2008-10-24 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-property-class.c: Fixed glade_property_class_make_adjustment()
for floating and double values (page inc and size were not properly set).
* gladeui/glade-app.c: Fixed a warning
* gladeui/glade-editor-table.c: Was loading invisible properties, oops.
* doc/properties.sgml: Documented custom-layout property.
2008-10-24 Tristan Van Berkom <tvb@gnome.org>
* plugins/gtk+/Makefile.am, plugins/gtk+/glade-button-editor.[ch]:
......
......@@ -151,7 +151,18 @@ Whether to save this property to the glade file (default "True")
<term>visible</term>
<listitem>
<para>
Whether to show the property in the editor (default "True")
Whether to show the property in the editor and reset dialog (default "True")
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>custom-layout</term>
<listitem>
<para>
This is used to avoid loading this property in the editor when implementing
a custom #GladeEditable that embeds the base #GladeEditorTable implementation,
custom-layout properties will still show up in the reset dialog (default "False)
</para>
</listitem>
</varlistentry>
......
......@@ -1347,7 +1347,7 @@ glade_app_command_delete (void)
for (list = glade_app_get_selection ();
list && list->data; list = list->next)
{
widget = glade_widget_get_from_gobject (GTK_WIDGET (list->data));
widget = glade_widget_get_from_gobject (list->data);
widgets = g_list_prepend (widgets, widget);
g_assert (widget);
......
......@@ -206,7 +206,7 @@ get_sorted_properties (GladeWidgetAdaptor *adaptor,
properties = (type == GLADE_PAGE_PACKING) ? adaptor->packing_props : adaptor->properties;
for (l = properties; l && l->data; l = g_list_next (l))
for (l = properties; l; l = g_list_next (l))
{
GladePropertyClass *klass = l->data;
......@@ -214,9 +214,11 @@ get_sorted_properties (GladeWidgetAdaptor *adaptor,
* invisible properties, allow adaptors to filter out properties from
* the GladeEditorTable using the "custom-layout" attribute.
*/
if (!klass->custom_layout && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type) &&
(glade_property_class_is_visible (klass) || type != GLADE_PAGE_QUERY))
if ((!klass->custom_layout) && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type) &&
(glade_property_class_is_visible (klass) || type == GLADE_PAGE_QUERY))
{
list = g_list_prepend (list, klass);
}
}
return g_list_sort (list, property_class_comp);
......
......@@ -50,10 +50,13 @@
#include "glade-debug.h"
#define NUMERICAL_STEP_INCREMENT 1
#define FLOATING_STEP_INCREMENT 0.01F
#define NUMERICAL_PAGE_INCREMENT 10
#define NUMERICAL_PAGE_SIZE 1
#define FLOATING_STEP_INCREMENT 0.01F
#define FLOATING_PAGE_INCREMENT 0.1F
#define FLOATING_PAGE_SIZE 0.01F
/**
* glade_property_class_new:
* @handle: A generic pointer (i.e. a #GladeWidgetClass)
......@@ -1181,6 +1184,7 @@ gpc_read_displayable_values_from_node (GladeXmlNode *node,
GtkAdjustment *
glade_property_class_make_adjustment (GladePropertyClass *property_class)
{
GtkAdjustment *adjustment;
gdouble min = 0, max = 0, def = 0;
gboolean float_range = FALSE;
......@@ -1220,9 +1224,9 @@ glade_property_class_make_adjustment (GladePropertyClass *property_class)
} else if (G_IS_PARAM_SPEC_FLOAT(property_class->pspec))
{
float_range = TRUE;
min = (gdouble)((GParamSpecFloat *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecFloat *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecFloat *) property_class->pspec)->default_value;
min = ((GParamSpecFloat *) property_class->pspec)->minimum;
max = ((GParamSpecFloat *) property_class->pspec)->maximum;
def = ((GParamSpecFloat *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_DOUBLE(property_class->pspec))
{
float_range = TRUE;
......@@ -1235,12 +1239,15 @@ glade_property_class_make_adjustment (GladePropertyClass *property_class)
g_type_name(G_PARAM_SPEC_TYPE (property_class->pspec)));
}
return (GtkAdjustment *)gtk_adjustment_new (def, min, max,
float_range ?
FLOATING_STEP_INCREMENT :
NUMERICAL_STEP_INCREMENT,
NUMERICAL_PAGE_INCREMENT,
NUMERICAL_PAGE_SIZE);
adjustment = (GtkAdjustment *)gtk_adjustment_new (def, min, max,
float_range ?
FLOATING_STEP_INCREMENT :
NUMERICAL_STEP_INCREMENT,
float_range ? FLOATING_PAGE_INCREMENT :
NUMERICAL_PAGE_INCREMENT,
float_range ? FLOATING_PAGE_SIZE :
NUMERICAL_PAGE_SIZE);
return adjustment;
}
/**
......@@ -1419,6 +1426,7 @@ glade_property_class_update_from_node (GladeXmlNode *node,
glade_xml_get_property_boolean (node, GLADE_TAG_LIBGLADE_UNSUPPORTED,
klass->libglade_unsupported);
if ((buf = glade_xml_get_property_string
(node, GLADE_TAG_FACTORY_STOCK_ID)) != NULL)
{
......
......@@ -674,7 +674,7 @@ embedded in another object</_tooltip>
<_tooltip>The stock item for this button</_tooltip>
</property>
<property id="custom-child" save="False" visible="False" default="False">
<property id="custom-child" save="False" custom-layout="True" default="False">
<spec>glade_standard_boolean_spec</spec>
</property>
......
Supports Markdown
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