Opaque Information



Hi,

I have two separate issues currently, both somewhat related to internal
Gnome 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?

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 (which is very confusing to users).

  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




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