www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - [GtkD] How to use Glade?

reply Alexandr Druzhinin <drug2004 bk.ru> writes:
How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial application, 
but I do it very inproductive, so I'd like to get some help or I'm 
afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk application, 
that built with glade and has several typical widgets and signal 
handlers - it may help very much.
May 02 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:
 How to use GtkD with Glade? Is some tutorial available?
 I spent some time trying to use Glade to build non-trivial application,
 but I do it very inproductive, so I'd like to get some help or I'm
 afraid it will be lasting for years...
 For example, if somebody would upload some example of Gtk application,
 that built with glade and has several typical widgets and signal
 handlers - it may help very much.
There is an small example distributed with GtkD: https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d -- Mike Wey
May 02 2013
next sibling parent reply "Carlos" <checoimg gmail.com> writes:
On Thursday, 2 May 2013 at 17:43:28 UTC, Mike Wey wrote:
 On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:
 How to use GtkD with Glade? Is some tutorial available?
 I spent some time trying to use Glade to build non-trivial 
 application,
 but I do it very inproductive, so I'd like to get some help or 
 I'm
 afraid it will be lasting for years...
 For example, if somebody would upload some example of Gtk 
 application,
 that built with glade and has several typical widgets and 
 signal
 handlers - it may help very much.
There is an small example distributed with GtkD: https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
I get thhis error when trying to compile it : testgithub.d(3): Error: module Builder is in file 'gtk/Builder.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import import path[2] = /usr/local/includes/d -------------------------------------------------------------------------------- I installed from here : link : http://www.dsource.org/projects/gtkd/wiki/DebianPackages
May 02 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/02/2013 08:21 PM, Carlos wrote:
 On Thursday, 2 May 2013 at 17:43:28 UTC, Mike Wey wrote:
 On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:
 How to use GtkD with Glade? Is some tutorial available?
 I spent some time trying to use Glade to build non-trivial application,
 but I do it very inproductive, so I'd like to get some help or I'm
 afraid it will be lasting for years...
 For example, if somebody would upload some example of Gtk application,
 that built with glade and has several typical widgets and signal
 handlers - it may help very much.
There is an small example distributed with GtkD: https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
I get thhis error when trying to compile it : testgithub.d(3): Error: module Builder is in file 'gtk/Builder.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import import path[2] = /usr/local/includes/d -------------------------------------------------------------------------------- I installed from here : link : http://www.dsource.org/projects/gtkd/wiki/DebianPackages
Try: dmd testgithub.d $(pkg-config --cflags --libs gtkd-2) -- Mike Wey
May 02 2013
next sibling parent "Carlos" <checoimg gmail.com> writes:
 I get thhis error when trying to compile it :

 testgithub.d(3): Error: module Builder is in file 
 'gtk/Builder.d' which
 cannot be read
 import path[0] = /usr/include/dmd/phobos
 import path[1] = /usr/include/dmd/druntime/import
 import path[2] = /usr/local/includes/d
 --------------------------------------------------------------------------------


 I installed from here :

 link : http://www.dsource.org/projects/gtkd/wiki/DebianPackages
Try: dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)
Now I get this error on tha command line : No glade file specified, using default "builderTest.glade" glib.GException.GException src/glib/GException.d(75): Failed to open file 'builderTest.glade': No such file or directory ---------------- ./testgithub(_Dmain+0x10f) [0x67a7ff] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x18) [0x843bb4] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x8436f2] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x3b) [0x843bfb] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x8436f2] ./testgithub(_d_run_main+0x1a8) [0x8436ac] ./testgithub(main+0x17) [0x8434ff] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f3b7001dea5] ---------------- Downloaded from here : link : https://github.com/SawfishWM/rep-gtk/blob/master/examples/gtk-builder-test.glade And still get errors. No glade file specified, using default "builderTest.glade" glib.GException.GException src/glib/GException.d(75): Failed to open file 'builderTest.glade': No such file or directory ---------------- ./testgithub(_Dmain+0x10f) [0x67a7ff] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain()+0x18) [0x843bb4] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x8436f2] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll()+0x3b) [0x843bfb] ./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x8436f2] ./testgithub(_d_run_main+0x1a8) [0x8436ac] ./testgithub(main+0x17) [0x8434ff] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f98ed0ceea5] ----------------
May 02 2013
prev sibling parent reply "Carlos" <checoimg gmail.com> writes:
 Try:

 dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)
