int
alarm_alarm_ring(Alarm *al, int test)
{
   char buf[4096];
   int ret = 1;

   alarm_config->alarms_state = ALARM_STATE_RINGING;
   if (!test)
     al->state = ALARM_STATE_RINGING;
   alarm_config->alarms_ringing_nb++;
   alarm_edje_signal_emit(EDJE_SIG_SEND_ALARM_RING_START);

   // TODO: real popups
   if (al->open_popup)
     {
        snprintf(buf, sizeof(buf),
                 D_("<hilight>Alarm : %s</hilight><br><br>"
                    "%s"),
                 al->name, (al->description) ? al->description : "" );
        e_module_dialog_show(alarm_config->module, D_("Alarm Module Popup"), buf);
     }

   if (al->run_program != ALARM_RUN_PROGRAM_NO)
     {
        Ecore_Exe *exe;
        
        if (al->run_program == ALARM_RUN_PROGRAM_PARENT)
          {
             exe = ecore_exe_pipe_run(alarm_config->alarms_program_default,
                                      ECORE_EXE_USE_SH, NULL);
          }
        else
          {
             exe = ecore_exe_pipe_run(al->program,
                                      ECORE_EXE_USE_SH, NULL);
          }

        if (exe > 0)
          ecore_exe_free(exe);
        else
          {
             snprintf(buf, sizeof(buf),
                      D_("<hilight>Failed !</hilight><br><br>"
                         "Alarm couln't launch the program you specified"));
             e_module_dialog_show(alarm_config->module, D_("Alarm Module Error"), buf);
             ret = 0;
          }
     }

   _alarm_check_date(al, 0);

   if (alarm_config->alarms_details)
     alarm_edje_refresh_details();

   e_config_save_queue();

   return ret;
}
Example #2
0
Eina_Bool
alert_command_run(void *data)
{
   Module_Alert_Command *mac = data;

#define _EV(_a, _b, _c, _d) _a = ecore_event_handler_add(ECORE_EXE_EVENT_##_b, _c, _d)
   _EV(mac->ev.data, DATA, _alert_command_data, mac);
   EINA_SAFETY_ON_NULL_RETURN_VAL(mac->ev.data, EINA_TRUE);

   _EV(mac->ev.del, DEL, _alert_command_del, mac);
   EINA_SAFETY_ON_NULL_GOTO(mac->ev.del, del_data);

   _EV(mac->ev.error, ERROR, _alert_command_error, mac);
   EINA_SAFETY_ON_NULL_GOTO(mac->ev.error, del_del);
#undef _EV

   mac->buf = eina_strbuf_new();
   EINA_SAFETY_ON_NULL_GOTO(mac->buf, del_error);

   mac->exe = ecore_exe_pipe_run(mac->command->command, ECORE_EXE_PIPE_READ, mac);
   EINA_SAFETY_ON_NULL_GOTO(mac->exe, free_buf);
   ecore_exe_data_set(mac->exe, mac);

   return EINA_TRUE;

free_buf:
   eina_strbuf_free(mac->buf);
del_error:
   ecore_event_handler_del(mac->ev.error);
del_del:
   ecore_event_handler_del(mac->ev.del);
del_data:
   ecore_event_handler_del(mac->ev.data);
   return EINA_TRUE;
}
Example #3
0
EOLIAN static Eo_Base *
_emerite_eo_base_constructor(Eo *obj, Emerite_Data *pd)
{
    Eina_Bool chk;
    char exe[PATH_MAX];
    const char exe_name[] = "emerite";

    obj = eo_constructor(eo_super(obj, MY_CLASS));

    if (email_in_tree_is())
    {
        snprintf(exe, sizeof(exe), "%s/emerite/%s", BUILD_BIN_DIR, exe_name);
    }
    else
    {
        snprintf(exe, sizeof(exe), "%s", exe_name);
    }
    exe[sizeof(exe) - 1] = '\0';

    pd->exe = ecore_exe_pipe_run(exe, ECORE_EXE_TERM_WITH_PARENT, pd);
    if (EINA_UNLIKELY(!pd->exe))
    {
        EINA_LOG_CRIT("Failed to create Ecore_Exe");
        return NULL; // FIXME leak
    }

    chk = email_subprocess_callback_register(pd->exe, ECORE_EXE_EVENT_DEL,
            _exe_del_cb, obj);
    if (EINA_UNLIKELY(!chk))
    {
        EINA_LOG_CRIT("Failed to register deletion callback");
        return NULL; // FIXME leak
    }
    return obj;
}
Example #4
0
EAPI Ecore_Exe *
ecore_exe_run(const char *exe_cmd,
              const void *data)
{
   EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
   return ecore_exe_pipe_run(exe_cmd, 0, data);
}
Example #5
0
/**
 * Module specific face initialisation.
 *
 * It is called when a new face is created.
 * Currently E_Gadget creates one when you call e_gadget_new(),
 * but doesn't let you create more faces.  I'm hoping to get
 * changed.
 *
 * @param   data the pointer you passed to e_gadget_new().
 * @param   face a pointer to your E_Gadget_Face.
 * @ingroup Emu_Module_Gadget_Group
 */
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
   E_Gadcon_Client *gcc = NULL;
   Emu_Face *emu_face;
   
   emu_face = E_NEW(Emu_Face, 1);

   if (emu_face)
     {
        Evas_Object *o;
        char buf[4096];

        o = edje_object_add(gc->evas);
        if ((!e_theme_edje_object_set(o, "base/theme/modules/emu", "modules/emu/main")) /*&& (_emu_module_edje)*/)
           edje_object_file_set(o, _emu_module_edje, "modules/emu/main");
        edje_object_signal_emit(o, "passive", "");

        gcc = e_gadcon_client_new(gc, name, id, style, o);
        gcc->data = emu_face;
        emu_face->gcc = gcc;
        emu_face->o_button = o;
        emu_face->menus = NULL;

        emu_face->name = eina_stringshare_add("Emu tester");
        snprintf(buf, sizeof(buf), "%s/bin/emu_client", e_module_dir_get(emu_module));
        emu_face->command = eina_stringshare_add(buf);
        if (emu_face->command)
          {
             emu_face->del = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _emu_cb_exe_del, emu_face);
             emu_face->add = ecore_event_handler_add(ECORE_EXE_EVENT_ADD, _emu_cb_exe_add, emu_face);
             emu_face->read = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _emu_cb_exe_data, emu_face);
             emu_face->exe =
                ecore_exe_pipe_run(emu_face->command, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ_LINE_BUFFERED
                                   /*| ECORE_EXE_RESPAWN */ , emu_face);
             if (!emu_face->exe)
                e_module_dialog_show(NULL, D_("Enlightenment Emu Module - error"), D_("There is no emu."));
          }

        e_gadcon_client_util_menu_attach(gcc);
        evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _emu_face_cb_mouse_down, emu_face);
     }
   
   return gcc;
}
Example #6
0
static void
_wkb_ibus_query_address(void)
{
   unsigned int flags = ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_READ_LINE_BUFFERED;
   Ecore_Exe *ibus_exe = NULL;

   if (wkb_ibus->address_pending)
      return;

   INF("Querying IBus address with '%s' command", IBUS_ADDRESS_CMD);

   if (!(ibus_exe = ecore_exe_pipe_run(IBUS_ADDRESS_CMD, flags, NULL)))
     {
        ERR("Error spawning '%s' command", IBUS_ADDRESS_CMD);
        return;
     }

   wkb_ibus->address_pending = EINA_TRUE;
}
Example #7
0
EAPI Ecore_Exe *
ecore_exe_run(const char *exe_cmd,
              const void *data)
{
   return ecore_exe_pipe_run(exe_cmd, 0, data);
}
Command_Service *
_command_service_new(Module_Services *services,
                     const char *jid,
                     const char *cmd,
                     const char *service)
{
   Command_Service *cs;
   const char *s;

   DBG("services[%p] jid[%s] cmd[%s] service[%s]",
       services, jid, cmd, service);

   cs = calloc(1, sizeof(Command_Service));
   EINA_SAFETY_ON_NULL_RETURN_VAL(cs, NULL);

   cs->services = services;

   cs->jid = strdup(jid);
   EINA_SAFETY_ON_NULL_GOTO(cs->jid, free_cs);

   cs->buf = eina_strbuf_new();
   EINA_SAFETY_ON_NULL_GOTO(cs->buf, free_jid);

#define _EV(_a, _b, _c, _d) _a = ecore_event_handler_add(ECORE_EXE_EVENT_##_b, _c, _d)
   _EV(cs->ev.data, DATA, _command_data, cs);
   EINA_SAFETY_ON_NULL_GOTO(cs->ev.data, free_buf);

   _EV(cs->ev.del, DEL, _command_del, cs);
   EINA_SAFETY_ON_NULL_GOTO(cs->ev.del, del_data);

   _EV(cs->ev.error, ERROR, _command_error, cs);
   EINA_SAFETY_ON_NULL_GOTO(cs->ev.error, del_del);
#undef _EV

   s = utils_strdupf(cmd, service);
   EINA_SAFETY_ON_NULL_GOTO(s, del_error);

   DBG("Running command [%s]", s);

   cs->exe = ecore_exe_pipe_run(s, ECORE_EXE_PIPE_READ, cs);
   EINA_SAFETY_ON_NULL_GOTO(cs->exe, free_s);

   ecore_exe_data_set(cs->exe, cs);
   free((char *)s);
   return cs;

free_s:
   free((char *)s);
del_error:
   ecore_event_handler_del(cs->ev.error);
del_del:
   ecore_event_handler_del(cs->ev.del);
del_data:
   ecore_event_handler_del(cs->ev.data);
free_buf:
   eina_strbuf_free(cs->buf);
free_jid:
   free((char *)cs->jid);
free_cs:
   free(cs);
   return NULL;
}