示例#1
0
void
_cpuclock_set_frequency(int frequency)
{
   char buf[4096 + 100], exe[4096];
   struct stat st;

#if defined(__FreeBSD__) || defined(__DragonFly__)
   frequency /= 1000;
#endif

#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
   snprintf(exe, sizeof(exe), "%s/%s/cpuclock_sysctl",
            e_module_dir_get(sysinfo_config->module), MODULE_ARCH);
   if (stat(exe, &st) < 0) return;
   snprintf(buf, sizeof(buf), "%s %d", exe, frequency);
   if (system(buf) != 0)
     ERR("Error code from trying to run \"%s\"", buf);
#else
   snprintf(exe, 4096, "%s/%s/cpuclock_sysfs",
            e_module_dir_get(sysinfo_config->module), MODULE_ARCH);
   if (stat(exe, &st) < 0) return;
   snprintf(buf, sizeof(buf),
            "%s %s %i", exe, "frequency", frequency);
   if (system(buf) != 0)
     ERR("Error code from trying to run \"%s\"", buf);
#endif
}
示例#2
0
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;
   Evas *evas;
   Instance *inst;
   char buf[4096];

   inst = E_NEW (Instance, 1);

   inst->ci = _empris_config_item_get (id);
   if (!inst->ci->id)
     inst->ci->id = eina_stringshare_add (id);

   o = edje_object_add (gc->evas);
   snprintf (buf, sizeof (buf), "%s/empris.edj",
	     e_module_dir_get (empris_config->module));
   if (!e_theme_edje_object_set
       (o, "base/theme/modules/empris", "modules/empris/main"))
     edje_object_file_set (o, buf, "modules/empris/main");
   evas_object_show (o);

   gcc = e_gadcon_client_new (gc, name, id, style, o);
   gcc->data = inst;
   inst->gcc = gcc;
   inst->empris = o;

   _empris_popup_create(inst, buf);

   evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
				   _empris_cb_mouse_down, inst);
   evas_object_event_callback_add (inst->empris, EVAS_CALLBACK_MOUSE_IN,
				   _empris_cb_mouse_in, inst);
   evas_object_event_callback_add (inst->empris, EVAS_CALLBACK_MOUSE_OUT,
				   _empris_cb_mouse_out, inst);
   edje_object_signal_callback_add (o, "empris,play", "", _empris_cb_play,
				    inst);
   edje_object_signal_callback_add (o, "empris,stop", "", _empris_cb_stop,
				    inst);
   edje_object_signal_callback_add (o, "empris,pause", "", _empris_cb_pause,
				    inst);
   edje_object_signal_callback_add (o, "empris,next", "", _empris_cb_next,
				    inst);
   edje_object_signal_callback_add (o, "empris,previous", "",
				    _empris_cb_previous, inst);

   inst->cb_player_track_change = e_dbus_signal_handler_add
     (conn, bus_name, "/Player", mpris_interface, "TrackChange",
      _dbus_cb_track_change, inst);

   inst->cb_player_status_change = e_dbus_signal_handler_add
     (conn, bus_name, "/Player", mpris_interface, "StatusChange",
      _dbus_cb_status_change, inst);

   _dbus_send_msg("/TrackList", "GetCurrentTrack", _dbus_cb_current_track, inst);
  
   empris_config->instances = eina_list_append (empris_config->instances, inst);
   return gcc;
}
static void
_forecasts_display_set(Instance *inst, int ok)
{
   char buf[4096];
   char m[4096];

   if (!inst)
     return;

   snprintf(m, sizeof(m), "%s/forecasts.edj",
            e_module_dir_get(forecasts_config->module));
   snprintf(buf, sizeof(buf), "modules/forecasts/icons/%d", inst->condition.code);
   if (!e_theme_edje_object_set(inst->forecasts->icon_obj,
                                "base/theme/modules/forecasts/icons", buf))
     edje_object_file_set(inst->forecasts->icon_obj, m, buf);
   edje_object_part_swallow(inst->forecasts->forecasts_obj, "icon", inst->forecasts->icon_obj);

   if (!inst->ci->show_text)
     edje_object_signal_emit(inst->forecasts_obj, "e,state,description,hide", "e");
   else
     edje_object_signal_emit(inst->forecasts_obj, "e,state,description,show", "e");

   snprintf(buf, sizeof(buf), "%d°%c", inst->condition.temp, inst->units.temp);
   edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.temp", buf);
   edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.description",
                             inst->condition.desc);
   edje_object_part_text_set(inst->forecasts->forecasts_obj, "e.text.location", inst->location);

   if (inst->gcc->gadcon->orient == E_GADCON_ORIENT_FLOAT)
      _right_values_update(inst); //Updating right two icons description

   if (inst->popup) _forecasts_popup_destroy(inst);
   inst->popup = NULL;
}
static Forecasts *
_forecasts_new(Evas *evas)
{
   Forecasts *w;
   char buf[4096];

   w = E_NEW(Forecasts, 1);

   w->forecasts_obj = edje_object_add(evas);

   snprintf(buf, sizeof(buf), "%s/forecasts.edj",
            e_module_dir_get(forecasts_config->module));
   if (!e_theme_edje_object_set(w->forecasts_obj, "base/theme/modules/forecasts",
                                "modules/forecasts/main"))
     edje_object_file_set(w->forecasts_obj, buf, "modules/forecasts/main");
   evas_object_show(w->forecasts_obj);

   w->icon_obj = edje_object_add(evas);
   if (!e_theme_edje_object_set(w->icon_obj, "base/theme/modules/forecasts/icons",
                                "modules/forecasts/icons/3200"))
     edje_object_file_set(w->icon_obj, buf, "modules/forecasts/icons/3200");
   edje_object_part_swallow(w->forecasts_obj, "icon", w->icon_obj);

   return w;
}
示例#5
0
    static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
    Instance *inst;
    E_Gadcon_Client *gcc;
    char buf[PATH_MAX];

    snprintf(buf, sizeof(buf), "%s/exalt.edj", e_module_dir_get(exalt_config->module));

    inst = E_NEW(Instance, 1);
    inst->o_button = edje_object_add(gc->evas);
    if (!e_theme_edje_object_set(inst->o_button, "base/theme/modules/exalt",
                "modules/exalt/main"))
        edje_object_file_set(inst->o_button, buf, "e/modules/exalt/main");

    gcc = e_gadcon_client_new(gc, name, id, style, inst->o_button);
    gcc->data = inst;
    inst->gcc = gcc;

    evas_object_event_callback_add(inst->o_button, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down, inst);

    exalt_config->instances = evas_list_append(exalt_config->instances, inst);

    exalt_dbus_notify_set( exalt_config->conn, _exalt_notify_cb, inst);

    return gcc;
}
示例#6
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;
}
示例#7
0
文件: e_mod_main.c 项目: gzorin/e17
EAPI void *
e_modapi_init(E_Module *m)
{
   char buf[4096];

   snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
   bindtextdomain(PACKAGE, buf);
   bind_textdomain_codeset(PACKAGE, "UTF-8");

   news = E_NEW(News, 1);
   news->module = m;

   DMAIN(("Initialisation ..."));

   if (!news_config_init()) E_MOD_INIT_FAIL(m, D_("Config init failed"));
   if (!news_parse_init())  E_MOD_INIT_FAIL(m, D_("Parser init failed"));
   if (!news_feed_init())   E_MOD_INIT_FAIL(m, D_("Feeds init failed"));
   if (!news_viewer_init()) E_MOD_INIT_FAIL(m, D_("Viewer init failed"));
   if (!news_popup_init()) E_MOD_INIT_FAIL(m, D_("Popup subsystem init failed"));

   e_gadcon_provider_register((E_Gadcon_Client_Class *)&_gadcon_class);

   DMAIN(("Initialisation END"));

   return m;
}
//static E_Config_Dialog *
//_pager_config_dialog(E_Container *con, const char *params)
E_Config_Dialog *
e_int_config_penguins_module(E_Container *con, const char *params)
{
   E_Config_Dialog *cfd;
   E_Config_Dialog_View *v;
   char buf[4096];
   Population *pop;

   pop = penguins_mod->data;
   if (e_config_dialog_find("Penguins", "appearance/penguins")) return NULL;
   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-penguins.edj", e_module_dir_get(pop->module));
   cfd = e_config_dialog_new(con,
			     D_("Population Settings"),
			     "Penguins", "appearance/penguins",
			     buf, 0, v, pop);
   pop->config_dialog = cfd;
   return cfd;
}
示例#9
0
E_API void *
e_modapi_init(E_Module *m)
{
   Eina_List *files;
   char buf[PATH_MAX];
   char *file;

   wiz_module = m;
   e_wizard_init();

   e_config->scale.use_dpi = 0;
   e_config->scale.use_custom = 1;
   e_config->scale.factor = 1.2;
   e_scale_update();
   snprintf(buf, sizeof(buf), "%s/%s", e_module_dir_get(m), MODULE_ARCH);
   files = ecore_file_ls(buf);
   files = eina_list_sort(files, 0, (Eina_Compare_Cb)_cb_sort_files);
   EINA_LIST_FREE(files, file)
     {
        if ((!strncmp(file, "page_", 5)) && (eina_str_has_extension(file, ".so")))
          {
             void *handle;

             snprintf(buf, sizeof(buf), "%s/%s/%s",
                      e_module_dir_get(m), MODULE_ARCH, file);
             handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
             if (handle)
               e_wizard_page_add(handle,
                                 dlsym(handle, "wizard_page_init"),
                                 dlsym(handle, "wizard_page_shutdown"),
                                 dlsym(handle, "wizard_page_show"),
                                 dlsym(handle, "wizard_page_hide"),
                                 dlsym(handle, "wizard_page_apply"));
             else
               {
                  // if its an executable...
                  // XXX
                  // else...
                  printf("%s\n", dlerror());
               }
          }
        free(file);
     }
   e_wizard_go();

   return m;
}
示例#10
0
/**
 * Setup basic module.
 *
 * It is called when the module is enabled.
 *
 * @param   m a pointer to your E_Module structure.
 * @return  This becomes m->data, return NULL if this falied, and you won't get enabled.
 * @ingroup Emu_Module_Basic_Group
 */
