On Thu, Dec 24, 2009 at 6:40 PM, Andrew Wood <ajw...@theiet.org> wrote:
> But that bit of code only runs the first time and the first time it works.
>
>
> On 24 Dec 2009, at 19:09, Tristan Van Berkom wrote:
>
>> From the assertions it *looks* like glade_xml_get_widget() is
>> returning NULL for "mainvbox".

You mean "it works" or you mean the code executes and assigns a
NULL pointer to your widget pointer the first time around ?

>From the warnings you printed, 'generalpage' is not a widget,
so maybe it was not found in the glade file, or maybe it was somehow
destroyed by some other code fragment in your app along the way.

Cheers,
        -Tristan

>>
>> Cheers,
>>      -Tristan
>>
>> On Thu, Dec 24, 2009 at 11:29 AM, Andrew Wood <ajw...@theiet.org> wrote:
>>>
>>> The following function is called to display a vbox, which is read from a
>>> glade file, in a scrollview.
>>>
>>> If the  vbox or 'page' hasnt been displayed before then
>>> generalpageinitialised will be false.
>>>
>>> There are other 'pages' in the app which are vboxes read from a glade
>>> file
>>> in the same way. The app always shows the vbox called rightpanevbox and
>>> it
>>> swaps this variable to point to the appropriate one read from glade.
>>>
>>> The first time the function is called the page shows perfectly. The
>>> second
>>> time I get errors such as:
>>>
>>> Showing General Page
>>> doing gtk_container_remove
>>>
>>> (a.out:21153): Gtk-CRITICAL **: gtk_container_remove: assertion
>>> `GTK_IS_WIDGET (widget)' failed
>>> done gtk_container_remove
>>>
>>>
>>> (a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer in cast
>>> to
>>> `GtkWidget'
>>>
>>> (a.out:21153): Gtk-CRITICAL **: gtk_scrolled_window_add_with_viewport:
>>> assertion `GTK_IS_WIDGET (child)' failed
>>>
>>>
>>> (a.out:21153): GLib-GObject-WARNING **: invalid unclassed pointer in cast
>>> to
>>> `GtkWidget'
>>>
>>> (a.out:21153): Gtk-CRITICAL **: gtk_widget_show_all: assertion
>>> `GTK_IS_WIDGET (widget)' failed
>>>
>>>
>>> I cant understand why its happy the first time its called but not on
>>> subsequent calls. If anyone can enlighten me Id be very grateful
>>>
>>> Thanks
>>>
>>>
>>> void showGeneralPage()
>>> {
>>>  g_print("Showing General Page\n");
>>>  if (generalpageinitialised==false)
>>>  {
>>>      generalpage= glade_xml_get_widget(generalpagexml,"mainvbox");
>>>      glade_xml_signal_autoconnect(generalpagexml);
>>>      generalpageinitialised=true;
>>>        }
>>>    if (pagedisplayed!="INIT")
>>>  {
>>>     //a previous page is shown so we need to remove it first
>>>      g_print("doing gtk_container_remove\n");
>>>      gtk_container_remove (GTK_CONTAINER
>>> (rightpanescrollview),gtk_bin_get_child(GTK_BIN(rightpanescrollview)));
>>>      g_print("done gtk_container_remove\n");
>>>  }
>>>  rightpanevbox=generalpage; //make generalpage the one currently on show
>>>  pagedisplayed = "General";
>>>
>>>
>>>
>>>  gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(rightpanescrollview),GTK_WIDGET(rightpanevbox));
>>>  gtk_widget_show_all(GTK_WIDGET(rightpanevbox));
>>> }
>>> _______________________________________________
>>> gtk-app-devel-list mailing list
>>> gtk-app-devel-list@gnome.org
>>> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>>
>>
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email
>> ______________________________________________________________________
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to