示例#1
0
int
news_config_dialog_show(void)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;

   if (e_config_dialog_find("News", DIALOG_CLASS))
     return 0;

   v = E_NEW(E_Config_Dialog_View, 1);
   
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _advanced_apply_data;
   v->basic.create_widgets = _basic_create_widgets;
   v->advanced.apply_cfdata = _advanced_apply_data;
   v->advanced.create_widgets = _advanced_create_widgets;
   
   cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
			     D_("News Main Configuration"),
                             "News", DIALOG_CLASS,
                             news_theme_file_get(NEWS_THEME_CAT_ICON), 0, v, NULL);

   return 1;
}
EAPI void
e_backlight_level_set(E_Zone *zone, double val, double tim)
{
   double bl_now;
   // zone == NULL == everything
   // set backlight associated with zone to val over period of tim
   // if tim == 0.0 - then do it instantnly, if time == -1 use some default
   // transition time
   if (val < 0.0) val = 0.0;
   else if (val > 1.0)
     val = 1.0;
   if ((fabs(val - e_bl_val) < DBL_EPSILON) && (!bl_anim)) return;
   if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
   ecore_event_add(E_EVENT_BACKLIGHT_CHANGE, NULL, NULL, NULL);
   bl_now = e_bl_val;
   e_bl_val = val;
   if (fabs(tim) < DBL_EPSILON)
     {
        _e_backlight_set(zone, val);
        return;
     }
//   if (e_config->backlight.mode != E_BACKLIGHT_MODE_NORMAL) return;
   if (e_config->backlight.mode == E_BACKLIGHT_MODE_NORMAL)
     tim = 0.5;
   else
   if (tim < 0.0)
     tim = e_config->backlight.transition;

   E_FREE_FUNC(bl_anim, ecore_animator_del);
   bl_anim = ecore_animator_timeline_add(tim, _bl_anim, zone);
   bl_animval = bl_now;
}
static void
_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
   News_Item *ni;
   Evas_Event_Mouse_Down *ev;

   ni = data;
   ev = event_info;

   DITEM(("Mouse down %d", ev->button));

   switch(ev->button)
     {
        int cx, cy, cw, ch;

     case 3:
        if (ni->menu) break;
        news_menu_item_show(ni);
        e_gadcon_canvas_zone_geometry_get(ni->gcc->gadcon,
                                          &cx, &cy, &cw, &ch);
        e_menu_activate_mouse(ni->menu,
                              e_util_zone_current_get(e_manager_current_get()),
                              cx + ev->output.x, cy + ev->output.y, 1, 1,
                              E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
        evas_event_feed_mouse_up(ni->gcc->gadcon->evas, ev->button,
                                 EVAS_BUTTON_NONE, ev->timestamp, NULL);
        break;
     }
}
static void
_cb_item_open(void *data, Evas_Object *obj, const char *emission, const char *source)
{
   News_Item *ni;
   E_Manager *man;
   E_Zone *zone;
   int cx, cy;

   ni = data;

   switch (ni->config->openmethod)
     {
     case NEWS_ITEM_OPENMETHOD_VIEWER:
        if (!ni->viewer)
          news_viewer_create(ni);
        else
          news_viewer_destroy(ni->viewer);
        break;
     case NEWS_ITEM_OPENMETHOD_BROWSER:
        news_menu_browser_show(ni);
        man = e_manager_current_get();
        zone = e_util_zone_current_get(man);
        ecore_x_pointer_xy_get(man->root, &cx, &cy);
        e_menu_activate_mouse(ni->menu_browser, zone,
                              cx, cy, 1, 1,
                              E_MENU_POP_DIRECTION_DOWN, 
                              ecore_x_current_time_get());
        break;
     }
}
示例#5
0
E_Config_Dialog *
e_int_config_desklock_fsel(E_Config_Dialog *parent) 
{
   E_Container *con;
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;

   if (parent) 
     con = parent->con;
   else
     con = e_container_current_get(e_manager_current_get());

   v = E_NEW(E_Config_Dialog_View, 1);
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.create_widgets = _basic_create;
   v->basic_only = 1;
   v->normal_win = 1;

   cfd = e_config_dialog_new(con, _("Select a Background..."), 
                             "E", "_desklock_fsel_dialog", 
                             "enlightenment/background", 0, v, parent);

   return cfd;
}
示例#6
0
static void
_wlan_cb_mouse_down (void *data, Evas * e, Evas_Object * obj, void *event_info)
{
  Instance *inst;
  Evas_Event_Mouse_Down *ev;

  inst = data;
  ev = event_info;
  if ((ev->button == 3) && (!wlan_config->menu))
    {
      E_Menu *m;
      E_Menu_Item *mi;
      int x, y, w, h;

      m = e_menu_new ();
      mi = e_menu_item_new (m);
      e_menu_item_label_set (mi, D_ ("Settings"));
      e_util_menu_item_theme_icon_set(mi, "preferences-system");
      e_menu_item_callback_set (mi, _wlan_menu_cb_configure, inst);

      m = e_gadcon_client_util_menu_items_append (inst->gcc, m, 0);
      e_menu_post_deactivate_callback_set (m, _wlan_menu_cb_post, inst);
      wlan_config->menu = m;
      e_gadcon_canvas_zone_geometry_get (inst->gcc->gadcon, &x, &y, &w, &h);
      e_menu_activate_mouse (m,
			     e_util_zone_current_get (e_manager_current_get
						      ()), x + ev->output.x,
			     y + ev->output.y, 1, 1,
			     E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
      evas_event_feed_mouse_up (inst->gcc->gadcon->evas, ev->button,
				EVAS_BUTTON_NONE, ev->timestamp, NULL);
    }
}
示例#7
0
/* Externally accesible functions */
EAPI E_Entry_Dialog *
e_entry_dialog_show(const char *title, const char *icon, const char *text,
                    const char *initial_text,
                    const char *button_text, const char *button2_text,
                    void (*ok_func)(void *data, char *text),
                    void (*cancel_func)(void *data), void *data)
{
   E_Entry_Dialog *ed;
   E_Dialog *dia;
   Evas_Object *o, *ob;
   Evas_Modifier_Mask mask;
   int w, h;

   ed = E_OBJECT_ALLOC(E_Entry_Dialog, E_ENTRY_DIALOG_TYPE, _e_entry_dialog_free);
   ed->ok.func = ok_func;
   ed->ok.data = data;
   ed->cancel.func = cancel_func;
   ed->cancel.data = data;
   if (initial_text)
     ed->text = strdup(initial_text);

   dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_entry_dialog");
   if (!dia)
     {
        e_object_del(E_OBJECT(ed));
        return NULL;
     }
   dia->data = ed;
   ed->dia = dia;

   mask = 0;
   evas_object_key_ungrab(dia->event_object, "space", mask, ~mask);
   e_object_del_attach_func_set(E_OBJECT(dia), _e_entry_dia_del);
   e_win_delete_callback_set(dia->win, _e_entry_dialog_delete);

   if (title) e_dialog_title_set(dia, title);
   if (icon) e_dialog_icon_set(dia, icon, 64);

   o = e_widget_list_add(dia->win->evas, 0, 0);
   if (text)
     {
        ob = e_widget_label_add(dia->win->evas, text);
        e_widget_list_object_append(o, ob, 1, 0, 0.5);
     }

   ed->entry = e_widget_entry_add(dia->win->evas, &(ed->text), NULL, NULL, NULL);
   evas_object_smart_callback_add(ed->entry, "key_down", _e_entry_cb_key_down, ed);
   e_widget_list_object_append(o, ed->entry, 1, 1, 0.5);
   e_widget_size_min_get(o, &w, &h);
   e_dialog_content_set(dia, o, w, h);

   e_dialog_button_add(dia, !button_text ? _("OK") : button_text, NULL, _e_entry_dialog_ok, ed);
   e_dialog_button_add(dia, !button2_text ? _("Cancel") : button2_text, NULL, _e_entry_dialog_cancel, ed);

   e_win_centered_set(dia->win, 1);
   e_dialog_show(dia);
   e_widget_focus_set(ed->entry, 1);
   e_editable_select_all(e_widget_entry_editable_object_get(ed->entry));
   return ed;
}
示例#8
0
文件: e_mod_config.c 项目: Limsik/e17
/* Config Calls */
void
_config_ut_module (Config_Item * ci)
{
  E_Config_Dialog *cfd;
  E_Config_Dialog_View *v;
  E_Container *con;
  char buf[4096];

  if (!ut_config)
    return;

  v = E_NEW (E_Config_Dialog_View, 1);
  if (!v)
    {
      warn ("malloc()");
      return;
    }

  v->create_cfdata = _create_data;
  v->free_cfdata = _free_data;
  v->basic.apply_cfdata = _basic_apply_data;
  v->basic.create_widgets = _basic_create_widgets;

  snprintf (buf, sizeof (buf), "%s/e-module-uptime.edj",
	    e_module_dir_get (ut_config->module));
  con = e_container_current_get (e_manager_current_get ());
  cfd = e_config_dialog_new (con, D_ ("Uptime Settings"), "UpTime", "_e_modules_uptime_config_dialog", buf, 0, v, ci);
  ut_config->config_dialog = cfd;
}
示例#9
0
文件: e_mod_gadcon.c 项目: Limsik/e17
static void
_gc_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event)
{
   Instance *inst;
   Evas_Event_Mouse_Down *ev;

   if (!(inst = data)) return;
   ev = event;
   if ((ev->button == 3) && (!inst->menu))
     {
        E_Menu *m;
        E_Menu_Item *mi;
        E_Zone *zone;
        int x = 0, y = 0;

        zone = e_util_zone_current_get(e_manager_current_get());

        m = e_menu_new();

        mi = e_menu_item_new(m);
        e_menu_item_label_set(mi, D_("Settings"));
        e_util_menu_item_theme_icon_set(mi, "configure");
        e_menu_item_callback_set(mi, _menu_cb_configure, inst);

        m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
        e_menu_post_deactivate_callback_set(m, _gc_cb_menu_post, inst);
        inst->menu = m;

        e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL);
        e_menu_activate_mouse(m, zone, x + ev->output.x, y + ev->output.y,
                              1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
     }
}
int
news_config_dialog_item_content_show(News_Item *ni)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;

   v = E_NEW(E_Config_Dialog_View, 1);
   
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _basic_apply_data;
   v->basic.create_widgets = _basic_create_widgets;
   
   cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
			     D_("News Gadget Content Configuration"),
                             "News", DIALOG_CLASS,
                             news_theme_file_get(NEWS_THEME_CAT_ICON), 0, v, ni);

   if (news->config->feed.langs_notset)
     {
        news_config_dialog_langs_show();
        news->config->feed.langs_notset = 0;
        news_config_save();
     }

   return 1;
}
示例#11
0
文件: e_mod_main.c 项目: Limsik/e17
/* action callback */
static void
_e_mod_action_exebuf_cb(E_Object *obj, const char *params)
{
   E_Zone *zone = NULL;
   
   if (obj)
     {
	if (obj->type == E_MANAGER_TYPE)
	  zone = e_util_zone_current_get((E_Manager *)obj);
	else if (obj->type == E_CONTAINER_TYPE)
	  zone = e_util_zone_current_get(((E_Container *)obj)->manager);
	else if (obj->type == E_ZONE_TYPE)
	  zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager);
	else
	  zone = e_util_zone_current_get(e_manager_current_get());
     }
   if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
   if (zone) e_exebuf_show(zone);
}
示例#12
0
static void
_systray_menu_new(Instance *inst, Evas_Event_Mouse_Down *ev)
{
   E_Zone *zone;
   E_Menu *m;
   int x, y;

   zone = e_util_zone_current_get(e_manager_current_get());

   m = e_menu_new();
   m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
   e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL);
   e_menu_activate_mouse(m, zone, x + ev->output.x, y + ev->output.y,
                         1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
   evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
                            EVAS_BUTTON_NONE, ev->timestamp, NULL);
}
示例#13
0
void 
config_temperature_module(Config_Face *inst) 
{
   E_Config_Dialog_View *v;
   char buff[PATH_MAX];

   v = E_NEW(E_Config_Dialog_View, 1);
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.create_widgets = _basic_create;
   v->basic.apply_cfdata = _basic_apply;

   snprintf(buff, sizeof(buff), 
            "%s/e-module-temperature.edj", inst->module->dir);
   inst->config_dialog = 
     e_config_dialog_new(e_container_current_get(e_manager_current_get()), 
                         _("Temperature Settings"), "E", 
                         "_e_mod_temperature_config_dialog", buff, 0, v, inst);
}
示例#14
0
Wayland_Surface *
e_mod_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h)
{
   Wayland_Surface *ws;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);

   if (!(ws = calloc(1, sizeof(Wayland_Surface)))) return NULL;

   wl_list_init(&ws->link);
   wl_list_init(&ws->buffer_link);

   glGenTextures(1, &ws->texture);
   glBindTexture(GL_TEXTURE_2D, ws->texture);

   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

   ws->surface.resource.client = NULL;

   ws->x = x;
   ws->y = y;
   ws->w = w;
   ws->h = h;
   ws->buffer = NULL;

   ws->win = e_win_new(e_container_current_get(e_manager_current_get()));
   e_win_borderless_set(ws->win, EINA_TRUE);
   e_win_move_resize(ws->win, x, y, w, h);

   pixman_region32_init(&ws->damage);
   pixman_region32_init(&ws->opaque);

   wl_list_init(&ws->frame_callbacks);

   ws->buffer_destroy_listener.notify =
     _e_mod_comp_wl_surface_buffer_destroy_handle;

   /* ws->transform = NULL; */

   return ws;
}
/********** externally accesible functions ****************/
EAPI E_Confirm_Dialog *
e_confirm_dialog_show(const char *title, const char *icon, const char *text,
                      const char *button_text, const char *button2_text,
                      void (*func)(void *data), void (*func2)(void *data),
                      void *data, void *data2,
                      void (*del_func)(void *data), void *del_data)
{
    E_Confirm_Dialog *cd;
    E_Dialog *dia;

    cd = E_OBJECT_ALLOC(E_Confirm_Dialog, E_CONFIRM_DIALOG_TYPE, _e_confirm_dialog_free);
    cd->yes.func = func;
    cd->yes.data = data;
    cd->no.func = func2;
    cd->no.data = data2;
    cd->del.func = del_func;
    cd->del.data = del_data;

    dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_confirm_dialog");
    if (!dia)
    {
        e_object_del(E_OBJECT(cd));
        return NULL;
    }
    dia->data = cd;
    cd->dia = dia;

    e_win_delete_callback_set(dia->win, _e_confirm_dialog_delete);

    if (title) e_dialog_title_set(dia, title);
    if (icon) e_dialog_icon_set(dia, icon, 64);
    if (text) e_dialog_text_set(dia, text);

    e_dialog_button_add(dia, !button_text ? _("Yes") : button_text, NULL, _e_confirm_dialog_yes, cd);
    e_dialog_button_add(dia, !button2_text ? _("No") : button2_text, NULL, _e_confirm_dialog_no, cd);

    e_dialog_button_focus_num(dia, 1);
    e_win_centered_set(dia->win, 1);
    e_dialog_show(dia);

    return cd;
}
示例#16
0
文件: e_mod_config.c 项目: Limsik/e17
void 
_config_pager_module(void)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;
   E_Container *con;

   if (e_config_dialog_find("E", "_e_mod_access_config_dialog"))
     return;
   v = E_NEW(E_Config_Dialog_View, 1);
   if (!v) return;

   v->create_cfdata =        _create_data;
   v->free_cfdata =          _free_data;
   v->basic.create_widgets = _basic_create;
   v->basic.apply_cfdata =   _basic_apply;

   con = e_container_current_get(e_manager_current_get());
   cfd = e_config_dialog_new(con, _("Access Settings"), "E", 
                             "_e_mod_access_config_dialog",
                             "preferences-desktop-access", 0, v, NULL);
}
示例#17
0
EAPI E_Obj_Dialog *
e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class)
{
   E_Obj_Dialog *od;
   E_Manager *man;
   Evas_Object *o;
   
   if (!con)
     {
	man = e_manager_current_get();
	if (!man) return NULL;
	con = e_container_current_get(man);
	if (!con) con = e_container_number_get(man, 0);
	if (!con) return NULL;
     }
   od = E_OBJECT_ALLOC(E_Obj_Dialog, E_OBJ_DIALOG_TYPE, _e_obj_dialog_free);
   if (!od) return NULL;
   od->win = e_win_new(con);
   if (!od->win)
     {
	free(od);
	return NULL;
     }
   e_win_delete_callback_set(od->win, _e_obj_dialog_cb_delete);
   e_win_resize_callback_set(od->win, _e_obj_dialog_cb_resize);
   od->win->data = od;
   e_win_dialog_set(od->win, 1);
   e_win_name_class_set(od->win, class_name, class_class);
   e_win_title_set(od->win, title);
   
   o = edje_object_add(e_win_evas_get(od->win));
   od->bg_object = o;
   
   e_win_centered_set(od->win, 1);
   od->cb_delete = NULL;
   
   return od;
}
static void
_alarm_snooze(Alarm *al)
{
   E_Dialog *dia;
   Evas_Object *o, *ob;
   Evas *evas;
   char buf[4096];
   int w, h;

   if (al->snooze.dia)
     return;

   dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "Alarm", "_e_modules_alarm_snooze_dialog");
   if (!dia)
     return;
   evas = e_win_evas_get(dia->win);

   snprintf(buf, sizeof(buf), D_("Snooze %s"), al->name);
   e_dialog_title_set(dia, buf);
   
   o = e_widget_list_add(evas, 0, 0);
   ob = e_widget_slider_add(evas, 1, 0, D_("%1.0f hours"), 0.0, 24.0, 1.0, 0,
                            NULL, &(al->snooze.hour), 100);
   e_widget_list_object_append(o, ob, 0, 0, 1.0);
   ob = e_widget_slider_add(evas, 1, 0, D_("%1.0f minutes"), 0.0, 60.0, 1.0, 0,
                            NULL, &(al->snooze.minute), 100);
   e_widget_list_object_append(o, ob, 0, 0, 1.0);

   e_widget_size_min_get(o, &w, &h);
   e_dialog_content_set(dia, o, w, h);

   e_dialog_button_add(dia, D_("Ok"), NULL, _alarm_cb_dialog_snooze_ok, al);
   e_dialog_button_add(dia, D_("Close"), NULL, _alarm_cb_dialog_snooze_cancel, al);

   al->snooze.dia = dia;
   e_win_centered_set(dia->win, 1);
   e_dialog_show(dia);
}
示例#19
0
文件: e_mod_config.c 项目: Limsik/e17
void
_config_execwatch_module(Config_Item * ci)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;
   E_Container *con;
   char buf[4096];

   v = E_NEW(E_Config_Dialog_View, 1);

   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _basic_apply_data;
   v->basic.create_widgets = _basic_create_widgets;
   v->override_auto_apply = 1;

   snprintf(buf, sizeof(buf), "%s/module.edj",
	    e_module_dir_get(execwatch_config->module));
   con = e_container_current_get(e_manager_current_get());
   cfd = e_config_dialog_new(con, "Execwatch Settings", "Execwatch",
			    "_e_modules_execwatch_config_dialog", buf, 0, v, ci);
   execwatch_config->config_dialog = cfd;
}
示例#20
0
文件: e_mod_config.c 项目: Limsik/e17
void
_config_empris_module (Config_Item * ci)
{
  E_Config_Dialog *cfd;
  E_Config_Dialog_View *v;
  E_Container *con;
  char buf[4096];

  v = E_NEW (E_Config_Dialog_View, 1);

  v->create_cfdata = _create_data;
  v->free_cfdata = _free_data;
  v->basic.apply_cfdata = _basic_apply_data;
  v->basic.create_widgets = _basic_create_widgets;

  snprintf (buf, sizeof (buf), "%s/e-module-empris.edj",
	    e_module_dir_get (empris_config->module));
  con = e_container_current_get (e_manager_current_get ());
  cfd =
    e_config_dialog_new (con, D_ ("Empris Configuration"), "Empris",
			 "_e_modules_empris_config_dialog", buf, 0, v, ci);
  empris_config->config_dialog = cfd;
}
示例#21
0
文件: e_mod_config.c 项目: Limsik/e17
void
_config_itask_module(Config_Item *ci)
{
   E_Config_Dialog_View *v;
   char buf[4096];

   v = E_NEW(E_Config_Dialog_View, 1);

   /* Dialog Methods */
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _basic_apply_data;
   v->basic.create_widgets = _basic_create_widgets;
   v->advanced.apply_cfdata = NULL;
   v->advanced.create_widgets = NULL;

   /* Create The Dialog */
   snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(itask_config->module));
   ci->cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
				 D_("ITask Configuration"),
				 "E", "_e_mod_itask_config_dialog",
				 buf, 0, v, ci);
}
void
_config_tclock_module(Config_Item *ci)
{
   E_Config_Dialog *cfd = NULL;
   E_Config_Dialog_View *v = NULL;
   E_Container *con = NULL;
   char buf[PATH_MAX];

   if (e_config_dialog_find("TClock", "_e_modules_tclock_config_dialog")) 
     return;

   v = E_NEW(E_Config_Dialog_View, 1);
   v->create_cfdata = _create_data;
   v->free_cfdata = _free_data;
   v->basic.apply_cfdata = _basic_apply;
   v->basic.create_widgets = _basic_create;

   snprintf(buf, sizeof(buf), "%s/e-module-tclock.edj", 
            tclock_config->mod_dir);
   con = e_container_current_get(e_manager_current_get());
   cfd = e_config_dialog_new(con, D_("Tclock Settings"), "TClock", 
                              "_e_modules_tclock_config_dialog", buf, 0, v, ci);
   tclock_config->config_dialog = cfd;
}
示例#23
0
文件: itask_menu.c 项目: Limsik/e17
static void
_itask_menu_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
   Evas_Event_Mouse_Down *ev;
   Itask *it;
   E_Menu *m;
   E_Menu_Item *mi;

   int cx, cy, cw, ch;
   Evas_Coord x, y, w, h;
   int dir;

   it = data;
   ev = event_info;

   if (ev->button == 3)
     {
	m = e_menu_new();
	e_menu_post_deactivate_callback_set(m, _itask_menu_cb_config_post, NULL);

	m = e_menu_new();
	mi = e_menu_item_new(m);
	e_menu_item_label_set(mi, D_("Settings"));
	e_util_menu_item_theme_icon_set(mi, "enlightenment/configuration");
	e_menu_item_callback_set(mi, _itask_menu_cb_configuration, it);

	m = e_gadcon_client_util_menu_items_append(it->gcc, m, 0);
     }
   else if (ev->button == 1)
     {
	/* if(it->ci->menu_all_window) */
	m = itask_menu_items_menu(it->items);
	/* else
	 *   m = itask_menu_items_menu(it->items_menu); */
     }
   if (m)
     {
	e_menu_post_deactivate_callback_set(m, _itask_menu_cb_post, NULL);
	evas_object_geometry_get(it->o_button, &x, &y, &w, &h);
	e_gadcon_canvas_zone_geometry_get(it->gcc->gadcon,
					  &cx, &cy, &cw, &ch);
	x += cx;
	y += cy;

	dir = E_MENU_POP_DIRECTION_AUTO;
	switch (it->gcc->gadcon->orient)
	  {
	   case E_GADCON_ORIENT_TOP:
	   case E_GADCON_ORIENT_CORNER_TL:
	   case E_GADCON_ORIENT_CORNER_TR:
	      dir = E_MENU_POP_DIRECTION_DOWN;
	      break;
	   case E_GADCON_ORIENT_BOTTOM:
	   case E_GADCON_ORIENT_CORNER_BL:
	   case E_GADCON_ORIENT_CORNER_BR:
	      dir = E_MENU_POP_DIRECTION_UP;
	      break;
	   case E_GADCON_ORIENT_LEFT:
	   case E_GADCON_ORIENT_CORNER_LT:
	   case E_GADCON_ORIENT_CORNER_LB:
	      dir = E_MENU_POP_DIRECTION_RIGHT;
	      break;
	   case E_GADCON_ORIENT_RIGHT:
	   case E_GADCON_ORIENT_CORNER_RT:
	   case E_GADCON_ORIENT_CORNER_RB:
	      dir = E_MENU_POP_DIRECTION_LEFT;
	      break;
	   case E_GADCON_ORIENT_FLOAT:
	   case E_GADCON_ORIENT_HORIZ:
	   case E_GADCON_ORIENT_VERT:
	   default:
	      dir = E_MENU_POP_DIRECTION_AUTO;
	      break;
	  }
	e_menu_activate_mouse(m,
			      e_util_zone_current_get(e_manager_current_get()),
			      x, y, w, h,
			      dir, ev->timestamp);

     }
}
示例#24
0
/**
 * Handle clicking on the face.
 *
 * While this callback is not a menu callback, currently all face clicks
 * that do anything popup a menu.  This will change as more emu commands
 * are implemented
 *
 * @param   data the pointer you passed to evas_object_event_callback_add().
 * @param   e not used.
 * @param   obj not used.
 * @param   event_info pointer to the event.
 * @ingroup Emu_Module_Menu_Group
 */
