mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug#333299: Handle selections more correctly in a utf8 world, within GnuCash at least.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14320 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
32cf6165e4
commit
003e41da06
@ -1,5 +1,11 @@
|
|||||||
2006-06-04 Joshua Sled <jsled@asynchronous.org>
|
2006-06-04 Joshua Sled <jsled@asynchronous.org>
|
||||||
|
|
||||||
|
* src/register/register-gnome/gnucash-item-edit.c
|
||||||
|
(gnc_item_edit_selection_get),
|
||||||
|
(gnc_item_edit_selection_received): Handle selections more
|
||||||
|
correctly in a utf8 world, within GnuCash at least. Fixes
|
||||||
|
Bug#333299.
|
||||||
|
|
||||||
* src/gnome/druid-loan.c (ld_get_pmt_formula)
|
* src/gnome/druid-loan.c (ld_get_pmt_formula)
|
||||||
(ld_get_ppmt_formula, ld_get_ipmt_formula): Treat all numbers in a
|
(ld_get_ppmt_formula, ld_get_ipmt_formula): Treat all numbers in a
|
||||||
auto-decimal-point-safe way. Bug#343795.
|
auto-decimal-point-safe way. Bug#343795.
|
||||||
|
@ -1436,7 +1436,7 @@ gnc_item_edit_selection_clear (GncItemEdit *item_edit,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_item_edit_selection_get (GncItemEdit *item_edit,
|
gnc_item_edit_selection_get (GncItemEdit *item_edit,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint info,
|
guint info,
|
||||||
guint time)
|
guint time)
|
||||||
@ -1486,9 +1486,11 @@ gnc_item_edit_selection_get (GncItemEdit *item_edit,
|
|||||||
c = str[length];
|
c = str[length];
|
||||||
str[length] = '\0';
|
str[length] = '\0';
|
||||||
|
|
||||||
gdk_string_to_compound_text(str, &encoding, &format,
|
gdk_utf8_to_compound_text(str, &encoding, &format,
|
||||||
&text, &new_length);
|
&text, &new_length);
|
||||||
|
// for some reason, format is set to '0', which makes GTK
|
||||||
|
// complain. -- jsled
|
||||||
|
format = 8;
|
||||||
gtk_selection_data_set(selection_data, encoding,
|
gtk_selection_data_set(selection_data, encoding,
|
||||||
format, text, new_length);
|
format, text, new_length);
|
||||||
|
|
||||||
@ -1520,32 +1522,38 @@ gnc_item_edit_selection_received (GncItemEdit *item_edit,
|
|||||||
editable = GTK_EDITABLE(item_edit->editor);
|
editable = GTK_EDITABLE(item_edit->editor);
|
||||||
|
|
||||||
if (selection_data->type == GDK_TARGET_STRING)
|
if (selection_data->type == GDK_TARGET_STRING)
|
||||||
|
{
|
||||||
type = STRING;
|
type = STRING;
|
||||||
else if ((selection_data->type ==
|
}
|
||||||
gdk_atom_intern("COMPOUND_TEXT", FALSE)) ||
|
else if (selection_data->type == gdk_atom_intern("COMPOUND_TEXT", FALSE)
|
||||||
(selection_data->type == gdk_atom_intern("TEXT", FALSE)))
|
|| selection_data->type == gdk_atom_intern("TEXT", FALSE))
|
||||||
|
{
|
||||||
type = CTEXT;
|
type = CTEXT;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
type = INVALID;
|
type = INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == INVALID || selection_data->length < 0)
|
if (type == INVALID || selection_data->length < 0)
|
||||||
{
|
{
|
||||||
/* avoid infinite loop */
|
/* avoid infinite loop */
|
||||||
if (selection_data->target != GDK_TARGET_STRING)
|
if (selection_data->target != GDK_TARGET_STRING)
|
||||||
|
{
|
||||||
gtk_selection_convert(GTK_WIDGET(item_edit->sheet),
|
gtk_selection_convert(GTK_WIDGET(item_edit->sheet),
|
||||||
selection_data->selection,
|
selection_data->selection,
|
||||||
GDK_TARGET_STRING, time);
|
GDK_TARGET_STRING, time);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
reselect = FALSE;
|
reselect = FALSE;
|
||||||
|
|
||||||
if (gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel) &&
|
if (gtk_editable_get_selection_bounds(editable, &start_sel, &end_sel)
|
||||||
(!item_edit->has_selection ||
|
&& (!item_edit->has_selection
|
||||||
(selection_data->selection == clipboard_atom)))
|
|| selection_data->selection == clipboard_atom))
|
||||||
{
|
{
|
||||||
reselect = TRUE;
|
reselect = TRUE;
|
||||||
|
|
||||||
gtk_editable_delete_text(editable, start_sel, end_sel);
|
gtk_editable_delete_text(editable, start_sel, end_sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1568,7 +1576,7 @@ gnc_item_edit_selection_received (GncItemEdit *item_edit,
|
|||||||
gint count;
|
gint count;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
count = gdk_text_property_to_text_list
|
count = gdk_text_property_to_utf8_list
|
||||||
(selection_data->type, selection_data->format,
|
(selection_data->type, selection_data->format,
|
||||||
selection_data->data, selection_data->length,
|
selection_data->data, selection_data->length,
|
||||||
&list);
|
&list);
|
||||||
@ -1579,7 +1587,6 @@ gnc_item_edit_selection_received (GncItemEdit *item_edit,
|
|||||||
list[i],
|
list[i],
|
||||||
strlen(list[i]),
|
strlen(list[i]),
|
||||||
&tmp_pos);
|
&tmp_pos);
|
||||||
|
|
||||||
gtk_editable_set_position(editable, tmp_pos);
|
gtk_editable_set_position(editable, tmp_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user