Re: Gtkhtml on win32, it's possible ?




I guess your best bet is to to run the application with some debugging
environment variables set... it also helps to take a look at the
source code of the libraries in question. That message seems to come
from libgconf, in gconf-internals.c:gconf_activate_server(), where it
uses g_spawn_async() to start gconfd-2.exe. Try setting
G_SPAWN_WIN32_DEBUG=y and see if you notice anything odd.

--tml


Thanks for reply,
this is the situation with GDB:

C:\GTK\bin>gdb gtkhtml_testing.exe
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) start
Breakpoint 1 at 0x401435: file gtkhtml_testing.c, line 66.
Starting program: C:\GTK\bin/gtkhtml_testing.exe
[New thread 3396.0xd48]
main (argc=2293680, args=0x4010b6) at gtkhtml_testing.c:66
66      {
(gdb) s
71              gtk_init (&argc, &args);
(gdb) s
72              gconf_init (argc, args);
(gdb) s
74              printf("before gtk_html_new_from_string ()\n");
(gdb) s
before gtk_html_new_from_string ()
75              html = gtk_html_new_from_string (html_source, -1);
(gdb) s
[New thread 3396.0xde8]

!!!NOW IT STOPPED ON THAT!!!


( i can see in Task Manager of windows that gconfd-2.exe is running)


------------------------------------------------
THIS IS THE SOURCE FILE:
------------------------------------------------

#include <gtk/gtk.h>
#include <gtkhtml/gtkhtml.h>


GtkWidget *html;
const gchar *html_source = "<B><FONT COLOR=Blue>Hello world!</FONT></B>";

static void
destroy_cb (GtkWidget *widget, gpointer user_data)
{
   gtk_main_quit ();
}

static void draw_page_cb (GtkPrintOperation *operation, GtkPrintContext *context,
            gint page_nr, gpointer user_data){
   gtk_html_print_page((GtkHTML*) html, context);
}

static void
print_cb (GtkWidget *widget, gpointer user_data)
{
   GtkPrintOperation *print;
   GtkPrintOperationResult res;

   print = gtk_print_operation_new();
/*
   G_LOCK(print_settings);
   if (print_settings)
       gtk_print_operation_set_print_settings(print, print_settings);
   G_UNLOCK(print_settings);
*/
   gtk_print_operation_set_use_full_page(print, FALSE);
   gtk_print_operation_set_unit(print, GTK_UNIT_POINTS);
   gtk_print_operation_set_n_pages(print, 1);
   g_signal_connect(print, "draw_page", G_CALLBACK(draw_page_cb), html);

res = gtk_print_operation_run(print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                 GTK_WINDOW(html), NULL);

   if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
/*        G_LOCK(print_settings);
       if (print_settings)
           g_object_unref(print_settings);
print_settings = g_object_ref(gtk_print_operation_get_print_settings(print));
       G_UNLOCK(print_settings);*/
   }
   g_object_unref(print);
}

static GtkWidget*
create_window ()
{
   GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
   gtk_widget_set_name (window, "GtkLauncher");
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);

   return window;
}


int
main (int argc, char *args [])
{
   GtkWidget *app;
   GtkWidget *scrolled_window;
   GtkWidget *button;

   gtk_init (&argc, &args);
   gconf_init (argc, args);

   printf("before gtk_html_new_from_string ()\n");
   html = gtk_html_new_from_string (html_source, -1);
   printf("after gtk_html_new_from_string ()\n");

   GtkWidget* vbox = gtk_vbox_new (FALSE, 0);

   app = create_window ();
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (scrolled_window), html); gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, FALSE, FALSE, 0);

   button= gtk_button_new_from_stock (GTK_STOCK_PRINT);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (print_cb), NULL);
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (app), vbox);
   gtk_window_set_default_size (GTK_WINDOW (app), 320, 80);
   gtk_widget_show_all (app);

   /* run the main loop */
   gtk_main ();
}


I remember you that this source works fine on linux, and i haven't finded G_SPAWN_WIN32_DEBUG.


Waiting for your answer, Best Regards!
Marco Rocco


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