unable to insert a gtkhtml2 HtmlView widget into a GtkTextView



Hi everyone,

I spent last night learning to use gtkhtml2.  I had no problems until I 
tried to insert the HtmlView widget into a GtkTextView.  I can display
an HtmlView in a window, and I can display a GtkLabel in a TextView, 
but if I try to insert an HtmlView into the TextView I get nothing.

I've attached my sample code to this email.  The top comment block 
explains how to compile the code and the expected results from running
with various numbers of args.

I tried to contact the libgtkhtml2 people, but 

    gtkhtml2.codefactory.se

doesn't even have DNS right now ;(

I have no idea if this is a GtkTextView or an HtmlView problem, so my 
apologies if I'm asking on the wrong list.  Thanks for your help.

cheers,
--
joey yandle                             ___====-_  _-====___
www.divisionbyzero.com            _--~~~#####//      \\#####~~~--_
/jwy/pubkey.asc                _-~##########// (    ) \\##########~-_
                              -############//  :\^^/:  \\############-
                            _~############//   (@::@)   \\############~_
                           ~#############((     \\//     ))#############~
                          -###############\\    (^^)    //###############-
                         -#################\\  / "" \  //#################-
                        -###################\\/      \//###################-
                       _#/:##########/\######(   /\   )######/\##########:\#_
                       :/ :#/\#/\#/\/  \#/\##\  :  :  /##/\#/  \/\#/\#/\#: \:
                       "  :/  V  V  "   V  \#\: :  : :/#/  V   "  V  V  \:  "
                          "   "  "      "   \ : :  : : /   "      "  "   "
/* -*- mode: C c-basic-offset: 4 -*- * * compile: * * gcc -g html.c -o html `pkg-config libgtkhtml-2.0 --cflags --libs` * * usage: * * ./html #put HtmlView into window * ./html foo #put TextView into window, add anchor * ./html foo bar #put TextView into window, add anchor, add HtmlView at anchor * ./html foo bar baz #put TextView into window, add anchor, add Label * */ #include int main(int argc, char** argv) { GtkWidget* view = NULL; GtkWidget* window = NULL; HtmlDocument* doc = NULL; GtkTextIter begin; char* buf = "

hello, world!

"; char* ctype = "text/html"; gtk_init(&argc, &argv); doc = html_document_new(); view = html_view_new(); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); if(html_document_open_stream(doc, ctype)) { html_document_write_stream(doc, buf, strlen(buf)); html_document_close_stream(doc); } else { printf("unable to open stream of type %s\n", ctype); } html_view_set_document(HTML_VIEW(view), doc); gtk_widget_show(view); if(argc > 1) { GtkWidget* text = NULL; GtkTextBuffer* buffer; GtkTextChildAnchor* anchor; text = gtk_text_view_new(); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); gtk_text_buffer_get_start_iter(buffer, &begin); anchor = gtk_text_buffer_create_child_anchor(buffer, &begin); if(argc > 2) { if(argc > 3) { GtkWidget* label = gtk_label_new("Hello, world!"); gtk_widget_show(label); gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(text), label, anchor); } else { gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(text), view, anchor); } } gtk_widget_show(text); gtk_container_add(GTK_CONTAINER(window), text); } else { gtk_container_add(GTK_CONTAINER(window), view); } gtk_window_set_default_size(GTK_WINDOW(window), 400, 400); gtk_widget_show(window); gtk_main(); return 0; }

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]