#ifndef __MTM_EXT_H__
#define __MTM_EXT_H__

#define MTM_EXT_TYPE		(mtm_ext_get_type ())
#define MTM_EXT(o)		(GTK_CHECK_CAST ((o), MTM_EXT_TYPE, MtmExt))
#define MTM_EXT_CLASS(k)	(GTK_CHECK_CLASS_CAST((k), MTM_EXT_TYPE, MtmExtClass))
#define MTM_IS_EXT(o)		(GTK_CHECK_TYPE ((o), MTM_EXT_TYPE))
#define MTM_IS_EXT_CLASS(k)	(GTK_CHECK_CLASS_TYPE ((k), MTM_EXT_TYPE))

typedef struct _MtmExt MtmExt;
typedef struct _MtmExtPrivate MtmExtPrivate;

typedef struct _MtmExtClass MtmExtClass;

#include <mtm/mtm-stateful.h>
#include <mtm/mtm-ext-handler.h>

struct _MtmExt
{
	MtmStateful parent;
	
	/* These are all GtkArg-enabled */
	gboolean enabled; /* Whether to install/uninstall */
	gboolean activate; /* Whether to activate*/
	gboolean update_ext; /* You get the idea now */
	
	/* Note that if you change the type, the stuff mirrored from the
	 * handler changes auto-magically.
	 * This will not affect editcmd if it has been changed
	 * from the default. */
	gchar *type;
	MtmExtHandler *handler;
	gchar *editcmd;

	gchar *file;
	gchar *url;
	
	MtmExtPrivate *priv;
};

struct _MtmExtClass
{
	MtmStatefulClass parent_class;
};

GtkType mtm_ext_get_type (void);

MtmExt *mtm_ext_new (MtmEnv *env);
void mtm_ext_construct (MtmExt *ext, MtmEnv *env);

MtmExt *mtm_ext_new_with_type (MtmEnv *env, gchar *type);
void mtm_ext_construct_with_type (MtmExt *ext, MtmEnv *env, gchar *type);

MtmExt *mtm_ext_dup (MtmExt *ext);

/* The plugins call these */
void mtm_ext_set_installed (MtmExt *ext, gboolean is_root, gchar *installed);

/* This one also queries the plugins */
gchar *mtm_ext_get_installed (MtmExt *ext, gboolean *is_root);

/* This one only does metatheme-installed ones. */
gchar *mtm_ext_get_installed_with_root (MtmExt *ext, gboolean is_root);

/* Hooray for accessor functions! You can
 * safely ignore the ::get ones. But *please* use the ::set ones. */
gboolean mtm_ext_get_enabled (MtmExt *ext);
void mtm_ext_set_enabled (MtmExt *ext, gboolean enabled);

gboolean mtm_ext_get_activate (MtmExt *ext);
void mtm_ext_set_activate (MtmExt *ext, gboolean activate);

gboolean mtm_ext_get_update_ext (MtmExt *ext);
void mtm_ext_set_update_ext (MtmExt *ext, gboolean update_ext);

gchar *mtm_ext_get_ext_type (MtmExt *ext);
void mtm_ext_set_ext_type (MtmExt *ext, gchar *type);

MtmExtHandler* mtm_ext_get_handler (MtmExt *ext);

gchar *mtm_ext_get_editcmd (MtmExt *ext);
void mtm_ext_set_editcmd (MtmExt *ext, gchar *editcmd);

gchar *mtm_ext_get_file (MtmExt *ext);
void mtm_ext_set_file (MtmExt *ext, gchar *file);

gchar *mtm_ext_get_url (MtmExt *ext);
void mtm_ext_set_url (MtmExt *ext, gchar *url);

#endif /* __MTM_EXT_H__ */