EAPI void *
e_modapi_init(E_Module *m)
{
   char buf[4096];

   emu_module = m;
   snprintf(buf, sizeof(buf), "%s/e-module-emu.edj", e_module_dir_get(m));
   _emu_module_edje = eina_stringshare_add(buf);
   /* Set up module's message catalogue */
   snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
   bindtextdomain(PACKAGE, buf);
   bind_textdomain_codeset(PACKAGE, "UTF-8");

   e_gadcon_provider_register(&_gadcon_class);

   return m;
}
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;
   Instance *inst;
   
   inst = E_NEW(Instance, 1);
   
   o = edje_object_add(gc->evas);

   if (alarm_config->theme)
     {
        char buf[4096];
        snprintf(buf, sizeof(buf), "%s/alarm.edj", e_module_dir_get(alarm_config->module));
        edje_object_file_set(o, buf, THEME_MAIN);
     }
   else
     e_theme_edje_object_set(o, THEME_IN_E, THEME_MAIN);

   edje_object_signal_callback_add(o, EDJE_SIG_RECV_ALARM_STATE_ON,
				   _cb_edje_alarm_state_on, NULL);
   edje_object_signal_callback_add(o, EDJE_SIG_RECV_ALARM_STATE_OFF,
				   _cb_edje_alarm_state_off, NULL);
   edje_object_signal_callback_add(o, EDJE_SIG_RECV_ALARM_RING_STOP,
				   _cb_edje_alarm_ring_stop, NULL);

   gcc = e_gadcon_client_new(gc, name, id, style, o);
   gcc->data = inst;
   
   inst->gcc = gcc;
   inst->obj = o;
   inst->orient = E_GADCON_ORIENT_HORIZ;

   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
				  _button_cb_mouse_down, inst);

   alarm_config->instances = eina_list_append(alarm_config->instances, inst);

   alarm_details_change();

   switch (alarm_config->alarms_state)
     {
     case ALARM_STATE_ON:
        edje_object_signal_emit(o, EDJE_SIG_SEND_ALARM_STATE_ON);
        break;
     case ALARM_STATE_OFF:
        edje_object_signal_emit(o, EDJE_SIG_SEND_ALARM_STATE_OFF);
        break;
     case ALARM_STATE_RINGING:
        edje_object_signal_emit(o, EDJE_SIG_SEND_ALARM_RING_START);
        break;
     }

   e_config_save_queue();

   return gcc;
}
示例#12
0
EAPI void *
e_modapi_init (E_Module * m)
{
   char buf[4096];

   snprintf (buf, sizeof (buf), "%s/locale", e_module_dir_get (m));
   bindtextdomain (PACKAGE, buf);
   bind_textdomain_codeset (PACKAGE, "UTF-8");

   conf_item_edd = E_CONFIG_DD_NEW ("Empris_Config_Item", Config_Item);
#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
   E_CONFIG_VAL (D, T, id, STR);
   E_CONFIG_VAL (D, T, player, STR);
   E_CONFIG_VAL (D, T, show_popup, UCHAR);

   conf_edd = E_CONFIG_DD_NEW ("Empris_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
   E_CONFIG_LIST (D, T, items, conf_item_edd);

   empris_config = e_config_domain_load ("module.empris", conf_edd);
   if (!empris_config)
     {
	Config_Item *ci;

	empris_config = E_NEW (Config, 1);

	ci = E_NEW (Config_Item, 1);
	ci->id = eina_stringshare_add ("0");
	ci->player = eina_stringshare_add ("");
	ci->show_popup = 1;

	empris_config->items = eina_list_append (empris_config->items, ci);
     }
   empris_config->module = m;

   conn = e_dbus_bus_get(DBUS_BUS_SESSION);

   if (!conn) return NULL;
   
   cb_name_owner_changed = e_dbus_signal_handler_add
     (conn, fdo_bus_name, fdo_path, fdo_interface, "NameOwnerChanged",
      _dbus_cb_name_owner_changed, NULL);

   e_dbus_list_names(conn, _dbus_cb_list_names, NULL);
  
   e_gadcon_provider_register (&_gc_class);

   e_module_delayed_set(m, 1);
  
   return m;
}
示例#13
0
EAPI void *
e_modapi_init(E_Module *m)
{
   char buf[4095];

   snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
   bindtextdomain(PACKAGE, buf);
   bind_textdomain_codeset(PACKAGE, "UTF-8");

   conf_item_edd = E_CONFIG_DD_NEW("Forecasts_Config_Item", Config_Item);
#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
   E_CONFIG_VAL(D, T, id, STR);
   E_CONFIG_VAL(D, T, poll_time, DOUBLE);
   E_CONFIG_VAL(D, T, days, DOUBLE);
   E_CONFIG_VAL(D, T, degrees, INT);
   E_CONFIG_VAL(D, T, host, STR);
   E_CONFIG_VAL(D, T, code, STR);
   E_CONFIG_VAL(D, T, show_text, INT);
   E_CONFIG_VAL(D, T, popup_on_hover, INT);
   E_CONFIG_VAL(D, T, by_code, INT);

   conf_edd = E_CONFIG_DD_NEW("Forecasts_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
   E_CONFIG_LIST(D, T, items, conf_item_edd);

   forecasts_config = e_config_domain_load("module.forecasts", conf_edd);
   if (!forecasts_config)
     {
        Config_Item *ci;

        forecasts_config = E_NEW(Config, 1);

        ci = E_NEW(Config_Item, 1);
        ci->poll_time = 60.0;
        ci->days = 15.0;
        ci->degrees = DEGREES_C;
        ci->host = eina_stringshare_add("query.yahooapis.com");
        ci->code = eina_stringshare_add(DEFAULT_LOCATION);
        ci->id = eina_stringshare_add("0");
        ci->show_text = 1;
        ci->popup_on_hover = 1;

        forecasts_config->items = eina_list_append(forecasts_config->items, ci);
     }
   _forecasts_get_proxy();

   forecasts_config->module = m;
   e_gadcon_provider_register(&_gadcon_class);
   return m;
}
示例#14
0
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;
  Evas *evas;
  Instance *inst;
  char buf[4096];

  inst = E_NEW (Instance, 1);

  inst->ci = _mpdule_config_item_get (id);
  if (!inst->ci->id)
    inst->ci->id = eina_stringshare_add (id);

  o = edje_object_add (gc->evas);
  snprintf (buf, sizeof (buf), "%s/mpdule.edj",
	    e_module_dir_get (mpdule_config->module));
  if (!e_theme_edje_object_set
      (o, "base/theme/modules/mpdule", "modules/mpdule/main"))
    edje_object_file_set (o, buf, "modules/mpdule/main");
  evas_object_show (o);

  gcc = e_gadcon_client_new (gc, name, id, style, o);
  gcc->data = inst;
  inst->gcc = gcc;
  inst->mpdule = o;

  _mpdule_popup_create(inst, buf);

  evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
				  _mpdule_cb_mouse_down, inst);
  evas_object_event_callback_add (inst->mpdule, EVAS_CALLBACK_MOUSE_IN,
				  _mpdule_cb_mouse_in, inst);
  evas_object_event_callback_add (inst->mpdule, EVAS_CALLBACK_MOUSE_OUT,
				  _mpdule_cb_mouse_out, inst);
  edje_object_signal_callback_add (o, "mpdule,play", "", _mpdule_cb_play,
				   inst);
  edje_object_signal_callback_add (o, "mpdule,stop", "", _mpdule_cb_stop,
				   inst);
  edje_object_signal_callback_add (o, "mpdule,pause", "", _mpdule_cb_pause,
				   inst);
  edje_object_signal_callback_add (o, "mpdule,next", "", _mpdule_cb_next,
				   inst);
  edje_object_signal_callback_add (o, "mpdule,previous", "",
				   _mpdule_cb_previous, inst);
  _mpdule_connect (inst);
  _mpdule_update_song (inst);
  inst->update_timer = ecore_timer_add (inst->ci->poll_time,
					_mpdule_update_song_cb, inst);

  mpdule_config->instances =
    eina_list_append (mpdule_config->instances, inst);
  return gcc;
}
示例#15
0
EAPI void *
e_modapi_init(E_Module *m)
{
   Mod *mod;
   char buf[4096];

   mod = calloc(1, sizeof(Mod));
   m->data = mod;

   mod->module = m;
   snprintf(buf, sizeof(buf), "%s/e-module-comp.edj", e_module_dir_get(m));
   e_configure_registry_category_add("appearance", 10, _("Look"), NULL,
                                     "preferences-look");
   e_configure_registry_item_add("appearance/comp", 120, _("Composite"), NULL,
                                 buf, e_int_config_comp_module);

   e_mod_comp_cfdata_edd_init(&(mod->conf_edd),
                              &(mod->conf_match_edd));
                              

   mod->conf = e_config_domain_load("module.comp", mod->conf_edd);
   if (!mod->conf) _e_mod_config_new(m);

   if (!e_config->use_composite)
     {
        e_config->use_composite = 1;
        e_config_save_queue();
     }

   /* XXX: disabled dropshadow module when comp is running */
   {
      Eina_List *l;
      E_Module *m2;
      EINA_LIST_FOREACH(e_module_list(), l, m2)
	{
	   if (m2->enabled && (!strcmp(m2->name, "dropshadow")))
	     e_module_disable(m2);
	}
   }

   /* XXX: update old configs. add config versioning */
   if (mod->conf->first_draw_delay == 0)
     mod->conf->first_draw_delay = 0.20;

   _comp_mod = mod;

   if (!e_mod_comp_init())
     {
        // FIXME: handle if comp init fails
     }

   e_module_delayed_set(m, 0);
   e_module_priority_set(m, -1000);
   return mod;
}
示例#16
0
EAPI void *
e_modapi_init(E_Module *m)
{
   Eina_List *files;
   char buf[PATH_MAX];
   char *file;
   
   default_e_theme = NULL;
   
   conf_module = m;
   e_wizard_init();
   
   snprintf(buf, sizeof(buf), "%s/%s", e_module_dir_get(m), MODULE_ARCH);
   files = ecore_file_ls(buf);
   files = eina_list_sort(files, 0, (Eina_Compare_Cb)_cb_sort_files);
   EINA_LIST_FREE(files, file)
	  {
	     if (!strncmp(file, "page_", 5))
	       {
		  void *handle;
		  
		  snprintf(buf, sizeof(buf), "%s/%s/%s",
			   e_module_dir_get(m), MODULE_ARCH, file);
		  handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
		  if (handle)
		    {
		       e_wizard_page_add(handle,
					 dlsym(handle, "wizard_page_init"),
					 dlsym(handle, "wizard_page_shutdown"),
					 dlsym(handle, "wizard_page_show"),
					 dlsym(handle, "wizard_page_hide"),
					 dlsym(handle, "wizard_page_apply"));
		    }
                  else
                    printf("%s\n", dlerror());
	       }
	free(file);
     }
   e_wizard_go();
   
   return m;
}
示例#17
0
static Evas_Object *
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas)
{
   Evas_Object *o;
   char buf[4096];
   
   o = edje_object_add(evas);
   snprintf(buf, sizeof(buf), "%s/e-module-emu.edj", e_module_dir_get(emu_module));
   edje_object_file_set(o, buf, "icon");
   return o;
}
static Evas_Object *
_gc_icon(const E_Gadcon_Client_Class *client_class, Evas *evas)
{
   Evas_Object *o;
   EINA_SAFETY_ON_NULL_RETURN_VAL(music_control_mod, NULL);
   snprintf(tmpbuf, sizeof(tmpbuf), "%s/e-module-music-control.edj",
            e_module_dir_get(music_control_mod));
   o = edje_object_add(evas);
   edje_object_file_set(o, tmpbuf, "icon");
   return o;
}
示例#19
0
    static Evas_Object *
