Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/examples


Modified Files:
        event_handler_example.c 


Log Message:


hmm make it mroe robust...

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/examples/event_handler_example.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- event_handler_example.c     8 May 2004 04:44:03 -0000       1.1
+++ event_handler_example.c     13 May 2004 02:40:58 -0000      1.2
@@ -1,39 +1,41 @@
-/* Ecore Event Handler Example.
- */
-
+/* Ecore Event Handler Example. */
 #include <Ecore.h>
  
 Ecore_Event_Handler *handler1 = NULL, *handler2 = NULL;
  
 int event_hup(void *data, int ev_type, void *ev)
 {
-  printf("Hup signal! Remove the exit handler.\n");
-  ecore_event_handler_del(handler1);
-  return 0;
+   printf("Hup signal! Remove the exit handler.\n");
+   if (handler1)
+     {
+       ecore_event_handler_del(handler1);
+       handler1 = NULL;
+     }
+   return 0;
 }
- 
+
 int event_exit(void *data, int ev_type, void *ev)
 {
-  Ecore_Event_Signal_Exit *e;
+   Ecore_Event_Signal_Exit *e;
    
-  e = (Ecore_Event_Signal_Exit *)ev;
-  printf("This callback handles event type: %i\n", ECORE_EVENT_SIGNAL_EXIT);
-  printf("Event type recieved: %i\n", ev_type);
-  if (e->interrupt) printf("Exit: interrupt\n");
-  if (e->quit)      printf("Exit: quit\n");
-  if (e->terminate) printf("Exit: terminate\n");
-  ecore_main_loop_quit();
-  return 1;
+   e = (Ecore_Event_Signal_Exit *)ev;
+   printf("This callback handles event type: %i\n", ECORE_EVENT_SIGNAL_EXIT);
+   printf("Event type recieved: %i\n", ev_type);
+   if (e->interrupt) printf("Exit: interrupt\n");
+   if (e->quit)      printf("Exit: quit\n");
+   if (e->terminate) printf("Exit: terminate\n");
+   ecore_main_loop_quit();
+   return 1;
 }
- 
+
 int main(int argc, char **argv)
 {
-  ecore_init();
-  ecore_app_args_set(argc, argv);
-  handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, 
-                                     event_exit, NULL);
-  handler2 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP, 
-                                     event_hup, NULL);
-  ecore_main_loop_begin();
-  ecore_shutdown();
+   ecore_init();
+   ecore_app_args_set(argc, argv);
+   handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, 
+                                     event_exit, NULL);
+   handler2 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP, 
+                                     event_hup, NULL);
+   ecore_main_loop_begin();
+   ecore_shutdown();
 }




-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to