Re: g_signal_emit()



Kristian Rietveld wrote:
On Sun, Aug 31, 2008 at 2:08 PM, dhk <dhkuhl optonline net> wrote:
I have two callback functions.  The first for when a cell in a treeview
gets edited and the second for when the tab key is pressed.  The first works
fine.  In the second, I want to emit the "edited" signal so it acts as if
the first event happened.  However, the g_signal_emit() in the
"key-press-event" callback does not seem to work.

I am doing the following and the renderer and sig_id are valid.

sig_id=g_signal_lookup("edited", G_OBJECT_TYPE(renderer));
g_signal_emit(renderer, sig_id, 0);

It looks like you are trying to emit the edited signal here without
specifying the correct arguments.

In short what I'm trying to do is emit the "edited" event when the
"key-press-event" occurs.  That way when the use tabs off the cell in the
treeview the callback for the "edited" event is called.  It doesn't make
sense the if there are two way to leave a cell (tabbing off it or clicking
outside of it) that you can't call the same event.

Maybe you can try using gtk_cell_editable_editing_done() here?  The
editing-done signal handler of the respective cell editable will take
care of emitting the edited signal.  You can get hold of the correct
cell editable by listening for the editing-started signal on the cell
renderer.


regards,

-kris.

That sounds like it could work. I'll see if I can get the GtkCellEditable from gtk_cell_renderer_start_editing(). That seems to take a lot of parameter that I don't have. I'll let you know what happens.

Thanks,
dave



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