mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
New settings manager based on XSettingsManager. Also it have
ability to serialize data at the shutdown and load it at the startup.
This commit is contained in:
47
evoke/Xsm.h
47
evoke/Xsm.h
@@ -13,54 +13,17 @@
|
||||
#ifndef __XSM_H__
|
||||
#define __XSM_H__
|
||||
|
||||
#include <X11/Xlib.h> // XEvent
|
||||
#include <edelib/XSettingsManager.h>
|
||||
|
||||
/*
|
||||
* This is manager class for XSETTINGS protocol. XSETTINGS provides a mechanism
|
||||
* for applications to share simple configuration settings like background
|
||||
* colors no matter what toolkit is used. For now only gtk fully supports it
|
||||
* and support for ede apps is going to be added.
|
||||
*
|
||||
* The protocol (0.5 version) is described at:
|
||||
* http://standards.freedesktop.org/xsettings-spec/xsettings-spec-0.5.html
|
||||
*
|
||||
* This code is greatly based on xsettings referent implementation I found on
|
||||
* freedesktop.org cvs, since specs are very unclear about the details.
|
||||
* Author of referent implementation is Owen Taylor.
|
||||
* XSETTINGS manager with serialization capability.
|
||||
*/
|
||||
|
||||
struct XsmData;
|
||||
struct XsettingsSetting;
|
||||
struct XsettingsBuffer;
|
||||
|
||||
/*
|
||||
* Enum order must be exact on client side too, since via these values
|
||||
* client will try to decode settings.
|
||||
*/
|
||||
enum XsettingsType {
|
||||
XS_TYPE_INT = 0,
|
||||
XS_TYPE_STRING,
|
||||
XS_TYPE_COLOR
|
||||
};
|
||||
|
||||
class Xsm {
|
||||
private:
|
||||
XsmData* data;
|
||||
void set_setting(const XsettingsSetting* setting);
|
||||
void delete_setting(XsettingsSetting* setting);
|
||||
|
||||
class Xsm : public edelib::XSettingsManager {
|
||||
public:
|
||||
Xsm();
|
||||
~Xsm();
|
||||
bool is_running(void);
|
||||
bool init(void);
|
||||
bool should_quit(const XEvent* xev);
|
||||
|
||||
void set_int(const char* name, int val);
|
||||
void set_color(const char* name,
|
||||
unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha);
|
||||
void set_string(const char* name, const char* str);
|
||||
void notify(void);
|
||||
bool load_serialized(const char* file);
|
||||
bool save_serialized(const char* file);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user