static void
pluma_prefs_manager_max_recents_changed (GSettings *settings,
        gchar       *key,
        gpointer     user_data)
{
    pluma_debug (DEBUG_PREFS);

    if (strcmp (key, GPM_MAX_RECENTS) == 0)
    {
        const GList *windows;
        gint max;

        max = g_settings_get_int (settings, key);

        if (max < 0) {
            max = GPM_DEFAULT_MAX_RECENTS;
        }

        windows = pluma_app_get_windows (pluma_app_get_default ());
        while (windows != NULL)
        {
            PlumaWindow *w = windows->data;

            gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (w->priv->toolbar_recent_menu),
                                          max);

            windows = g_list_next (windows);
        }

        /* FIXME: we have no way at the moment to trigger the
         * update of the inline recents in the File menu */
    }
}
static void
pluma_plugins_engine_deactivate_plugin_real (PlumaPluginsEngine *engine,
					     PlumaPluginInfo *info)
{
	const GList *wins;
	PlumaPluginLoader *loader;

	if (!pluma_plugin_info_is_active (info) ||
	    !pluma_plugin_info_is_available (info))
		return;

	for (wins = pluma_app_get_windows (pluma_app_get_default ());
	     wins != NULL;
	     wins = wins->next)
	{
		call_plugin_deactivate (info->plugin, PLUMA_WINDOW (wins->data));
	}

	/* first unref the plugin (the loader still has one) */
	g_object_unref (info->plugin);

	/* find the loader and tell it to gc and unload the plugin */
	loader = get_plugin_loader (engine, info);

	pluma_plugin_loader_garbage_collect (loader);
	pluma_plugin_loader_unload (loader, info);

	info->plugin = NULL;
}
static void
draw_spaces (PlumaDrawspacesPlugin *plugin)
{
	const GList *windows, *l;

	windows = pluma_app_get_windows (pluma_app_get_default ());

	for (l = windows; l != NULL; l = g_list_next (l))
	{
		draw_spaces_in_window (l->data, plugin);
	}
}
static void
pluma_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
        gchar       *key,
        gpointer     user_data)
{
    pluma_debug (DEBUG_PREFS);

    if (strcmp (key, GPM_SYNTAX_HL_ENABLE) == 0)
    {
        gboolean enable;
        GList *docs;
        GList *l;
        const GList *windows;

        enable = g_settings_get_boolean (settings, key);

        docs = pluma_app_get_documents (pluma_app_get_default ());
        l = docs;

        while (l != NULL)
        {
            g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));

            gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data),
                                                    enable);

            l = l->next;
        }

        g_list_free (docs);

        /* update the sensitivity of the Higlight Mode menu item */
        windows = pluma_app_get_windows (pluma_app_get_default ());
        while (windows != NULL)
        {
            GtkUIManager *ui;
            GtkAction *a;

            ui = pluma_window_get_ui_manager (PLUMA_WINDOW (windows->data));

            a = gtk_ui_manager_get_action (ui,
                                           "/MenuBar/ViewMenu/ViewHighlightModeMenu");

            gtk_action_set_sensitive (a, enable);

            windows = g_list_next (windows);
        }
    }
}
static void
pluma_plugins_engine_activate_plugin_real (PlumaPluginsEngine *engine,
					   PlumaPluginInfo *info)
{
	const GList *wins;

	if (!load_plugin (engine, info))
		return;

	for (wins = pluma_app_get_windows (pluma_app_get_default ());
	     wins != NULL;
	     wins = wins->next)
	{
		pluma_plugin_activate (info->plugin, PLUMA_WINDOW (wins->data));
	}
}