aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2010-11-03 14:45:17 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2010-11-03 14:45:17 +0000
commit21f998ddf38bda65348d765bf045dd48864e362e (patch)
tree831f72a75e3dedacb5ee26e5ef0ded30f4520d52
parent160fcdfd8b822d5de7e008309038427212ad9e56 (diff)
Use g_utf16_toutf8() instead of utf_16to8() to avoid the last display filter
applied from being overwritten. Fixes bug 3894. Also, combined the open and merge filters into one, so we have a single most recently used filter. svn path=/trunk/; revision=34759
-rw-r--r--gtk/file_dlg_win32.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/gtk/file_dlg_win32.c b/gtk/file_dlg_win32.c
index d7fb28df96..3ce1a6b8fe 100644
--- a/gtk/file_dlg_win32.c
+++ b/gtk/file_dlg_win32.c
@@ -138,8 +138,7 @@ static print_args_t print_args;
* being opened/saved/etc.).
*/
static HWND g_sf_hwnd = NULL;
-static char *dfilter_open_str = NULL;
-static char *dfilter_merge_str = NULL;
+static char *dfilter_str = NULL;
gboolean
win32_open_file (HWND h_wnd) {
@@ -225,7 +224,7 @@ win32_open_file (HWND h_wnd) {
}
/* apply our filter */
- if (dfilter_compile(dfilter_open_str, &dfp)) {
+ if (dfilter_compile(dfilter_str, &dfp)) {
cf_set_rfcode(&cfile, dfp);
}
@@ -479,7 +478,7 @@ win32_merge_file (HWND h_wnd) {
}
/* apply our filter */
- if (dfilter_compile(dfilter_merge_str, &dfp)) {
+ if (dfilter_compile(dfilter_str, &dfp)) {
cf_set_rfcode(&cfile, dfp);
}
@@ -1095,11 +1094,11 @@ filter_tb_get(HWND hwnd) {
len++;
strval = g_malloc(len*sizeof(TCHAR));
len = GetWindowText(hwnd, strval, len);
- ret = utf_16to8(strval);
+ ret = g_utf16_to_utf8(strval, -1, NULL, NULL, NULL);
g_free(strval);
return ret;
} else {
- return "";
+ return NULL;
}
}
@@ -1160,9 +1159,9 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
switch(msg) {
case WM_INITDIALOG:
/* Retain the filter text, and fill it in. */
- if(dfilter_open_str != NULL) {
+ if(dfilter_str != NULL) {
cur_ctrl = GetDlgItem(of_hwnd, EWFD_FILTER_EDIT);
- SetWindowText(cur_ctrl, utf_8to16(dfilter_open_str));
+ SetWindowText(cur_ctrl, utf_8to16(dfilter_str));
}
/* Fill in our resolution values */
@@ -1180,7 +1179,9 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
case CDN_FILEOK:
/* Fetch the read filter */
cur_ctrl = GetDlgItem(of_hwnd, EWFD_FILTER_EDIT);
- dfilter_open_str = filter_tb_get(cur_ctrl);
+ if (dfilter_str)
+ g_free(dfilter_str);
+ dfilter_str = filter_tb_get(cur_ctrl);
/* Fetch our resolution values */
gbl_resolv_flags = prefs.name_resolve & RESOLV_CONCURRENT;
@@ -1753,9 +1754,9 @@ merge_file_hook_proc(HWND mf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
switch(msg) {
case WM_INITDIALOG:
/* Retain the filter text, and fill it in. */
- if(dfilter_merge_str != NULL) {
+ if(dfilter_str != NULL) {
cur_ctrl = GetDlgItem(mf_hwnd, EWFD_FILTER_EDIT);
- SetWindowText(cur_ctrl, utf_8to16(dfilter_merge_str));
+ SetWindowText(cur_ctrl, utf_8to16(dfilter_str));
}
/* Append by default */
@@ -1770,7 +1771,9 @@ merge_file_hook_proc(HWND mf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
case CDN_FILEOK:
/* Fetch the read filter */
cur_ctrl = GetDlgItem(mf_hwnd, EWFD_FILTER_EDIT);
- dfilter_merge_str = filter_tb_get(cur_ctrl);
+ if (dfilter_str)
+ g_free(dfilter_str);
+ dfilter_str = filter_tb_get(cur_ctrl);
cur_ctrl = GetDlgItem(mf_hwnd, EWFD_MERGE_CHRONO_BTN);
if(SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED) {