forked from enlightenment/enlightenment
Fix some very serious formatting issues with this one.
Renamed a couple of functions, but other than that, no functional changes, just formatting. SVN revision: 23593
This commit is contained in:
parent
44cbb5c5dd
commit
f044210059
|
@ -11,27 +11,13 @@ struct _E_Config_Dialog_Data
|
|||
};
|
||||
|
||||
/* Protos */
|
||||
static void *_e_app_error_dialog_create_data(E_Config_Dialog * cfd);
|
||||
static void _e_app_error_dialog_free_data(E_Config_Dialog * cfd,
|
||||
E_Config_Dialog_Data *
|
||||
cfdata);
|
||||
static Evas_Object *_e_app_error_dialog_basic_create_widgets(E_Config_Dialog *
|
||||
cfd, Evas * evas,
|
||||
E_Config_Dialog_Data
|
||||
* cfdata);
|
||||
static Evas_Object *_e_app_error_dialog_advanced_create_widgets(E_Config_Dialog
|
||||
* cfd,
|
||||
Evas * evas,
|
||||
E_Config_Dialog_Data
|
||||
* cfdata);
|
||||
static void _e_app_error_dialog_resize(void *data, Evas * e,
|
||||
Evas_Object * obj,
|
||||
void *event_info);
|
||||
static Evas_Object *_e_app_error_dialog_scrolltext_create(Evas * evas,
|
||||
char *title,
|
||||
Ecore_Exe_Event_Data_Line
|
||||
* lines);
|
||||
static void _e_app_error_dialog_save_cb(void *data, void *data2);
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static void _dialog_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static Evas_Object *_scrolltext_create(Evas *evas, char *title, Ecore_Exe_Event_Data_Line *lines);
|
||||
static void _dialog_save_cb(void *data, void *data2);
|
||||
|
||||
EAPI void
|
||||
e_app_error_dialog(E_Container *con, E_App_Autopsy *app)
|
||||
|
@ -39,49 +25,41 @@ e_app_error_dialog(E_Container * con, E_App_Autopsy * app)
|
|||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1); /* This gets freed by e_config_dialog. */
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
if (v)
|
||||
{
|
||||
/* Dialog Methods */
|
||||
v->create_cfdata = _e_app_error_dialog_create_data;
|
||||
v->free_cfdata = _e_app_error_dialog_free_data;
|
||||
v->basic.create_widgets = _e_app_error_dialog_basic_create_widgets;
|
||||
v->advanced.create_widgets =
|
||||
_e_app_error_dialog_advanced_create_widgets;
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->advanced.create_widgets = _advanced_create_widgets;
|
||||
|
||||
/* Create The Dialog */
|
||||
cfd =
|
||||
e_config_dialog_new(con, _("Application Execution Error"), NULL, 0,
|
||||
v, app);
|
||||
cfd = e_config_dialog_new(con, _("Application Execution Error"), NULL, 0, v, app);
|
||||
app->error_dialog = cfd;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_app_error_dialog_fill_data(E_App_Autopsy * app,
|
||||
E_Config_Dialog_Data * cfdata)
|
||||
_fill_data(E_App_Autopsy *app, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
if (!cfdata->label)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), _("%s stopped running unexpectedly."),
|
||||
app->app->name);
|
||||
snprintf(buf, sizeof(buf), _("%s stopped running unexpectedly."), app->app->name);
|
||||
cfdata->label = strdup(buf);
|
||||
}
|
||||
|
||||
if ((app->del.exited) && (!cfdata->exit))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), _("An exit code of %i was returned from %s"),
|
||||
app->del.exit_code, app->app->exe);
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("An exit code of %i was returned from %s"), app->del.exit_code, app->app->exe);
|
||||
cfdata->exit = strdup(buf);
|
||||
}
|
||||
if ((app->del.signalled) && (!cfdata->signal))
|
||||
{
|
||||
if (app->del.exit_signal == SIGINT)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by an Interrupt Signal"),
|
||||
app->app->exe);
|
||||
_("%s was interrupted by an Interrupt Signal"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGQUIT)
|
||||
snprintf(buf, sizeof(buf), _("%s was interrupted by a Quit Signal"),
|
||||
app->app->exe);
|
||||
|
@ -90,26 +68,22 @@ _e_app_error_dialog_fill_data(E_App_Autopsy * app,
|
|||
_("%s was interrupted by an Abort Signal"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGFPE)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by a Floating Point Error"),
|
||||
app->app->exe);
|
||||
_("%s was interrupted by a Floating Point Error"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGKILL)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by an Uninterruptable Kill Signal"),
|
||||
app->app->exe);
|
||||
_("%s was interrupted by an Uninterruptable Kill Signal"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGSEGV)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by a Segmentation Fault"),
|
||||
app->app->exe);
|
||||
_("%s was interrupted by a Segmentation Fault"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGPIPE)
|
||||
snprintf(buf, sizeof(buf), _("%s was interrupted by a Broken Pipe"),
|
||||
app->app->exe);
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by a Broken Pipe"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGTERM)
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by a Termination Singal"),
|
||||
app->app->exe);
|
||||
_("%s was interrupted by a Termination Singal"), app->app->exe);
|
||||
else if (app->del.exit_signal == SIGBUS)
|
||||
snprintf(buf, sizeof(buf), _("%s was interrupted by a Bus Error"),
|
||||
app->app->exe);
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by a Bus Error"), app->app->exe);
|
||||
else
|
||||
snprintf(buf, sizeof(buf),
|
||||
_("%s was interrupted by the signal number %i"),
|
||||
|
@ -139,20 +113,19 @@ _e_app_error_dialog_fill_data(E_App_Autopsy * app,
|
|||
}
|
||||
|
||||
static void *
|
||||
_e_app_error_dialog_create_data(E_Config_Dialog * cfd)
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
E_App_Autopsy *app;
|
||||
|
||||
app = cfd->data;
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
_e_app_error_dialog_fill_data(app, cfdata);
|
||||
_fill_data(app, cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_app_error_dialog_free_data(E_Config_Dialog * cfd,
|
||||
E_Config_Dialog_Data * cfdata)
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_App_Autopsy *app;
|
||||
|
||||
|
@ -178,8 +151,7 @@ _e_app_error_dialog_free_data(E_Config_Dialog * cfd,
|
|||
}
|
||||
|
||||
static void
|
||||
_e_app_error_dialog_resize(void *data, Evas * e, Evas_Object * obj,
|
||||
void *event_info)
|
||||
_dialog_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Coord mw, mh, vw, vh, w, h;
|
||||
|
||||
|
@ -194,8 +166,7 @@ _e_app_error_dialog_resize(void *data, Evas * e, Evas_Object * obj,
|
|||
}
|
||||
|
||||
static Evas_Object *
|
||||
_e_app_error_dialog_scrolltext_create(Evas * evas, char *title,
|
||||
Ecore_Exe_Event_Data_Line * lines)
|
||||
_dialog_scrolltext_create(Evas *evas, char *title, Ecore_Exe_Event_Data_Line *lines)
|
||||
{
|
||||
int i;
|
||||
Evas_Object *obj, *os;
|
||||
|
@ -228,15 +199,14 @@ _e_app_error_dialog_scrolltext_create(Evas * evas, char *title,
|
|||
}
|
||||
|
||||
static Evas_Object *
|
||||
_e_app_error_dialog_basic_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
||||
E_Config_Dialog_Data * cfdata)
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
int error_length = 0;
|
||||
Evas_Object *o, *ob, *os;
|
||||
E_App_Autopsy *app;
|
||||
|
||||
app = cfd->data;
|
||||
_e_app_error_dialog_fill_data(app, cfdata);
|
||||
_fill_data(app, cfdata);
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
|
@ -247,9 +217,7 @@ _e_app_error_dialog_basic_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
|||
error_length = app->error->size;
|
||||
if (error_length)
|
||||
{
|
||||
os =
|
||||
_e_app_error_dialog_scrolltext_create(evas, _("Error Logs"),
|
||||
app->error->lines);
|
||||
os = _dialog_scrolltext_create(evas, _("Error Logs"), app->error->lines);
|
||||
e_widget_list_object_append(o, os, 1, 1, 0.5);
|
||||
}
|
||||
else
|
||||
|
@ -258,17 +226,14 @@ _e_app_error_dialog_basic_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
|||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
}
|
||||
|
||||
ob =
|
||||
e_widget_button_add(evas, _("Save This Message"), "enlightenment/run",
|
||||
_e_app_error_dialog_save_cb, app, cfdata);
|
||||
ob = e_widget_button_add(evas, _("Save This Message"), "enlightenment/run", _dialog_save_cb, app, cfdata);
|
||||
e_widget_list_object_append(o, ob, 0, 0, 0.5);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_e_app_error_dialog_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
||||
E_Config_Dialog_Data * cfdata)
|
||||
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
int read_length = 0;
|
||||
int error_length = 0;
|
||||
|
@ -276,7 +241,7 @@ _e_app_error_dialog_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
|||
E_App_Autopsy *app;
|
||||
|
||||
app = cfd->data;
|
||||
_e_app_error_dialog_fill_data(app, cfdata);
|
||||
_fill_data(app, cfdata);
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
ot = e_widget_table_add(evas, 0);
|
||||
|
@ -305,9 +270,7 @@ _e_app_error_dialog_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
|||
|
||||
if (read_length)
|
||||
{
|
||||
of =
|
||||
_e_app_error_dialog_scrolltext_create(evas, _("Output Data"),
|
||||
app->read->lines);
|
||||
of = _dialog_scrolltext_create(evas, _("Output Data"), app->read->lines);
|
||||
/* FIXME: Add stdout "start". */
|
||||
/* FIXME: Add stdout "end". */
|
||||
}
|
||||
|
@ -323,9 +286,7 @@ _e_app_error_dialog_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
|||
error_length = app->error->size;
|
||||
if (error_length)
|
||||
{
|
||||
of =
|
||||
_e_app_error_dialog_scrolltext_create(evas, _("Error Logs"),
|
||||
app->error->lines);
|
||||
of = _dialog_scrolltext_create(evas, _("Error Logs"), app->error->lines);
|
||||
/* FIXME: Add stderr "start". */
|
||||
/* FIXME: Add stderr "end". */
|
||||
}
|
||||
|
@ -339,16 +300,14 @@ _e_app_error_dialog_advanced_create_widgets(E_Config_Dialog * cfd, Evas * evas,
|
|||
|
||||
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
||||
|
||||
ob =
|
||||
e_widget_button_add(evas, _("Save This Message"), "enlightenment/run",
|
||||
_e_app_error_dialog_save_cb, app, cfdata);
|
||||
ob = e_widget_button_add(evas, _("Save This Message"), "enlightenment/run", _dialog_save_cb, app, cfdata);
|
||||
e_widget_list_object_append(o, ob, 0, 0, 0.5);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_app_error_dialog_save_cb(void *data, void *data2)
|
||||
_dialog_save_cb(void *data, void *data2)
|
||||
{
|
||||
E_App_Autopsy *app;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
@ -362,22 +321,18 @@ _e_app_error_dialog_save_cb(void *data, void *data2)
|
|||
app = data;
|
||||
cfdata = data2;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s.log", e_user_homedir_get(),
|
||||
app->app->name);
|
||||
snprintf(buf, sizeof(buf), "%s/%s.log", e_user_homedir_get(), app->app->name);
|
||||
f = fopen(buf, "w");
|
||||
if (!f)
|
||||
return;
|
||||
if (!f) return;
|
||||
|
||||
if (cfdata->exit)
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "Error Information:\n\t%s\n\n",
|
||||
cfdata->exit);
|
||||
snprintf(buffer, sizeof(buffer), "Error Information:\n\t%s\n\n", cfdata->exit);
|
||||
fwrite(buffer, sizeof(char), strlen(buffer), f);
|
||||
}
|
||||
if (cfdata->signal)
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "Error Signal Information:\n\t%s\n\n",
|
||||
cfdata->signal);
|
||||
snprintf(buffer, sizeof(buffer), "Error Signal Information:\n\t%s\n\n", cfdata->signal);
|
||||
fwrite(buffer, sizeof(char), strlen(buffer), f);
|
||||
}
|
||||
|
||||
|
@ -405,8 +360,7 @@ _e_app_error_dialog_save_cb(void *data, void *data2)
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Output Data:\n\tThere was no output\n\n");
|
||||
snprintf(buffer, sizeof(buffer), "Output Data:\n\tThere was no output\n\n");
|
||||
fwrite(buffer, sizeof(char), strlen(buffer), f);
|
||||
}
|
||||
|
||||
|
@ -436,8 +390,7 @@ _e_app_error_dialog_save_cb(void *data, void *data2)
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"Error Logs:\n\tThere was no error message\n");
|
||||
snprintf(buffer, sizeof(buffer), "Error Logs:\n\tThere was no error message\n");
|
||||
fwrite(buffer, sizeof(char), strlen(buffer), f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue