Exemplo n.º 1
0
void
pluma_document_loader_loading (PlumaDocumentLoader *loader,
			       gboolean             completed,
			       GError              *error)
{
	/* the object will be unrefed in the callback of the loading signal
	 * (when completed == TRUE), so we need to prevent finalization.
	 */
	if (completed)
	{
		g_object_ref (loader);
	}

	g_signal_emit (loader, signals[LOADING], 0, completed, error);

	if (completed)
	{
		if (error == NULL)
			pluma_debug_message (DEBUG_LOADER, "load completed");
		else
			pluma_debug_message (DEBUG_LOADER, "load failed");

		g_object_unref (loader);
	}
}
void
pluma_document_saver_saving (PlumaDocumentSaver *saver,
			     gboolean            completed,
			     GError             *error)
{
	/* the object will be unrefed in the callback of the saving
	 * signal, so we need to prevent finalization.
	 */
	if (completed)
	{
		g_object_ref (saver);
	}

	g_signal_emit (saver, signals[SAVING], 0, completed, error);

	if (completed)
	{
		if (error == NULL)
			pluma_debug_message (DEBUG_SAVER, "save completed");
		else
			pluma_debug_message (DEBUG_SAVER, "save failed");

		g_object_unref (saver);
	}
}
static void
docinfo_real (PlumaDocument *doc,
	      DocInfoDialog *dialog)
{
	GtkTextIter start, end;
	gint words = 0;
	gint chars = 0;
	gint white_chars = 0;
	gint lines = 0;
	gint bytes = 0;
	gchar *tmp_str;
	gchar *doc_name;

	pluma_debug (DEBUG_PLUGINS);

	gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc),
				    &start,
				    &end);

	lines = gtk_text_buffer_get_line_count (GTK_TEXT_BUFFER (doc));

	calculate_info (doc,
			&start, &end,
			&chars, &words, &white_chars, &bytes);

	if (chars == 0)
		lines = 0;

	pluma_debug_message (DEBUG_PLUGINS, "Chars: %d", chars);
	pluma_debug_message (DEBUG_PLUGINS, "Lines: %d", lines);
	pluma_debug_message (DEBUG_PLUGINS, "Words: %d", words);
	pluma_debug_message (DEBUG_PLUGINS, "Chars non-space: %d", chars - white_chars);
	pluma_debug_message (DEBUG_PLUGINS, "Bytes: %d", bytes);

	doc_name = pluma_document_get_short_name_for_display (doc);
	tmp_str = g_strdup_printf ("<span weight=\"bold\">%s</span>", doc_name);
	gtk_label_set_markup (GTK_LABEL (dialog->file_name_label), tmp_str);
	g_free (doc_name);
	g_free (tmp_str);

	tmp_str = g_strdup_printf("%d", lines);
	gtk_label_set_text (GTK_LABEL (dialog->lines_label), tmp_str);
	g_free (tmp_str);

	tmp_str = g_strdup_printf("%d", words);
	gtk_label_set_text (GTK_LABEL (dialog->words_label), tmp_str);
	g_free (tmp_str);

	tmp_str = g_strdup_printf("%d", chars);
	gtk_label_set_text (GTK_LABEL (dialog->chars_label), tmp_str);
	g_free (tmp_str);

	tmp_str = g_strdup_printf("%d", chars - white_chars);
	gtk_label_set_text (GTK_LABEL (dialog->chars_ns_label), tmp_str);
	g_free (tmp_str);

	tmp_str = g_strdup_printf("%d", bytes);
	gtk_label_set_text (GTK_LABEL (dialog->bytes_label), tmp_str);
	g_free (tmp_str);
}
static TagList* parse_taglist_dir(const gchar* dir)
{
	GError* error = NULL;
	GDir* d;
	const gchar* dirent;

	pluma_debug_message(DEBUG_PLUGINS, "DIR: %s", dir);

	d = g_dir_open(dir, 0, &error);

	if (!d)
	{
		pluma_debug_message(DEBUG_PLUGINS, "%s", error->message);
		g_error_free (error);
		return taglist;
	}

	while ((dirent = g_dir_read_name(d)))
	{
		if (g_str_has_suffix(dirent, ".tags") || g_str_has_suffix(dirent, ".tags.gz"))
		{
			gchar* tags_file = g_build_filename(dir, dirent, NULL);
			parse_taglist_file(tags_file);
			g_free (tags_file);
		}
	}

	g_dir_close (d);

	return taglist;
}
static gboolean
load_plugin_info (PlumaPluginsEngine *engine,
		  const gchar        *filename,
		  gpointer            userdata)
{
	PlumaPluginInfo *info;

	info = _pluma_plugin_info_new (filename);

	if (info == NULL)
		return TRUE;

	/* If a plugin with this name has already been loaded
	 * drop this one (user plugins override system plugins) */
	if (pluma_plugins_engine_get_plugin_info (engine, pluma_plugin_info_get_module_name (info)) != NULL)
	{
		pluma_debug_message (DEBUG_PLUGINS, "Two or more plugins named '%s'. "
				     "Only the first will be considered.\n",
				     pluma_plugin_info_get_module_name (info));

		_pluma_plugin_info_unref (info);

		return TRUE;
	}

	engine->priv->plugin_list = g_list_prepend (engine->priv->plugin_list, info);

	pluma_debug_message (DEBUG_PLUGINS, "Plugin %s loaded", info->name);
	return TRUE;
}
static gboolean
pluma_object_module_load (GTypeModule *gmodule)
{
	PlumaObjectModule *module = PLUMA_OBJECT_MODULE (gmodule);
	PlumaObjectModuleRegisterFunc register_func;
	gchar *path;

	pluma_debug_message (DEBUG_PLUGINS, "Loading %s module from %s",
			     module->priv->module_name, module->priv->path);

	path = g_module_build_path (module->priv->path, module->priv->module_name);
	g_return_val_if_fail (path != NULL, FALSE);
	pluma_debug_message (DEBUG_PLUGINS, "Module filename: %s", path);

	module->priv->library = g_module_open (path, 
					       G_MODULE_BIND_LAZY);
	g_free (path);

	if (module->priv->library == NULL)
	{
		g_warning ("%s: %s", module->priv->module_name, g_module_error());

		return FALSE;
	}

	/* extract symbols from the lib */
	if (!g_module_symbol (module->priv->library, module->priv->type_registration,
			      (void *) &register_func))
	{
		g_warning ("%s: %s", module->priv->module_name, g_module_error());
		g_module_close (module->priv->library);

		return FALSE;
	}

	/* symbol can still be NULL even though g_module_symbol
	 * returned TRUE */
	if (register_func == NULL)
	{
		g_warning ("Symbol '%s' should not be NULL", module->priv->type_registration);
		g_module_close (module->priv->library);

		return FALSE;
	}

	module->priv->type = register_func (gmodule);

	if (module->priv->type == 0)
	{
		g_warning ("Invalid object contained by module %s", module->priv->module_name);
		return FALSE;
	}

	if (module->priv->resident)
	{
		g_module_make_resident (module->priv->library);
	}

	return TRUE;
}
void free_taglist(void)
{
	GList* l;

	pluma_debug_message(DEBUG_PLUGINS, "ref_count: %d", taglist_ref_count);

	if (taglist == NULL)
	{
		return;
	}

	g_return_if_fail(taglist_ref_count > 0);

	--taglist_ref_count;

	if (taglist_ref_count > 0)
	{
		return;
	}

	for (l = taglist->tag_groups; l != NULL; l = g_list_next (l))
	{
		free_tag_group ((TagGroup*) l->data);
	}

	g_list_free (taglist->tag_groups);
	g_free (taglist);
	taglist = NULL;

	pluma_debug_message (DEBUG_PLUGINS, "Really freed");
}
Exemplo n.º 8
0
/* lazy loading of language mappings */
static void
load_language_mappings (void)
{
	gchar *fname;
	GKeyFile *mappings;
	GError *error = NULL;

	fname = g_build_filename (modelines_data_dir,
				  MODELINES_LANGUAGE_MAPPINGS_FILE,
				  NULL);

	mappings = g_key_file_new ();

	if (g_key_file_load_from_file (mappings, fname, 0, &error))
	{
		pluma_debug_message (DEBUG_PLUGINS,
				     "Loaded language mappings from %s",
				     fname);

		vim_languages = load_language_mappings_group (mappings, "vim");
		emacs_languages	= load_language_mappings_group (mappings, "emacs");
		kate_languages = load_language_mappings_group (mappings, "kate");
	}
	else
	{
		pluma_debug_message (DEBUG_PLUGINS,
				     "Failed to loaded language mappings from %s: %s",
				     fname, error->message);

		g_error_free (error);
	}

	g_key_file_free (mappings);
	g_free (fname);
}
Exemplo n.º 9
0
void
_pluma_plugin_info_unref (PlumaPluginInfo *info)
{
	if (!g_atomic_int_dec_and_test (&info->refcount))
		return;

	if (info->plugin != NULL)
	{
		pluma_debug_message (DEBUG_PLUGINS, "Unref plugin %s", info->name);

		g_object_unref (info->plugin);
	}

	g_free (info->file);
	g_free (info->module_name);
	g_strfreev (info->dependencies);
	g_free (info->name);
	g_free (info->desc);
	g_free (info->icon_name);
	g_free (info->website);
	g_free (info->copyright);
	g_free (info->loader);
	g_free (info->version);
	g_strfreev (info->authors);

	g_free (info);
}
Exemplo n.º 10
0
static void
auto_spell_cb (GtkAction   *action,
	       PlumaSpellPlugin *plugin)
{
	PlumaWindow *window;
	PlumaDocument *doc;
	gboolean active;

	pluma_debug (DEBUG_PLUGINS);

	window = PLUMA_WINDOW (plugin->priv->window);

	active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));

	pluma_debug_message (DEBUG_PLUGINS, active ? "Auto Spell activated" : "Auto Spell deactivated");

	doc = pluma_window_get_active_document (window);
	if (doc == NULL)
		return;

	if (get_autocheck_type (plugin) == AUTOCHECK_DOCUMENT)
	{
		pluma_document_set_metadata (doc,
				     PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED,
				     active ? "1" : NULL, NULL);
	}

	set_auto_spell (window, doc, active);
}
void
pluma_plugins_engine_deactivate_plugins (PlumaPluginsEngine *engine,
					  PlumaWindow        *window)
{
	GList *pl;

	pluma_debug (DEBUG_PLUGINS);

	g_return_if_fail (PLUMA_IS_PLUGINS_ENGINE (engine));
	g_return_if_fail (PLUMA_IS_WINDOW (window));

	for (pl = engine->priv->plugin_list; pl; pl = pl->next)
	{
		PlumaPluginInfo *info = (PlumaPluginInfo*)pl->data;

		/* check if the plugin is actually active */
		if (!pluma_plugin_info_is_active (info))
			continue;

		/* call deactivate for the plugin for this window */
		pluma_plugin_deactivate (info->plugin, window);
	}

	pluma_debug_message (DEBUG_PLUGINS, "End");
}
static void
pluma_drawspaces_plugin_dispose (GObject *object)
{
	PlumaDrawspacesPlugin *plugin = PLUMA_DRAWSPACES_PLUGIN (object);

	pluma_debug_message (DEBUG_PLUGINS, "PlumaDrawspacesPlugin disposing");

	if (plugin->priv->connection_id != 0)
	{
		mateconf_client_notify_remove (plugin->priv->mateconf_client,
					    plugin->priv->connection_id);

		plugin->priv->connection_id = 0;
	}

	if (plugin->priv->mateconf_client != NULL)
	{
		mateconf_client_suggest_sync (plugin->priv->mateconf_client, NULL);

		g_object_unref (G_OBJECT (plugin->priv->mateconf_client));

		plugin->priv->mateconf_client = NULL;
	}

	G_OBJECT_CLASS (pluma_drawspaces_plugin_parent_class)->dispose (object);
}
Exemplo n.º 13
0
static GHashTable *
load_language_mappings_group (GKeyFile *key_file, const gchar *group)
{
	GHashTable *table;
	gchar **keys;
	gsize length = 0;
	int i;

	table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);

	keys = g_key_file_get_keys (key_file, group, &length, NULL);

	pluma_debug_message (DEBUG_PLUGINS,
			     "%" G_GSIZE_FORMAT " mappings in group %s",
			     length, group);

	for (i = 0; i < length; i++)
	{
		gchar *name = keys[i];
		gchar *id = g_key_file_get_string (key_file, group, name, NULL);
		g_hash_table_insert (table, name, id);
	}
	g_free (keys);

	return table;
}
static void
pluma_docinfo_plugin_finalize (GObject *object)
{
	pluma_debug_message (DEBUG_PLUGINS, "PlumaDocInfoPlugin finalizing");

	G_OBJECT_CLASS (pluma_docinfo_plugin_parent_class)->finalize (object);
}
Exemplo n.º 15
0
static void
pluma_bookmarks_plugin_finalize (GObject *object)
{
	pluma_debug_message (DEBUG_PLUGINS, "PlumaBookmarksPlugin finalizing");

	G_OBJECT_CLASS (pluma_bookmarks_plugin_parent_class)->finalize (object);
}
Exemplo n.º 16
0
static gchar *
get_current_word (PlumaDocument *doc, gint *start, gint *end)
{
	const CheckRange *range;
	GtkTextIter end_iter;
	GtkTextIter current_iter;
	gint range_end;

	pluma_debug (DEBUG_PLUGINS);

	g_return_val_if_fail (doc != NULL, NULL);
	g_return_val_if_fail (start != NULL, NULL);
	g_return_val_if_fail (end != NULL, NULL);

	range = get_check_range (doc);
	g_return_val_if_fail (range != NULL, NULL);

	gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), 
			&end_iter, range->end_mark);

	range_end = gtk_text_iter_get_offset (&end_iter);

	gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), 
			&current_iter, range->current_mark);

	end_iter = current_iter;

	if (!gtk_text_iter_is_end (&end_iter))
	{
		pluma_debug_message (DEBUG_PLUGINS, "Current is not end");

		gtk_text_iter_forward_word_end (&end_iter);
	}

	*start = gtk_text_iter_get_offset (&current_iter);
	*end = MIN (gtk_text_iter_get_offset (&end_iter), range_end);

	pluma_debug_message (DEBUG_PLUGINS, "Current word extends [%d, %d]", *start, *end);

	if (!(*start < *end))
		return NULL;

	return gtk_text_buffer_get_slice (GTK_TEXT_BUFFER (doc),
					  &current_iter,
					  &end_iter,
					  TRUE);
}
static void
pluma_check_update_plugin_finalize (GObject *object)
{
	pluma_debug_message (DEBUG_PLUGINS,
			     "PlumaCheckUpdatePlugin finalizing");

	G_OBJECT_CLASS (pluma_check_update_plugin_parent_class)->finalize (object);
}
static void
load_all_plugins (PlumaPluginsEngine *engine)
{
	gchar *plugin_dir;
	const gchar *pdirs_env = NULL;

	/* load user plugins */
	plugin_dir = pluma_dirs_get_user_plugins_dir ();
	if (g_file_test (plugin_dir, G_FILE_TEST_IS_DIR))
	{
		load_dir_real (engine,
			       plugin_dir,
			       PLUGIN_EXT,
			       load_plugin_info,
			       NULL);

	}
	g_free (plugin_dir);

	/* load system plugins */
	pdirs_env = g_getenv ("PLUMA_PLUGINS_PATH");

	pluma_debug_message (DEBUG_PLUGINS, "PLUMA_PLUGINS_PATH=%s", pdirs_env);

	if (pdirs_env != NULL)
	{
		gchar **pdirs;
		gint i;

		pdirs = g_strsplit (pdirs_env, G_SEARCHPATH_SEPARATOR_S, 0);

		for (i = 0; pdirs[i] != NULL; i++)
		{
			if (!load_dir_real (engine,
					    pdirs[i],
					    PLUGIN_EXT,
					    load_plugin_info,
					    NULL))
			{
				break;
			}
		}

		g_strfreev (pdirs);
	}
	else
	{
		plugin_dir = pluma_dirs_get_pluma_plugins_dir ();

		load_dir_real (engine,
			       plugin_dir,
			       PLUGIN_EXT,
			       load_plugin_info,
			       NULL);

		g_free (plugin_dir);
	}
}
static void
dialog_destroyed (GtkObject *obj, gpointer dialog_pointer)
{
	pluma_debug (DEBUG_PLUGINS);

	g_slice_free (DrawspacesConfigureDialog, dialog_pointer);

	pluma_debug_message (DEBUG_PLUGINS, "END");
}
static void
pluma_object_module_init (PlumaObjectModule *module)
{
	pluma_debug_message (DEBUG_PLUGINS, "PlumaObjectModule %p initialising", module);
	
	module->priv = G_TYPE_INSTANCE_GET_PRIVATE (module,
						    PLUMA_TYPE_OBJECT_MODULE,
						    PlumaObjectModulePrivate);
}
Exemplo n.º 21
0
static void
pluma_spell_plugin_init (PlumaSpellPlugin *plugin)
{
	pluma_debug_message (DEBUG_PLUGINS, "PlumaSpellPlugin initializing");

	plugin->priv = PLUMA_SPELL_PLUGIN_GET_PRIVATE (plugin);

	plugin->priv->settings = g_settings_new (SPELL_SCHEMA);
}
Exemplo n.º 22
0
TagList* create_taglist(const gchar* data_dir)
{
	gchar* pdir;

	pluma_debug_message(DEBUG_PLUGINS, "ref_count: %d", taglist_ref_count);

	if (taglist_ref_count > 0)
	{
		++taglist_ref_count;

		return taglist;
	}

	const gchar* home;
	const gchar* envvar;

	/* load user's taglists */

	/* legacy dir */
	home = g_get_home_dir ();
	if (home != NULL)
	{
		pdir = g_build_filename (home,
					 USER_PLUMA_TAGLIST_PLUGIN_LOCATION_LEGACY,
					 NULL);
		parse_taglist_dir (pdir);
		g_free (pdir);
	}

	/* Support old libmate env var */
	envvar = g_getenv ("MATE22_USER_DIR");
	if (envvar != NULL)
	{
		pdir = g_build_filename (envvar,
					 USER_PLUMA_TAGLIST_PLUGIN_LOCATION,
					 NULL);
		parse_taglist_dir (pdir);
		g_free (pdir);
	}
	else if (home != NULL)
	{
		pdir = g_build_filename(home, ".config", USER_PLUMA_TAGLIST_PLUGIN_LOCATION, NULL);
		parse_taglist_dir(pdir);
		g_free (pdir);
	}

	/* load system's taglists */
	parse_taglist_dir(data_dir);

	++taglist_ref_count;
	g_return_val_if_fail(taglist_ref_count == 1, taglist);

	return taglist;
}
static void
docinfo_dialog_response_cb (GtkDialog	*widget,
			    gint	res_id,
			    PlumaWindow *window)
{
	WindowData *data;

	pluma_debug (DEBUG_PLUGINS);
	
	data = (WindowData *) g_object_get_data (G_OBJECT (window),
						 WINDOW_DATA_KEY);

	switch (res_id)
	{
		case GTK_RESPONSE_CLOSE:
		{
			pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CLOSE");
			gtk_widget_destroy (data->dialog->dialog);

			break;
		}

		case GTK_RESPONSE_OK:
		{
			PlumaDocument *doc;
			
			pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
			
			doc = pluma_window_get_active_document (window);
			g_return_if_fail (doc != NULL);
			
			docinfo_real (doc,
				      data->dialog);

			selectioninfo_real (doc,
					    data->dialog);
			
			break;
		}
	}
}
Exemplo n.º 24
0
static void
free_tag_group (TagGroup *tag_group)
{
	GList *l;

	pluma_debug_message (DEBUG_PLUGINS, "Tag group: %s", tag_group->name);

	g_return_if_fail (tag_group != NULL);

	free (tag_group->name);

	for (l = tag_group->tags; l != NULL; l = g_list_next (l))
	{
		free_tag ((Tag *) l->data);
	}

	g_list_free (tag_group->tags);
	g_free (tag_group);

	pluma_debug_message (DEBUG_PLUGINS, "END");
}
static void
pluma_object_module_unload (GTypeModule *gmodule)
{
	PlumaObjectModule *module = PLUMA_OBJECT_MODULE (gmodule);

	pluma_debug_message (DEBUG_PLUGINS, "Unloading %s", module->priv->path);

	g_module_close (module->priv->library);

	module->priv->library = NULL;
	module->priv->type = 0;
}
static void
pluma_check_update_plugin_init (PlumaCheckUpdatePlugin *plugin)
{
	plugin->priv = PLUMA_CHECK_UPDATE_PLUGIN_GET_PRIVATE (plugin);

	pluma_debug_message (DEBUG_PLUGINS,
			     "PlumaCheckUpdatePlugin initializing");

	plugin->priv->session = soup_session_async_new ();

	plugin->priv->settings = g_settings_new (SETTINGS_SCHEMA);
}
Exemplo n.º 27
0
/* Scan a line for vi(m)/emacs/kate modelines.
 * Line numbers are counted starting at one.
 */
