Connection profiles: read profiles from local directory
This commit is contained in:
parent
918c7c21c4
commit
abf6c901d8
|
@ -7,6 +7,7 @@ project(CLOUSEAU)
|
|||
find_package(Efl REQUIRED)
|
||||
find_package(Eina REQUIRED)
|
||||
find_package(Eet REQUIRED)
|
||||
find_package(Efreet REQUIRED)
|
||||
find_package(Eolian REQUIRED)
|
||||
find_package(Eo REQUIRED)
|
||||
find_package(Elementary REQUIRED)
|
||||
|
|
|
@ -6,10 +6,13 @@ STRING(REGEX REPLACE "\n" "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
|
|||
STRING(REGEX REPLACE " " "" EOLIAN_EO_DIR ${EOLIAN_EO_DIR})
|
||||
add_definitions(${CLI_COMMON_DEFINITIONS} -DEFL_EO_API_SUPPORT -DEOLIAN_EO_DIR="${EOLIAN_EO_DIR}")
|
||||
|
||||
link_directories (${PC_LIBELEMENTARY_LIBRARY_DIRS})
|
||||
|
||||
include_directories(
|
||||
${ELEMENTARY_INCLUDE_DIRS}
|
||||
${EINA_INCLUDE_DIRS}
|
||||
${EET_INCLUDE_DIRS}
|
||||
${EFREET_INCLUDE_DIRS}
|
||||
${EO_INCLUDE_DIRS}
|
||||
${EOLIAN_INCLUDE_DIRS}
|
||||
${ECORE_INCLUDE_DIRS}
|
||||
|
@ -27,11 +30,13 @@ target_link_libraries(clouseau_client
|
|||
${ELEMENTARY_LIBRARIES}
|
||||
${EINA_LIBRARIES}
|
||||
${EET_LIBRARIES}
|
||||
${EFREET_LIBRARIES}
|
||||
${EO_LIBRARIES}
|
||||
${EOLIAN_LIBRARIES}
|
||||
${ECORE_LIBRARIES}
|
||||
${EVAS_LIBRARIES}
|
||||
${EDEBUG_LIBRARIES}
|
||||
ecore_file
|
||||
)
|
||||
|
||||
install(TARGETS clouseau_client DESTINATION bin)
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
#ifndef ELM_INTERNAL_API_ARGESFSDFEFC
|
||||
#define ELM_INTERNAL_API_ARGESFSDFEFC
|
||||
#endif
|
||||
#include <Efreet.h>
|
||||
#include <Elementary.h>
|
||||
#include <Evas.h>
|
||||
#include <Eolian.h>
|
||||
#include <Ecore_File.h>
|
||||
#include "gui.h"
|
||||
|
||||
#include <Eolian_Debug.h>
|
||||
|
@ -20,6 +22,8 @@
|
|||
_buf += sz; \
|
||||
}
|
||||
|
||||
#define _PROFILE_EET_ENTRY "config"
|
||||
|
||||
static uint32_t _cl_stat_reg_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||
static uint32_t _module_init_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||
static uint32_t _poll_on_opcode = EINA_DEBUG_OPCODE_INVALID;
|
||||
|
@ -59,6 +63,19 @@ typedef struct
|
|||
void *data;
|
||||
} _Obj_info_node;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLOUSEAU_PROFILE_LOCAL,
|
||||
CLOUSEAU_PROFILE_SDB
|
||||
} Clouseau_Profile_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
const char *script;
|
||||
Clouseau_Profile_Type type;
|
||||
} Clouseau_Profile;
|
||||
|
||||
static Eina_List *_pending = NULL;
|
||||
static Eina_Debug_Session *_session = NULL;
|
||||
static int _selected_app = -1;
|
||||
|
@ -68,6 +85,9 @@ static Eina_List *_objs_list_tree = NULL;
|
|||
static Eolian_Debug_Object_Information *_obj_info = NULL;
|
||||
static Eina_Debug_Client *_current_client = NULL;
|
||||
|
||||
static Eet_Data_Descriptor *_profile_edd = NULL;
|
||||
static Eina_List *_profiles = NULL;
|
||||
|
||||
static void
|
||||
_consume(uint32_t opcode)
|
||||
{
|
||||
|
@ -522,6 +542,61 @@ _post_register_handle(Eina_Bool flag)
|
|||
eina_debug_client_free(cl);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_mkdir(const char *dir)
|
||||
{
|
||||
if (!ecore_file_exists(dir))
|
||||
{
|
||||
Eina_Bool success = ecore_file_mkdir(dir);
|
||||
if (!success)
|
||||
{
|
||||
printf("Cannot create a config folder \"%s\"\n", dir);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_profile_eet_load()
|
||||
{
|
||||
if (_profile_edd) return;
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
|
||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Clouseau_Profile);
|
||||
_profile_edd = eet_data_descriptor_stream_new(&eddc);
|
||||
|
||||
#define CFG_ADD_BASIC(member, eet_type)\
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC\
|
||||
(_profile_edd, Clouseau_Profile, # member, member, eet_type)
|
||||
|
||||
CFG_ADD_BASIC(name, EET_T_STRING);
|
||||
CFG_ADD_BASIC(script, EET_T_STRING);
|
||||
CFG_ADD_BASIC(type, EET_T_INT);
|
||||
|
||||
#undef CFG_ADD_BASIC
|
||||
}
|
||||
|
||||
static void
|
||||
_config_load()
|
||||
{
|
||||
char path[1024], *filename;
|
||||
sprintf(path, "%s/clouseau", efreet_config_home_get());
|
||||
if (!_mkdir(path)) return;
|
||||
sprintf(path, "%s/clouseau/profiles", efreet_config_home_get());
|
||||
if (!_mkdir(path)) return;
|
||||
Eina_List *files = ecore_file_ls(path), *itr;
|
||||
if (files) _profile_eet_load();
|
||||
EINA_LIST_FOREACH(files, itr, filename)
|
||||
{
|
||||
sprintf(path, "%s/clouseau/profiles/%s", efreet_config_home_get(), filename);
|
||||
Eet_File *file = eet_open(path, EET_FILE_MODE_READ);
|
||||
Clouseau_Profile *p = eet_data_read(file, _profile_edd, _PROFILE_EET_ENTRY);
|
||||
eet_close(file);
|
||||
_profiles = eina_list_append(_profiles, p);
|
||||
}
|
||||
}
|
||||
|
||||
static const Eina_Debug_Opcode ops[] =
|
||||
{
|
||||
{"daemon/client_status_register", &_cl_stat_reg_opcode, NULL},
|
||||
|
@ -547,6 +622,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
pub_widgets = gui_gui_get();
|
||||
|
||||
_config_load();
|
||||
|
||||
//Init objects Genlist
|
||||
if (!_objs_itc)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue