Setting the default values for a class
- From: Richard Shann <richard shann virgin net>
- To: gtk-app-devel-list gnome org
- Subject: Setting the default values for a class
- Date: Sat, 03 Nov 2007 17:21:32 +0000
In the denemo music program it would be useful for the class GtkLabel to
default to use_markup TRUE (so that the music font could be freely
used). I have tried traversing the widgets setting this value, thus
static void use_markup(GtkWidget *widget)
{
if(GTK_IS_LABEL(widget)) {
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
}
else
if(GTK_IS_CONTAINER(widget)) {
GList *g = gtk_container_get_children (GTK_CONTAINER(widget));
for(;g;g=g->next)
use_markup(g->data);
if (GTK_IS_MENU_ITEM(widget)) {
use_markup(gtk_menu_item_get_submenu(widget));
}
}
}
but this curiously fails for toolitems (the GtkLabel widget in the
GtkToolButton changes under some condition, perhaps to do with
accelerators).
I wondered if there was a call to be made to set the default for the
class, but when I looked at the source I became more perplexed:
gtklabel.c has a function
static void gtk_label_class_init (GtkLabelClass *class)
which is not called within the file, even though it is static. Short of
some preprocesser magic, I can't see how this could ever get called.
Is there a way to set the class defaults?
Richard Shann
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]