static void
parse_modeline (gchar           *s,
		gint             line_number,
		gint             line_count,
		ModelineOptions *options)
{
	gchar prev;

	/* look for the beginning of a modeline */
	for (prev = ' '; (s != NULL) && (*s != '\0'); prev = *(s++))
	{
		if (!g_ascii_isspace (prev))
			continue;

		if ((line_number <= 3 || line_number > line_count - 3) &&
		    (strncmp (s, "ex:", 3) == 0 ||
		     strncmp (s, "vi:", 3) == 0 ||
		     strncmp (s, "vim:", 4) == 0))
		{
			pluma_debug_message (DEBUG_PLUGINS, "Vim modeline on line %d", line_number);

		    	while (*s != ':') s++;
		    	s = parse_vim_modeline (s + 1, options);
		}
		else if (line_number <= 2 && strncmp (s, "-*-", 3) == 0)
		{
			pluma_debug_message (DEBUG_PLUGINS, "Emacs modeline on line %d", line_number);

			s = parse_emacs_modeline (s + 3, options);
		}
		else if ((line_number <= 10 || line_number > line_count - 10) &&
			 strncmp (s, "kate:", 5) == 0)
		{
			pluma_debug_message (DEBUG_PLUGINS, "Kate modeline on line %d", line_number);

			s = parse_kate_modeline (s + 5, options);
		}
	}
}
static void
pluma_object_module_finalize (GObject *object)
{
	PlumaObjectModule *module = PLUMA_OBJECT_MODULE (object);

	pluma_debug_message (DEBUG_PLUGINS, "PlumaObjectModule %p finalising", module);

	g_free (module->priv->path);
	g_free (module->priv->module_name);
	g_free (module->priv->type_registration);

	G_OBJECT_CLASS (pluma_object_module_parent_class)->finalize (object);
}
void
pluma_plugins_engine_activate_plugins (PlumaPluginsEngine *engine,
					PlumaWindow        *window)
{
	GSList *active_plugins = NULL;
	GList *pl;

	pluma_debug (DEBUG_PLUGINS);

	g_return_if_fail (PLUMA_IS_PLUGINS_ENGINE (engine));
	g_return_if_fail (PLUMA_IS_WINDOW (window));

	/* the first time, we get the 'active' plugins from mateconf */
	if (engine->priv->activate_from_prefs)
	{
		active_plugins = pluma_prefs_manager_get_active_plugins ();
	}

	for (pl = engine->priv->plugin_list; pl; pl = pl->next)
	{
		PlumaPluginInfo *info = (PlumaPluginInfo*)pl->data;

		if (engine->priv->activate_from_prefs &&
		    g_slist_find_custom (active_plugins,
					 pluma_plugin_info_get_module_name (info),
					 (GCompareFunc)strcmp) == NULL)
			continue;

		/* If plugin is not active, don't try to activate/load it */
		if (!engine->priv->activate_from_prefs &&
		    !pluma_plugin_info_is_active (info))
			continue;

		if (load_plugin (engine, info))
			pluma_plugin_activate (info->plugin,
					       window);
	}

	if (engine->priv->activate_from_prefs)
	{
		g_slist_foreach (active_plugins, (GFunc) g_free, NULL);
		g_slist_free (active_plugins);
		engine->priv->activate_from_prefs = FALSE;
	}

	pluma_debug_message (DEBUG_PLUGINS, "End");

	/* also call update_ui after activation */
	pluma_plugins_engine_update_plugins_ui (engine, window);
}
static gboolean
load_dir_real (PlumaPluginsEngine *engine,
	       const gchar        *dir,
	       const gchar        *suffix,
	       LoadDirCallback     callback,
	       gpointer            userdata)
{
	GError *error = NULL;
	GDir *d;
	const gchar *dirent;
	gboolean ret = TRUE;

	g_return_val_if_fail (dir != NULL, TRUE);

	pluma_debug_message (DEBUG_PLUGINS, "DIR: %s", dir);

	d = g_dir_open (dir, 0, &error);
	if (!d)
	{
		g_warning ("%s", error->message);
		g_error_free (error);
		return TRUE;
	}

	while ((dirent = g_dir_read_name (d)))
	{
		gchar *filename;

		if (!g_str_has_suffix (dirent, suffix))
			continue;

		filename = g_build_filename (dir, dirent, NULL);

		ret = callback (engine, filename, userdata);

		g_free (filename);

		if (!ret)
			break;
	}

	g_dir_close (d);
	return ret;
}