Re: Choosing a parent class
- From: Andreas Kotowicz <kotoml mynetix de>
- To: Tristan Van Berkom <tvb gnome org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Choosing a parent class
- Date: Tue, 11 Apr 2006 23:00:33 +0200
On Tue, 2006-04-11 at 17:02 -0400, Tristan Van Berkom wrote:
Andreas Kotowicz wrote:
[...]
ok, I think I understand now. but somehow it seems that my class has
some mistake in it (see attachment). I'm calling it like this in my
code:
********
.
.
window->priv->object = app_calendar_new ();
gtk_box_pack_end (GTK_BOX (main_box),
GTK_WIDGET(window->priv->object),
TRUE,
TRUE,
0);
.
.
********
all objects before and after this code get created and displayed
correctly, only my self made object refuses to show up.
Is it visible ? i.e. did you call gtk_widget_show() on the calendar ?
sure (ok, I just realized that my attachments did get removed from my
last email). so here's the relevant code:
static void
app_calendar_class_init (AppCalendarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (object_class, sizeof(AppCalendarPrivate));
}
static void
app_calendar_init (AppCalendar *calendar)
{
gint i;
calendar->priv = APP_CALENDAR_GET_PRIVATE (calendar);
/* some widgets to test with
the calender stuff will be inserted later on
not using calendar-> priv here yet as things don't work */
GtkWidget *main_box, *hbox, *label;
main_box = gtk_hbox_new (FALSE, 0);
gtk_widget_show (main_box);
hbox = gtk_hbox_new(TRUE, DEF_PAD);
gtk_box_pack_start (GTK_BOX (main_box), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
label = gtk_label_new("text from AppCalendar");
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
g_message("called app_calendar_init");
}
GtkWidget *
app_calendar_new (void)
{
return GTK_WIDGET (g_object_new (APP_TYPE_CALENDAR, NULL));
}
Also, where are you doing that code ? from a constructor or an instance
init func ?
instance init func:
window->priv->object = app_calendar_new ();
gtk_box_pack_end (GTK_BOX (main_box),
GTK_WIDGET(window->priv->object),
TRUE,
TRUE,
0);
/* this get's displayed correctly */
GtkWidget *hbox, *label;
hbox = gtk_hbox_new(TRUE, DEF_PAD);
label = gtk_label_new("text from MainWindow");
gtk_box_pack_end (GTK_BOX (main_box), label, TRUE, TRUE, 0);
ok, I hope these were all relevant parts.
andreas
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]