View previous topic :: View next topic |
Author |
Message |
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Mon Apr 03, 2006 9:29 am Post subject: Converting from DUI to Duit |
|
|
Just a few conversion questions:
1. What is the best way to convert code that used the Dispatcher class? The other listeners are easy to convert, but this one is different.
2. What happened to the modifyFG in Label?
3. Are we supposed to explicitly import all used classes? No dui.all replacement?
4. I would like to have a duit package outside of gtk, gdk and the others, like
Code: | import dui.gtk.Label; |
|
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Mon Apr 03, 2006 10:13 am Post subject: Re: Converting from DUI to Duit |
|
|
larsivi wrote: |
4. I would like to have a duit package outside of gtk, gdk and the others, like
Code: | import dui.gtk.Label; |
|
I meant Code: | import duit.gtk.Label | , and of course, just IMHO.
5. which TextBuffer constructor is the correct when previously using the one without arguments? |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Mon Apr 03, 2006 10:44 am Post subject: Re: Converting from DUI to Duit |
|
|
larsivi wrote: | larsivi wrote: |
4. I would like to have a duit package outside of gtk, gdk and the others, like
Code: | import dui.gtk.Label; |
|
I meant Code: | import duit.gtk.Label | , and of course, just IMHO.
5. which TextBuffer constructor is the correct when previously using the one without arguments? |
(I'm sorry I'm in a hurry)
1. Use the addOnXXXXXXXXXX mehods. those will take a delegate (and more)
2. modifyFg (the automatic name conversion will capitalize only the first letter after the '_'
3. no dui.all replacement do we need it? should I create it? (not too much work)
4. (what you mean?)
5. it's missing use "new Textbuffer(cast(TextTagTable)null)"
the future implemetation will be equivalent (as in DUI)
Ant |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Mon Apr 03, 2006 11:02 am Post subject: Re: Converting from DUI to Duit |
|
|
Ant wrote: |
1. Use the addOnXXXXXXXXXX mehods. those will take a delegate (and more)
2. modifyFg (the automatic name conversion will capitalize only the first letter after the '_'
3. no dui.all replacement do we need it? should I create it? (not too much work)
4. (what you mean?)
5. it's missing use "new Textbuffer(cast(TextTagTable)null)"
the future implemetation will be equivalent (as in DUI)
Ant |
hmm...
1. I can't find the one for timeouts
3. No, I was just asking
4. the gtk, gdk, etc packages are under src, I would liked to have an additional level duit, but as I said, that is just me
Thanks |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Mon Apr 03, 2006 1:08 pm Post subject: Re: Converting from DUI to Duit |
|
|
larsivi wrote: | Ant wrote: |
1. Use the addOnXXXXXXXXXX mehods. those will take a delegate (and more)
2. modifyFg (the automatic name conversion will capitalize only the first letter after the '_'
3. no dui.all replacement do we need it? should I create it? (not too much work)
4. (what you mean?)
5. it's missing use "new Textbuffer(cast(TextTagTable)null)"
the future implemetation will be equivalent (as in DUI)
Ant |
hmm...
1. I can't find the one for timeouts
3. No, I was just asking
4. the gtk, gdk, etc packages are under src, I would liked to have an additional level duit, but as I said, that is just me
Thanks :) |
1. look for the class gtk.Timeout
it's implemented using the gtk timeout - will be changed to glib timeout but should be transparent to the user.
demos.duit.TestIdle.d contains example for Timeout and Idle.
4, I see... you might be right...
Ant |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Tue Apr 04, 2006 8:25 am Post subject: |
|
|
I've now gotten the ported app to compile and link using Duit, but it segfaults while trying to construct a ListStore, using this(GType[]) constructor.
The Duit/gtk part of the backtrace gives this
Code: |
0xb785365b in g_type_check_is_value_type () from /usr/lib/libgobject-2.0.so.0
(gdb) bt
#0 0xb785365b in g_type_check_is_value_type ()
from /usr/lib/libgobject-2.0.so.0
#1 0xb7bff6cb in _gtk_tree_data_list_check_type ()
from /usr/lib/libgtk-x11-2.0.so
#2 0xb7b5208e in gtk_list_store_newv () from /usr/lib/libgtk-x11-2.0.so
#3 0x0809fa61 in gtk.ListStore.ListStore._ctor(gobject.typedefs.GType[]) ()
|
The only difference in the immediately surrounding client code, was a DUIType.STRING to GType.STRING.
Any ideas? |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Tue Apr 04, 2006 9:27 am Post subject: |
|
|
Ok, here is a minimal HelloWorld example and full backtrace:
Code: |
module gtk.HelloWorld;
private import gtk.Window;
private import gtk.Duit;
private import gtk.ListStore;
class HelloWorld : Window
{
this()
{
GType[] columns;
columns ~= GType.STRING;
ListStore ls = new ListStore(columns);
super("Hello World");
showAll();
}
}
void main(char[][] args)
{
Duit.init(args);
new HelloWorld();
Duit.main();
}
|
Code: |
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210358080 (LWP 1106)]
0xb77fd65b in g_type_check_is_value_type () from /usr/lib/libgobject-2.0.so.0
(gdb) bt
#0 0xb77fd65b in g_type_check_is_value_type ()
from /usr/lib/libgobject-2.0.so.0
#1 0xb7ba96cb in _gtk_tree_data_list_check_type ()
from /usr/lib/libgtk-x11-2.0.so
#2 0xb7afc08e in gtk_list_store_newv () from /usr/lib/libgtk-x11-2.0.so
#3 0x0806fa99 in gtk.ListStore.ListStore._ctor(gobject.typedefs.GType[]) ()
#4 0x0804c638 in gtk.HelloWorld.HelloWorld._ctor() () at liststore.d:31
#5 0x0804c688 in D main () at liststore.d:40
#6 0x0804d453 in main ()
|
Many, many functions fails to load from libglib, although the library itself seems to be loaded, and a few functions in pango fails to load. |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Tue Apr 04, 2006 9:59 am Post subject: |
|
|
Hmm, setting the length of columns to something (e.g. 2) actually seems to get it further, although I now get this message:
Code: |
(liststore:1211): Gtk-WARNING **: gtkliststore.c:329: Invalid type (null) passed to gtk_list_store_newv
|
I suppose passing an array on the stack to a dynamic library won't work as well as in a statically linked app... just noticed... any best practices that should be followed? |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Tue Apr 04, 2006 11:31 am Post subject: |
|
|
larsivi wrote: | Ok, here is a minimal HelloWorld example and full backtrace:
|
Thanks.
I'll take a look at it later tonight.
Ant |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Tue Apr 04, 2006 10:40 pm Post subject: |
|
|
Ant wrote: | larsivi wrote: | Ok, here is a minimal HelloWorld example and full backtrace:
|
Thanks.
I'll take a look at it later tonight.
Ant |
Corrected on revision 140.
My fault.
the gobject make fundamental type is value << 2
I had 2 << value
GType.STRING is 64 not 131072...
DuitTests was ok because had Code: |
enum columns
{
//duiObject = DUIType.PIXBUF,
duiObject = 16<<2,
gtkObject = 16<<2,
desc = 16<<2,
percentDone = 16<<2,
author = 16<<2
}
|
and Code: |
GType[] columns;
columns ~= Pixbuf.getType();
columns ~= 16<<2;
super(columns);
|
obviously I coded that before the automatic conversion of the GType was in place...
Ant |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Wed Apr 05, 2006 7:08 am Post subject: |
|
|
Thanks, Ant! That worked!
Now, I'm still having problems with ListStore. I've extended the test program above with a TreeIter, and use the ListStore.setValue, but get some Gtk-CRITICAL-assertions:
Code: |
(liststore:7419): GLib-GObject-CRITICAL **: g_value_set_string: assertion `G_VALUE_HOLDS_STRING (value)' failed
(liststore:7419): Gtk-CRITICAL **: gtk_list_store_set_value: assertion `G_IS_VALUE (value)' failed
|
The program:
Code: |
module gtk.HelloWorld;
private import gtk.Window;
private import gtk.Duit;
private import gtk.ListStore;
private import gtk.TreeIter;
class HelloWorld : Window
{
this()
{
GType[] columns;
columns ~= GType.STRING;
ListStore ls = new ListStore(columns);
TreeIter iter = ls.createIter();
ls.setValue(iter, 0, "test" );
super("Hello World");
showAll();
}
}
void main(char[][] args)
{
Duit.init(args);
new HelloWorld();
Duit.main();
}
|
|
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Wed Apr 05, 2006 8:16 am Post subject: |
|
|
larsivi wrote: | ...use the ListStore.setValue, but get some Gtk-CRITICAL-assertions:
|
hmmm...
That seems to be ok on DuitTests.
(maybe TreeStore is ok and ListStore is not)
Again I'll have to leave it to latter tonigth.
thank you for the example.
Ant |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Wed Apr 05, 2006 11:27 pm Post subject: |
|
|
larsivi wrote: | Thanks, Ant! That worked!
Now, I'm still having problems with ListStore. I've extended the test program above with a TreeIter, and use the ListStore.setValue, but get some Gtk-CRITICAL-assertions:
Code: |
(liststore:7419): GLib-GObject-CRITICAL **: g_value_set_string: assertion `G_VALUE_HOLDS_STRING (value)' failed
(liststore:7419): Gtk-CRITICAL **: gtk_list_store_set_value: assertion `G_IS_VALUE (value)' failed
|
|
darn, I don't get that...
Do you see the same messages from glib on the DuitTests?
what's your gtk and glib version? (it shouldn't matter...)
Ant |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Thu Apr 06, 2006 2:36 am Post subject: |
|
|
Hmm, very annoying.
The version numbers are
libglib: 2.10.1
libgtk: 2.8.16
Here's the startup messages:
Code: |
Loaded lib = libgtk-x11-2.0.so
* Finished static this(): gtk
Loaded lib = libglib-2.0.so
failed to load (libglib-2.0.so): g_atomic_int_inc
failed to load (libglib-2.0.so): g_atomic_int_dec_and_test
failed to load (libglib-2.0.so): g_thread_init
failed to load (libglib-2.0.so): g_thread_supported
failed to load (libglib-2.0.so): g_thread_create
failed to load (libglib-2.0.so): g_thread_yield
failed to load (libglib-2.0.so): g_static_mutex_lock
failed to load (libglib-2.0.so): g_static_mutex_trylock
failed to load (libglib-2.0.so): g_static_mutex_unlock
failed to load (libglib-2.0.so): g_static_mutex_get_mutex
failed to load (libglib-2.0.so): g_mutex_new
failed to load (libglib-2.0.so): g_mutex_lock
failed to load (libglib-2.0.so): g_mutex_trylock
failed to load (libglib-2.0.so): g_mutex_unlock
failed to load (libglib-2.0.so): g_mutex_free
failed to load (libglib-2.0.so): g_cond_new
failed to load (libglib-2.0.so): g_cond_signal
failed to load (libglib-2.0.so): g_cond_broadcast
failed to load (libglib-2.0.so): g_cond_wait
failed to load (libglib-2.0.so): g_cond_timed_wait
failed to load (libglib-2.0.so): g_cond_free
failed to load (libglib-2.0.so): g_private_new
failed to load (libglib-2.0.so): g_private_get
failed to load (libglib-2.0.so): g_private_set
failed to load (libglib-2.0.so): g_module_supported
failed to load (libglib-2.0.so): g_module_build_path
failed to load (libglib-2.0.so): g_module_open
failed to load (libglib-2.0.so): g_module_symbol
failed to load (libglib-2.0.so): g_module_name
failed to load (libglib-2.0.so): g_module_make_resident
failed to load (libglib-2.0.so): g_module_close
failed to load (libglib-2.0.so): g_module_error
failed to load (libglib-2.0.so): g_ascii_isalnum
failed to load (libglib-2.0.so): g_ascii_isalpha
failed to load (libglib-2.0.so): g_ascii_iscntrl
failed to load (libglib-2.0.so): g_ascii_isdigit
failed to load (libglib-2.0.so): g_ascii_isgraph
failed to load (libglib-2.0.so): g_ascii_islower
failed to load (libglib-2.0.so): g_ascii_isprint
failed to load (libglib-2.0.so): g_ascii_ispunct
failed to load (libglib-2.0.so): g_ascii_isspace
failed to load (libglib-2.0.so): g_ascii_isupper
failed to load (libglib-2.0.so): g_ascii_isxdigit
failed to load (libglib-2.0.so): g_win32_error_message
failed to load (libglib-2.0.so): g_win32_getlocale
failed to load (libglib-2.0.so): g_win32_get_package_installation_directory
failed to load (libglib-2.0.so): g_win32_get_package_installation_subdirectory
failed to load (libglib-2.0.so): g_win32_get_windows_version
failed to load (libglib-2.0.so): g_win32_locale_filename_from_utf8
* Finished static this(): glib
Loaded lib = libgobject-2.0.so
* Finished static this(): gobject
Loaded lib = libgdk-x11-2.0.so
* Finished static this(): gdk
Loaded lib = libatk-1.0.so
* Finished static this(): atk
Loaded lib = libpango-1.0.so
failed to load (libpango-1.0.so): script_engine_list
failed to load (libpango-1.0.so): script_engine_init
failed to load (libpango-1.0.so): script_engine_exit
failed to load (libpango-1.0.so): script_engine_create
* Finished static this(): pango
|
How could I debug this? I don't want to recompile gtk... Could I use the gtk-dbg libs somehow? |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Thu Apr 06, 2006 5:04 am Post subject: |
|
|
h3r3tic gets the same errors as me.
In addition I've tried to load the debug versions of the libs instead, but it seems like it crashed before anything happened at all
ListStore is not used in the DuitTests? At least not the setValue(TreeIter, char[]) I think.
I use dmd 0.150 and h3r3tic 0.151/0.152.
I'm on Kubuntu Dapper, while h3r3tic tried some Suse. |
|
Back to top |
|
|
|