It compiles but doesn't run well. I'm checking this comment on the code. /** * Usage ./gladeText /path/to/your/glade/file.glade * */
May 02 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/02/2013 11:25 PM, Carlos wrote:
 Try:

 dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)
It compiles but doesn't run well. I'm checking this comment on the code. /** * Usage ./gladeText /path/to/your/glade/file.glade * */
Normally the example looks for builderTest.glade in the directory where the binary is. There one in the GtkD git https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade You can also specify a different glade file on the commandline, the example code tries to access a wiget named window1 if it's not pressent in the glade file it will print "No window?" and exit. -- Mike Wey
May 02 2013
next sibling parent reply "Carlos" <checoimg gmail.com> writes:
On Thursday, 2 May 2013 at 22:07:46 UTC, Mike Wey wrote:
 On 05/02/2013 11:25 PM, Carlos wrote:
 Try:

 dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)
It compiles but doesn't run well. I'm checking this comment on the code. /** * Usage ./gladeText /path/to/your/glade/file.glade * */
Normally the example looks for builderTest.glade in the directory where the binary is. There one in the GtkD git https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade You can also specify a different glade file on the commandline, the example code tries to access a wiget named window1 if it's not pressent in the glade file it will print "No window?" and exit.
I can't believe an hour has passed so easy. How do I specify the doferent glade ?, During compilation ?
May 02 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
03.05.2013 6:12, Carlos пишет:
 Normally the example looks for builderTest.glade in the directory
 where the binary is.

 There one in the GtkD git
 https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


 You can also specify a different glade file on the commandline, the
 example code tries to access a wiget named window1 if it's not
 pressent in the glade file it will print "No window?" and exit.
I can't believe an hour has passed so easy. How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. but if you just want to use another glade file with the same name then answer is no. this different glade file should has window widget with name window1 but with the rest no other restrictions exist. with glade you can create more complex application easer and after debugging build glade file into your application.
May 02 2013
next sibling parent "Carlos" <checoimg gmail.com> writes:
On Friday, 3 May 2013 at 00:24:50 UTC, Alexandr Druzhinin wrote:
 03.05.2013 6:12, Carlos пишет:
 Normally the example looks for builderTest.glade in the 
 directory
 where the binary is.

 There one in the GtkD git
 https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


 You can also specify a different glade file on the 
 commandline, the
 example code tries to access a wiget named window1 if it's not
 pressent in the glade file it will print "No window?" and 
 exit.
I can't believe an hour has passed so easy. How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. but if you just want to use another glade file with the same name then answer is no. this different glade file should has window widget with name window1 but with the rest no other restrictions exist. with glade you can create more complex application easer and after debugging build glade file into your application.
Right now I want to use the glade file form the site.
May 02 2013
prev sibling parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
03.05.2013 7:24, Alexandr Druzhinin пишет:
 I can't believe an hour has passed so easy.

 How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. but if you just want to use another glade file with the same name then answer is no. this different glade file should has window widget with name window1 but with the rest no other restrictions exist. with glade you can create more complex application easer and after debugging build glade file into your application.
I was totally wrong - didn't look at code before :( The right answer to your question is you can specify your own glade file into command line as second argument like this: builder /path/to/your/glade/file/your.glade it will be enough
May 02 2013
next sibling parent "Carlos" <checoimg gmail.com> writes:
 I was totally wrong - didn't look at code before :(
 The right answer to your question is you can specify your own 
 glade file into command line as second argument like this:
 builder /path/to/your/glade/file/your.glade
 it will be enough
