PlankServicesPreferences

PlankServicesPreferences — The base class for all preferences in the system. Preferences are serialized to files. The file is watched for changes and loads new values if the backing file changed. When any public property of a sub-class is changed, the public properties are serialized to the backing file.

Synopsis

#define             PLANK_SERVICES_TYPE_PREFERENCES
void                plank_services_preferences_verify   (PlankServicesPreferences *self,
                                                         const gchar *prop);
void                plank_services_preferences_reset_properties
                                                        (PlankServicesPreferences *self);
void                plank_services_preferences_init_from_file
                                                        (PlankServicesPreferences *self,
                                                         GFile *file);
void                plank_services_preferences_init_from_filename
                                                        (PlankServicesPreferences *self,
                                                         const gchar *filename);
void                plank_services_preferences_delay    (PlankServicesPreferences *self);
void                plank_services_preferences_apply    (PlankServicesPreferences *self);
gchar *             plank_services_preferences_get_filename
                                                        (PlankServicesPreferences *self);
void                plank_services_preferences_delete   (PlankServicesPreferences *self);
struct              PlankServicesPreferences;
struct              PlankServicesPreferencesClass;
gchar *             plank_services_prefs_serializable_prefs_serialize
                                                        (PlankServicesPrefsSerializable *self);
void                plank_services_prefs_serializable_prefs_deserialize
                                                        (PlankServicesPrefsSerializable *self,
                                                         const gchar *s);
                    PlankServicesPrefsSerializable;
struct              PlankServicesPrefsSerializableIface;

Object Hierarchy

  GObject
   +----PlankServicesPreferences
         +----PlankDockPreferences
         +----PlankDrawingTheme
         +----PlankItemsDockItemPreferences
  GInterface
   +----PlankServicesPrefsSerializable

Prerequisites

PlankServicesPrefsSerializable requires GObject.

Signals

  "deleted"                                        : Run Last

Description

Details

PLANK_SERVICES_TYPE_PREFERENCES

#define PLANK_SERVICES_TYPE_PREFERENCES (plank_services_preferences_get_type ())

The type for PlankServicesPreferences.


plank_services_preferences_verify ()

void                plank_services_preferences_verify   (PlankServicesPreferences *self,
                                                         const gchar *prop);

This method will verify the value of a property. If the value is wrong, this method should replace it with a sanitized value.

self :

the PlankServicesPreferences instance

prop :

 . the name of the property that needs verified. [in]

plank_services_preferences_reset_properties ()

void                plank_services_preferences_reset_properties
                                                        (PlankServicesPreferences *self);

Resets all properties to their default values. Called from construct and before loading from the backing file.

self :

the PlankServicesPreferences instance

plank_services_preferences_init_from_file ()

void                plank_services_preferences_init_from_file
                                                        (PlankServicesPreferences *self,
                                                         GFile *file);

Initializes this preferences with a backing file.

self :

the PlankServicesPreferences instance

file :

 . the GFile of the backing file for this preferences. [in]

plank_services_preferences_init_from_filename ()

void                plank_services_preferences_init_from_filename
                                                        (PlankServicesPreferences *self,
                                                         const gchar *filename);

Initializes this preferences with a backing filename.

self :

the PlankServicesPreferences instance

filename :

 . of the backing file for this preferences. [in]

plank_services_preferences_delay ()

void                plank_services_preferences_delay    (PlankServicesPreferences *self);

Delays saving changes to the backing file until apply() is called.

self :

the PlankServicesPreferences instance

plank_services_preferences_apply ()

void                plank_services_preferences_apply    (PlankServicesPreferences *self);

If any settings were changed, apply them now.

self :

the PlankServicesPreferences instance

plank_services_preferences_get_filename ()

gchar *             plank_services_preferences_get_filename
                                                        (PlankServicesPreferences *self);

Returns the filename of the backing file.

self :

the PlankServicesPreferences instance

Returns :

the filename of the backing file

plank_services_preferences_delete ()

void                plank_services_preferences_delete   (PlankServicesPreferences *self);

This forces the deletion of the backing file for this preferences.

self :

the PlankServicesPreferences instance

struct PlankServicesPreferences

struct PlankServicesPreferences;

The base class for all preferences in the system. Preferences are serialized to files. The file is watched for changes and loads new values if the backing file changed. When any public property of a sub-class is changed, the public properties are serialized to the backing file.


struct PlankServicesPreferencesClass

struct PlankServicesPreferencesClass {
	GObjectClass parent_class;
	void (*verify) (PlankServicesPreferences* self, const gchar* prop);
	void (*reset_properties) (PlankServicesPreferences* self);
};

The class structure for PLANK_SERVICES_TYPE_PREFERENCES. All the fields in this structure are private and should never be accessed directly.

GObjectClass parent_class;

the parent class structure

verify ()

virtual method used internally

reset_properties ()

virtual method used internally

plank_services_prefs_serializable_prefs_serialize ()

gchar *             plank_services_prefs_serializable_prefs_serialize
                                                        (PlankServicesPrefsSerializable *self);

Serializes the object into a string representation.

self :

the PlankServicesPrefsSerializable instance

Returns :

the string representation of the object

plank_services_prefs_serializable_prefs_deserialize ()

void                plank_services_prefs_serializable_prefs_deserialize
                                                        (PlankServicesPrefsSerializable *self,
                                                         const gchar *s);

De-serializes the object from a string representation.

self :

the PlankServicesPrefsSerializable instance

s :

 . the string representation of the object. [in]

PlankServicesPrefsSerializable

typedef struct _PlankServicesPrefsSerializable PlankServicesPrefsSerializable;

This interface is used by objects that need to be serialized in a Preferences. The object must have a string representation and provide these methods to translate between the string and object representations.


struct PlankServicesPrefsSerializableIface

struct PlankServicesPrefsSerializableIface {
	GTypeInterface parent_iface;
	gchar* (*prefs_serialize) (PlankServicesPrefsSerializable* self);
	void (*prefs_deserialize) (PlankServicesPrefsSerializable* self, const gchar* s);
};

Interface for creating PlankServicesPrefsSerializable implementations.

GTypeInterface parent_iface;

the parent interface structure

prefs_serialize ()

virtual method called by plank_services_prefs_serializable_prefs_serialize()

prefs_deserialize ()

virtual method called by plank_services_prefs_serializable_prefs_deserialize()

Signal Details

The "deleted" signal

void                user_function                      (PlankServicesPreferences *preferences,
                                                        gpointer                  user_data)        : Run Last

This signal indicates that the backing file for this preferences was deleted.

preferences :

the PlankServicesPreferences instance that received the signal

user_data :

user data set when the signal handler was connected.