Re: Glade and dialogs



On Wed, 2005-02-23 at 06:55, [ A b h i s h e k ] wrote:
hey guys,

i am using Glade 2.0 in which i have created a Gnome window as well as a 
Gnome dialog box. So now when i click on some menu option i would like to 
display this dialog box.

Glade builds the menu callbacks for you when using the default menus.

 Say you've got the "Open" menu so there exists an on_open1_clicked()
callback in callbacks.c

It also creates a construction function for your dialog, say your dialog
is called foo_dialog, Glade builds a function called 
create_foo_dialog(), see interface.c

What you have to do, is in the the on_open1_clicked() body, write down
some come to build and show your dialog:

void
on_open1_clicked (GtkMenuItem* item, gpointer user_data)
{
        GtkWidget *mydlg;

        mydlg = create_foo_dialog();
        gtk_widget_show(mydlg);
}

 I dont know how to implement this without getting 
into the hassle of global variables and all. 

No need for that.

And also when i do somehow 
manage to display the Gnome about dialog box, i cannot understand which 
event is called when i close this box.

Among others the GtkDialog "close" signal.

 could someone please help me out. Im 
pretty new to Gtk programming. Thanks

You should take a look at two things in the code:

1.- What signals are connected by Glade and how: search in interface.c
for g_signal_connect()

2.- What callbacks are build by Glade and how are they called: see
callbacks.c and try to match those callbaks with the names on
g_signal_connect() calls on interface.c

This will give you an overall view on how callbacks are connected to
signals, and how to implement your how callbacks.

Check also in Glade the "signals" tab on the property editor - On the
menu "view > property editor" you can show/hide it.

My recomendation is to stuck in the steb-by-step approach of the gtk
tutorial - to get an overview of GTK - before to start playing with
Glade.
http://www.gtk.org/tutorial/

This will make things easier, than try to understand the somewaht
complex code generated by Glade. As example, you don't need to separate
all functions in a bunch of files, but you can easily do it in one file
for small test applications as yours.
 
Regards.
-- 
Iago Rubio



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