_gc_icon(Evas *evas)
{
    Evas_Object *o;
    char buf[PATH_MAX];

    snprintf(buf, sizeof(buf), "%s/e-module-exalt.edj", e_module_dir_get(exalt_config->module));
    o = edje_object_add(evas);
    edje_object_file_set(o, buf, "icon");
    return o;
}
示例#20
0
static Evas_Object *
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas) 
{
   Evas_Object *o;
   char buf[PATH_MAX];

   snprintf(buf, sizeof(buf), "%s/e-module-net.edj", 
            e_module_dir_get(net_cfg->mod));
   o = edje_object_add(evas);
   edje_object_file_set(o, buf, "icon");
   return o;
}
示例#21
0
文件: e_mod_main.c 项目: Limsik/e17
static Evas_Object *
_gc_icon (const E_Gadcon_Client_Class *client_class, Evas * evas)
{
   Evas_Object *o;
   char buf[PATH_MAX];

   o = edje_object_add (evas);
   snprintf (buf, sizeof (buf), "%s/module.edj",
	     e_module_dir_get (ut_config->module));
   edje_object_file_set (o, buf, "icon");

   return o;
}
EAPI void *
e_modapi_init(E_Module *m)
{
   char buf[PATH_MAX];

   // Set up module's message catalogue
   snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
   bindtextdomain(PACKAGE, buf);
   bind_textdomain_codeset(PACKAGE, "UTF-8");

   // Add an item in the config panel
   snprintf(buf, sizeof(buf), "%s/e-module-penguins.edj", e_module_dir_get(m));
   e_configure_registry_category_add("appearance", 10, D_("Look"),
                                     NULL, "preferences-look");
   e_configure_registry_item_add("appearance/penguins", 150, D_("Penguins"),
                                 NULL, buf, e_int_config_penguins_module);

   penguins_mod = m;
   e_module_delayed_set(m, 1);

   return penguins_init(m);
}
示例#23
0
EAPI void *
e_modapi_init (E_Module * m)
{
  char buf[4096];

  snprintf (buf, sizeof (buf), "%s/locale", e_module_dir_get (m));
  bindtextdomain (PACKAGE, buf);
  bind_textdomain_codeset (PACKAGE, "UTF-8");

  conf_item_edd = E_CONFIG_DD_NEW ("MPDule_Config_Item", Config_Item);
#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
  E_CONFIG_VAL (D, T, id, STR);
  E_CONFIG_VAL (D, T, poll_time, DOUBLE);
  E_CONFIG_VAL (D, T, hostname, STR);
  E_CONFIG_VAL (D, T, port, INT);
  E_CONFIG_VAL (D, T, show_popup, UCHAR);

  conf_edd = E_CONFIG_DD_NEW ("MPDule_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
  E_CONFIG_LIST (D, T, items, conf_item_edd);

  mpdule_config = e_config_domain_load ("module.mpdule", conf_edd);
  if (!mpdule_config)
    {
      Config_Item *ci;

      mpdule_config = E_NEW (Config, 1);

      ci = E_NEW (Config_Item, 1);
      ci->id = eina_stringshare_add ("0");
      ci->poll_time = 1.0;
      ci->hostname = eina_stringshare_add ("localhost");
      ci->port = 6600;
      ci->show_popup = 1;

      mpdule_config->items = eina_list_append (mpdule_config->items, ci);
    }
  mpdule_config->module = m;

  e_gadcon_provider_register (&_gc_class);
  return m;
}
示例#24
0
static Evas_Object *
_forecasts_popup_icon_create(Evas *evas, int code)
{
   char buf[4096];
   char m[4096];
   Evas_Object *o;

   snprintf(m, sizeof(m), "%s/forecasts.edj",
            e_module_dir_get(forecasts_config->module));
   o = edje_object_add(evas);
   snprintf(buf, sizeof(buf), "modules/forecasts/icons/%d", code);
   if (!e_theme_edje_object_set(o, "base/theme/modules/forecasts/icons", buf))
     edje_object_file_set(o, m, buf);

   return o;
}
示例#25
0
static void
_empris_popup_create (Instance * inst, const char *dir)
{
   Evas *evas;
   Evas_Object *o_popup;
   char buf[4096];
  
   if (inst->ci->show_popup)
     {
	inst->popup = e_gadcon_popup_new (inst->gcc);
	evas = inst->popup->win->evas;
	o_popup = edje_object_add (evas);
	if (!e_theme_edje_object_set
	    (o_popup, "base/theme/modules/empris", "modules/empris/popup"))
	  {
	     if (dir)
	       {
		  edje_object_file_set (o_popup, dir, "modules/empris/popup");
	       }
	     else
	       {
		  snprintf(buf, sizeof(buf), "%s/empris.edj",
			   e_module_dir_get(empris_config->module));
		  edje_object_file_set(o_popup, buf, "modules/empris/popup");
	       }
	  }
	evas_object_show (o_popup);
	e_gadcon_popup_content_set (inst->popup, o_popup);
	edje_object_size_min_calc (o_popup, NULL, NULL);
	inst->o_popup = o_popup;
	edje_object_signal_callback_add (o_popup, "empris,play", "",
					 _empris_cb_play, inst);
	edje_object_signal_callback_add (o_popup, "empris,stop", "",
					 _empris_cb_stop, inst);
	edje_object_signal_callback_add (o_popup, "empris,pause", "",
					 _empris_cb_pause, inst);
	edje_object_signal_callback_add (o_popup, "empris,next", "",
					 _empris_cb_next, inst);
	edje_object_signal_callback_add (o_popup, "empris,previous", "",
					 _empris_cb_previous, inst);
     }
   else
     {
	inst->popup = NULL;
	inst->o_popup = NULL;
     }
}
示例#26
0
EAPI void *
e_modapi_init (E_Module * m)
{
  char buf[PATH_MAX];

  snprintf (buf, sizeof (buf), "%s/locale", e_module_dir_get (m));
  bindtextdomain (PACKAGE, buf);
  bind_textdomain_codeset (PACKAGE, "UTF-8");

  conf_item_edd = E_CONFIG_DD_NEW ("Wlan_Config_Item", Config_Item);
#undef T
#undef D
#define T Config_Item
#define D conf_item_edd
  E_CONFIG_VAL (D, T, id, STR);
  E_CONFIG_VAL (D, T, device, STR);  
  E_CONFIG_VAL (D, T, poll_time, DOUBLE);
  E_CONFIG_VAL (D, T, always_text, INT);
  E_CONFIG_VAL (D, T, show_percent, INT);

  conf_edd = E_CONFIG_DD_NEW ("Wlan_Config", Config);
#undef T
#undef D
#define T Config
#define D conf_edd
  E_CONFIG_LIST (D, T, items, conf_item_edd);

  wlan_config = e_config_domain_load ("module.wlan", conf_edd);
  if (!wlan_config)
    {
      Config_Item *ci;

      wlan_config = E_NEW (Config, 1);

      ci = E_NEW (Config_Item, 1);
      ci->id = eina_stringshare_add ("0");
      ci->device = eina_stringshare_add ("wlan0");      
      ci->poll_time = 1.0;
      ci->always_text = 0;
      ci->show_percent = 1;
      wlan_config->items = eina_list_append (wlan_config->items, ci);
    }
  wlan_config->module = m;
  e_gadcon_provider_register (&_gc_class);
  return m;
}
static const char *
_systray_theme_path(void)
{
#define TF "/e-module-systray.edj"
   unsigned int dirlen;
   const char *moddir = e_module_dir_get(systray_mod);

   dirlen = strlen(moddir);
   if (dirlen >= sizeof(tmpbuf) - sizeof(TF))
     return NULL;

   memcpy(tmpbuf, moddir, dirlen);
   memcpy(tmpbuf + dirlen, TF, sizeof(TF));

   return tmpbuf;
#undef TF
}
示例#28
0
static void
_mail_cb_mouse_in (void *data, Evas * e, Evas_Object * obj, void *event_info)
{
  Instance    *inst = data;
  Evas_Object *list;
  Eina_List   *l;
  char         buf[256];
  char path[PATH_MAX];

  if (!inst)
    return;
  edje_object_signal_emit (inst->mail_obj, "label_active", "");

  if (inst->popup) return;
  if ((!inst->ci->show_popup) || (!inst->ci->boxes)) return;

  inst->popup = e_gadcon_popup_new (inst->gcc);
  snprintf (path, sizeof (path), "%s/mail.edj",
	    e_module_dir_get (mail_config->module));
  list = e_ilist_add (inst->popup->win->evas);
  for (l = inst->ci->boxes; l; l = l->next)
    {
       Config_Box *cb;

       cb = l->data;
       if (!cb) continue;
       if ((!inst->ci->show_popup_empty) && (!cb->num_new)) continue;
       snprintf (buf, sizeof (buf), "%s: %d/%d", cb->name, cb->num_new,
	         cb->num_total);
       e_ilist_append (list, NULL, NULL, buf, 0, NULL, NULL, NULL, NULL);
    }
  if (e_ilist_count (list))
    {
       Evas_Coord mw, mh;

       e_ilist_size_min_get (list, &mw, &mh);
       evas_object_size_hint_min_set(list, mw, mh);
       e_gadcon_popup_content_set (inst->popup, list);
       e_gadcon_popup_show (inst->popup);
    }
  else
    {
       e_object_del (E_OBJECT (inst->popup));
       inst->popup = NULL;
    }
}
示例#29
0
void
_cpuclock_set_pstate(int min, int max, int turbo)
{
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
   return;
#endif
   char buf[4096 + 100], exe[4096];
   struct stat st;

   snprintf(exe, 4096, "%s/%s/cpuclock_sysfs",
            e_module_dir_get(sysinfo_config->module), MODULE_ARCH);
   if (stat(exe, &st) < 0) return;
   snprintf(buf, sizeof(buf),
            "%s %s %i %i %i", exe, "pstate", min, max, turbo);
   if (system(buf) != 0)
     ERR("Error code from trying to run \"%s\"", buf);
}
示例#30
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;
}