[Glade-users] Libglade Tutorial



Can somebody point me to a good libglade tutorial.  I'm specifically
looking for the "proper" way to lookup widgets in a callback function. 
for example my "main" function looks like this:

/* Created by Anjuta version 1.2.1 */
/*      This file will not be overwritten */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gnome.h>
#include <glade/glade.h>
#include "callbacks.h"

int main (int argc, char *argv[])
{
        GtkWidget *window1;
        GladeXML *xml;

        #ifdef ENABLE_NLS
                bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
                textdomain (PACKAGE);
        #endif

        gnome_init (PACKAGE, VERSION, argc, argv);
        glade_gnome_init ();
        /*
         * The .glade filename should be on the next line.
         */
        xml = glade_xml_new (PACKAGE_SOURCE_DIR"/LibGladeMusic2.glade", NULL,
NULL);

        /* This is important */
        glade_xml_signal_autoconnect (xml);
                                
        window1 = glade_xml_get_widget (xml, "window1");
        gtk_widget_show (window1);

        gtk_main ();
        return 0;
}

The callback exists in a separate fill called callbacks.c and looks like
this:

void on_butStoreMusic_clicked               (GtkButton       *button,
                                                gpointer         user_data)
{
        GtkWidget *widget;
        //GladeXML *xml;
        g_print("button clicked\n");
        //xml = glade_xml_new (PACKAGE_SOURCE_DIR"/LibGladeMusicbox.glade",
NULL, NULL);
        widget=glade_xml_get_widget(GladeXML(button), "butStoreMusic");
        //set up the song listing
        //StoreMusicListSetup(button);
        //gtk_notebook_set_page(GTK_NOTEBOOK(widget), 2);

} 

The callback is called because I get the "button clicked" message in the
terminal window, but I can't for the life of me grab a widget so that I
can turn a page in the notebook that the widget exists in.  
I've looked for a good libglade tutorial, but have been unable to find
one so far.





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