mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
Change gnc_launch_assoc to use gnc_uri_get_scheme
Change the gnc_launch_assoc function to use the gnc_uri_get_scheme instead of glib one and re-indent source file
This commit is contained in:
parent
4cb2910121
commit
167d209688
@ -45,6 +45,7 @@
|
||||
#include "dialog-commodity.h"
|
||||
#include "dialog-totd.h"
|
||||
#include "gnc-ui-util.h"
|
||||
#include "gnc-uri-utils.h"
|
||||
#include "gnc-session.h"
|
||||
#include "qofbookslots.h"
|
||||
#ifdef G_OS_WIN32
|
||||
@ -482,32 +483,33 @@ void
|
||||
gnc_launch_assoc (const char *uri)
|
||||
{
|
||||
wchar_t *winuri = NULL;
|
||||
char* scheme = g_uri_parse_scheme(uri);
|
||||
/* ShellExecuteW open doesn't decode http escapes if it's passed a
|
||||
* file URI so we have to do it. */
|
||||
if (scheme && strcmp (scheme, "file") == 0)
|
||||
if (gnc_uri_is_file_uri (uri))
|
||||
{
|
||||
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
|
||||
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
|
||||
gchar *uri_ue = g_uri_unescape_string (uri, NULL);
|
||||
gchar *filename = gnc_uri_get_path (uri_ue);
|
||||
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
|
||||
g_free (filename);
|
||||
g_free (uri_ue);
|
||||
}
|
||||
else
|
||||
winuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL);
|
||||
winuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL);
|
||||
|
||||
if (winuri)
|
||||
{
|
||||
wchar_t *wincmd = (wchar_t *)g_utf8_to_utf16("open", -1,
|
||||
NULL, NULL, NULL);
|
||||
if ((INT_PTR)ShellExecuteW(NULL, wincmd, winuri,
|
||||
NULL, NULL, SW_SHOWNORMAL) <= 32)
|
||||
{
|
||||
const gchar *message =
|
||||
_("GnuCash could not find the associated file");
|
||||
gnc_error_dialog(NULL, "%s: %s", message, uri);
|
||||
}
|
||||
g_free (wincmd);
|
||||
g_free (winuri);
|
||||
wchar_t *wincmd = (wchar_t *)g_utf8_to_utf16("open", -1,
|
||||
NULL, NULL, NULL);
|
||||
if ((INT_PTR)ShellExecuteW(NULL, wincmd, winuri,
|
||||
NULL, NULL, SW_SHOWNORMAL) <= 32)
|
||||
{
|
||||
const gchar *message =
|
||||
_("GnuCash could not find the associated file");
|
||||
gnc_error_dialog(NULL, "%s: %s", message, uri);
|
||||
}
|
||||
g_free (wincmd);
|
||||
g_free (winuri);
|
||||
}
|
||||
g_free (scheme);
|
||||
}
|
||||
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user