static void
_emu_face_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
   Emu_Face *emu_face;
   Evas_Event_Mouse_Down *ev;

   emu_face = data;
   ev = event_info;
//   if ((ev->button == 3) && emu_face->face->menu)
//     {                          /* Right click configuration menu. */
//        e_menu_activate_mouse(emu_face->face->menu,
//                              e_zone_current_get(emu_face->face->con), ev->output.x, ev->output.y, 1, 1, E_MENU_POP_DIRECTION_AUTO,
//                              ev->timestamp);
//     }
   /*else*/ if (ev->button == 1)
     {                          /* Left click default menu. */
        Easy_Menu *menu;
	Evas_Coord x, y, w, h;
	int cx, cy, cw, ch;
	
	evas_object_geometry_get(emu_face->o_button, &x, &y, &w, &h); 
	e_gadcon_canvas_zone_geometry_get(emu_face->gcc->gadcon, &cx, &cy, &cw, &ch);
	x += cx;
	y += cy;

        /* Find the default menu, if there is one. */
        menu = eina_hash_find(emu_face->menus, "");
        if (menu && menu->valid)
          {
	     int dir;
	     
             e_menu_post_deactivate_callback_set(menu->menu->menu, _emu_menu_cb_post_deactivate, emu_face);
	     dir = E_MENU_POP_DIRECTION_AUTO;
	     switch (emu_face->gcc->gadcon->orient)
	       {
		case E_GADCON_ORIENT_TOP:
		  dir = E_MENU_POP_DIRECTION_DOWN;
		  break;
		case E_GADCON_ORIENT_BOTTOM:
		  dir = E_MENU_POP_DIRECTION_UP;
		  break;
		case E_GADCON_ORIENT_LEFT:
		  dir = E_MENU_POP_DIRECTION_RIGHT;
		  break;
		case E_GADCON_ORIENT_RIGHT:
		  dir = E_MENU_POP_DIRECTION_LEFT;
		  break;
		case E_GADCON_ORIENT_CORNER_TL:
		  dir = E_MENU_POP_DIRECTION_DOWN;
		  break;
		case E_GADCON_ORIENT_CORNER_TR:
		  dir = E_MENU_POP_DIRECTION_DOWN;
		  break;
		case E_GADCON_ORIENT_CORNER_BL:
		  dir = E_MENU_POP_DIRECTION_UP;
		  break;
		case E_GADCON_ORIENT_CORNER_BR:
		  dir = E_MENU_POP_DIRECTION_UP;
		  break;
		case E_GADCON_ORIENT_CORNER_LT:
		  dir = E_MENU_POP_DIRECTION_RIGHT;
		  break;
		case E_GADCON_ORIENT_CORNER_RT:
		  dir = E_MENU_POP_DIRECTION_LEFT;
		  break;
		case E_GADCON_ORIENT_CORNER_LB:
		  dir = E_MENU_POP_DIRECTION_RIGHT;
		  break;
		case E_GADCON_ORIENT_CORNER_RB:
		  dir = E_MENU_POP_DIRECTION_LEFT;
		  break;
		case E_GADCON_ORIENT_FLOAT:
		case E_GADCON_ORIENT_HORIZ:
		case E_GADCON_ORIENT_VERT:
		default:
		  dir = E_MENU_POP_DIRECTION_AUTO;
		  break;
	       }
//             e_menu_activate_mouse(menu->menu->menu, e_zone_current_get(emu_face->face->con), ev->output.x, ev->output.y, 1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
	     e_menu_activate_mouse(menu->menu->menu, e_util_zone_current_get(e_manager_current_get()), x, y, w, h, dir, ev->timestamp);
	     edje_object_signal_emit(emu_face->o_button, "active", "");
	     evas_event_feed_mouse_up(emu_face->gcc->gadcon->evas, ev->button, EVAS_BUTTON_NONE, ev->timestamp, NULL);
          }
     }
}
示例#25
0
static int
_basic_apply_data(E_Config_Dialog      *cfd,
                  E_Config_Dialog_Data *cfdata)
{
   int need_rearrangement =
     memcmp(cfdata, tiling_g.config, sizeof(Config) - (sizeof(char *) * 2) - sizeof(Eina_List *));

   if (!need_rearrangement)
     {
        if (cfdata->tiling_border && tiling_g.config->tiling_border)
          need_rearrangement = strcmp(cfdata->tiling_border, tiling_g.config->tiling_border);
        else if (cfdata->tiling_border || tiling_g.config->tiling_border)
          need_rearrangement = 1;
     }

   if (!need_rearrangement)
     {
        if (cfdata->floating_border && tiling_g.config->floating_border)
          need_rearrangement = strcmp(cfdata->floating_border, tiling_g.config->floating_border);
        else if (cfdata->floating_border || tiling_g.config->floating_border)
          need_rearrangement = 1;
     }

   if (!need_rearrangement)
     {
        /* Check if the layout for one of the vdesks has changed */
         Eina_List *l;
         for (l = tiling_g.config->vdesks; l; l = l->next)
           {
              struct _E_Config_vdesk *vd = l->data,
              *newvd;
              if (!vd || !(newvd = get_vdesk(cfdata, vd->x, vd->y, vd->zone_num))) continue;
              if (newvd->layout != vd->layout)
                {
                   E_Zone *zone = e_zone_current_get(e_container_current_get(e_manager_current_get()));
                   E_Desk *desk = e_desk_current_get(zone);
                   if (desk->x == vd->x && desk->y == vd->y && zone->num == vd->zone_num)
                     {
                        need_rearrangement = 1;
                        break;
                     }
                }
           }
     }

   if (tiling_g.config->floating_border)
     free(tiling_g.config->floating_border);
   if (tiling_g.config->tiling_border)
     free(tiling_g.config->tiling_border);
   memcpy(tiling_g.config, cfdata, sizeof(Config));

   cfdata->floating_border = NULL;
   cfdata->tiling_border = NULL;
   cfdata->vdesks = NULL;

   e_config_save_queue();

   if (need_rearrangement)
     e_mod_tiling_rearrange();

   return 1;
}
示例#26
0
static void
_ng_border_menu_cb_new(void *data, E_Menu *m, E_Menu_Item *mi)
{
   E_Border *bd = (E_Border *)data;
   e_exec(e_util_zone_current_get(e_manager_current_get()), bd->desktop, NULL, NULL, NULL);
}
static void
_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
   Instance *inst;
   Evas_Event_Mouse_Down *ev;
   
   inst = data;
   ev = event_info;
   if ((ev->button == 3) && (!alarm_config->menu))
     {
	E_Menu *m;
	E_Menu_Item *mi;
	int cx, cy, cw, ch;
        int nb_snoozed = 0;
	
	m = e_menu_new();
	mi = e_menu_item_new(m);
	e_menu_item_label_set(mi, D_("Add an alarm"));
	e_menu_item_callback_set(mi, _menu_cb_alarm_add, NULL);
        if (!alarm_config->theme) e_util_menu_item_theme_icon_set(mi, THEME_ICON_ALARM_ON);
        else e_menu_item_icon_edje_set(mi, alarm_config->theme, THEME_ICON_ALARM_ON);
        mi = e_menu_item_new(m);
        e_menu_item_separator_set(mi, 1);
	mi = e_menu_item_new(m);
	e_menu_item_label_set(mi, D_("Settings"));
	e_util_menu_item_theme_icon_set(mi, "preferences-system");
	e_menu_item_callback_set(mi, _menu_cb_configure, NULL);
	
	m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);

        /* snooze menu */
        if (alarm_config->alarms_state == ALARM_STATE_RINGING)
          {
             Eina_List *l;

             for (l=alarm_config->alarms; l; l=eina_list_next(l))
               {
                  Alarm *al;
                  al = eina_list_data_get(l);
                  if (al->state == ALARM_STATE_RINGING)
                    {
                       char buf[30];
                       snprintf(buf, sizeof(buf), D_("Snooze %s"), al->name);
                       mi = e_menu_item_new_relative(m, NULL);
                       e_menu_item_label_set(mi, buf);
                       e_menu_item_callback_set(mi, _menu_cb_alarm_snooze, al);
                       if (!alarm_config->theme) e_util_menu_item_theme_icon_set(mi, THEME_ICON_SNOOZE);
                       else e_menu_item_icon_edje_set(mi, alarm_config->theme, THEME_ICON_SNOOZE);
                       if (al->snooze.remember)
                         {
                            snprintf(buf, sizeof(buf), D_("Snooze %.14s of %.2d:%.2d"),
                                     al->name, al->snooze.hour, al->snooze.minute);
                            mi = e_menu_item_new_relative(m, NULL);
                            e_menu_item_label_set(mi, buf);
                            e_menu_item_callback_set(mi, _menu_cb_alarm_snooze, al);
                         }
                       nb_snoozed = 1;
                    }
               }
          }

        if (!nb_snoozed)
          {
             mi = e_menu_item_new_relative(m, NULL);
             e_menu_item_label_set(mi, D_("Snooze (No alarm to delay)"));
             if (!alarm_config->theme) e_util_menu_item_theme_icon_set(mi, THEME_ICON_SNOOZE);
             else e_menu_item_icon_edje_set(mi, alarm_config->theme, THEME_ICON_SNOOZE);
          }

	e_menu_post_deactivate_callback_set(m, _menu_cb_deactivate_post, inst);
	alarm_config->menu = m;	
	e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon,
					  &cx, &cy, &cw, &ch);
	e_menu_activate_mouse(m,
			      e_util_zone_current_get(e_manager_current_get()),
			      cx + ev->output.x, cy + ev->output.y, 1, 1,
			      E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
	evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button,
				 EVAS_BUTTON_NONE, ev->timestamp, NULL);
     }
}
示例#28
0
/*
 * Validate the entered configuration. Display and error message
 * if required.
 */
