Proposal: gtk_main() quit callbacks



hello everyone,

i'd like to propose the addition of a gtk_main() quit callback
mechanism like so:

gint       gtk_quit_add            (guint	       main_level,
				    GtkFunction        function,
                                    gpointer           data);
gint       gtk_quit_add_full       (guint	       main_level,
				    GtkFunction        function,
                                    GtkCallbackMarshal marshal,
                                    gpointer           data,
                                    GtkDestroyNotify   destroy);

function will be called when gtk_main () is left if main_level ==
gtk_main_level() or main_level==0.

this meachanism can be used for example to destroy certain data:

int
main ()
{
  [...]
  my_table = g_new0 (gchar, 10 * 10);

  gtk_widget_show (window);
  gtk_widget_show (action_list);
  
  gtk_quit_add (1, (GtkFunction*) gtk_widget_destroy, action_list);
  gtk_quit_add (1, (GtkFunction*) g_free, my_table);
  gtk_quit_add (0, (GtkFunction*) printf, "main has been quitted\n");
  
  gtk_main ();
  
  return 0;
}

my actuall personal motivation for the need to trigger functions on the
end of gtk_main() is that GLE needs to shut down if the main application
finishes its user interface (without using some atexit() magic), but it
will certainly be much usefull for other applications.
i'd like to get that into 0.99.4 so quik responses (objections) will be
neccessary ;)

---
ciaoTJ



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