Commit ebdf9b09 authored by Murray Cumming's avatar Murray Cumming
Browse files

ImageGlom: Use AppInfo instead of gtk_show_uri() for Open.

* glom/utility_widgets/imageglom.cc: For the case that we have no AppInfo
(not Open With), use the static AppInfo method, for consistency.
This might work on Win32 too.
parent 1b193db8
2011-07-12 Murray Cumming <murrayc@murrayc.com>
ImageGlom: Use AppInfo instead of gtk_show_uri() for Open.
* glom/utility_widgets/imageglom.cc: For the case that we have no AppInfo
(not Open With), use the static AppInfo method, for consistency.
This might work on Win32 too.
2011-07-12 Murray Cumming <murrayc@murrayc.com>
Image fields: Add Open, Open With, and Save context menu items.
......
......@@ -359,8 +359,10 @@ void ImageGlom::open_with(const Glib::RefPtr<Gio::AppInfo>& app_info)
{
std::vector<std::string> vec_uris;
vec_uris.push_back(uri);
std::cout << "app_info: " << app_info->get_name() << ", uri=" << uri << std::endl;
app_info->launch_uris(vec_uris, 0); //TODO: Get a GdkAppLaunchContext?
//TODO Use this instead when we can use glibmm 3.2:
//app_info->launch_uri(uri);
}
else
{
......@@ -369,15 +371,11 @@ void ImageGlom::open_with(const Glib::RefPtr<Gio::AppInfo>& app_info)
// gtk_show_uri doesn't seem to work on Win32, at least not for local files
// We use Windows API instead.
// TODO: Check it again and file a bug if necessary.
// TODO: and this might not be necessary with Gio::AppInfo::launch_default_for_uri().
// Previously we used gtk_show_uri().
ShellExecute(0, "open", uri.c_str(), 0, 0, SW_SHOW);
#else
//Use the GNOME browser:
GError* gerror = 0;
if(!gtk_show_uri(0 /* screen */, uri.c_str(), GDK_CURRENT_TIME, &gerror))
{
std::cerr << G_STRFUNC << ": " << gerror->message << std::endl;
g_error_free(gerror);
}
Gio::AppInfo::launch_default_for_uri(uri);
#endif //G_OS_WIN32
}
}
......
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