Re: Destroy signal not working on GtkMenuItem?



learfox furry ao net wrote:

void destroy_cb (GtkObject *object, gpointer data);

It's in GtkObject.

lfan> I tried to use the "destroy" signal handling in the same situation for a
lfan> GtkMenuItem, however it segfaults and gdb seems to show the inputs are no
lfan> the same to the signal handler function.

That's  a  strange  behaviour.  Here  is  an  example which shows that
the   "destroy"   signal   is   sent  to  the  GtkMenuItem  when  you
gtk_widget_destroy it:

# include <gtk/gtk.h>

void warn (GtkWidget *);

int
main (int argc, char **argv)
{
  GtkWidget *win, *menubar, *file;

  gtk_init (&argc, &argv);
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);


  menubar = gtk_menu_bar_new ();
  file = gtk_menu_item_new_with_label ("File");
  gtk_signal_connect (GTK_OBJECT (file),
                      "destroy",
                      GTK_SIGNAL_FUNC (warn),
                      NULL);

  gtk_signal_connect_object (GTK_OBJECT (win),
                             "delete_event",
                             GTK_SIGNAL_FUNC (gtk_widget_destroy),
                             GTK_OBJECT (file));

  gtk_container_add (GTK_CONTAINER (menubar), file);
  gtk_container_add (GTK_CONTAINER (win), menubar);
  gtk_widget_show (win);
  gtk_widget_show (menubar);
  gtk_widget_show (file);
  gtk_main ();
}
void
warn (GtkWidget *wid)
{
    g_print ("\n\n reached \n\n");
}

When  you  execute  it,  and  delete  the window (sending by the way a
delete_event),  the  warn  function is run and "reached" is shown. So,
there's probably an error in your code.

lfan> Is there anything different from how the "destroy" signal is sent to a
lfan> signal handler function for a GtkMenuItem than a GtkCombo?

When  destroying  a  widget,  Gtk+ don't care about it's a GtkCombo or
GtkMenuItem. It sends a destroy signal, and that's all.

lfan> --
lfan> Sincerely,                  ,"-_                         \|/
lfan> -Capt. Taura M.             ,   O=__                    --X--
lfan> ..__                         ,_JNMNNEO=_                 /|\
lfan> OMNOUMmnne.                  {OMMNNNEEEEOO=_
lfan> UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
lfan> UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
lfan> OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
lfan> EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
lfan> NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
lfan>                   http://furry.ao.net/~learfox/


bye,

--
mmenal
                                 ____               _    _                    _
         __  __ _ __  __  __    / ___| ___  _   _  | |  ( )_ __  _   ___  __ | |
(o-      \ \/ /(_)\ \/ /  _ \  | |  _ /'_ \| | | | | |  | | '_ \| | | \ \/ / | |
/\        \  / | | \  / | __/  | |_| | | | | |_| | | |__| | | | | |_| |>  <  |_|
L_/_       \/  |_|  \/  \___|  \_____|_| |_|\__,_/ |____|_|_| |_|\__,_/_/\_\ (_)


 
______________________________________________________________________________
Vous avez un site perso ?
2 millions de francs à gagner sur i(france) !
Webmasters : ZE CONCOURS ! http://www.ifrance.com/_reloc/concours.emailif






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