Ejemplo n.º 1
0
static GOPluginFileSaver *
go_plugin_file_saver_new (GOPluginService *service)
{
	GOPluginFileSaver *pfs;
	GOPluginServiceFileSaver *psfs = GO_PLUGIN_SERVICE_FILE_SAVER (service);
	gchar *saver_id;

	saver_id = g_strconcat (go_plugin_get_id (service->plugin),
				":",
				service->id,
				NULL);
	pfs = GO_PLUGIN_FILE_SAVER (g_object_new
				   (TYPE_GO_PLUGIN_FILE_SAVER,
				    "id", saver_id,
				    "extension", psfs->file_extension,
				    "mime-type", psfs->mime_type,
				    "description", psfs->description,
				    "format-level", psfs->format_level,
				    "overwrite", psfs->overwrite_files,
				    "scope", psfs->save_scope,
				    NULL));

	pfs->service = service;
	g_free (saver_id);

	return pfs;
}
Ejemplo n.º 2
0
static void
go_plugin_service_plugin_loader_deactivate (GOPluginService *service,
					    GOErrorInfo **ret_error)
{
	gchar *full_id;

	GO_INIT_RET_ERROR_INFO (ret_error);
	full_id = g_strconcat (
		go_plugin_get_id (service->plugin), ":", service->id, NULL);
	go_plugins_unregister_loader (full_id);
	g_free (full_id);
	service->is_active = FALSE;
}
Ejemplo n.º 3
0
static GOPluginFileOpener *
go_plugin_file_opener_new (GOPluginService *service)
{
	GOPluginServiceFileOpener *service_file_opener = GO_PLUGIN_SERVICE_FILE_OPENER (service);
	GOPluginFileOpener *fo;
	gchar *opener_id;

	opener_id = g_strconcat (
		go_plugin_get_id (service->plugin), ":", service->id, NULL);
	fo = GO_PLUGIN_FILE_OPENER (g_object_new (TYPE_GO_PLUGIN_FILE_OPENER, NULL));
	go_file_opener_setup (GO_FILE_OPENER (fo), opener_id,
		service_file_opener->description,
		go_str_slist_dup (service_file_opener->suffixes),
		go_str_slist_dup (service_file_opener->mimes),
		service_file_opener->encoding_dependent, NULL, NULL);
	fo->service = service;
	g_free (opener_id);

	return fo;
}
Ejemplo n.º 4
0
static void
cb_pm_selection_changed (GtkTreeSelection *selection, PluginManagerGUI *pm_gui)
{
	GOPlugin *pinfo;
	GtkTreeIter iter;
	const char *plugin_desc;

	g_return_if_fail (pm_gui != NULL);

	g_signal_handlers_disconnect_matched (
		pm_gui->checkbutton_mark_for_deactivation,
		G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
		cb_checkbutton_mark_for_deactivation_toggled, NULL);

	if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
		gtk_text_buffer_set_text (pm_gui->text_description, "", 0);
		gtk_entry_set_text (pm_gui->entry_directory, "");
		gtk_tree_store_clear (pm_gui->model_details);
		gtk_widget_hide (pm_gui->frame_mark_for_deactivation);
	} else {
		GtkTreeIter iter2, iter3;
		GSList *dep_ids, *services;

		gtk_tree_model_get (GTK_TREE_MODEL (pm_gui->model_plugins),
		                    &iter, PLUGIN_POINTER, &pinfo, -1);
		plugin_desc = _(go_plugin_get_description (pinfo));
		if (plugin_desc == NULL) {
			plugin_desc = "";
		}
		gtk_text_buffer_set_text (
			pm_gui->text_description, plugin_desc, strlen (plugin_desc));
		gtk_entry_set_text (pm_gui->entry_directory, go_plugin_get_dir_name (pinfo));

		gtk_tree_store_clear (pm_gui->model_details);
		gtk_tree_store_append (pm_gui->model_details, &iter, NULL);
		gtk_tree_store_set (
			pm_gui->model_details, &iter,
			DETAILS_DESC, go_plugin_get_name (pinfo),
			DETAILS_ID, go_plugin_get_id (pinfo),
			-1);
		dep_ids = go_plugin_get_dependencies_ids (pinfo);
		if (dep_ids != NULL) {
			gtk_tree_store_append (pm_gui->model_details, &iter2, &iter);
			gtk_tree_store_set (
				pm_gui->model_details, &iter2,
				DETAILS_DESC, _("Plugin dependencies"),
				DETAILS_ID, "",
				-1);
			GO_SLIST_FOREACH (dep_ids, char, dep_id,
				GOPlugin *dep_plugin;
				const char *name;

				dep_plugin = go_plugins_get_plugin_by_id (dep_id);
				name =  dep_plugin != NULL ? (char *) go_plugin_get_name (dep_plugin) : _("Unknown plugin");
				gtk_tree_store_append (pm_gui->model_details, &iter3, &iter2);
				gtk_tree_store_set (
					pm_gui->model_details, &iter3,
					DETAILS_DESC, name,
					DETAILS_ID, dep_id,
					-1);
			);
		}