static int parse_config_gui(E_Config_Dialog_Data *cfdata)
{
   E_Dialog *error_popup;
   char error_message[1024];
   int config_ok = 1;
   char *end_pointer;
   float parsed_float;
   const char *text_value;
   regex_t *reg_expression;
   int regex_result;
   char *viewpos_file;
   float lat, lon;

   sprintf(error_message, "The configuration you have entered is invalid:<br>");

   if (cfdata->local_xplanet.source_type == SOURCE_ORIGIN)
      cfdata->local_xplanet.origin = strdup(e_widget_ilist_selected_value_get(cfdata->gui.o_source_ilist));
   else
      cfdata->local_xplanet.projection = strdup(e_widget_ilist_selected_value_get(cfdata->gui.o_source_ilist));

   if (cfdata->local_xplanet.source_type == SOURCE_ORIGIN)
   {
      if (strcmp(cfdata->local_xplanet.body, "random") && !strcmp(cfdata->local_xplanet.body, cfdata->local_xplanet.origin))
      {
         sprintf(error_message + strlen(error_message),
            "<br>* Target and origin cannot be the same.");
         config_ok = 0;
      }
   }

   switch (cfdata->local_xplanet.viewpos_type)
   {
   case VIEWPOS_LATLON:
   {
      end_pointer = (char *)e_widget_entry_text_get(cfdata->gui.o_viewpos_lat);
      if (strlen(end_pointer) == 0)
      {
         sprintf(error_message + strlen(error_message),
               "<br>* You must enter a latitude.");
         config_ok = 0;
      }
      else
      {
         parsed_float = strtof(e_widget_entry_text_get(cfdata->gui.o_viewpos_lat),
               &end_pointer);
         if (*end_pointer != '\0' || parsed_float < -90.0 || parsed_float > 90.0)
         {
            sprintf(error_message + strlen(error_message),
                  "<br>* The entered latitude is invalid - must be in the range -90 to 90.");
            config_ok = 0;
         }
         else cfdata->local_xplanet.viewpos_lat = parsed_float;
      }

      end_pointer = (char *)e_widget_entry_text_get(cfdata->gui.o_viewpos_lon);
      if (strlen(end_pointer) == 0)
      {
         sprintf(error_message + strlen(error_message),
               "<br>* You must enter a longitude.");
         config_ok = 0;
      }
      else
      {
         parsed_float = strtof(e_widget_entry_text_get(cfdata->gui.o_viewpos_lon),
               &end_pointer);
         if (*end_pointer != '\0' || parsed_float < -180.0 || parsed_float > 360.0)
         {
            sprintf(error_message + strlen(error_message),
                  "<br>* The entered longitude is invalid - must be in the range 0 to 360 or -180 to 180");
            config_ok = 0;
         }
         else cfdata->local_xplanet.viewpos_lon = parsed_float;
      }
      break;
   }
   case VIEWPOS_FILE:
   {
      lat = INVALID_COORD;
      lon = INVALID_COORD;

      viewpos_file = (char *)e_widget_entry_text_get(cfdata->gui.o_viewpos_file_val);
      switch(read_viewpos_file(viewpos_file, &lat, &lon))
      {
      case VIEWPOS_FILE_NO_PERM:
      {
         sprintf(error_message + strlen(error_message),
               "<br>* No permissions to read viewing position file");
         config_ok = 0;
         break;
      }
      case VIEWPOS_FILE_NOT_FOUND:
      {
         sprintf(error_message + strlen(error_message),
               "<br>* The viewing position file cannot be found");
         config_ok = 0;
         break;
      }
      case VIEWPOS_FILE_IS_DIR:
      {
         sprintf(error_message + strlen(error_message),
               "<br>* The viewing position file is a directory");
         config_ok = 0;
         break;
      }
      case VIEWPOS_FILE_FORMAT_ERROR:
      {
         sprintf(error_message + strlen(error_message),
               "<br>* The viewing position file is in the wrong format (must be 2 numbers, lat then lon)");
         config_ok = 0;
         break;
      }
      case VIEWPOS_FILE_OK:
         cfdata->local_xplanet.viewpos_file = (char *)eina_stringshare_add(viewpos_file);
         break;
      }
      break;
   }
   default:
      break;
   }

   cfdata->local_xplanet.use_localtime = e_widget_check_checked_get(cfdata->gui.o_use_localtime);
   cfdata->local_xplanet.localtime = cfdata->gui.o_localtime;

   cfdata->local_xplanet.show_label = e_widget_check_checked_get(cfdata->gui.o_show_label);
   cfdata->local_xplanet.label_text = strdup(e_widget_entry_text_get(cfdata->gui.o_label_text));

   text_value = strdup(e_widget_entry_text_get(cfdata->gui.o_label_pos_other_text));
   if (!text_value || strlen(text_value) == 0)
   {
      cfdata->local_xplanet.label_pos_other = "";
      if (cfdata->local_xplanet.label_pos == LABEL_POS_OTHER)
      {
         sprintf(error_message + strlen(error_message),
               "<br>* You have not entered a label position");
         config_ok = 0;
      }
   }
   else
   {
      reg_expression = E_NEW(regex_t, 1);
      regcomp(reg_expression, "^[+-][0-9][0-9]*[+-][0-9][0-9]*$", 0);
      regex_result = regexec(reg_expression, text_value, 0, NULL, 0);
      if (regex_result)
      {
         sprintf(error_message + strlen(error_message),
               "<br>* The entered label position is invalid - must be of the form -15+15");
         config_ok = 0;
      }
      else cfdata->local_xplanet.label_pos_other = text_value;

      regfree(reg_expression);
      free(reg_expression);
   }

   cfdata->local_xplanet.use_config = e_widget_check_checked_get(cfdata->gui.o_config_check);
   cfdata->local_xplanet.config_name = strdup(e_widget_entry_text_get(cfdata->gui.o_config_name));

   cfdata->local_xplanet.extra_options = strdup(e_widget_entry_text_get(cfdata->gui.o_extra_options));

   if (!config_ok)
   {
      error_popup = e_dialog_new(e_container_current_get(
            e_manager_current_get()), "eplanet_error", "eplanet/error");
      e_dialog_title_set(error_popup, "Configuration error");
      e_dialog_text_set(error_popup, (const char *) &error_message);
      e_dialog_button_add(error_popup, D_("OK"), NULL, NULL, NULL);
      e_dialog_show(error_popup);
   }

   return config_ok;
}
示例#29
0
/* Delete previous copy of config profile and save new one */
#include "e_wizard.h"

