Re: g_object_set_data



If you haven't caught it already,

On Sat, 2002-11-30 at 12:08, Blowfish wrote:
> void
> on_button1_clicked (GtkButton       *button,
>                   gpointer         user_data)
> {
> 	GtkWidget *tmp;
>    GtkWidget *colorselectiondialog1;
> 	tmp = lookup_widget ((GtkWidget *)button, "window1");
>    colorselectiondialog1 = create_colorselectiondialog1 
> ();
> 	g_object_set_data ((GObject *)colorselectiondialog1, 
> "main_window", tmp);
                                        ^^^^^^^^^^^^^^^^^^^^^
Here you associate the data with the dialog,

>    gtk_widget_show (colorselectiondialog1);
> }
> 
> void
> on_colorselectiondialog_ok_button1_clicked (GtkButton 
> *button, gpointer user_data)
> {
> 	GtkWidget *window;
>    window = (GtkWidget *) g_object_get_data ((GObject *) 
> button, "main_window");
  ^^^^^^
And then try and retrieve it from the button.

> 	gtk_window_set_title ((GtkWindow *)window, "my title");
> }
> 

So you need to associate the data with the button in the dialog or chain
up to the toplevel from the button in the dialog.

HTH

-- 
Stephen




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