Possible bug in GdlDockLayout or Python Bindings

Hey guys, I'm not quite sure who to contact regarding the gdl python bindings or which project the bug should be submitted to (I don't know much about language bindings). Another user posted this issue back in Feb. of last year: http://www.mail-archive.com/gnome-devtools gnome org/msg00335.html

However, it was left unresolved. I've done a little testing and have some more information.

The problem is with loading a GdlDockLayout from a file. I've built a little test application in C and another in Python. The one in C works, where as the Python one does not. When the Python application loads the layout from the file, it looses all dock items. I've attached the test applications to this email. These test programs save the layout when to close, so you'll have to run it once, close it, and then run it again to see the bug.

If anyone could take a quick look and a) make sure I'm using gdl properly (docs are limited) and b) suggest whom I might contact and/or submit a bug regarding this problem and c) any suggestions for a quick fix would be great. Who is maintaining the gdl python bindings?


- Micah Carrick

 Developer - http://www.micahcarrick.com
 GTK+ Forums - http://www.gtkforums.com

/* gcc -Wall -g `pkg-config --cflags --libs gtk+-2.0 gdl-1.0`-o gdl-test gdl-test.c  */

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

gboolean on_window_delete_event(GtkWindow *window, GdkEvent *event, GdlDockLayout *layout)
    gdl_dock_layout_save_layout (layout, "test");
    gdl_dock_layout_save_to_file (layout, "layout_c.xml");
    g_print("Saved layout XML to file.\n");
    return FALSE;

int main (int argc, char *argv[])
    GtkWidget *win, *dock, *label1, *item1, *label2, *item2;
    GdlDockLayout *layout;
    gtk_init (&argc, &argv);
    win = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    dock = gdl_dock_new ();
    layout = gdl_dock_layout_new (GDL_DOCK(dock));
    g_signal_connect (G_OBJECT(win), "destroy",
                      G_CALLBACK (gtk_main_quit), NULL);
    g_signal_connect (G_OBJECT(win), "delete-event",
                      G_CALLBACK (on_window_delete_event), layout);

    label1 = gtk_label_new ("Label 1");
    item1 = gdl_dock_item_new_with_stock ("item1", 
                                          "Item 1",
    gtk_container_add (GTK_CONTAINER (item1), label1);
    gdl_dock_add_item (GDL_DOCK (dock), GDL_DOCK_ITEM (item1), GDL_DOCK_LEFT);
    gtk_widget_show_all (item1);
    label2 = gtk_label_new ("Label 21");
    item2 = gdl_dock_item_new_with_stock ("item2", 
                                          "Item 2",
    gtk_container_add (GTK_CONTAINER (item2), label2);
    gdl_dock_add_item (GDL_DOCK (dock), GDL_DOCK_ITEM (item2), GDL_DOCK_RIGHT);
    gtk_widget_show_all (item2);
    gtk_container_add(GTK_CONTAINER(win), dock);
    if (gdl_dock_layout_load_from_file (layout, "layout_c.xml"))
        gdl_dock_layout_load_layout (layout, "test");
        g_print("Loaded layout XML from file.\n");


    return 0;
import os
import pygtk
import gtk
import gdl

def on_window_delete_event(window, params):
    print "Saved layout XML to file."

win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.connect('destroy', gtk.main_quit)
win.connect('delete-event', on_window_delete_event)
dock = gdl.Dock()
layout = gdl.DockLayout(dock)    
item1 = gdl.DockItem("item1", "Item 1", gtk.STOCK_OPEN, gdl.DOCK_ITEM_BEH_NORMAL)
item1.add(gtk.Label("Label 1"))
dock.add_item (item1, gdl.DOCK_LEFT)

item2 = gdl.DockItem("item2", "Item 2", gtk.STOCK_SAVE, gdl.DOCK_ITEM_BEH_NORMAL)
item2.add(gtk.Label("Label 2"))
dock.add_item (item2, gdl.DOCK_RIGHT)

if layout.load_from_file('layout_py.xml'):
    print "Loaded layout XML from file."


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