Esempio n. 1
0
int
main()
{
   Ecore_Con_Server *svr;
   eina_init();
   ecore_init();
   ecore_con_init();

/* comment if not using gnutls */
   gnutls_global_set_log_level(9);
   gnutls_global_set_log_function(tls_log_func);

/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */
   if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL)))
/* to use simple tcp with ssl/tls, use this line */
//   if (!ecore_con_server_add(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_SSL3, "127.0.0.1", 8080, NULL))
     exit(1);

   ecore_con_ssl_server_cert_add(svr, "server.pem");
   ecore_con_ssl_server_privkey_add(svr, "server.pem");
/* set event handler for client connect */
   ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL);
/* set event handler for client disconnect */
   ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL);
/* set event handler for receiving client data */
   ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb)_data, NULL);

/* start server */
   ecore_main_loop_begin();
}
static void * document_create(Eon_Document *d, const char *options)
{
	Ecore_Ipc_Server *srv;

	printf("[REMOTE] Initializing engine\n");

	ecore_init();
	ecore_ipc_init();
	srv = ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, "eon-remote", 0, NULL);
	if (!srv)
	{
		/* FIXME add a good way to tell the system that the creation
		 * failed
		 */
		exit(1);
	}
	rdoc = calloc(1, sizeof(Engine_Remote_Document));
	ekeko_event_listener_add(d, EON_DOCUMENT_OBJECT_NEW, _object_new_cb, EINA_FALSE, NULL);

	ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD,
		handler_server_add, NULL);
	ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL,
		handler_server_del, NULL);
	ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA,
		handler_server_data, NULL);

	rdoc->srv = srv;
	return rdoc;
}
Esempio n. 3
0
static void _init(EWeather *eweather)
{
   Instance *inst = calloc(1, sizeof(Instance));
   eweather->plugin.data = inst;
   inst->weather = eweather;
   inst->host = eina_stringshare_add("www.google.com");

   printf("INIT %d\n",ecore_con_init());

   inst->add_handler =
      ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
	    _server_add, inst);
   inst->del_handler =
      ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL,
	    _server_del, inst);
   inst->err_handler =
      ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ERROR,
	    _server_error, inst);
   inst->data_handler =
      ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
	    _server_data, inst);

   inst->check_timer =
      ecore_timer_add(0, _weather_cb_check, inst);
}
AVReceiver::AVReceiver(Params &p, int default_port, int _connection_type):
    ref_count(0),
    params(p),
    econ(NULL),
    timer_con(NULL),
    isConnected(false),
    volume_main(0),
    volume_zone2(0),
    volume_zone3(0),
    power_main(false),
    power_zone2(false),
    power_zone3(false),
    source_main(0),
    source_zone2(0),
    source_zone3(0),
    connection_type(_connection_type)
{
    cDebugDom("output") << params["id"];

    if (!params.Exists("visible")) params.Add("visible", "false");

    host = params["host"];
    port = default_port;

    if (params.Exists("port"))
        from_string(params["port"], port);

    ehandler_add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_con_server_add, this);
    ehandler_del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb)_con_server_del, this);
    ehandler_data = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb)_con_server_data, this);

    timerConnReconnect();
    timer_con = new EcoreTimer(AVR_RECONNECT, (sigc::slot<void>)sigc::mem_fun(*this, &AVReceiver::timerConnReconnect));
}
int
main(int argc, char **argv)
{

    ecore_dbus_init();
    svr = ecore_dbus_server_system_connect(NULL);
    if (!svr)
    {
        printf("Couldn't connect to dbus system server!\n");
    }
    else
    {
        int i = 0;
        Ecore_Event_Handler *handler[3];

        printf("Connected!\n");

        handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_ADD,
                                               ecore_dbus_event_server_add, NULL);
        handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_DEL,
                                               ecore_dbus_event_server_del, NULL);
        handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SIGNAL,
                                               ecore_dbus_event_server_signal, NULL);

        ecore_main_loop_begin();

        for (i = 0; i < 3; i++)
            ecore_event_handler_del(handler[i]);

        if (svr) ecore_dbus_server_del(svr);
    }
    ecore_dbus_shutdown();
    return 0;
}
Esempio n. 6
0
static void
_backlight_input_win_new(Instance *inst)
{
   Ecore_X_Window_Configure_Mask mask;
   Ecore_X_Window w, popup_w;
   E_Manager *man;
   
   man = inst->gcc->gadcon->zone->container->manager;
   
   w = ecore_x_window_input_new(man->root, 0, 0, man->w, man->h);
   mask = (ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE |
           ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING);
   popup_w = inst->popup->win->evas_win;
   ecore_x_window_configure(w, mask, 0, 0, 0, 0, 0, popup_w,
                            ECORE_X_WINDOW_STACK_BELOW);
   ecore_x_window_show(w);
   
   inst->hand_mouse_down =
      ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
                              _backlight_input_win_mouse_down_cb, inst);
   inst->hand_key_down =
      ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
                              _backlight_input_win_key_down_cb, inst);
   inst->input_win = w;
   e_grabinput_get(0, 0, inst->input_win);
}
Esempio n. 7
0
void
ipc_init(void)
{
   char *file = NULL;
   Ecore_Fd_Handler *fdh;
   
   file = getenv("EXQUISITE_IPC");
   if (!file || !file[0]) file = "/tmp/exquisite";

   if (!method) method = getenv("EXQUISITE_IPC_METHOD");

   if (!method || !method[0] || !strcmp(method, "fifo"))
     {
        unlink(file);
        mkfifo(file, S_IRUSR | S_IWUSR |  S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
        fd = open(file, O_RDWR);
        fcntl(fd, F_SETFL, O_NONBLOCK);
        if (fd < 0)
          {
             printf("EXQUISITE ERROR: Cannot create fifo: %s\n", file);
             exit(-1);
          }
        fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, 
                                        fifo_input, NULL, 
                                        NULL, NULL);
     }
   else if (strstr(method, "socket"))
     {
        ecore_con_init();

        if (!strcmp(method, "socket"))
          {
             sock = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM, 
                                         file,
                                         0, NULL);
          }
        else
          {
             sock = ecore_con_server_add(ECORE_CON_LOCAL_ABSTRACT, 
                                         file,
                                         0, NULL);
          }

        if (!sock)
          {
            printf("EXQUISITE ERROR: Cannot create socket %s.\n", file);
            exit(-1);
          }

        ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
                                socket_input, NULL);
        ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
                                socket_del, NULL);
     }
   else
     {
        printf("Invalid ipc method: %s\n", method);
        exit(0);
     }
}
Esempio n. 8
0
//Popup the menu at the position (x, y)
void eclair_menu_popup_at_xy(Eclair_Menu *menu, int x, int y)
{
   if (!menu)
      return;

   if (!_eclair_menu_input_window)
   {
      Ecore_X_Window root, parent;
      int root_x, root_y, root_w, root_h;

      root = menu->x_window;
      while ((parent = ecore_x_window_parent_get(root)) != 0)
         root = parent;
 
      ecore_x_window_geometry_get(root, &root_x, &root_y, &root_w, &root_h);
      _eclair_menu_input_window = ecore_x_window_input_new(root, root_x, root_y, root_w, root_h);
   }
   if (!_eclair_menu_root)
   {
      _eclair_menu_mouse_up_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, _eclair_menu_mouse_up_cb, menu);
      _eclair_menu_mouse_move_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, _eclair_menu_mouse_move_cb, menu);
      ecore_x_window_show(_eclair_menu_input_window);
      ecore_x_keyboard_grab(_eclair_menu_input_window);
      ecore_x_pointer_confine_grab(_eclair_menu_input_window);

      _eclair_menu_root = menu;
   }
   ecore_evas_move(menu->window, x, y);
   ecore_evas_show(menu->window);
   evas_event_feed_mouse_move(menu->evas, -100000, -100000, ecore_x_current_time_get(), NULL);
   evas_event_feed_mouse_in(menu->evas, ecore_x_current_time_get(), NULL);
   _eclair_menu_popped_menus = eina_list_append(_eclair_menu_popped_menus, menu);

   _eclair_menu_update_slide_timer(menu);
}
Esempio n. 9
0
int
main(void)
{
   Esql *e;
   struct ctx ctx = {0, 0, 0};

   ecore_init();
   esql_init();

   eina_log_domain_level_set("esskyuehl", EINA_LOG_LEVEL_DBG);

   e = esql_new(ESQL_TYPE_SQLITE);
   assert(e != NULL);

   ecore_event_handler_add(ESQL_EVENT_CONNECT, on_connect, &ctx);
   ecore_event_handler_add(ESQL_EVENT_ERROR, on_error, &ctx);

   assert(esql_connect(e, ":memory:", NULL, NULL));

   ecore_main_loop_begin();
   esql_disconnect(e);

   esql_shutdown();
   ecore_shutdown();

   assert(ctx.conns == 1);
   assert(ctx.errors == 0);
   assert(ctx.res == 2 + INSERTED_ROWS);

   return 0;
}
Esempio n. 10
0
int
main(void)
{
   double done;
   eina_init();
   ecore_init();
   ecore_con_init();

   eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR);
   eina_log_domain_level_set("eina", EINA_LOG_LEVEL_ERR);
   counter = eina_counter_new("client");
   eina_counter_start(counter);
   done = ecore_time_get();

   ecore_job_add(_spawn, NULL);

