Re: custom widget->realize fct for GtkFileSelection
- From: John Cupitt <john cupitt ng-london org uk>
- To: Erwann Chenede <Erwann Chenede Sun COM>
- Cc: gtk-list gnome org
- Subject: Re: custom widget->realize fct for GtkFileSelection
- Date: Fri, 07 Sep 2001 12:42:05 +0100
Erwann Chenede wrote:
> Here is my realize function :
>
> static void
> gtk_file_selection_realize (GtkWidget *widget)
> {
> GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
> widget->window = gtk_widget_get_parent_window (widget);
> gdk_window_ref (widget->window);
> g_print ("In gtk_file_selection_realize\n");
> }
>
> I get an error from gtk_widget_get_parent_window which tells
> me the widget doesn't have a parent window.
Hi Erwann, GtkFilesel is subclassed off GtkWindow ... so the easiest way to do
this is to override _realize() (rather than using signals, as I guess you're
doing).
In your _class_init() function, do:
widget_class->realize = my_fileselection_widget_realize;
Where my_fileselection_widget_realize() looks like this:
static void
my_fileselection_widget_realize( GtkWidget *widget )
{
/* Do any before-we're-realized init.
*/
/* Realize our superclasses.
*/
if( GTK_WIDGET_CLASS( parent_class )->realize )
(*GTK_WIDGET_CLASS( parent_class )->realize)( widget );
/* Now do any after-we're-realized init.
*/
}
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]