mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-10-06 00:05:26 -04:00
Define the group property.
2004-10-06 Morten Welinder <terra@gnome.org> * widgets/gtkradiobutton.xml: Define the group property. * widgets/gtk-base.xml: Load gtkradiobutton.xml * src/glade-widget.c (glade_widget_new_child_from_node): Bullet proof. * src/glade-property-class.c (glade_property_class_make_gvalue_from_string): Bullet proof. * src/glade-gtk.c (glade_gtk_radio_button_set_group, glade_gtk_radio_button_get_group): New functions.
This commit is contained in:
parent
743a7db7f6
commit
458ee79442
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2004-10-06 Morten Welinder <terra@gnome.org>
|
||||
|
||||
* widgets/gtkradiobutton.xml: Define the group property.
|
||||
|
||||
* widgets/gtk-base.xml: Load gtkradiobutton.xml
|
||||
|
||||
* src/glade-widget.c (glade_widget_new_child_from_node): Bullet
|
||||
proof.
|
||||
|
||||
* src/glade-property-class.c
|
||||
(glade_property_class_make_gvalue_from_string): Bullet proof.
|
||||
|
||||
* src/glade-gtk.c (glade_gtk_radio_button_set_group,
|
||||
glade_gtk_radio_button_get_group): New functions.
|
||||
|
||||
2004-10-06 Morten Welinder <terra@gnome.org>
|
||||
|
||||
* src/glade-gtk.c (glade_gtk_widget_condition): Fix life cycle of
|
||||
|
@ -1247,3 +1247,44 @@ glade_gtk_dialog_child_property_applies (GtkWidget *ancestor,
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glade_gtk_radio_button_get_group:
|
||||
* @object:
|
||||
* @value:
|
||||
*
|
||||
* TODO: write me
|
||||
*/
|
||||
void GLADEGTK_API
|
||||
glade_gtk_radio_button_get_group (GObject *object, GValue *value)
|
||||
{
|
||||
GtkRadioButton *button = GTK_RADIO_BUTTON (object);
|
||||
GSList *group;
|
||||
const char *name;
|
||||
|
||||
group = gtk_radio_button_get_group (button);
|
||||
name = group
|
||||
? gtk_widget_get_name (group->data)
|
||||
: NULL;
|
||||
|
||||
g_value_reset (value);
|
||||
g_value_set_string (value, name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* glade_gtk_radio_button_set_group:
|
||||
* @object:
|
||||
* @value:
|
||||
*
|
||||
* TODO: write me
|
||||
*/
|
||||
void GLADEGTK_API
|
||||
glade_gtk_radio_button_set_group (GObject *object, GValue *value)
|
||||
{
|
||||
GtkRadioButton *button = GTK_RADIO_BUTTON (object);
|
||||
const char *name = g_value_get_string (value);
|
||||
|
||||
/* FIXME: now what? */
|
||||
}
|
||||
|
@ -552,13 +552,15 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class
|
||||
}
|
||||
case GLADE_PROPERTY_TYPE_OBJECT:
|
||||
break;
|
||||
default:
|
||||
default: {
|
||||
const char *typestr = glade_property_type_enum_to_string (type);
|
||||
g_warning ("Could not make gvalue from string ->%s<- and type %s\n",
|
||||
string,
|
||||
glade_property_type_enum_to_string (type));
|
||||
string ? string : "(null)",
|
||||
typestr ? typestr : "(null)");
|
||||
g_free (value);
|
||||
value = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ glade_widget_class_list_properties (GladeWidgetClass *class)
|
||||
|
||||
g_type_class_ref (class->type); /* hmm */
|
||||
/* We count on the fact we have an instance, or else we'd have
|
||||
* touse g_type_class_ref ();
|
||||
* to use g_type_class_ref ();
|
||||
*/
|
||||
|
||||
object_class = g_type_class_peek (class->type);
|
||||
|
@ -546,8 +546,11 @@ glade_widget_set_class (GladeWidget *widget, GladeWidgetClass *klass)
|
||||
{
|
||||
property_class = list->data;
|
||||
property = glade_property_new (property_class, widget);
|
||||
if (!property)
|
||||
if (!property) {
|
||||
g_print ("Failed to create [%s] property.\n",
|
||||
property_class->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
widget->properties = g_list_prepend (widget->properties, property);
|
||||
}
|
||||
@ -617,23 +620,19 @@ glade_widget_get_property (GladeWidget *widget, const char *id_property)
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
|
||||
g_return_val_if_fail (id_property != NULL, NULL);
|
||||
|
||||
list = widget->properties;
|
||||
for (; list; list = list->next)
|
||||
{
|
||||
for (list = widget->properties; list; list = list->next) {
|
||||
property = list->data;
|
||||
if (strcmp (property->class->id, id_property) == 0)
|
||||
return property;
|
||||
}
|
||||
|
||||
list = widget->packing_properties;
|
||||
for (; list; list = list->next)
|
||||
{
|
||||
for (list = widget->packing_properties; list; list = list->next) {
|
||||
property = list->data;
|
||||
if (strcmp (property->class->id, id_property) == 0)
|
||||
return property;
|
||||
}
|
||||
|
||||
g_warning ("Could not get property %s for widget %s\n",
|
||||
g_warning ("Could not get property \"%s\" for widget %s",
|
||||
id_property, widget->name);
|
||||
|
||||
return NULL;
|
||||
@ -1467,9 +1466,12 @@ glade_widget_new_from_node_real (GladeXmlNode *node,
|
||||
return NULL;
|
||||
|
||||
klass = glade_widget_class_get_by_name (class_name);
|
||||
g_free (class_name);
|
||||
if (!klass)
|
||||
if (!klass) {
|
||||
g_warning ("Widget class %s unknown.", class_name);
|
||||
g_free (class_name);
|
||||
return NULL;
|
||||
}
|
||||
g_free (class_name);
|
||||
|
||||
widget_gtk = g_object_new (klass->type, NULL);
|
||||
|
||||
@ -1542,16 +1544,21 @@ glade_widget_new_child_from_node (GladeXmlNode *node,
|
||||
if (internalchild)
|
||||
{
|
||||
GtkWidget *child_gtk = glade_widget_get_internal_child (parent, internalchild);
|
||||
GladeWidgetClass *child_class =
|
||||
glade_widget_class_get_by_name (G_OBJECT_TYPE_NAME (child_gtk));
|
||||
GladeWidgetClass *child_class;
|
||||
|
||||
if (!child_gtk) {
|
||||
g_warning ("Failed to locate internal child %s of %s",
|
||||
internalchild, glade_widget_get_name (parent));
|
||||
return FALSE;
|
||||
}
|
||||
child_class = glade_widget_class_get_by_name (G_OBJECT_TYPE_NAME (child_gtk));
|
||||
child = glade_widget_new_for_internal_child (child_class, parent, child_gtk, internalchild);
|
||||
glade_widget_fill_from_node (child_node, child);
|
||||
g_free (internalchild);
|
||||
}
|
||||
else
|
||||
{
|
||||
glade_widget_fill_from_node (child_node, child);
|
||||
} else {
|
||||
child = glade_widget_new_from_node_real (child_node, project, parent);
|
||||
g_return_val_if_fail (child != NULL, FALSE);
|
||||
if (!child)
|
||||
return FALSE;
|
||||
gtk_container_add (GTK_CONTAINER (parent->widget), child->widget);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
<GladeWidget name="GtkToggleButton" generic_name="togglebutton" palette_name="Toggle Button" filename="gtktogglebutton.xml"/>
|
||||
<GladeWidget name="GtkCheckButton" generic_name="checkbutton" palette_name="Check Button" filename="gtkcheckbutton.xml"/>
|
||||
<GladeWidget name="GtkSpinButton" generic_name="spinbutton" palette_name="Spin Button"/>
|
||||
<GladeWidget name="GtkRadioButton" generic_name="radiobutton" palette_name="Radio Button"/>
|
||||
<GladeWidget name="GtkRadioButton" generic_name="radiobutton" palette_name="Radio Button" filename="gtkradiobutton.xml"/>
|
||||
|
||||
<GladeWidget name="GtkTreeView" generic_name="treeview" palette_name="Tree View" filename="gtktreeview.xml"/>
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
<GladeWidgetClass>
|
||||
|
||||
<Properties>
|
||||
<Property Id="label" Default="check button"/>
|
||||
<Property Id="draw-indicator" Default="True"/>
|
||||
<Property Id="label" Default="check button"/>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
<GladeWidgetClass>
|
||||
|
||||
<Properties>
|
||||
<Property Id="label" default="radio button"/>
|
||||
<Property Id="label" Default="radio button"/>
|
||||
<Property Id="draw-indicator" Default="True"/>
|
||||
<Property Id="group" Disabled="True"/>
|
||||
<Property Id="group" Name="Group" Default="True">
|
||||
<Type>String</Type>
|
||||
<SetFunction>glade_gtk_radio_button_set_group</SetFunction>
|
||||
<GetFunction>glade_gtk_radio_button_get_group</GetFunction>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
</GladeWidgetClass>
|
||||
|
Loading…
x
Reference in New Issue
Block a user