mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-09-24 00:04:33 -04:00
glade_project_open() fixed segfault on open faiure.
* src/glade_project.c: glade_project_open() fixed segfault on open faiure. * src/glade-property-class.[ch]: Added glade_property_class_void_value() * src/glade-widget.c: when creating new objects; ignore voided defaults using glade_property_class_void_value() (and finally added myself as an author). * src/glade-editor-property.c: Fixed segfaults & assertions when dealing with NULL colors in GladeEPropColor. * widgets/gtk+.xml.in: Dont save virtual "pages" property on notebook, if we dont need it in glade-2 files we dont need it period.
This commit is contained in:
parent
1762f4b696
commit
186388d786
19
ChangeLog
19
ChangeLog
@ -1,9 +1,24 @@
|
||||
2006-03-22 Tristan Van Berkom <tvb@gnome.org>
|
||||
2006-03-29 Tristan Van Berkom <tvb@gnome.org>
|
||||
|
||||
* src/glade-project-window.c: Removed idle handler hack that has
|
||||
been obsoleted by Vincent's smarter one-line patch.
|
||||
|
||||
2006-03-19 Vincent Geddes <vgeddes@metroweb.co.za>
|
||||
* src/glade_project.c: glade_project_open() fixed segfault
|
||||
on open faiure.
|
||||
|
||||
* src/glade-property-class.[ch]: Added glade_property_class_void_value()
|
||||
|
||||
* src/glade-widget.c: when creating new objects; ignore voided defaults
|
||||
using glade_property_class_void_value() (and finally added myself as
|
||||
an author).
|
||||
|
||||
* src/glade-editor-property.c: Fixed segfaults & assertions when dealing
|
||||
with NULL colors in GladeEPropColor.
|
||||
|
||||
* widgets/gtk+.xml.in: Dont save virtual "pages" property on notebook,
|
||||
if we dont need it in glade-2 files we dont need it period.
|
||||
|
||||
2006-03-29 Vincent Geddes <vgeddes@metroweb.co.za>
|
||||
|
||||
* src/glade_project.c: glade_project_changed() should not set
|
||||
project->changed if project is still in process of being loaded.
|
||||
|
@ -1043,13 +1043,31 @@ glade_eprop_color_load (GladeEditorProperty *eprop, GladeProperty *property)
|
||||
|
||||
if (property)
|
||||
{
|
||||
text = glade_property_class_make_string_from_gvalue
|
||||
(eprop->class, property->value);
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), text);
|
||||
g_free (text);
|
||||
|
||||
color = g_value_get_boxed (property->value);
|
||||
gtk_color_button_set_color (GTK_COLOR_BUTTON (eprop_color->cbutton), color);
|
||||
if ((text = glade_property_class_make_string_from_gvalue
|
||||
(eprop->class, property->value)) != NULL)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), text);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), "");
|
||||
|
||||
if ((color = g_value_get_boxed (property->value)) != NULL)
|
||||
gtk_color_button_set_color (GTK_COLOR_BUTTON (eprop_color->cbutton),
|
||||
color);
|
||||
else
|
||||
{
|
||||
GdkColor black = { 0, };
|
||||
|
||||
/* Manually fill it with black for an NULL value.
|
||||
*/
|
||||
if (gdk_color_parse("Black", &black) &&
|
||||
gdk_colormap_alloc_color(gtk_widget_get_default_colormap(),
|
||||
&black, FALSE, TRUE))
|
||||
gtk_color_button_set_color
|
||||
(GTK_COLOR_BUTTON (eprop_color->cbutton),
|
||||
&black);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ glade_project_open (const gchar *path)
|
||||
|
||||
}
|
||||
|
||||
project->changed = FALSE;
|
||||
if (project) project->changed = FALSE;
|
||||
|
||||
return project;
|
||||
}
|
||||
@ -1567,7 +1567,8 @@ glade_project_display_name (GladeProject *project,
|
||||
gboolean tab_aligned,
|
||||
gboolean mnemonic)
|
||||
{
|
||||
const gchar *prefix = tab_aligned ? "\t" : "";
|
||||
const gchar *prefix =
|
||||
tab_aligned ? "\t" : "";
|
||||
const gchar *unsaved_prefix = unsaved_changes ?
|
||||
(tab_aligned ? " *\t" : "*") : prefix;
|
||||
|
||||
|
@ -1313,3 +1313,26 @@ glade_property_class_match (GladePropertyClass *class,
|
||||
return (strcmp (class->id, comp->id) == 0 &&
|
||||
class->pspec->owner_type == comp->pspec->owner_type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glade_property_class_match:
|
||||
* @class: a #GladePropertyClass
|
||||
*
|
||||
* Returns: Whether @value for this @class is voided; a voided value
|
||||
* can be a %NULL value for boxed or object type param specs.
|
||||
*/
|
||||
gboolean
|
||||
glade_property_class_void_value (GladePropertyClass *class,
|
||||
GValue *value)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (class), FALSE);
|
||||
|
||||
if (G_IS_PARAM_SPEC_OBJECT (class->pspec) &&
|
||||
g_value_get_object (value) == NULL)
|
||||
return TRUE;
|
||||
else if (G_IS_PARAM_SPEC_BOXED (class->pspec) &&
|
||||
g_value_get_boxed (value) == NULL)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -204,6 +204,9 @@ LIBGLADEUI_API
|
||||
gboolean glade_property_class_match (GladePropertyClass *class,
|
||||
GladePropertyClass *comp);
|
||||
|
||||
LIBGLADEUI_API
|
||||
gboolean glade_property_class_void_value (GladePropertyClass *class,
|
||||
GValue *value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* Authors:
|
||||
* Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
* Chema Celorio <chema@celorio.com>
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -602,9 +603,15 @@ glade_widget_build_object (GladeWidgetClass *klass, GladeWidget *widget)
|
||||
if (g_value_type_compatible (G_VALUE_TYPE (glade_property_class->def),
|
||||
G_VALUE_TYPE (¶meter.value)))
|
||||
{
|
||||
if (glade_property_class_void_value
|
||||
(glade_property_class,
|
||||
glade_property_class->def))
|
||||
continue;
|
||||
#if 0
|
||||
if (g_type_is_a (G_VALUE_TYPE (glade_property_class->def), G_TYPE_OBJECT))
|
||||
if (g_value_get_object (glade_property_class->def) == NULL)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
g_value_copy (glade_property_class->def, ¶meter.value);
|
||||
}
|
||||
@ -2915,9 +2922,18 @@ glade_widget_params_from_widget_info (GladeWidgetClass *widget_class,
|
||||
else if (g_value_type_compatible (G_VALUE_TYPE (glade_property_class->orig_def),
|
||||
G_VALUE_TYPE (¶meter.value)))
|
||||
{
|
||||
if (g_type_is_a (G_VALUE_TYPE (glade_property_class->orig_def), G_TYPE_OBJECT))
|
||||
if (g_value_get_object (glade_property_class->orig_def) == NULL)
|
||||
if (glade_property_class_void_value
|
||||
(glade_property_class,
|
||||
glade_property_class->orig_def))
|
||||
continue;
|
||||
#if 0
|
||||
/* If its a NULL object property; disregard it.
|
||||
*/
|
||||
if (g_type_is_a (G_VALUE_TYPE (glade_property_class->orig_def),
|
||||
G_TYPE_OBJECT))
|
||||
if (g_value_get_object (glade_property_class->orig_def) == NULL)
|
||||
continue;
|
||||
#endif
|
||||
g_value_copy (glade_property_class->orig_def, ¶meter.value);
|
||||
}
|
||||
else
|
||||
|
@ -645,7 +645,7 @@
|
||||
<glade-widget-class name="GtkNotebook" generic-name="notebook" _title="Notebook">
|
||||
<post-create-function>empty</post-create-function>
|
||||
<properties>
|
||||
<property id="pages" _name="Number of pages" default="3" query="True">
|
||||
<property id="pages" _name="Number of pages" save="False" default="3" query="True">
|
||||
<spec>glade_standard_int_spec</spec>
|
||||
<_tooltip>The number of pages in the notebook</_tooltip>
|
||||
<set-function>glade_gtk_notebook_set_n_pages</set-function>
|
||||
|
Loading…
x
Reference in New Issue
Block a user