Logo Search packages:      
Sourcecode: libdesktop-agnostic version File versions  Download package

config-bridge.h

/* 
 * Provides a method to bind configuration entries to a GObject.
 *
 * Copyright (C) 2008, 2009 Mark Lee <libdesktop-agnostic@lazymalevolence.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * Author : Neil J. Patel <njpatel@gmail.com> (Original C code)
 * Author : Mark Lee <libdesktop-agnostic@lazymalevolence.com>
 */

#ifndef __LIBDESKTOP_AGNOSTIC_CONFIG_BRIDGE_H__
#define __LIBDESKTOP_AGNOSTIC_CONFIG_BRIDGE_H__

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <libdesktop-agnostic/config-iface.h>

G_BEGIN_DECLS

typedef struct _DesktopAgnosticConfigBinding DesktopAgnosticConfigBinding;

#define DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE (desktop_agnostic_config_bridge_get_type ())
#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridge))
#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass))
#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE))
#define DESKTOP_AGNOSTIC_CONFIG_IS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE))
#define DESKTOP_AGNOSTIC_CONFIG_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOP_AGNOSTIC_CONFIG_TYPE_BRIDGE, DesktopAgnosticConfigBridgeClass))

typedef struct _DesktopAgnosticConfigBridge DesktopAgnosticConfigBridge;
typedef struct _DesktopAgnosticConfigBridgeClass DesktopAgnosticConfigBridgeClass;
typedef struct _DesktopAgnosticConfigBridgePrivate DesktopAgnosticConfigBridgePrivate;

/**
   * Note: trying to get this working as a struct seems to be more trouble than
   * it's worth.
   */
00052 struct _DesktopAgnosticConfigBinding {
      DesktopAgnosticConfigBackend* cfg;
      char* group;
      char* key;
      GObject* obj;
      char* property_name;
      gulong notify_id;
      gboolean read_only;
};

/**
   * Provides a convenient way for a GObject's properties and associated
   * configuration keys to be in sync for the duration of the object's life.
   */
00066 struct _DesktopAgnosticConfigBridge {
      GObject parent_instance;
      DesktopAgnosticConfigBridgePrivate * priv;
};

struct _DesktopAgnosticConfigBridgeClass {
      GObjectClass parent_class;
};


DesktopAgnosticConfigBinding* desktop_agnostic_config_binding_new (void);
void desktop_agnostic_config_binding_free (DesktopAgnosticConfigBinding* self);
DesktopAgnosticConfigBridge* desktop_agnostic_config_bridge_get_default (void);
void desktop_agnostic_config_bridge_bind (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, gboolean read_only, GError** error);
void desktop_agnostic_config_bridge_remove (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, const char* group, const char* key, GObject* obj, const char* property_name, GError** error);
void desktop_agnostic_config_bridge_remove_all_for_object (DesktopAgnosticConfigBridge* self, DesktopAgnosticConfigBackend* config, GObject* obj, GError** error);
GType desktop_agnostic_config_bridge_get_type (void);


G_END_DECLS

#endif

Generated by  Doxygen 1.6.0   Back to index