Commit 67fb3f57 authored by Tristan Van Berkom's avatar Tristan Van Berkom

stock spec name fixed and removed construct only.

	* src/glade-builtins.c: stock spec name fixed and removed construct only.

	* src/glade-property.c:
	  - Fixed glade_property_dup () to use properties.
	  - Fixed double free in glade_property_finalize (thankyou valgrind)

	* src/main.c: Removed workaround for an old fixed bug in gtk+, no reason to have
	  obscure code like that when we are targeting a recent version of gtk+.

	* widgets/gtk+.xml: Ignore selectable changes & implement ignore property

	* src/glade-property-class.c, src/glade-property.[ch]: implement ignore
parent 1091ad43
2005-07-30 Tristan Van Berkom <tvb@gnome.org>
* src/glade-builtins.c: stock spec name fixed and removed construct only.
* src/glade-property.c:
- Fixed glade_property_dup () to use properties.
- Fixed double free in glade_property_finalize (thankyou valgrind)
* src/main.c: Removed workaround for an old fixed bug in gtk+, no reason to have
obscure code like that when we are targeting a recent version of gtk+.
* widgets/gtk+.xml: Ignore selectable changes & implement ignore property
* src/glade-property-class.c, src/glade-property.[ch]: implement ignore
2005-07-29 Tristan Van Berkom <tvb@gnome.org>
* src/Makefile.am, src/glade-plugin.h, src/glade-buildtins.[ch], widgets/gtk+.xml:
......
......@@ -70,7 +70,7 @@ glade_standard_stock_get_type (void)
values = g_array_append_val (values, value);
}
etype = g_enum_register_static ("GladeGtkStockType", (GEnumValue *)values->data);
etype = g_enum_register_static ("GladeStock", (GEnumValue *)values->data);
g_slist_free (stock_list);
}
......@@ -83,7 +83,7 @@ glade_standard_stock_spec (void)
return g_param_spec_enum ("stock", _("Stock"),
_("A builtin stock item"),
glade_standard_stock_get_type (),
0, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
0, G_PARAM_READWRITE);
}
GParamSpec *
......
......@@ -921,19 +921,6 @@ empty (GObject *container)
{
}
/**
* ignore:
* @object: a #GObject
* @value: a #GValue
*
* This function does absolutely nothing
*/
void GLADEGTK_API
ignore (GObject *object, GValue *value)
{
}
/* ------------------------- Post Create functions ------------------------- */
static gboolean
glade_gtk_fixed_button_press (GtkWidget *widget,
......
......@@ -62,12 +62,13 @@ glade_property_class_new (void)
property_class->optional_default = TRUE;
property_class->common = FALSE;
property_class->packing = FALSE;
property_class->save = TRUE;
property_class->is_modified = FALSE;
property_class->verify_function = NULL;
property_class->set_function = NULL;
property_class->get_function = NULL;
property_class->visible = TRUE;
property_class->save = TRUE;
property_class->ignore = FALSE;
property_class->translatable = TRUE;
return property_class;
......@@ -812,12 +813,12 @@ glade_property_class_update_from_node (GladeXmlNode *node,
class->translatable = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSLATABLE, TRUE);
/* common, optional, etc */
class->common = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, class->common);
class->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, FALSE);
class->query = glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, FALSE);
class->save = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE, TRUE);
class->visible = glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, TRUE);
class->common = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, class->common);
class->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, class->optional);
class->query = glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, class->query);
class->save = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE, class->save);
class->visible = glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, class->visible);
class->ignore = glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, class->ignore);
if (class->optional)
class->optional_default =
......
......@@ -142,11 +142,18 @@ struct _GladePropertyClass
* UI.
*/
/* These three are the master switches for the glade-file output,
* property editor availability & live object updates in the glade environment.
*/
gboolean save; /* Whether we should save to the glade file or not
* (mostly just for custom glade properties)
*/
gboolean visible; /* Whether or not to show this property in the editor
*/
gboolean ignore; /* When true, we will not sync the object when the property
* changes.
*/
gboolean is_modified; /* If true, this property_class has been "modified" from the
* the standard property by a xml file. */
......
......@@ -70,18 +70,26 @@ glade_property_dup_impl (GladeProperty *template, GladeWidget *widget)
{
GladeProperty *property;
property = g_object_new (GLADE_TYPE_PROPERTY, NULL);
property = g_object_new (GLADE_TYPE_PROPERTY,
"enabled", template->enabled,
"sensitive", template->sensitive,
"i18n-translatable", template->i18n_translatable,
"i18n-has-context", template->i18n_has_context,
"i18n-comment", template->i18n_comment,
NULL);
property->class = template->class;
property->widget = widget;
property->value = g_new0 (GValue, 1);
property->enabled = template->enabled;
property->insensitive_tooltip =
template->insensitive_tooltip ?
g_strdup (template->insensitive_tooltip) : NULL;
g_value_init (property->value, template->value->g_type);
g_value_copy (template->value, property->value);
property->i18n_translatable = template->i18n_translatable;
property->i18n_has_context = template->i18n_has_context;
property->i18n_comment = g_strdup (template->i18n_comment);
return property;
}
......@@ -158,7 +166,9 @@ glade_property_get_value_impl (GladeProperty *property, GValue *value)
static void
glade_property_sync_impl (GladeProperty *property)
{
if (!property->enabled || property->loading)
if (property->enabled == FALSE ||
property->class->ignore ||
property->loading)
return;
property->loading = TRUE;
......@@ -368,7 +378,6 @@ glade_property_get_real_property (GObject *object,
}
}
static void
glade_property_finalize (GObject *object)
{
......@@ -378,10 +387,9 @@ glade_property_finalize (GObject *object)
{
g_value_unset (property->value);
g_free (property->value);
property->value = NULL;
}
g_free (property->i18n_comment);
g_free (property);
if (property->i18n_comment)
g_free (property->i18n_comment);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -459,7 +467,7 @@ glade_property_cinfo_init (GladePropertyCinfo *prop_class)
/* Signals */
glade_property_signals[VALUE_CHANGED] =
g_signal_new ("value-changed",
G_TYPE_FROM_CLASS (parent_class),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GladePropertyCinfo,
value_changed),
......@@ -469,7 +477,7 @@ glade_property_cinfo_init (GladePropertyCinfo *prop_class)
glade_property_signals[TOOLTIP_CHANGED] =
g_signal_new ("tooltip-changed",
G_TYPE_FROM_CLASS (parent_class),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GladePropertyCinfo,
tooltip_changed),
......@@ -499,7 +507,6 @@ glade_property_get_type (void)
sizeof (GladeProperty),
0, /* n_preallocs */
(GInstanceInitFunc) glade_property_init,
NULL /* value_table */
};
property_type =
g_type_register_static (G_TYPE_OBJECT,
......
......@@ -45,7 +45,7 @@ struct _GladeProperty
* of the property->input state for the loaded
* widget.
*/
/* Used only for translatable strings. */
gboolean i18n_translatable;
gboolean i18n_has_context;
......
......@@ -108,6 +108,7 @@
#define GLADE_TAG_SPECIAL_CHILD_TYPE "special-child-type"
#define GLADE_TAG_SAVE "save"
#define GLADE_TAG_EDITABLE "editable"
#define GLADE_TAG_IGNORE "ignore"
LIBGLADEUI_API gboolean glade_verbose;
......
......@@ -130,13 +130,6 @@ main (int argc, char *argv[])
gtk_init (&argc, &argv);
/* XXX This is a hack to make up for a bug in GTK+;
* gtk_icon_theme_get_default() wont return anything
* untill an `ensure_default_icons ();' is provoked
* (gtk_icon_factory_lookup_default does this).
*/
gtk_icon_factory_lookup_default ("");
glade_setup_log_handlers ();
if (!glade_init ())
......
......@@ -3,14 +3,9 @@
<!-- Gtk+ Base -->
<glade-widget-class name="GtkWidget">
<properties>
<property id="visible" common="True">
<set-function>ignore</set-function>
<get-function>ignore</get-function>
</property>
<property common="True" optional="True" optional-default="False" default="0" id="width-request"/>
<property common="True" optional="True" optional-default="False" default="0" id="height-request"/>
<property id="visible" common="True" ignore="True"/>
<property id="width-request" common="True" optional="True" optional-default="False" default="0"/>
<property id="height-request" common="True" optional="True" optional-default="False" default="0"/>
<property common="True" id="tooltip" name="Tooltip" default="">
<spec>glade_standard_string_spec</spec>
......@@ -26,9 +21,7 @@
</displayable-values>
</property>
<property common="True" id="events">
<set-function>ignore</set-function>
<get-function>ignore</get-function>
<property common="True" id="events" ignore="True">
<displayable-values>
<value id="GDK_EXPOSURE_MASK" name="Exposure"/>
<value id="GDK_POINTER_MOTION_MASK" name="Pointer Motion"/>
......@@ -145,15 +138,10 @@
<value id="GDK_GRAVITY_STATIC" name="Static"/>
</displayable-values>
</property>
<property id="modal">
<set-function>ignore</set-function>
<get-function>ignore</get-function>
</property>
<property id="modal" ignore="True"/>
<property id="default-width" default="0" optional="True" optional-default="False"/>
<property id="default-height" default="0" optional="True" optional-default="False"/>
<property id="type-hint">
<set-function>ignore</set-function>
<get-function>ignore</get-function>
<property id="type-hint" ignore="True">
<displayable-values>
<value id="GDK_WINDOW_TYPE_HINT_NORMAL" name="Normal"/>
<value id="GDK_WINDOW_TYPE_HINT_DIALOG" name="Dialog"/>
......@@ -165,9 +153,7 @@
<value id="GDK_WINDOW_TYPE_HINT_DESKTOP" name="Desktop"/>
</displayable-values>
</property>
<property id="type">
<set-function>ignore</set-function>
<get-function>ignore</get-function>
<property id="type" ignore="True">
<displayable-values>
<value id="GTK_WINDOW_TOPLEVEL" name="Top Level"/>
<value id="GTK_WINDOW_POPUP" name="Popup"/>
......@@ -281,7 +267,8 @@
<glade-widget-class name="GtkLabel" generic-name="label" title="Label">
<properties>
<property id="label" default="label"/>
<property id="selectable" ignore="True"/>
<property id="label" default="label"/>
<property id="pattern" default=""/>
<property id="max-width-chars" name="Maximun Width"/>
<property id="justify">
......@@ -336,11 +323,9 @@
<set-function>glade_gtk_button_set_stock</set-function>
</property>
<property id="response-id" name="Response ID" default="0" common="False">
<property id="response-id" name="Response ID" default="0" common="False" ignore="True">
<spec>glade_standard_int_spec</spec>
<tooltip>The response ID of this button in a dialog (it's NOT useful if this button is not in a GtkDialog)</tooltip>
<set-function>ignore</set-function>
<get-function>ignore</get-function>
</property>
<property id="relief">
......@@ -444,9 +429,6 @@
<child-property-applies-function>glade_gtk_dialog_child_property_applies</child-property-applies-function>
<properties>
<property id="modal">
<set-function>ignore</set-function>
</property>
<property id="default-width" default="0" optional="True" optional-default="False"/>
<property id="default-height" default="0" optional="True" optional-default="False"/>
</properties>
......@@ -793,8 +775,8 @@
<glade-widget-class name="GtkSocket" generic-name="socket" title="Socket"/>
-->
<!-- Gtk+ Dialogs -->
<glade-widget-class name="GtkColorSelectionDialog" generic-name="colorselectiondialog" title="Color Selection Dialog"/>
<!-- Gtk+ Dialogs -->
<glade-widget-class name="GtkColorSelectionDialog" generic-name="colorselectiondialog" title="Color Selection Dialog"/>
<glade-widget-class name="GtkFileChooserDialog" generic-name="filechooserdialog" title="File Chooser Dialog">
<properties>
......@@ -817,10 +799,6 @@
<post-create-function>glade_gtk_message_dialog_post_create</post-create-function>
<properties>
<property id="modal">
<set-function>ignore</set-function>
</property>
<property id="default-width" default="0" optional="True" optional-default="False"/>
<property id="default-height" default="0" optional="True" optional-default="False"/>
......
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