Re: Odd gnome property box behavior



gandalf@pobox.com wrote:
> 
> Hi,
> I was creating a preferences screen, and decided to use the
> gnome_property_box_new() to create a property box.  I then attached an
> apply_cb proc with:
> gtk_signal_connect (GTK_OBJECT (propbox), "apply",
>                      GTK_SIGNAL_FUNC (apply_cb), NULL);
> 
> I was testing, so I just defined apply_cb as:
> static void apply_cb(GtkWidget *w, gpointer data)
> { g_print("apply\n"); }
> 
> What I noticed while using this, was that whenever I clicked apply or ok,
> I saw the string "apply" printed twice!  I would assume then that the
> callback is getting called two times.  While I don't have any code that
> cares if it is executed twice, I would think that some might, and would
> not think that this would be the expected behaviour.

The propertybox widget expects your callback to have the following
prototype:
void <func_name> (GtkWidget *w, gint pagenum, gpointer data);

The apply signal is emmitted once for each dirty page of the box.  For
each page, it sets pagenum to the page (0 based).  When it is done with
that, it sends a final call with the pagenum == -1.  You are probably
seeing the results of one dirty page and the "final" call.

Good luck!

-------------
Dave Camp                \    /
campd@oit.edu             \||/
                          --



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