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; battery_config->full = -2; battery_config->time_left = -2; battery_config->time_full = -2; battery_config->have_battery = -2; battery_config->have_power = -2; inst = E_NEW(Instance, 1); o = edje_object_add(gc->evas); e_theme_edje_object_set(o, "base/theme/modules/battery", "e/modules/battery/main"); gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; inst->gcc = gcc; inst->o_battery = o; inst->warning = NULL; inst->popup_battery = NULL; #ifdef HAVE_EEZE eeze_init(); #elif !defined __OpenBSD__ e_dbus_init(); e_hal_init(); #endif evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _button_cb_mouse_down, inst); battery_config->instances = eina_list_append(battery_config->instances, inst); _battery_config_updated(); return gcc; }
void e_mod_kbd_device_init(void) { /* load the 'ignored' keyboard file */ _e_mod_kbd_device_ignore_load(); #ifdef HAVE_EEZE eeze_init(); watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD, EEZE_UDEV_EVENT_NONE, _e_mod_kbd_device_udev_event, NULL); #else e_dbus_init(); e_hal_init(); /* try to attach to the system dbus */ if (!(_dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM))) return; /* ask HAL for any input keyboards */ e_hal_manager_find_device_by_capability(_dbus_conn, "input.keyboard", _e_mod_kbd_device_cb_input_kbd, NULL); /* setup dbus signal handlers for when a device gets added/removed/changed */ _dev_add = e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "DeviceAdded", _e_mod_kbd_device_dbus_add, NULL); _dev_del = e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "DeviceRemoved", _e_mod_kbd_device_dbus_del, NULL); _dev_chg = e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "NewCapability", _e_mod_kbd_device_dbus_chg, NULL); #endif }
/* externally accessible functions */ EINTERN int e_msgbus_init(void) { E_DBus_Interface *iface; _e_msgbus_data = E_NEW(E_Msgbus_Data, 1); e_dbus_init(); #ifdef HAVE_HAL e_hal_init(); #endif _e_msgbus_data->conn = e_dbus_bus_get(DBUS_BUS_SESSION); if (!_e_msgbus_data->conn) { WRN("Cannot get DBUS_BUS_SESSION"); return 0; } e_dbus_request_name(_e_msgbus_data->conn, "org.enform.wm.service", 0, _e_msgbus_request_name_cb, NULL); _e_msgbus_data->obj = e_dbus_object_add(_e_msgbus_data->conn, "/org/enform/wm/RemoteObject", NULL); iface = e_dbus_interface_new("org.enform.wm.Core"); if (!iface) { WRN("Cannot add org.enform.wm.Core interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Hardcore methods */ e_dbus_interface_method_add(iface, "Restart", "", "", _e_msgbus_core_restart_cb); e_dbus_interface_method_add(iface, "Shutdown", "", "", _e_msgbus_core_shutdown_cb); iface = e_dbus_interface_new("org.enform.wm.Module"); if (!iface) { WRN("Cannot add org.enform.wm.Module interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Module methods */ e_dbus_interface_method_add(iface, "Load", "s", "", _e_msgbus_module_load_cb); e_dbus_interface_method_add(iface, "Unload", "s", "", _e_msgbus_module_unload_cb); e_dbus_interface_method_add(iface, "Enable", "s", "", _e_msgbus_module_enable_cb); e_dbus_interface_method_add(iface, "Disable", "s", "", _e_msgbus_module_disable_cb); e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_module_list_cb); iface = e_dbus_interface_new("org.enform.wm.Profile"); if (!iface) { WRN("Cannot add org.enform.wm.Profile interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Profile methods */ e_dbus_interface_method_add(iface, "Set", "s", "", _e_msgbus_profile_set_cb); e_dbus_interface_method_add(iface, "Get", "", "s", _e_msgbus_profile_get_cb); e_dbus_interface_method_add(iface, "List", "", "as", _e_msgbus_profile_list_cb); e_dbus_interface_method_add(iface, "Add", "s", "", _e_msgbus_profile_add_cb); e_dbus_interface_method_add(iface, "Delete", "s", "", _e_msgbus_profile_delete_cb); iface = e_dbus_interface_new("org.enform.wm.Window"); if (!iface) { WRN("Cannot add org.enform.wm.Window interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Profile methods */ e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_window_list_cb); e_dbus_interface_method_add(iface, "Close", "i", "", _e_msgbus_window_close_cb); e_dbus_interface_method_add(iface, "Kill", "i", "", _e_msgbus_window_kill_cb); e_dbus_interface_method_add(iface, "Focus", "i", "", _e_msgbus_window_focus_cb); e_dbus_interface_method_add(iface, "Iconify", "i", "", _e_msgbus_window_iconify_cb); e_dbus_interface_method_add(iface, "Uniconify", "i", "", _e_msgbus_window_uniconify_cb); e_dbus_interface_method_add(iface, "Maximize", "i", "", _e_msgbus_window_maximize_cb); e_dbus_interface_method_add(iface, "Unmaximize", "i", "", _e_msgbus_window_unmaximize_cb); return 1; }
/* externally accessible functions */ EINTERN int e_msgbus_init(void) { E_DBus_Interface *iface; _e_msgbus_data = E_NEW(E_Msgbus_Data, 1); e_dbus_init(); #ifdef HAVE_HAL e_hal_init(); #endif _e_msgbus_data->conn = e_dbus_bus_get(DBUS_BUS_SESSION); if (!_e_msgbus_data->conn) { printf("WARNING: Cannot get DBUS_BUS_SESSION\n"); return 0; } e_dbus_request_name(_e_msgbus_data->conn, "org.enlightenment.wm.service", 0, _e_msgbus_request_name_cb, NULL); _e_msgbus_data->obj = e_dbus_object_add(_e_msgbus_data->conn, "/org/enlightenment/wm/RemoteObject", NULL); iface = e_dbus_interface_new("org.enlightenment.wm.Core"); if (!iface) { printf("WARNING: Cannot add org.enlightenment.wm.Core interface\n"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Hardcore methods */ e_dbus_interface_method_add(iface, "Restart", "", "", _e_msgbus_core_restart_cb); e_dbus_interface_method_add(iface, "Shutdown", "", "", _e_msgbus_core_shutdown_cb); iface = e_dbus_interface_new("org.enlightenment.wm.Module"); if (!iface) { printf("WARNING: Cannot add org.enlightenment.wm.Module interface\n"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Module methods */ e_dbus_interface_method_add(iface, "Load", "s", "", _e_msgbus_module_load_cb); e_dbus_interface_method_add(iface, "Unload", "s", "", _e_msgbus_module_unload_cb); e_dbus_interface_method_add(iface, "Enable", "s", "", _e_msgbus_module_enable_cb); e_dbus_interface_method_add(iface, "Disable", "s", "", _e_msgbus_module_disable_cb); e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_module_list_cb); iface = e_dbus_interface_new("org.enlightenment.wm.Profile"); if (!iface) { printf("WARNING: Cannot add org.enlightenment.wm.Profile interface\n"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Profile methods */ e_dbus_interface_method_add(iface, "Set", "s", "", _e_msgbus_profile_set_cb); e_dbus_interface_method_add(iface, "Get", "", "s", _e_msgbus_profile_get_cb); e_dbus_interface_method_add(iface, "List", "", "as", _e_msgbus_profile_list_cb); e_dbus_interface_method_add(iface, "Add", "s", "", _e_msgbus_profile_add_cb); e_dbus_interface_method_add(iface, "Delete", "s", "", _e_msgbus_profile_delete_cb); return 1; }