gtkhtml



Hello All,
        I have been trying to create a Gnome app with Glade and gtkhtml but am
not having any luck.

I inserted a custom widget and assigned a function to create it, in that
function I create the gtkhtml widget:

  GtkWidget* notebook;
  GtkWidget* html, *html_label;

  notebook = gtk_notebook_new();
  gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), TRUE);
  gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), TRUE);

  html = gtk_html_new();
  gtk_object_set_data_full (GTK_OBJECT (notebook), "html", html,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_ref(html);
  gtk_html_load_from_string (GTK_HTML (html),
         "<html><body>foo</body></html>",
         strlen("<html><body>foo</body></html>"));
  gtk_signal_connect (GTK_OBJECT (html), "url_requested",
         GTK_SIGNAL_FUNC (url_requested), NULL);
  gtk_widget_show(html);

  html_label = gtk_label_new("html");
  gtk_object_set_data_full (GTK_OBJECT (notebook), "html_label",
         html_label,
         (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show(html_label);

  gtk_container_add(GTK_CONTAINER(notebook),html);

  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook),
        gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0),
        html_label);
  gtk_notebook_set_page(GTK_NOTEBOOK(notebook),
        gtk_notebook_page_num(GTK_NOTEBOOK(notebook),html));

  return notebook;

however every time I run this app it crashes on me. I have narrowed it
down to the html widget by replacing it with a label and everything
works fine.

Am I creating the html widget properly?

Steve








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