* Boston, MA 02111-1307, USA.
*/
+#include <config.h>
#include <string.h>
#undef GTK_DISABLE_DEPRECATED
label = GTK_WIDGET (children->data);
button = GTK_WIDGET (children->next->data);
g_object_get (object, pspec->name, &obj, NULL);
+ g_list_free (children);
if (obj)
name = g_type_name (G_TYPE_FROM_INSTANCE (obj));
GtkWidget *sw;
GtkWidget *vbox;
GtkWidget *table;
- GObjectClass *class;
GParamSpec **specs;
gint n_specs;
int i;
- class = G_OBJECT_CLASS (g_type_class_peek (type));
- specs = g_object_class_list_properties (class, &n_specs);
+ if (G_TYPE_IS_INTERFACE (type))
+ {
+ gpointer vtable = g_type_default_interface_peek (type);
+ specs = g_object_interface_list_properties (vtable, &n_specs);
+ }
+ else
+ {
+ GObjectClass *class = G_OBJECT_CLASS (g_type_class_peek (type));
+ specs = g_object_class_list_properties (class, &n_specs);
+ }
if (n_specs == 0)
return NULL;
return sw;
}
+static void
+kill_tips (GtkWindow *win, GtkObject *tips)
+{
+ gtk_object_destroy (tips);
+ g_object_unref (tips);
+}
/* Pass zero for type if you want all properties */
GtkWidget*
GtkWidget *properties;
GtkWidget *label;
gchar *title;
-
+ GType *ifaces;
+ guint n_ifaces;
+
if ((win = g_object_get_data (G_OBJECT (object), "prop-editor-win")))
{
gtk_window_present (GTK_WINDOW (win));
if (GTK_IS_WIDGET (object))
gtk_window_set_screen (GTK_WINDOW (win),
gtk_widget_get_screen (GTK_WIDGET (object)));
-
+
tips = gtk_tooltips_new ();
- g_signal_connect_swapped (win, "destroy",
- G_CALLBACK (gtk_object_destroy), tips);
+ g_object_ref (tips);
+ gtk_object_sink (GTK_OBJECT (tips));
+
+ /* Kill the tips when the widget goes away. */
+ g_signal_connect (G_OBJECT (win), "destroy", G_CALLBACK (kill_tips), tips);
/* hold a weak ref to the object we're editing */
g_object_set_data_full (G_OBJECT (object), "prop-editor-win", win, model_destroy);
type = g_type_parent (type);
}
+
+ ifaces = g_type_interfaces (G_TYPE_FROM_INSTANCE (object), &n_ifaces);
+ while (n_ifaces--)
+ {
+ properties = properties_from_type (object, ifaces[n_ifaces], tips);
+ if (properties)
+ {
+ label = gtk_label_new (g_type_name (ifaces[n_ifaces]));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ properties, label);
+ }
+ }
+
+ g_free (ifaces);
}
else
{
gtk_container_add (GTK_CONTAINER (win), properties);
title = g_strdup_printf ("Properties of %s", g_type_name (type));
gtk_window_set_title (GTK_WINDOW (win), title);
+ g_free (title);
}
gtk_window_set_default_size (GTK_WINDOW (win), -1, 400);