DIA_PLUGIN_CHECK_INIT PluginInitResult dia_plugin_init(PluginInfo *info) { if (!dia_plugin_info_init(info, "WPG", _("WordPerfect Graphics export filter"), _plugin_can_unload, _plugin_unload)) return DIA_PLUGIN_INIT_ERROR; filter_register_export(&my_export_filter); filter_register_import(&my_import_filter); return DIA_PLUGIN_INIT_OK; }
static PluginInitResult internal_plugin_init(PluginInfo *info) { if (!dia_plugin_info_init(info, "Internal", _("Objects and filters internal to Dia"), NULL, NULL)) return DIA_PLUGIN_INIT_ERROR; /* register the group object type */ object_register_type(&group_type); /* register import filters */ filter_register_import(&dia_import_filter); /* register export filters */ /* Standard Dia format */ filter_register_export(&dia_export_filter); return DIA_PLUGIN_INIT_OK; }
DIA_PLUGIN_CHECK_INIT PluginInitResult dia_plugin_init(PluginInfo *info) { /* * If GTK is not initialized yet don't register this plug-in. This is * almost the same as app_is_interactive() but avoids to make plug-ins * depend on Dia's app core function. Also what we really need is a * display, not an interactive app ;) */ if (gdk_display_get_default ()) { if (!dia_plugin_info_init(info, "Pixbuf", _("gdk-pixbuf-based bitmap export/import"), _plugin_can_unload, _plugin_unload)) return DIA_PLUGIN_INIT_ERROR; else { GSList* formats = gdk_pixbuf_get_formats (); GSList* sl; /* if we get this far we still may be running non-interactive. To avoid complains * from color_convert() we are initializing ourselves ;) */ color_init (); /* * Instead of hard-coding capabilities, ask GdkPixbuf what's installed */ for (sl = formats; sl != NULL; sl = g_slist_next (sl)) { GdkPixbufFormat* format = (GdkPixbufFormat*)sl->data; if (gdk_pixbuf_format_is_writable (format)) { DiaExportFilter* efilter = g_new0 (DiaExportFilter, 1); gchar* name; name = gdk_pixbuf_format_get_name (format); /* the pixbuf desriptions are too generic for Dia's usage, make our own */ efilter->description = g_strdup_printf ("Pixbuf[%s]", name); /* NOT: gdk_pixbuf_format_get_description (format); */ efilter->extensions = (const gchar**)gdk_pixbuf_format_get_extensions (format); efilter->export_func = export_data; efilter->user_data = g_strdup (name); efilter->unique_name = g_strdup_printf ("pixbuf-%s", (gchar*)efilter->user_data); g_free (name); _export_filters = g_list_append (_export_filters, efilter); filter_register_export(efilter); } /* there is no write only filter */ { DiaImportFilter* ifilter; gchar* name; name = gdk_pixbuf_format_get_name (format); /* filter out the less useful ones to keep the total list reasonable short * (If anyone complains make it configurable via persistence and this default ;-) */ if ( strcmp (name, "ani") == 0 || strcmp (name, "ico") == 0 || strcmp (name, "pcx") == 0 || strcmp (name, "pnm") == 0 || strcmp (name, "ras") == 0 || strcmp (name, "tiff") == 0 || strcmp (name, "wbmp") == 0 || strcmp (name, "xbm") == 0) { g_free (name); continue; } ifilter = g_new0 (DiaImportFilter, 1); /* the pixbuf desriptions are too generic for Dia's usage, make our own */ ifilter->description = g_strdup_printf ("Pixbuf[%s]", name); ifilter->extensions = (const gchar**)gdk_pixbuf_format_get_extensions (format); ifilter->import_func = import_data; ifilter->user_data = gdk_pixbuf_format_get_name (format); /* they are in differnt namespaces aren't they? */ ifilter->unique_name = g_strdup_printf ("pixbuf-%s", name); /* don't use pixbuf loader for vector formats */ if ( strcmp (name, "svg") == 0 || strcmp (name, "svgz") == 0 || strcmp (name, "wmf") == 0 || strcmp (name, "emf") == 0) ifilter->hints = FILTER_DONT_GUESS; g_free (name); _import_filters = g_list_append (_import_filters, ifilter); filter_register_import(ifilter); } } g_slist_free (formats); } } return DIA_PLUGIN_INIT_OK; }