static void
_e_int_menus_bodhi_quick_start(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
   E_Zone *zone;
   char buff[PATH_MAX];

   snprintf(buff, sizeof(buff), "enlightenment_open "
            "file:///usr/share/bodhi/quickstart/quickstartEN/index.html");
   zone = e_util_zone_current_get(e_manager_current_get());
   e_exec(zone, NULL, buff, NULL, NULL);
}

#if 0
EAPI int
wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
   return 1;
}

EAPI int
wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
{
   return 1;
}

EAPI int
wizard_page_show(E_Wizard_Page *pg __UNUSED__)
{
示例#30
0
static void
_mail_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
		     void *event_info)
{
  Instance *inst = data;
  Evas_Event_Mouse_Down *ev = event_info;
  Eina_List *l;

  if (!inst)
    return;
  if ((ev->button == 3) && (!mail_config->menu))
    {
      E_Menu *m;
      E_Menu_Item *mi;
      int x, y, w, h;
      char buf[1024];

      m = e_menu_new ();
      mi = e_menu_item_new (m);
      e_menu_item_label_set (mi, D_("Settings"));
      e_util_menu_item_theme_icon_set(mi, "preferences-system");
      e_menu_item_callback_set (mi, _mail_menu_cb_configure, inst);

      m = e_gadcon_client_util_menu_items_append (inst->gcc, m, 0);
      e_menu_post_deactivate_callback_set (m, _mail_menu_cb_post, inst);
      mail_config->menu = m;

      if ((inst->ci->boxes) && (eina_list_count (inst->ci->boxes) > 0))
	{
	   mi = NULL;
	   snprintf (buf, sizeof (buf), "%s/module.edj",
		     e_module_dir_get (mail_config->module));

	   for (l = inst->ci->boxes; l; l = l->next)
	     {
		Config_Box *cb;

		cb = l->data;
		if (!cb)
		  continue;
		mi = e_menu_item_new_relative (m, mi);
		snprintf (buf, sizeof (buf), "%s: %d/%d", cb->name, cb->num_new,
			  cb->num_total);
		e_menu_item_label_set (mi, buf);
		if ((cb->exec) && (cb->use_exec))
		  e_menu_item_callback_set (mi, _mail_menu_cb_exec, cb);
	     }
	   if (mi)
	     {
		mi = e_menu_item_new_relative(m, mi);
		e_menu_item_separator_set(mi, 1); 
	     }
	}

      e_gadcon_canvas_zone_geometry_get (inst->gcc->gadcon, &x, &y, &w, &h);
      e_menu_activate_mouse (m,
			     e_util_zone_current_get (e_manager_current_get
						      ()), x + ev->output.x,
			     y + ev->output.y, 1, 1,
			     E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
      evas_event_feed_mouse_up (inst->gcc->gadcon->evas, ev->button,
				EVAS_BUTTON_NONE, ev->timestamp, NULL);
    }
  else if (ev->button == 1)
    _mail_cb_check (inst);
}