/* set event handler for server connect */
   ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL);
   ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_del, NULL);

/* start client */
   ecore_main_loop_begin();
   eina_counter_stop(counter, 1);
   printf("\nTime elapsed for %i connections: %f seconds\n%s", NUM_CLIENTS, ecore_time_get() - done, eina_counter_dump(counter));
   return 0;
}
Esempio n. 11
0
/* local subsystem functions */
int
_e_fm_ipc_init(void)
{
   char *sdir;

   sdir = getenv("E_IPC_SOCKET");
   if (!sdir)
     {
        printf("The E_IPC_SOCKET environment variable is not set. This is\n"
               "exported by Enlightenment to all processes it launches.\n"
               "This environment variable must be set and must point to\n"
               "Enlightenment's IPC socket file (minus port number).\n");
        return 0;
     }
   _e_fm_ipc_server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, sdir, 0, NULL);
   if (!_e_fm_ipc_server)
     {
        printf("Cannot connect to enlightenment (socket '%s') - abort\n", sdir);
        return 0;
     }

   ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, _e_fm_ipc_cb_server_add, NULL);
   ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _e_fm_ipc_cb_server_del, NULL);
   ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, _e_fm_ipc_cb_server_data, NULL);

   return 1;
}
Esempio n. 12
0
/*============================================================================*
 *                                 Global                                     *
 *============================================================================*/
