=== modified file 'src/extension/internal/gdkpixbuf-input.cpp' --- src/extension/internal/gdkpixbuf-input.cpp 2012-02-12 13:43:17 +0000 +++ src/extension/internal/gdkpixbuf-input.cpp 2012-03-08 19:11:56 +0000 @@ -8,6 +8,7 @@ #include "extension/input.h" #include "extension/system.h" #include "gdkpixbuf-input.h" +#include "preferences.h" #include "selection-chemistry.h" #include "sp-image.h" #include "document-undo.h" @@ -33,8 +34,17 @@ SPDocument * GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) { - bool embed = (strcmp(mod->get_param_optiongroup("link"), "embed") == 0); - + bool embed = false; + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring attr = prefs->getString("/extensions/org.inkscape.input.gdkpixbuf.link"); + if (strcmp(attr.c_str(), "embed") == 0) { + embed = true; + } else if (strcmp(attr.c_str(), "link") == 0) { + embed = false; + } else { + embed = (strcmp(mod->get_param_optiongroup("link"), "embed") == 0); + } + SPDocument *doc = NULL; GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL ); static std::set lossy = create_lossy_set(); @@ -120,7 +130,7 @@ GdkpixbufInput::init(void) { GSList * formatlist, * formatlisthead; - + /* \todo I'm not sure if I need to free this list */ for (formatlist = formatlisthead = gdk_pixbuf_get_formats(); formatlist != NULL; @@ -146,22 +156,23 @@ if (strcmp(extensions[i], "svg.gz") == 0) { continue; } - gchar *caption = g_strdup_printf(_("%s GDK pixbuf Input"), name); + gchar *caption = g_strdup_printf(_("%s Bitmap Input"), name); + gchar *xmlString = g_strdup_printf( "\n" - "%s\n" - "org.inkscape.input.gdkpixbuf.%s\n" - "\n" - "<_option value='embed'>" N_("Embed") "\n" - "<_option value='link'>" N_("Link") "\n" - "\n" - "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "\n" - "\n" - ".%s\n" - "%s\n" - "%s (*.%s)\n" - "%s\n" - "\n" + "%s\n" + "org.inkscape.input.gdkpixbuf.%s\n" + "\n" + "<_option value='embed'>" N_("Embed") "\n" + "<_option value='link'>" N_("Link") "\n" + "\n" + "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "\n" + "\n" + ".%s\n" + "%s\n" + "%s (*.%s)\n" + "%s\n" + "\n" "", caption, extensions[i], === modified file 'src/extension/system.cpp' --- src/extension/system.cpp 2012-03-07 20:27:39 +0000 +++ src/extension/system.cpp 2012-03-08 19:17:28 +0000 @@ -88,6 +88,19 @@ throw Input::no_extension_found(); } + // Hide pixbuf extensions depending on user preferences. + //g_warning("Extension: %s", imod->get_id()); + + bool show = true; + if (strlen(imod->get_id()) > 27) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring attr = prefs->getString("/extensions/org.inkscape.input.gdkpixbuf.link"); + Glib::ustring id = Glib::ustring(imod->get_id(), 28); + if (strcmp(attr.c_str(), "ask") != 0 and strcmp(id.c_str(), "org.inkscape.input.gdkpixbuf") == 0) { + show = false; + imod->set_gui(false); + } + } imod->set_state(Extension::STATE_LOADED); if (!imod->loaded()) { @@ -112,6 +125,9 @@ } doc->setUri(filename); + if (!show) { + imod->set_gui(true); + } return doc; } === modified file 'src/ui/dialog/inkscape-preferences.cpp' --- src/ui/dialog/inkscape-preferences.cpp 2012-02-26 16:54:08 +0000 +++ src/ui/dialog/inkscape-preferences.cpp 2012-03-08 19:15:51 +0000 @@ -30,6 +30,8 @@ #include #include "enums.h" #include "desktop-handles.h" +#include "extension/internal/gdkpixbuf-input.h" +#include "extension/db.h" #include "message-stack.h" #include "style.h" #include "selection.h" @@ -1306,6 +1308,13 @@ _bitmap_copy_res.init("/options/createbitmap/resolution", 1.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); _page_bitmaps.add_line( false, _("Resolution for Create Bitmap Copy:"), _bitmap_copy_res, _("dpi"), _("Resolution used by the Create Bitmap Copy command"), false); + { + Glib::ustring labels[] = {_("Always embed"), _("Always link"), _("Ask")}; + Glib::ustring values[] = {"embed", "link", "ask"}; + _bitmap_import.init("/extensions/org.inkscape.input.gdkpixbuf.link", labels, values, G_N_ELEMENTS(values), "ask"); + _page_bitmaps.add_line( false, _("Bitmap import:"), _bitmap_import, "", "", false); + // _bitmap_import.signal_changed().connect( sigc::bind( sigc::ptr_fun(bitmapImportComboChanged), &_bitmap_import) ); + } this->AddPage(_page_bitmaps, _("Bitmaps"), PREFS_PAGE_BITMAPS); } === modified file 'src/ui/dialog/inkscape-preferences.h' --- src/ui/dialog/inkscape-preferences.h 2012-02-26 16:54:08 +0000 +++ src/ui/dialog/inkscape-preferences.h 2012-03-08 19:12:51 +0000 @@ -322,6 +322,7 @@ UI::Widget::PrefEntryFileButtonHBox _misc_bitmap_editor; UI::Widget::PrefCheckButton _misc_bitmap_autoreload; UI::Widget::PrefSpinButton _bitmap_copy_res; + UI::Widget::PrefCombo _bitmap_import; UI::Widget::PrefCheckButton _save_use_current_dir; UI::Widget::PrefCheckButton _save_autosave_enable;