* Break out intl data. Reduces the size of e_imc * Add Dbus ipc replacement * Elightenment Dbus API can be extended by modules (Example: msgbus_lang) SVN revision: 31803devs/princeamd/enlightenment-0.17-elive
parent
1e507658f3
commit
54ab7f0d3c
25 changed files with 743 additions and 144 deletions
@ -0,0 +1,29 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#include "e.h" |
||||
|
||||
EAPI E_Config_DD * |
||||
e_config_descriptor_new(const char *name, int size) |
||||
{ |
||||
Eet_Data_Descriptor_Class eddc; |
||||
|
||||
eddc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION; |
||||
eddc.func.mem_alloc = NULL; |
||||
eddc.func.mem_free = NULL; |
||||
eddc.func.str_alloc = (char *(*)(const char *)) evas_stringshare_add; |
||||
eddc.func.str_free = (void (*)(const char *)) evas_stringshare_del; |
||||
eddc.func.list_next = (void *(*)(void *)) evas_list_next; |
||||
eddc.func.list_append = (void *(*)(void *l, void *d)) evas_list_append; |
||||
eddc.func.list_data = (void *(*)(void *)) evas_list_data; |
||||
eddc.func.list_free = (void *(*)(void *)) evas_list_free; |
||||
eddc.func.hash_foreach =
|
||||
(void (*) (void *, int (*) (void *, const char *, void *, void *), void *))
|
||||
evas_hash_foreach; |
||||
eddc.func.hash_add = (void *(*) (void *, const char *, void *)) evas_hash_add; |
||||
eddc.func.hash_free = (void (*) (void *)) evas_hash_free; |
||||
eddc.name = name; |
||||
eddc.size = size; |
||||
return (E_Config_DD *)eet_data_descriptor2_new(&eddc); |
||||
} |
||||
|
@ -0,0 +1,35 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#ifdef E_TYPEDEFS |
||||
|
||||
#define E_CONFIG_DD_NEW(str, typ) \ |
||||
e_config_descriptor_new(str, sizeof(typ)) |
||||
#define E_CONFIG_DD_FREE(eed) if (eed) { eet_data_descriptor_free((eed)); (eed) = NULL; } |
||||
#define E_CONFIG_VAL(edd, type, member, dtype) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype) |
||||
#define E_CONFIG_SUB(edd, type, member, eddtype) EET_DATA_DESCRIPTOR_ADD_SUB(edd, type, #member, member, eddtype) |
||||
#define E_CONFIG_LIST(edd, type, member, eddtype) EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype) |
||||
#define E_CONFIG_HASH(edd, type, member, eddtype) EET_DATA_DESCRIPTOR_ADD_HASH(edd, type, #member, member, eddtype) |
||||
|
||||
#define CHAR EET_T_CHAR |
||||
#define SHORT EET_T_SHORT |
||||
#define INT EET_T_INT |
||||
#define LL EET_T_LONG_LONG |
||||
#define FLOAT EET_T_FLOAT |
||||
#define DOUBLE EET_T_DOUBLE |
||||
#define UCHAR EET_T_UCHAR |
||||
#define USHORT EET_T_USHORT |
||||
#define UINT EET_T_UINT |
||||
#define ULL EET_T_ULONG_LONG |
||||
#define STR EET_T_STRING |
||||
|
||||
typedef Eet_Data_Descriptor E_Config_DD; |
||||
|
||||
#else |
||||
#ifndef E_CONFIG_H |
||||
#define E_CONFIG_H |
||||
|
||||
EAPI E_Config_DD *e_config_descriptor_new(const char *name, int size); |
||||
|
||||
#endif |
||||
#endif |
@ -0,0 +1,77 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#include "e.h" |
||||
|
||||
/* This file is the counterpart for data storage of e_intl */ |
||||
/* This only needs to be separate because the e_imc binary and other third parties
|
||||
many waht to include the functionality to read IMC data from EET files |
||||
*/ |
||||
static Eet_Data_Descriptor *_e_intl_input_method_config_edd = NULL; |
||||
|
||||
EAPI int |
||||
e_intl_data_init(void) |
||||
{ |
||||
_e_intl_input_method_config_edd = E_CONFIG_DD_NEW("input_method_config", E_Input_Method_Config); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, version, INT); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_name, STR); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, gtk_im_module, STR); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, qt_im_module, STR); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, xmodifiers, STR); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_exec, STR); |
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_setup_exec, STR); |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
EAPI int |
||||
e_intl_data_shutdown(void) |
||||
{ |
||||
E_CONFIG_DD_FREE(_e_intl_input_method_config_edd); |
||||
|
||||
return 1; |
||||
} |
||||
|
||||
|
||||
/* Get the input method configuration from the file */ |
||||
EAPI E_Input_Method_Config * |
||||
e_intl_input_method_config_read(Eet_File *imc_file) |
||||
{ |
||||
E_Input_Method_Config *imc; |
||||
|
||||
imc = NULL; |
||||
if (imc_file) |
||||
{ |
||||
imc = (E_Input_Method_Config *) eet_data_read(imc_file, _e_intl_input_method_config_edd, "imc"); |
||||
} |
||||
return imc; |
||||
} |
||||
|
||||
/* Write the input method configuration to the file */ |
||||
EAPI int |
||||
e_intl_input_method_config_write(Eet_File *imc_file, E_Input_Method_Config *imc) |
||||
{ |
||||
int ok = 0; |
||||
|
||||
if (imc_file) |
||||
{ |
||||
ok = eet_data_write(imc_file, _e_intl_input_method_config_edd, "imc", imc, 0); |
||||
} |
||||
return ok; |
||||
} |
||||
|
||||
EAPI void |
||||
e_intl_input_method_config_free(E_Input_Method_Config *imc) |
||||
{ |
||||
if (imc != NULL) |
||||
{ |
||||
if (imc->e_im_name) evas_stringshare_del(imc->e_im_name); |
||||
if (imc->gtk_im_module) evas_stringshare_del(imc->gtk_im_module); |
||||
if (imc->qt_im_module) evas_stringshare_del(imc->qt_im_module); |
||||
if (imc->xmodifiers) evas_stringshare_del(imc->xmodifiers); |
||||
if (imc->e_im_exec) evas_stringshare_del(imc->e_im_exec); |
||||
if (imc->e_im_setup_exec) evas_stringshare_del(imc->e_im_setup_exec); |
||||
E_FREE(imc); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,31 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#ifdef E_TYPEDEFS |
||||
|
||||
typedef struct _E_Input_Method_Config E_Input_Method_Config; |
||||
|
||||
#else |
||||
#ifndef E_INTL_DATA_H |
||||
#define E_INTL_DATA_H |
||||
|
||||
#define E_INTL_INPUT_METHOD_CONFIG_VERSION 2 |
||||
|
||||
struct _E_Input_Method_Config |
||||
{ |
||||
int version; |
||||
const char *e_im_name; |
||||
const char *gtk_im_module; |
||||
const char *qt_im_module; |
||||
const char *xmodifiers; |
||||
const char *e_im_exec; |
||||
const char *e_im_setup_exec; |
||||
}; |
||||
|
||||
EAPI int e_intl_data_init(void); |
||||
EAPI int e_intl_data_shutdown(void); |
||||
EAPI E_Input_Method_Config *e_intl_input_method_config_read (Eet_File *imc_file); |
||||
EAPI int e_intl_input_method_config_write (Eet_File *imc_file, E_Input_Method_Config *imc); |
||||
EAPI void e_intl_input_method_config_free (E_Input_Method_Config *imc); |
||||
#endif |
||||
#endif |
@ -0,0 +1,347 @@ |
||||
#include "e.h" |
||||
|
||||
/* local subsystem functions */ |
||||
#ifdef HAVE_EDBUS |
||||
static void _e_msgbus_request_name_cb(void *data, DBusMessage *msg, DBusError *err); |
||||
|
||||
static DBusMessage* _e_msgbus_core_restart_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_core_shutdown_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
|
||||
static DBusMessage* _e_msgbus_module_load_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_module_unload_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_module_enable_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_module_disable_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_module_list_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
|
||||
static DBusMessage* _e_msgbus_profile_set_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_profile_get_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_profile_list_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_profile_add_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
static DBusMessage* _e_msgbus_profile_delete_cb(E_DBus_Object *obj, DBusMessage *msg); |
||||
#endif |
||||
|
||||
/* local subsystem globals */ |
||||
static E_Msgbus_Data *_e_msgbus_data = NULL; |
||||
|
||||
/* externally accessible functions */ |
||||
EAPI int |
||||
e_msgbus_init(void) |
||||
{ |
||||
#ifdef HAVE_EDBUS |
||||
E_DBus_Interface *iface; |
||||
|
||||
_e_msgbus_data = E_NEW(E_Msgbus_Data, 1); |
||||
|
||||
e_dbus_init(); |
||||
|
||||
_e_msgbus_data->conn = e_dbus_bus_get(DBUS_BUS_SESSION); |
||||
e_dbus_request_name(_e_msgbus_data->conn, "org.enlighenment.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) return 0; |
||||
e_dbus_object_interface_attach(_e_msgbus_data->obj, 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) return 0; |
||||
e_dbus_object_interface_attach(_e_msgbus_data->obj, 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) return 0; |
||||
e_dbus_object_interface_attach(_e_msgbus_data->obj, 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); |
||||
|
||||
|
||||
#endif |
||||
return 1; |
||||
} |
||||
|
||||
EAPI int |
||||
e_msgbus_shutdown(void) |
||||
{ |
||||
#ifdef HAVE_EDBUS |
||||
if (_e_msgbus_data->obj) |
||||
{ |
||||
e_dbus_object_free(_e_msgbus_data->obj); |
||||
} |
||||
if (_e_msgbus_data->conn) |
||||
{ |
||||
e_dbus_connection_close(_e_msgbus_data->conn); |
||||
} |
||||
e_dbus_shutdown(); |
||||
|
||||
E_FREE(_e_msgbus_data); |
||||
_e_msgbus_data = NULL; |
||||
#endif |
||||
return 1; |
||||
} |
||||
|
||||
EAPI void |
||||
e_msgbus_interface_attach(E_DBus_Interface *iface) |
||||
{ |
||||
#ifdef HAVE_EDBUS |
||||
e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); |
||||
#endif |
||||
} |
||||
|
||||
EAPI void |
||||
e_msgbus_interface_detach(E_DBus_Interface *iface) |
||||
{ |
||||
#ifdef HAVE_EDBUS |
||||
e_dbus_object_interface_detach(_e_msgbus_data->obj, iface); |
||||
#endif |
||||
} |
||||
|
||||
#ifdef HAVE_EDBUS |
||||
static void |
||||
_e_msgbus_request_name_cb(void *data, DBusMessage *msg, DBusError *err) |
||||
{ |
||||
//TODO Handle Errors
|
||||
} |
||||
|
||||
/* Core Handlers */ |
||||
static DBusMessage*
|
||||
_e_msgbus_core_restart_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
restart = 1; |
||||
ecore_main_loop_quit(); |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_core_shutdown_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
if (!e_util_immortal_check()) ecore_main_loop_quit(); |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
/* Modules Handlers */ |
||||
static DBusMessage*
|
||||
_e_msgbus_module_load_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *module; |
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &module); |
||||
|
||||
if (!e_module_find(module))
|
||||
{ |
||||
e_module_new(module); |
||||
e_config_save_queue(); |
||||
} |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_module_unload_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *module;
|
||||
E_Module *m; |
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &module); |
||||
|
||||
if ((m = e_module_find(module)))
|
||||
{ |
||||
e_module_disable(m); |
||||
e_object_del(E_OBJECT(m)); |
||||
e_config_save_queue(); |
||||
} |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_module_enable_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *module;
|
||||
E_Module *m; |
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &module); |
||||
|
||||
if ((m = e_module_find(module))) { |
||||
e_module_enable(m); |
||||
e_config_save_queue(); |
||||
} |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_module_disable_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *module;
|
||||
E_Module *m; |
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &module); |
||||
|
||||
if ((m = e_module_find(module))) { |
||||
e_module_disable(m); |
||||
e_config_save_queue(); |
||||
} |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_module_list_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
Evas_List *mod_list; |
||||
Evas_List * l; |
||||
DBusMessage *reply; |
||||
DBusMessageIter iter; |
||||
DBusMessageIter arr; |
||||
|
||||
reply = dbus_message_new_method_return(msg); |
||||
dbus_message_iter_init_append(reply, &iter); |
||||
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(si)", &arr); |
||||
|
||||
mod_list = e_module_list(); |
||||
|
||||
for (l = mod_list; l; l = l->next)
|
||||
{ |
||||
DBusMessageIter sub; |
||||
E_Module *mod; |
||||
const char *name; |
||||
int enabled; |
||||
|
||||
mod = l->data; |
||||
name = mod->name; |
||||
enabled = mod->enabled; |
||||
dbus_message_iter_open_container(&arr, DBUS_TYPE_STRUCT, NULL, &sub); |
||||
dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &(name)); |
||||
dbus_message_iter_append_basic(&sub, DBUS_TYPE_INT32, &(enabled)); |
||||
dbus_message_iter_close_container(&arr, &sub); |
||||
} |
||||
dbus_message_iter_close_container(&iter, &arr); |
||||
|
||||
return reply; |
||||
} |
||||
|
||||
/* Profile Handlers */ |
||||
static DBusMessage*
|
||||
_e_msgbus_profile_set_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *profile;
|
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &profile); |
||||
|
||||
e_config_save_flush(); |
||||
e_config_profile_set(profile); |
||||
e_config_profile_save(); |
||||
e_config_save_block_set(1); |
||||
restart = 1; |
||||
ecore_main_loop_quit(); |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_profile_get_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
DBusMessage *reply; |
||||
char *profile;
|
||||
|
||||
profile = e_config_profile_get(); |
||||
|
||||
reply = dbus_message_new_method_return(msg); |
||||
dbus_message_iter_init_append(reply, &iter); |
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &profile); |
||||
|
||||
return reply; |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_profile_list_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
Evas_List *profiles; |
||||
Evas_List * l; |
||||
DBusMessage *reply; |
||||
DBusMessageIter iter; |
||||
DBusMessageIter arr; |
||||
|
||||
reply = dbus_message_new_method_return(msg); |
||||
dbus_message_iter_init_append(reply, &iter); |
||||
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &arr); |
||||
|
||||
profiles = e_config_profile_list(); |
||||
|
||||
for (l = profiles; l; l = l->next)
|
||||
{ |
||||
const char *name; |
||||
|
||||
name = l->data; |
||||
dbus_message_iter_append_basic(&arr, DBUS_TYPE_STRING, &name); |
||||
} |
||||
dbus_message_iter_close_container(&iter, &arr); |
||||
|
||||
return reply; |
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_profile_add_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *profile;
|
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &profile); |
||||
|
||||
e_config_profile_add(profile); |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
|
||||
} |
||||
|
||||
static DBusMessage*
|
||||
_e_msgbus_profile_delete_cb(E_DBus_Object *obj, DBusMessage *msg) |
||||
{ |
||||
DBusMessageIter iter; |
||||
char *profile;
|
||||
|
||||
dbus_message_iter_init(msg, &iter); |
||||
dbus_message_iter_get_basic(&iter, &profile); |
||||
if (!strcmp(e_config_profile_get(), profile)) |
||||
{ |
||||
DBusMessage *ret; |
||||
|
||||
ret = dbus_message_new_error(msg, "org.enlightenment.DBus.InvalidArgument",
|
||||
"Can't delete active profile"); |
||||
return ret; |
||||
} |
||||
e_config_profile_del(profile); |
||||
|
||||
return dbus_message_new_method_return(msg); |
||||
} |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,30 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#ifdef E_TYPEDEFS |
||||
|
||||
#ifndef HAVE_EDBUS |
||||
#define E_DBus_Interface void |
||||
#endif |
||||
|
||||
typedef struct _E_Msgbus_Data E_Msgbus_Data; |
||||
|
||||
#else |
||||
#ifndef E_MSGBUS_H |
||||
#define E_MSGBUS_H |
||||
|
||||
/* This is the dbus subsystem, but e_dbus namespace is taken by e_dbus */ |
||||
|
||||
struct _E_Msgbus_Data
|
||||
{ |
||||
#ifdef HAVE_EDBUS |
||||
E_DBus_Connection *conn; |
||||
E_DBus_Object *obj; |
||||
#endif |
||||
}; |
||||
|
||||
EAPI int e_msgbus_init(void); |
||||
EAPI int e_msgbus_shutdown(void); |
||||
|
||||
#endif |
||||
#endif |
@ -0,0 +1,7 @@ |
||||
.deps |
||||
.libs |
||||
Makefile |
||||
Makefile.in |
||||
*.lo |
||||
module.la |
||||
module.desktop |
@ -0,0 +1,33 @@ |
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = msgbus_lang
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
e-module-$(MODULE).edj module.desktop |
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
||||
|
||||
# the module .so file
|
||||
INCLUDES = -I. \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src/modules/$(MODULE) \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/modules \
|
||||
@e_cflags@
|
||||
|
||||
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
||||
|
||||
if HAVE_EDBUS |
||||
pkg_LTLIBRARIES = module.la
|
||||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@ @E_DBUS_LIBS@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
endif |
||||
|
||||
uninstall: |
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
Binary file not shown.
@ -0,0 +1,93 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#include "e.h" |
||||
#include "e_mod_main.h" |
||||
|
||||
/***************************************************************************/ |
||||
/**/ |
||||
/* actual module specifics */ |
||||
|
||||
static E_DBus_Interface *iface = NULL; |
||||
|
||||
/**/ |
||||
/***************************************************************************/ |
||||
|
||||
/***************************************************************************/ |
||||
/**/ |
||||
|
||||
DBusMessage * |
||||
cb_langs(E_DBus_Object *obj, DBusMessage *message) |
||||
{ |
||||
DBusMessage *reply; |
||||
DBusMessageIter iter; |
||||
DBusMessageIter arr; |
||||
Evas_List * languages; |
||||
Evas_List * l; |
||||
|
||||
memset(&arr, 0, sizeof(DBusMessageIter)); |
||||
|
||||
reply = dbus_message_new_method_return(message); |
||||
dbus_message_iter_init_append(reply, &iter); |
||||
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &arr); |
||||
|
||||
languages = e_intl_language_list(); |
||||
for (l = languages; l; l = l->next) { |
||||
const char *str; |
||||
|
||||
str = l->data; |
||||
dbus_message_iter_append_basic(&arr, DBUS_TYPE_STRING, &str); |
||||
} |
||||
|
||||
dbus_message_iter_close_container(&iter, &arr); |
||||
|
||||
return reply; |
||||
} |
||||
|
||||
/**/ |
||||
/***************************************************************************/ |
||||
|
||||
/***************************************************************************/ |
||||
/**/ |
||||
/* module setup */ |
||||
EAPI E_Module_Api e_modapi = |
||||
{ |
||||
E_MODULE_API_VERSION, |
||||
"IPC - Language" |
||||
}; |
||||
|
||||
EAPI void * |
||||
e_modapi_init(E_Module *m) |
||||
{ |
||||
iface = e_dbus_interface_new("org.enlightenment.wm.Language"); |
||||
if (!iface) return NULL; |
||||
|
||||
e_dbus_interface_method_add(iface, "List", "", "as", cb_langs); |
||||
|
||||
e_msgbus_interface_attach(iface); |
||||
|
||||
return m; |
||||
} |
||||
|
||||
EAPI int |
||||
e_modapi_shutdown(E_Module *m) |
||||
{ |
||||
e_msgbus_interface_detach(iface); |
||||
e_dbus_interface_unref(iface); |
||||
return 1; |
||||
} |
||||
|
||||
EAPI int |
||||
e_modapi_save(E_Module *m) |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
EAPI int |
||||
e_modapi_about(E_Module *m) |
||||
{ |
||||
e_module_dialog_show(m, |
||||
_("DBus IPC - Language"), |
||||
_("Extensions for language IPC configuration")); |
||||
return 1; |
||||
} |
@ -0,0 +1,14 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#ifndef E_MOD_MAIN_H |
||||
#define E_MOD_MAIN_H |
||||
|
||||
EAPI extern E_Module_Api e_modapi; |
||||
|
||||
EAPI void *e_modapi_init (E_Module *m); |
||||
EAPI int e_modapi_shutdown (E_Module *m); |
||||
EAPI int e_modapi_save (E_Module *m); |
||||
EAPI int e_modapi_about (E_Module *m); |
||||
|
||||
#endif |
@ -0,0 +1,4 @@ |
||||
[Desktop Entry] |
||||
Type=Link |
||||
Name=DBus Extension - Language |
||||
Icon=e-module-msgbus_lang |
Loading…
Reference in new issue