Re: Signal inside widget subclass



Lets say your buffer's class is like

typedef struct _MyTextBufferClass
{
  GtkTextBufferClass parent_class;
  // more stuff here
} MyTextBufferClass;


Basicaly in my_text_buffer_class_init override "changed" function

void my_text_buffer_class_init(MyTextBufferClass *klass)
{
  GtkTextBufferClass* tbc = (GtkTextBufferClass*)klass;

  tbc->changed = your_function_name_here;
}

And then in your function call previous function

void your_function_name_here(GtkTextBuffer *buffer)
{
  // your stuff here

  GTK_TEXT_BUFFER_CLASS(my_text_buffer_parent_class)->changed(buffer)
}


On 12/02/2010 04:42 AM, Erick PÃrez Castellanos wrote:
Hi:
I have this design issue: Iâm kinda newbie with gtk development, so
sorry is this is the first line on some mystery tutorial out there .

Iâm subclassing a Gtk.TextBuffer and I want to know inside the widget
code when the âchangedâ signal is emitted. I know I always can connect a
callback to the signal, that why they exist anyway, but that sound like
something I wouldn't do inside the widget.

Is it correct ? At least from the Gtk development/design point view. It
works, really well, my point is purely about design, maybe there a
better and prettier way of doing this.

Thxs
_______________________________________________
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]