Ok I'll try that.
May 02 2013
prev sibling parent reply "Carlos" <checoimg gmail.com> writes:
On Friday, 3 May 2013 at 00:30:00 UTC, Alexandr Druzhinin wrote:
 03.05.2013 7:24, Alexandr Druzhinin пишет:
 I can't believe an hour has passed so easy.

 How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. but if you just want to use another glade file with the same name then answer is no. this different glade file should has window widget with name window1 but with the rest no other restrictions exist. with glade you can create more complex application easer and after debugging build glade file into your application.
I was totally wrong - didn't look at code before :( The right answer to your question is you can specify your own glade file into command line as second argument like this: builder /path/to/your/glade/file/your.glade it will be enough
Sorry if this was too wild but this is what I can do at the moment since I don't see a "gladeText" program which I believe is required for this action I did my guess. code: dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder ~/Documents/Glade/builderTest.glade gives error : Error: unrecognized file extension glade ----------------------------------------------------------------- gtkD samples give error but I'm not using the same software from developers I'll try to install by purge all gtkD programs installed by no and trying "make install" again. Then check if the samples compile right.
May 02 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
03.05.2013 7:55, Carlos пишет:
 Sorry if this was too wild but this is what I can do at the moment since
 I don't see a "gladeText" program which I believe is required for this
 action I did my guess.

 code:

 dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder
 ~/Documents/Glade/builderTest.glade

 gives error :

 Error: unrecognized file extension glade

 -----------------------------------------------------------------

 gtkD samples give error but I'm not using the same software from
 developers I'll try to install by purge all gtkD programs installed by
 no and trying "make install" again. Then check if the samples compile
 right.
first build application: dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) then run it: builder ~/Documents/Glade/builderTest.glade
May 02 2013
parent reply "Carlos" <checoimg gmail.com> writes:
On Friday, 3 May 2013 at 00:58:36 UTC, Alexandr Druzhinin wrote:
 03.05.2013 7:55, Carlos пишет:
 Sorry if this was too wild but this is what I can do at the 
 moment since
 I don't see a "gladeText" program which I believe is required 
 for this
 action I did my guess.

 code:

 dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder
 ~/Documents/Glade/builderTest.glade

 gives error :

 Error: unrecognized file extension glade

 -----------------------------------------------------------------

 gtkD samples give error but I'm not using the same software 
 from
 developers I'll try to install by purge all gtkD programs 
 installed by
 no and trying "make install" again. Then check if the samples 
 compile
 right.
first build application: dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) then run it: builder ~/Documents/Glade/builderTest.glade
I got it working now. I'm using the sample code and I made another layout with Glade for GTK+3 and saved it with the same name, so when I compile the file is called and I get the UI I wanted.
May 02 2013
parent reply "Carlos" <checoimg gmail.com> writes:
On Friday, 3 May 2013 at 01:27:54 UTC, Carlos wrote:
 On Friday, 3 May 2013 at 00:58:36 UTC, Alexandr Druzhinin wrote:
 03.05.2013 7:55, Carlos пишет:
 Sorry if this was too wild but this is what I can do at the 
 moment since
 I don't see a "gladeText" program which I believe is required 
 for this
 action I did my guess.

 code:

 dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder
 ~/Documents/Glade/builderTest.glade

 gives error :

 Error: unrecognized file extension glade

 -----------------------------------------------------------------

 gtkD samples give error but I'm not using the same software 
 from
 developers I'll try to install by purge all gtkD programs 
 installed by
 no and trying "make install" again. Then check if the samples 
 compile
 right.
