From b5e2146249c6357cd4eb670478c0ec297b621b2f Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 4 Dec 2008 01:42:02 +0100 Subject: [PATCH] Add midori_extension_is_active --- midori/midori-extension.c | 31 +++++++++++++++++++++++++++++++ midori/midori-extension.h | 3 +++ 2 files changed, 34 insertions(+) diff --git a/midori/midori-extension.c b/midori/midori-extension.c index 3aadeebb..04228bd1 100644 --- a/midori/midori-extension.c +++ b/midori/midori-extension.c @@ -28,6 +28,7 @@ struct _MidoriExtensionPrivate gchar* version; gchar* authors; + gboolean active; gchar* config_dir; }; @@ -139,13 +140,25 @@ midori_extension_class_init (MidoriExtensionClass* class) g_type_class_add_private (class, sizeof (MidoriExtensionPrivate)); } +void +midori_extension_activate_cb (MidoriExtension* extension, + MidoriApp* app) +{ + extension->priv->active = TRUE; + /* FIXME: Disconnect all signal handlers */ +} + static void midori_extension_init (MidoriExtension* extension) { extension->priv = G_TYPE_INSTANCE_GET_PRIVATE (extension, MIDORI_TYPE_EXTENSION, MidoriExtensionPrivate); + extension->priv->active = FALSE; extension->priv->config_dir = NULL; + + g_signal_connect (extension, "activate", + G_CALLBACK (midori_extension_activate_cb), NULL); } static void @@ -239,6 +252,24 @@ midori_extension_is_prepared (MidoriExtension* extension) return FALSE; } +/** + * midori_extension_is_active: + * @extension: a #MidoriExtension + * + * Determines if @extension is active. + * + * Return value: %TRUE if @extension is active + * + * Since: 0.1.2 + **/ +gboolean +midori_extension_is_active (MidoriExtension* extension) +{ + g_return_val_if_fail (MIDORI_IS_EXTENSION (extension), FALSE); + + return extension->priv->active; +} + /** * midori_extension_deactivate: * @extension: a #MidoriExtension diff --git a/midori/midori-extension.h b/midori/midori-extension.h index 7f13d5de..3e21056a 100644 --- a/midori/midori-extension.h +++ b/midori/midori-extension.h @@ -51,6 +51,9 @@ midori_extension_get_type (void); gboolean midori_extension_is_prepared (MidoriExtension* extension); +gboolean +midori_extension_is_active (MidoriExtension* extension); + void midori_extension_deactivate (MidoriExtension* extension);