Wireshark-dev: Re: [Wireshark-dev] Set button label in GTK 1.2

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Tue, 11 Jul 2006 22:46:26 +0200
Tinoshi Kitazawa wrote:
Hi,
I was looking through the wireshark code to find a way to set the label in a GtkButton with Gtk1.x and I've found this (in gtk\simple_dialog.c): #if GTK_MAJOR_VERSION >= 2
    /* XXX - find a way to set the GtkButton label in GTK 1.x */
    gtk_button_set_label(GTK_BUTTON(ask_cb), text);
#endif
So, I'm using this: #if GTK_MAJOR_VERSION >= 2
    /* XXX - find a way to set the GtkButton label in GTK 1.x */
    gtk_button_set_label(GTK_BUTTON(ask_cb), text);
#else
    /* Set the GtkButton label in GTK 1.x */
    gtk_label_set_text(GTK_LABEL(GTK_BIN(ask_cb)->child), text);
#endif
I know it is not so 'clean', but I think that it is probably the only way to do that and for all GtkButton I use it works... Am I right?
I don't know if it will work with all GTK 1.x versions in the wild.

However, if it will work with your 1.2 versions, chances are high that 1.3.x versions will also work.

If things get bad, we can use something like "#if GTK_MINOR_VERSION >= 2" or such anyway.

Regards, ULFL