[Glade-users] Global GladeXML

Hello all,

my problem is the folowing...
I have a glade xml file being opened in my code...

I wanna use the same pointer to this XML file in other functions...
how could I do it??
I have the implementation below, but my signals are not connecting.. why??
(maybe this IS a newbie question... but I'm not figuring this out...
the purpose here is to make it easier if I wanna port the application
to other Graphical Interface Toolkit such as Maemo/Hildon, QT or even

/* Global Glade XML File */
static GladeXML *openhset;

/* Event Handlers */
void on_main_window_ok_clicked (GtkWidget *widget, gpointer data)

void on_main_window_quit_clicked (GtkWidget *widget, gpointer data)
        printf( "Calling Quit handler\n");

void on_main_window_destroy_event (GtkWidget *widget, gpointer data)

/* Custom interface functions */
void openhset_main(void)

int openhset_fill_list(char **data)
        GtkWidget               *treeview;
        GtkListStore            *list;
        GtkTreeIter             iter;
        GtkCellRenderer         *renderer;
        GtkTreeViewColumn       *column;

        treeview = glade_xml_get_widget (openhset, "main_window_treeview1");
        list = gtk_list_store_new (1, G_TYPE_STRING);
        gtk_list_store_append (list, &iter);
        gtk_list_store_set (list, &iter,
                        COLUMN, "Testing new function",

        gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (list));

        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes ("USB", renderer,
                        "text", COLUMN, NULL);

        gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);

        return 0;

int openhset_init_interface(int argc, char *argv[])
        GtkWidget       *main_window, *test_window;
        GtkWidget       *main_window_treeview1;
        GtkWidget       *main_window_ok;

        GtkListStore    *main_window_list;
        GtkTreeIter     iter;

        GtkCellRenderer *renderer;
        GtkTreeViewColumn       *column;

        gtk_init(&argc, &argv);

        /* Open the XML File */
        openhset = glade_xml_new (OPENHSET_XML, NULL, NULL);

        /* Get Widgets */
        main_window = glade_xml_get_widget (openhset, "main_window");
        main_window_ok = glade_xml_get_widget (openhset, "main_window_ok");

        return 0;

Best Regards,

Felipe Balbi
felipebalbi at users.sourceforge.net

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