first build application: dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) then run it: builder ~/Documents/Glade/builderTest.glade
I got it working now. I'm using the sample code and I made another layout with Glade for GTK+3 and saved it with the same name, so when I compile the file is called and I get the UI I wanted.
SO now next step is to learn the signals part, Right ?
May 02 2013
parent Alexandr Druzhinin <drug2004 bk.ru> writes:
03.05.2013 8:29, Carlos пишет:
 I got it working now. I'm using the sample code and I made another
 layout with Glade for GTK+3 and saved it with the same name, so when I
 compile the file is called and I get the UI I wanted.
SO now next step is to learn the signals part, Right ?
right. and it's very very simpler than in plain C
May 02 2013
prev sibling parent "Carlos" <checoimg gmail.com> writes:
On Thursday, 2 May 2013 at 22:07:46 UTC, Mike Wey wrote:
 On 05/02/2013 11:25 PM, Carlos wrote:
 Try:

 dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)
It compiles but doesn't run well. I'm checking this comment on the code. /** * Usage ./gladeText /path/to/your/glade/file.glade * */
Normally the example looks for builderTest.glade in the directory where the binary is. There one in the GtkD git https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade You can also specify a different glade file on the commandline, the example code tries to access a wiget named window1 if it's not pressent in the glade file it will print "No window?" and exit.
Thanks Mike Wey this was crucial on this workaround.
May 02 2013
prev sibling next sibling parent Alexandr Druzhinin <drug2004 bk.ru> writes:
03.05.2013 0:43, Mike Wey пишет:
 There is an small example distributed with GtkD:
 https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
Oops, didn't see.
May 02 2013
prev sibling parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
03.05.2013 0:43, Mike Wey пишет:
 On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:
 How to use GtkD with Glade? Is some tutorial available?
 I spent some time trying to use Glade to build non-trivial application,
 but I do it very inproductive, so I'd like to get some help or I'm
 afraid it will be lasting for years...
 For example, if somebody would upload some example of Gtk application,
 that built with glade and has several typical widgets and signal
 handlers - it may help very much.
There is an small example distributed with GtkD: https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
won't it be better to have the simple template to hide cast() using Builder.getObject(): auto getObjectAs(T)(Builder b, string object_name) { return cast(T) b.getObject(object_name); } ?
May 02 2013
next sibling parent "Carlos" <checoimg gmail.com> writes:
On Friday, 3 May 2013 at 01:00:48 UTC, Alexandr Druzhinin wrote:
 03.05.2013 0:43, Mike Wey пишет:
 On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:
 How to use GtkD with Glade? Is some tutorial available?
 I spent some time trying to use Glade to build non-trivial 
 application,
 but I do it very inproductive, so I'd like to get some help 
 or I'm
 afraid it will be lasting for years...
 For example, if somebody would upload some example of Gtk 
 application,
 that built with glade and has several typical widgets and 
 signal
 handlers - it may help very much.
There is an small example distributed with GtkD: https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
won't it be better to have the simple template to hide cast() using Builder.getObject(): auto getObjectAs(T)(Builder b, string object_name) { return cast(T) b.getObject(object_name); } ?
Thank you very much for your help! It's being the whole day working on this.
May 02 2013
prev sibling parent Mike Wey <mike-wey example.com> writes:
On 05/03/2013 03:00 AM, Alexandr Druzhinin wrote:
 03.05.2013 0:43, Mike Wey пишет:
 On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:
 How to use GtkD with Glade? Is some tutorial available?
 I spent some time trying to use Glade to build non-trivial application,
 but I do it very inproductive, so I'd like to get some help or I'm
 afraid it will be lasting for years...
 For example, if somebody would upload some example of Gtk application,
 that built with glade and has several typical widgets and signal
 handlers - it may help very much.
There is an small example distributed with GtkD: https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d
won't it be better to have the simple template to hide cast() using Builder.getObject(): auto getObjectAs(T)(Builder b, string object_name) { return cast(T) b.getObject(object_name); } ?
Thats a good idea. -- Mike Wey
May 03 2013