Efl_Egueb_IO_Request * efl_egueb_io_request_new(Egueb_Dom_String *location,
		const Efl_Egueb_IO_Request_Descriptor *descriptor, void *data)
{
	Efl_Egueb_IO_Request *thiz;
	const char *filename;


	if (!location) return NULL;
	filename = egueb_dom_string_chars_get(location);

	thiz = calloc(1, sizeof(Efl_Egueb_IO_Request));
	thiz->descriptor = descriptor;
	thiz->data = data;

	if (!strncmp(filename, "file://", 7))
	{
		Enesim_Stream *s;

		s = enesim_stream_file_new(filename + 7, "r");
		if (s)
		{
			DBG("Data '%s' loaded correctly", filename);
			thiz->in_event = EINA_TRUE;
			if (thiz->descriptor->completion)
				thiz->descriptor->completion(thiz, s);
			enesim_stream_unref(s);
			thiz->in_event = EINA_FALSE;
		}
	}
	else if (!strncmp(filename, "http://", 7))
	{
		thiz->conn = ecore_con_url_new(filename);
		thiz->binbuf = eina_binbuf_new();

		ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE,
				_efl_egueb_io_request_url_completion_cb,
				thiz);
		ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA,
				_efl_egueb_io_request_url_data_cb,
				thiz);
		ecore_con_url_get(thiz->conn);
	}
	else
	{
		WRN("Unsupported schema '%s'", filename);
		free(thiz);
		thiz = NULL;
		goto done;
	}

	if (thiz->destroy)
	{
		efl_egueb_io_request_free(thiz);
		return NULL;		
	}
