Commit 1dec7b19 authored by Murray Cumming's avatar Murray Cumming
Browse files

ImageGlom: Remove hard-coded mentions of PNG file formats.

* glom/utility_widgets/imageglom.cc: Open With: Use the actual (sniffed)
mime type.
Clipboard: Try to use the actual mime type, though this does not seem to
work for any mime type now.
parent 01af8b7c
2011-07-13 Murray Cumming <murrayc@murrayc.com>
ImageGlom: Remove hard-coded mentions of PNG file formats.
* glom/utility_widgets/imageglom.cc: Open With: Use the actual (sniffed)
mime type.
Clipboard: Try to use the actual mime type, though this does not seem to
work for any mime type now.
2011-07-13 Murray Cumming <murrayc@murrayc.com>
ImageGlom: Show the missing image icon again.
......
......@@ -445,7 +445,13 @@ void ImageGlom::on_menupopup_activate_open_file_with()
Application* pApp = get_application();
//Offer the user a choice of suitable applications:
Gtk::AppChooserDialog dialog(GLOM_IMAGE_FORMAT_MIME_TYPE);
const Glib::ustring mime_type = get_mime_type();
if(mime_type.empty())
{
std::cerr << G_STRFUNC << ": mime_type is empty." << std::endl;
}
Gtk::AppChooserDialog dialog(mime_type);
if(pApp)
dialog.set_transient_for(*pApp);
......@@ -688,14 +694,29 @@ void ImageGlom::on_clipboard_get(Gtk::SelectionData& selection_data, guint /* in
const std::string target = selection_data.get_target();
if(target == GLOM_IMAGE_FORMAT_MIME_TYPE)
const Glib::ustring mime_type = get_mime_type();
if(mime_type.empty())
{
std::cerr << G_STRFUNC << ": mime_type is empty." << std::endl;
}
if(target == mime_type)
{
const GdaBinary* gda_binary = gda_value_get_binary(m_original_data.gobj());
if(!gda_binary)
return;
if(!gda_binary->data)
return;
selection_data.set(mime_type, 8, gda_binary->data, gda_binary->binary_length);
// This set() override uses an 8-bit text format for the data.
selection_data.set_pixbuf(m_pixbuf_clipboard);
//selection_data.set_pixbuf(m_pixbuf_clipboard);
}
else
{
g_warning("ExampleWindow::on_clipboard_get(): Unexpected clipboard target format.");
std::cout << "ExampleWindow::on_clipboard_get(): Unexpected clipboard target format. expected: " << mime_type << std::endl;
}
}
......@@ -720,8 +741,14 @@ void ImageGlom::on_menupopup_activate_copy()
Glib::RefPtr<Gtk::Clipboard> refClipboard = Gtk::Clipboard::get();
//Targets:
const Glib::ustring mime_type = get_mime_type();
if(mime_type.empty())
{
std::cerr << G_STRFUNC << ": mime_type is empty." << std::endl;
}
std::vector<Gtk::TargetEntry> listTargets;
listTargets.push_back( Gtk::TargetEntry(GLOM_IMAGE_FORMAT_MIME_TYPE) );
listTargets.push_back( Gtk::TargetEntry(mime_type) );
refClipboard->set( listTargets, sigc::mem_fun(*this, &ImageGlom::on_clipboard_get), sigc::mem_fun(*this, &ImageGlom::on_clipboard_clear) );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment