]> spindle.queued.net Git - midori/commitdiff
Add midori_extension_is_active
authorChristian Dywan <christian@twotoasts.de>
Thu, 4 Dec 2008 00:42:02 +0000 (01:42 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 4 Dec 2008 00:42:02 +0000 (01:42 +0100)
midori/midori-extension.c
midori/midori-extension.h

index 3aadeebb44d83bcff26c93a4487a357c51c21d05..04228bd1e05ff31fb76ed2c9eaeb9cb9b3759be6 100644 (file)
@@ -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
index 7f13d5de560355575bc93a8eec3186f732a3e8dc..3e21056a5e3fe6d75af6ffd7ad2a562a2a117de1 100644 (file)
@@ -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);