forked from enlightenment/enlightenment
complete rewrite of all includes and file splitting to completely abstract dbus out of efm
SVN revision: 53051
This commit is contained in:
parent
f9c6eb799c
commit
04662b3565
|
@ -159,7 +159,9 @@ e_order.h \
|
||||||
e_exec.h \
|
e_exec.h \
|
||||||
e_widget_font_preview.h \
|
e_widget_font_preview.h \
|
||||||
e_fm_custom.h \
|
e_fm_custom.h \
|
||||||
e_fm_shared.h \
|
e_fm_shared_types.h \
|
||||||
|
e_fm_shared_codec.h \
|
||||||
|
e_fm_shared_dbus.h \
|
||||||
e_config_data.h \
|
e_config_data.h \
|
||||||
e_intl_data.h \
|
e_intl_data.h \
|
||||||
e_toolbar.h \
|
e_toolbar.h \
|
||||||
|
@ -277,6 +279,8 @@ e_confirm_dialog.c \
|
||||||
e_int_border_prop.c \
|
e_int_border_prop.c \
|
||||||
e_entry_dialog.c \
|
e_entry_dialog.c \
|
||||||
e_fm.c \
|
e_fm.c \
|
||||||
|
e_fm_shared_codec.c \
|
||||||
|
e_fm_shared_dbus.c \
|
||||||
e_fm_dbus.c \
|
e_fm_dbus.c \
|
||||||
e_fm_op_registry.c \
|
e_fm_op_registry.c \
|
||||||
e_widget_scrollframe.c \
|
e_widget_scrollframe.c \
|
||||||
|
|
|
@ -449,9 +449,8 @@ static Ecore_Timer *_e_fm2_mime_clear = NULL;
|
||||||
* _e_storage_volume_edd_init()
|
* _e_storage_volume_edd_init()
|
||||||
* _e_storage_volume_edd_shutdown()
|
* _e_storage_volume_edd_shutdown()
|
||||||
*/
|
*/
|
||||||
#define E_FM_SHARED_CODEC
|
|
||||||
#include "e_fm_shared.h"
|
#include "e_fm_shared_codec.h"
|
||||||
#undef E_FM_SHARED_CODEC
|
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
_e_fm2_icon_realpath(const E_Fm2_Icon *ic, char *buf, int buflen)
|
_e_fm2_icon_realpath(const E_Fm2_Icon *ic, char *buf, int buflen)
|
||||||
|
@ -2914,7 +2913,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
||||||
{
|
{
|
||||||
E_Storage *s;
|
E_Storage *s;
|
||||||
|
|
||||||
s = eet_data_descriptor_decode(_e_storage_edd, e->data, e->size);
|
s = _e_fm_shared_codec_storage_decode(e->data, e->size);
|
||||||
if (s) e_fm2_dbus_storage_add(s);
|
if (s) e_fm2_dbus_storage_add(s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2936,7 +2935,7 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
||||||
{
|
{
|
||||||
E_Volume *v;
|
E_Volume *v;
|
||||||
|
|
||||||
v = eet_data_descriptor_decode(_e_volume_edd, e->data, e->size);
|
v = _e_fm_shared_codec_volume_decode(e->data, e->size);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
e_fm2_dbus_volume_add(v);
|
e_fm2_dbus_volume_add(v);
|
||||||
|
|
|
@ -47,9 +47,7 @@ typedef struct _E_Fm2_Config E_Fm2_Config;
|
||||||
typedef struct _E_Fm2_Icon E_Fm2_Icon;
|
typedef struct _E_Fm2_Icon E_Fm2_Icon;
|
||||||
typedef struct _E_Fm2_Icon_Info E_Fm2_Icon_Info;
|
typedef struct _E_Fm2_Icon_Info E_Fm2_Icon_Info;
|
||||||
|
|
||||||
#define E_FM_SHARED_DATATYPES
|
#include "e_fm_shared_types.h"
|
||||||
#include "e_fm_shared.h"
|
|
||||||
#undef E_FM_SHARED_DATATYPES
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifndef E_FM_H
|
#ifndef E_FM_H
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
INCLUDES = -I$(top_builddir) \
|
||||||
|
-I$(top_srcdir) \
|
||||||
|
-I$(top_srcdir)/src/bin \
|
||||||
|
-I$(top_srcdir)/src/lib \
|
||||||
|
@e_cflags@ \
|
||||||
|
@x_cflags@ \
|
||||||
|
@cf_cflags@ \
|
||||||
|
@VALGRIND_CFLAGS@ \
|
||||||
|
@EDJE_DEF@ \
|
||||||
|
-DPACKAGE_BIN_DIR=\"@PACKAGE_BIN_DIR@\" \
|
||||||
|
-DPACKAGE_LIB_DIR=\"@PACKAGE_LIB_DIR@\" \
|
||||||
|
-DPACKAGE_DATA_DIR=\"@PACKAGE_DATA_DIR@\" \
|
||||||
|
-DLOCALE_DIR=\"@LOCALE_DIR@\" \
|
||||||
|
-DPACKAGE_SYSCONF_DIR=\"@PACKAGE_SYSCONF_DIR@\"
|
||||||
|
|
||||||
|
internal_bindir = $(libdir)/enlightenment/utils
|
||||||
|
internal_bin_PROGRAMS = \
|
||||||
|
enlightenment_fm
|
||||||
|
|
||||||
|
enlightenment_fm_SOURCES = \
|
||||||
|
e_fm_main.c \
|
||||||
|
e_fm_main_dbus.c \
|
||||||
|
e_fm_ipc.c \
|
||||||
|
../e_fm_shared_codec.c \
|
||||||
|
../e_fm_shared_dbus.c \
|
||||||
|
../e_user.c \
|
||||||
|
../e_sha1.c
|
||||||
|
|
||||||
|
enlightenment_fm_LDADD = @E_FM_LIBS@
|
||||||
|
enlightenment_fm_CFLAGS = $(INCLUDES)
|
||||||
|
|
||||||
|
|
|
@ -33,17 +33,12 @@
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
#include <Efreet.h>
|
#include <Efreet.h>
|
||||||
#include <Eet.h>
|
#include <Eet.h>
|
||||||
#include <E_DBus.h>
|
|
||||||
#ifdef HAVE_EUKIT
|
|
||||||
#include <E_Ukit.h>
|
|
||||||
#else
|
|
||||||
#include <E_Hal.h>
|
|
||||||
#endif
|
|
||||||
#include <eina_stringshare.h>
|
#include <eina_stringshare.h>
|
||||||
|
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
#include "e_fm_ipc.h"
|
#include "e_fm_ipc.h"
|
||||||
|
//#include "e_fm_shared_c.h"
|
||||||
#include "e_fm_op.h"
|
#include "e_fm_op.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +113,7 @@ struct _E_Fm_Task
|
||||||
int x,y;
|
int x,y;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "e_fm_shared.h"
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
Ecore_Ipc_Server *_e_fm_ipc_server = NULL;
|
Ecore_Ipc_Server *_e_fm_ipc_server = NULL;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef E_FM_IPC_H
|
#ifndef E_FM_IPC_H
|
||||||
#define E_FM_IPC_H
|
#define E_FM_IPC_H
|
||||||
|
|
||||||
|
#include "e_fm_shared_types.h"
|
||||||
|
|
||||||
int _e_fm_ipc_init(void);
|
int _e_fm_ipc_init(void);
|
||||||
Eina_Bool _e_fm_ipc_slave_data_cb(void *data, int type, void *event);
|
Eina_Bool _e_fm_ipc_slave_data_cb(void *data, int type, void *event);
|
||||||
Eina_Bool _e_fm_ipc_slave_error_cb(void *data, int type, void *event);
|
Eina_Bool _e_fm_ipc_slave_error_cb(void *data, int type, void *event);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef E_FM_MAIN_H
|
||||||
|
#define E_FM_MAIN_H
|
||||||
|
|
||||||
|
extern Ecore_Ipc_Server *_e_fm_ipc_server;
|
||||||
|
|
||||||
|
#define E_FM_MOUNT_TIMEOUT 30.0
|
||||||
|
#define E_FM_UNMOUNT_TIMEOUT 60.0
|
||||||
|
#define E_FM_EJECT_TIMEOUT 15.0
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef E_FM_MAIN_DBUS_H
|
||||||
|
#define E_FM_MAIN_DBUS_H
|
||||||
|
|
||||||
|
#include <E_DBus.h>
|
||||||
|
#include <E_Hal.h>
|
||||||
|
|
||||||
|
#include "e_fm_shared_types.h"
|
||||||
|
|
||||||
|
E_Volume *_e_fm_main_dbus_volume_add(const char *udi, Eina_Bool first_time);
|
||||||
|
void _e_fm_main_dbus_volume_del(const char *udi);
|
||||||
|
E_Volume *_e_fm_main_dbus_volume_find(const char *udi);
|
||||||
|
|
||||||
|
void _e_fm_main_dbus_volume_eject(E_Volume *v);
|
||||||
|
void _e_fm_main_dbus_volume_unmount(E_Volume *v);
|
||||||
|
void _e_fm_main_dbus_volume_mount(E_Volume *v);
|
||||||
|
|
||||||
|
E_Storage *_e_fm_main_dbus_storage_add(const char *udi);
|
||||||
|
void _e_fm_main_dbus_storage_del(const char *udi);
|
||||||
|
E_Storage *_e_fm_main_dbus_storage_find(const char *udi);
|
||||||
|
|
||||||
|
|
||||||
|
void _e_fm_main_dbus_init(void);
|
||||||
|
void _e_fm_main_dbus_shutdown(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,8 +1,6 @@
|
||||||
#include "e_fm_dbus.h"
|
#include "e_fm_dbus.h"
|
||||||
|
#include "e_fm_shared_codec.h"
|
||||||
#define E_FM_SHARED_CODEC
|
#include "e_fm_shared_dbus.h"
|
||||||
#include "e_fm_shared.h"
|
|
||||||
#undef E_FM_SHARED_CODEC
|
|
||||||
|
|
||||||
static void _e_fm2_volume_write(E_Volume *v) EINA_ARG_NONNULL(1);
|
static void _e_fm2_volume_write(E_Volume *v) EINA_ARG_NONNULL(1);
|
||||||
static void _e_fm2_volume_erase(E_Volume *v) EINA_ARG_NONNULL(1);
|
static void _e_fm2_volume_erase(E_Volume *v) EINA_ARG_NONNULL(1);
|
||||||
|
@ -74,7 +72,7 @@ e_fm2_dbus_storage_del(E_Storage *s)
|
||||||
{
|
{
|
||||||
// printf("STO- %s\n", s->udi);
|
// printf("STO- %s\n", s->udi);
|
||||||
_e_stores = eina_list_remove(_e_stores, s);
|
_e_stores = eina_list_remove(_e_stores, s);
|
||||||
_e_storage_free(s);
|
_e_fm_shared_dbus_storage_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI E_Storage *
|
EAPI E_Storage *
|
||||||
|
@ -279,7 +277,7 @@ e_fm2_dbus_volume_del(E_Volume *v)
|
||||||
_e_fm2_dbus_unmount_ok(m);
|
_e_fm2_dbus_unmount_ok(m);
|
||||||
_e_fm2_dbus_mount_free(m);
|
_e_fm2_dbus_mount_free(m);
|
||||||
}
|
}
|
||||||
_e_volume_free(v);
|
_e_fm_shared_dbus_volume_free(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,209 +0,0 @@
|
||||||
#ifdef E_FM_SHARED_DATATYPES
|
|
||||||
|
|
||||||
# define E_DEVICE_TYPE_STORAGE 1
|
|
||||||
# define E_DEVICE_TYPE_VOLUME 2
|
|
||||||
typedef struct _E_Storage E_Storage;
|
|
||||||
typedef struct _E_Volume E_Volume;
|
|
||||||
typedef struct _E_Fm2_Mount E_Fm2_Mount;
|
|
||||||
|
|
||||||
struct _E_Storage
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
const char *udi, *bus;
|
|
||||||
const char *drive_type;
|
|
||||||
|
|
||||||
const char *model, *vendor, *serial;
|
|
||||||
|
|
||||||
Eina_Bool removable;
|
|
||||||
Eina_Bool media_available;
|
|
||||||
unsigned long long media_size;
|
|
||||||
|
|
||||||
Eina_Bool requires_eject;
|
|
||||||
Eina_Bool hotpluggable;
|
|
||||||
Eina_Bool media_check_enabled;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
const char *drive, *volume;
|
|
||||||
} icon;
|
|
||||||
|
|
||||||
Eina_List *volumes;
|
|
||||||
|
|
||||||
Eina_Bool validated : 1;
|
|
||||||
Eina_Bool trackable : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Volume
|
|
||||||
{
|
|
||||||
int type;
|
|
||||||
const char *udi, *uuid;
|
|
||||||
const char *label, *icon, *fstype;
|
|
||||||
unsigned long long size;
|
|
||||||
|
|
||||||
Eina_Bool partition;
|
|
||||||
int partition_number;
|
|
||||||
const char *partition_label;
|
|
||||||
Eina_Bool mounted;
|
|
||||||
const char *mount_point;
|
|
||||||
|
|
||||||
const char *parent;
|
|
||||||
E_Storage *storage;
|
|
||||||
void *prop_handler;
|
|
||||||
Eina_List *mounts;
|
|
||||||
|
|
||||||
Eina_Bool validated : 1;
|
|
||||||
|
|
||||||
Eina_Bool auto_unmount : 1; // unmount, when last associated fm window closed
|
|
||||||
Eina_Bool first_time; // volume discovery in init sequence
|
|
||||||
Ecore_Timer *guard; // operation guard timer
|
|
||||||
DBusPendingCall *op; // d-bus call handle
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _E_Fm2_Mount
|
|
||||||
{
|
|
||||||
const char *udi;
|
|
||||||
const char *mount_point;
|
|
||||||
|
|
||||||
Ecore_Cb mount_ok;
|
|
||||||
Ecore_Cb mount_fail;
|
|
||||||
Ecore_Cb unmount_ok;
|
|
||||||
Ecore_Cb unmount_fail;
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
E_Volume *volume;
|
|
||||||
|
|
||||||
Eina_Bool mounted : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef E_FM_SHARED_CODEC
|
|
||||||
static Eet_Data_Descriptor *_e_volume_edd = NULL;
|
|
||||||
static Eet_Data_Descriptor *_e_storage_edd = NULL;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_volume_free(E_Volume *v)
|
|
||||||
{
|
|
||||||
if (v->storage)
|
|
||||||
{
|
|
||||||
v->storage->volumes = eina_list_remove(v->storage->volumes, v);
|
|
||||||
v->storage = NULL;
|
|
||||||
}
|
|
||||||
if (v->udi) eina_stringshare_del(v->udi);
|
|
||||||
if (v->uuid) eina_stringshare_del(v->uuid);
|
|
||||||
if (v->label) eina_stringshare_del(v->label);
|
|
||||||
if (v->icon) eina_stringshare_del(v->icon);
|
|
||||||
if (v->fstype) eina_stringshare_del(v->fstype);
|
|
||||||
if (v->partition_label) eina_stringshare_del(v->partition_label);
|
|
||||||
if (v->mount_point) eina_stringshare_del(v->mount_point);
|
|
||||||
if (v->parent) eina_stringshare_del(v->parent);
|
|
||||||
free(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_storage_free(E_Storage *s)
|
|
||||||
{
|
|
||||||
E_Volume *v;
|
|
||||||
EINA_LIST_FREE(s->volumes, v)
|
|
||||||
{
|
|
||||||
v->storage = NULL;
|
|
||||||
_e_volume_free(v);
|
|
||||||
}
|
|
||||||
if (s->udi) eina_stringshare_del(s->udi);
|
|
||||||
if (s->bus) eina_stringshare_del(s->bus);
|
|
||||||
if (s->drive_type) eina_stringshare_del(s->drive_type);
|
|
||||||
if (s->model) eina_stringshare_del(s->model);
|
|
||||||
if (s->vendor) eina_stringshare_del(s->vendor);
|
|
||||||
if (s->serial) eina_stringshare_del(s->serial);
|
|
||||||
if (s->icon.drive) eina_stringshare_del(s->icon.drive);
|
|
||||||
if (s->icon.volume) eina_stringshare_del(s->icon.volume);
|
|
||||||
free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eet_Data_Descriptor *
|
|
||||||
_e_volume_edd_new(void)
|
|
||||||
{
|
|
||||||
Eet_Data_Descriptor *edd;
|
|
||||||
Eet_Data_Descriptor_Class eddc;
|
|
||||||
|
|
||||||
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc), "e_volume", sizeof(E_Volume)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// eddc.func.str_alloc = (char *(*)(const char *)) strdup;
|
|
||||||
// eddc.func.str_free = (void (*)(const char *)) free;
|
|
||||||
|
|
||||||
edd = eet_data_descriptor_stream_new(&eddc);
|
|
||||||
#define DAT(MEMBER, TYPE) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Volume, #MEMBER, MEMBER, EET_T_##TYPE)
|
|
||||||
DAT(type, INT);
|
|
||||||
DAT(udi, STRING);
|
|
||||||
DAT(uuid, STRING);
|
|
||||||
DAT(label, STRING);
|
|
||||||
DAT(fstype, STRING);
|
|
||||||
DAT(size, ULONG_LONG);
|
|
||||||
DAT(partition, CHAR);
|
|
||||||
DAT(partition_number, INT);
|
|
||||||
DAT(partition_label, STRING);
|
|
||||||
DAT(mounted, CHAR);
|
|
||||||
DAT(mount_point, STRING);
|
|
||||||
DAT(parent, STRING);
|
|
||||||
DAT(first_time, CHAR);
|
|
||||||
#undef DAT
|
|
||||||
return edd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eet_Data_Descriptor *
|
|
||||||
_e_storage_edd_new(void)
|
|
||||||
{
|
|
||||||
Eet_Data_Descriptor *edd;
|
|
||||||
Eet_Data_Descriptor_Class eddc;
|
|
||||||
|
|
||||||
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "e_storage", sizeof (E_Storage)))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// eddc.func.str_alloc = (char *(*)(const char *)) strdup;
|
|
||||||
// eddc.func.str_free = (void (*)(const char *)) free;
|
|
||||||
|
|
||||||
edd = eet_data_descriptor_stream_new(&eddc);
|
|
||||||
#define DAT(MEMBER, TYPE) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Storage, #MEMBER, MEMBER, EET_T_##TYPE)
|
|
||||||
DAT(type, INT);
|
|
||||||
DAT(udi, STRING);
|
|
||||||
DAT(bus, STRING);
|
|
||||||
DAT(drive_type, STRING);
|
|
||||||
DAT(model, STRING);
|
|
||||||
DAT(vendor, STRING);
|
|
||||||
DAT(serial, STRING);
|
|
||||||
DAT(removable, CHAR);
|
|
||||||
DAT(media_available, CHAR);
|
|
||||||
DAT(media_size, ULONG_LONG);
|
|
||||||
DAT(requires_eject, CHAR);
|
|
||||||
DAT(hotpluggable, CHAR);
|
|
||||||
DAT(media_check_enabled, CHAR);
|
|
||||||
DAT(icon.drive, STRING);
|
|
||||||
DAT(icon.volume, STRING);
|
|
||||||
#undef DAT
|
|
||||||
return edd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_storage_volume_edd_init(void)
|
|
||||||
{
|
|
||||||
_e_volume_edd = _e_volume_edd_new();
|
|
||||||
_e_storage_edd = _e_storage_edd_new();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_e_storage_volume_edd_shutdown(void)
|
|
||||||
{
|
|
||||||
if (_e_volume_edd)
|
|
||||||
{
|
|
||||||
eet_data_descriptor_free(_e_volume_edd);
|
|
||||||
_e_volume_edd = NULL;
|
|
||||||
}
|
|
||||||
if (_e_storage_edd)
|
|
||||||
{
|
|
||||||
eet_data_descriptor_free(_e_storage_edd);
|
|
||||||
_e_storage_edd = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
#include "e_fm_shared_types.h"
|
||||||
|
#include "e_fm_shared_codec.h"
|
||||||
|
|
||||||
|
static Eet_Data_Descriptor *_e_volume_edd = NULL;
|
||||||
|
static Eet_Data_Descriptor *_e_storage_edd = NULL;
|
||||||
|
|
||||||
|
Eet_Data_Descriptor *
|
||||||
|
_e_volume_edd_new(void)
|
||||||
|
{
|
||||||
|
Eet_Data_Descriptor *edd;
|
||||||
|
Eet_Data_Descriptor_Class eddc;
|
||||||
|
|
||||||
|
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc), "e_volume", sizeof(E_Volume)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// eddc.func.str_alloc = (char *(*)(const char *)) strdup;
|
||||||
|
// eddc.func.str_free = (void (*)(const char *)) free;
|
||||||
|
|
||||||
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
|
#define DAT(MEMBER, TYPE) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Volume, #MEMBER, MEMBER, EET_T_##TYPE)
|
||||||
|
DAT(type, INT);
|
||||||
|
DAT(udi, STRING);
|
||||||
|
DAT(uuid, STRING);
|
||||||
|
DAT(label, STRING);
|
||||||
|
DAT(fstype, STRING);
|
||||||
|
DAT(size, ULONG_LONG);
|
||||||
|
DAT(partition, CHAR);
|
||||||
|
DAT(partition_number, INT);
|
||||||
|
DAT(partition_label, STRING);
|
||||||
|
DAT(mounted, CHAR);
|
||||||
|
DAT(mount_point, STRING);
|
||||||
|
DAT(parent, STRING);
|
||||||
|
DAT(first_time, CHAR);
|
||||||
|
#undef DAT
|
||||||
|
return edd;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eet_Data_Descriptor *
|
||||||
|
_e_storage_edd_new(void)
|
||||||
|
{
|
||||||
|
Eet_Data_Descriptor *edd;
|
||||||
|
Eet_Data_Descriptor_Class eddc;
|
||||||
|
|
||||||
|
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "e_storage", sizeof (E_Storage)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// eddc.func.str_alloc = (char *(*)(const char *)) strdup;
|
||||||
|
// eddc.func.str_free = (void (*)(const char *)) free;
|
||||||
|
|
||||||
|
edd = eet_data_descriptor_stream_new(&eddc);
|
||||||
|
#define DAT(MEMBER, TYPE) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Storage, #MEMBER, MEMBER, EET_T_##TYPE)
|
||||||
|
DAT(type, INT);
|
||||||
|
DAT(udi, STRING);
|
||||||
|
DAT(bus, STRING);
|
||||||
|
DAT(drive_type, STRING);
|
||||||
|
DAT(model, STRING);
|
||||||
|
DAT(vendor, STRING);
|
||||||
|
DAT(serial, STRING);
|
||||||
|
DAT(removable, CHAR);
|
||||||
|
DAT(media_available, CHAR);
|
||||||
|
DAT(media_size, ULONG_LONG);
|
||||||
|
DAT(requires_eject, CHAR);
|
||||||
|
DAT(hotpluggable, CHAR);
|
||||||
|
DAT(media_check_enabled, CHAR);
|
||||||
|
DAT(icon.drive, STRING);
|
||||||
|
DAT(icon.volume, STRING);
|
||||||
|
#undef DAT
|
||||||
|
return edd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
_e_fm_shared_codec_storage_encode(E_Storage *s, int *size)
|
||||||
|
{
|
||||||
|
return eet_data_descriptor_encode(_e_storage_edd, s, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
E_Storage *
|
||||||
|
_e_fm_shared_codec_storage_decode(void *s, int size)
|
||||||
|
{
|
||||||
|
return eet_data_descriptor_decode(_e_storage_edd, s, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *
|
||||||
|
_e_fm_shared_codec_volume_encode(E_Volume *v, int *size)
|
||||||
|
{
|
||||||
|
return eet_data_descriptor_encode(_e_volume_edd, v, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
E_Volume *
|
||||||
|
_e_fm_shared_codec_volume_decode(void *v, int size)
|
||||||
|
{
|
||||||
|
return eet_data_descriptor_decode(_e_volume_edd, v, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_e_storage_volume_edd_init(void)
|
||||||
|
{
|
||||||
|
_e_volume_edd = _e_volume_edd_new();
|
||||||
|
_e_storage_edd = _e_storage_edd_new();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_e_storage_volume_edd_shutdown(void)
|
||||||
|
{
|
||||||
|
if (_e_volume_edd)
|
||||||
|
{
|
||||||
|
eet_data_descriptor_free(_e_volume_edd);
|
||||||
|
_e_volume_edd = NULL;
|
||||||
|
}
|
||||||
|
if (_e_storage_edd)
|
||||||
|
{
|
||||||
|
eet_data_descriptor_free(_e_storage_edd);
|
||||||
|
_e_storage_edd = NULL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef E_FM_SHARED_CODEC
|
||||||
|
#define E_FM_SHARED_CODEC
|
||||||
|
|
||||||
|
#include <Eet.h>
|
||||||
|
|
||||||
|
void *_e_fm_shared_codec_storage_encode(E_Storage *s, int *size);
|
||||||
|
E_Storage *_e_fm_shared_codec_storage_decode(void *s, int size);
|
||||||
|
void *_e_fm_shared_codec_volume_encode(E_Volume *v, int *size);
|
||||||
|
E_Volume *_e_fm_shared_codec_volume_decode(void *v, int size);
|
||||||
|
|
||||||
|
Eet_Data_Descriptor *_e_volume_edd_new(void);
|
||||||
|
Eet_Data_Descriptor *_e_storage_edd_new(void);
|
||||||
|
void _e_storage_volume_edd_init(void);
|
||||||
|
void _e_storage_volume_edd_shutdown(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,42 @@
|
||||||
|
#include "e_fm_shared_types.h"
|
||||||
|
#include "e_fm_shared_dbus.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
_e_fm_shared_dbus_storage_free(E_Storage *s)
|
||||||
|
{
|
||||||
|
E_Volume *v;
|
||||||
|
EINA_LIST_FREE(s->volumes, v)
|
||||||
|
{
|
||||||
|
v->storage = NULL;
|
||||||
|
_e_fm_shared_dbus_volume_free(v);
|
||||||
|
}
|
||||||
|
if (s->udi) eina_stringshare_del(s->udi);
|
||||||
|
if (s->bus) eina_stringshare_del(s->bus);
|
||||||
|
if (s->drive_type) eina_stringshare_del(s->drive_type);
|
||||||
|
if (s->model) eina_stringshare_del(s->model);
|
||||||
|
if (s->vendor) eina_stringshare_del(s->vendor);
|
||||||
|
if (s->serial) eina_stringshare_del(s->serial);
|
||||||
|
if (s->icon.drive) eina_stringshare_del(s->icon.drive);
|
||||||
|
if (s->icon.volume) eina_stringshare_del(s->icon.volume);
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_e_fm_shared_dbus_volume_free(E_Volume *v)
|
||||||
|
{
|
||||||
|
if (v->storage)
|
||||||
|
{
|
||||||
|
v->storage->volumes = eina_list_remove(v->storage->volumes, v);
|
||||||
|
v->storage = NULL;
|
||||||
|
}
|
||||||
|
if (v->udi) eina_stringshare_del(v->udi);
|
||||||
|
if (v->uuid) eina_stringshare_del(v->uuid);
|
||||||
|
if (v->label) eina_stringshare_del(v->label);
|
||||||
|
if (v->icon) eina_stringshare_del(v->icon);
|
||||||
|
if (v->fstype) eina_stringshare_del(v->fstype);
|
||||||
|
if (v->partition_label) eina_stringshare_del(v->partition_label);
|
||||||
|
if (v->mount_point) eina_stringshare_del(v->mount_point);
|
||||||
|
if (v->parent) eina_stringshare_del(v->parent);
|
||||||
|
free(v);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef E_FM_SHARED_DBUS_H
|
||||||
|
#define E_FM_SHARED_DBUS_H
|
||||||
|
|
||||||
|
#include "e_fm_shared_types.h"
|
||||||
|
|
||||||
|
void _e_fm_shared_dbus_storage_free(E_Storage *s);
|
||||||
|
void _e_fm_shared_dbus_volume_free(E_Volume *v);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,85 @@
|
||||||
|
#ifndef E_FM_SHARED_TYPES
|
||||||
|
#define E_FM_SHARED_TYPES
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
|
#include <Ecore.h>
|
||||||
|
#include <E_DBus.h>
|
||||||
|
|
||||||
|
# define E_DEVICE_TYPE_STORAGE 1
|
||||||
|
# define E_DEVICE_TYPE_VOLUME 2
|
||||||
|
typedef struct _E_Storage E_Storage;
|
||||||
|
typedef struct _E_Volume E_Volume;
|
||||||
|
typedef struct _E_Fm2_Mount E_Fm2_Mount;
|
||||||
|
|
||||||
|
#ifndef HAVE_EEZE_MOUNT
|
||||||
|
struct _E_Storage
|
||||||
|
{
|
||||||
|
int type;
|
||||||
|
const char *udi, *bus;
|
||||||
|
const char *drive_type;
|
||||||
|
|
||||||
|
const char *model, *vendor, *serial;
|
||||||
|
|
||||||
|
Eina_Bool removable;
|
||||||
|
Eina_Bool media_available;
|
||||||
|
unsigned long long media_size;
|
||||||
|
|
||||||
|
Eina_Bool requires_eject;
|
||||||
|
Eina_Bool hotpluggable;
|
||||||
|
Eina_Bool media_check_enabled;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *drive, *volume;
|
||||||
|
} icon;
|
||||||
|
|
||||||
|
Eina_List *volumes;
|
||||||
|
|
||||||
|
Eina_Bool validated : 1;
|
||||||
|
Eina_Bool trackable : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _E_Volume
|
||||||
|
{
|
||||||
|
int type;
|
||||||
|
const char *udi, *uuid;
|
||||||
|
const char *label, *icon, *fstype;
|
||||||
|
unsigned long long size;
|
||||||
|
|
||||||
|
Eina_Bool partition;
|
||||||
|
int partition_number;
|
||||||
|
const char *partition_label;
|
||||||
|
Eina_Bool mounted;
|
||||||
|
const char *mount_point;
|
||||||
|
|
||||||
|
const char *parent;
|
||||||
|
E_Storage *storage;
|
||||||
|
void *prop_handler;
|
||||||
|
Eina_List *mounts;
|
||||||
|
|
||||||
|
Eina_Bool validated : 1;
|
||||||
|
|
||||||
|
Eina_Bool auto_unmount : 1; // unmount, when last associated fm window closed
|
||||||
|
Eina_Bool first_time; // volume discovery in init sequence
|
||||||
|
Ecore_Timer *guard; // operation guard timer
|
||||||
|
DBusPendingCall *op; // d-bus call handle
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _E_Fm2_Mount
|
||||||
|
{
|
||||||
|
const char *udi;
|
||||||
|
const char *mount_point;
|
||||||
|
|
||||||
|
Ecore_Cb mount_ok;
|
||||||
|
Ecore_Cb mount_fail;
|
||||||
|
Ecore_Cb unmount_ok;
|
||||||
|
Ecore_Cb unmount_fail;
|
||||||
|
void *data;
|
||||||
|
|
||||||
|
E_Volume *volume;
|
||||||
|
|
||||||
|
Eina_Bool mounted : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
Loading…
Reference in New Issue