done:
	return thiz;
}
Esempio n. 13
0
void
_mail_imap_check_mail (void *data)
{
   Ecore_Con_Type type;
   Eina_List *l;
   printf("check mail!!!!\n");

  for (l = iservers; l; l = l->next)
    {
      ImapServer *is;
      printf("1\n");

      is = l->data;
      is->data = data;
      if (!is->server)
	{
	   printf("2\n");
	  if (!is->add_handler)
	    is->add_handler =
	      ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
				       _mail_imap_server_add, NULL);
	  if (!is->del_handler)
	    is->del_handler =
	      ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
				       _mail_imap_server_del, NULL);
	  if (!is->data_handler)
	    is->data_handler =
	      ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
				       _mail_imap_server_data, NULL);

	  if (is->local)
	    type = ECORE_CON_LOCAL_SYSTEM;
	  else
	    type = ECORE_CON_REMOTE_SYSTEM;

	  if (ecore_con_ssl_available_get () && (is->ssl))
            {
	       type |= ECORE_CON_USE_SSL;
#ifdef PRINT_LOTS_OF_DEBUG
               if (ecore_con_ssl_available_get() == 1)
                 {
                    gnutls_global_set_log_level(9);
                    gnutls_global_set_log_function(tls_log_func);
                 }
            }
#endif
           }
	  is->state = IMAP_STATE_DISCONNECTED;
	  is->server =
	     ecore_con_server_connect (type, is->host,
		   is->port, NULL);
	  is->cmd = 0;
	  is->current = is->clients;
	}
    }
Esempio n. 14
0
static void
optional_ews_window_manager_setup(void)
{
   ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_ADD, _wm_win_add, NULL);
   ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_MOVE, _wm_win_move, NULL);
   ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_RESIZE, _wm_win_resize, NULL);
   ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_SHOW, _wm_win_show, NULL);

   /* one may use any known unique identifier, like an app function pointer */
   ecore_evas_ews_manager_set(optional_ews_window_manager_setup);
}
Esempio n. 15
0
/* Gadcon Functions */
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
   Evas_Object *o;
   E_Gadcon_Client *gcc;
   Forecasts *w;
   Instance *inst;

   inst = E_NEW(Instance, 1);

   inst->ci = _forecasts_config_item_get(id);
   inst->area = eina_stringshare_add(inst->ci->code);
   inst->buffer = eina_strbuf_new();

   w = _forecasts_new(gc->evas);
   w->inst = inst;
   inst->forecasts = w;

   o = w->forecasts_obj;
   gcc = e_gadcon_client_new(gc, name, id, style, o);
   gcc->data = inst;
   inst->gcc = gcc;
   inst->popup = NULL;
   inst->forecasts_obj = o;
   evas_object_event_callback_add(inst->forecasts_obj, EVAS_CALLBACK_MOUSE_DOWN,
                                  _cb_mouse_down, inst);
   evas_object_event_callback_add(inst->forecasts_obj, EVAS_CALLBACK_MOUSE_IN,
                                  _cb_mouse_in, inst);
   evas_object_event_callback_add(inst->forecasts_obj, EVAS_CALLBACK_MOUSE_OUT,
                                  _cb_mouse_out, inst);

   if (!inst->add_handler)
     inst->add_handler =
       ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD,
                               _forecasts_server_add, inst);
   if (!inst->del_handler)
     inst->del_handler =
       ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL,
                               _forecasts_server_del, inst);
   if (!inst->data_handler)
     inst->data_handler =
       ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
                               _forecasts_server_data, inst);

   evas_object_event_callback_add(w->forecasts_obj, EVAS_CALLBACK_MOUSE_DOWN,
                                  _forecasts_cb_mouse_down, inst);
   forecasts_config->instances =
     eina_list_append(forecasts_config->instances, inst);

   _forecasts_cb_check(inst);
   inst->check_timer =
     ecore_timer_add(inst->ci->poll_time, _forecasts_cb_check, inst);
   return gcc;
}
Esempio n. 16
0
int
wkb_ibus_init(void)
{
   if (wkb_ibus && wkb_ibus->refcount)
      goto end;

   if (!eldbus_init())
     {
        ERR("Error initializing Eldbus");
        goto eldbus_err;
     }

   if (!efreet_init())
     {
        ERR("Error initializing Efreet");
        goto efreet_err;
     }

   if (!wkb_ibus_config_eet_init())
     {
        ERR("Error initializing wkb_config_eet");
        goto eet_err;
     }

   if (!wkb_ibus && !(wkb_ibus = calloc(1, sizeof(*wkb_ibus))))
     {
        ERR("Error calloc");
        goto calloc_err;
     }

   WKB_IBUS_CONNECTED = ecore_event_type_new();
   WKB_IBUS_DISCONNECTED = ecore_event_type_new();
   WKB_IBUS_CONFIG_VALUE_CHANGED = ecore_event_type_new();
   WKB_THEME_CHANGED = ecore_event_type_new();

   wkb_ibus->add_handle = ecore_event_handler_add(ECORE_EXE_EVENT_ADD, _wkb_ibus_exe_add_cb, NULL);
   wkb_ibus->data_handle = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _wkb_ibus_exe_data_cb, NULL);

end:
   return ++wkb_ibus->refcount;

calloc_err:
   wkb_ibus_config_eet_shutdown();

eet_err:
   efreet_shutdown();

efreet_err:
   eldbus_shutdown();

eldbus_err:
   return 0;
}
Esempio n. 17
0
EAPI int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *o, *bg, *box;
   Ecore_Event_Handler *handle_key_up, *handle_key_down;

   win = elm_win_add(NULL, "elm_event", ELM_WIN_BASIC);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_win_autodel_set(win, EINA_TRUE);

   o = elm_bg_add(win);
   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, o);
   evas_object_show(o);

   box = elm_box_add(win);
   elm_box_horizontal_set(box, EINA_FALSE);
   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, box);
   evas_object_show(box);

   o = elm_entry_add(win);
   elm_entry_single_line_set(o, EINA_TRUE);
   elm_entry_entry_set(o, "123ab456");
   elm_box_pack_end(box, o);
   evas_object_show(o);

   o = elm_button_add(win);
   elm_object_text_set(o, "Test");
   elm_box_pack_end(box, o);
   evas_object_show(o);

   handle_key_up = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
                                           _input_event_cb, NULL);
   handle_key_down = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
                                             _input_event_cb, NULL);

   evas_object_resize(win, 300, 300);
   evas_object_show(win);

   elm_run();

   if (handle_key_up)
     ecore_event_handler_del(handle_key_up);
   if (handle_key_down)
     ecore_event_handler_del(handle_key_down);

   elm_shutdown();

   return 0;
}
Esempio n. 18
0
FileDownloader::FileDownloader(string _url, string _dest, bool auto_del):
                url_con(NULL),
                dl_file(NULL),
                auto_destroy(auto_del),
                idler(NULL),
                url(_url),
                dest(_dest),
                user_data(NULL)
{
        ecore_con_url_init();

        complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _complete_cb, this);
        progress_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _progress_cb, this);
}
Esempio n. 19
0
int main(int argc, const char **argv)
{
	Ecore_X_Window win;

	ecore_init();
	ecore_app_args_set(argc, argv);

	if (!ecore_evas_init())
		return -1;

	ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, win_w, win_h);
	if (!ee)
		return 1;
	win = ecore_evas_software_x11_window_get(ee);
	ecore_evas_title_set(ee, "Etox Selection Test");
	ecore_evas_show(ee);

	/* setup callbacks for events */
	ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, e_mouse_move, NULL);
	ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, e_mouse_down,
			NULL);
	ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, e_mouse_up,
			NULL);
	ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, sig_exit, NULL);

	evas = ecore_evas_get(ee);
	evas_font_path_append(evas, FONT_DIRECTORY);

	/* program does its data setup here */
	setup();

	ecore_evas_callback_resize_set(ee, window_resize);

	/* and now loop forever handling events */
	ecore_main_loop_begin();

	evas_object_del(e_msg);
	evas_object_del(e_test);

	while (pbuttons) {
		panel_button_free(pbuttons->data);
		pbuttons = eina_list_remove(pbuttons, pbuttons->data);
	}

	evas_free(evas);

	return 0;
	argc = 0;
	argv = NULL;
}
Esempio n. 20
0
Elm_Url *
_elm_url_download(const char *url, Elm_Url_Done done_cb, Elm_Url_Cancel cancel_cb, Elm_Url_Progress progress_cb, const void *data)
{
   Ecore_Con_Url *target;
   Elm_Url *r;

   ecore_con_url_init();

   target = ecore_con_url_new(url);
   if (!target) goto on_error;

#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
   if (getuid() == geteuid())
#endif
     {
        if (getenv("http_proxy")) ecore_con_url_proxy_set(target, getenv("http_proxy"));
        if (getenv("https_proxy")) ecore_con_url_proxy_set(target, getenv("https_proxy"));
        if (getenv("ftp_proxy")) ecore_con_url_proxy_set(target, getenv("ftp_proxy"));
     }

   r = malloc(sizeof (Elm_Url));
   if (!r) goto on_error;

   r->url = eina_stringshare_add(url);
   r->cb.done = done_cb;
   r->cb.cancel = cancel_cb;
   r->cb.progress = progress_cb;
   r->data = data;

   r->download = eina_binbuf_new();
   r->target = target;
   r->handler.progress = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _elm_url_progress, r);
   r->handler.done = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _elm_url_done, r);
   r->handler.data = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _elm_url_data, r);

   if (!ecore_con_url_get(r->target))
     {
       _elm_url_free(r);
       cancel_cb((void*) data, NULL, -1);
       return NULL;
     }

   return r;

 on_error:
   ecore_con_url_shutdown();

   cancel_cb((void*) data, NULL, -1);
   return NULL;
}
Esempio n. 21
0
CalaosCameraView::CalaosCameraView(Evas *evas):
    EvasSmart(evas, "PageContentView")
{
    clip = evas_object_rectangle_add(evas);
    evas_object_color_set(clip, 255, 255, 255, 255);
    AddMemberObject(clip);

    camImage = evas_object_image_add(evas);
    evas_object_clip_set(camImage, clip);
    AddMemberObject(camImage);

    handler_data = ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data_cb, this);
    handler_complete = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, this);
}
Esempio n. 22
0
Eina_Bool
enfeeble_connect(Enfeeble *enf)
{
   int ssl;

   EINA_SAFETY_ON_NULL_RETURN_VAL(enf, EINA_FALSE);
   ssl = enf->ssl * ECORE_CON_USE_MIXED;
   enf->ev_add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)con, enf);
   enf->ev_del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb)disc, NULL);
   enf->ev_data = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb)data, enf);
   enf->ev_error = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ERROR, (Ecore_Event_Handler_Cb)error, NULL);
   enf->svr = ecore_con_server_connect(ECORE_CON_REMOTE_NODELAY, enf->svr_name, enf->port, enf);

   return EINA_TRUE;
}
Esempio n. 23
0
/*
 *Delete location feed from cosm. Return EINA_TRUE if success.
 */
