gchar* authors;
MidoriApp* app;
- gboolean active;
+ gint active;
gchar* config_dir;
GList* lsettings;
GHashTable* settings;
}
#define midori_extension_can_install_setting(extension, name) \
- if (extension->priv->active) \
+ if (extension->priv->active > 0) \
{ \
g_critical ("%s: Settings have to be installed before " \
"the extension is activated.", G_STRFUNC); \
}
extension->priv->app = g_object_ref (app);
- extension->priv->active = TRUE;
+ extension->priv->active = 1;
/* FIXME: Disconnect all signal handlers */
}
MIDORI_TYPE_EXTENSION, MidoriExtensionPrivate);
extension->priv->app = NULL;
- extension->priv->active = FALSE;
+ extension->priv->active = 0;
extension->priv->config_dir = NULL;
extension->priv->lsettings = NULL;
extension->priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal,
{
g_return_val_if_fail (MIDORI_IS_EXTENSION (extension), FALSE);
- return extension->priv->active;
+ return extension->priv->active > 0;
+}
+
+/**
+ * midori_extension_is_deactivating:
+ * @extension: a #MidoriExtension
+ *
+ * Determines if @extension is currently in the process of
+ * being deactivated.
+ *
+ * Extensions remain fully functional even while being
+ * deactivated, so you can for instance still save settings
+ * but you may need to cleanup during deactivation.
+ *
+ * Return value: %TRUE if @extension is deactivating
+ *
+ * Since: 0.1.7
+ **/
+gboolean
+midori_extension_is_deactivating (MidoriExtension* extension)
+{
+ g_return_val_if_fail (MIDORI_IS_EXTENSION (extension), FALSE);
+
+ return extension->priv->active == 2;
}
/**
{
g_return_if_fail (midori_extension_is_active (extension));
+ extension->priv->active = 2;
g_signal_emit (extension, signals[DEACTIVATE], 0);
- extension->priv->active = FALSE;
+ extension->priv->active = 0;
katze_object_assign (extension->priv->app, NULL);
}