[Gnucash-changes] r14320 - gnucash/trunk - Bug#333299: Handle
selections more correctly in a utf8 world, within GnuCash at least.
Joshua Sled
jsled at cvs.gnucash.org
Sun Jun 4 14:27:25 EDT 2006
Author: jsled
Date: 2006-06-04 14:27:24 -0400 (Sun, 04 Jun 2006)
New Revision: 14320
Trac: http://svn.gnucash.org/trac/changeset/14320
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c
Log:
Bug#333299: Handle selections more correctly in a utf8 world, within GnuCash at least.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-06-04 15:01:33 UTC (rev 14319)
+++ gnucash/trunk/ChangeLog 2006-06-04 18:27:24 UTC (rev 14320)
@@ -1,5 +1,11 @@
2006-06-04 Joshua Sled <jsled at 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)
(ld_get_ppmt_formula, ld_get_ipmt_formula): Treat all numbers in a
auto-decimal-point-safe way. Bug#343795.
Modified: gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c 2006-06-04 15:01:33 UTC (rev 14319)
+++ gnucash/trunk/src/register/register-gnome/gnucash-item-edit.c 2006-06-04 18:27:24 UTC (rev 14320)
@@ -1436,7 +1436,7 @@
void
-gnc_item_edit_selection_get (GncItemEdit *item_edit,
+gnc_item_edit_selection_get (GncItemEdit *item_edit,
GtkSelectionData *selection_data,
guint info,
guint time)
@@ -1486,9 +1486,11 @@
c = str[length];
str[length] = '\0';
- gdk_string_to_compound_text(str, &encoding, &format,
- &text, &new_length);
-
+ gdk_utf8_to_compound_text(str, &encoding, &format,
+ &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,
format, text, new_length);
@@ -1520,32 +1522,38 @@
editable = GTK_EDITABLE(item_edit->editor);
if (selection_data->type == GDK_TARGET_STRING)
+ {
type = STRING;
- else if ((selection_data->type ==
- gdk_atom_intern("COMPOUND_TEXT", FALSE)) ||
- (selection_data->type == gdk_atom_intern("TEXT", FALSE)))
+ }
+ else if (selection_data->type == gdk_atom_intern("COMPOUND_TEXT", FALSE)
+ || selection_data->type == gdk_atom_intern("TEXT", FALSE))
+ {
type = CTEXT;
+ }
else
+ {
type = INVALID;
+ }
if (type == INVALID || selection_data->length < 0)
{
/* avoid infinite loop */
if (selection_data->target != GDK_TARGET_STRING)
+ {
gtk_selection_convert(GTK_WIDGET(item_edit->sheet),
selection_data->selection,
GDK_TARGET_STRING, time);
+ }
return;
}
reselect = FALSE;
- if (gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel) &&
- (!item_edit->has_selection ||
- (selection_data->selection == clipboard_atom)))
+ if (gtk_editable_get_selection_bounds(editable, &start_sel, &end_sel)
+ && (!item_edit->has_selection
+ || selection_data->selection == clipboard_atom))
{
reselect = TRUE;
-
gtk_editable_delete_text(editable, start_sel, end_sel);
}
@@ -1568,7 +1576,7 @@
gint count;
gint i;
- count = gdk_text_property_to_text_list
+ count = gdk_text_property_to_utf8_list
(selection_data->type, selection_data->format,
selection_data->data, selection_data->length,
&list);
@@ -1579,7 +1587,6 @@
list[i],
strlen(list[i]),
&tmp_pos);
-
gtk_editable_set_position(editable, tmp_pos);
}
More information about the gnucash-changes
mailing list