Eina_Bool
cosm_location_feed_delete(Location *location)
{
	Ecore_Con_Url *cosm_url = NULL;
	char *s;

	//Don't delete if no cosm feedid cosm or null location
	if(!location || (location_cosm_feedid_get(location) == 0) || !edams_settings_cosm_apikey_get())
		return EINA_FALSE;

	int feedid = location_cosm_feedid_get(location);

	debug(MSG_COSM, _("Deleting Cosm feed '%s'..."), location_name_get(location));

   	ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_feed_delete_complete_cb, (void*)feedid);
	asprintf(&s, "http://api.cosm.com/v2/feeds/%d", location_cosm_feedid_get(location));
	cosm_url = ecore_con_url_custom_new(s, "DELETE");
   	if (!cosm_url)
     {
	    debug(MSG_ERROR, _("Can't create Ecore_Con_Url object"));
		return EINA_FALSE;
     }
	//ecore_con_url_verbose_set(cosm_url, edams_settings_debug_get());
   	ecore_con_url_additional_header_add(cosm_url, "X-ApiKey", edams_settings_cosm_apikey_get());


	if(!ecore_con_url_post(cosm_url, (void*)s, strlen(s), NULL))
	{
		debug(MSG_ERROR, _("Can't realize url PUT request"));
		return EINA_FALSE;
	}
	FREE(s);

	return EINA_TRUE;
}/*cosm_location_feed_delete*/
Esempio n. 24
0
int
ecore_file_download_init(void)
{
#ifdef BUILD_ECORE_CON
  if (!ecore_con_url_init())
    return 0;

# ifdef HAVE_CURL
  _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL);
  _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
# endif

#endif /* BUILD_ECORE_CON */

   return 1;
}
Esempio n. 25
0
/**
 * @brief Allocate a new client object
 *
 * This function creates a new client object for use in connecting to a
 * server.
 * @return The new client, or NULL on failure
 */
