Re: Private data problems



Hi Liam,
   It seems that the "switch-page" is a historical problem, its one of the
oldest signals on the widget and fixing that issue would only be an
api break in gtk+, although it might make sense to at least make sure
there is a bug report active.

I definitely suggest you go make sure there is a bug report for the
second issue,
people on gtk+ bugzilla are pretty responsive and will review your
patches too :)

Cheers,
              -Tristan

On Mon, Sep 15, 2008 at 3:39 AM, Liam O'Boyle <liam treshna com> wrote:

Hi, I have two separate issues currently, both somewhat related to internal
GTK structures.

First up, the GtkNotebook "switch-page" event returns a GtkNotebookPage,
which is of incredibly little use. I would like to get at the actual widget
inside the page? I have copied the structure definition out of the GTK
code, which allows me to get the correct widget as follows

(GtkWidget *)((GtkNotebookPage *)notebookpage)->child

but obviously this is far from ideal, as changes to the _GtkNotebookPage
structure are likely to break my app. What's the correct way to get at
this? It seems odd that a signal deliberately exposes the private data
structure, why doesn't it just return the child?

Another problem I have is behavioural. The GtkCellRendererText can be set
to allow editing of the stored value. However, if the cell looses focus
while editing is in place the "editing-canceled" signal is emitted, which
causes the GtkEntry widget to be destroyed and the list to revert to the
previous value. Again, after copying an internal structure,
GtkCellRendererTextPrivate, into my code it's possible to correct this
behaviour

GtkCellRendererTextPrivate *priv;
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE
(GTK_CELL_RENDERER_TEXT(renderer));
if (priv->focus_out_id > 0)
 {
 g_signal_handler_disconnect (priv->entry, priv->focus_out_id);
 priv->focus_out_id = 0;
 }

Is there a correct way to do this, without referring to private structures?
I assume that the behaviour in these two cases is deliberate, although I
can't see why it isn't at least configurable behaviour; in the second
instance, in particular, the behaviour doesn't seem like anything than
anybody would want. In fact, gconf-editor seems to implement its own
GtkCellEditable widget, possibly just to avoid this behaviour. If the
behaviour is not deliberate, I am happy to provide a patch to fix it.

Thanks for any help,
Liam

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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