Re: GtkTreeView "activate" signal patch



Mikael Hermansson <tyan linux se> writes:

> On fre, 16 mar 2001 18:31:48 jrb redhat com wrote:
> > > Looks like GtkBinding only takes signals as arguments
> > > but this leads to an problem because I need to check
> > > if there is an item selected before the "activate" signal is 
> > > emited?
> > 
> > It's even more complicated then that, as you need to consider cells like
> > toggle buttons that can be activated on their own (see
> > tests/testtreefocus.c as an example of such an application).  Anyway,
> > I'll add the button click case here in the short term so you can start
> > using it, and we can add the keyboard activation later.
> > 
> 
> I don't think we should add the patch if were not sure it's the right
> solution :-)
> 
> If I'm correct tree_view don't now what type of cell that is
> clicked/focused right?

It knows the cell, and I recently added a "can_activate" parameter to
GtkCellRenderer.  This way it can know to pass the activation on to the
cell or not.

> One solution is to add two new gtkcellrenderer class functions:
> 
>   void (* key_press_event)   (GtkCellRenderer     *cell, GdkEventButton *)
>   void (* button_press_event)   (GtkCellRenderer     *cell, GdkEventButton
> *)
> 
> ... and pass the tree_view-> key_press_event/button_press_event to the cell
> renderer
> to check what todo.

Actually, I'm planning on changing gtk_cell_renderer_event to be just
gtk_cell_renderer_activate in the future, and leave it at that.  This
seems somewhat cleaner to me.  If anyone thinks this wont be flexible
enough, please let me know.

> gint
> cell_render_button_press(GtkCellRenderer *cell, GtkTreeView *tview,
> GdkEvent)
> {
>   do_the_test_to_check_if_its_ok_to_emit_the_signal()
> 
>   g_signal_emit(tree_view, "row_activated");
> }

I think it makes much more sense for the tree to emit this signal.  I
don't see any point in doing this.

> This is also good to use for the checkbox/editable cells etc.
> 
> > > Is this patch ok to submit?
> > 
> > Of course it's okay to submit. (-: I'll read through it and apply it,
> > though...
> 
> The patch I sent to the list is broken. I forgot to store the
> tree_view_signal[ACTIVATE]  id :-/

Yeah -- I noticed. (-:
But I cleaned it up and committed it.  There should be a "row_activated"
signal now.

> My new "local" patch also seems to be broken (sometimes coredumps on
> doubleclick).

Can you try the version I just committed, and see if they still
happen???

Thanks,
-Jonathan




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