Azy_Client *
azy_client_new(void)
{
   Azy_Client *client;

   if (!(client = calloc(1, sizeof(Azy_Client))))
     return NULL;

   client->add = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_azy_client_handler_add, client);
   client->del = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb)_azy_client_handler_del, client);
   client->upgrade = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_UPGRADE,
                                             (Ecore_Event_Handler_Cb)_azy_client_handler_upgrade, client);

   AZY_MAGIC_SET(client, AZY_MAGIC_CLIENT);
   return client;
}
Esempio n. 26
0
int main(int argc, char *argv[])
{
    const char *url;
    int args = 1;

    if (!ecore_evas_init())
        return EXIT_FAILURE;

    if (args < argc)
        url = argv[args];
    else
        url = DEFAULT_URL;

    MiniBrowser *browser = browserCreate(url);

    Ecore_Event_Handler *handle = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, 0);

    ecore_main_loop_begin();

    ecore_event_handler_del(handle);
    ecore_evas_free(browser->ee);
    free(browser);

    ecore_evas_shutdown();

    return 0;
}
Esempio n. 27
0
int main (int argc, char *argv[]) {
  ecore_con_init();

  printf("Server is running: waiting for connections\n");
  svr = ecore_con_server_add(ECORE_CON_LOCAL_USER, "con_example", 0, NULL);
  ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
			  (Handler_Func)client_connect, NULL);
  ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
			  (Handler_Func)client_disconnect, NULL);
  ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
			  (Handler_Func)client_data, NULL);
  ecore_main_loop_begin();

  ecore_con_shutdown();
  return 0;
}
int
main(int argc, char **argv)
{
   struct context ctxt = {0};

   if (!ecore_init())
     {
        printf("ERROR: Cannot init Ecore!\n");
        return -1;
     }

   _event_type = ecore_event_type_new();

   ctxt.enterer = ecore_idle_enterer_add(_enterer_cb, &ctxt);
   ctxt.exiter = ecore_idle_exiter_add(_exiter_cb, &ctxt);
//   ctxt.idler = ecore_idler_add(_idler_cb, &ctxt);
   ctxt.idler = eo_add_custom(ECORE_IDLER_CLASS, NULL, ecore_idler_constructor(_idler_cb, &ctxt));
   ctxt.handler = ecore_event_handler_add(_event_type,
                                          _event_handler_cb,
                                          &ctxt);
   ctxt.timer = ecore_timer_add(0.0005, _timer_cb, &ctxt);

   ecore_main_loop_begin();
   ecore_shutdown();

   return 0;
}
EAPI void *
e_modapi_init(E_Module *m)
{
   E_Music_Control_Module_Context *ctxt;

   ctxt = calloc(1, sizeof(E_Music_Control_Module_Context));
   EINA_SAFETY_ON_NULL_RETURN_VAL(ctxt, NULL);
   music_control_mod = m;

   ctxt->conf_edd = E_CONFIG_DD_NEW("music_control_config", Music_Control_Config);
   #undef T
   #undef D
   #define T Music_Control_Config
   #define D ctxt->conf_edd
   E_CONFIG_VAL(D, T, player_selected, INT);
   E_CONFIG_VAL(D, T, pause_on_desklock, INT);
   ctxt->config = e_config_domain_load(MUSIC_CONTROL_DOMAIN, ctxt->conf_edd);
   if (!ctxt->config)
     ctxt->config = calloc(1, sizeof(Music_Control_Config));

   if (!music_control_dbus_init(ctxt, music_player_players[ctxt->config->player_selected].dbus_name))
     goto error_dbus_bus_get;
   music_control_mod = m;

   e_gadcon_provider_register(&_gc_class);

   if (ctxt->config->pause_on_desklock)
     desklock_handler = ecore_event_handler_add(E_EVENT_DESKLOCK, _desklock_cb, ctxt);

   return ctxt;

error_dbus_bus_get:
   free(ctxt);
   return NULL;
}
Esempio n. 30
0
/* externally accessible functions */
EINTERN int
e_msg_init(void)
{
   E_EVENT_MSG = ecore_event_type_new();
   hand = ecore_event_handler_add(E_EVENT_MSG, _e_msg_event_cb, NULL);
   return 1;
}