Welcome, Guest.
Please login or register.
xblite and GTK+
Forum Login
Login Name: Create a new account
Password:     Forgot password

XBLite Forum    General Boards    General Programming Discussion  ›  xblite and GTK+
Users Browsing Forum
No Members and 1 Guests

xblite and GTK+  This thread currently has 7,076 views. Print Print Thread
1 Pages 1 Recommend Thread
Julien
March 20, 2009, 8:11pm Report to Moderator Report to Moderator
Baby Member
Posts: 3
Hi folks,

I know that this is more a GTK+ question than an xblite one,
but I'm trying to use Liviu Armeanu's GTK+ binding for xblite to create a "File Open" dialog window...

At runtime, I get this error :
Gtk-CRITICAL **:gtk_window_set_transient_for: assertion `parent == NULL || GTK_IS_WINDOW (parent)' failed

This is like the parent window that is then passed to the "File Open" dialog could not be created.

Is there some GTK guru here?
Here the code:

gtk_init (argc, argv)
window = gtk_window_new ($$GTK_WINDOW_TOPLEVEL)
title$ = "Open file"
dialog = gtk_file_chooser_dialog_new (&title$, &window, $$GTK_FILE_CHOOSER_ACTION_OPEN, &$$GTK_STOCK_CANCEL, $$GTK_RESPONSE_CANCEL, &$$GTK_STOCK_OPEN, $$GTK_RESPONSE_ACCEPT, NULL)
gtk_main ()
Logged Offline
Private Message Private message
Julien
March 21, 2009, 5:24pm Report to Moderator Report to Moderator
Baby Member
Posts: 3
The xblite code below works to create a GTK+ "Open file" dialog.
As parent window for the dialog, I pass a value of 0 (variable None).
The dialog displays, however, I don't know what should be the xblite/GTK equivalent for this GTK_FILE_CHOOSER (dialog)

For those interested in GTK+ for xblite, see : http://homepages.ihug.co.nz/~armeanu/xblite.html
See the message on the xblite Google Groups forum if you encounter installation problems with the necessary libraries.

gtk_init (argc, argv)
title$ = "Open file"
dialog = gtk_file_chooser_dialog_new (&title$, None, $$GTK_FILE_CHOOSER_ACTION_OPEN, &$$GTK_STOCK_CANCEL, $$GTK_RESPONSE_CANCEL, &$$GTK_STOCK_OPEN, $$GTK_RESPONSE_ACCEPT, NULL)
    
IF (gtk_dialog_run (dialog) = $$GTK_RESPONSE_ACCEPT) THEN
    'filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
    'open_file (filename);
    'g_free (filename);
END IF
     
gtk_widget_destroy (dialog)
Logged Offline
Private Message Private message Reply: 1 - 2
Julien
March 29, 2009, 12:07pm Report to Moderator Report to Moderator
Baby Member
Posts: 3
To retrieve the file name of the file to open, use gtk_file_chooser_get_filename_utf8 instead of gtk_file_chooser_get_filename.

See this thread for details : http://groups.google.com/group/xblite/browse_thread/thread/f520978a90715b2a
Logged Offline
Private Message Private message Reply: 2 - 2
1 Pages 1 Recommend Thread
Print Print Thread

XBLite Forum    General Boards    General Programming Discussion  ›  xblite and GTK+

Thread Rating
There is currently no rating for this thread