From: Christian Dywan Date: Sun, 7 Jun 2009 00:15:32 +0000 (+0200) Subject: Listen for (de)activation of extensions and save the config X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eddb0b30dfa71b8858cca6ae9ed4fa0fbfc3f375;p=midori Listen for (de)activation of extensions and save the config --- diff --git a/midori/main.c b/midori/main.c index 1c3b26a0..7f472614 100644 --- a/midori/main.c +++ b/midori/main.c @@ -744,6 +744,15 @@ settings_notify_cb (MidoriWebSettings* settings, g_free (config_file); } +static void +extension_activate_cb (MidoriExtension* extension, + MidoriApp* app) +{ + MidoriWebSettings* settings = katze_object_get_object (app, "settings"); + settings_notify_cb (settings, NULL, app); + g_object_unref (settings); +} + static void accel_map_changed_cb (GtkAccelMap* accel_map, gchar* accel_path, @@ -1185,6 +1194,8 @@ midori_load_extensions (gpointer data) if (extension_dir != NULL) { const gchar* filename; + gchar* config_file = build_config_filename ("config"); + gboolean is_writable = is_writable (config_file); while ((filename = g_dir_read_name (extension_dir))) { @@ -1228,9 +1239,17 @@ midori_load_extensions (gpointer data) if (!g_strcmp0 (filename, name)) g_signal_emit_by_name (extension, "activate", app); } + if (is_writable) + { + g_signal_connect_after (extension, "activate", + G_CALLBACK (extension_activate_cb), app); + g_signal_connect_after (extension, "deactivate", + G_CALLBACK (extension_activate_cb), app); + } g_object_unref (extension); } g_dir_close (extension_dir); + g_free (config_file); } g_free (extension_path); }