Nice! :) Please go ahead and remove eektool from svn and add a hint to use execwatch instead :)
2012/7/14 Enlightenment SVN <[email protected]>: > Log: > Now it's possible to show the periodic command output on desktop (example: > http://www.enlightenment.org/ss/e-50015e06d36fb2.76306200.jpg). > > Author: morlenxus > Date: 2012-07-14 05:07:09 -0700 (Sat, 14 Jul 2012) > New Revision: 73854 > Trac: http://trac.enlightenment.org/e/changeset/73854 > > Modified: > trunk/E-MODULES-EXTRA/execwatch/execwatch.edc > trunk/E-MODULES-EXTRA/execwatch/src/e_mod_config.c > trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.c > trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.h > > Modified: trunk/E-MODULES-EXTRA/execwatch/execwatch.edc > =================================================================== > --- trunk/E-MODULES-EXTRA/execwatch/execwatch.edc 2012-07-14 11:15:41 > UTC (rev 73853) > +++ trunk/E-MODULES-EXTRA/execwatch/execwatch.edc 2012-07-14 12:07:09 > UTC (rev 73854) > @@ -13,7 +13,7 @@ > { \ > part \ > { \ > - name: "icon"; \ > + name: "icon_status"; \ > description \ > { \ > state: "default" 0.0; \ > @@ -26,13 +26,22 @@ > } \ > } > > +styles > +{ > + style > + { > + name: "cmd_style"; > + base: "font=Sans:style=Mono font_size=10 text_class=tb_plain > align=left color=#fff style=outline_soft_shadow shadow_color=#00000032 > wrap=word"; > + tag: "br" "\n"; > + } > +} > + > collections > { > group > { > name: "modules/execwatch/main"; > min: 40 40; > - max: 128 128; > parts > { > part > @@ -50,7 +59,7 @@ > } > part > { > - name: "custom_icon"; > + name: "icon_custom"; > type: SWALLOW; > mouse_events: 0; > description > @@ -60,18 +69,24 @@ > } > description > { > - state: "small" 0.0; > - visible: 1; > + state: "display_icon_custom" 0.0; > + visible: 1; > } > + description > + { > + state: "display_command_output" 0.0; > + visible: 0; > + } > } > part > { > - name: "icon"; > + name: "icon_status"; > type: SWALLOW; > mouse_events: 0; > description > { > state: "default" 0.0; > + visible: 1; > aspect_preference: BOTH; > align: 0.0 0.0; > rel1 > @@ -87,7 +102,8 @@ > } > description > { > - state: "small" 0.0; > + state: "display_icon_custom" 0.0; > + visible: 1; > aspect_preference: BOTH; > rel1 > { > @@ -100,10 +116,78 @@ > offset: -1 -1; > } > } > + description > + { > + state: "display_command_output" 0.0; > + visible: 0; > + } > } > part > { > - name: "e.text.display_name"; > + name: "command_output_background"; > + type: RECT; > + mouse_events: 0; > + description > + { > + state: "default" 0.0; > + visible: 0; > + } > + description > + { > + state: "display_command_output" 0.0; > + visible: 1; > + color: 0 0 0 50; > + aspect_preference: BOTH; > + rel1 > + { > + relative: 0.0 0.0; > + offset: 0 0; > + } > + rel2 > + { > + relative: 1.0 1.0; > + offset: -1 -1; > + } > + } > + } > + part > + { > + name: "command_output"; > + type: TEXTBLOCK; > + effect: OUTLINE_SOFT_SHADOW; > + mouse_events: 0; > + description > + { > + state: "default" 0.0; > + visible: 0; > + } > + description > + { > + state: "display_command_output" 0.0; > + visible: 1; > + aspect_preference: BOTH; > + rel1 > + { > + relative: 0.0 0.0; > + offset: 0 0; > + } > + rel2 > + { > + relative: 1.0 1.0; > + offset: -1 -1; > + } > + > + text > + { > + style: "cmd_style"; > + min: 0 1; > + } > + } > + > + } > + part > + { > + name: "display_name"; > type: TEXT; > effect: OUTLINE_SOFT_SHADOW; > mouse_events: 0; > @@ -141,22 +225,37 @@ > { > program > { > - name: "set_icon_small"; > - signal: "e,visibility,small"; > + name: "display_icon_status"; > + signal: "e,visibility,display_icon_status"; > source: "e"; > - action: STATE_SET "small" 0.0; > - target: "icon"; > - target: "custom_icon"; > + action: STATE_SET "default" 0.0; > + target: "icon_status"; > + target: "icon_custom"; > + target: "command_output_background"; > + target: "command_output"; > } > program > { > - name: "set_icon_big"; > - signal: "e,visibility,big"; > + name: "display_icon_custom"; > + signal: "e,visibility,display_icon_custom"; > source: "e"; > - action: STATE_SET "default" 0.0; > - target: "icon"; > - target: "custom_icon"; > + action: STATE_SET "display_icon_custom" 0.0; > + target: "icon_status"; > + target: "icon_custom"; > + target: "command_output_background"; > + target: "command_output"; > } > + program > + { > + name: "display_command_output"; > + signal: "e,visibility,display_cmd_output"; > + source: "e"; > + action: STATE_SET "display_command_output" 0.0; > + target: "icon_status"; > + target: "icon_custom"; > + target: "command_output_background"; > + target: "command_output"; > + } > } > } > > > Modified: trunk/E-MODULES-EXTRA/execwatch/src/e_mod_config.c > =================================================================== > --- trunk/E-MODULES-EXTRA/execwatch/src/e_mod_config.c 2012-07-14 11:15:41 > UTC (rev 73853) > +++ trunk/E-MODULES-EXTRA/execwatch/src/e_mod_config.c 2012-07-14 12:07:09 > UTC (rev 73854) > @@ -3,6 +3,7 @@ > > struct _E_Config_Dialog_Data > { > + int display_mode; > char *display_name; > char *icon_path; > char *status_cmd; > @@ -77,6 +78,7 @@ > cfdata->okstate_exitcode = strdup(buf); > snprintf (buf, sizeof(buf), "%d", ci->okstate_lines); > cfdata->okstate_lines = strdup(buf); > + cfdata->display_mode = ci->display_mode; > cfdata->okstate_mode = ci->okstate_mode; > cfdata->refresh_after_dblclk_cmd = ci->refresh_after_dblclk_cmd; > cfdata->poll_time_hours = ci->poll_time_hours / 3600; > @@ -111,80 +113,96 @@ > static Evas_Object * > _basic_create_widgets(E_Config_Dialog * cfd, Evas * evas, > E_Config_Dialog_Data * cfdata) > { > - Evas_Object *o, *of, *ob; > + Evas_Object *o, *ob, *otb; > E_Radio_Group *rg; > > - o = e_widget_list_add(evas, 0, 0); > + otb = e_widget_toolbook_add(evas, (48 * e_scale), (48 * e_scale)); > > - of = e_widget_frametable_add(evas, "Status Command Settings", 0); > > - ob = e_widget_label_add(evas, "Status Command"); > - e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0); > + o = e_widget_table_add(evas, 0); > + > + ob = e_widget_label_add(evas, D_("Command")); > + e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 0, 1, 0); > ob = e_widget_entry_add(evas, &cfdata->status_cmd, NULL, NULL, NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 0, 1, 1, 1, 0, 1, 0); > + ob = e_widget_label_add(evas, D_("(Example: ping -c 5 127.0.0.1)")); > + e_widget_table_object_append(o, ob, 1, 1, 2, 1, 1, 0, 1, 0); > > - ob = e_widget_label_add(evas, "(Example: ping -c 5 127.0.0.1)"); > - e_widget_frametable_object_append(of, ob, 1, 1, 2, 1, 1, 0, 1, 0); > + ob = e_widget_label_add(evas, D_("Poll Time")); > + e_widget_table_object_append(o, ob, 0, 2, 2, 1, 1, 0, 1, 0); > + ob = e_widget_slider_add(evas, 1, 0, D_("%2.0f hours"), 0.0, 24.0, 1.0, 0, > + &(cfdata->poll_time_hours), NULL, 40); > + e_widget_table_object_append(o, ob, 1, 2, 2, 1, 1, 0, 1, 0); > + ob = e_widget_slider_add(evas, 1, 0, D_("%2.0f mins"), 0.0, 59.0, 1.0, 0, > + &(cfdata->poll_time_mins), NULL, 40); > + e_widget_table_object_append(o, ob, 1, 3, 2, 1, 1, 0, 1, 0); > + ob = e_widget_slider_add(evas, 1, 0, D_("%2.0f secs"), 0.0, 59.0, 1.0, 0, > + &(cfdata->poll_time_secs), NULL, 40); > + e_widget_table_object_append(o, ob, 1, 4, 2, 1, 1, 0, 1, 0); > > - rg = e_widget_radio_group_new (&(cfdata->okstate_mode)); > - ob = e_widget_radio_add (evas, "Expected Exitcode", 0, rg); > - e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0); > - ob = e_widget_entry_add(evas, &cfdata->okstate_exitcode, NULL, NULL, > NULL); > + ob = e_widget_label_add(evas, D_("Doubleclick Command")); > + e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0); > + ob = e_widget_entry_add(evas, &cfdata->dblclk_cmd, NULL, NULL, NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 5, 1, 1, 1, 0, 1, 0); > + ob = e_widget_check_add(evas, D_("Refresh after Execution"), > &(cfdata->refresh_after_dblclk_cmd)); > + e_widget_table_object_append(o, ob, 1, 6, 1, 1, 1, 0, 1, 0); > > - ob = e_widget_radio_add (evas, "Expected String", 1, rg); > - e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 1, 0, 1, 0); > - ob = e_widget_entry_add(evas, &cfdata->okstate_string, NULL, NULL, NULL); > + e_widget_toolbook_page_append(otb, NULL, D_("Command"), o, 1, 0, 1, 0, > 0.5, 0.0); > + > + > + o = e_widget_table_add(evas, 0); > + > + ob = e_widget_label_add(evas, D_("Title")); > + e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 0, 1, 0); > + ob = e_widget_entry_add(evas, &cfdata->display_name, NULL, NULL, NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 3, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 0, 1, 1, 1, 0, 1, 0); > > - ob = e_widget_radio_add (evas, "Expected Lines", 2, rg); > - e_widget_frametable_object_append(of, ob, 0, 4, 1, 1, 1, 0, 1, 0); > - ob = e_widget_entry_add(evas, &cfdata->okstate_lines, NULL, NULL, NULL); > + ob = e_widget_label_add(evas, D_("Mode")); > + e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0); > + rg = e_widget_radio_group_new (&(cfdata->display_mode)); > + ob = e_widget_radio_add (evas, D_("Evaluate Command Result"), 0, rg); > + e_widget_table_object_append(o, ob, 1, 1, 1, 1, 1, 0, 1, 0); > + ob = e_widget_radio_add (evas, D_("Show Command Output"), 1, rg); > + e_widget_table_object_append(o, ob, 1, 2, 1, 1, 1, 0, 1, 0); > + > + ob = e_widget_label_add(evas, D_("Custom Icon")); > + e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0); > + ob = e_widget_entry_add(evas, &cfdata->icon_path, NULL, NULL, NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 4, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 3, 1, 1, 1, 0, 1, 0); > > - ob = e_widget_label_add(evas, "Poll Time"); > - e_widget_frametable_object_append(of, ob, 0, 5, 2, 1, 1, 0, 1, 0); > - ob = e_widget_slider_add(evas, 1, 0, "%2.0f hours", 0.0, 24.0, 1.0, 0, > - &(cfdata->poll_time_hours), NULL, 40); > - e_widget_frametable_object_append(of, ob, 1, 5, 2, 1, 1, 0, 1, 0); > - ob = e_widget_slider_add(evas, 1, 0, "%2.0f mins", 0.0, 59.0, 1.0, 0, > - &(cfdata->poll_time_mins), NULL, 40); > - e_widget_frametable_object_append(of, ob, 1, 6, 2, 1, 1, 0, 1, 0); > - ob = e_widget_slider_add(evas, 1, 0, "%2.0f secs", 0.0, 59.0, 1.0, 0, > - &(cfdata->poll_time_secs), NULL, 40); > - e_widget_frametable_object_append(of, ob, 1, 7, 2, 1, 1, 0, 1, 0); > + e_widget_toolbook_page_append(otb, NULL, D_("Display"), o, 1, 0, 1, 0, > 0.5, 0.0); > > - e_widget_list_object_append(o, of, 1, 1, 0.5); > - of = e_widget_frametable_add(evas, "Icon Settings", 0); > > - ob = e_widget_label_add(evas, "Display Name"); > - e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0); > - ob = e_widget_entry_add(evas, &cfdata->display_name, NULL, NULL, NULL); > + o = e_widget_table_add(evas, 0); > + > + rg = e_widget_radio_group_new (&(cfdata->okstate_mode)); > + ob = e_widget_radio_add (evas, D_("Expected Exitcode"), 0, rg); > + e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 0, 1, 0); > + ob = e_widget_entry_add(evas, &cfdata->okstate_exitcode, NULL, NULL, > NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 0, 1, 1, 1, 0, 1, 0); > > - ob = e_widget_label_add(evas, "Icon Path"); > - e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0); > - ob = e_widget_entry_add(evas, &cfdata->icon_path, NULL, NULL, NULL); > + ob = e_widget_radio_add (evas, D_("Expected String"), 1, rg); > + e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0); > + ob = e_widget_entry_add(evas, &cfdata->okstate_string, NULL, NULL, NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 1, 1, 1, 1, 0, 1, 0); > > - ob = e_widget_label_add(evas, "Doubleclick Command"); > - e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0); > - ob = e_widget_entry_add(evas, &cfdata->dblclk_cmd, NULL, NULL, NULL); > + ob = e_widget_radio_add (evas, D_("Expected Lines"), 2, rg); > + e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0); > + ob = e_widget_entry_add(evas, &cfdata->okstate_lines, NULL, NULL, NULL); > e_widget_size_min_set(ob, 150, 1); > - e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 0, 1, 0); > + e_widget_table_object_append(o, ob, 1, 2, 1, 1, 1, 0, 1, 0); > > - ob = e_widget_check_add(evas, "Refresh after Command", > &(cfdata->refresh_after_dblclk_cmd)); > - e_widget_frametable_object_append(of, ob, 1, 3, 1, 1, 1, 0, 1, 0); > + e_widget_toolbook_page_append(otb, NULL, D_("Evaluation"), o, 1, 0, 1, 0, > 0.5, 0.0); > > - e_widget_list_object_append(o, of, 1, 1, 0.5); > > - return o; > + e_widget_toolbook_page_show(otb, 0); > + return otb; > } > > static int > @@ -222,6 +240,7 @@ > ci->okstate_exitcode = atoi (cfdata->okstate_exitcode); > if (strlen(cfdata->okstate_lines)) > ci->okstate_lines = atoi (cfdata->okstate_lines); > + ci->display_mode = cfdata->display_mode; > ci->okstate_mode = cfdata->okstate_mode; > ci->refresh_after_dblclk_cmd = cfdata->refresh_after_dblclk_cmd; > ci->poll_time_hours = cfdata->poll_time_hours * 3600; > > Modified: trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.c > =================================================================== > --- trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.c 2012-07-14 11:15:41 > UTC (rev 73853) > +++ trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.c 2012-07-14 12:07:09 > UTC (rev 73854) > @@ -20,6 +20,8 @@ > > Config_Item *ci; > E_Gadcon_Popup *popup; > + > + char *status_exe_result; > }; > > struct _Execwatch > @@ -37,7 +39,7 @@ > static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas > *evas); > static const char *_gc_id_new(E_Gadcon_Client_Class *client_class); > static Config_Item *_config_item_get(const char *id); > -static void _execwatch_icon(Instance *inst, char *icon); > +static void _execwatch_display(Instance *inst, char *icon); > static Eina_Bool _execwatch_status_cmd_exec(void *data); > static int _execwatch_status_cmd_exit(void *data, int type, void *event); > static void _execwatch_popup_content_create(Instance *inst); > @@ -103,7 +105,7 @@ > _cb_mouse_down, inst); > > if (inst->ci->display_name) > - edje_object_part_text_set(execwatch->execwatch_obj, > "e.text.display_name", > + edje_object_part_text_set(execwatch->execwatch_obj, "display_name", > inst->ci->display_name); > if (inst->ci->status_cmd && strlen(inst->ci->status_cmd) && > (inst->ci->poll_time_hours || inst->ci->poll_time_mins || > inst->ci->poll_time_secs)) > @@ -113,7 +115,7 @@ > _execwatch_status_cmd_exec(inst); > } > else > - _execwatch_icon(inst, "cmd_edit"); > + _execwatch_display(inst, "cmd_edit"); > > return gcc; > } > @@ -212,6 +214,7 @@ > > ci = E_NEW(Config_Item, 1); > ci->id = eina_stringshare_add(id); > + ci->display_mode = 0; // default: show icon > ci->display_name = eina_stringshare_add("Edit!"); > ci->icon_path = eina_stringshare_add(""); > ci->status_cmd = eina_stringshare_add(""); > @@ -222,18 +225,134 @@ > ci->okstate_lines = 0; > ci->refresh_after_dblclk_cmd = 0; > ci->poll_time_hours = 0.0; > - ci->poll_time_mins = 0.0; > + ci->poll_time_mins = 1.0; > ci->poll_time_secs = 0.0; > > execwatch_config->items = eina_list_append(execwatch_config->items, ci); > return ci; > } > > +static void > +_execwatch_cmd_output_prepare(Instance *inst) > +{ > + char *d; > + const char *p; > + int textlen=0; > + > + if (!inst) return; > + if (inst->status_exe_result) > + E_FREE(inst->status_exe_result); > + if (inst->read && inst->read->lines) > + { > + Ecore_Exe_Event_Data_Line *lines; > + int i=0; > + > + lines = inst->read->lines; > + for (i=0; lines[i].line; i++) > + { > + if (inst->ci->display_mode) > + { > + if (i > 0) > + textlen += 4; // <br> > + /* replace special stringparts > + * '\t' -> " " > + * '<' -> "<" > + * '>' -> ">" > + * '&' -> "&" > + */ > + for (p = lines[i].line; *p != 0; p++) > + { > + if (*p == '\t') textlen += 4; // ' ' > + else if (*p == '<') textlen += 4; // '<' > + else if (*p == '>') textlen += 4; // '>' > + else if (*p == '&') textlen += 5; // '&' > + else textlen++; > + } > + } > + else > + { > + if (i > 0) > + textlen += lines[i].size + 1; // \n > + else > + textlen += lines[i].size; > + } > + } > + textlen++; // \0 > + > + inst->status_exe_result = calloc(1, textlen); > + if (!inst->status_exe_result) return; > + > + inst->status_exe_result[0] = '\0'; > + d = inst->status_exe_result; > + for (i = 0; lines[i].line; i++) > + { > + if (inst->ci->display_mode) > + { > + if (i > 0) > + { > + strcpy(d, "<br>"); > + d += 4; > + } > + for (p = lines[i].line; *p != 0; p++) > + { > + if (*p == '\t') > + { > + strcpy(d, " "); > + d += 4; > + } > + else if (*p == '<') > + { > + strcpy(d, "<"); > + d += 4; > + } > + else if (*p == '>') > + { > + strcpy(d, ">"); > + d += 4; > + } > + else if (*p == '&') > + { > + strcpy(d, "&"); > + d += 5; > + } > + else > + { > + *d = *p; > + d++; > + } > + } > + } > + else > + { > + if (i > 0) > + strcat(inst->status_exe_result, "\n"); > + strcat(inst->status_exe_result, lines[i].line); > + } > + } > + } > + else > + { > + char *nodata_text = D_("--- no data received ---"); > + > + textlen = strlen (nodata_text); > + textlen++; // \0 > + > + inst->status_exe_result = calloc(1, textlen); > + if (!inst->status_exe_result) return; > + inst->status_exe_result[0] = '\0'; > + strcat(inst->status_exe_result, nodata_text); > + } > + > + inst->status_exe_result[textlen] = '\0'; > + edje_object_part_text_set(inst->execwatch->execwatch_obj, > "command_output", inst->status_exe_result); > +} > + > static void > -_execwatch_icon(Instance *inst, char *icon) > +_execwatch_display(Instance *inst, char *icon) > { > Execwatch *execwatch; > char m[4096], buf[4096]; > + char *text; > > if (!inst) return; > execwatch = inst->execwatch; > @@ -243,18 +362,22 @@ > snprintf (buf, sizeof(buf), "modules/execwatch/icons/%s", icon); > if (!e_theme_edje_object_set(execwatch->icon_obj, > "base/theme/modules/execwatch/icons", buf)) > - edje_object_file_set(execwatch->icon_obj, m, buf); > - edje_object_part_swallow(execwatch->execwatch_obj, "icon", > execwatch->icon_obj); > + edje_object_file_set(execwatch->icon_obj, m, buf); > + edje_object_part_swallow(execwatch->execwatch_obj, "icon_status", > execwatch->icon_obj); > > - if (inst->ci->icon_path && ecore_file_exists(inst->ci->icon_path)) > + if (inst->ci->display_mode) > { > - e_icon_file_set(execwatch->icon_custom_obj, inst->ci->icon_path); > - edje_object_part_swallow(execwatch->execwatch_obj, "custom_icon", > execwatch->icon_custom_obj); > - > edje_object_signal_emit(execwatch->execwatch_obj,"e,visibility,small","e"); > + > edje_object_signal_emit(execwatch->execwatch_obj,"e,visibility,display_cmd_output","e"); > } > + else if (inst->ci->icon_path && ecore_file_exists(inst->ci->icon_path)) > + { > + e_icon_file_set(execwatch->icon_custom_obj, inst->ci->icon_path); > + edje_object_part_swallow(execwatch->execwatch_obj, "icon_custom", > execwatch->icon_custom_obj); > + > edje_object_signal_emit(execwatch->execwatch_obj,"e,visibility,display_icon_custom","e"); > + } > else > { > - > edje_object_signal_emit(execwatch->execwatch_obj,"e,visibility,big","e"); > + > edje_object_signal_emit(execwatch->execwatch_obj,"e,visibility,display_icon_status","e"); > } > } > > @@ -271,7 +394,7 @@ > if (inst->status_exe) return EINA_TRUE; > if (!inst->ci->status_cmd || !strlen(inst->ci->status_cmd)) return > EINA_TRUE; > > - _execwatch_icon(inst, "cmd_exec"); > + _execwatch_display(inst, "cmd_exec"); > inst->status_exe = ecore_exe_pipe_run(inst->ci->status_cmd, > ECORE_EXE_PIPE_AUTO | ECORE_EXE_PIPE_READ | > ECORE_EXE_PIPE_ERROR | > ECORE_EXE_PIPE_READ_LINE_BUFFERED | > ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, > @@ -299,46 +422,50 @@ > > if (!strcmp(ecore_exe_tag_get(ev->exe), STATUS_EXE_TAG)) > { > + _execwatch_cmd_output_prepare(inst); > + > inst->read = ecore_exe_event_data_get(ev->exe, ECORE_EXE_PIPE_READ); > inst->status_exe = NULL; > > if (!inst->ci->okstate_mode) > { > + // check exitcode > if (ev->exit_code == inst->ci->okstate_exitcode) > - _execwatch_icon(inst, "cmd_ok"); > + _execwatch_display(inst, "cmd_ok"); > else > - _execwatch_icon(inst, "cmd_error"); > + _execwatch_display(inst, "cmd_error"); > } > - else > - { > - if (inst->read && inst->read->lines) > - { > - int icon_set = 0; > + else if (inst->read && inst->read->lines) > + { > + int icon_set = 0; > > - lines = inst->read->lines; > - for (i = 0; lines[i].line; i++) > - { > - if (inst->ci->okstate_mode == 1) > - { > - if (strstr(lines[i].line, > inst->ci->okstate_string)) > - { > - _execwatch_icon(inst, "cmd_ok"); > - icon_set = 1; > - break; > - } > - } > - } > - if (inst->ci->okstate_mode == 2) > - if (i == inst->ci->okstate_lines) > - { > - _execwatch_icon(inst, "cmd_ok"); > - icon_set = 1; > - } > - if (!icon_set) _execwatch_icon(inst, "cmd_error"); > - } > - else > - _execwatch_icon(inst, "cmd_error"); > - } > + lines = inst->read->lines; > + for (i = 0; lines[i].line; i++) > + { > + if (inst->ci->okstate_mode == 1) > + { > + // check lines and compare with string > + if (strstr(lines[i].line, inst->ci->okstate_string)) > + { > + _execwatch_display(inst, "cmd_ok"); > + icon_set = 1; > + break; > + } > + } > + else if (inst->ci->okstate_mode == 2) > + { > + // check number of returned lines > + if (i == inst->ci->okstate_lines) > + { > + _execwatch_display(inst, "cmd_ok"); > + icon_set = 1; > + } > + } > + if (!icon_set) _execwatch_display(inst, "cmd_error"); > + } > + } > + else > + _execwatch_display(inst, "cmd_error"); > > if (inst->popup) > { > @@ -376,30 +503,7 @@ > > if (!inst->ci->status_cmd || !strlen(inst->ci->status_cmd)) return; > > - if (inst->read && inst->read->lines) > - { > - lines = inst->read->lines; > - for (i = 0; lines[i].line; i++) > - textlen += lines[i].size + 1; > - text = alloca(textlen + 1); > - if (!text) return; > - > - text[0] = '\0'; > - for (i = 0; lines[i].line; i++) > - { > - strcat(text, lines[i].line); > - strcat(text, "\n"); > - } > - } > - else > - { > - textlen = 32; > - text = alloca(textlen); > - if (!text) return; > - snprintf(text, textlen, "--- no data received ---\n"); > - } > - > - if (inst->popup) _execwatch_popup_destroy(inst); > + if (inst->popup) _execwatch_popup_destroy(inst); // FIXME: reopen > popup after content recreation > inst->popup = e_gadcon_popup_new(inst->gcc); > > current_time = time (NULL); > @@ -412,7 +516,8 @@ > > inst->ci->display_name); > of = e_widget_framelist_add (evas, buf, 0); > ob = e_widget_textblock_add(evas); > - e_widget_textblock_plain_set(ob, text); > + if (inst->status_exe_result) > + e_widget_textblock_plain_set(ob, inst->status_exe_result); > e_widget_size_min_set(ob, 240, 120); > e_widget_framelist_object_append(of, ob); > e_widget_list_object_append(o, of, 1, 1, 0.5); > @@ -441,7 +546,8 @@ > > if (!(inst = data)) return; > > - e_gadcon_popup_show(inst->popup); > + if (!inst->ci->display_mode) > + e_gadcon_popup_show(inst->popup); > } > > static void > @@ -551,7 +657,7 @@ > if (inst->poll_timer) ecore_timer_del(inst->poll_timer); > if (inst->status_exe) ecore_exe_terminate (inst->status_exe); > if (inst->ci->display_name) > - edje_object_part_text_set(inst->execwatch->execwatch_obj, > "e.text.display_name", > + edje_object_part_text_set(inst->execwatch->execwatch_obj, > "display_name", > inst->ci->display_name); > inst->poll_timer = ecore_timer_add((inst->ci->poll_time_hours + > inst->ci->poll_time_mins + inst->ci->poll_time_secs), > _execwatch_status_cmd_exec, inst); > @@ -574,6 +680,7 @@ > #define T Config_Item > #undef D > #define D conf_item_edd > + E_CONFIG_VAL(D, T, display_mode, INT); > E_CONFIG_VAL(D, T, id, STR); > E_CONFIG_VAL(D, T, display_name, STR); > E_CONFIG_VAL(D, T, icon_path, STR); > @@ -602,6 +709,7 @@ > execwatch_config = E_NEW(Config, 1); > ci = E_NEW(Config_Item, 1); > ci->id = eina_stringshare_add("0"); > + ci->display_mode = 0; // default: show icon > ci->display_name = eina_stringshare_add("Edit!"); > ci->icon_path = eina_stringshare_add(""); > ci->status_cmd = eina_stringshare_add(""); > @@ -612,7 +720,7 @@ > ci->okstate_lines = 0; > ci->refresh_after_dblclk_cmd = 0; > ci->poll_time_hours = 0.0; > - ci->poll_time_mins = 0.0; > + ci->poll_time_mins = 1.0; > ci->poll_time_secs = 0.0; > > execwatch_config->items = eina_list_append(execwatch_config->items, > ci); > > Modified: trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.h > =================================================================== > --- trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.h 2012-07-14 11:15:41 > UTC (rev 73853) > +++ trunk/E-MODULES-EXTRA/execwatch/src/e_mod_main.h 2012-07-14 12:07:09 > UTC (rev 73854) > @@ -27,6 +27,7 @@ > { > const char *id; > > + int display_mode; > const char *display_name; > const char *icon_path; > const char *status_cmd; > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > enlightenment-svn mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn -- Leif ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
