Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        Makefile.am e_apps.c e_apps.h 
Added Files:
        e_apps_error.c 


Log Message:
Exe error dialog.  Still needs some work, but it's good enough for testing
by the wider community.  Currently only e_app started exe's get this.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/Makefile.am,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -3 -r1.94 -r1.95
--- Makefile.am 12 Jan 2006 02:12:21 -0000      1.94
+++ Makefile.am 21 Jan 2006 15:39:03 -0000      1.95
@@ -208,6 +208,7 @@
 e_widget_entry.c \
 e_widget_image.c \
 e_config_dialog.c \
+e_apps_error.c \
 e_int_config_focus.c \
 e_icon_grid.c \
 e_icon_canvas.c \
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- e_apps.c    17 Jan 2006 10:50:58 -0000      1.116
+++ e_apps.c    21 Jan 2006 15:39:03 -0000      1.117
@@ -13,6 +13,9 @@
  * - clean up the add app functions. To much similar code.
  */
 
+extern void _e_app_error_dialog(E_Container *con, E_App_Autopsy *app);
+
+
 /* local subsystem functions */
 typedef struct _E_App_Change_Info E_App_Change_Info;
 typedef struct _E_App_Callback    E_App_Callback;
@@ -417,7 +420,8 @@
     * the eapp file */
    inst = E_NEW(E_App_Instance, 1);
    if (!inst) return 0;
-   exe = ecore_exe_run(a->exe, inst);
+   /* We want the stdout and stderr as lines for the error dialog if it exits 
abnormally. */
+   exe = ecore_exe_pipe_run(a->exe, ECORE_EXE_PIPE_AUTO| ECORE_EXE_PIPE_READ | 
ECORE_EXE_PIPE_ERROR | ECORE_EXE_PIPE_READ_LINE_BUFFERED | 
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, inst);
    if (!exe)
      {
        free(inst);
@@ -429,6 +433,8 @@
                            a->exe);
        return 0;
      }
+   /* 20 lines at start and end, 20x100 limit on bytes at each end. */
+   ecore_exe_auto_limits_set(exe, 2000, 2000, 20, 20);
    ecore_exe_tag_set(exe, "E/app");
    inst->app = a;
    inst->exe = exe;
@@ -1854,13 +1860,25 @@
    a = ai->app;
    if (!a) return 1;
 
-   /* FIXME: maybe we could capture stdout/stderr and display it here? */
-   if (ev->exit_code == 127) /* /bin/sh uses this if cmd not found */
-     e_error_dialog_show(_("Run Error"),
-                        _("Enlightenment was unable to run the program:\n"
-                          "\n"
-                          "%s\n"),
-                        a->exe);
+   if ( (ev->exited) && (ev->exit_code == 127) ) /* /bin/sh uses this if cmd 
not found */
+     {
+        e_error_dialog_show(_("Run Error"),
+                           _("Enlightenment was unable to run the program:\n"
+                             "\n"
+                             "%s\n"),
+                           a->exe);
+      }
+   else if ( ! ((ev->exited) && (ev->exit_code == EXIT_SUCCESS)) )   /* Let's 
hope that everyhing returns this properly. */
+      {   /* Show the error dialog with details from the exe. */
+         E_App_Autopsy *aut;
+
+         aut = E_NEW(E_App_Autopsy, 1);
+        aut->app = a;
+         aut->del = *ev;
+         aut->read = ecore_exe_event_data_get(ai->exe, ECORE_FD_READ);
+         aut->error = ecore_exe_event_data_get(ai->exe, ECORE_FD_ERROR);
+         _e_app_error_dialog(NULL, aut);
+      }
    if (ai->expire_timer) ecore_timer_del(ai->expire_timer);
    free(ai);
    a->instances = evas_list_remove(a->instances, ai);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- e_apps.h    14 Jan 2006 21:05:43 -0000      1.27
+++ e_apps.h    21 Jan 2006 15:39:03 -0000      1.28
@@ -17,6 +17,7 @@
 
 typedef struct _E_App          E_App;
 typedef struct _E_App_Instance E_App_Instance;
+typedef struct _E_App_Autopsy  E_App_Autopsy;
 
 #else
 #ifndef E_APPS_H
@@ -76,6 +77,15 @@
    Ecore_Timer *expire_timer;
 };
 
+struct _E_App_Autopsy
+{
+   E_App       *app;
+
+   Ecore_Exe_Event_Del del;
+   E_Config_Dialog *error_dialog;   
+   Ecore_Exe_Event_Data *error, *read;
+};
+
 EAPI int         e_app_init                              (void);
 EAPI int         e_app_shutdown                          (void);
 




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to