gnucash maint: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Wed Apr 10 06:12:35 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/19bbeaa6 (commit)
via https://github.com/Gnucash/gnucash/commit/d44e0ee7 (commit)
via https://github.com/Gnucash/gnucash/commit/e745f4cf (commit)
via https://github.com/Gnucash/gnucash/commit/57eac14d (commit)
from https://github.com/Gnucash/gnucash/commit/0cce764e (commit)
commit 19bbeaa67ae6953603570a435fdcdf9ae3c6c44f
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Apr 9 17:36:09 2019 +0100
Bug 797185 - Correct the sorting for the Transaction Association Dialog
Change the sort function to use the correct model column.
diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c
index f835e8664..d85998953 100644
--- a/gnucash/gnome/dialog-trans-assoc.c
+++ b/gnucash/gnome/dialog-trans-assoc.c
@@ -100,8 +100,8 @@ sort_iter_compare_func (GtkTreeModel *model,
gint ret = 0;
gchar *uri1, *uri2;
- gtk_tree_model_get (model, a, URI, &uri1, -1);
- gtk_tree_model_get (model, b, URI, &uri2, -1);
+ gtk_tree_model_get (model, a, URI_U, &uri1, -1);
+ gtk_tree_model_get (model, b, URI_U, &uri2, -1);
ret = g_utf8_collate (uri1, uri2);
commit d44e0ee750dd8677ef6979324ef2edc62015f426
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Apr 9 17:32:53 2019 +0100
When displaying paths on MS Windows, make them look normal
Change the forward slashes to back slashes as that is normal for paths
in MS Windows.
diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c
index fbb9a00ae..f835e8664 100644
--- a/gnucash/gnome/dialog-trans-assoc.c
+++ b/gnucash/gnome/dialog-trans-assoc.c
@@ -170,7 +170,12 @@ convert_uri_to_unescaped (AssocDialog *assoc_dialog, const gchar *uri, gchar *sc
file_path = convert_uri_to_filename (assoc_dialog, uri, scheme);
if (file_path)
+ {
uri_u = g_uri_unescape_string (file_path, NULL);
+#ifdef G_OS_WIN32 // make path look like a traditional windows path
+ uri_u = g_strdelimit (uri_u, "/", '\\');
+#endif
+ }
else
uri_u = g_uri_unescape_string (uri, NULL);
@@ -489,7 +494,9 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
gchar *path_head_ue_str = g_uri_unescape_string (assoc_dialog->path_head, NULL);
gchar *path_head_str = gnc_uri_get_path (path_head_ue_str);
gchar *path_head_label;
-
+#ifdef G_OS_WIN32 // make path look like a traditional windows path
+ path_head_str = g_strdelimit (path_head_str, "/", '\\');
+#endif
// test for current folder being present
if (g_file_test (path_head_str, G_FILE_TEST_IS_DIR))
path_head_label = g_strconcat (_("Path head for files is, "), path_head_str, NULL);
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index 84071323c..5f7f0767c 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -1083,7 +1083,13 @@ gsr_default_associate_handler_file (GNCSplitReg *gsr, Transaction *trans, gboole
GtkWidget *label;
gchar *file_uri_u = g_uri_unescape_string (file_uri, NULL);
gchar *filename = gnc_uri_get_path (file_uri_u);
- gchar *uri_label = g_strconcat (_("Existing Association is '"), filename, "'", NULL);
+ gchar *uri_label;
+
+#ifdef G_OS_WIN32 // make path look like a traditional windows path
+ filename = g_strdelimit (filename, "/", '\\');
+#endif
+ uri_label = g_strconcat (_("Existing Association is '"), filename, "'", NULL);
+
PINFO("Path head: '%s', URI: '%s', Filename: '%s'", path_head, uri, filename);
label = gtk_label_new (uri_label);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), label);
diff --git a/gnucash/register/ledger-core/split-register-model.c b/gnucash/register/ledger-core/split-register-model.c
index 287891f7d..f05dcd118 100644
--- a/gnucash/register/ledger-core/split-register-model.c
+++ b/gnucash/register/ledger-core/split-register-model.c
@@ -574,6 +574,11 @@ gnc_split_register_get_associate_tooltip (VirtualLocation virt_loc,
if (gnc_uri_is_file_scheme (scheme)) // absolute path
file_path = gnc_uri_get_path (uri);
+#ifdef G_OS_WIN32 // make path look like a traditional windows path
+ if (file_path)
+ file_path = g_strdelimit (file_path, "/", '\\');
+#endif
+
g_free (scheme);
if (!file_path)
@@ -583,6 +588,7 @@ gnc_split_register_get_associate_tooltip (VirtualLocation virt_loc,
gchar *file_uri_u = g_uri_unescape_string (file_path, NULL);
const gchar *filename = gnc_uri_get_path (file_uri_u);
g_free (file_uri_u);
+ g_free (file_path);
return g_strdup (filename);
}
}
commit e745f4cfeefefab92302678a0f8344e7d344ec3a
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Apr 9 17:29:46 2019 +0100
Fix some transient parent warnings for gnc_launch_assoc
Add a Gtkwindow parent parameter to above function so it can be passed
to the error warning dialog.
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 66900501e..b9066ab35 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -458,7 +458,7 @@ gnc_gnome_help (const char *file_name, const char *anchor)
* toolkit.
*/
void
-gnc_launch_assoc (const char *uri)
+gnc_launch_assoc (GtkWindow *parent, const char *uri)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *uri_str = [NSString stringWithUTF8String: uri];
@@ -473,14 +473,14 @@ gnc_launch_assoc (const char *uri)
return;
}
- gnc_error_dialog(NULL, "%s", message);
+ gnc_error_dialog(parent, "%s", message);
[pool release];
return;
}
#elif defined G_OS_WIN32 /* G_OS_WIN32 */
void
-gnc_launch_assoc (const char *uri)
+gnc_launch_assoc (GtkWindow *parent, const char *uri)
{
wchar_t *winuri = NULL;
gchar *filename = NULL;
@@ -506,7 +506,7 @@ gnc_launch_assoc (const char *uri)
{
const gchar *message =
_("GnuCash could not find the associated file");
- gnc_error_dialog(NULL, "%s:\n%s", message, filename);
+ gnc_error_dialog(parent, "%s:\n%s", message, filename);
}
g_free (wincmd);
g_free (winuri);
@@ -516,7 +516,7 @@ gnc_launch_assoc (const char *uri)
#else
void
-gnc_launch_assoc (const char *uri)
+gnc_launch_assoc (GtkWindow *parent, const char *uri)
{
GError *error = NULL;
gboolean success;
@@ -550,7 +550,7 @@ gnc_launch_assoc (const char *uri)
else
error_uri = g_strdup (uri);
- gnc_error_dialog(NULL, "%s\n%s", message, error_uri);
+ gnc_error_dialog(parent, "%s\n%s", message, error_uri);
g_free (error_uri);
}
PERR ("%s", error->message);
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.h b/gnucash/gnome-utils/gnc-gnome-utils.h
index d0ffe2e88..75fcf1226 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.h
+++ b/gnucash/gnome-utils/gnc-gnome-utils.h
@@ -58,13 +58,13 @@ void gnc_gnome_help (const char *file_name,
const char *anchor);
/** Launch the default gnome browser and open the provided URI.
*/
-void gnc_launch_assoc (const char *uri);
+void gnc_launch_assoc (GtkWindow *parent, const char *uri);
/** Set the help callback to 'gnc_book_options_help_cb' to open a help browser
* and point it to the Book Options link in the Help file.
*/
void gnc_options_dialog_set_book_options_help_cb (GNCOptionWin *win);
-
+
/** Set the initial values of new book options to values specified in user
* preferences.
*/
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 6b1e69f05..bc9a38e36 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -4449,7 +4449,7 @@ get_file_strsplit (const gchar *partial)
static gboolean
url_signal_cb (GtkAboutDialog *dialog, gchar *uri, gpointer data)
{
- gnc_launch_assoc (uri);
+ gnc_launch_assoc (GTK_WINDOW(dialog), uri);
return TRUE;
}
diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c
index 5db3fc239..fbb9a00ae 100644
--- a/gnucash/gnome/dialog-trans-assoc.c
+++ b/gnucash/gnome/dialog-trans-assoc.c
@@ -303,7 +303,7 @@ row_selected_cb (GtkTreeView *view, GtkTreePath *path,
if (uri_out_scheme) // make sure we have a scheme entry
{
- gnc_launch_assoc (uri_out);
+ gnc_launch_assoc (gnc_ui_get_gtk_window(GTK_WIDGET (view)), uri_out);
g_free (uri_out_scheme);
}
else
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index 6a30ca880..84071323c 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -1368,7 +1368,7 @@ gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
if (uri_scheme) // make sure we have a scheme entry
{
- gnc_launch_assoc (run_uri);
+ gnc_launch_assoc (GTK_WINDOW (gsr->window), run_uri);
g_free (uri_scheme);
}
else
commit 57eac14d82b6cb7acfa043546dedb63c3dc21f74
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Tue Apr 9 17:23:20 2019 +0100
Bug 797183 - association head path with spaces displayed wrong
The Transaction Association path head was being displayed with '%20' as
the space as it was not being unescaped. Fixed by unescaping and also
noticed that the error message string were wrong also.
diff --git a/gnucash/gnome-utils/gnc-gnome-utils.c b/gnucash/gnome-utils/gnc-gnome-utils.c
index 008c9f62b..66900501e 100644
--- a/gnucash/gnome-utils/gnc-gnome-utils.c
+++ b/gnucash/gnome-utils/gnc-gnome-utils.c
@@ -483,14 +483,15 @@ void
gnc_launch_assoc (const char *uri)
{
wchar_t *winuri = NULL;
+ gchar *filename = NULL;
/* ShellExecuteW open doesn't decode http escapes if it's passed a
* file URI so we have to do it. */
if (gnc_uri_is_file_uri (uri))
{
gchar *uri_ue = g_uri_unescape_string (uri, NULL);
- gchar *filename = gnc_uri_get_path (uri_ue);
+ filename = gnc_uri_get_path (uri_ue);
+ filename = g_strdelimit (filename, "/", '\\'); // needed for unc paths
winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
- g_free (filename);
g_free (uri_ue);
}
else
@@ -505,10 +506,11 @@ gnc_launch_assoc (const char *uri)
{
const gchar *message =
_("GnuCash could not find the associated file");
- gnc_error_dialog(NULL, "%s: %s", message, uri);
+ gnc_error_dialog(NULL, "%s:\n%s", message, filename);
}
g_free (wincmd);
g_free (winuri);
+ g_free (filename);
}
}
@@ -533,9 +535,23 @@ gnc_launch_assoc (const char *uri)
g_assert(error != NULL);
{
+ gchar *error_uri = NULL;
const gchar *message =
_("GnuCash could not open the associated URI:");
- gnc_error_dialog(NULL, "%s\n%s", message, uri);
+
+ if (gnc_uri_is_file_uri (uri))
+ {
+ gchar *uri_ue = g_uri_unescape_string (uri, NULL);
+ gchar *filename = gnc_uri_get_path (uri_ue);
+ error_uri = g_strdup (filename);
+ g_free (uri_ue);
+ g_free (filename);
+ }
+ else
+ error_uri = g_strdup (uri);
+
+ gnc_error_dialog(NULL, "%s\n%s", message, error_uri);
+ g_free (error_uri);
}
PERR ("%s", error->message);
g_error_free(error);
diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c
index 8be470317..5db3fc239 100644
--- a/gnucash/gnome/dialog-trans-assoc.c
+++ b/gnucash/gnome/dialog-trans-assoc.c
@@ -486,7 +486,8 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
if (assoc_dialog->path_head && g_strcmp0 (assoc_dialog->path_head, "") != 0) // not default entry
{
- gchar *path_head_str = gnc_uri_get_path (assoc_dialog->path_head);
+ gchar *path_head_ue_str = g_uri_unescape_string (assoc_dialog->path_head, NULL);
+ gchar *path_head_str = gnc_uri_get_path (path_head_ue_str);
gchar *path_head_label;
// test for current folder being present
@@ -499,6 +500,7 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
gtk_label_set_text (GTK_LABEL(path_head), path_head_label);
g_free (path_head_label);
g_free (path_head_str);
+ g_free (path_head_ue_str);
}
else
{
Summary of changes:
gnucash/gnome-utils/gnc-gnome-utils.c | 32 ++++++++++++++++------
gnucash/gnome-utils/gnc-gnome-utils.h | 4 +--
gnucash/gnome-utils/gnc-main-window.c | 2 +-
gnucash/gnome/dialog-trans-assoc.c | 19 +++++++++----
gnucash/gnome/gnc-split-reg.c | 10 +++++--
.../register/ledger-core/split-register-model.c | 6 ++++
6 files changed, 55 insertions(+), 18 deletions(-)
More information about the gnucash-changes
mailing list