[Glade-users] changing the title on the main window.



thanks for the help, but why do i need to pass a reference to a button, i just
want to change the title when, for example, the user entered a number.
is there any way to call gtk_window_set_title() simply from a function?

the reason i am asking is because the function i am using is a simple callback
funtion for a timer, there are no paramters, not gtkwidgets, etc.

thanks for the help
uri





------------------------------------
Micah Carrick email at micahcarrick.com
Wed Jun 21 15:24:39 EDT 2006

    * Previous message: [Glade-users] changing the title on the main window.
    * Next message: [Glade-users] changing the title on the main window.
    * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Use gtk_window_set_title() but pass the reference of the main window... 
not a new window using gtk_window_new...


void on_button_clicked (GtkWidget *widget, gpointer user_data);

int
main (int argc, char *argv[])
{
    GtkWidget *window;
    GladeXML *gxml;
    
    /* libglade */
    gxml = glade_xml_new ("glade1.glade", NULL, NULL);

    /* get window reference */
    window = glade_xml_get_widget (gxml, "window1");

    /*
    connect function to button clicked signal and pass reference
    to window as user data
    */
    glade_xml_signal_connect_data (gxml, "on_button_clicked",
                G_CALLBACK(on_button_clicked), window);

    /* show the window */
    gtk_widget_show (window);

    /* gtk main loop */
    gtk_main ();

    return 0;
}

on_button_clicked (GtkWidget *widget, gpointer user_data)
{
    /* Window is passed in user data. Use it to change the title */
    gtk_window_set_title(GTK_WINDOW(user_data),
                "This is the new title");

}

Uri wrote:
the application i am writing need to change the title on the main window
every
time something happens.

i tried using:

gtk_window_new()
gtk_window_set_title()

passing as a paramter a pointer to the main window, but that will only create
a
new window with title i want.

how do you change the title of the main window at runtime?
thanks!

A story: A man fires a rifle for many years; And he goes to war. And
afterward he turns the rifle in at the armoury; And he believes he's finished
with the rifle. But no matter what else he might do with his hands, love a
woman, build a house, change his son's diaper; His hands still remember the
rifle. -- Jarhead

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Glade-users maillist  -  Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users

  

    * Previous message: [Glade-

A story: A man fires a rifle for many years; And he goes to war. And afterward he turns the rifle in at the 
armoury; And he believes he's finished with the rifle. But no matter what else he might do with his hands, 
love a woman, build a house, change his son's diaper; His hands still remember the rifle. -- Jarhead

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




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